[ { "file_name": "Pulse.Lib.Par.Pledge.fsti", "name": "Pulse.Lib.Par.Pledge.ustep0", "opens_and_abbrevs": [ { "open": "Pulse.Lib.InvList" }, { "open": "Pulse.Lib.Pervasives" }, { "open": "Pulse.Lib.Par" }, { "open": "Pulse.Lib.Par" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let ustep0 (p q : vprop)\n = unit -> stt_ghost unit p (fun _ -> q)", "source_range": { "start_line": 27, "start_col": 0, "end_line": 28, "end_col": 41 }, "interleaved": false, "definition": "fun p q -> _: Prims.unit -> Pulse.Lib.Core.stt_ghost Prims.unit p (fun _ -> q)", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Lib.Core.vprop", "Prims.unit", "Pulse.Lib.Core.stt_ghost" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "prompt": "let ustep0 (p q: vprop) =\n ", "expected_response": "unit -> stt_ghost unit p (fun _ -> q)", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/pledge/Pulse.Lib.Par.Pledge.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.Par.Pledge.fsti", "checked_file": "dataset/Pulse.Lib.Par.Pledge.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Pulse.Lib.Pervasives.fst.checked", "dataset/Pulse.Lib.InvList.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "val pledge (is:invlist) (f:vprop) (v:vprop) : vprop", "let ustep (is:invlist) (p q : vprop)\n = unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q)" ], "closest": [ "val Pulse.Lib.Par.Pledge.Simple.ustep = is: Pulse.Lib.InvList.invlist -> p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type\nlet ustep (is:invlist) (p q : vprop)\n = unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q)", "val Pulse.Lib.Reference.cond = b: Prims.bool -> p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet cond b (p q:vprop) = if b then p else q", "val Pulse.Lib.Forall.token = v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet token (v:vprop) = v", "val Pulse.Lib.Forall.universal_quantifier = v: Pulse.Lib.Core.vprop -> p: (_: a -> Pulse.Lib.Core.vprop) -> Type\nlet universal_quantifier #a (v:vprop) (p: a -> vprop) =\n x:a -> stt_ghost unit v (fun _ -> p x)", "val PulseCore.Heap.hheap = p: PulseCore.Heap.slprop -> Type\nlet hheap (p:slprop u#a) = m:heap u#a {interp p m}", "val Pulse.Lib.Forall.is_forall = v: Pulse.Lib.Core.vprop -> p: (_: a -> Pulse.Lib.Core.vprop) -> Type0\nlet is_forall #a (v:vprop) (p:a -> vprop) =\n squash (universal_quantifier #a v p)", "val PulseCore.Action.thunk = p: PulseCore.InstantiatedSemantics.slprop -> _: Prims.unit -> PulseCore.InstantiatedSemantics.slprop\nlet thunk (p:slprop) = fun (_:unit) -> p", "val PulseCore.Heap.stronger = p: PulseCore.Heap.slprop -> q: PulseCore.Heap.slprop -> Prims.logical\nlet stronger (p q:slprop) =\n forall h. interp p h ==> interp q h", "val PulseCore.Heap.pure = p: Prims.prop -> PulseCore.Heap.slprop\nlet pure (p:prop) = h_refine emp (fun _ -> p)", "val PulseCore.Heap.hprop = fp: PulseCore.Heap.slprop -> Type\nlet hprop (fp:slprop u#a) =\n q:(heap u#a -> prop){\n forall (h0:heap{interp fp h0}) (h1:heap{disjoint h0 h1}).\n q h0 <==> q (join h0 h1)\n }", "val PulseCore.Memory.hmem = p: PulseCore.Memory.slprop -> Type\nlet hmem (p:slprop u#a) = m:mem u#a {interp p m}", "val Pulse.Checker.Prover.Base.vprop_typing = g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term -> Type0\nlet vprop_typing (g:env) (t:term) = tot_typing g t tm_vprop", "val PulseCore.Memory.mprop = fp: PulseCore.Memory.slprop -> Type\nlet mprop (fp:slprop u#a) =\n q:(mem u#a -> prop){\n forall (m0:mem{interp fp m0}) (m1:mem{disjoint m0 m1}).\n q m0 <==> q (join m0 m1)}", "val Pulse.Lib.Par.Pledge.inv_p' = \n is: Pulse.Lib.InvList.invlist ->\n f: Pulse.Lib.Core.vprop ->\n v1: Pulse.Lib.Core.vprop ->\n v2: Pulse.Lib.Core.vprop ->\n r1: Pulse.Lib.GhostReference.ref Prims.bool ->\n r2: Pulse.Lib.GhostReference.ref Prims.bool ->\n b1: Prims.bool ->\n b2: Prims.bool\n -> Pulse.Lib.Core.vprop\nlet inv_p' (is:invlist) (f v1 v2 : vprop) (r1 r2 : GR.ref bool) (b1 b2 : bool) =\n GR.pts_to r1 #one_half b1\n ** GR.pts_to r2 #one_half b2\n ** (match b1, b2 with\n | false, false -> pledge is f (v1 ** v2)\n | false, true -> v1\n | true, false -> v2\n | true, true -> emp)", "val Pulse.Typing.prop_validity = g: Pulse.Typing.Env.env -> t: Pulse.Syntax.Base.term -> Type0\nlet prop_validity (g:env) (t:term) =\n FTB.prop_validity_token (elab_env g) (elab_term t)", "val Steel.Effect.Common.t_of = p: Steel.Effect.Common.vprop -> Type0\nlet rec t_of (p:vprop) = match p with\n | VUnit p -> p.t\n | VStar p1 p2 -> t_of p1 * t_of p2", "val Steel.Effect.Common.hmem = p: Steel.Effect.Common.vprop -> Type\nlet hmem (p:vprop) = hmem (hp_of p)", "val PulseCore.Heap.sl_implies = p: PulseCore.Heap.slprop -> q: PulseCore.Heap.slprop -> Prims.logical\nlet sl_implies (p q:slprop) = forall m. interp p m ==> interp q m", "val ( ** ) (p q:vprop) : vprop\nlet op_Star_Star = op_Star_Star", "val equiv (p q:vprop) : prop\nlet equiv (p q:vprop) : prop = Mem.equiv (hp_of p) (hp_of q) /\\ True", "val uquant (#a: Type u#a) (p: (a -> vprop)) : vprop\nlet uquant (#a:Type u#a) (p: a -> vprop)\n: vprop\n= exists* (v:vprop).\n pure (is_forall v p) **\n token v", "val Pulse.Lib.HigherArray.token = x: 'a -> Pulse.Lib.Core.vprop\nlet token (x:'a) = emp", "val Vale.AsLowStar.ValeSig.sprop = Type\nlet sprop = VS.vale_state -> prop", "val Steel.Effect.Common.to_vprop = p: Steel.Memory.slprop -> Steel.Effect.Common.vprop\nlet to_vprop (p:slprop) = VUnit (to_vprop' p)", "val Pulse.Lib.InvList.invlist0 = Type\nlet invlist0 = list invlist_elem", "val Steel.Heap.hheap = p: Steel.Heap.slprop -> Type\nlet hheap (p:slprop u#a) = m:heap u#a {interp p m}", "val inv (p:vprop) : Type0\nlet inv (p:vprop) = r:ghost_ref bool & inv (ex_conditional_inv r p)", "val ConstructiveLogic.ex2 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex2 (p q : prop) =\n assert (p ==> q ==> p)\n by (let bp = implies_intro () in\n let _ = implies_intro () in\n hyp (binding_to_namedv bp);\n qed ())", "val Pulse.Lib.InvList.invlist_elem = Type\nlet invlist_elem = p:vprop & inv p", "val Pulse.Syntax.Builder.mk_assert_hint_type = p: Pulse.Syntax.Base.vprop -> Pulse.Syntax.Base.proof_hint_type\nlet mk_assert_hint_type p = ASSERT { p }", "val ConstructiveLogic.ex5 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex5 (p q : prop) =\n assert (p ==> p \\/ q)\n by (let bp = implies_intro () in\n left ();\n hyp (binding_to_namedv bp);\n qed ())", "val Steel.Effect.Common.to_vprop' = p: Steel.Memory.slprop -> Steel.Effect.Common.vprop'\nlet to_vprop' (p:slprop) = {hp = p; t = unit; sel = fun _ -> ()}", "val Steel.Memory.hmem = p: Steel.Memory.slprop -> Type\nlet hmem (p:slprop u#a) = m:mem u#a {interp p m}", "val ConstructiveLogic.ex8 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex8 (p q : prop) =\n assert ((p ==> q) ==> p ==> q)\n by (let i = implies_intro () in\n let h = implies_intro () in\n mapply i;\n mapply h;\n qed ())", "val PulseCore.Action.property = a: Type -> Type\nlet property (a:Type)\r\n = a -> prop", "val ConstructiveLogic.ex3 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex3 (p q : prop) =\n assert (p ==> q ==> q /\\ p)\n by (let bp = implies_intro () in\n let bq = implies_intro () in\n split ();\n (* Now we have two goals: q and p *)\n hyp (binding_to_namedv bq);\n (* Only one goal left, p *)\n hyp (binding_to_namedv bp);\n (* Done! *)\n qed ())", "val ConstructiveLogic.ex7 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex7 (p q : prop) =\n assert (p \\/ q ==> q \\/ p)\n by (let bp_or_q = implies_intro () in\n cases_or (binding_to_term bp_or_q);\n (* first case *)\n let bp = implies_intro () in\n right ();\n hyp (binding_to_namedv bp);\n (* second case *)\n let bq = implies_intro () in\n left ();\n hyp (binding_to_namedv bq);\n qed ())", "val inv (p:vprop) : Type u#0\nlet inv = Act.inv", "val Pulse.Typing.comp_typing_u = e: Pulse.Typing.Env.env -> c: Pulse.Syntax.Base.comp_st -> Type0\nlet comp_typing_u (e:env) (c:comp_st) = comp_typing e c (universe_of_comp c)", "val vprop : Type u#2\nlet vprop = slprop", "val ConstructiveLogic.ex4 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex4 (p q : prop) =\n assert (p /\\ q ==> p)\n by (let h = implies_intro () in\n let (bp, bq) = destruct_and (binding_to_term h) in\n hyp (binding_to_namedv bp);\n qed ())", "val PulseCore.Memory.h_or = p1: PulseCore.Heap.slprop -> p2: PulseCore.Heap.slprop -> PulseCore.Heap.slprop\nlet h_or = H.h_or", "val Pulse.Typing.comp_intro_pure = p: Pulse.Syntax.Base.term -> Pulse.Syntax.Base.comp\nlet comp_intro_pure (p:term) =\n C_STGhost {\n u=u_zero;\n res=tm_unit;\n pre=tm_emp;\n post=tm_pure p\n }", "val Pulse.Typing.tm_prop = Pulse.Syntax.Base.term\nlet tm_prop = with_range (Tm_FStar FStar.Reflection.Typing.tm_prop) Range.range_0", "val Pulse.Lib.PCM.Map.map = k: Prims.eqtype -> v: Type -> Type\nlet map (k:eqtype) (v:Type) =\n m:Map.t k v {\n Map.domain m `Set.equal` Set.complement Set.empty\n }", "val Steel.Effect.Common.pure = p: Prims.prop -> Steel.Effect.Common.vprop\nlet pure (p:prop) = to_vprop (pure p)", "val inv (p: vprop) : Type0\nlet inv (p:vprop) : Type0 = Mem.inv (hp_of p)", "val ConstructiveLogic.ex6 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex6 (p q : prop) =\n assert (p ==> q \\/ p)\n by (let bp = implies_intro () in\n right ();\n hyp (binding_to_namedv bp);\n qed ())", "val Pulse.Lib.InvList.invlist = Type\nlet invlist =\n i:invlist0{invlist_nodups i}", "val Pulse.Lib.Core.inames = Type0\nlet inames = erased (FStar.Set.set iname)", "val Pulse.Syntax.Base.tm_vprop = Pulse.Syntax.Base.term\nlet tm_vprop = with_range Tm_VProp FStar.Range.range_0", "val SelectorLogic.wand = p: SelectorLogic.vprop -> q: SelectorLogic.vprop -> SelectorLogic.vprop\nlet wand (p q:vprop) =\n {hp = p.hp `Mem.wand` q.hp;\n t = (fun m -> ((x:left_wand_t m p) -> GTot (q.t (join m (dfst x)))));\n sel = fun m0 -> fun (| h, vp |) -> q.sel (join m0 h)\n }", "val Steel.Heap.stronger = p: Steel.Heap.slprop -> q: Steel.Heap.slprop -> Prims.logical\nlet stronger (p q:slprop) =\n forall h. interp p h ==> interp q h", "val PulseCore.Memory.h_and = p1: PulseCore.Heap.slprop -> p2: PulseCore.Heap.slprop -> PulseCore.Heap.slprop\nlet h_and = H.h_and", "val PulseCore.Heap.full_hheap = fp: PulseCore.Heap.slprop -> Type\nlet full_hheap fp = h:hheap fp { full_heap_pred h }", "val Pulse.Lib.SpinLock.maybe = b: Prims.bool -> p: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet maybe (b:bool) (p:vprop) =\n if b then p else emp", "val Pulse.Typing.tot_typing = g: Pulse.Typing.Env.env -> e: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.term -> Type0\nlet tot_typing (g:env) (e:term) (t:term) =\n typing g e T.E_Total t", "val PulseCore.Action.stable_property = pcm: FStar.PCM.pcm a -> Type\nlet stable_property (#a:Type) (pcm:pcm a)\r\n = fact:property a {\r\n FStar.Preorder.stable fact (PP.preorder_of_pcm pcm)\r\n }", "val PulseCore.Heap.a_heap_prop = Type\nlet a_heap_prop = p:(heap -> prop) { heap_prop_is_affine p }", "val Pulse.Typing.subtyping_token = g: Pulse.Typing.Env.env -> t1: Pulse.Syntax.Base.term -> t2: Pulse.Syntax.Base.term -> Type0\nlet subtyping_token g t1 t2 =\n T.subtyping_token (elab_env g) (elab_term t1) (elab_term t2)", "val ConstructiveLogic.ex1_qed = p: Prims.prop -> Prims.unit\nlet ex1_qed (p : prop) =\n assert (p ==> p)\n by (let b = implies_intro () in\n hyp (binding_to_namedv b);\n qed ())", "val vprop_equiv (p q:vprop) : prop\nlet vprop_equiv = slprop_equiv", "val Steel.Effect.Common.vdep = v: Steel.Effect.Common.vprop -> p: (_: Steel.Effect.Common.t_of v -> Steel.Effect.Common.vprop)\n -> Steel.Effect.Common.vprop\nlet vdep (v: vprop) (p: ( (t_of v) -> Tot vprop)) = VUnit (vdep' v p)", "val Pulse.Typing.post_hint_for_env_p = g: Pulse.Typing.Env.env -> p: Pulse.Typing.post_hint_t -> Prims.logical\nlet post_hint_for_env_p (g:env) (p:post_hint_t) = g `env_extends` p.g", "val PulseCore.Memory.wand = p1: PulseCore.Heap.slprop -> p2: PulseCore.Heap.slprop -> PulseCore.Heap.slprop\nlet wand = H.wand", "val PulseTutorial.Ghost.correlated = x: Pulse.Lib.Reference.ref a -> y: Pulse.Lib.GhostReference.ref a -> v: a -> Pulse.Lib.Core.vprop\nlet correlated #a (x:ref a) (y:GR.ref a) (v:a)=\r\n pts_to x v ** GR.pts_to y #one_half v", "val Pulse.Lib.CancellableInvariant.cancellable = t: Pulse.Lib.CancellableInvariant.token -> v: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet cancellable (t:token) (v:vprop) =\n exists* b.\n maybe b v **\n GR.pts_to t #(half_perm full_perm) b", "val PulseCore.Heap.equiv = p1: PulseCore.Heap.slprop -> p2: PulseCore.Heap.slprop -> Prims.logical\nlet equiv (p1 p2:slprop) =\n forall m. interp p1 m <==> interp p2 m", "val Steel.Effect.Common.hp_of = p: Steel.Effect.Common.vprop -> Steel.Memory.slprop\nlet rec hp_of (p:vprop) = match p with\n | VUnit p -> p.hp\n | VStar p1 p2 -> hp_of p1 `Mem.star` hp_of p2", "val ConstructiveLogic.ex14 = a: Type -> p: (_: a -> Prims.prop) -> q: (_: a -> Prims.prop) -> Prims.unit\nlet ex14 (a:Type) (p q : a -> prop) =\n assert ((forall x. p x ==> q x) ==> (forall x. p x) ==> (forall x. q x))\n by (smt ())", "val vprop_post_equiv (#t:Type u#a) (p q: t -> vprop) : prop\nlet vprop_post_equiv = slprop_post_equiv", "val Pulse.Soundness.VPropEquiv.vprop_equiv_sym_type = FStar.Stubs.Reflection.Types.term\nlet vprop_equiv_sym_type = \n let var0 = 0 in\n let v0 = mk_name var0 in\n let var1 = 1 in\n let v1 = mk_name var1 in\n let v_typ = elab_term tm_vprop in\n mk_arrow \n (v_typ, R.Q_Implicit)\n (RT.close_term\n (mk_arrow\n (v_typ, R.Q_Implicit)\n (RT.close_term \n (mk_arrow\n (stt_vprop_equiv v0 v1, R.Q_Explicit)\n (stt_vprop_equiv v0 v1)) var1))\n var0)", "val prop_and (p1 p2: prop) : Tot prop\nlet prop_and (p1 p2: prop) : Tot prop = p1 /\\ p2", "val Pulse.Reflection.Util.vprop_fv = FStar.Stubs.Reflection.Types.fv\nlet vprop_fv = R.pack_fv vprop_lid", "val Vale.Def.Prop_s.prop0 = Type\nlet prop0 = Type0", "val pure (p: prop) : vprop\nlet pure = pure", "val ifProp: #p:Type0 -> b:Type0 -> e1:squash p -> e2:squash p -> GTot (squash p)\nlet ifProp #p b e1 e2 =\n bind_squash (excluded_middle_squash b) \n\t (fun (x:Prims.sum b (~ b)) -> \n\t\tmatch x with\n\t | Prims.Left _ -> e1\n\t\t| Prims.Right _ -> e2)", "val Steel.Channel.Protocol.msg_t = p: Steel.Channel.Protocol.protocol Prims.unit -> Type0\nlet msg_t (p:protocol unit) = next_msg_t p", "val vpure' (p: prop) : GTot vprop'\nlet vpure'\n (p: prop)\n: GTot vprop'\n= {\n hp = Steel.Memory.pure p;\n t = squash p;\n sel = vpure_sel p;\n}", "val PulseTutorial.ImplicationAndForall.regain_half_q = x: Pulse.Lib.GhostReference.ref a -> Pulse.Lib.Core.vprop\nlet regain_half_q #a (x:GR.ref a) =\r\n forall* u. pts_to x #one_half u @==> pts_to x u", "val elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n : vprop_equiv (p x) (q x)\nlet elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n: vprop_equiv (p x) (q x)\n= let pf\n : squash (vprop_equiv (p x) (q x))\n = eliminate forall x. vprop_equiv (p x) (q x) with x\n in\n coerce_eq (prop_squash_idem _) pf", "val Steel.Memory.mprop = fp: Steel.Memory.slprop -> Type\nlet mprop (fp:slprop u#a) =\n q:(mem u#a -> prop){\n forall (m0:mem{interp fp m0}) (m1:mem{disjoint m0 m1}).\n q m0 <==> q (join m0 m1)}", "val Pulse.Reflection.Util.stt_vprop_equiv_fv = FStar.Stubs.Reflection.Types.fv\nlet stt_vprop_equiv_fv =\n R.pack_fv (mk_pulse_lib_core_lid \"vprop_equiv\")", "val PulseCore.Memory.mprop2 = fp_pre: PulseCore.Memory.slprop -> fp_post: (_: a -> PulseCore.Memory.slprop) -> Type\nlet mprop2 (#a:Type u#b) (fp_pre:slprop u#a) (fp_post:a -> slprop u#a) =\n q:(mem u#a -> a -> mem u#a -> prop){\n // can join any disjoint mem to the pre-mem and q is still valid\n (forall (x:a) (m0:mem{interp fp_pre m0}) (m_post:mem{interp (fp_post x) m_post}) (m1:mem{disjoint m0 m1}).\n q m0 x m_post <==> q (join m0 m1) x m_post) /\\\n // can join any mem to the post-mem and q is still valid\n (forall (x:a) (m_pre:mem{interp fp_pre m_pre}) (m0:mem{interp (fp_post x) m0}) (m1:mem{disjoint m0 m1}).\n q m_pre x m0 <==> q m_pre x (join m0 m1))}", "val vpure (p: prop) : Tot vprop\nlet vpure (p: prop) : Tot vprop = VUnit (vpure' p)", "val Pulse.Syntax.Base.comp_post = c: Pulse.Syntax.Base.comp{Pulse.Syntax.Base.stateful_comp c} -> Pulse.Syntax.Base.vprop\nlet comp_post (c:comp { stateful_comp c }) = (st_comp_of_comp c).post", "val Pulse.Syntax.Base.comp_pre = c: Pulse.Syntax.Base.comp{Pulse.Syntax.Base.stateful_comp c} -> Pulse.Syntax.Base.vprop\nlet comp_pre (c:comp { stateful_comp c }) = (st_comp_of_comp c).pre", "val Pulse.Typing.ghost_typing = g: Pulse.Typing.Env.env -> e: Pulse.Syntax.Base.term -> t: Pulse.Syntax.Base.typ -> Type0\nlet ghost_typing (g:env) (e:term) (t:typ) =\n typing g e T.E_Ghost t", "val pure (p:prop) : vprop\nlet pure = pure", "val bind_pledge' (#is:invlist) (#f:vprop) (#v1:vprop) (#v2:vprop)\n (extra : vprop)\n (k : ustep is (extra ** v1) (pledge is f v2))\n : stt_ghost unit (pledge is f v1 ** extra) (fun () -> pledge is f v2)\nlet bind_pledge' = __bind_pledge'", "val squash_pledge (is:invlist) (f:vprop) (v1:vprop)\n : stt_ghost unit (pledge is f (pledge is f v1)) (fun () -> pledge is f v1)\nlet squash_pledge = __squash_pledge", "val Automation.ea5' = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ea5' (p q : prop) =\n assert (p ==> q ==> p /\\ q)\n by (conjt ())", "val ParallelIncrement.pts_to_refine = x: Pulse.Lib.Reference.ref a -> p: (_: a -> Pulse.Lib.Core.vprop) -> Pulse.Lib.Core.vprop\nlet pts_to_refine #a (x:ref a) (p:a -> vprop) = exists* v. pts_to x v ** p v", "val intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\nlet intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\n = let pf : squash (forall x. vprop_equiv (p x) (q x)) = \n introduce forall x. vprop_equiv (p x) (q x)\n with FStar.Squash.return_squash (pf x)\n in\n coerce_eq (prop_squash_idem _) pf", "val Steel.Heap.sl_implies = p: Steel.Heap.slprop -> q: Steel.Heap.slprop -> Prims.logical\nlet sl_implies (p q:slprop) = forall m. interp p m ==> interp q m", "val Steel.Effect.Common.rmem' = pre: Steel.Effect.Common.vprop -> Type\nlet rmem' (pre:vprop) =\n FExt.restricted_g_t\n (r0:vprop{can_be_split pre r0})\n (fun r0 -> normal (t_of r0))", "val Pulse.Lib.SpinLock.lock_inv = r: Pulse.Lib.Reference.ref FStar.UInt32.t -> p: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet lock_inv (r:ref U32.t) (p:vprop) =\n exists* v. pts_to r v ** maybe (v = 0ul) p", "val pledge (is:invlist) (f:vprop) (v:vprop) : vprop\nlet pledge opens f v = (==>*) #opens f (f ** v)", "val bind_pledge (#is:invlist) (#f:vprop) (#v1:vprop) (#v2:vprop)\n (extra : vprop)\n (k : ustep is (f ** extra ** v1) (f ** pledge is f v2))\n : stt_ghost unit (pledge is f v1 ** extra) (fun () -> pledge is f v2)\nlet bind_pledge #os #f #v1 #v2 extra k = __bind_pledge #os #f #v1 #v2 extra k", "val PulseCore.Preorder.property = a: Type -> Type\nlet property (a:Type)\n = a -> prop" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.Simple.fsti", "name": "Pulse.Lib.Par.Pledge.Simple.ustep" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fsti", "name": "Pulse.Lib.Reference.cond" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.token" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.universal_quantifier" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.hheap" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.is_forall" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.thunk" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.stronger" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.pure" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.hprop" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.hmem" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fsti", "name": "Pulse.Checker.Prover.Base.vprop_typing" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.mprop" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.inv_p'" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.prop_validity" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.t_of" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.hmem" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.sl_implies" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.op_Star_Star" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.equiv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.uquant" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.token" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.ValeSig.fst", "name": "Vale.AsLowStar.ValeSig.sprop" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.to_vprop" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist0" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.hheap" }, { "project_name": "steel", "file_name": "Steel.DisposableInvariant.fst", "name": "Steel.DisposableInvariant.inv" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex2" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist_elem" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Builder.fst", "name": "Pulse.Syntax.Builder.mk_assert_hint_type" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex5" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.to_vprop'" }, { "project_name": "steel", "file_name": "Steel.Memory.fsti", "name": "Steel.Memory.hmem" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex8" }, { "project_name": "steel", "file_name": "PulseCore.Action.fsti", "name": "PulseCore.Action.property" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex3" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex7" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.inv" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.comp_typing_u" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex4" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.h_or" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.comp_intro_pure" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.tm_prop" }, { "project_name": "steel", "file_name": "Pulse.Lib.PCM.Map.fst", "name": "Pulse.Lib.PCM.Map.map" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.pure" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.inv" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex6" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fsti", "name": "Pulse.Lib.Core.inames" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.tm_vprop" }, { "project_name": "steel", "file_name": "SelectorLogic.fst", "name": "SelectorLogic.wand" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.stronger" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.h_and" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.full_hheap" }, { "project_name": "steel", "file_name": "Pulse.Lib.SpinLock.fst", "name": "Pulse.Lib.SpinLock.maybe" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.tot_typing" }, { "project_name": "steel", "file_name": "PulseCore.Action.fsti", "name": "PulseCore.Action.stable_property" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.a_heap_prop" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.subtyping_token" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex1_qed" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_equiv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.vdep" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.post_hint_for_env_p" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.wand" }, { "project_name": "steel", "file_name": "PulseTutorial.Ghost.fst", "name": "PulseTutorial.Ghost.correlated" }, { "project_name": "steel", "file_name": "Pulse.Lib.CancellableInvariant.fst", "name": "Pulse.Lib.CancellableInvariant.cancellable" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.equiv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.hp_of" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex14" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_post_equiv" }, { "project_name": "steel", "file_name": "Pulse.Soundness.VPropEquiv.fst", "name": "Pulse.Soundness.VPropEquiv.vprop_equiv_sym_type" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.prop_and" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.vprop_fv" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Prop_s.fst", "name": "Vale.Def.Prop_s.prop0" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.pure" }, { "project_name": "FStar", "file_name": "FStar.SquashProperties.fst", "name": "FStar.SquashProperties.ifProp" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.msg_t" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vpure'" }, { "project_name": "steel", "file_name": "PulseTutorial.ImplicationAndForall.fst", "name": "PulseTutorial.ImplicationAndForall.regain_half_q" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.elim_vprop_post_equiv" }, { "project_name": "steel", "file_name": "Steel.Memory.fsti", "name": "Steel.Memory.mprop" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.stt_vprop_equiv_fv" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.mprop2" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vpure" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.comp_post" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.comp_pre" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.ghost_typing" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.pure" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.bind_pledge'" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.squash_pledge" }, { "project_name": "FStar", "file_name": "Automation.fst", "name": "Automation.ea5'" }, { "project_name": "steel", "file_name": "ParallelIncrement.fst", "name": "ParallelIncrement.pts_to_refine" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.intro_vprop_post_equiv" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.sl_implies" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.rmem'" }, { "project_name": "steel", "file_name": "Pulse.Lib.SpinLock.fst", "name": "Pulse.Lib.SpinLock.lock_inv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.pledge" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.bind_pledge" }, { "project_name": "steel", "file_name": "PulseCore.Preorder.fst", "name": "PulseCore.Preorder.property" } ], "selected_premises": [ "Pulse.Lib.Reference.cond", "Pulse.Lib.Par.Pledge.ustep", "Pulse.Lib.Core.emp_inames", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Pervasives.perform", "Pulse.Lib.InvList.invlist_v", "Pulse.Lib.Pervasives.vprop_equiv_norm", "FStar.PCM.composable", "Pulse.Lib.Core.all_inames", "FStar.UInt.size", "Pulse.Lib.Core.inames", "FStar.Mul.op_Star", "PulseCore.FractionalPermission.comp_perm", "FStar.Real.one", "FStar.Real.two", "FStar.PCM.op", "FStar.PCM.compatible", "PulseCore.FractionalPermission.sum_perm", "Pulse.Lib.InvList.invlist_elem", "FStar.Pervasives.reveal_opaque", "Pulse.Lib.Core.one_half", "Pulse.Lib.Pervasives.inames_join_self", "Pulse.Lib.InvList.invlist_names", "Pulse.Lib.InvList.invlist0", "Pulse.Lib.Pervasives.perform_ghost", "Pulse.Lib.InvList.invlist", "Pulse.Lib.Core.unit_non_informative", "Pulse.Lib.Core.join_inames", "PulseCore.FractionalPermission.half_perm", "FStar.Pervasives.Native.snd", "Pulse.Lib.Core.add_iname", "FStar.Pervasives.Native.fst", "FStar.Math.Lemmas.pow2_plus", "Pulse.Lib.Pervasives.inames_ext", "Pulse.Lib.Pervasives.tfst", "Pulse.Lib.Core.prop_non_informative", "Pulse.Lib.Core.erased_non_informative", "Pulse.Lib.InvList.invlist_empty", "Pulse.Lib.Core.add_inv", "FStar.Real.zero", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "Pulse.Lib.Core.inames_subset", "Pulse.Lib.Pervasives.default_arg", "Pulse.Lib.InvList.invlist_nodups", "Pulse.Lib.Pervasives.tthd", "Pulse.Lib.Core.mem_inv", "FStar.Math.Lemmas.pow2_le_compat", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.FractionalPermission.writeable", "FStar.Math.Lemmas.pow2_lt_compat", "Pulse.Lib.Core.squash_non_informative", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "Pulse.Lib.Core.remove_inv", "Pulse.Lib.InvList.invlist_sub", "Pulse.Lib.Core.mem_iname", "FStar.Math.Lib.max", "Pulse.Lib.Pervasives.tsnd", "FStar.Set.disjoint", "FStar.Set.remove", "FStar.UInt32.n_minus_one", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.Real.test_le3", "FStar.UInt.sub", "FStar.Math.Lib.min", "FStar.UInt32.op_Greater_Equals_Hat", "FStar.Real.test_le2", "FStar.UInt.one_extend", "FStar.UInt32.lt", "FStar.UInt.lt", "FStar.UInt.shift_right", "FStar.UInt.shift_left", "FStar.UInt.zero", "FStar.UInt.one", "FStar.UInt.lte", "FStar.PCM.frame_preserving_val_to_fp_upd", "FStar.Real.test_lt3", "FStar.Set.add", "FStar.Math.Lib.div_non_eucl", "FStar.Math.Lemmas.lemma_div_lt", "FStar.UInt.div", "FStar.UInt32.op_Equals_Hat", "FStar.Real.test_le1", "FStar.UInt.ones", "FStar.UInt.incr", "FStar.Real.test_div_lt", "FStar.Math.Lib.div_non_eucl_decr_lemma", "FStar.Real.test_lt2", "FStar.UInt.udiv", "FStar.Real.test_ge1", "FStar.UInt.minus", "FStar.PCM.frame_compatible", "FStar.Set.subset", "FStar.Preorder.stable", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Real.test_ge3", "FStar.PCM.compatible_elim", "FStar.UInt32.minus", "FStar.Real.test_ge2", "FStar.UInt.msb" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.Par.Pledge\n\nopen Pulse.Lib.Pervasives\nopen Pulse.Lib.InvList\n\nval pledge (is:invlist) (f:vprop) (v:vprop) : vprop\n\n(* A ghost step to rewrite the context, running under invlist is. *)\nlet ustep (is:invlist) (p q : vprop)\n = unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q)", "sketch": [ "The definition `ustep0` specifies a type that represents a ghost step to rewrite the context, running under an invlist.\n\nStep 1: The `ustep0` type represents a ghost step to rewrite the context, running under an invlist.\nStep 2: The `ustep0` type is implemented as a dependent pair where the first component is a proof of the pre-condition and the second component is a function that transforms the context from `p` to `q`.", "The definition `ustep0` represents a type that takes two vprops `p` and `q` as input.\n\nStep 1: We define a type `ustep0` that represents a ghost step to rewrite the context, running under an invlist.\n\nStep 2: The `ustep0` type is implemented by taking two vprops `p` and `q` as input parameters.", "The definition `ustep0` is about specifying a type that represents a ghost step to rewrite the context, running under an `invlist`.\n\nThe `ustep0` type is implemented to take two parameters `p` and `q` of type `Pulse.Lib.Core.vprop` and return a `Type`.", "The definition `ustep0` specifies a type that represents a ghost step to rewrite the context, running under an invlist.\n\nStep 1: The `ustep0` type represents a ghost step to rewrite the context under an invlist.\nStep 2: The `ustep0` type is implemented as a dependent pair of a function that takes a unit argument and returns a `stt_ghost` computation, and a proof that the resulting state transition relation holds.", "The definition is implemented as a type that takes two arguments `p` and `q`, both of type `Pulse.Lib.Core.vprop`, representing the pre- and post-conditions of the ghost step.", "The definition is implemented by specifying the type of `ustep0` as taking two arguments `p` and `q`, both of type `Pulse.Lib.Core.vprop`, and returning a `Type`.", "The `ustep0` type is implemented as a dependent pair, where the first element is a proof that the pre-condition `p` holds, and the second element is a proof that the post-condition `q` holds under the given invlist `is`.", "The definition `ustep0` specifies a type that represents a ghost step to rewrite the context, running under an `invlist`.\n\nStep 1: The `ustep0` type represents a ghost step to rewrite the context, running under an `invlist`.\nStep 2: The `ustep0` type is implemented as a dependent pair of a function that takes a `p` of type `vprop` and a `q` of type `vprop` and returns `Type`.", "The definition is implemented as a type that takes two arguments `p` and `q` of type `Pulse.Lib.Core.vprop` and returns a `Type`.", "The definition `ustep0` represents a type that takes two vprops `p` and `q` as input.\n\nStep 1: We define a type `ustep0` that represents a ghost step to rewrite the context, running under an invlist.\n\nStep 2: The `ustep0` type is implemented by taking two vprops `p` and `q` as input and returning a Type." ], "generated_solution": [ "val ustep0 : p: vprop -> q: vprop -> Type", "val ustep0 : p: vprop -> q: vprop -> Type", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type\n = fun p q -> (unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q)) * (unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q) -> Type)", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type\n = fun (p: Pulse.Lib.Core.vprop) (q: Pulse.Lib.Core.vprop) -> (invlist_v is ** p) -> (unit -> stt_ghost unit (invlist_v is ** p) (fun _ -> invlist_v is ** q))", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "val ustep0 : p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Type", "val ustep0 : p: vprop -> q: vprop -> Type" ] }, { "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.intro_exists_erased", "opens_and_abbrevs": [ { "open": "Steel.ST.Coercions" }, { "abbrev": "STAG", "full_module": "Steel.ST.Effect.AtomicAndGhost" }, { "abbrev": "STG", "full_module": "Steel.ST.Effect.Ghost" }, { "abbrev": "SE", "full_module": "Steel.Effect" }, { "abbrev": "SEA", "full_module": "Steel.Effect.Atomic" }, { "abbrev": "U", "full_module": "FStar.Universe" }, { "open": "Steel.ST.Effect.Ghost" }, { "open": "Steel.Memory" }, { "open": "FStar.Ghost" }, { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Steel.ST.Effect.Ghost" }, { "open": "Steel.ST.Effect.Atomic" }, { "open": "Steel.ST.Effect" }, { "open": "Steel.Effect.Common" }, { "open": "Steel.Memory" }, { "open": "Steel.FractionalPermission" }, { "abbrev": "U", "full_module": "FStar.Universe" }, { "open": "Steel.ST.Effect.Ghost" }, { "open": "Steel.Memory" }, { "open": "FStar.Ghost" }, { "open": "Steel.ST" }, { "open": "Steel.ST" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val intro_exists_erased (#a:Type)\n (#opened_invariants:_)\n (x:Ghost.erased a)\n (p:a -> vprop)\n : STGhostT unit opened_invariants (p x) (fun _ -> exists_ p)", "source_definition": "let intro_exists_erased #a #o x p\n = coerce_ghost (fun _ -> SEA.intro_exists_erased x p)", "source_range": { "start_line": 120, "start_col": 0, "end_line": 121, "end_col": 55 }, "interleaved": false, "definition": "fun x p -> Steel.ST.Coercions.coerce_ghost (fun _ -> Steel.Effect.Atomic.intro_exists_erased x p)", "effect": "Steel.ST.Effect.Ghost.STGhostT", "effect_flags": [], "mutual_with": [], "premises": [ "Steel.Memory.inames", "FStar.Ghost.erased", "Steel.Effect.Common.vprop", "Steel.ST.Coercions.coerce_ghost", "Prims.unit", "FStar.Ghost.reveal", "Steel.Effect.Common.VUnit", "Steel.Effect.Common.to_vprop'", "Steel.Effect.Atomic.h_exists_sl", "Prims.l_True", "Steel.Effect.Atomic.intro_exists_erased" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "x: FStar.Ghost.erased a -> p: (_: a -> Steel.Effect.Common.vprop)\n -> Steel.ST.Effect.Ghost.STGhostT Prims.unit", "prompt": "let intro_exists_erased #a #o x p =\n ", "expected_response": "coerce_ghost (fun _ -> SEA.intro_exists_erased x p)", "source": { "project_name": "steel", "file_name": "lib/steel/Steel.ST.Util.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Steel.ST.Util.fst", "checked_file": "dataset/Steel.ST.Util.fst.checked", "interface_file": true, "dependencies": [ "dataset/Steel.ST.Effect.Ghost.fsti.checked", "dataset/Steel.ST.Effect.AtomicAndGhost.fsti.checked", "dataset/Steel.ST.Coercions.fsti.checked", "dataset/Steel.Memory.fsti.checked", "dataset/Steel.Effect.Common.fsti.checked", "dataset/Steel.Effect.Atomic.fsti.checked", "dataset/Steel.Effect.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.IndefiniteDescription.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Algebra.CommMonoid.Equiv.fst.checked" ] }, "definitions_in_context": [ "let weaken #o p q l =\n coerce_ghost (fun () -> SEA.rewrite_slprop p q l)", "let rewrite #o p q =\n weaken p q (fun _ -> ())", "let rewrite_with_tactic #opened p q =\n weaken p q (fun _ -> reveal_equiv p q)", "val weaken (#opened:inames)\n (p q:vprop)\n (l:(m:mem) -> Lemma\n (requires interp (hp_of p) m)\n (ensures interp (hp_of q) m))\n : STGhostT unit opened p (fun _ -> q)", "let rewrite_equiv #opened p q =\n FStar.Algebra.CommMonoid.Equiv.elim_eq_laws Steel.Effect.Common.req;\n assert (Steel.Effect.Common.req.eq == equiv);\n reveal_equiv p q;\n weaken p q (fun _ -> ())", "let noop #o _ = rewrite #o emp emp", "val rewrite (#opened:inames)\n (p q: vprop)\n : STGhost unit opened p (fun _ -> q) (p == q) (fun _ -> True)", "let slassert0 #o (p:vprop)\n : SEA.SteelGhostT unit o p (fun _ -> p)\n = SEA.slassert p", "let assert_ #o p = coerce_ghost (fun _ -> slassert0 p)", "let assume_ #o p = admit_ ()", "let drop #o p = coerce_ghost (fun _ -> SEA.drop p)", "let pure = pure", "val rewrite_with_tactic (#opened:_) (p q:vprop)\n : STGhost unit opened\n p\n (fun _ -> q)\n (requires T.with_tactic init_resolve_tac (squash (p `equiv` q)))\n (ensures fun _ -> True)", "let reveal_pure _ = ()", "let intro_pure #o p = coerce_ghost (fun _ -> SEA.intro_pure p)", "let elim_pure #o p = coerce_ghost (fun _ -> SEA.elim_pure p)", "let extract_pure (#uses:_) (p:prop)\n : STGhost unit uses (pure p) (fun _ -> pure p) True (fun _ -> p)\n = let _ = elim_pure p in\n intro_pure p", "val rewrite_equiv (#opened:_) (p q:vprop)\n : STGhost unit opened p (fun _ -> q)\n (requires equiv p q \\/ equiv q p)\n (ensures fun _ -> True)", "let intro_can_be_split_pure'\n (p: prop)\n: Lemma\n (p ==> emp `can_be_split` pure p)\n= reveal_can_be_split ();\n Classical.forall_intro (pure_interp p)", "val noop (#opened:inames) (_:unit)\n : STGhostT unit opened emp (fun _ -> emp)", "let intro_can_be_split_pure\n (p: prop)\n (sq: squash p)\n: Tot (squash (emp `can_be_split` pure p))\n= intro_can_be_split_pure' p", "val assert_ (#opened_invariants:_)\n (p:vprop)\n : STGhostT unit opened_invariants p (fun _ -> p)", "let intro_can_be_split_forall_dep_pure\n p\n= Classical.forall_intro (fun x -> intro_can_be_split_pure' (p x))", "val assume_ (#opened_invariants:_)\n (p:vprop)\n : STGhostT unit opened_invariants emp (fun _ -> p)", "let return0 #a #o #p (x:a)\n : SEA.SteelAtomicBase a true o Unobservable\n (return_pre (p x)) p\n (fun _ -> True)\n (fun _ v _ -> v == x)\n = let _ = () in SEA.return x", "val drop (#opened:inames) (p:vprop) : STGhostT unit opened p (fun _ -> emp)", "let return #a #o #p x = coerce_atomicF (fun _ -> return0 x)", "val pure (p: prop) : vprop", "let exists_ (#a:Type u#a) (p:a -> vprop)\n : vprop\n = SEA.h_exists p", "val reveal_pure (p: prop) : Lemma (pure p == Steel.Effect.Common.pure p)", "let intro_can_be_split_exists\n a x p\n=\n SEA.reveal_can_be_split ();\n Classical.forall_intro (Steel.Memory.intro_h_exists x (SEA.h_exists_sl' p))", "val intro_pure (#uses:_) (p:prop)\n : STGhost unit uses emp (fun _ -> pure p) p (fun _ -> True)", "val elim_pure (#uses:_) (p:prop)\n : STGhost unit uses (pure p) (fun _ -> emp) True (fun _ -> p)", "let intro_can_be_split_forall_dep_exists\n b a x p\n=\n let prf\n (y: b)\n : Lemma\n (p y (x y) `can_be_split` exists_ (p y))\n =\n intro_can_be_split_exists (a y) (x y) (p y)\n in\n Classical.forall_intro prf", "val extract_pure (#uses:_) (p:prop)\n : STGhost unit uses (pure p) (fun _ -> pure p) True (fun _ -> p)", "val intro_can_be_split_pure\n (p: prop)\n (sq: squash p)\n: Lemma (emp `can_be_split` pure p)", "let intro_exists #a #o x p\n = coerce_ghost (fun _ -> SEA.intro_exists x p)" ], "closest": [ "val intro_exists_erased (#a:Type) (#opened_invariants:_) (x:Ghost.erased a) (p:a -> vprop)\n : SteelGhostT unit opened_invariants (p x) (fun _ -> h_exists p)\nlet intro_exists_erased #a #opened x p =\n rewrite_slprop (p x) (h_exists p)\n (fun m -> Steel.Memory.intro_h_exists (Ghost.reveal x) (h_exists_sl' p) m)", "val intro_exists (#a:Type) (#opened_invariants:_) (x:a) (p:a -> vprop)\n : SteelGhostT unit opened_invariants (p x) (fun _ -> h_exists p)\nlet intro_exists #a #opened x p =\n rewrite_slprop (p x) (h_exists p) (fun m -> Steel.Memory.intro_h_exists x (h_exists_sl' p) m)", "val intro_exists_erased (#a:Type) (p:a -> vprop) (e:erased a)\n: stt_ghost unit (p (reveal e)) (fun _ -> exists* x. p x)\nlet intro_exists_erased #a p e = A.intro_exists p e", "val intro_exists (#opened_invariants:_) (#a:_) (p:a -> slprop) (x:erased a)\n : action_except unit opened_invariants\n (p x)\n (fun _ -> h_exists p)\nlet intro_exists #opened_invariants #a p x = \n lift_tot_action_with_frame (lift_heap_action_with_frame opened_invariants (H.intro_exists p x))", "val intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: stt_ghost unit (p x) (fun _ -> exists* x. p x)\nlet intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: stt_ghost unit (p x) (fun _ -> exists* x. p x)\r\n= Ghost.hide (A.intro_exists p x)", "val witness_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit)\n : SteelGhostT (erased a) opened_invariants\n (h_exists p) (fun x -> p x)\nlet witness_exists #a #u #p _ =\n SteelGhost?.reflect (Steel.Memory.witness_h_exists #u (fun x -> hp_of (p x)))", "val intro_exists (#a:Type) (p:a -> vprop) (e:a)\n: stt_ghost unit (p e) (fun _ -> exists* x. p x)\nlet intro_exists #a p e = A.intro_exists p e", "val intro_h_exists (#a: Type) (#o: _) (v: Ghost.erased a) (p: (a -> vprop))\n : STGhostT unit o (p v) (fun _ -> SEA.h_exists p)\nlet intro_h_exists (#a:Type) #o (v:Ghost.erased a) (p:a -> vprop)\n : STGhostT unit o\n (p v)\n (fun _ -> SEA.h_exists p)\n = let _ = coerce_ghost (fun _ -> SEA.intro_exists_erased v p) in ()", "val open_exists: #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit\n -> SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun r -> p (reveal r))\nlet open_exists (#a:Type) (#opened_invariants:_) (#p:a -> vprop) (_:unit)\n : SteelGhostT (Ghost.erased a) opened_invariants\n (h_exists p) (fun r -> p (reveal r))\n = let v : erased a = witness_exists () in\n v", "val witness_h_exists_erased:\n #a: Type ->\n #opened_invariants: _ ->\n #p: (Ghost.erased a -> vprop) ->\n unit\n -> SteelGhostT (Ghost.erased a) opened_invariants (h_exists p) (fun x -> p x)\nlet witness_h_exists_erased (#a:Type) (#opened_invariants:_) (#p: Ghost.erased a -> vprop) (_:unit)\n : SteelGhostT (Ghost.erased a) opened_invariants\n (h_exists p) (fun x -> p x)\n=\n let w = witness_exists #(Ghost.erased a) #_ #p () in\n Ghost.reveal w", "val elim_exists': #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit\n -> STGhostT (a) opened_invariants (exists_ p) (fun x -> p x)\nlet elim_exists' (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (a) opened_invariants\n (exists_ p)\n (fun x -> p x)\n= let gx = elim_exists () in\n let x = Ghost.reveal gx in\n rewrite (p gx) (p x);\n x", "val elim_exists': #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit\n -> STGhostT (a) opened_invariants (exists_ p) (fun x -> p x)\nlet elim_exists' (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (a) opened_invariants\n (exists_ p)\n (fun x -> p x)\n= let gx = elim_exists () in\n let x = Ghost.reveal gx in\n rewrite (p gx) (p x);\n x", "val intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (fun _ -> exists* x. p x)\nlet intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (fun _ -> exists* x. p x)\r\n= intro_exists'' p x", "val intro_exists (#a:_) (p:a -> slprop) (x:erased a)\n : action_with_frame (p x) unit (fun _ -> h_exists p)\nlet intro_exists #a p x =\n fun frame h0 ->\n intro_h_exists (reveal x) p h0;\n (| (), h0 |)", "val intro_exists'' (#a: Type u#a) (p: (a -> slprop)) (x: erased a)\n : act unit emp_inames (p x) (thunk (exists* x. p x))\nlet intro_exists'' (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (thunk (exists* x. p x))\r\n= coerce_eq (exists_equiv #a #p) (intro_exists' #a p x)", "val elim_exists (#a:Type) (p:a -> vprop)\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p (reveal x))\nlet elim_exists #a p = A.elim_exists p", "val intro_exists' (#a: Type u#a) (p: (a -> slprop)) (x: erased a)\n : act unit emp_inames (p x) (thunk (op_exists_Star p))\nlet intro_exists' (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (thunk (op_exists_Star p))\r\n= fun #ictx -> mem_action_as_action _ _ _ _ (intro_exists #ictx (F.on_dom a p) x)", "val e_exists_to_exists (#a: Type) (#o: _) (p: (a -> vprop))\n : STGhostT unit o (exists_ (fun (x: erased a) -> p x)) (fun _ -> exists_ p)\nlet e_exists_to_exists (#a:Type) #o (p:a -> vprop)\n : STGhostT unit o (exists_ (fun (x:erased a) -> p x))\n (fun _ -> exists_ p)\n = let w = elim_exists () in\n intro_exists #a (reveal (reveal w)) p", "val intro_pure (#opened_invariants:_) (p:prop)\n : SteelGhost unit opened_invariants emp (fun _ -> pure p)\n (requires fun _ -> p) (ensures fun _ _ _ -> True)\nlet intro_pure p = rewrite_slprop emp (pure p) (fun m -> pure_interp p m)", "val exists_to_e_exists (#a: Type) (#o: _) (p: (a -> vprop))\n : STGhostT unit o (exists_ p) (fun _ -> exists_ (fun (x: erased a) -> p x))\nlet exists_to_e_exists (#a:Type) #o (p:a -> vprop)\n : STGhostT unit o (exists_ p)\n (fun _ -> exists_ (fun (x:erased a) -> p x))\n = let w = elim_exists () in\n intro_exists w (fun (x:erased a) -> p x)", "val elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\nlet elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\r\n= Ghost.hide (A.elim_exists p)", "val intro_ghost_vptr (#a: Type) (#opened: inames) (r: ghost_ref a) (p: perm) (v: erased a)\n : SteelGhost unit\n opened\n (ghost_pts_to r p v)\n (fun _ -> ghost_vptrp r p)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> h1 (ghost_vptrp r p) == reveal v)\nlet intro_ghost_vptr (#a:Type) (#opened:inames) (r:ghost_ref a) (p: perm) (v:erased a)\n : SteelGhost unit opened (ghost_pts_to r p v) (fun _ -> ghost_vptrp r p)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> h1 (ghost_vptrp r p) == reveal v)\n = change_slprop_2 (ghost_pts_to r p v) (ghost_vptrp r p) v (intro_ghost_vptr_lemma r p v)", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val implies_refl (#opened: _) (p: vprop) : STGhostT unit opened emp (fun _ -> p @==> p)\nlet implies_refl\n (#opened: _)\n (p: vprop)\n: STGhostT unit opened\n emp\n (fun _ -> p @==> p)\n= intro_implies p p emp (fun _ -> noop ())", "val witness_h_exists (#opened_invariants:_) (#a:_) (p:a -> slprop)\n : action_except (erased a) opened_invariants\n (h_exists p)\n (fun x -> p x)\nlet witness_h_exists #opened_invariants #a p =\n lift_tot_action_with_frame (lift_heap_action_with_frame opened_invariants (H.witness_h_exists p))", "val witness_h_exists (#opened_invariants:_) (#a:_) (p:a -> slprop)\n : action_except (erased a) opened_invariants\n (h_exists p)\n (fun x -> p x)\nlet witness_h_exists #opened_invariants #a p =\n lift_tot_action_with_frame (lift_heap_action_with_frame opened_invariants (H.witness_h_exists p))", "val intro_implies\n (#opened: _)\n (hyp concl v: vprop)\n (f_elim: (opened': inames -> STGhostT unit opened' (v `star` hyp) (fun _ -> concl)))\n : STGhostT unit opened v (fun _ -> ( @==> ) hyp concl)\nlet intro_implies\n (#opened: _)\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: (\n (opened': inames) ->\n STGhostT unit opened'\n (v `star` hyp)\n (fun _ -> concl)\n ))\n: STGhostT unit opened\n v\n (fun _ -> (@==>) hyp concl)\n= intro_implies_gen hyp concl v f_elim", "val intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\nlet intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\n= let _ : squash (universal_quantifier v p) = FStar.Squash.return_squash f_elim in\n let m1\n : stt_ghost unit (emp ** v) (fun _ -> pure (is_forall v p) ** v) \n = frame_ghost v (intro_pure (is_forall v p) ()) in\n let m2 ()\n : stt_ghost unit\n (pure (is_forall v p) ** token v) \n (fun _ -> forall* x. p x)\n = intro_exists (fun (v:vprop) -> pure (is_forall v p) ** token v) v\n in\n let m = bind_ghost m1 m2 in\n sub_ghost v _\n (vprop_equiv_unit _)\n (intro_vprop_post_equiv _ _ (fun _ -> vprop_equiv_refl _))\n m", "val elim_forall\n (#a:Type)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* x. p x)\n (fun _ -> p x)\nlet elim_forall\n (#a:Type u#a)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* (x:a). p x)\n (fun _ -> p x)\n= let m1 = elim_exists #vprop (fun (v:vprop) -> pure (is_forall v p) ** token v) in\n let m2 (v:Ghost.erased vprop)\n : stt_ghost unit \n (pure (is_forall v p) ** token v)\n (fun _ -> p x)\n = bind_ghost\n (frame_ghost \n (token v)\n (elim_pure_explicit (is_forall v p)))\n (fun (pf:squash (is_forall v p)) ->\n let f = extract_q v p pf in\n sub_ghost (emp ** Ghost.reveal v)\n (fun _ -> p x)\n (vprop_equiv_sym _ _ (vprop_equiv_unit _))\n (intro_vprop_post_equiv \n (fun _ -> p x)\n (fun _ -> p x)\n (fun _ -> vprop_equiv_refl (p x)))\n (f x))\n in\n bind_ghost m1 m2", "val free (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit opened\n (pts_to r full_perm v) (fun _ -> emp)\nlet free\n #_ #a #v r\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_free gr)", "val intro_vconst (#opened: _) (#a: Type) (x: a)\n : SteelGhost unit\n opened\n emp\n (fun _ -> vconst x)\n (fun _ -> True)\n (fun _ _ h' -> h' (vconst x) == x)\nlet intro_vconst\n (#opened: _)\n (#a: Type)\n (x: a)\n: SteelGhost unit opened\n emp\n (fun _ -> vconst x)\n (fun _ -> True)\n (fun _ _ h' -> h' (vconst x) == x)\n=\n change_slprop_rel\n emp\n (vconst x)\n (fun _ y -> y == x)\n (fun _ -> ())", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val rewrite_erased (#a: _) (p: (erased a -> vprop)) (x: erased a) (y: a)\n : Steel unit\n (p x)\n (fun _ -> p (Ghost.hide y))\n (requires fun _ -> reveal x == y)\n (ensures fun _ _ _ -> True)\nlet rewrite_erased #a (p:erased a -> vprop) (x:erased a) (y:a)\n : Steel unit (p x) (fun _ -> p (Ghost.hide y))\n (requires fun _ -> reveal x == y)\n (ensures fun _ _ _ -> True)\n = rewrite_slprop (p x) (p (Ghost.hide y)) (fun _ -> ())", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val implies_emp_l (#opened: _) (p: vprop) : STGhostT unit opened p (fun _ -> emp @==> p)\nlet implies_emp_l\n (#opened: _)\n (p: vprop)\n: STGhostT unit opened\n p\n (fun _ -> emp @==> p)\n= intro_implies emp p p (fun _ -> noop ())", "val ghost_write (#a:Type0) (#opened:inames) (r:ghost_ref a) (x:Ghost.erased a)\n : SteelGhost unit opened\n (ghost_vptr r) (fun _ -> ghost_vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> Ghost.reveal x == h1 (ghost_vptr r))\nlet ghost_write r x =\n let _ = elim_ghost_vptr r _ in\n ghost_write_pt r x;\n intro_ghost_vptr r _ x", "val intro_vpure (#opened: _) (p: prop)\n : SteelGhost unit opened emp (fun _ -> vpure p) (fun _ -> p) (fun _ _ h' -> p)\nlet intro_vpure\n (#opened: _)\n (p: prop)\n: SteelGhost unit opened\n emp\n (fun _ -> vpure p)\n (fun _ -> p)\n (fun _ _ h' -> p)\n=\n change_slprop_rel\n emp\n (vpure p)\n (fun _ _ -> p)\n (fun m -> pure_interp p m)", "val get (#p:vprop) (#opened:inames) (_:unit) : SteelGhostF (erased (rmem p))\n opened\n p (fun _ -> p)\n (requires fun _ -> True)\n (ensures fun h0 r h1 -> frame_equalities p h0 h1 /\\ frame_equalities p r h1)\nlet get () = SteelGhost?.reflect (get0 ())", "val elim_h_exists (#a: Type) (#o: _) (p: (a -> vprop))\n : STGhostT (Ghost.erased a) o (SEA.h_exists p) (fun v -> p v)\nlet elim_h_exists (#a:Type) #o (p:a -> vprop)\n : STGhostT (Ghost.erased a) o\n (SEA.h_exists p)\n (fun v -> p v)\n = let x = coerce_ghost SEA.witness_exists in x", "val admit_ (#a:Type)\n (#opened:inames)\n (#p:pre_t)\n (#q:post_t a)\n (_:unit)\n : STGhostF a opened p q True (fun _ -> False)\nlet admit_ _ = STGhostF?.reflect (fun _ -> NMSTTotal.nmst_tot_admit ())", "val gget (#opened: inames) (p: vprop)\n : SteelGhost (erased (t_of p))\n opened\n p\n (fun _ -> p)\n (requires (fun _ -> True))\n (ensures (fun h0 res h1 -> h1 p == h0 p /\\ reveal res == h0 p /\\ reveal res == h1 p))\nlet gget (#opened:inames) (p: vprop) : SteelGhost (erased (t_of p))\n opened\n p (fun _ -> p)\n (requires (fun _ -> True))\n (ensures (fun h0 res h1 ->\n h1 p == h0 p /\\\n reveal res == h0 p /\\\n reveal res == h1 p\n ))\n=\n let m = get #p () in\n hide ((reveal m) p)", "val adjoint_intro_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is: inames)\n (p q r: vprop)\n (f: (opened: inames{opened /! is} -> STGhostT unit opened (p `star` q) (fun _ -> r)))\n : STGhostT unit opened p (fun _ -> ( @==> ) #is q r)\nlet adjoint_intro_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is : inames)\n (p q r: vprop)\n (f: (\n (opened: inames{opened /! is}) ->\n STGhostT unit opened\n (p `star` q) (fun _ -> r)\n ))\n: STGhostT unit opened\n p\n (fun _ -> (@==>) #is q r)\n= intro_implies_gen q r p (fun _ ->\n f _\n )", "val intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a)\n : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v)\nlet intro_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm) (v:erased a)\n : SteelGhost unit opened (pts_to r p v) (fun _ -> vptrp r p)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> h1 (vptrp r p) == reveal v)\n = change_slprop_2 (pts_to r p v) (vptrp r p) v (intro_vptr_lemma r p v)", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> MR.write r x)", "val intro_exists_compare_inv\n (#o: _)\n (#t: eqtype)\n (#p0 #p1: perm)\n (a0 a1: array t)\n (#s0 #s1: Seq.seq t)\n (l: US.t)\n (ctr: R.ref (option US.t))\n (x: Ghost.erased (option US.t))\n : STGhostT unit\n o\n (let open US in\n (((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))\n `star`\n (R.pts_to ctr Steel.FractionalPermission.full_perm x))\n `star`\n (pure (equal_up_to s0 s1 x)))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\nlet intro_exists_compare_inv #o\n (#t:eqtype)\n (#p0 #p1:perm)\n (a0 a1:array t)\n (#s0: Seq.seq t)\n (#s1: Seq.seq t)\n (l:US.t)\n (ctr : R.ref (option US.t))\n (x: Ghost.erased (option US.t))\n : STGhostT unit o\n (let open US in\n pts_to a0 p0 s0 `star`\n pts_to a1 p1 s1 `star`\n R.pts_to ctr Steel.FractionalPermission.full_perm x `star`\n pure (equal_up_to s0 s1 x))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\n = let b : bool =\n match Ghost.reveal x with\n | None -> false\n | Some x -> US.(x <^ l)\n in\n assert (within_bounds x l b);\n intro_compare_inv #_ #_ #p0 #p1 a0 a1 #s0 #s1 l ctr x b;\n intro_exists _ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val slassert (#opened_invariants:_) (p:vprop)\n : SteelGhost unit opened_invariants p (fun _ -> p)\n (requires fun _ -> True)\n (ensures fun h0 _ h1 -> frame_equalities p h0 h1)\nlet slassert p = SteelGhost?.reflect (slassert0 p)", "val alloc (#opened: _) (#a:Type) (x:a)\n : STGhost (ref a) opened\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> True)\nlet alloc\n #_ #a x\n= let gr = STC.coerce_ghost (fun _ -> R.ghost_alloc x) in\n let r = Hide (Ghost.reveal (coerce_eq (R.reveal_ghost_ref a) gr)) in\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n );\n r", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val intro_llist_cons\n (#opened: _)\n (p1: ref cell)\n (#v1: Ghost.erased (typeof cell))\n (p2: ptr cell)\n (a: U32.t)\n (q: Ghost.erased (list U32.t))\n : STGhost unit\n opened\n (((pts_to p1 v1) `star` (llist p2 q)) `star` (freeable p1))\n (fun _ -> llist p1 (a :: q))\n (Ghost.reveal v1 == ({ hd = mk_scalar a; tl = mk_scalar p2 }))\n (fun _ -> True)\nlet intro_llist_cons\n (#opened: _)\n (p1: ref cell) (#v1: Ghost.erased (typeof cell)) (p2: ptr cell) (a: U32.t) (q: Ghost.erased (list U32.t))\n: STGhost unit opened\n (pts_to p1 v1 `star`\n llist p2 q `star`\n freeable p1\n )\n (fun _ -> llist p1 (a :: q))\n (Ghost.reveal v1 == ({ hd = mk_scalar a; tl = mk_scalar p2 }))\n (fun _ -> True)\n= noop ();\n rewrite_with_tactic (llist_cons p1 a q llist) (llist p1 (a :: q))", "val elim_ghost_vptr (#a: Type) (#opened: inames) (r: ghost_ref a) (p: perm)\n : SteelGhost (erased a)\n opened\n (ghost_vptrp r p)\n (fun v -> ghost_pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (ghost_vptrp r p))\nlet elim_ghost_vptr (#a:Type) (#opened:inames) (r:ghost_ref a)\n (p: perm)\n : SteelGhost (erased a) opened (ghost_vptrp r p) (fun v -> ghost_pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (ghost_vptrp r p))\n = let v = gget (ghost_vptrp r p) in\n change_slprop (ghost_vptrp r p) (ghost_pts_to r p v) v () (elim_ghost_vptr_lemma r p v);\n v", "val mk_selector_vprop_intro\n (#opened: _) (#t: Type0) (#x: t)\n (p: t -> vprop) (p_inj: interp_hp_of_injective p)\n: SteelGhost unit opened\n (p x)\n (fun _ -> mk_selector_vprop p p_inj)\n (fun _ -> True)\n (fun _ _ h' -> h' (mk_selector_vprop p p_inj) == x)\nlet mk_selector_vprop_intro\n #_ #_ #x p p_inj\n= change_slprop_rel\n (p _)\n (mk_selector_vprop p p_inj)\n (fun _ x' -> x == x')\n (fun m ->\n intro_h_exists x (hp_of_pointwise p) m;\n let x' = mk_selector_vprop_sel' p p_inj m in\n p_inj x x' m\n )", "val adjoint_elim_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is: inames{opened /! is})\n (p q r: vprop)\n (f: (opened: inames{opened /! is} -> STGhostT unit opened p (fun _ -> ( @==> ) #is q r)))\n : STGhostT unit opened (p `star` q) (fun _ -> r)\nlet adjoint_elim_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is : inames{opened /! is})\n (p q r: vprop)\n (f: (\n (opened: inames { opened /! is }) ->\n STGhostT unit opened\n p (fun _ -> (@==>) #is q r)\n ))\n: STGhostT unit opened\n (p `star` q)\n (fun _ -> r)\n= f _;\n elim_implies_gen #opened q r", "val ghost_reveal (a:Type) (x:erased a)\r\n : stt_ghost a emp (fun y -> pure (reveal x == y))\nlet ghost_reveal (a:Type) (x:erased a)\r\n: stt_ghost a emp (fun y -> pure (reveal x == y))\r\n= let m\r\n : stt_ghost a\r\n (pure (reveal x == reveal x))\r\n (fun y -> pure (reveal x == y))\r\n = Ghost.hide (A.return #_ #(fun y -> pure (reveal x == y)) (reveal x))\r\n in\r\n pure_trivial (reveal x == reveal x) ();\r\n m", "val intro_vptrp\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h0 _ h1 ->\n Seq.create 1 (selp r p h1) == A.aselp r p h0\n )\nlet intro_vptrp r p =\n let h0 = get () in\n intro_vptrp' r p;\n let h1 = get () in\n assert (Seq.create 1 (selp r p h1) `Seq.equal` A.aselp r p h0)", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val intro_queue_tail\n (#opened: _)\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (tail: ref (ccell_ptrvalue a))\n: SteelGhost unit opened\n (llist_fragment_tail l (cllist_head x) `star` vptr (cllist_tail x) `star` vptr tail)\n (fun _ -> queue_tail x l)\n (fun h ->\n sel_llist_fragment_tail l (cllist_head x) h == tail /\\\n sel (cllist_tail x) h == tail /\\\n ccell_ptrvalue_is_null (sel tail h)\n )\n (fun _ _ _ -> True)\nlet intro_queue_tail\n x l tail\n=\n intro_vrefine (vptr tail) (queue_tail_refine tail tail);\n intro_vdep2\n (vptr (cllist_tail x))\n (vptr tail `vrefine` queue_tail_refine tail tail)\n tail\n (queue_tail_dep2 x l tail);\n intro_vdep2\n (llist_fragment_tail l (cllist_head x))\n (vptr (cllist_tail x) `vdep` queue_tail_dep2 x l tail)\n tail\n (queue_tail_dep1 x l)", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = MHR.write r (U.raise_val x);\n rewrite_slprop\n (MHR.pts_to _ _ _)\n (pts_to r full_perm x)\n (fun _ -> ())", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = let h_old_e = witness_exists #_ #_ #(pts_to_body r full_perm v) () in\n let _ = elim_pure r v h_old_e in\n\n let h_old = read r in\n let h: history a p = extend_history' h_old x in\n write r h_old_e h;\n\n intro_pure_full r x h", "val mk_selector_vprop_elim\n (#opened: _) (#t: Type0)\n (p: t -> vprop) (p_inj: interp_hp_of_injective p)\n: SteelGhost (Ghost.erased t) opened\n (mk_selector_vprop p p_inj)\n (fun x -> p x)\n (fun _ -> True)\n (fun h x _ -> h (mk_selector_vprop p p_inj) == Ghost.reveal x)\nlet mk_selector_vprop_elim\n #_ #t p p_inj\n=\n let x0 = gget (mk_selector_vprop p p_inj) in\n let refinement (x: t) : Tot prop = x == Ghost.reveal x0 in\n intro_vrefine (mk_selector_vprop p p_inj) refinement;\n rewrite_slprop\n (mk_selector_vprop p p_inj `vrefine` refinement)\n (p x0)\n (fun m ->\n interp_vrefine_hp (mk_selector_vprop p p_inj) refinement m\n // injectivity is not needed, because the return value of the\n // selector is exactly the witness of exists_\n );\n x0", "val intro_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (#v: _) (p: P.perm) (s: Seq.seq elt)\n : STGhost unit\n opened\n (R.pts_to (ptr_of a).base v)\n (fun _ -> pts_to a p s)\n (v == mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p /\\\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a)\n (fun _ -> True)\nlet intro_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (#v: _) (p: P.perm) (s: Seq.seq elt) : STGhost unit opened\n (R.pts_to (ptr_of a).base v)\n (fun _ -> pts_to a p s)\n (\n v == mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p /\\\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a\n )\n (fun _ -> True)\n= change_r_pts_to (ptr_of a).base v (ptr_of a).base (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p);\n intro_pure _;\n rewrite\n (pts_to0 a p s)\n (pts_to a p s)", "val intro_vptrp' (#opened: _) (#a: Type0) (r: ref a) (p: perm)\n : SteelGhost unit\n opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\ selp r p h' == Seq.index s 0)\nlet intro_vptrp'\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\\n selp r p h' == Seq.index s 0\n )\n= intro_vptr0 r p;\n change_slprop_rel\n (vptr0 r p)\n (vptrp r p)\n (fun v1 v2 -> v1 === v2)\n (fun m ->\n assert (interp (hp_of (vptrp r p)) m);\n assert_norm (sel_of (vptrp r p) m === sel_of (vptr0 r p) m)\n )", "val lift_h_exists (#opened_invariants:_) (#a:_) (p:a -> slprop)\n : action_except unit opened_invariants\n (h_exists p)\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\nlet lift_h_exists #opened_invariants p = lift_tot_action (lift_heap_action opened_invariants (H.lift_h_exists p))", "val lift_h_exists (#opened_invariants:_) (#a:_) (p:a -> slprop)\n : action_except unit opened_invariants\n (h_exists p)\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\nlet lift_h_exists #opened_invariants p = lift_tot_action (lift_heap_action opened_invariants (H.lift_h_exists p))", "val ghost_alloc (#a:Type0) (#opened:inames) (x:Ghost.erased a)\n : SteelGhost (ghost_ref a) opened\n emp (fun r -> ghost_vptr r)\n (requires fun _ -> True)\n (ensures fun _ r h1 -> ghost_sel r h1 == Ghost.reveal x)\nlet ghost_alloc x =\n let r = ghost_alloc_pt x in\n intro_ghost_vptr r _ x;\n r", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= elim_pts_to a p x;\n mk_carrier_share (US.v (ptr_of a).base_len) (ptr_of a).offset x p1 p2;\n R.split (ptr_of a).base _\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p1)\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p2);\n intro_pts_to a p1 x;\n intro_pts_to a p2 x", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= rewrite\n (pts_to a _ _)\n (H.pts_to a p (seq_map raise x));\n H.share a p p1 p2;\n rewrite\n (H.pts_to a p1 _)\n (pts_to a p1 x);\n rewrite\n (H.pts_to a p2 _)\n (pts_to a p2 x)", "val exists_to_h_exists (#a: Type) (#o: _) (p: (a -> vprop))\n : STGhostT unit o (exists_ p) (fun _ -> SEA.h_exists p)\nlet exists_to_h_exists (#a:Type) #o (p:a -> vprop)\n : STGhostT unit o (exists_ p)\n (fun _ -> SEA.h_exists p)\n = let w = elim_exists () in\n intro_h_exists w p", "val elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (exists* x. p x) (fun x -> p x)\nlet elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (exists* x. p x) (fun x -> p x)\r\n= coerce_eq (exists_equiv #a #p) (elim_exists' #a p)", "val with_invariant_g (#a:Type)\n (#fp:vprop)\n (#fp':a -> vprop)\n (#opened_invariants:inames)\n (#p:vprop)\n (#perm:_)\n (i:inv p{not (mem_inv opened_invariants i)})\n ($f:unit -> SteelGhostT a (add_inv opened_invariants i)\n (p `star` fp)\n (fun x -> p `star` fp' x))\n : SteelAtomicUT (erased a) opened_invariants (active perm i `star` fp) (fun x -> active perm i `star` fp' x)\nlet with_invariant_g #a #fp #fp' #u #p #perm i f\n = let with_invariant_aux (r:ghost_ref bool)\n (_:unit)\n : SteelGhostT a (add_inv u i)\n (ex_conditional_inv r p `star`\n (ghost_pts_to r (half_perm perm) true `star`\n fp))\n (fun x ->\n ex_conditional_inv r p `star`\n (ghost_pts_to r (half_perm perm) true `star` //associativity matters\n fp' x))\n = let b = witness_exists #_ #_ #(conditional_inv r p) () in\n ghost_pts_to_injective_eq r true (hide (reveal b));\n rewrite_slprop (if b then p else emp) p (fun _ -> ());\n let x = f() in\n intro_exists true (conditional_inv r p);\n x\n in\n let x = with_invariant_g (dsnd i)\n (with_invariant_aux (gref i)) in\n x", "val intro_vptr0 (#opened: _) (#a: Type0) (r: ref a) (p: perm)\n : SteelGhost unit\n opened\n (A.varrayp r p)\n (fun _ -> vptr0 r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\ h' (vptr0 r p) == Seq.index s 0)\nlet intro_vptr0\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptr0 r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\\n h' (vptr0 r p) == Seq.index s 0\n )\n= A.varrayp_not_null r p;\n intro_vrefine (A.varrayp r p) (vptr0_refine r);\n intro_vrewrite (A.varrayp r p `vrefine` vptr0_refine r) (vptr0_rewrite r p);\n change_equal_slprop (vptr1 r p) (vptr0 r p)", "val vpattern_rewrite_with_implies (#opened: _) (#a: Type) (#x1: a) (p: (a -> vprop)) (x2: a)\n : STGhost unit\n opened\n (p x1)\n (fun _ -> (p x2) `star` (p x2 @==> p x1))\n (x1 == x2)\n (fun _ -> True)\nlet vpattern_rewrite_with_implies\n (#opened: _)\n (#a: Type)\n (#x1: a)\n (p: a -> vprop)\n (x2: a)\n: STGhost unit opened\n (p x1)\n (fun _ -> p x2 `star` (p x2 @==> p x1))\n (x1 == x2)\n (fun _ -> True)\n= rewrite_with_implies (p x1) (p x2)", "val implies_trans_r1 (#opened: _) (q1 p q2 r: vprop)\n : STGhostT unit\n opened\n ((p @==> q2) `star` ((q1 `star` q2) @==> r))\n (fun _ -> (q1 `star` p) @==> r)\nlet implies_trans_r1\n (#opened: _)\n (q1 p q2 r: vprop)\n: STGhostT unit opened\n ((p @==> q2) `star` ((q1 `star` q2) @==> r))\n (fun _ -> (q1 `star` p) @==> r)\n= implies_reg_l q1 p q2;\n implies_trans (q1 `star` p) (q1 `star` q2) r", "val id_elim_exists (#a:Type) (p : a -> slprop) (m:mem)\n : Pure (erased a)\n (requires (interp (h_exists p) m))\n (ensures (fun x -> interp (p x) m))\nlet id_elim_exists #a p m =\n let existsprop (x:a) =\n interp (p x) m\n in\n elim_h_exists p m;\n let x = IndefiniteDescription.indefinite_description_tot _ existsprop in\n x", "val implies_swap_r (#opened: _) (p q1 q2: vprop)\n : STGhostT unit opened (p @==> (q1 `star` q2)) (fun _ -> p @==> (q2 `star` q1))\nlet implies_swap_r\n (#opened: _)\n (p q1 q2: vprop)\n: STGhostT unit opened\n (p @==> (q1 `star` q2))\n (fun _ -> p @==> (q2 `star` q1))\n= implies_with_tactic (q1 `star` q2) (q2 `star` q1);\n implies_trans p (q1 `star` q2) (q2 `star` q1)", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val intro_h_exists (#a:_) (x:a) (p:a -> slprop) (m:mem)\n : Lemma (interp (p x) m ==> interp (h_exists p) m)\nlet intro_h_exists #a x p m = H.intro_h_exists x p (heap_of_mem m)", "val intro_h_exists (#a:_) (x:a) (p:a -> slprop) (m:mem)\n : Lemma (interp (p x) m ==> interp (h_exists p) m)\nlet intro_h_exists #a x p m = H.intro_h_exists x p (heap_of_mem m)", "val intro_vptr (#opened: _) (#a: Type0) (r: ref a)\n : SteelGhost unit\n opened\n (A.varray r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> A.asel r h0 == Seq.create 1 (sel r h1))\nlet intro_vptr (#opened: _)\n (#a: Type0)\n (r: ref a)\n: SteelGhost unit opened\n (A.varray r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> A.asel r h0 == Seq.create 1 (sel r h1))\n = intro_vptrp r full_perm", "val intro_queue_head\n (#opened: _)\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: Ghost.erased (ccell_ptrvalue a))\n: SteelGhost unit opened\n (vptr (cllist_head x) `star` llist_fragment_head l (cllist_head x) hd `star` vptr (cllist_tail x))\n (fun _ -> queue_head x l)\n (fun h -> (\n let frag = (sel_llist_fragment_head l (cllist_head x) hd) h in\n sel (cllist_head x) h == Ghost.reveal hd /\\\n sel (cllist_tail x) h == fst frag /\\\n ccell_ptrvalue_is_null (snd frag) == true\n ))\n (fun _ _ _ -> True)\nlet intro_queue_head\n #_ #a x l hd\n=\n let ptl = gget (llist_fragment_head l (cllist_head x) hd) in\n intro_vrefine\n (vptr (cllist_tail x))\n (queue_head_refine x l hd ptl);\n assert_norm (vptr (cllist_tail x) `vrefine` queue_head_refine x l hd ptl == queue_head_dep1 x l hd ptl);\n intro_vdep\n (llist_fragment_head l (cllist_head x) hd)\n (vptr (cllist_tail x) `vrefine` queue_head_refine x l hd ptl)\n (queue_head_dep1 x l hd);\n intro_vdep\n (vptr (cllist_head x))\n (llist_fragment_head l (cllist_head x) hd `vdep` queue_head_dep1 x l hd)\n (queue_head_dep2 x l)", "val implies_concl_r (#opened: _) (q r p: vprop)\n : STGhostT unit opened (p `star` (q @==> r)) (fun _ -> q @==> (r `star` p))\nlet implies_concl_r\n (#opened: _)\n (q r p: vprop)\n: STGhostT unit opened\n (p `star` (q @==> r))\n (fun _ -> q @==> (r `star` p))\n= implies_concl_l p q r;\n implies_with_tactic (p `star` r) (r `star` p);\n implies_trans q (p `star` r) (r `star` p)", "val elim_exists' (#a: Type u#a) (p: (a -> slprop))\n : act (erased a) emp_inames (op_exists_Star p) (fun x -> p x)\nlet elim_exists' (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (op_exists_Star p) (fun x -> p x)\r\n= fun #ictx -> mem_action_as_action _ _ _ _ (witness_h_exists #ictx (F.on_dom a p))", "val assert_null (#t: Type) (#opened: _) (#td: typedef t) (#v: Ghost.erased t) (p: ptr td)\n : STGhost unit opened (pts_to_or_null p v) (fun _ -> emp) (p == null _) (fun _ -> True)\nlet assert_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (p: ptr td)\n: STGhost unit opened\n (pts_to_or_null p v)\n (fun _ -> emp)\n (p == null _)\n (fun _ -> True)\n= rewrite (pts_to_or_null p v) emp", "val ghost_read (#a: Type0) (#opened: inames) (r: ghost_ref a)\n : SteelGhost (Ghost.erased a)\n opened\n (ghost_vptr r)\n (fun _ -> ghost_vptr r)\n (requires fun _ -> True)\n (ensures\n fun h0 x h1 -> h0 (ghost_vptr r) == h1 (ghost_vptr r) /\\ Ghost.reveal x == h1 (ghost_vptr r)\n )\nlet ghost_read (#a:Type0) (#opened:inames) (r:ghost_ref a)\n : SteelGhost (Ghost.erased a) opened\n (ghost_vptr r) (fun _ -> ghost_vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> h0 (ghost_vptr r) == h1 (ghost_vptr r) /\\ Ghost.reveal x == h1 (ghost_vptr r))\n= ghost_readp r full_perm", "val intro_pure (#opened #a #p #f: _) (r: ref a p) (v: a) (h: history a p {history_val h v f})\n : SteelGhostT unit opened (PR.pts_to r h) (fun _ -> pts_to_body r f v h)\nlet intro_pure #opened #a #p #f\n (r:ref a p)\n (v:a)\n (h:history a p { history_val h v f })\n : SteelGhostT unit opened\n (PR.pts_to r h)\n (fun _ -> pts_to_body r f v h)\n = A.intro_pure (history_val h v f)", "val intro_pure (p:prop) (_:squash p)\n: stt_ghost unit emp (fun _ -> pure p)\nlet intro_pure p _ = A.intro_pure p ()", "val exists_intro\n (a:Type)\n (p:a -> Type)\n (v:a)\n (x: unit -> Tot (squash (p v)))\n : Tot (squash (exists x. p x))\nlet exists_intro\n (a:Type)\n (p:a -> Type)\n (v:a)\n (f: unit -> Tot (squash (p v)))\n : Tot (squash (exists x. p x))\n = exists_intro_simple a p v (f())", "val intro_vrewrite (#opened:inames)\n (v: vprop) (#t: Type) (f: (normal (t_of v) -> GTot t))\n: SteelGhost unit opened v (fun _ -> vrewrite v f)\n (fun _ -> True) (fun h _ h' -> h' (vrewrite v f) == f (h v))\nlet intro_vrewrite\n v #t f\n= let x : Ghost.erased (t_of v) = gget v in\n let x' : Ghost.erased t = Ghost.hide (f (Ghost.reveal x)) in\n change_slprop\n v\n (vrewrite v f)\n x\n x'\n (fun m ->\n vrewrite_sel_eq v f m\n )", "val stt_ghost_reveal (a:Type) (x:erased a)\n: stt_ghost a emp (fun y -> pure (reveal x == y))\nlet stt_ghost_reveal a x = A.ghost_reveal a x", "val rewrite_with_implies (#opened: _) (p q: vprop)\n : STGhost unit opened p (fun _ -> q `star` (q @==> p)) (p == q) (fun _ -> True)\nlet rewrite_with_implies\n (#opened: _)\n (p q: vprop)\n: STGhost unit opened\n p\n (fun _ -> q `star` (q @==> p))\n (p == q)\n (fun _ -> True)\n= rewrite p q;\n intro_implies q p emp (fun _ ->\n rewrite q p\n )", "val implies_trans_l1 (#opened: _) (p q1 q2 r: vprop)\n : STGhostT unit\n opened\n ((p @==> q1) `star` ((q1 `star` q2) @==> r))\n (fun _ -> (p `star` q2) @==> r)\nlet implies_trans_l1\n (#opened: _)\n (p q1 q2 r: vprop)\n: STGhostT unit opened\n ((p @==> q1) `star` ((q1 `star` q2) @==> r))\n (fun _ -> (p `star` q2) @==> r)\n= implies_reg_r p q1 q2;\n implies_trans (p `star` q2) (q1 `star` q2) r", "val implies_trans (#opened: _) (v1 v2 v3: vprop)\n : STGhostT unit opened ((( @==> ) v1 v2) `star` (( @==> ) v2 v3)) (fun _ -> ( @==> ) v1 v3)\nlet implies_trans\n (#opened: _)\n (v1 v2 v3: vprop)\n: STGhostT unit opened\n (((@==>) v1 v2) `star` ((@==>) v2 v3))\n (fun _ -> (@==>) v1 v3)\n= implies_trans_gen v1 v2 v3;\n assert (Set.union Set.empty Set.empty `Set.equal` (Set.empty #iname));\n noop ();\n rewrite (implies_ #(Set.union Set.empty Set.empty) v1 v3) (implies_ #(Set.empty) v1 v3)", "val alloc (#opened: _) (#a:Type) (p:Preorder.preorder a) (v:a)\n : STGhostT (ref a p) opened emp (fun r -> pts_to r full_perm v)\nlet alloc #opened (#a:Type) (p:Preorder.preorder a) (v:a)\n : STGhostT (ref a p) opened emp (fun r -> pts_to r full_perm v)\n = let x = coerce_ghost (fun _ -> MR.alloc p v) in\n x", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share\n r\n= RST.share r.reveal", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share r)", "val atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a)\n (r:ref a)\n : SteelAtomic a opened\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires fun h -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n = let v1 : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop (pts_to r p v) (RP.pts_to r v1 `star` pure (perm_ok p)) (fun _ -> ());\n elim_pure (perm_ok p);\n\n let v2 = RP.atomic_read r v1 in\n rewrite_slprop (RP.pts_to r v1) (pts_to r p v)\n (fun m ->\n emp_unit (hp_of (pts_to_raw r p v));\n pure_star_interp (hp_of (pts_to_raw r p v)) (perm_ok p) m);\n assert (compatible pcm_frac v1 v2);\n let Some (x, _) = v2 in\n rewrite_slprop (pts_to r p v) (pts_to r p x) (fun _ -> ());\n return x", "val share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\nlet share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\n = coerce_ghost (fun _ -> R.ghost_share_pt r)", "val share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share_pt r)" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.intro_exists_erased" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.intro_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.intro_exists_erased" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.intro_exists" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.intro_exists" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.witness_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.intro_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.intro_h_exists" }, { "project_name": "steel", "file_name": "TwoLockQueue.fst", "name": "TwoLockQueue.open_exists" }, { "project_name": "steel", "file_name": "Queue.fst", "name": "Queue.witness_h_exists_erased" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.elim_exists'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.elim_exists'" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.intro_exists" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.intro_exists" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.intro_exists''" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.elim_exists" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.intro_exists'" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.e_exists_to_exists" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.intro_pure" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.exists_to_e_exists" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.elim_exists" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.intro_ghost_vptr" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_refl" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.witness_h_exists" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.witness_h_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.intro_implies" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.intro_forall" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.elim_forall" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.free" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.intro_vconst" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.rewrite_erased" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_emp_l" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_write" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.intro_vpure" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.get" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.elim_h_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.Ghost.fst", "name": "Steel.ST.Effect.Ghost.admit_" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fsti", "name": "Steel.Effect.Atomic.gget" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.adjoint_intro_implies" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.intro_vptr" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.intro_exists_compare_inv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim'" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.slassert" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim'" }, { "project_name": "steel", "file_name": "LList2.fst", "name": "LList2.intro_llist_cons" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.elim_ghost_vptr" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.mk_selector_vprop_intro" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.adjoint_elim_implies" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_reveal" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptrp" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.intro_queue_tail" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.mk_selector_vprop_elim" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.intro_pts_to" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptrp'" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.lift_h_exists" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.lift_h_exists" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_alloc" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.share" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.share" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.exists_to_h_exists" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.elim_exists" }, { "project_name": "steel", "file_name": "Steel.DisposableInvariant.fst", "name": "Steel.DisposableInvariant.with_invariant_g" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptr0" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.vpattern_rewrite_with_implies" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_trans_r1" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.id_elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_swap_r" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.intro_h_exists" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.intro_h_exists" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fsti", "name": "Steel.ArrayRef.intro_vptr" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.intro_queue_head" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_concl_r" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.elim_exists'" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Base.fsti", "name": "Steel.ST.C.Types.Base.assert_null" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.ghost_read" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.intro_pure" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.intro_pure" }, { "project_name": "FStar", "file_name": "FStar.Classical.Sugar.fst", "name": "FStar.Classical.Sugar.exists_intro" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.intro_vrewrite" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.stt_ghost_reveal" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.rewrite_with_implies" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_trans_l1" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_trans" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.atomic_read" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share" } ], "selected_premises": [ "Steel.ST.Util.intro_exists", "Steel.Effect.Common.rmem", "Steel.ST.Util.drop", "Steel.ST.Util.pure", "Steel.Memory.inames", "Steel.ST.Util.return", "Steel.Effect.Common.to_vprop", "Steel.ST.Util.rewrite", "Steel.Effect.Common.to_vprop'", "Steel.ST.Util.noop", "Steel.Effect.Common.rm", "Steel.ST.Util.assert_", "Steel.ST.Util.rewrite_with_tactic", "Steel.Effect.Common.guard_vprop", "Steel.ST.Util.rewrite_equiv", "Steel.Effect.Common.star", "Steel.Effect.Common.hp_of", "Steel.FractionalPermission.full_perm", "Steel.ST.Util.weaken", "Steel.Effect.Common.mk_rmem", "Steel.Effect.Common.t_of", "Steel.Memory.full_mem", "Steel.ST.Util.elim_pure", "Steel.ST.Util.return0", "Steel.ST.Util.intro_can_be_split_exists", "Steel.ST.Util.exists_", "Steel.Preorder.pcm_history", "Steel.Effect.Atomic.h_exists", "Steel.Effect.Common.pure", "Steel.Effect.Common.hmem", "Steel.ST.Util.intro_pure", "Steel.Effect.Common.vrefine'", "Steel.Effect.Common.normal", "Steel.Effect.Common.rmem'", "Steel.Effect.Common.req", "FStar.List.Tot.Base.length", "FStar.List.Tot.Base.map", "Steel.ST.Util.slassert0", "Steel.Effect.Common.inv", "Steel.Effect.Atomic.gget", "Steel.Memory.hmem", "Steel.Effect.Common.focus_rmem_refl", "Steel.Effect.Common.vrefine", "Steel.Preorder.history_val", "Steel.Effect.Common.normal_steps", "FStar.PCM.composable", "Steel.Effect.Common.focus_rmem", "Steel.Effect.Common.return_pre", "FStar.UInt.size", "FStar.Reflection.V2.Derived.mk_app", "Steel.ST.Util.extract_pure", "FStar.Reflection.V2.Data.var", "Steel.Effect.Common.vc_norm", "FStar.Real.one", "Steel.Effect.Common.sel_of", "Steel.Effect.Atomic.mk_selector_vprop", "FStar.Real.two", "Steel.Effect.Common.mk_rmem'", "FStar.Mul.op_Star", "Steel.Effect.Atomic.return_req", "Steel.Effect.return_req", "FStar.Reflection.V2.Derived.mk_e_app", "Steel.FractionalPermission.comp_perm", "FStar.PCM.op", "FStar.List.Tot.Base.op_At", "FStar.PCM.compatible", "Steel.Effect.Common.frame_equalities", "FStar.Reflection.V2.Derived.u_unk", "Steel.FractionalPermission.sum_perm", "Steel.Effect.Common.unfold_guard", "Steel.Effect.Common.extract_contexts", "FStar.Pervasives.reveal_opaque", "Steel.Effect.Common.focus_rmem'", "FStar.FunctionalExtensionality.feq", "Steel.Effect.Common.frame_equalities'", "Steel.ST.Util.intro_can_be_split_pure'", "Steel.Effect.subcomp_pre", "Steel.Effect.Common.try_open_existentials", "Steel.Effect.Atomic.subcomp_pre", "Steel.Effect.if_then_else_req", "Steel.Effect.Atomic.if_then_else_req", "Steel.Effect.Common.norm_return_pre", "Steel.Effect.Common.frame_vc_norm", "Steel.Effect.Common.selector'", "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq", "FStar.Sealed.Inhabited.seal", "FStar.List.Tot.Base.tl", "FStar.List.Tot.Base.rev", "Steel.Effect.Atomic.return_ens", "FStar.NMSTTotal.get", "FStar.Reflection.V2.Derived.flatten_name", "FStar.List.Tot.Base.mem", "Steel.Effect.if_then_else_ens", "Steel.Effect.Atomic.if_then_else_ens", "Steel.Effect.Common.sel_depends_only_on", "FStar.Heap.trivial_preorder", "Steel.Effect.Common.unrestricted_focus_rmem", "Steel.ST.Util.intro_can_be_split_forall_dep_exists", "Steel.ST.Util.intro_can_be_split_pure", "Steel.Effect.Common.visit_br" ], "source_upto_this": "(*\n Copyright 2020 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule Steel.ST.Util\nopen FStar.Ghost\nopen Steel.Memory\nopen Steel.ST.Effect.Ghost\nmodule U = FStar.Universe\nmodule SEA = Steel.Effect.Atomic\nmodule SE = Steel.Effect\nmodule STG = Steel.ST.Effect.Ghost\nmodule STAG = Steel.ST.Effect.AtomicAndGhost\nopen Steel.ST.Coercions\n\n#set-options \"--ide_id_info_off\"\n\nlet weaken #o p q l =\n coerce_ghost (fun () -> SEA.rewrite_slprop p q l)\n\nlet rewrite #o p q =\n weaken p q (fun _ -> ())\n\nlet rewrite_with_tactic #opened p q =\n weaken p q (fun _ -> reveal_equiv p q)\n\nlet rewrite_equiv #opened p q =\n FStar.Algebra.CommMonoid.Equiv.elim_eq_laws Steel.Effect.Common.req;\n assert (Steel.Effect.Common.req.eq == equiv);\n reveal_equiv p q;\n weaken p q (fun _ -> ())\n\nlet noop #o _ = rewrite #o emp emp\n\nlet slassert0 #o (p:vprop)\n : SEA.SteelGhostT unit o p (fun _ -> p)\n = SEA.slassert p\n\nlet assert_ #o p = coerce_ghost (fun _ -> slassert0 p)\nlet assume_ #o p = admit_ ()\nlet drop #o p = coerce_ghost (fun _ -> SEA.drop p)\nlet pure = pure\nlet reveal_pure _ = ()\nlet intro_pure #o p = coerce_ghost (fun _ -> SEA.intro_pure p)\nlet elim_pure #o p = coerce_ghost (fun _ -> SEA.elim_pure p)\n\n/// Extracting a proposition from a [pure p] while retaining [pure p]\nlet extract_pure (#uses:_) (p:prop)\n : STGhost unit uses (pure p) (fun _ -> pure p) True (fun _ -> p)\n = let _ = elim_pure p in\n intro_pure p\n\nlet intro_can_be_split_pure'\n (p: prop)\n: Lemma\n (p ==> emp `can_be_split` pure p)\n= reveal_can_be_split ();\n Classical.forall_intro (pure_interp p)\n\nlet intro_can_be_split_pure\n (p: prop)\n (sq: squash p)\n: Tot (squash (emp `can_be_split` pure p))\n= intro_can_be_split_pure' p\n\nlet intro_can_be_split_forall_dep_pure\n p\n= Classical.forall_intro (fun x -> intro_can_be_split_pure' (p x))\n\n[@@noextract_to \"Plugin\"]\nlet return0 #a #o #p (x:a)\n : SEA.SteelAtomicBase a true o Unobservable\n (return_pre (p x)) p\n (fun _ -> True)\n (fun _ v _ -> v == x)\n = let _ = () in SEA.return x\n\n[@@noextract_to \"Plugin\"]\nlet return #a #o #p x = coerce_atomicF (fun _ -> return0 x)\n\n(* Lifting the separation logic exists combinator to vprop *)\nlet exists_ (#a:Type u#a) (p:a -> vprop)\n : vprop\n = SEA.h_exists p\n\nlet intro_can_be_split_exists\n a x p\n=\n SEA.reveal_can_be_split ();\n Classical.forall_intro (Steel.Memory.intro_h_exists x (SEA.h_exists_sl' p))\n\nlet intro_can_be_split_forall_dep_exists\n b a x p\n=\n let prf\n (y: b)\n : Lemma\n (p y (x y) `can_be_split` exists_ (p y))\n =\n intro_can_be_split_exists (a y) (x y) (p y)\n in\n Classical.forall_intro prf\n\n/// Introducing an existential if the predicate [p] currently holds for value [x]\nlet intro_exists #a #o x p\n = coerce_ghost (fun _ -> SEA.intro_exists x p)\n\n/// Variant of intro_exists above, when the witness is a ghost value", "sketch": [ "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We want to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We need to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We need to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We need to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We can implement this by coercing the operation to introduce an existential proposition for the erased ghost value `x` using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We need to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We can implement this by coercing the operation to introduce an existential proposition for the erased ghost value `x` using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We want to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We want to introduce an existential proposition based on the predicate `p` and the erased ghost value `x`.\n\nStep 2: To implement this, we will use coercion to introduce the existential proposition based on the predicate `p` and the erased ghost value `x`.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We want to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We can implement this by coercing the ghost effect to introduce the existential proposition based on the predicate `p` and the erased ghost value `x`.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We want to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function.", "The `intro_exists_erased` function introduces an existential proposition if the predicate `p` currently holds for the erased ghost value `x`.\n\nStep 1: We need to introduce an existential proposition if the predicate `p` holds for the erased ghost value `x`.\nStep 2: We will implement the `intro_exists_erased` function by coercing the ghost computation to introduce the existential proposition using the `SEA.intro_exists` function." ], "generated_solution": [ "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists_erased x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists_erased x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)", "let intro_exists_erased #a #opened_invariants x p =\n coerce_ghost (fun _ -> SEA.intro_exists x p)" ] }, { "file_name": "Hacl.RSAPSS.fst", "name": "Hacl.RSAPSS.rsapss_verify", "opens_and_abbrevs": [ { "abbrev": "BD", "full_module": "Hacl.Bignum.Definitions" }, { "abbrev": "BE", "full_module": "Hacl.Bignum.Exponentiation" }, { "abbrev": "BM", "full_module": "Hacl.Bignum.Montgomery" }, { "abbrev": "BN", "full_module": "Hacl.Bignum" }, { "abbrev": "RK", "full_module": "Hacl.Impl.RSAPSS.Keys" }, { "abbrev": "RI", "full_module": "Hacl.Impl.RSAPSS" }, { "abbrev": "Hash", "full_module": "Spec.Agile.Hash" }, { "abbrev": "S", "full_module": "Spec.RSAPSS" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl" }, { "open": "Hacl" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val rsapss_verify:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n RI.rsapss_verify_st t_limbs (ke modBits) a modBits", "source_definition": "let rsapss_verify a modBits eBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits eBits pkey saltLen sgntLen sgnt msgLen msg", "source_range": { "start_line": 88, "start_col": 0, "end_line": 89, "end_col": 84 }, "interleaved": false, "definition": "fun a modBits eBits pkey saltLen sgntLen sgnt msgLen msg ->\n Hacl.Impl.RSAPSS.rsapss_verify (Hacl.RSAPSS.ke modBits) a modBits eBits pkey saltLen sgntLen sgnt\n msgLen msg", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Spec.Hash.Definitions.hash_alg", "Prims.b2t", "Spec.RSAPSS.hash_is_supported", "Hacl.RSAPSS.modBits_t", "Lib.IntTypes.size_t", "Hacl.Spec.RSAPSS.pkey_len_pre", "Hacl.RSAPSS.t_limbs", "Lib.IntTypes.v", "Lib.IntTypes.U32", "Lib.IntTypes.PUB", "Hacl.Bignum.Definitions.lbignum", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.op_Star_Bang", "FStar.UInt32.__uint_to_t", "Hacl.Bignum.Definitions.blocks", "Lib.IntTypes.size", "Lib.IntTypes.bits", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "Hacl.Impl.RSAPSS.rsapss_verify", "Hacl.RSAPSS.ke", "Prims.bool" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} -> modBits: Hacl.RSAPSS.modBits_t\n -> Hacl.Impl.RSAPSS.rsapss_verify_st Hacl.RSAPSS.t_limbs (Hacl.RSAPSS.ke modBits) a modBits", "prompt": "let rsapss_verify a modBits eBits pkey saltLen sgntLen sgnt msgLen msg =\n ", "expected_response": "RI.rsapss_verify (ke modBits) a modBits eBits pkey saltLen sgntLen sgnt msgLen msg", "source": { "project_name": "hacl-star", "file_name": "code/rsapss/Hacl.RSAPSS.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.RSAPSS.fst", "checked_file": "dataset/Hacl.RSAPSS.fst.checked", "interface_file": false, "dependencies": [ "dataset/Spec.RSAPSS.fst.checked", "dataset/Spec.Agile.Hash.fsti.checked", "dataset/prims.fst.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Hacl.Impl.RSAPSS.MGF.fst.checked", "dataset/Hacl.Impl.RSAPSS.Keys.fst.checked", "dataset/Hacl.Impl.RSAPSS.fst.checked", "dataset/Hacl.Bignum.Montgomery.fsti.checked", "dataset/Hacl.Bignum.Exponentiation.fsti.checked", "dataset/Hacl.Bignum.Definitions.fst.checked", "dataset/Hacl.Bignum.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [ "let t_limbs = U64", "let modBits_t = RI.modBits_t t_limbs", "let ke (modBits:modBits_t) =\n BE.mk_runtime_exp #t_limbs (BD.blocks modBits (size (bits t_limbs)))", "let load_pkey (modBits:modBits_t) : RK.rsapss_load_pkey_st t_limbs (ke modBits) modBits =\n RK.rsapss_load_pkey (ke modBits) modBits RK.mk_runtime_rsapss_checks", "let load_skey (modBits:modBits_t) : RK.rsapss_load_skey_st t_limbs (ke modBits) modBits =\n RK.rsapss_load_skey (ke modBits) modBits RK.mk_runtime_rsapss_checks (load_pkey modBits)", "val rsapss_sign:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n RI.rsapss_sign_st t_limbs (ke modBits) a modBits", "let rsapss_sign a modBits eBits dBits skey saltLen salt msgLen msg sgnt =\n RI.rsapss_sign (ke modBits) a modBits eBits dBits skey saltLen salt msgLen msg sgnt", "val rsapss_verify:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n RI.rsapss_verify_st t_limbs (ke modBits) a modBits" ], "closest": [ "val rsapss_verify:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_verify_st t ke a modBits\nlet rsapss_verify #t ke a modBits eBits pkey saltLen sgntLen sgnt msgLen msg =\n let hLen = RM.hash_len a in\n Math.Lemmas.pow2_lt_compat 61 32;\n Math.Lemmas.pow2_lt_compat 125 32;\n //assert (max_size_t < Hash.max_input_length a);\n assert (v msgLen <= max_size_t);\n assert (v hLen + 8 < max_size_t);\n\n let b =\n saltLen <=. 0xfffffffful -! hLen -! 8ul &&\n sgntLen =. blocks modBits 8ul in\n\n if b then\n rsapss_verify_ ke a modBits eBits pkey saltLen sgnt msgLen msg\n else\n false", "val rsapss_verify_:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_verify_st1 t ke a modBits\nlet rsapss_verify_ #t ke a modBits eBits pkey saltLen sgnt msgLen msg =\n push_frame ();\n [@inline_let] let bits : size_pos = bits t in\n let nLen = blocks modBits (size bits) in\n let m = create nLen (uint #t 0) in\n let b = rsapss_verify_compute_msg ke modBits eBits pkey sgnt m in\n let res = if b then rsapss_verify_bn_to_msg a modBits saltLen msgLen msg m else false in\n pop_frame ();\n res", "val rsapss_pkey_verify:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t\n -> rsapss_load_pkey:RK.rsapss_load_pkey_st t ke modBits\n -> rsapss_verify:rsapss_verify_st t ke a modBits ->\n rsapss_pkey_verify_st t ke a modBits\nlet rsapss_pkey_verify #t ke a modBits rsapss_load_pkey rsapss_verify eBits nb eb saltLen sgntLen sgnt msgLen msg =\n push_frame ();\n [@inline_let] let bits = size (bits t) in\n let pkey = create (2ul *! blocks modBits bits +! blocks eBits bits) (uint #t 0) in\n let h0 = ST.get () in\n let b = rsapss_load_pkey eBits nb eb pkey in\n LS.rsapss_load_pkey_lemma #t (v modBits) (v eBits) (as_seq h0 nb) (as_seq h0 eb);\n\n let res =\n if b then\n rsapss_verify eBits pkey saltLen sgntLen sgnt msgLen msg\n else\n false in\n pop_frame ();\n let h1 = ST.get () in\n assert (res == LS.rsapss_pkey_verify #t a (v modBits) (v eBits) (as_seq h0 nb) (as_seq h0 eb)\n (v saltLen) (v sgntLen) (as_seq h0 sgnt) (v msgLen) (as_seq h0 msg));\n res", "val rsapss_verify_bn_to_msg:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_verify_bn_to_msg_st t a modBits\nlet rsapss_verify_bn_to_msg #t a modBits saltLen msgLen msg m =\n push_frame ();\n [@inline_let] let bits : size_pos = bits t in\n [@inline_let] let numb : size_pos = numbytes t in\n let nLen = blocks modBits (size bits) in\n\n let emBits = modBits -! 1ul in\n let emLen = blocks emBits 8ul in\n [@inline_let] let mLen = blocks emLen (size numb) in\n let em = create emLen (u8 0) in\n\n LS.blocks_bits_lemma t (v emBits);\n LS.blocks_numb_lemma t (v emBits);\n assert (SD.blocks (v emBits) bits == v mLen);\n assert (numb * v mLen <= max_size_t);\n assert (v mLen <= v nLen);\n\n let m1 = sub m 0ul mLen in\n BN.bn_to_bytes_be emLen m1 em;\n let res = RP.pss_verify a saltLen msgLen msg emBits em in\n pop_frame ();\n res", "val rsapss_sign:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_sign_st t ke a modBits\nlet rsapss_sign #t ke a modBits eBits dBits skey saltLen salt msgLen msg sgnt =\n let hLen = RM.hash_len a in\n Math.Lemmas.pow2_lt_compat 61 32;\n Math.Lemmas.pow2_lt_compat 125 32;\n //assert (max_size_t < Hash.max_input_length a);\n\n let b =\n saltLen <=. 0xfffffffful -! hLen -! 8ul &&\n saltLen +! hLen +! 2ul <=. blocks (modBits -! 1ul) 8ul in\n\n if b then\n rsapss_sign_ ke a modBits eBits dBits skey saltLen salt msgLen msg sgnt\n else\n false", "val Hacl.Impl.RSAPSS.rsapss_verify_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_verify_st (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> pkey:lbignum t (2ul *! len +! blocks eBits (size (bits t)))\n -> saltLen:size_t\n -> sgntLen:size_t\n -> sgnt:lbuffer uint8 sgntLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h msg /\\ live h sgnt /\\ live h pkey /\\\n disjoint msg sgnt /\\ disjoint msg pkey /\\\n\n LS.rsapss_pkey_pre (v modBits) (v eBits) (as_seq h pkey))\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.rsapss_verify a (v modBits) (v eBits) (as_seq h0 pkey)\n (v saltLen) (v sgntLen) (as_seq h0 sgnt) (v msgLen) (as_seq h0 msg))", "val rsapss_sign_:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_sign_st1 t ke a modBits\nlet rsapss_sign_ #t ke a modBits eBits dBits skey saltLen salt msgLen msg sgnt =\n push_frame ();\n [@inline_let] let bits : size_pos = bits t in\n let nLen = blocks modBits (size bits) in\n let m = create nLen (uint #t 0) in\n rsapss_sign_msg_to_bn a modBits saltLen salt msgLen msg m;\n let eq_b = rsapss_sign_compute_sgnt ke modBits eBits dBits skey m sgnt in\n pop_frame ();\n eq_b", "val rsapss_verify:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> pkey:rsapss_pkey modBits\n -> sLen:size_nat\n -> k:size_nat\n -> sgnt:lbytes k\n -> msgLen:nat\n -> msg:bytes{length msg == msgLen} ->\n Tot bool\nlet rsapss_verify a modBits pkey sLen k sgnt msgLen msg =\n let b =\n sLen + Hash.hash_length a + 8 <= max_size_t &&\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a &&\n msgLen `Hash.less_than_max_input_length` a &&\n k = blocks modBits 8 in\n\n if b then\n rsapss_verify_ a modBits pkey sLen sgnt msgLen msg\n else\n false", "val Hacl.Impl.RSAPSS.rsapss_pkey_verify_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet rsapss_pkey_verify_st (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:size_t) =\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> nb:lbuffer uint8 (blocks modBits 8ul)\n -> eb:lbuffer uint8 (blocks eBits 8ul)\n -> saltLen:size_t\n -> sgntLen:size_t\n -> sgnt:lbuffer uint8 sgntLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen ->\n Stack bool\n (requires fun h ->\n blocks modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h msg /\\ live h sgnt /\\ live h nb /\\ live h eb /\\\n disjoint msg sgnt /\\ disjoint nb eb /\\ disjoint sgnt nb /\\\n disjoint sgnt eb /\\ disjoint msg nb /\\ disjoint msg eb)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == S.rsapss_pkey_verify a (v modBits) (v eBits) (as_seq h0 nb) (as_seq h0 eb)\n (v saltLen) (v sgntLen) (as_seq h0 sgnt) (v msgLen) (as_seq h0 msg))", "val rsapss_skey_sign:\n #t:limb_t\n -> ke:BE.exp t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t\n -> rsapss_load_skey:RK.rsapss_load_skey_st t ke modBits\n -> rsapss_sign:rsapss_sign_st t ke a modBits ->\n rsapss_skey_sign_st t ke a modBits\nlet rsapss_skey_sign #t ke a modBits rsapss_load_skey rsapss_sign eBits dBits nb eb db saltLen salt msgLen msg sgnt =\n [@inline_let] let bits = size (bits t) in\n let h0 = ST.get () in\n push_frame ();\n let skey = create (2ul *! blocks modBits bits +! blocks eBits bits +! blocks dBits bits) (uint #t 0) in\n let b = rsapss_load_skey eBits dBits nb eb db skey in\n LS.rsapss_load_skey_lemma #t (v modBits) (v eBits) (v dBits) (as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db);\n\n let res =\n if b then\n rsapss_sign eBits dBits skey saltLen salt msgLen msg sgnt\n else\n false in\n pop_frame ();\n let h1 = ST.get () in\n assert ((res, as_seq h1 sgnt) == LS.rsapss_skey_sign #t a (v modBits) (v eBits) (v dBits)\n (as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db) (v saltLen) (as_seq h0 salt)\n (v msgLen) (as_seq h0 msg) (as_seq h0 sgnt));\n res", "val rsapss_verify:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sLen:size_nat //saltLen\n -> k:size_nat\n -> sgnt:lseq uint8 k\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} ->\n Pure bool\n (requires rsapss_pkey_pre modBits eBits pkey)\n (ensures fun r -> rsapss_verify_post1 a modBits eBits pkey sLen k sgnt msgLen msg r)\nlet rsapss_verify #t a modBits eBits pkey sLen k sgnt msgLen msg =\n let hLen = Hash.hash_length a in\n Math.Lemmas.pow2_lt_compat 61 32;\n Math.Lemmas.pow2_lt_compat 125 32;\n //assert (max_size_t < Hash.max_input_length a);\n assert (hLen + 8 < max_size_t);\n\n let b =\n sLen <= v (0xfffffffful) - hLen - 8 &&\n msgLen `less_than_max_input_length` a &&\n k = blocks modBits 8 in\n\n if b then begin\n rsapss_verify_lemma a modBits eBits pkey sLen sgnt msgLen msg;\n rsapss_verify_ a modBits eBits pkey sLen sgnt msgLen msg end\n else\n false", "val Hacl.Impl.RSAPSS.rsapss_verify_st1 = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_verify_st1 (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> pkey:lbignum t (2ul *! len +! blocks eBits (size (bits t)))\n -> saltLen:size_t\n -> sgnt:lbuffer uint8 (blocks modBits 8ul)\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h msg /\\ live h sgnt /\\ live h pkey /\\\n disjoint msg sgnt /\\ disjoint msg pkey /\\\n\n LS.rsapss_pkey_pre (v modBits) (v eBits) (as_seq h pkey) /\\\n LS.rsapss_verify_pre a (v saltLen) (v msgLen) (as_seq h msg))\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.rsapss_verify_ a (v modBits) (v eBits) (as_seq h0 pkey)\n (v saltLen) (as_seq h0 sgnt) (v msgLen) (as_seq h0 msg))", "val rsapss_sign_msg_to_bn:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t t ->\n rsapss_sign_msg_to_bn_st t a modBits\nlet rsapss_sign_msg_to_bn #t a modBits saltLen salt msgLen msg m =\n push_frame ();\n [@inline_let] let bits : size_pos = bits t in\n [@inline_let] let numb : size_pos = numbytes t in\n let nLen = blocks modBits (size bits) in\n\n let emBits = modBits -! 1ul in\n let emLen = blocks emBits 8ul in\n [@inline_let] let mLen = blocks emLen (size numb) in\n\n let em = create emLen (u8 0) in\n RP.pss_encode a saltLen salt msgLen msg emBits em;\n LS.blocks_bits_lemma t (v emBits);\n LS.blocks_numb_lemma t (v emBits);\n assert (SD.blocks (v emBits) bits = v mLen);\n assert (numb * v mLen <= max_size_t);\n assert (v mLen <= v nLen);\n\n let h' = ST.get () in\n update_sub_f h' m 0ul mLen\n (fun h -> SB.bn_from_bytes_be (v emLen) (as_seq h' em))\n (fun _ -> BN.bn_from_bytes_be emLen em (sub m 0ul mLen));\n pop_frame ()", "val rsapss_pkey_verify:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> sLen:size_nat //saltLen\n -> k:size_nat\n -> sgnt:lseq uint8 k\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} ->\n Pure bool\n (requires True)\n (ensures fun r ->\n r == S.rsapss_pkey_verify a modBits eBits nb eb sLen k sgnt msgLen msg)\nlet rsapss_pkey_verify #t a modBits eBits nb eb sLen k sgnt msgLen msg =\n let b, pkey = rsapss_load_pkey #t modBits eBits nb eb in\n rsapss_load_pkey_lemma #t modBits eBits nb eb;\n\n if b then\n rsapss_verify a modBits eBits pkey sLen k sgnt msgLen msg\n else\n false", "val rsapss_verify_:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> pkey:rsapss_pkey modBits\n -> sLen:size_nat{\n sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a}\n -> sgnt:lbytes (blocks modBits 8)\n -> msgLen:nat{msgLen `Hash.less_than_max_input_length` a}\n -> msg:bytes{length msg == msgLen} ->\n Tot bool\nlet rsapss_verify_ a modBits pkey sLen sgnt msgLen msg =\n let n = Mk_rsapss_pkey?.n pkey in\n let e = Mk_rsapss_pkey?.e pkey in\n let k = blocks modBits 8 in\n FStar.Math.Lemmas.pow2_le_compat (8 * k) modBits;\n\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n let s = os2ip #k sgnt in\n if s < n then begin\n let m = pow_mod #n s e in\n if m < pow2 (emLen * 8) then\n let em = i2osp emLen m in\n pss_verify a sLen msgLen msg emBits em\n else false end\n else false", "val rsapss_verify_:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sLen:size_nat //saltLen\n -> sgnt:lseq uint8 (blocks modBits 8)\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} ->\n Pure bool\n (requires\n rsapss_pkey_pre modBits eBits pkey /\\\n rsapss_verify_pre a sLen msgLen msg)\n (ensures fun r -> True)\nlet rsapss_verify_ #t a modBits eBits pkey sLen sgnt msgLen msg =\n let (b, m) = rsapss_verify_compute_msg #t modBits eBits pkey sgnt in\n if b then\n rsapss_verify_bn_to_msg a modBits sLen msgLen msg m\n else\n false", "val rsapss_verify_post:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sLen:size_nat //saltLen\n -> sgnt:lseq uint8 (blocks modBits 8)\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> verify:bool -> Type0\nlet rsapss_verify_post #t a modBits eBits pkey sLen sgnt msgLen msg verify =\n rsapss_verify_pre a sLen msgLen msg /\\\n rsapss_pkey_pre modBits eBits pkey /\\\n (let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = bn_v (sub pkey 0 nLen) in\n let e = bn_v (sub pkey (nLen + nLen) eLen) in\n let pkeys : S.rsapss_pkey modBits = S.Mk_rsapss_pkey n e in\n verify == S.rsapss_verify_ a modBits pkeys sLen sgnt msgLen msg)", "val Hacl.Impl.RSAPSS.rsapss_sign_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_sign_st (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> skey:lbignum t (2ul *! len +! blocks eBits (size (bits t)) +! blocks dBits (size (bits t)))\n -> saltLen:size_t\n -> salt:lbuffer uint8 saltLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen\n -> sgnt:lbuffer uint8 (blocks modBits 8ul) ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h salt /\\ live h msg /\\ live h sgnt /\\ live h skey /\\\n disjoint sgnt salt /\\ disjoint sgnt msg /\\ disjoint sgnt salt /\\ disjoint sgnt skey /\\\n disjoint salt msg /\\\n\n LS.rsapss_skey_pre (v modBits) (v eBits) (v dBits) (as_seq h skey))\n (ensures fun h0 b h1 -> modifies (loc sgnt) h0 h1 /\\\n (b, as_seq h1 sgnt) == LS.rsapss_sign a (v modBits) (v eBits) (v dBits)\n (as_seq h0 skey) (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg) (as_seq h0 sgnt))", "val Hacl.Impl.RSAPSS.rsapss_verify_bn_to_msg_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_verify_bn_to_msg_st (t:limb_t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n saltLen:size_t\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen\n -> m:lbignum t (blocks modBits (size (bits t))) ->\n Stack bool\n (requires fun h ->\n live h msg /\\ live h m /\\ disjoint m msg /\\\n\n LS.rsapss_verify_pre a (v saltLen) (v msgLen) (as_seq h msg))\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.rsapss_verify_bn_to_msg a (v modBits) (v saltLen) (v msgLen) (as_seq h0 msg) (as_seq h0 m))", "val rsapss_verify_lemma:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sLen:size_nat //saltLen\n -> sgnt:lseq uint8 (blocks modBits 8)\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} -> Lemma\n (requires\n rsapss_verify_pre a sLen msgLen msg /\\\n rsapss_pkey_pre modBits eBits pkey)\n (ensures\n rsapss_verify_post a modBits eBits pkey sLen sgnt msgLen msg\n (rsapss_verify_ a modBits eBits pkey sLen sgnt msgLen msg))\nlet rsapss_verify_lemma #t a modBits eBits pkey sLen sgnt msgLen msg =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = sub pkey 0 nLen in\n let r2 = sub pkey nLen nLen in\n let e = sub pkey (nLen + nLen) eLen in\n\n let k = blocks modBits 8 in\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n blocks_bits_lemma t modBits;\n blocks_numb_lemma t modBits;\n assert (blocks k numb == nLen);\n assert (numb * blocks k numb <= max_size_t);\n let s = bn_from_bytes_be k sgnt in\n bn_from_bytes_be_lemma #t k sgnt;\n\n let mask = bn_lt_mask s n in\n bn_lt_mask_lemma s n;\n\n let res =\n if BB.unsafe_bool_of_limb mask then begin\n Math.Lemmas.pow2_le_compat (bits * nLen) modBits;\n SM.bn_precomp_r2_mod_n_lemma (modBits - 1) n;\n let m = bn_mod_exp_vartime_precompr2 nLen n r2 s eBits e in\n\n blocks_bits_lemma t emBits;\n blocks_numb_lemma t emBits;\n assert (blocks emLen numb == blocks emBits bits);\n assert (numb * blocks emLen numb <= max_size_t);\n\n bn_lt_pow2_lemma modBits m;\n assert (bn_lt_pow2 modBits m == (bn_v m < pow2 (emLen * 8)));\n let res =\n if bn_lt_pow2 modBits m then begin\n let m1 = sub m 0 (blocks emLen numb) in\n bn_eval_sub modBits m;\n assert (bn_v m1 == bn_v m);\n let em = bn_to_bytes_be emLen m1 in\n bn_to_bytes_be_lemma emLen m1;\n S.pss_verify a sLen msgLen msg emBits em end\n else false in\n () end in\n ()", "val rsapss_pkey_verify:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> eBits:size_pos\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> sLen:size_nat\n -> k:size_nat\n -> sgnt:lbytes k\n -> msgLen:nat\n -> msg:bytes{length msg == msgLen} ->\n Tot bool\nlet rsapss_pkey_verify a modBits eBits nb eb sLen k sgnt msgLen msg =\n let pkey = rsapss_load_pkey modBits eBits nb eb in\n match pkey with\n | Some vpkey -> rsapss_verify a modBits vpkey sLen k sgnt msgLen msg\n | None -> false", "val rsapss_verify_post1:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sLen:size_nat //saltLen\n -> k:size_nat\n -> sgnt:lseq uint8 k\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> verify:bool -> Type0\nlet rsapss_verify_post1 #t a modBits eBits pkey sLen k sgnt msgLen msg verify =\n rsapss_pkey_pre modBits eBits pkey /\\\n (let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = bn_v (sub pkey 0 nLen) in\n let e = bn_v (sub pkey (nLen + nLen) eLen) in\n let pkeys : S.rsapss_pkey modBits = S.Mk_rsapss_pkey n e in\n verify == S.rsapss_verify a modBits pkeys sLen k sgnt msgLen msg)", "val rsapss_verify_bn: #t:limb_t -> ke:BE.exp t -> modBits:modBits_t t -> rsapss_verify_bn_st t ke modBits\nlet rsapss_verify_bn #t ke modBits eBits pkey m_def s =\n [@inline_let] let bits = size (bits t) in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = sub pkey 0ul nLen in\n let r2 = sub pkey nLen nLen in\n let e = sub pkey (nLen +! nLen) eLen in\n\n let mask = BN.bn_lt_mask nLen s n in\n let h = ST.get () in\n SB.bn_lt_mask_lemma (as_seq h s) (as_seq h n);\n\n let res =\n if BB.unsafe_bool_of_limb mask then begin\n Math.Lemmas.pow2_le_compat (v bits * v nLen) (v modBits);\n SM.bn_precomp_r2_mod_n_lemma (v modBits - 1) (as_seq h n);\n\n let h0 = ST.get () in\n BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_vt_precomp n r2 s eBits e m_def;\n let h1 = ST.get () in\n SD.bn_eval_inj (v nLen) (as_seq h1 m_def)\n (SE.bn_mod_exp_vartime_precompr2 (v nLen) (as_seq h0 n) (as_seq h0 r2)\n (as_seq h1 s) (v eBits) (as_seq h0 e));\n\n if bn_lt_pow2 modBits m_def then true\n else false end\n else false in\n res", "val Hacl.Impl.RSAPSS.rsapss_skey_sign_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet rsapss_skey_sign_st (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:size_t) =\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> nb:lbuffer uint8 (blocks modBits 8ul)\n -> eb:lbuffer uint8 (blocks eBits 8ul)\n -> db:lbuffer uint8 (blocks dBits 8ul)\n -> saltLen:size_t\n -> salt:lbuffer uint8 saltLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen\n -> sgnt:lbuffer uint8 (blocks modBits 8ul) ->\n Stack bool\n (requires fun h ->\n blocks modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h salt /\\ live h msg /\\ live h sgnt /\\\n live h nb /\\ live h eb /\\ live h db /\\\n disjoint sgnt salt /\\ disjoint sgnt msg /\\ disjoint sgnt salt /\\\n disjoint sgnt nb /\\ disjoint sgnt eb /\\ disjoint sgnt db /\\\n disjoint salt msg)\n (ensures fun h0 b h1 -> modifies (loc sgnt) h0 h1 /\\\n (let sgnt_s = S.rsapss_skey_sign a (v modBits) (v eBits) (v dBits)\n (as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db) (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg) in\n if b then Some? sgnt_s /\\ as_seq h1 sgnt == Some?.v sgnt_s else None? sgnt_s))", "val Hacl.Impl.RSAPSS.rsapss_sign_st1 = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_sign_st1 (t:limb_t) (ke:BE.exp t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> skey:lbignum t (2ul *! len +! blocks eBits (size (bits t)) +! blocks dBits (size (bits t)))\n -> saltLen:size_t\n -> salt:lbuffer uint8 saltLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen\n -> sgnt:lbuffer uint8 (blocks modBits 8ul) ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h salt /\\ live h msg /\\ live h sgnt /\\ live h skey /\\\n disjoint sgnt salt /\\ disjoint sgnt msg /\\ disjoint sgnt salt /\\ disjoint sgnt skey /\\\n disjoint salt msg /\\\n\n LS.rsapss_skey_pre (v modBits) (v eBits) (v dBits) (as_seq h skey) /\\\n LS.rsapss_sign_pre a (v modBits) (v saltLen) (as_seq h salt) (v msgLen) (as_seq h msg))\n (ensures fun h0 eq_m h1 -> modifies (loc sgnt) h0 h1 /\\\n (eq_m, as_seq h1 sgnt) == LS.rsapss_sign_ a (v modBits) (v eBits) (v dBits)\n (as_seq h0 skey) (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg))", "val rsapss_sign_:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> skey:rsapss_skey modBits\n -> sLen:size_nat{\n sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a /\\\n sLen + Hash.hash_length a + 2 <= blocks (modBits - 1) 8}\n -> salt:lbytes sLen\n -> msgLen:nat{msgLen `Hash.less_than_max_input_length` a}\n -> msg:bytes{length msg == msgLen} ->\n tuple2 bool (lbytes (blocks modBits 8))\nlet rsapss_sign_ a modBits skey sLen salt msgLen msg =\n let pkey = Mk_rsapss_skey?.pkey skey in\n let n = Mk_rsapss_pkey?.n pkey in\n let e = Mk_rsapss_pkey?.e pkey in\n let d = Mk_rsapss_skey?.d skey in\n\n let k = blocks modBits 8 in\n FStar.Math.Lemmas.pow2_le_compat (8 * k) modBits;\n\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n let em = pss_encode a sLen salt msgLen msg emBits in\n let m = os2ip #emLen em in\n os2ip_lemma emBits em;\n let s = pow_mod #n m d in\n let m' = pow_mod #n s e in\n let eq_m = m = m' in\n let s = if eq_m then s else 0 in\n (eq_m, i2osp k s)", "val Hacl.Impl.RSAPSS.rsapss_verify_bn_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_verify_bn_st (t:limb_t) (ke:BE.exp t) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> pkey:lbignum t (2ul *! len +! blocks eBits (size (bits t)))\n -> m_def:lbignum t len\n -> s:lbignum t len ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h pkey /\\ live h m_def /\\ live h s /\\\n disjoint m_def pkey /\\ disjoint m_def s /\\ disjoint s pkey /\\\n LS.rsapss_pkey_pre (v modBits) (v eBits) (as_seq h pkey))\n (ensures fun h0 r h1 -> modifies (loc m_def) h0 h1 /\\\n (r, as_seq h1 m_def) == LS.rsapss_verify_bn (v modBits) (v eBits) (as_seq h0 pkey) (as_seq h0 m_def) (as_seq h0 s))", "val rsapss_sign:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> skey:rsapss_skey modBits\n -> sLen:size_nat\n -> salt:lbytes sLen\n -> msgLen:nat\n -> msg:bytes{length msg == msgLen} ->\n option (lbytes (blocks modBits 8))\nlet rsapss_sign a modBits skey sLen salt msgLen msg =\n let b =\n sLen + Hash.hash_length a + 8 <= max_size_t &&\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a &&\n msgLen `Hash.less_than_max_input_length` a &&\n sLen + Hash.hash_length a + 2 <= blocks (modBits - 1) 8 in\n\n if b then begin\n let (eq_m, sgnt) = rsapss_sign_ a modBits skey sLen salt msgLen msg in\n if eq_m then Some sgnt else None end\n else\n None", "val rsapss_verify_compute_msg:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:modBits_t t ->\n rsapss_verify_compute_msg_st t ke modBits\nlet rsapss_verify_compute_msg #t ke modBits eBits pkey sgnt m =\n push_frame ();\n [@inline_let] let bits : size_pos = bits t in\n [@inline_let] let numb : size_pos = numbytes t in\n let nLen = blocks modBits (size bits) in\n let k = blocks modBits 8ul in\n\n let s = create nLen (uint #t 0) in\n LS.blocks_bits_lemma t (v modBits);\n LS.blocks_numb_lemma t (v modBits);\n assert (SD.blocks (v k) numb == v nLen);\n assert (numb * v nLen <= max_size_t);\n BN.bn_from_bytes_be k sgnt s;\n\n let b = rsapss_verify_bn #t ke modBits eBits pkey m s in\n pop_frame ();\n b", "val rsapss_verify_bn_to_msg:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat{1 < modBits}\n -> sLen:size_nat //saltLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> m:lbignum t (blocks modBits (bits t)) ->\n Pure bool\n (requires rsapss_verify_pre a sLen msgLen msg)\n (ensures fun r -> True)\nlet rsapss_verify_bn_to_msg #t a modBits sLen msgLen msg m =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n blocks_bits_lemma t emBits;\n blocks_numb_lemma t emBits;\n assert (blocks emLen numb == blocks emBits bits);\n assert (numb * blocks emLen numb <= max_size_t);\n\n let m1 = sub m 0 (blocks emLen numb) in\n let em = bn_to_bytes_be emLen m1 in\n S.pss_verify a sLen msgLen msg emBits em", "val Hacl.Impl.RSAPSS.rsapss_sign_msg_to_bn_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_sign_msg_to_bn_st (t:limb_t) (a:Hash.hash_alg{S.hash_is_supported a}) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n saltLen:size_t\n -> salt:lbuffer uint8 saltLen\n -> msgLen:size_t\n -> msg:lbuffer uint8 msgLen\n -> m:lbignum t len ->\n Stack unit\n (requires fun h ->\n live h salt /\\ live h msg /\\ live h m /\\\n disjoint salt msg /\\ disjoint m msg /\\ disjoint m salt /\\\n as_seq h m == LSeq.create (v len) (uint #t 0) /\\\n LS.rsapss_sign_pre a (v modBits) (v saltLen) (as_seq h salt) (v msgLen) (as_seq h msg))\n (ensures fun h0 _ h1 -> modifies (loc m) h0 h1 /\\\n as_seq h1 m == LS.rsapss_sign_msg_to_bn a (v modBits) (v saltLen) (as_seq h0 salt) (v msgLen) (as_seq h0 msg))", "val rsapss_check_modulus:\n #t:limb_t\n -> bn_check_num_bits:bn_check_num_bits_st t ->\n rsapss_check_modulus_st t\nlet rsapss_check_modulus #t bn_check_num_bits modBits n =\n let nLen = blocks modBits (size (bits t)) in\n let bits0 = BN.bn_is_odd nLen n in\n let m0 = uint #t 0 -. bits0 in\n let m1 = BN.bn_gt_pow2_mask nLen n (modBits -! 1ul) in\n let m2 = bn_check_num_bits modBits n in\n m0 &. (m1 &. m2)", "val rsapss_sign:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> sgnt:lseq uint8 (blocks modBits 8)\n -> Pure (tuple2 bool (lseq uint8 (blocks modBits 8)))\n (requires rsapss_skey_pre modBits eBits dBits skey)\n (ensures fun (b, sgnt) ->\n rsapss_sign_post1 a modBits eBits dBits skey sLen salt msgLen msg b sgnt)\nlet rsapss_sign #t a modBits eBits dBits skey sLen salt msgLen msg sgnt =\n let hLen = Hash.hash_length a in\n Math.Lemmas.pow2_lt_compat 61 32;\n Math.Lemmas.pow2_lt_compat 125 32;\n\n let b =\n sLen <= v (0xfffffffful) - hLen - 8 &&\n msgLen `less_than_max_input_length` a &&\n sLen + hLen + 2 <= blocks (modBits - 1) 8 in\n\n if b then begin\n rsapss_sign_lemma a modBits eBits dBits skey sLen salt msgLen msg;\n rsapss_sign_ a modBits eBits dBits skey sLen salt msgLen msg end\n else\n false, sgnt", "val rsapss_sign_post:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> eq_m:bool\n -> sgnt:lseq uint8 (blocks modBits 8) -> Type0\nlet rsapss_sign_post #t a modBits eBits dBits skey sLen salt msgLen msg eq_m sgnt =\n rsapss_sign_pre a modBits sLen salt msgLen msg /\\\n rsapss_skey_pre modBits eBits dBits skey /\\\n (let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let n = bn_v (sub skey 0 nLen) in\n let e = bn_v (sub skey (nLen + nLen) eLen) in\n let d = bn_v (sub skey (nLen + nLen + eLen) dLen) in\n let pkeys : S.rsapss_pkey modBits = S.Mk_rsapss_pkey n e in\n let skeys : S.rsapss_skey modBits = S.Mk_rsapss_skey pkeys d in\n let eq_m_s, sgnt_s = S.rsapss_sign_ a modBits skeys sLen salt msgLen msg in\n eq_m_s == eq_m /\\ sgnt == sgnt_s)", "val rsapss_skey_sign:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8)\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> sgnt:lseq uint8 (blocks modBits 8)\n -> Pure (tuple2 bool (lseq uint8 (blocks modBits 8)))\n (requires True)\n (ensures fun (b, sgnt) ->\n (let sgnt_s = S.rsapss_skey_sign a modBits eBits dBits nb eb db sLen salt msgLen msg in\n if b then Some? sgnt_s /\\ sgnt == Some?.v sgnt_s else None? sgnt_s))\nlet rsapss_skey_sign #t a modBits eBits dBits nb eb db sLen salt msgLen msg sgnt =\n let b, skey = rsapss_load_skey #t modBits eBits dBits nb eb db in\n rsapss_load_skey_lemma #t modBits eBits dBits nb eb db;\n\n if b then\n rsapss_sign a modBits eBits dBits skey sLen salt msgLen msg sgnt\n else\n false, sgnt", "val rsapss_sign_:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} ->\n Pure (tuple2 bool (lseq uint8 (blocks modBits 8)))\n (requires\n rsapss_skey_pre modBits eBits dBits skey /\\\n rsapss_sign_pre a modBits sLen salt msgLen msg)\n (ensures fun res -> True)\nlet rsapss_sign_ #t a modBits eBits dBits skey sLen salt msgLen msg =\n let m = rsapss_sign_msg_to_bn #t a modBits sLen salt msgLen msg in\n rsapss_sign_compute_sgnt #t modBits eBits dBits skey m", "val rsapss_verify_bn:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> m_def:lbignum t (blocks modBits (bits t))\n -> s:lbignum t (blocks modBits (bits t)) ->\n Pure (tuple2 bool (lbignum t (blocks modBits (bits t))))\n (requires rsapss_pkey_pre modBits eBits pkey)\n (ensures fun res -> True)\nlet rsapss_verify_bn #t modBits eBits pkey m_def s =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = sub pkey 0 nLen in\n let r2 = sub pkey nLen nLen in\n let e = sub pkey (nLen + nLen) eLen in\n\n let mask = bn_lt_mask s n in\n bn_lt_mask_lemma s n;\n\n if BB.unsafe_bool_of_limb mask then begin\n Math.Lemmas.pow2_le_compat (bits * nLen) modBits;\n SM.bn_precomp_r2_mod_n_lemma (modBits - 1) n;\n\n let m = bn_mod_exp_vartime_precompr2 nLen n r2 s eBits e in\n if bn_lt_pow2 modBits m then (true, m)\n else false, m end\n else false, m_def", "val Hacl.Impl.RSAPSS.rsapss_verify_compute_msg_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_verify_compute_msg_st (t:limb_t) (ke:BE.exp t) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> pkey:lbignum t (2ul *! len +! blocks eBits (size (bits t)))\n -> sgnt:lbuffer uint8 (blocks modBits 8ul)\n -> m:lbignum t len ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h sgnt /\\ live h pkey /\\ live h m /\\\n disjoint m sgnt /\\ disjoint m pkey /\\\n as_seq h m == LSeq.create (v len) (uint #t 0) /\\\n LS.rsapss_pkey_pre (v modBits) (v eBits) (as_seq h pkey))\n (ensures fun h0 r h1 -> modifies (loc m) h0 h1 /\\\n (r, as_seq h1 m) == LS.rsapss_verify_compute_msg (v modBits) (v eBits) (as_seq h0 pkey) (as_seq h0 sgnt))", "val rsapss_sign_post1:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen}\n -> eq_m:bool\n -> sgnt:lseq uint8 (blocks modBits 8) -> Type0\nlet rsapss_sign_post1 #t a modBits eBits dBits skey sLen salt msgLen msg eq_m sgnt =\n rsapss_skey_pre modBits eBits dBits skey /\\\n (let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let n = bn_v (sub skey 0 nLen) in\n let e = bn_v (sub skey (nLen + nLen) eLen) in\n let d = bn_v (sub skey (nLen + nLen + eLen) dLen) in\n let pkeys : S.rsapss_pkey modBits = S.Mk_rsapss_pkey n e in\n let skeys : S.rsapss_skey modBits = S.Mk_rsapss_skey pkeys d in\n let sgnt_s = S.rsapss_sign a modBits skeys sLen salt msgLen msg in\n if eq_m then Some? sgnt_s /\\ sgnt == Some?.v sgnt_s else None? sgnt_s)", "val rsapss_check_modulus: #t:limb_t -> modBits:size_pos -> n:lbignum t (blocks modBits (bits t)) ->\n res:limb t{v res == (if (bn_v n % 2 = 1 && pow2 (modBits - 1) < bn_v n && bn_v n < pow2 modBits) then v (ones t SEC) else v (zeros t SEC))}\nlet rsapss_check_modulus #t modBits n =\n let bit0 = bn_is_odd n in\n bn_is_odd_lemma n;\n assert (v bit0 == bn_v n % 2);\n let m0 = uint #t 0 -. bit0 in\n\n let m1 = bn_gt_pow2_mask n (modBits - 1) in\n bn_gt_pow2_mask_lemma n (modBits - 1);\n\n let m2 = bn_check_num_bits modBits n in\n let m = m0 &. (m1 &. m2) in\n logand_lemma m0 (m1 &. m2);\n logand_lemma m1 m2;\n m", "val rsapss_sign_lemma:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} -> Lemma\n (requires\n rsapss_sign_pre a modBits sLen salt msgLen msg /\\\n rsapss_skey_pre modBits eBits dBits skey)\n (ensures\n (let eq_m, s = rsapss_sign_ a modBits eBits dBits skey sLen salt msgLen msg in\n rsapss_sign_post a modBits eBits dBits skey sLen salt msgLen msg eq_m s))\nlet rsapss_sign_lemma #t a modBits eBits dBits skey sLen salt msgLen msg =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let n = sub skey 0 nLen in\n let r2 = sub skey nLen nLen in\n let e = sub skey (nLen + nLen) eLen in\n let d = sub skey (nLen + nLen + eLen) dLen in\n\n let k = blocks modBits 8 in\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n let em = S.pss_encode a sLen salt msgLen msg emBits in\n blocks_bits_lemma t emBits;\n blocks_numb_lemma t emBits;\n assert (blocks emLen numb == blocks emBits bits);\n assert (numb * blocks emLen numb <= max_size_t);\n\n let emNat = bn_from_bytes_be emLen em in\n let m = create nLen (uint #t 0) in\n let m = update_sub m 0 (blocks emLen numb) emNat in\n bn_eval_update_sub (blocks emLen numb) emNat nLen;\n assert (bn_v m == bn_v emNat);\n bn_from_bytes_be_lemma #t emLen em;\n S.os2ip_lemma emBits em;\n\n assert (bn_v m < bn_v n);\n Math.Lemmas.pow2_le_compat (bits * nLen) modBits;\n SM.bn_precomp_r2_mod_n_lemma (modBits - 1) n;\n let s = bn_mod_exp_consttime_precompr2 nLen n r2 m dBits d in\n let m' = bn_mod_exp_vartime_precompr2 nLen n r2 s eBits e in\n\n let eq_m = bn_eq_mask m m' in\n bn_eq_mask_lemma m m';\n\n let s' = map (logand eq_m) s in\n bn_mask_lemma s eq_m;\n\n blocks_bits_lemma t modBits;\n blocks_numb_lemma t modBits;\n assert (blocks k numb == nLen);\n assert (numb * blocks k numb <= max_size_t);\n Math.Lemmas.pow2_le_compat (8 * k) modBits;\n assert (bn_v s' < pow2 (8 * k));\n let sgnt = bn_to_bytes_be k s' in\n bn_to_bytes_be_lemma k s'", "val rsapss_sign_bn: #t:limb_t -> ke:BE.exp t -> modBits:modBits_t t -> rsapss_sign_bn_st t ke modBits\nlet rsapss_sign_bn #t ke modBits eBits dBits skey m m' s =\n [@inline_let] let bits : size_pos = bits t in\n let nLen = blocks modBits (size bits) in\n let eLen = blocks eBits (size bits) in\n let dLen = blocks dBits (size bits) in\n\n let n = sub skey 0ul nLen in\n let r2 = sub skey nLen nLen in\n let e = sub skey (nLen +! nLen) eLen in\n let d = sub skey (nLen +! nLen +! eLen) dLen in\n\n Math.Lemmas.pow2_le_compat (bits * v nLen) (v modBits);\n let h0 = ST.get () in\n SM.bn_precomp_r2_mod_n_lemma (v modBits - 1) (as_seq h0 n);\n BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_ct_precomp n r2 m dBits d s;\n BE.mk_bn_mod_exp_precompr2 nLen ke.BE.exp_vt_precomp n r2 s eBits e m';\n let h1 = ST.get () in\n SD.bn_eval_inj (v nLen) (as_seq h1 s)\n (SE.bn_mod_exp_consttime_precompr2 (v nLen) (as_seq h0 n) (as_seq h0 r2)\n (as_seq h0 m) (v dBits) (as_seq h0 d));\n SD.bn_eval_inj (v nLen) (as_seq h1 m')\n (SE.bn_mod_exp_vartime_precompr2 (v nLen) (as_seq h0 n) (as_seq h0 r2)\n (as_seq h1 s) (v eBits) (as_seq h0 e));\n let eq_m = BN.bn_eq_mask nLen m m' in\n mapT nLen s (logand eq_m) s;\n BB.unsafe_bool_of_limb eq_m", "val rsapss_skey_sign:\n a:Hash.hash_alg{hash_is_supported a}\n -> modBits:modBits_t\n -> eBits:size_pos\n -> dBits:size_pos\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8)\n -> sLen:size_nat\n -> salt:lbytes sLen\n -> msgLen:nat\n -> msg:bytes{length msg == msgLen} ->\n option (lbytes (blocks modBits 8))\nlet rsapss_skey_sign a modBits eBits dBits nb eb db sLen salt msgLen msg =\n let skey = rsapss_load_skey modBits eBits dBits nb eb db in\n match skey with\n | Some vskey -> rsapss_sign a modBits vskey sLen salt msgLen msg\n | None -> None", "val rsapss_load_skey:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:size_t\n -> kc:rsapss_checks t\n -> rsapss_load_pkey:rsapss_load_pkey_st t ke modBits ->\n rsapss_load_skey_st t ke modBits\nlet rsapss_load_skey #t ke modBits kc rsapss_load_pkey eBits dBits nb eb db skey =\n let h0 = ST.get () in\n [@inline_let] let bits = size (bits t) in\n [@inline_let] let numb = size (numbytes t) in\n let nbLen = blocks modBits 8ul in\n let ebLen = blocks eBits 8ul in\n let dbLen = blocks dBits 8ul in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let pkeyLen = nLen +! nLen +! eLen in\n let skeyLen = pkeyLen +! eLen in\n\n LS.blocks_bits_lemma t (v dBits);\n assert (v (blocks dbLen numb) == v dLen);\n\n let pkey = sub skey 0ul pkeyLen in\n let d = sub skey pkeyLen dLen in\n\n let b = rsapss_load_pkey eBits nb eb pkey in\n BN.bn_from_bytes_be dbLen db d;\n let h1 = ST.get () in\n LSeq.lemma_concat2 (v pkeyLen) (as_seq h1 pkey) (v dLen) (as_seq h1 d) (as_seq h1 skey);\n\n let m1 = kc.check_exponent dBits d in\n let b1 = b && BB.unsafe_bool_of_limb m1 in\n b1", "val rsapss_sign_msg_to_bn:\n #t:limb_t\n -> a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:size_nat{1 < modBits}\n -> sLen:size_nat\n -> salt:lseq uint8 sLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} ->\n Pure (lbignum t (blocks modBits (bits t)))\n (requires rsapss_sign_pre a modBits sLen salt msgLen msg)\n (ensures fun res -> bn_v res < pow2 (modBits - 1))\nlet rsapss_sign_msg_to_bn #t a modBits sLen salt msgLen msg =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n\n let emBits = modBits - 1 in\n let emLen = blocks emBits 8 in\n\n let em = S.pss_encode a sLen salt msgLen msg emBits in\n blocks_bits_lemma t emBits;\n blocks_numb_lemma t emBits;\n assert (blocks emLen numb == blocks emBits bits);\n assert (numb * blocks emLen numb <= max_size_t);\n let emNat = bn_from_bytes_be #t emLen em in\n let m = create nLen (uint #t 0) in\n let m = update_sub m 0 (blocks emLen numb) emNat in\n bn_eval_update_sub (blocks emLen numb) emNat nLen;\n assert (bn_v m == bn_v emNat);\n bn_from_bytes_be_lemma #t emLen em;\n S.os2ip_lemma emBits em;\n m", "val rsapss_load_pkey:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:size_t\n -> kc:rsapss_checks t ->\n rsapss_load_pkey_st t ke modBits\nlet rsapss_load_pkey #t ke modBits kc eBits nb eb pkey =\n let h0 = ST.get () in\n [@inline_let] let bits = size (bits t) in\n [@inline_let] let numb = size (numbytes t) in\n let nbLen = blocks modBits 8ul in\n let ebLen = blocks eBits 8ul in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n assert (v ((modBits -! 1ul) /. bits) < v nLen);\n\n LS.blocks_bits_lemma t (v modBits);\n assert (v (blocks nbLen numb) == v nLen);\n\n LS.blocks_bits_lemma t (v eBits);\n assert (v (blocks ebLen numb) == v eLen);\n\n let n = sub pkey 0ul nLen in\n let r2 = sub pkey nLen nLen in\n let e = sub pkey (nLen +! nLen) eLen in\n\n BN.bn_from_bytes_be nbLen nb n;\n ke.BE.precompr2 (modBits -! 1ul) n r2;\n BN.bn_from_bytes_be ebLen eb e;\n let h1 = ST.get () in\n LSeq.lemma_concat3 (v nLen) (as_seq h1 n)\n (v nLen) (as_seq h1 r2) (v eLen) (as_seq h1 e) (as_seq h1 pkey);\n\n let m0 = kc.check_modulus modBits n in\n let m1 = kc.check_exponent eBits e in\n let m = m0 &. m1 in\n BB.unsafe_bool_of_limb #t m", "val rsapss_sign_compute_sgnt:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:modBits_t t ->\n rsapss_sign_compute_sgnt_st t ke modBits\nlet rsapss_sign_compute_sgnt #t ke modBits eBits dBits skey m sgnt =\n push_frame ();\n let h_init = ST.get () in\n [@inline_let] let bits : size_pos = bits t in\n [@inline_let] let numb : size_pos = numbytes t in\n let nLen = blocks modBits (size bits) in\n\n let k = blocks modBits 8ul in\n let s = create nLen (uint #t 0) in\n let m' = create nLen (uint #t 0) in\n let eq_b = rsapss_sign_bn ke modBits eBits dBits skey m m' s in\n LS.blocks_bits_lemma t (v modBits);\n LS.blocks_numb_lemma t (v modBits);\n assert (SD.blocks (v k) numb == v nLen);\n assert (numb * v nLen <= max_size_t);\n BN.bn_to_bytes_be k s sgnt;\n pop_frame ();\n eq_b", "val rsapss_check_skey_len:\n #t:limb_t\n -> modBits:size_t\n -> eBits:size_t\n -> dBits:size_t ->\n res:bool{res <==> LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\nlet rsapss_check_skey_len #t modBits eBits dBits =\n if rsapss_check_pkey_len #t modBits eBits && 0ul <. dBits then begin\n [@inline_let] let bits = size (bits t) in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n dLen <=. 0xfffffffful /. bits &&\n 2ul *! nLen <=. 0xfffffffful -! eLen -! dLen end\n else false", "val rsapss_verify_compute_msg:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t))\n -> sgnt:lseq uint8 (blocks modBits 8) ->\n Pure (tuple2 bool (lbignum t (blocks modBits (bits t))))\n (requires rsapss_pkey_pre modBits eBits pkey)\n (ensures fun res -> True)\nlet rsapss_verify_compute_msg #t modBits eBits pkey sgnt =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n let k = blocks modBits 8 in\n\n blocks_bits_lemma t modBits;\n blocks_numb_lemma t modBits;\n assert (blocks k numb == nLen);\n assert (numb * blocks k numb <= max_size_t);\n let s = bn_from_bytes_be k sgnt in\n\n let m_def = create nLen (uint #t 0) in\n rsapss_verify_bn #t modBits eBits pkey m_def s", "val Hacl.Impl.RSAPSS.rsapss_sign_bn_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_sign_bn_st (t:limb_t) (ke:BE.exp t) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> skey:lbignum t (2ul *! len +! blocks eBits (size (bits t)) +! blocks dBits (size (bits t)))\n -> m:lbignum t len\n -> m':lbignum t len\n -> s:lbignum t len ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h skey /\\ live h m /\\ live h s /\\ live h m' /\\\n disjoint s m /\\ disjoint s skey /\\ disjoint m skey /\\\n disjoint m m' /\\ disjoint m' s /\\ disjoint m' skey /\\\n LS.rsapss_skey_pre (v modBits) (v eBits) (v dBits) (as_seq h skey) /\\\n bn_v h m < bn_v h (gsub skey 0ul len))\n (ensures fun h0 r h1 -> modifies (loc s |+| loc m') h0 h1 /\\\n (r, as_seq h1 s) == LS.rsapss_sign_bn (v modBits) (v eBits) (v dBits) (as_seq h0 skey) (as_seq h0 m))", "val rsapss_verify_pre:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> sLen:size_nat //saltLen\n -> msgLen:nat\n -> msg:seq uint8{length msg == msgLen} -> Type0\nlet rsapss_verify_pre a sLen msgLen msg =\n sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `less_than_max_input_length` a /\\\n msgLen `less_than_max_input_length` a", "val new_rsapss_load_skey:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:size_t\n -> kc:rsapss_checks t ->\n new_rsapss_load_skey_st t ke modBits\nlet new_rsapss_load_skey #t ke modBits kc r eBits dBits nb eb db =\n [@inline_let] let bits = size (bits t) in\n\n if not (rsapss_check_skey_len #t modBits eBits dBits) then\n B.null\n else begin\n assert (LS.skey_len_pre t (v modBits) (v eBits) (v dBits));\n let h0 = ST.get () in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n let skeyLen = nLen +! nLen +! eLen +! dLen in\n let skey = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t 0) skeyLen in\n if B.is_null skey then\n skey\n else\n let h1 = ST.get () in\n B.(modifies_only_not_unused_in loc_none h0 h1);\n assert (B.len skey == skeyLen);\n let skey: Lib.Buffer.buffer (limb t) = skey in\n assert (B.length skey == FStar.UInt32.v skeyLen);\n let skey: lbignum t skeyLen = skey in\n let b = rsapss_load_skey ke modBits kc (rsapss_load_pkey ke modBits kc) eBits dBits nb eb db skey in\n let h2 = ST.get () in\n B.(modifies_only_not_unused_in loc_none h0 h2);\n LS.rsapss_load_skey_lemma #t (v modBits) (v eBits) (v dBits)\n\t(as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db);\n if b then skey else begin\n B.free (skey <: buffer (limb t));\n B.null end\n end", "val rsapss_check_pkey_len:\n #t:limb_t\n -> modBits:size_t\n -> eBits:size_t ->\n res:bool{res <==> LS.pkey_len_pre t (v modBits) (v eBits)}\nlet rsapss_check_pkey_len #t modBits eBits =\n if 1ul <. modBits && 0ul <. eBits then begin\n [@inline_let] let bits = size (bits t) in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n nLen <=. 0xfffffffful /. (2ul *! bits) && eLen <=. 0xfffffffful /. bits &&\n nLen +! nLen <=. 0xfffffffful -. eLen end\n else false", "val Hacl.Impl.RSAPSS.Keys.rsapss_load_skey_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet rsapss_load_skey_st (t:limb_t) (ke:BE.exp t) (modBits:size_t) =\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> nb:lbuffer uint8 (blocks modBits 8ul)\n -> eb:lbuffer uint8 (blocks eBits 8ul)\n -> db:lbuffer uint8 (blocks dBits 8ul)\n -> skey:lbignum t (2ul *! blocks modBits (size (bits t)) +! blocks eBits (size (bits t)) +! blocks dBits (size (bits t))) ->\n Stack bool\n (requires fun h ->\n blocks modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h nb /\\ live h eb /\\ live h db /\\ live h skey /\\\n disjoint skey nb /\\ disjoint skey eb /\\ disjoint skey db)\n (ensures fun h0 b h1 -> modifies (loc skey) h0 h1 /\\\n (b, as_seq h1 skey) == LS.rsapss_load_skey (v modBits) (v eBits) (v dBits)\n (as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db))", "val Hacl.Impl.RSAPSS.Keys.new_rsapss_load_skey_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet new_rsapss_load_skey_st (t:limb_t) (ke:BE.exp t) (modBits:size_t) =\n r:HS.rid\n -> eBits:size_t\n -> dBits:size_t\n -> nb:lbuffer uint8 (blocks0 modBits 8ul)\n -> eb:lbuffer uint8 (blocks0 eBits 8ul)\n -> db:lbuffer uint8 (blocks0 dBits 8ul) ->\n ST (B.buffer (limb t))\n (requires fun h ->\n blocks0 modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h nb /\\ live h eb /\\ live h db /\\\n ST.is_eternal_region r)\n (ensures fun h0 skey h1 -> B.(modifies loc_none h0 h1) /\\\n not (B.g_is_null skey) ==> (\n LS.skey_len_pre t (v modBits) (v eBits) (v dBits) /\\\n B.(fresh_loc (loc_buffer skey) h0 h1) /\\\n B.freeable skey /\\\n B.(loc_includes (loc_region_only false r) (loc_buffer skey)) /\\\n (let bits = size (bits t) in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n let skeyLen = nLen +! nLen +! eLen +! dLen in\n\n B.len skey == skeyLen /\\\n (let skey = skey <: lbignum t skeyLen in\n LS.rsapss_load_skey_post (v modBits) (v eBits) (v dBits)\n\t(as_seq h0 nb) (as_seq h0 eb) (as_seq h0 db) (as_seq h1 skey)))))", "val new_rsapss_load_pkey:\n #t:limb_t\n -> ke:BE.exp t\n -> modBits:size_t\n -> kc:rsapss_checks t ->\n new_rsapss_load_pkey_st t ke modBits\nlet new_rsapss_load_pkey #t ke modBits kc r eBits nb eb =\n [@inline_let] let bits = size (bits t) in\n\n if not (rsapss_check_pkey_len #t modBits eBits) then\n B.null\n else\n let h0 = ST.get () in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let pkeyLen = nLen +! nLen +! eLen in\n let pkey = LowStar.Monotonic.Buffer.mmalloc_partial r (uint #t 0) pkeyLen in\n if B.is_null pkey then\n pkey\n else\n let h1 = ST.get () in\n B.(modifies_only_not_unused_in loc_none h0 h1);\n assert (B.len pkey == pkeyLen);\n let pkey: Lib.Buffer.buffer (limb t) = pkey in\n assert (B.length pkey == FStar.UInt32.v pkeyLen);\n let pkey: lbignum t pkeyLen = pkey in\n let b = rsapss_load_pkey ke modBits kc eBits nb eb pkey in\n let h2 = ST.get () in\n B.(modifies_only_not_unused_in loc_none h0 h2);\n LS.rsapss_load_pkey_lemma #t (v modBits) (v eBits) (as_seq h0 nb) (as_seq h0 eb);\n if b then pkey else begin\n B.free (pkey <: buffer (limb t));\n B.null end", "val rsapss_sign_bn:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> m:lbignum t (blocks modBits (bits t)) ->\n Pure (tuple2 bool (lbignum t (blocks modBits (bits t))))\n (requires\n (let nLen = blocks modBits (bits t) in\n let n = sub skey 0 nLen in\n rsapss_skey_pre modBits eBits dBits skey /\\\n bn_v m < bn_v n))\n (ensures fun res -> True)\nlet rsapss_sign_bn #t modBits eBits dBits skey m =\n let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let n = sub skey 0 nLen in\n let r2 = sub skey nLen nLen in\n let e = sub skey (nLen + nLen) eLen in\n let d = sub skey (nLen + nLen + eLen) dLen in\n\n let k = blocks modBits 8 in\n Math.Lemmas.pow2_le_compat (bits * nLen) modBits;\n SM.bn_precomp_r2_mod_n_lemma (modBits - 1) n;\n let s = bn_mod_exp_consttime_precompr2 nLen n r2 m dBits d in\n let m' = bn_mod_exp_vartime_precompr2 nLen n r2 s eBits e in\n let eq_m = bn_eq_mask m m' in\n let s = map (logand eq_m) s in\n BB.unsafe_bool_of_limb eq_m, s", "val rsapss_check_exponent:\n #t:limb_t\n -> bn_check_num_bits:bn_check_num_bits_st t ->\n rsapss_check_exponent_st t\nlet rsapss_check_exponent #t bn_check_num_bits eBits e =\n let eLen = blocks eBits (size (bits t)) in\n let m0 = BN.bn_is_zero_mask eLen e in\n let m1 = bn_check_num_bits eBits e in\n (lognot m0) &. m1", "val pss_verify_:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> saltLen:salt_len_t a\n -> msgLen:msg_len_t a\n -> msg:lbuffer uint8 msgLen\n -> emBits:em_len_t a saltLen\n -> em:lbuffer uint8 (BD.blocks emBits 8ul) ->\n Stack bool\n (requires fun h -> live h msg /\\ live h em /\\ disjoint em msg)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == S.pss_verify_ a (v saltLen) (v msgLen) (as_seq h0 msg) (v emBits) (as_seq h0 em))\nlet pss_verify_ a saltLen msgLen msg emBits em =\n push_frame ();\n let emLen = BD.blocks emBits 8ul in\n\n let hLen = hash_len a in\n let m1Hash0 = create hLen (u8 0) in\n let dbLen = emLen -! hLen -! 1ul in\n let maskedDB = sub em 0ul dbLen in\n let m1Hash = sub em dbLen hLen in\n\n let dbMask = create dbLen (u8 0) in\n mgf_hash a hLen m1Hash dbLen dbMask;\n xor_bytes dbLen dbMask maskedDB;\n db_zero dbLen dbMask emBits;\n\n let padLen = emLen -! saltLen -! hLen -! 1ul in\n let pad2 = create padLen (u8 0) in\n pad2.(padLen -! 1ul) <- u8 0x01;\n\n let pad = sub dbMask 0ul padLen in\n let salt = sub dbMask padLen saltLen in\n\n let res =\n if not (Lib.ByteBuffer.lbytes_eq #padLen pad pad2) then false\n else begin\n get_m1Hash a saltLen salt msgLen msg hLen m1Hash0;\n Lib.ByteBuffer.lbytes_eq #hLen m1Hash0 m1Hash end in\n pop_frame ();\n res", "val pss_verify:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> saltLen:salt_len_t a\n -> msgLen:msg_len_t a\n -> msg:lbuffer uint8 msgLen\n -> emBits:size_t{0 < v emBits}\n -> em:lbuffer uint8 (BD.blocks emBits 8ul) ->\n Stack bool\n (requires fun h -> live h msg /\\ live h em /\\ disjoint em msg)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == S.pss_verify a (v saltLen) (v msgLen) (as_seq h0 msg) (v emBits) (as_seq h0 em))\nlet pss_verify a saltLen msgLen msg emBits em =\n let emLen = BD.blocks emBits 8ul in\n let msBits = emBits %. 8ul in\n\n let em_0 = if msBits >. 0ul then em.(0ul) &. (u8 0xff <<. msBits) else u8 0 in\n let em_last = em.(emLen -! 1ul) in\n\n if (emLen <. saltLen +! hash_len a +! 2ul) then false\n else begin\n if not (FStar.UInt8.(Lib.RawIntTypes.u8_to_UInt8 em_last =^ 0xbcuy) &&\n FStar.UInt8.(Lib.RawIntTypes.u8_to_UInt8 em_0 =^ 0uy)) then false\n else pss_verify_ a saltLen msgLen msg emBits em end", "val rsapss_skey_pre:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t)) -> Type0\nlet rsapss_skey_pre #t modBits eBits dBits skey =\n let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n let pkeyLen = nLen + nLen + eLen in\n\n let pkey = sub skey 0 pkeyLen in\n let d = sub skey pkeyLen dLen in\n rsapss_pkey_pre modBits eBits pkey /\\\n 0 < bn_v d /\\ bn_v d < pow2 dBits", "val rsapss_check_exponent: #t:limb_t -> eBits:size_pos -> e:lbignum t (blocks eBits (bits t)) ->\n res:limb t{v res == (if (0 < bn_v e && bn_v e < pow2 eBits) then v (ones t SEC) else v (zeros t SEC))}\nlet rsapss_check_exponent #t eBits e =\n let m0 = bn_is_zero_mask e in\n bn_is_zero_mask_lemma e;\n let m1 = bn_check_num_bits eBits e in\n let m = (lognot m0) &. m1 in\n lognot_lemma m0;\n logand_lemma (lognot m0) m1;\n m", "val Hacl.Impl.RSAPSS.Keys.new_rsapss_load_pkey_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet new_rsapss_load_pkey_st (t:limb_t) (ke:BE.exp t) (modBits:size_t) =\n r:HS.rid\n -> eBits:size_t\n -> nb:lbuffer uint8 (blocks0 modBits 8ul)\n -> eb:lbuffer uint8 (blocks0 eBits 8ul) ->\n ST (B.buffer (limb t))\n (requires fun h ->\n blocks0 modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h nb /\\ live h eb /\\ ST.is_eternal_region r)\n (ensures fun h0 pkey h1 -> B.(modifies loc_none h0 h1) /\\\n not (B.g_is_null pkey) ==> (\n LS.pkey_len_pre t (v modBits) (v eBits) /\\\n B.(fresh_loc (loc_buffer pkey) h0 h1) /\\\n B.freeable pkey /\\\n B.(loc_includes (loc_region_only false r) (loc_buffer pkey)) /\\\n (let bits = size (bits t) in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let pkeyLen = nLen +! nLen +! eLen in\n B.len pkey == pkeyLen /\\\n (let pkey = pkey <: lbignum t pkeyLen in\n\n LS.rsapss_load_pkey_post (v modBits) (v eBits)\n\t(as_seq h0 nb) (as_seq h0 eb) (as_seq h1 pkey)))))", "val rsapss_pkey_pre:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t)) -> Type0\nlet rsapss_pkey_pre #t modBits eBits pkey =\n let bits = bits t in\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = sub pkey 0 nLen in\n let r2 = sub pkey nLen nLen in\n let e = sub pkey (nLen + nLen) eLen in\n r2 == SM.bn_precomp_r2_mod_n (modBits - 1) n /\\\n bn_v n % 2 = 1 /\\\n pow2 (modBits - 1) < bn_v n /\\ bn_v n < pow2 modBits /\\\n 0 < bn_v e /\\ bn_v e < pow2 eBits", "val Hacl.Impl.RSAPSS.Keys.rsapss_load_pkey_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Lib.IntTypes.size_t\n -> Type0\nlet rsapss_load_pkey_st (t:limb_t) (ke:BE.exp t) (modBits:size_t) =\n eBits:size_t{LS.pkey_len_pre t (v modBits) (v eBits)}\n -> nb:lbuffer uint8 (blocks modBits 8ul)\n -> eb:lbuffer uint8 (blocks eBits 8ul)\n -> pkey:lbignum t (2ul *! blocks modBits (size (bits t)) +! blocks eBits (size (bits t))) ->\n Stack bool\n (requires fun h ->\n blocks modBits (size (bits t)) == ke.BE.bn.BN.len /\\\n live h nb /\\ live h eb /\\ live h pkey /\\\n disjoint pkey nb /\\ disjoint pkey eb)\n (ensures fun h0 b h1 -> modifies (loc pkey) h0 h1 /\\\n (b, as_seq h1 pkey) == LS.rsapss_load_pkey (v modBits) (v eBits) (as_seq h0 nb) (as_seq h0 eb))", "val rsapss_load_pkey:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8) ->\n tuple2 bool (lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t)))\nlet rsapss_load_pkey #t modBits eBits nb eb =\n let n = bn_from_bytes_be (blocks modBits 8) nb in\n let r2 = SM.bn_precomp_r2_mod_n (modBits - 1) n in\n let e = bn_from_bytes_be (blocks eBits 8) eb in\n let pkey = (n @| r2) @| e in\n\n let m0 = rsapss_check_modulus modBits n in\n let m1 = rsapss_check_exponent eBits e in\n let m = m0 &. m1 in\n BB.unsafe_bool_of_limb m, pkey", "val rsapss_load_skey:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8) ->\n tuple2 bool (lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t)))\nlet rsapss_load_skey #t modBits eBits dBits nb eb db =\n let b, pkey = rsapss_load_pkey modBits eBits nb eb in\n let d = bn_from_bytes_be #t (blocks dBits 8) db in\n let skey = pkey @| d in\n\n let m0 = rsapss_check_exponent dBits d in\n let b1 = b && BB.unsafe_bool_of_limb m0 in\n b1, skey", "val rsapss_load_skey_post:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8)\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t)) -> Type0\nlet rsapss_load_skey_post #t modBits eBits dBits nb eb db skey =\n let bits = bits t in\n let skey_s = S.rsapss_load_skey modBits eBits dBits nb eb db in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let n = sub skey 0 nLen in\n let e = sub skey (nLen + nLen) eLen in\n let d = sub skey (nLen + nLen + eLen) dLen in\n\n rsapss_skey_pre modBits eBits dBits skey /\\\n Some? skey_s /\\ (let pkey_s = S.Mk_rsapss_skey?.pkey (Some?.v skey_s) in\n bn_v n == S.Mk_rsapss_pkey?.n pkey_s /\\\n bn_v e == S.Mk_rsapss_pkey?.e pkey_s /\\\n bn_v d == S.Mk_rsapss_skey?.d (Some?.v skey_s))", "val pss_verify:\n a:Hash.hash_alg{hash_is_supported a}\n -> sLen:size_nat{sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a}\n -> msgLen:nat{msgLen `Hash.less_than_max_input_length` a}\n -> msg:bytes{length msg == msgLen}\n -> emBits:size_pos\n -> em:lbytes (blocks emBits 8) ->\n Tot bool\nlet pss_verify a sLen msgLen msg emBits em =\n let emLen = blocks emBits 8 in\n let msBits = emBits % 8 in\n\n let em_0 = if msBits > 0 then em.[0] &. (u8 0xff <<. size msBits) else u8 0 in\n let em_last = em.[emLen - 1] in\n\n if (emLen < sLen + Hash.hash_length a + 2) then false\n else begin\n if not (FStar.UInt8.(Lib.RawIntTypes.u8_to_UInt8 em_last =^ 0xbcuy) &&\n FStar.UInt8.(Lib.RawIntTypes.u8_to_UInt8 em_0 =^ 0uy))\n then false\n else pss_verify_ a sLen msgLen msg emBits em end", "val rsapss_load_pkey_post:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> pkey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t)) -> Type0\nlet rsapss_load_pkey_post #t modBits eBits nb eb pkey =\n let bits = bits t in\n let pkey_s = S.rsapss_load_pkey modBits eBits nb eb in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = sub pkey 0 nLen in\n let e = sub pkey (nLen + nLen) eLen in\n\n rsapss_pkey_pre modBits eBits pkey /\\\n Some? pkey_s /\\\n bn_v n == S.Mk_rsapss_pkey?.n (Some?.v pkey_s) /\\\n bn_v e == S.Mk_rsapss_pkey?.e (Some?.v pkey_s)", "val rsapss_sign_compute_sgnt:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> skey:lbignum t (2 * blocks modBits (bits t) + blocks eBits (bits t) + blocks dBits (bits t))\n -> m:lbignum t (blocks modBits (bits t)) ->\n Pure (tuple2 bool (lseq uint8 (blocks modBits 8)))\n (requires\n (let nLen = blocks modBits (bits t) in\n let n = sub skey 0 nLen in\n rsapss_skey_pre modBits eBits dBits skey /\\\n bn_v m < bn_v n))\n (ensures fun res -> True)\nlet rsapss_sign_compute_sgnt #t modBits eBits dBits skey m =\n let bits = bits t in\n let numb = numbytes t in\n let nLen = blocks modBits bits in\n let k = blocks modBits 8 in\n\n let eq_b, s = rsapss_sign_bn #t modBits eBits dBits skey m in\n blocks_bits_lemma t modBits;\n blocks_numb_lemma t modBits;\n assert (blocks k numb == nLen);\n assert (numb * blocks k numb <= max_size_t);\n let sgnt = bn_to_bytes_be k s in\n eq_b, sgnt", "val pss_verify_:\n a:Hash.hash_alg{hash_is_supported a}\n -> sLen:size_nat{sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a}\n -> msgLen:nat{msgLen `Hash.less_than_max_input_length` a}\n -> msg:bytes{length msg == msgLen}\n -> emBits:size_pos{sLen + Hash.hash_length a + 2 <= blocks emBits 8}\n -> em:lbytes (blocks emBits 8) ->\n Tot bool\nlet pss_verify_ a sLen msgLen msg emBits em =\n let hLen = Hash.hash_length a in\n let emLen = blocks emBits 8 in\n let dbLen = emLen - hLen - 1 in\n let maskedDB = sub em 0 dbLen in\n let m1Hash = sub em dbLen hLen in\n\n let dbMask = mgf_hash a hLen m1Hash dbLen in\n let db = xor_bytes dbMask maskedDB in\n let db = db_zero db emBits in\n\n let padLen = emLen - sLen - hLen - 1 in\n let pad2 = create padLen (u8 0) in\n let pad2 = pad2.[padLen - 1] <- u8 0x01 in\n\n let pad = sub db 0 padLen in\n let salt = sub db padLen sLen in\n\n if not (lbytes_eq pad pad2) then false\n else begin\n let mHash = Hash.hash a msg in\n let m1Len = 8 + hLen + sLen in\n let m1 = create m1Len (u8 0) in\n let m1 = update_sub m1 8 hLen mHash in\n let m1 = update_sub m1 (8 + hLen) sLen salt in\n let m1Hash0 = Hash.hash a m1 in\n lbytes_eq m1Hash0 m1Hash\n end", "val Hacl.Impl.RSAPSS.rsapss_sign_compute_sgnt_st = \n t: Hacl.Bignum.Definitions.limb_t ->\n ke: Hacl.Bignum.Exponentiation.exp t ->\n modBits: Hacl.Impl.RSAPSS.modBits_t t\n -> Type0\nlet rsapss_sign_compute_sgnt_st (t:limb_t) (ke:BE.exp t) (modBits:modBits_t t) =\n let len = blocks modBits (size (bits t)) in\n eBits:size_t\n -> dBits:size_t{LS.skey_len_pre t (v modBits) (v eBits) (v dBits)}\n -> skey:lbignum t (2ul *! len +! blocks eBits (size (bits t)) +! blocks dBits (size (bits t)))\n -> m:lbignum t len\n -> sgnt:lbuffer uint8 (blocks modBits 8ul) ->\n Stack bool\n (requires fun h -> len == ke.BE.bn.BN.len /\\\n live h sgnt /\\ live h skey /\\ live h m /\\\n disjoint sgnt skey /\\ disjoint m sgnt /\\ disjoint m skey /\\\n LS.rsapss_skey_pre (v modBits) (v eBits) (v dBits) (as_seq h skey) /\\\n bn_v h m < bn_v h (gsub skey 0ul len))\n (ensures fun h0 eq_m h1 -> modifies (loc sgnt) h0 h1 /\\\n (eq_m, as_seq h1 sgnt) == LS.rsapss_sign_compute_sgnt (v modBits) (v eBits) (v dBits) (as_seq h0 skey) (as_seq h0 m))", "val Hacl.Impl.RSAPSS.Keys.rsapss_check_modulus_st = t: Hacl.Bignum.Definitions.limb_t -> Type0\nlet rsapss_check_modulus_st (t:limb_t) =\n modBits:size_t{0 < v modBits /\\ bits t * v (blocks modBits (size (bits t))) <= max_size_t}\n -> n:lbignum t (blocks modBits (size (bits t))) ->\n Stack (limb t)\n (requires fun h -> live h n)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.rsapss_check_modulus (v modBits) (as_seq h0 n))", "val Hacl.Spec.RSAPSS.skey_len_pre = \n t: Hacl.Spec.Bignum.Definitions.limb_t ->\n modBits: Lib.IntTypes.size_nat ->\n eBits: Lib.IntTypes.size_nat ->\n dBits: Lib.IntTypes.size_nat\n -> Prims.logical\nlet skey_len_pre (t:limb_t) (modBits:size_nat) (eBits:size_nat) (dBits:size_nat) =\n let bits = bits t in\n pkey_len_pre t modBits eBits /\\\n 0 < dBits /\\ bits * blocks dBits bits <= max_size_t /\\\n 2 * blocks modBits bits + blocks eBits bits + blocks dBits bits <= max_size_t", "val Hacl.Impl.RSAPSS.MGF.mgf_hash_st = a: Spec.Hash.Definitions.hash_alg{Spec.RSAPSS.hash_is_supported a} -> Type0\nlet mgf_hash_st (a:Hash.hash_alg{S.hash_is_supported a}) =\n len:size_t{v len + 4 <= max_size_t /\\ (v len + 4) `less_than_max_input_length` a}\n -> mgfseed:lbuffer uint8 len\n -> maskLen:size_t{0 < v maskLen /\\ S.blocks (v maskLen) (Hash.hash_length a) * Hash.hash_length a < pow2 32}\n -> res:lbuffer uint8 maskLen ->\n Stack unit\n (requires fun h -> live h mgfseed /\\ live h res /\\ disjoint res mgfseed)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_seq h1 res == S.mgf_hash a (v len) (as_seq h0 mgfseed) (v maskLen))", "val rsapss_load_pkey:\n modBits:modBits_t\n -> eBits:size_pos\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8) ->\n option (rsapss_pkey modBits)\nlet rsapss_load_pkey modBits eBits nb eb =\n let n = os2ip #(blocks modBits 8) nb in\n let e = os2ip #(blocks eBits 8) eb in\n\n //`n % 2 = 1` is needed to store `r2 = r * r % n` as a part of pkey\n if (n % 2 = 1 && pow2 (modBits - 1) < n && n < pow2 modBits &&\n 0 < e && e < pow2 eBits) then\n Some (Mk_rsapss_pkey n e)\n else\n None", "val rsapss_load_pkey_lemma:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat{pkey_len_pre t modBits eBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8) ->\n Lemma\n (let b, pkey = rsapss_load_pkey #t modBits eBits nb eb in\n let pkey_s = S.rsapss_load_pkey modBits eBits nb eb in\n (if b then rsapss_load_pkey_post modBits eBits nb eb pkey else None? pkey_s))\nlet rsapss_load_pkey_lemma #t modBits eBits nb eb =\n let bits = bits t in\n let nbLen = blocks modBits 8 in\n let ebLen = blocks eBits 8 in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n\n let n = bn_from_bytes_be #t nbLen nb in\n bn_from_bytes_be_lemma #t nbLen nb;\n let r2 = SM.bn_precomp_r2_mod_n (modBits - 1) n in\n let e = bn_from_bytes_be #t ebLen eb in\n bn_from_bytes_be_lemma #t ebLen eb;\n\n let pkey = (n @| r2) @| e in\n eq_intro (sub pkey 0 nLen) n;\n eq_intro (sub pkey nLen nLen) r2;\n eq_intro (sub pkey (nLen + nLen) eLen) e;\n\n\n let m0 = rsapss_check_modulus modBits n in\n let m1 = rsapss_check_exponent eBits e in\n let m = m0 &. m1 in\n logand_lemma m0 m1", "val Hacl.Impl.RSAPSS.modBits_t = t: Hacl.Bignum.Definitions.limb_t -> Type0\nlet modBits_t (t:limb_t) = modBits:size_t{1 < v modBits /\\ 2 * bits t * SD.blocks (v modBits) (bits t) <= max_size_t}", "val rsapss_load_skey:\n modBits:modBits_t\n -> eBits:size_pos\n -> dBits:size_pos\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8) ->\n option (rsapss_skey modBits)\nlet rsapss_load_skey modBits eBits dBits nb eb db =\n let pkey = rsapss_load_pkey modBits eBits nb eb in\n let d = os2ip #(blocks dBits 8) db in\n\n if (Some? pkey && 0 < d && d < pow2 dBits) then\n Some (Mk_rsapss_skey (Some?.v pkey) d)\n else\n None", "val rsapss_load_skey_lemma:\n #t:limb_t\n -> modBits:size_nat\n -> eBits:size_nat\n -> dBits:size_nat{skey_len_pre t modBits eBits dBits}\n -> nb:lseq uint8 (blocks modBits 8)\n -> eb:lseq uint8 (blocks eBits 8)\n -> db:lseq uint8 (blocks dBits 8) ->\n Lemma\n (let b, skey = rsapss_load_skey #t modBits eBits dBits nb eb db in\n let skey_s = S.rsapss_load_skey modBits eBits dBits nb eb db in\n (if b then rsapss_load_skey_post modBits eBits dBits nb eb db skey else None? skey_s))\nlet rsapss_load_skey_lemma #t modBits eBits dBits nb eb db =\n let bits = bits t in\n let nbLen = blocks modBits 8 in\n let ebLen = blocks eBits 8 in\n let dbLen = blocks dBits 8 in\n\n let nLen = blocks modBits bits in\n let eLen = blocks eBits bits in\n let dLen = blocks dBits bits in\n\n let b, pkey = rsapss_load_pkey #t modBits eBits nb eb in\n rsapss_load_pkey_lemma #t modBits eBits nb eb;\n\n let d = bn_from_bytes_be #t (blocks dBits 8) db in\n bn_from_bytes_be_lemma #t (blocks dBits 8) db;\n\n let skey = pkey @| d in\n eq_intro (sub skey 0 (nLen + nLen + eLen)) pkey;\n eq_intro (sub skey (nLen + nLen + eLen) dLen) d", "val Hacl.Spec.RSAPSS.pkey_len_pre = \n t: Hacl.Spec.Bignum.Definitions.limb_t ->\n modBits: Lib.IntTypes.size_nat ->\n eBits: Lib.IntTypes.size_nat\n -> Prims.logical\nlet pkey_len_pre (t:limb_t) (modBits:size_nat) (eBits:size_nat) =\n let bits = bits t in\n 1 < modBits /\\ 0 < eBits /\\\n 2 * bits * blocks modBits bits <= max_size_t /\\\n bits * blocks eBits bits <= max_size_t /\\\n 2 * blocks modBits bits + blocks eBits bits <= max_size_t", "val check_modulus_u64:rsapss_check_modulus_st U64\nlet check_modulus_u64 : rsapss_check_modulus_st U64 =\n rsapss_check_modulus check_num_bits_u64", "val check_modulus_u32:rsapss_check_modulus_st U32\nlet check_modulus_u32 : rsapss_check_modulus_st U32 =\n rsapss_check_modulus check_num_bits_u32", "val Hacl.Impl.RSAPSS.Keys.bn_check_num_bits_st = t: Hacl.Bignum.Definitions.limb_t -> Type0\nlet bn_check_num_bits_st (t:limb_t) =\n bs:size_t{0 < v bs /\\ bits t * v (blocks bs (size (bits t))) <= max_size_t}\n -> b:lbignum t (blocks bs (size (bits t))) ->\n Stack (limb t)\n (requires fun h -> live h b)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.bn_check_num_bits (v bs) (as_seq h0 b))", "val bn_check_mod_exp:\n #t:limb_t\n -> #len:BN.bn_len t\n -> n:lbignum t len\n -> a:lbignum t len\n -> bBits:size_nat\n -> b:lbignum t (blocks0 bBits (bits t)) ->\n res:limb t{\n let b =\n bn_v n % 2 = 1 && 1 < bn_v n &&\n bn_v b < pow2 bBits &&\n bn_v a < bn_v n in\n v res == (if b then v (ones t SEC) else v (zeros t SEC))}\nlet bn_check_mod_exp #t #len n a bBits b =\n let pbits = bits t in\n let m0 = BM.bn_check_modulus n in\n\n bn_eval_bound b (blocks0 bBits pbits);\n let m1 =\n if bBits < pbits * blocks0 bBits pbits then begin\n BN.bn_lt_pow2_mask_lemma b bBits;\n BN.bn_lt_pow2_mask b bBits end\n else begin\n Math.Lemmas.pow2_le_compat bBits (pbits * blocks bBits pbits);\n ones t SEC end in\n assert (if v m1 = 0 then pow2 bBits <= bn_v b else bn_v b < pow2 bBits);\n\n let m2 = BN.bn_lt_mask a n in\n BN.bn_lt_mask_lemma a n;\n assert (if v m2 = 0 then bn_v a >= bn_v n else bn_v a < bn_v n);\n\n let m = m1 &. m2 in\n logand_lemma m1 m2;\n let r = m0 &. m in\n logand_lemma m0 m;\n r", "val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a\nlet sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =\n BN.bn_karatsuba_sqr n_limbs a", "val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a\nlet sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =\n BN.bn_sqr n_limbs a", "val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a\nlet sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =\n BN.bn_karatsuba_sqr n_limbs a", "val sqr: a:lbignum t_limbs n_limbs -> BN.bn_karatsuba_sqr_st t_limbs n_limbs a\nlet sqr (a:lbignum t_limbs n_limbs) : BN.bn_karatsuba_sqr_st t_limbs n_limbs a =\n BN.bn_sqr n_limbs a", "val bn_karatsuba_res_lemma:\n #t:limb_t\n -> #aLen:size_pos{2 * aLen <= max_size_t}\n -> r01:lbignum t aLen\n -> r23:lbignum t aLen\n -> c5:limb t{v c5 <= 1}\n -> t45:lbignum t aLen ->\n Lemma\n (let c, res = bn_karatsuba_res r01 r23 c5 t45 in\n bn_v res + v c * pow2 (bits t * (aLen + aLen)) ==\n bn_v r23 * pow2 (bits t * aLen) + (v c5 * pow2 (bits t * aLen) + bn_v t45) * pow2 (aLen / 2 * bits t) + bn_v r01)\nlet bn_karatsuba_res_lemma #t #aLen r01 r23 c5 t45 =\n let pbits = bits t in\n let aLen2 = aLen / 2 in\n let aLen3 = aLen + aLen2 in\n let aLen4 = aLen + aLen in\n\n let res0 = concat r01 r23 in\n let c6, res1 = bn_lshift_add_early_stop res0 t45 aLen2 in\n\n let c7 = c5 +. c6 in\n let c8, res2 = bn_lshift_add res1 c7 aLen3 in\n\n calc (==) {\n bn_v res2 + v c8 * pow2 (pbits * aLen4);\n (==) { bn_lshift_add_lemma res1 c7 aLen3 }\n bn_v res1 + v c7 * pow2 (pbits * aLen3);\n (==) { Math.Lemmas.small_mod (v c5 + v c6) (pow2 pbits) }\n bn_v res1 + (v c5 + v c6) * pow2 (pbits * aLen3);\n (==) { bn_lshift_add_early_stop_lemma res0 t45 aLen2 }\n bn_v res0 + bn_v t45 * pow2 (pbits * aLen2) - v c6 * pow2 (pbits * aLen3) + (v c5 + v c6) * pow2 (pbits * aLen3);\n (==) { Math.Lemmas.distributivity_add_left (v c5) (v c6) (pow2 (pbits * aLen3)) }\n bn_v res0 + bn_v t45 * pow2 (pbits * aLen2) + v c5 * pow2 (pbits * aLen3);\n (==) { Math.Lemmas.pow2_plus (pbits * aLen) (pbits * aLen2) }\n bn_v res0 + bn_v t45 * pow2 (pbits * aLen2) + v c5 * (pow2 (pbits * aLen) * pow2 (pbits * aLen2));\n (==) { Math.Lemmas.paren_mul_right (v c5) (pow2 (pbits * aLen)) (pow2 (pbits * aLen2));\n Math.Lemmas.distributivity_add_left (bn_v t45) (v c5 * pow2 (pbits * aLen)) (pow2 (pbits * aLen2)) }\n bn_v res0 + (bn_v t45 + v c5 * pow2 (pbits * aLen)) * pow2 (pbits * aLen2);\n (==) { bn_concat_lemma r01 r23 }\n bn_v r23 * pow2 (pbits * aLen) + (v c5 * pow2 (pbits * aLen) + bn_v t45) * pow2 (pbits * aLen2) + bn_v r01;\n }", "val Spec.RSAPSS.mgf_hash_a = \n len: Lib.IntTypes.size_nat{len + 4 <= Lib.IntTypes.max_size_t} ->\n n: Prims.pos ->\n i: Prims.nat{i <= n}\n -> Type0\nlet mgf_hash_a (len:size_nat{len + 4 <= max_size_t}) (n:pos) (i:nat{i <= n}) = lbytes (len + 4)", "val mk_runtime_rsapss_checks (#t: limb_t) : rsapss_checks t\nlet mk_runtime_rsapss_checks (#t:limb_t) : rsapss_checks t =\n match t with\n | U32 -> mk_runtime_rsapss_checks_uint32\n | U64 -> mk_runtime_rsapss_checks_uint64", "val pss_encode:\n a:Hash.hash_alg{hash_is_supported a}\n -> sLen:size_nat{sLen + Hash.hash_length a + 8 <= max_size_t /\\\n (sLen + Hash.hash_length a + 8) `Hash.less_than_max_input_length` a}\n -> salt:lbytes sLen\n -> msgLen:nat{msgLen `Hash.less_than_max_input_length` a}\n -> msg:bytes{length msg == msgLen}\n -> emBits:size_pos{Hash.hash_length a + sLen + 2 <= blocks emBits 8} ->\n Pure (lbytes (blocks emBits 8))\n (requires True)\n (ensures fun em -> if emBits % 8 > 0 then v em.[0] < pow2 (emBits % 8) else v em.[0] < pow2 8)\nlet pss_encode a sLen salt msgLen msg emBits =\n let mHash = Hash.hash a msg in\n let hLen = Hash.hash_length a in\n\n //m1 = [8 * 0x00; mHash; salt]\n let m1Len = 8 + hLen + sLen in\n let m1 = create m1Len (u8 0) in\n let m1 = update_sub m1 8 hLen mHash in\n let m1 = update_sub m1 (8 + hLen) sLen salt in\n let m1Hash = Hash.hash a m1 in\n\n //db = [0x00;..; 0x00; 0x01; salt]\n let emLen = blocks emBits 8 in\n let dbLen = emLen - hLen - 1 in\n let db = create dbLen (u8 0) in\n let last_before_salt = dbLen - sLen - 1 in\n let db = db.[last_before_salt] <- u8 1 in\n let db = update_sub db (last_before_salt + 1) sLen salt in\n\n let dbMask = mgf_hash a hLen m1Hash dbLen in\n let maskedDB = xor_bytes db dbMask in\n let maskedDB = db_zero maskedDB emBits in\n\n //em = [maskedDB; m1Hash; 0xbc]\n let em = create emLen (u8 0) in\n let em = update_sub em 0 dbLen maskedDB in\n let em = update_sub em dbLen hLen m1Hash in\n assert (v em.[0] == v maskedDB.[0]);\n em.[emLen - 1] <- u8 0xbc", "val mul: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_mul_st t_limbs len a\nlet mul len a b res =\n (ke len).BE.bn.BN.mul a b res", "val mul: len:BN.meta_len t_limbs -> a:lbignum t_limbs len -> BN.bn_karatsuba_mul_st t_limbs len a\nlet mul len a b res =\n (ke len).BE.bn.BN.mul a b res", "val Hacl.Impl.RSAPSS.Keys.rsapss_check_exponent_st = t: Hacl.Bignum.Definitions.limb_t -> Type0\nlet rsapss_check_exponent_st (t:limb_t) =\n eBits:size_t{0 < v eBits /\\ bits t * v (blocks eBits (size (bits t))) <= max_size_t}\n -> e:lbignum t (blocks eBits (size (bits t))) ->\n Stack (limb t)\n (requires fun h -> live h e)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == LS.rsapss_check_exponent (v eBits) (as_seq h0 e))", "val bn_karatsuba_mul:\n #t:limb_t\n -> len:size_t{0 < v len /\\ 4 * v len <= max_size_t}\n -> a:lbignum t len ->\n bn_karatsuba_mul_st t len a\nlet bn_karatsuba_mul #t len a b res =\n let h0 = ST.get () in\n Hacl.Spec.Bignum.bn_karatsuba_mul_lemma (as_seq h0 a) (as_seq h0 b);\n Hacl.Bignum.Karatsuba.bn_karatsuba_mul len a b res", "val verify_valid_pk_rs:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul\n -> a':point\n -> r':point ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h msg /\\ live h signature /\\ live h a' /\\ live h r' /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\ point_inv_full_t h a' /\\\n (F51.point_eval h a' == Some?.v (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))) /\\ point_inv_full_t h r' /\\\n (F51.point_eval h r' == Some?.v (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))))\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n z == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify_valid_pk_rs public_key msg_len msg signature a' r' =\n push_frame ();\n let hb = create 32ul (u8 0) in\n let rs = sub signature 0ul 32ul in\n let sb = sub signature 32ul 32ul in\n\n let b = verify_sb sb in\n let res =\n if b then false\n else begin\n Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre_pre2 hb rs public_key msg_len msg;\n verify_all_valid_hb sb hb a' r' end in\n pop_frame ();\n res", "val Hacl.FFDHE.ke = a: Spec.FFDHE.ffdhe_alg -> Hacl.Bignum.Exponentiation.exp Hacl.FFDHE.t_limbs\nlet ke (a:S.ffdhe_alg) =\n BE.mk_runtime_exp #t_limbs (BD.blocks (DH.ffdhe_len a) (size (numbytes t_limbs)))" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_pkey_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_bn_to_msg" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_pkey_verify_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_skey_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_st1" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_msg_to_bn" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_pkey_verify" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_verify_" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_post" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_bn_to_msg_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_pkey_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_post1" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_bn" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_skey_sign_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_st1" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_sign_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_bn_st" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_compute_msg" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_bn_to_msg" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_msg_to_bn_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_modulus" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_post" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_skey_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_bn" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_verify_compute_msg_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_post1" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_check_modulus" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_bn" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_skey_sign" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_load_skey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_msg_to_bn" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_load_pkey" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_compute_sgnt" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_skey_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_compute_msg" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_bn_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_verify_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.new_rsapss_load_skey" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_pkey_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_load_skey_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.new_rsapss_load_skey_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.new_rsapss_load_pkey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_bn" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_exponent" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Padding.fst", "name": "Hacl.Impl.RSAPSS.Padding.pss_verify_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Padding.fst", "name": "Hacl.Impl.RSAPSS.Padding.pss_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_skey_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_check_exponent" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.new_rsapss_load_pkey_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_pkey_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_load_pkey_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_pkey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_skey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_skey_post" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.pss_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_pkey_post" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_sign_compute_sgnt" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.pss_verify_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.rsapss_sign_compute_sgnt_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_modulus_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.skey_len_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.MGF.fst", "name": "Hacl.Impl.RSAPSS.MGF.mgf_hash_st" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_load_pkey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_pkey_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.fst", "name": "Hacl.Impl.RSAPSS.modBits_t" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.rsapss_load_skey" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.rsapss_load_skey_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.RSAPSS.fst", "name": "Hacl.Spec.RSAPSS.pkey_len_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.check_modulus_u64" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.check_modulus_u32" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.bn_check_num_bits_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Exponentiation.fst", "name": "Hacl.Spec.Bignum.Exponentiation.bn_check_mod_exp" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum4096_32.fst", "name": "Hacl.Bignum4096_32.sqr" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum256.fst", "name": "Hacl.Bignum256.sqr" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum4096.fst", "name": "Hacl.Bignum4096.sqr" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum256_32.fst", "name": "Hacl.Bignum256_32.sqr" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Karatsuba.fst", "name": "Hacl.Spec.Bignum.Karatsuba.bn_karatsuba_res_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.mgf_hash_a" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.mk_runtime_rsapss_checks" }, { "project_name": "hacl-star", "file_name": "Spec.RSAPSS.fst", "name": "Spec.RSAPSS.pss_encode" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum32.fst", "name": "Hacl.Bignum32.mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum64.fst", "name": "Hacl.Bignum64.mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Keys.fst", "name": "Hacl.Impl.RSAPSS.Keys.rsapss_check_exponent_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.fst", "name": "Hacl.Bignum.bn_karatsuba_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_valid_pk_rs" }, { "project_name": "hacl-star", "file_name": "Hacl.FFDHE.fst", "name": "Hacl.FFDHE.ke" } ], "selected_premises": [ "Hacl.RSAPSS.load_pkey", "Lib.Buffer.lbuffer", "Hacl.Impl.RSAPSS.rsapss_sign", "Hacl.Impl.RSAPSS.rsapss_verify", "Hacl.RSAPSS.load_skey", "Hacl.Impl.RSAPSS.rsapss_verify_", "Lib.Buffer.lbuffer_t", "Hacl.Spec.Bignum.Definitions.blocks", "Spec.RSAPSS.blocks", "Hacl.Hash.Definitions.m_spec", "Hacl.Impl.RSAPSS.rsapss_verify_bn_to_msg", "Hacl.Spec.Bignum.Definitions.blocks0", "Hacl.Bignum.meta_len", "Hacl.Bignum.Definitions.blocks0", "Lib.MultiBuffer.as_seq_multi", "Hacl.Spec.RSAPSS.rsapss_verify_", "Hacl.Impl.RSAPSS.MGF.hash_len", "Hacl.Impl.RSAPSS.rsapss_verify_bn", "Lib.NTuple.ntuple", "Hacl.Impl.RSAPSS.rsapss_sign_", "Hacl.Bignum.Definitions.lbignum", "Lib.Buffer.as_seq", "LowStar.Buffer.trivial_preorder", "Hacl.Bignum.Definitions.blocks", "Hacl.RSAPSS.rsapss_sign", "Hacl.Spec.Bignum.Definitions.lbignum", "Lib.NTuple.flen", "Hacl.Spec.RSAPSS.rsapss_verify", "Hacl.Impl.RSAPSS.Keys.mk_runtime_rsapss_checks_uint32", "Hacl.Impl.RSAPSS.rsapss_verify_compute_msg", "Lib.Sequence.lseq", "FStar.List.Tot.Base.length", "Hacl.Impl.RSAPSS.Keys.check_num_bits_u32", "Hacl.Impl.RSAPSS.Keys.rsapss_load_pkey", "Lib.IntTypes.int_t", "Lib.Buffer.gsub", "Lib.IntTypes.uint_t", "Hacl.RSAPSS.ke", "FStar.List.Tot.Base.map", "Hacl.Impl.RSAPSS.Keys.check_exponent_u32", "Hacl.Impl.RSAPSS.Keys.check_modulus_u32", "Hacl.Spec.RSAPSS.rsapss_verify_bn_to_msg", "Hacl.Spec.RSAPSS.rsapss_verify_bn", "Hacl.Impl.RSAPSS.MGF.mgf_hash", "Hacl.Spec.RSAPSS.rsapss_pkey_verify", "Hacl.Spec.RSAPSS.rsapss_verify_pre", "Hacl.Impl.RSAPSS.MGF.mgf_hash_f", "Hacl.Bignum.Definitions.bn_v", "Hacl.Streaming.MD.hacl_md", "Hacl.Impl.RSAPSS.Keys.mk_runtime_rsapss_checks_uint64", "LowStar.Monotonic.Buffer.length", "Hacl.Impl.RSAPSS.rsapss_skey_sign", "Lib.IntTypes.size", "FStar.Integers.op_Greater_Equals", "Lib.IntTypes.range", "Hacl.Bignum.Definitions.limb", "Hacl.Impl.RSAPSS.Keys.rsapss_check_pkey_len", "FStar.Seq.Properties.seq_of_list", "Spec.SHA2.Constants.k384_512", "Hacl.Impl.RSAPSS.Keys.mk_runtime_rsapss_checks", "FStar.Int.Cast.uint64_to_uint32", "FStar.Integers.op_Less_Equals", "Hacl.Impl.RSAPSS.MGF.hash", "FStar.Integers.op_Greater", "Hacl.Spec.RSAPSS.rsapss_pkey_pre", "Hacl.Hash.Definitions.mk_impl", "FStar.Integers.op_Less", "LowStar.Buffer.gcmalloc_of_list", "Hacl.Impl.RSAPSS.Padding.get_m1Hash", "Lib.Sequence.to_seq", "Hacl.Streaming.MD.hacl_sha2_256", "Hacl.Streaming.SHA2.hacl_sha2_256", "Hacl.Spec.RSAPSS.rsapss_load_pkey_post", "Lib.MultiBuffer.multibuf", "Hacl.Streaming.SHA2.state_512", "Hacl.Streaming.SHA2.hacl_sha2_224", "Hacl.Impl.RSAPSS.Padding.msg_len_t", "Hacl.Streaming.Interface.optional_key", "Lib.NTuple.ntuple_", "Hacl.Impl.RSAPSS.Keys.new_rsapss_load_pkey", "Hacl.Streaming.SHA2.state_t_512", "FStar.Integers.op_Plus", "Lib.MultiBuffer.live_multi", "Lib.Sequence.op_String_Access", "Hacl.Spec.RSAPSS.rsapss_verify_post", "Hacl.Streaming.SHA2.hash_384", "Hacl.RSAPSS.modBits_t", "Hacl.Spec.Bignum.Base.carry", "Hacl.Hash.Definitions.prev_len_v", "Hacl.Spec.RSAPSS.rsapss_sign_msg_to_bn", "Lib.IntTypes.u64", "Hacl.Spec.SHA2.Vec.words_state'", "Hacl.Streaming.SHA2.hacl_sha2_512", "Hacl.Streaming.MD.hacl_sha2_512", "Hacl.RSAPSS.t_limbs", "Lib.IntTypes.u8", "Hacl.Spec.RSAPSS.rsapss_verify_compute_msg", "Hacl.Impl.RSAPSS.Keys.check_modulus_u64", "Hacl.Streaming.SHA2.hash_256", "Hacl.Hash.Definitions.as_seq" ], "source_upto_this": "module Hacl.RSAPSS\n\nopen FStar.Mul\nopen Lib.IntTypes\n\nmodule S = Spec.RSAPSS\nmodule Hash = Spec.Agile.Hash\n\nmodule RI = Hacl.Impl.RSAPSS\nmodule RK = Hacl.Impl.RSAPSS.Keys\n\nmodule BN = Hacl.Bignum\nmodule BM = Hacl.Bignum.Montgomery\nmodule BE = Hacl.Bignum.Exponentiation\nmodule BD = Hacl.Bignum.Definitions\n\n#reset-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\ninline_for_extraction noextract\nlet t_limbs = U64\n\ninline_for_extraction noextract\nlet modBits_t = RI.modBits_t t_limbs\n\ninline_for_extraction noextract\nlet ke (modBits:modBits_t) =\n BE.mk_runtime_exp #t_limbs (BD.blocks modBits (size (bits t_limbs)))\n\n\nprivate\n[@CInline]\nlet load_pkey (modBits:modBits_t) : RK.rsapss_load_pkey_st t_limbs (ke modBits) modBits =\n RK.rsapss_load_pkey (ke modBits) modBits RK.mk_runtime_rsapss_checks\n\nprivate\n[@CInline]\nlet load_skey (modBits:modBits_t) : RK.rsapss_load_skey_st t_limbs (ke modBits) modBits =\n RK.rsapss_load_skey (ke modBits) modBits RK.mk_runtime_rsapss_checks (load_pkey modBits)\n\n\n[@@ Comment \"Sign a message `msg` and write the signature to `sgnt`.\n\n@param a Hash algorithm to use. Allowed values for `a` are ...\n - Spec_Hash_Definitions_SHA2_256,\n - Spec_Hash_Definitions_SHA2_384, and\n - Spec_Hash_Definitions_SHA2_512.\n@param modBits Count of bits in the modulus (`n`).\n@param eBits Count of bits in `e` value.\n@param dBits Count of bits in `d` value.\n@param skey Pointer to secret key created by `Hacl_RSAPSS_new_rsapss_load_skey`.\n@param saltLen Length of salt.\n@param salt Pointer to `saltLen` bytes where the salt is read from.\n@param msgLen Length of message.\n@param msg Pointer to `msgLen` bytes where the message is read from.\n@param sgnt Pointer to `ceil(modBits / 8)` bytes where the signature is written to.\n\n@return Returns true if and only if signing was successful.\"]\nval rsapss_sign:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n RI.rsapss_sign_st t_limbs (ke modBits) a modBits\n\nlet rsapss_sign a modBits eBits dBits skey saltLen salt msgLen msg sgnt =\n RI.rsapss_sign (ke modBits) a modBits eBits dBits skey saltLen salt msgLen msg sgnt\n\n\n[@@ Comment \"Verify the signature `sgnt` of a message `msg`.\n\n@param a Hash algorithm to use. Allowed values for `a` are ...\n - Spec_Hash_Definitions_SHA2_256,\n - Spec_Hash_Definitions_SHA2_384, and\n - Spec_Hash_Definitions_SHA2_512.\n@param modBits Count of bits in the modulus (`n`).\n@param eBits Count of bits in `e` value.\n@param pkey Pointer to public key created by `Hacl_RSAPSS_new_rsapss_load_pkey`.\n@param saltLen Length of salt.\n@param sgntLen Length of signature.\n@param sgnt Pointer to `sgntLen` bytes where the signature is read from.\n@param msgLen Length of message.\n@param msg Pointer to `msgLen` bytes where the message is read from.\n\n@return Returns true if and only if the signature is valid.\"]\nval rsapss_verify:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n RI.rsapss_verify_st t_limbs (ke modBits) a modBits\n", "sketch": [ "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate parameters. We need to pass the `ke modBits` value, the hash algorithm `a`, the modulus bits `modBits`, and the other parameters to the `RI.rsapss_verify` function.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate arguments and return the result.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate parameters.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate parameters.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate arguments and return the result.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate parameters.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate arguments and return the result.", "To implement the `rsapss_verify` function, we need to call the `RI.rsapss_verify` function with the appropriate parameters.", "The `rsapss_verify` function takes a hash algorithm `a`, the count of bits in the modulus `modBits`, and a public key `pkey` created by `Hacl_RSAPSS_new_rsapss_load_pkey`. It also takes the length of the salt, the length of the signature, the signature itself, the length of the message, and the message. It verifies the signature `sgnt` of the message `msg` using the specified hash algorithm and public key.", "To implement `rsapss_verify`, we need to call the `RI.rsapss_verify` function with the appropriate parameters and return its result." ], "generated_solution": [ "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg", "val rsapss_verify:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> modBits:modBits_t ->\n pkey: RK.rsapss_load_pkey_st t_limbs (ke modBits) modBits ->\n saltLen: int ->\n sgntLen: int ->\n sgnt: FStar.Bytes.bytes sgntLen ->\n msgLen: int ->\n msg: FStar.Bytes.bytes msgLen ->\n bool", "let rsapss_verify a modBits pkey saltLen sgntLen sgnt msgLen msg =\n RI.rsapss_verify (ke modBits) a modBits pkey saltLen sgntLen sgnt msgLen msg" ] }, { "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.sub_ghost", "opens_and_abbrevs": [ { "abbrev": "Act", "full_module": "PulseCore.Action" }, { "open": "PulseCore.Observability" }, { "open": "PulseCore.FractionalPermission" }, { "open": "PulseCore.InstantiatedSemantics" }, { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "A", "full_module": "PulseCore.Atomic" }, { "abbrev": "I", "full_module": "PulseCore.InstantiatedSemantics" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "Set", "full_module": "FStar.Set" }, { "abbrev": "G", "full_module": "FStar.Ghost" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "FStar.PCM" }, { "open": "PulseCore.Observability" }, { "open": "PulseCore.FractionalPermission" }, { "open": "FStar.Ghost" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2", "source_definition": "let sub_ghost = A.sub_ghost", "source_range": { "start_line": 151, "start_col": 0, "end_line": 151, "end_col": 27 }, "interleaved": false, "definition": "PulseCore.Atomic.sub_ghost", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "PulseCore.Atomic.sub_ghost" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n pre2: Pulse.Lib.Core.vprop ->\n post2: (_: a -> Pulse.Lib.Core.vprop) ->\n pf1: Pulse.Lib.Core.vprop_equiv pre1 pre2 ->\n pf2: Pulse.Lib.Core.vprop_post_equiv post1 post2 ->\n e: Pulse.Lib.Core.stt_ghost a pre1 post1\n -> Pulse.Lib.Core.stt_ghost a pre2 post2", "prompt": "let sub_ghost =\n ", "expected_response": "A.sub_ghost", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Core.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.Core.fst", "checked_file": "dataset/Pulse.Lib.Core.fst.checked", "interface_file": true, "dependencies": [ "dataset/PulseCore.Observability.fst.checked", "dataset/PulseCore.InstantiatedSemantics.fsti.checked", "dataset/PulseCore.FractionalPermission.fst.checked", "dataset/PulseCore.Atomic.fsti.checked", "dataset/PulseCore.Action.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.PropositionalExtensionality.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.Sugar.fsti.checked" ] }, "definitions_in_context": [ "let double_one_half () = ()", "let equate_by_smt = ()", "let one_half =\n half_perm full_perm", "let vprop = slprop", "let emp = emp", "let op_Star_Star = op_Star_Star", "val double_one_half ()\n : Lemma (sum_perm one_half one_half == full_perm)", "let pure = pure", "let op_exists_Star = op_exists_Star", "let vprop_equiv = slprop_equiv", "let elim_vprop_equiv #p #q pf = slprop_equiv_elim p q", "let vprop_post_equiv = slprop_post_equiv", "let prop_squash_idem (p:prop)\n : Tot (squash (squash p == p))\n = FStar.PropositionalExtensionality.apply p (squash p)", "let intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\n = let pf : squash (forall x. vprop_equiv (p x) (q x)) = \n introduce forall x. vprop_equiv (p x) (q x)\n with FStar.Squash.return_squash (pf x)\n in\n coerce_eq (prop_squash_idem _) pf", "let elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n: vprop_equiv (p x) (q x)\n= let pf\n : squash (vprop_equiv (p x) (q x))\n = eliminate forall x. vprop_equiv (p x) (q x) with x\n in\n coerce_eq (prop_squash_idem _) pf", "val equate_by_smt : unit", "val vprop : Type u#2", "val emp : vprop", "let vprop_equiv_refl (v0:vprop) \n : vprop_equiv v0 v0\n = slprop_equiv_refl v0", "val ( ** ) (p q:vprop) : vprop", "val pure (p:prop) : vprop", "val ( exists* ) (#a:Type) (p:a -> vprop) : vprop", "val vprop_equiv (p q:vprop) : prop", "let vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p", "val elim_vprop_equiv (#p #q:_) (_:vprop_equiv p q) : squash (p == q)", "val vprop_post_equiv (#t:Type u#a) (p q: t -> vprop) : prop", "val intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q", "let vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p", "val elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n : vprop_equiv (p x) (q x)", "let vprop_equiv_unit (x:vprop)\n : vprop_equiv (emp ** x) x\n = slprop_equiv_unit x", "val vprop_equiv_refl (v0:vprop) : vprop_equiv v0 v0", "let vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)\n = slprop_equiv_comm p1 p2", "val vprop_equiv_sym (v0 v1:vprop) (_:vprop_equiv v0 v1)\n : vprop_equiv v1 v0", "val vprop_equiv_trans (v0 v1 v2:vprop) (_:vprop_equiv v0 v1) (_:vprop_equiv v1 v2)\n : vprop_equiv v0 v2", "let vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv ((p1 ** p2) ** p3) (p1 ** (p2 ** p3))\n = slprop_equiv_assoc p1 p2 p3", "val vprop_equiv_unit (x:vprop) : vprop_equiv (emp ** x) x", "let vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (f: vprop_equiv p1 p3)\n (g: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)\n = slprop_equiv_elim p1 p3;\n slprop_equiv_elim p2 p4;\n vprop_equiv_refl _", "val vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)", "val vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv (p1 ** p2 ** p3) (p1 ** (p2 ** p3))", "val vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (_: vprop_equiv p1 p3)\n (_: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)", "let vprop_equiv_ext p1 p2 _ = vprop_equiv_refl p1", "val vprop_equiv_ext (p1 p2:vprop) (_:p1 == p2)\n : vprop_equiv p1 p2", "let iname = Act.iname", "let join_sub _ _ = ()", "let join_emp is =\n Set.lemma_equal_intro (join_inames is emp_inames) (reveal is);\n Set.lemma_equal_intro (join_inames emp_inames is) (reveal is)", "let inv = Act.inv", "val iname : eqtype", "let name_of_inv = Act.name_of_inv", "let inames = erased (FStar.Set.set iname)", "let emp_inames : inames = Ghost.hide Set.empty", "let add_already_there i is = Set.lemma_equal_intro (add_inv is i) is", "let join_inames (is1 is2 : inames) : inames =\n Set.union is1 is2", "let inames_subset (is1 is2 : inames) : Type0 =\n Set.subset is1 is2", "let stt = I.stt", "let return_stt_noeq = I.return", "let bind_stt = I.bind", "let (/!) (is1 is2 : inames) : Type0 =\n Set.disjoint is1 is2", "let frame_stt = I.frame", "let par_stt = I.par", "let sub_stt = I.sub", "val inv (p:vprop) : Type u#0", "let conv_stt pf1 pf2 = I.conv #_ _ _ _ _ pf1 pf2", "let hide_div = I.hide_div", "val name_of_inv #p (i : inv p) : GTot iname", "let mem_iname (e:inames) (i:iname) : erased bool = elift2 (fun e i -> Set.mem i e) e i", "let mem_inv (#p:vprop) (e:inames) (i:inv p) : erased bool = mem_iname e (name_of_inv i)", "let stt_atomic a #obs inames pre post = A.stt_atomic a #obs inames pre post", "let add_iname (e:inames) (i:iname) : inames = Set.union (Set.singleton i) (reveal e)", "let lift_observability = A.lift_observability", "let add_inv (#p:vprop) (e:inames) (i:inv p) : inames = add_iname e (name_of_inv i)", "let return_neutral = A.return_atomic", "let remove_inv (#p:vprop) (e:inames) (i:inv p) : inames = Set.remove (name_of_inv i) e", "let return_neutral_noeq = A.return_atomic_noeq", "let all_inames : inames = Set.complement Set.empty", "let bind_atomic = A.bind_atomic", "let inv_disjointness_remove_i_i (#p:vprop) (e:inames) (i:inv p)\n: Lemma (not (mem_inv (remove_inv e i) i))\n= ()", "let frame_atomic = A.frame_atomic", "let sub_atomic = A.sub_atomic", "let sub_invs_atomic = A.sub_invs_stt_atomic", "let lift_atomic0 = A.lift_atomic0", "let lift_atomic1 = A.lift_atomic1", "val add_already_there #p (i : inv p) (is : inames)\n : Lemma (requires Set.mem (name_of_inv i) is)\n (ensures add_inv is i == is)\n [SMTPat (add_inv is i)]", "let lift_atomic2 = A.lift_atomic2", "let new_invariant = A.new_invariant", "let with_invariant = A.with_invariant", "let stt_ghost = A.stt_ghost", "let bind_ghost = A.bind_ghost", "let lift_ghost_neutral = A.lift_ghost_neutral", "let lift_neutral_ghost = A.lift_neutral_ghost", "let frame_ghost = A.frame_ghost" ], "closest": [ "val sub_ghost\r\n (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_ghost a pre1 post1)\r\n: stt_ghost a pre2 post2\nlet sub_ghost pre2 post2 pf1 pf2 e\r\n= Ghost.hide (A.sub pre2 post2 e)", "val bind_ghost\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_ghost a pre1 post1)\r\n (e2:(x:a -> stt_ghost b (post1 x) post2))\r\n: stt_ghost b pre1 post2\nlet bind_ghost\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_ghost a pre1 post1)\r\n (e2:(x:a -> stt_ghost b (post1 x) post2))\r\n: stt_ghost b pre1 post2\r\n= let e1 = Ghost.reveal e1 in\r\n let e2 = FStar.Ghost.Pull.pull (fun (x:a) -> Ghost.reveal (e2 x)) in\r\n Ghost.hide (A.bind e1 e2)", "val stt_ghost\r\n (a:Type u#a)\r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type u#(max 2 a)\nlet stt_ghost a pre post = Ghost.erased (act a emp_inames pre post)", "val frame_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_ghost a pre post)\r\n: stt_ghost a (pre ** frame) (fun x -> post x ** frame)\nlet frame_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_ghost a pre post)\r\n: stt_ghost a (pre ** frame) (fun x -> post x ** frame)\r\n= Ghost.hide (A.frame (Ghost.reveal e))", "val sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\nlet sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\r\n= coerce_eq (conv pre1 pre2 post1 post2 pf1 pf2) e", "val perform_ghost\n (#a #pre #post : _)\n (f : unit -> stt_ghost a pre post)\n : stt_ghost a pre post\nlet perform_ghost f = f ()", "val lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\nlet lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\r\n= Ghost.hide e", "val fix_stt_ghost_1 (#a : Type) (#b : a -> Type) (#pre : a -> vprop) (#post : (x:a -> b x -> vprop))\n (ff : (x:a -> (y:a{y << x} -> stt_ghost (b y) (pre y) (post y)) -> stt_ghost (b x) (pre x) (post x)))\n : x:a -> stt_ghost (b x) (pre x) (post x)\nlet fix_stt_ghost_1 (#a : Type) (#b : a -> Type) (#pre : a -> vprop) (#post : (x:a -> b x -> vprop))\n (ff : (x:a -> (y:a{y << x} -> stt_ghost (b y) (pre y) (post y)) -> stt_ghost (b x) (pre x) (post x)))\n : x:a -> stt_ghost (b x) (pre x) (post x)\n = fix_1 #a #(fun x -> stt_ghost (b x) (pre x) (post x)) ff", "val conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\nlet conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\r\n= slprop_equiv_elim pre1 pre2;\r\n introduce forall x. post1 x == post2 x\r\n with slprop_equiv_elim (post1 x) (post2 x);\r\n Sem.conv #state a #pre1 #(F.on_dom _ post1) (F.on_dom _ post2);\r\n ()", "val coerce_ghost (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a false o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a false o Unobservable p q pre post\nlet coerce_ghost (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a false o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a false o Unobservable p q pre post\n = STG.STGhostBase?.reflect (SA.reify_steel_ghost_comp f)", "val mk_stt_ghost_comp_post_equiv\n (g: R.env)\n (u: R.universe)\n (a pre post1 post2: R.term)\n (posts_equiv: RT.equiv g post1 post2)\n : RT.equiv g (mk_stt_ghost_comp u a pre post1) (mk_stt_ghost_comp u a pre post2)\nlet mk_stt_ghost_comp_post_equiv (g:R.env) (u:R.universe) (a pre post1 post2:R.term)\n (posts_equiv:RT.equiv g post1 post2)\n : RT.equiv g (mk_stt_ghost_comp u a pre post1)\n (mk_stt_ghost_comp u a pre post2) =\n let open R in\n let open RT in\n let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in\n let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in\n let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in\n Rel_ctxt g post1 post2\n (Ctxt_app_arg t Q_Explicit Ctxt_hole)\n posts_equiv", "val coerce_ghostF (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a true o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a true o Unobservable p q pre post\nlet coerce_ghostF #a #o #p #q #pre #post f\n = STGhostBase?.reflect (SA.reify_steel_ghost_comp f)", "val sub_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_atomic a #obs opens pre1 post1)\r\n: stt_atomic a #obs opens pre2 post2\nlet sub_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_atomic a #obs opens pre1 post1)\r\n: stt_atomic a #obs opens pre2 post2\r\n= A.sub pre2 post2 e", "val bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\nlet bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\r\n= fun _ -> Sem.mbind (e1()) (fun x -> e2 x ())", "val ghost_recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:ghost_ref pcm)\r\n (v:Ghost.erased a)\r\n (w:ghost_witnessed r fact)\r\n: stt_ghost (v1:Ghost.erased a{compatible pcm v v1})\r\n (ghost_pts_to r v)\r\n (fun v1 -> ghost_pts_to r v ** pure (fact v1))\nlet ghost_recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:ghost_ref pcm)\r\n (v:Ghost.erased a)\r\n (w:ghost_witnessed r fact)\r\n= Ghost.hide (A.recall r v w)", "val hide_ghost (#a #pre #post: _) (f: stt_ghost a pre post)\n : stt_ghost (erased a) pre (fun x -> post (reveal x))\nlet hide_ghost #a #pre #post \r\n (f:stt_ghost a pre post)\r\n: stt_ghost (erased a) pre (fun x -> post (reveal x))\r\n= let f = Ghost.reveal f in\r\n Ghost.hide <|\r\n A.bind f\r\n (fun (r:a) ->\r\n A.return #(erased a) #(fun (x:erased a) -> post (reveal x))\r\n (hide r))", "val return_ghost\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_ghost a (p x) (fun r -> p r ** pure (r == x))\nlet return_ghost #a x p = Ghost.hide (return_atomic #a x p)", "val ghost_witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n: stt_ghost\r\n (ghost_witnessed r fact)\r\n (ghost_pts_to r v)\r\n (fun _ -> ghost_pts_to r v)\nlet ghost_witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n= Ghost.hide (A.witness r fact v pf)", "val recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:erased (ref a pcm))\r\n (v:Ghost.erased a)\r\n (w:witnessed r fact)\r\n: stt_ghost (v1:Ghost.erased a{compatible pcm v v1})\r\n (pts_to r v)\r\n (fun v1 -> pts_to r v ** pure (fact v1))\nlet recall #a #pcm #fact r v w = Ghost.hide (A.recall r v w)", "val Pulse.Reflection.Util.mk_sub_stt_ghost = \n u510: FStar.Stubs.Reflection.Types.universe ->\n a: FStar.Stubs.Reflection.Types.term ->\n pre1: FStar.Stubs.Reflection.Types.term ->\n pre2: FStar.Stubs.Reflection.Types.term ->\n post1: FStar.Stubs.Reflection.Types.term ->\n post2: FStar.Stubs.Reflection.Types.term ->\n e: FStar.Stubs.Reflection.Types.term\n -> FStar.Stubs.Reflection.Types.term\nlet mk_sub_stt_ghost (u:R.universe) (a pre1 pre2 post1 post2 e:R.term) =\n let open R in\n let lid = mk_pulse_lib_core_lid \"sub_ghost\" in\n let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in\n let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (pre1, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (pre2, Q_Explicit)) in\n let t = pack_ln (R.Tv_App t (post1, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (post2, Q_Explicit)) in\n let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in\n let t = pack_ln (R.Tv_App t (`(), Q_Explicit)) in\n pack_ln (R.Tv_App t (e, Q_Explicit))", "val elab_stghost_equiv\n (g: R.env)\n (c: comp{C_STGhost? c})\n (pre post: R.term)\n (eq_pre: RT.equiv g pre (elab_term (comp_pre c)))\n (eq_post:\n RT.equiv g post (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c))))\n : RT.equiv g\n (let C_STGhost { u = u ; res = res } = c in\n mk_stt_ghost_comp u (elab_term res) pre post)\n (elab_comp c)\nlet elab_stghost_equiv (g:R.env) (c:comp{C_STGhost? c}) (pre:R.term) (post:R.term)\n (eq_pre:RT.equiv g pre (elab_term (comp_pre c)))\n (eq_post:RT.equiv g post\n (mk_abs (elab_term (comp_res c)) R.Q_Explicit (elab_term (comp_post c))))\n : RT.equiv g\n (let C_STGhost {u;res} = c in\n mk_stt_ghost_comp u\n (elab_term res)\n pre\n post)\n (elab_comp c) =\n \n let C_STGhost _ = c in\n mk_stt_ghost_comp_equiv _\n (comp_u c)\n (elab_term (comp_res c))\n _ _ _ _ eq_pre eq_post", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val with_invlist_ghost (#pre : vprop) (#post : vprop)\n (is : invlist)\n (f : unit -> stt_ghost unit (invlist_v is ** pre) (fun _ -> invlist_v is ** post))\n : stt_atomic unit #Unobservable (invlist_names is) pre (fun _ -> post)\nlet with_invlist_ghost = __with_invlist_ghost", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val return_ghost_noeq\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_ghost a (p x) p\nlet return_ghost_noeq #a x p = Ghost.hide (A.return #_ #p x)", "val bind_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (#b: Type)\n (#post_b: post_t st b)\n (lpost_b: (x: a -> l_post (post_a x) post_b))\n : l_post pre post_b\nlet bind_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (#b:Type)\n (#post_b:post_t st b)\n (lpost_b:(x:a -> l_post (post_a x) post_b))\n : l_post pre post_b\n =\n fun h0 y h2 -> lpre_a h0 /\\ (exists x h1. lpost_a h0 x h1 /\\ (lpost_b x) h1 y h2)", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift2 e", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val sub_invs_stt_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens1 #opens2:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens1 pre post)\r\n (_ : squash (inames_subset opens1 opens2))\r\n: stt_atomic a #obs opens2 pre post\nlet sub_invs_stt_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens1 #opens2:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens1 pre post)\r\n (_ : squash (inames_subset opens1 opens2))\r\n: stt_atomic a #obs opens2 pre post\r\n= assert (Set.equal (Set.union opens1 opens2) opens2);\r\n A.weaken opens2 e", "val witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:erased (ref a pcm))\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n: stt_ghost\r\n (witnessed r fact)\r\n (pts_to r v)\r\n (fun _ -> pts_to r v)\nlet witness #a #pcm r f v pf = Ghost.hide (A.witness r f v pf)", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val vpattern_rewrite\n (#opened: _)\n (#a: Type)\n (#x1: a)\n (p: a -> vprop)\n (x2: a)\n: STGhost unit opened\n (p x1)\n (fun _ -> p x2)\n (x1 == x2)\n (fun _ -> True)\nlet vpattern_rewrite\n (#opened: _)\n (#a: Type)\n (#x1: a)\n (p: a -> vprop)\n (x2: a)\n: STGhost unit opened\n (p x1)\n (fun _ -> p x2)\n (x1 == x2)\n (fun _ -> True)\n= rewrite (p x1) (p x2)", "val ghost_gather\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a)\r\n: stt_ghost (squash (composable pcm v0 v1))\r\n (ghost_pts_to r v0 ** ghost_pts_to r v1)\r\n (fun _ -> ghost_pts_to r (op pcm v0 v1))\nlet ghost_gather r v0 v1 = Ghost.hide (A.gather r v0 v1)", "val exists_cong (#a:_)\n (#u:_)\n (p:a -> vprop)\n (q:a -> vprop {forall x. equiv (p x) (q x) })\n : STGhostT unit u\n (exists_ p)\n (fun _ -> exists_ q)\nlet exists_cong #a #u p q\n = coerce_ghost (fun _ -> SEA.exists_cong #a #u p q)", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift1 e", "val ghost_read\r\n (#a:Type)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (x:erased a)\r\n (f:(v:a{compatible p x v}\r\n -> GTot (y:a{compatible p y v /\\\r\n FStar.PCM.frame_compatible p x v y})))\r\n: stt_ghost (erased (v:a{compatible p x v /\\ p.refine v}))\r\n (ghost_pts_to r x)\r\n (fun v -> ghost_pts_to r (f v))\nlet ghost_read\r\n (#a:Type)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (x:erased a)\r\n (f:(v:a{compatible p x v}\r\n -> GTot (y:a{compatible p y v /\\\r\n FStar.PCM.frame_compatible p x v y})))\r\n: stt_ghost (erased (v:a{compatible p x v /\\ p.refine v}))\r\n (ghost_pts_to r x)\r\n (fun v -> ghost_pts_to r (f v))\r\n= hide_ghost <| Ghost.hide <|A.read r x f", "val frame_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post: post_t st a)\n (lpre: l_pre pre)\n (lpost: l_post pre post)\n (#frame: st.hprop)\n (f_frame: fp_prop frame)\n : l_post (pre `st.star` frame) (fun x -> (post x) `st.star` frame)\nlet frame_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post:post_t st a)\n (lpre:l_pre pre)\n (lpost:l_post pre post)\n (#frame:st.hprop)\n (f_frame:fp_prop frame)\n : l_post (pre `st.star` frame) (fun x -> post x `st.star` frame)\n =\n fun h0 x h1 -> lpre h0 /\\ lpost h0 x h1 /\\ f_frame h1", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val ghost_share\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\r\n: stt_ghost unit\r\n (ghost_pts_to r (v0 `op pcm` v1))\r\n (fun _ -> ghost_pts_to r v0 ** ghost_pts_to r v1)\nlet ghost_share r v0 v1 = Ghost.hide (A.share r v0 v1)", "val elim_forall\n (#a:Type)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* x. p x)\n (fun _ -> p x)\nlet elim_forall\n (#a:Type u#a)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* (x:a). p x)\n (fun _ -> p x)\n= let m1 = elim_exists #vprop (fun (v:vprop) -> pure (is_forall v p) ** token v) in\n let m2 (v:Ghost.erased vprop)\n : stt_ghost unit \n (pure (is_forall v p) ** token v)\n (fun _ -> p x)\n = bind_ghost\n (frame_ghost \n (token v)\n (elim_pure_explicit (is_forall v p)))\n (fun (pf:squash (is_forall v p)) ->\n let f = extract_q v p pf in\n sub_ghost (emp ** Ghost.reveal v)\n (fun _ -> p x)\n (vprop_equiv_sym _ _ (vprop_equiv_unit _))\n (intro_vprop_post_equiv \n (fun _ -> p x)\n (fun _ -> p x)\n (fun _ -> vprop_equiv_refl (p x)))\n (f x))\n in\n bind_ghost m1 m2", "val ghost_put (#o:_)\r\n (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n (x:v)\r\n (content:Ghost.erased c)\r\n : STGhost unit o\r\n (perm a init m b `star` vp i x content)\r\n (fun _ -> perm a init (Map.upd m i content) (PartialMap.remove b i))\r\n (requires\r\n PartialMap.sel b i == Some x)\r\n (ensures fun _ ->\r\n True)\nlet ghost_put #_ #v #c #vp #init #m #b a i x content =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n ETbl.ghost_put a.etbl i x content;\r\n assert (PartialMap.equal (PartialMap.upd (repr_to_eht_repr m) i content)\r\n (repr_to_eht_repr (Map.upd m i content)));\r\n rewrite (ETbl.tperm _ _ _)\r\n (ETbl.tperm a.etbl\r\n (repr_to_eht_repr (Map.upd m i content))\r\n (PartialMap.remove b i));\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) (Map.upd m i content) (PartialMap.remove b i) a.high)", "val par_lpost\n (#st: st)\n (#aL: Type)\n (#preL: st.hprop)\n (#postL: post_t st aL)\n (lpreL: l_pre preL)\n (lpostL: l_post preL postL)\n (#aR: Type)\n (#preR: st.hprop)\n (#postR: post_t st aR)\n (lpreR: l_pre preR)\n (lpostR: l_post preR postR)\n : l_post (preL `st.star` preR) (fun (xL, xR) -> (postL xL) `st.star` (postR xR))\nlet par_lpost\n (#st:st)\n (#aL:Type)\n (#preL:st.hprop)\n (#postL:post_t st aL)\n (lpreL:l_pre preL)\n (lpostL:l_post preL postL)\n (#aR:Type)\n (#preR:st.hprop)\n (#postR:post_t st aR)\n (lpreR:l_pre preR)\n (lpostR:l_post preR postR)\n : l_post (preL `st.star` preR) (fun (xL, xR) -> postL xL `st.star` postR xR)\n =\n fun h0 (xL, xR) h1 -> lpreL h0 /\\ lpreR h0 /\\ lpostL h0 xL h1 /\\ lpostR h0 xR h1", "val ghost_witness2 (a:Type u#2) (_:squash a) :\n stt_ghost a emp (fun _ -> emp)\nlet ghost_witness2 = __ghost_witness2", "val ghost_gather\n (#a: Type)\n (#u: _)\n (#p0 #p1: perm)\n (#p: perm{p == sum_perm p0 p1})\n (x0 #x1: erased a)\n (r: ghost_ref a)\n : SteelGhost unit\n u\n ((ghost_pts_to r p0 x0) `star` (ghost_pts_to r p1 x1))\n (fun _ -> ghost_pts_to r p x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather (#a:Type) (#u:_)\n (#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})\n (x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r p x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\n = let _ = ghost_gather_pt #a #u #p0 #p1 r in ()", "val stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\nlet stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\r\n= lower (Sem.m u#2 u#100 u#a #state a pre (F.on_dom a post))", "val admit_ (#a:Type)\n (#opened:inames)\n (#p:pre_t)\n (#q:post_t a)\n (_:unit)\n : STGhostF a opened p q True (fun _ -> False)\nlet admit_ _ = STGhostF?.reflect (fun _ -> NMSTTotal.nmst_tot_admit ())", "val share\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ref a pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\r\n: stt_ghost unit\r\n (pts_to r (v0 `op pcm` v1))\r\n (fun _ -> pts_to r v0 ** pts_to r v1)\nlet share #a #pcm r v0 v1 = Ghost.hide (A.share r v0 v1)", "val ghost_witness_exists2 (a:Type u#2) :\n stt_ghost a (pure (exists (x:a). True)) (fun _ -> emp)\nlet ghost_witness_exists2 = __ghost_witness_exists2", "val sub \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens:inames)\r\n (pre':slprop { slprop_equiv pre pre' })\r\n (post':a -> slprop { forall x. slprop_equiv (post x) (post' x) })\r\n (f:act a opens pre post)\r\n: act a opens pre' post'\nlet sub \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens:inames)\r\n (pre':slprop { slprop_equiv pre pre' })\r\n (post':a -> slprop { forall x. slprop_equiv (post x) (post' x) })\r\n (f:act a opens pre post)\r\n: act a opens pre' post'\r\n= I.slprop_equiv_elim pre pre';\r\n introduce forall x. post x == post' x\r\n with I.slprop_equiv_elim (post x) (post' x);\r\n f", "val ghost_pts_to (#a:Type u#1) (#p:pcm a) (r:ghost_ref p) (v:a) : slprop\nlet ghost_pts_to #a #p r v = pts_to r v", "val frame\r\n (#a:Type u#a)\r\n (#pre:slprop) (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt a pre post)\r\n: stt a (pre ** frame) (fun x -> post x ** frame)\nlet frame\r\n (#a:Type u#a)\r\n (#pre:slprop) (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt a pre post)\r\n: stt a (pre `star` frame) (fun x -> post x `star` frame)\r\n= fun _ -> Sem.frame frame (e())", "val elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\nlet elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\r\n= Ghost.hide (A.elim_exists p)", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#p: P.perm)\n (a1 a2: array elt)\n (sq: squash (adjacent a1 a2))\n : SteelGhost unit\n opened\n ((varrayp a1 p) `star` (varrayp a2 p))\n (fun res -> varrayp (merge a1 a2) p)\n (fun _ -> True)\n (fun h _ h' -> aselp (merge a1 a2) p h' == (aselp a1 p h) `Seq.append` (aselp a2 p h))\nlet ghost_join\n (#opened: _)\n (#elt: Type)\n (#p: P.perm)\n (a1 a2: array elt)\n (sq: squash (adjacent a1 a2))\n: SteelGhost unit opened\n (varrayp a1 p `star` varrayp a2 p)\n (fun res -> varrayp (merge a1 a2) p)\n (fun _ -> True)\n (fun h _ h' ->\n aselp (merge a1 a2) p h' == aselp a1 p h `Seq.append` aselp a2 p h\n )\n= let _ = elim_varrayp a1 p in\n let _ = elim_varrayp a2 p in\n A.ghost_join a1 a2 ();\n intro_varrayp _ _ _", "val inst_heap_prop_for_par\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post: post_t st a)\n (lpost: l_post pre post)\n (state: st.mem)\n : fp_prop pre\nlet inst_heap_prop_for_par\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post:post_t st a)\n (lpost:l_post pre post)\n (state:st.mem)\n : fp_prop pre\n =\n fun h ->\n forall x final_state.\n lpost h x final_state <==>\n lpost (st.core state) x final_state", "val rewrite_value_vprops_prefix_and_suffix\n (#opened: _)\n (#k: eqtype)\n (#v: Type0)\n (#contents: Type)\n (vp: vp_t k v contents)\n (s1 s2: Seq.seq (option (k & v)))\n (m1 m2: Map.t k contents)\n (borrows1 borrows2: Map.t k v)\n (idx: US.t{Seq.length s1 == Seq.length s2 /\\ US.v idx < Seq.length s1})\n : STGhost unit\n opened\n ((value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1)\n `star`\n (value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1))\n (fun _ ->\n (value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2)\n `star`\n (value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2))\n (requires\n value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2 /\\\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (ensures fun _ -> True)\nlet rewrite_value_vprops_prefix_and_suffix (#opened:_)\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (s1 s2:Seq.seq (option (k & v)))\n (m1 m2:Map.t k contents)\n (borrows1 borrows2:Map.t k v)\n (idx:US.t{Seq.length s1 == Seq.length s2 /\\ US.v idx < Seq.length s1})\n : STGhost unit opened\n (value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1\n `star`\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1)\n (fun _ ->\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2\n `star`\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (requires value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2 /\\\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (ensures fun _ -> True)\n = rewrite\n (value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1\n `star`\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1)\n (value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2\n `star`\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val elim_pure (p:prop)\r\n: stt_ghost (squash p) (pure p) (fun _ -> emp)\nlet elim_pure (p:prop)\r\n: stt_ghost (squash p) (pure p) (fun _ -> emp)\r\n= Ghost.hide (A.elim_pure p)", "val share_gen\n (#t: Type)\n (#opened: _)\n (#p: perm)\n (#v: t)\n (r: ref t)\n (p1 p2: perm)\n: STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n #_ #_ #_ #v r p1 p2\n= coerce_ghost (fun _ -> R.ghost_share_gen_pt #_ #_ #_ #v r p1 p2)", "val intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\nlet intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\n= let _ : squash (universal_quantifier v p) = FStar.Squash.return_squash f_elim in\n let m1\n : stt_ghost unit (emp ** v) (fun _ -> pure (is_forall v p) ** v) \n = frame_ghost v (intro_pure (is_forall v p) ()) in\n let m2 ()\n : stt_ghost unit\n (pure (is_forall v p) ** token v) \n (fun _ -> forall* x. p x)\n = intro_exists (fun (v:vprop) -> pure (is_forall v p) ** token v) v\n in\n let m = bind_ghost m1 m2 in\n sub_ghost v _\n (vprop_equiv_unit _)\n (intro_vprop_post_equiv _ _ (fun _ -> vprop_equiv_refl _))\n m", "val with_pre (pre: vprop) (#a: Type) (#post: (a -> vprop)) (m: stt a emp post)\n : stt a pre (fun v -> pre ** post v)\nlet with_pre (pre:vprop) (#a:Type) (#post:a -> vprop)(m:stt a emp post)\n: stt a pre (fun v -> pre ** post v)\n= let m1 = frame_stt pre m in\n let pf_post : vprop_post_equiv (fun r -> post r ** pre) (fun r -> pre ** post r)\n = intro_vprop_post_equiv _ _ (fun r -> vprop_equiv_comm (post r) pre)\n in\n sub_stt _ _ (vprop_equiv_unit pre) pf_post m1", "val lift_ghost_unobservable (#pre #post: _) (f: stt_ghost unit pre post)\n : stt_atomic unit #Unobservable emp_inames pre post\nlet lift_ghost_unobservable #pre #post (f:stt_ghost unit pre post) \n : stt_atomic unit #Unobservable emp_inames pre post\n = lift_observability #_ #_ #Unobservable (lift_ghost_neutral f unit_non_informative)", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val stt_atomic\r\n (a:Type u#a)\r\n (#obs:observability)\r\n (opens:inames)\r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type u#(max 2 a)\nlet stt_atomic a #obs opens pre post =\r\n A.act a opens pre post", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n: stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share #a arr #s #p = H.share arr #(raise_seq s) #p", "val gather\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ref a pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a)\r\n: stt_ghost (squash (composable pcm v0 v1))\r\n (pts_to r v0 ** pts_to r v1)\r\n (fun _ -> pts_to r (op pcm v0 v1))\nlet gather #a #pcm r v0 v1 = Ghost.hide (A.gather r v0 v1)", "val ghost_witnessed\r\n (#a:Type u#1)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n: Type0\nlet ghost_witnessed \r\n (#a:Type u#1) \r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n= witnessed (reveal r) f", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val elim_exists (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (Ghost.erased a) opened_invariants\n (exists_ p)\n (fun x -> p x)\nlet elim_exists #a #o #p _\n = coerce_ghost (fun _ -> SEA.witness_exists #a #o #p ())", "val repr (a:Type u#a) //result type\n (already_framed:bool) //framed or not\n (opened_invariants:inames) //which invariants are we relying on\n (g:observability) //is this a ghost computation?\n (pre:pre_t) //expects vprop\n (post:post_t a) //provides a -> vprop\n (req:pure_pre) //a prop refinement as a precondition\n (ens:pure_post a) //an (a -> prop) as a postcondition\n : Type u#(max a 2)\nlet repr (a:Type u#a)\n (already_framed:bool)\n (opened_invariants:inames)\n (g:observability)\n (pre:pre_t)\n (post:post_t a)\n (req:Type0)\n (ens:a -> Type0)\n : Type u#(max a 2)\n = SEA.repr a already_framed opened_invariants g pre post\n (fun _ -> req)\n (fun _ x _ -> ens x)", "val vpattern\n (#opened: _)\n (#a: Type)\n (#x: a)\n (p: a -> vprop)\n: STGhost a opened (p x) (fun _ -> p x) True (fun res -> res == x)\nlet vpattern\n (#opened: _)\n (#a: Type)\n (#x: a)\n (p: a -> vprop)\n: STGhost a opened (p x) (fun _ -> p x) True (fun res -> res == x)\n= noop ();\n x", "val share_gen (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : STGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n r p1 p2\n= coerce_ghost (fun _ -> R.share_gen_pt r p1 p2)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.split r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (hide (U.raise_val (reveal v)))", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Seq.seq elt)\n (#p: P.perm)\n (a1 a2: array elt)\n (h: squash (adjacent a1 a2))\n: STGhostT unit opened\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to (merge a1 a2) p (x1 `Seq.append` x2))\nlet ghost_join\n #_ #_ #x1 #x2 #p a1 a2 h\n= rewrite\n (pts_to a1 _ _)\n (H.pts_to a1 p (seq_map raise x1));\n rewrite\n (pts_to a2 _ _)\n (H.pts_to a2 p (seq_map raise x2));\n H.ghost_join a1 a2 h;\n assert (seq_map raise (x1 `Seq.append` x2) `Seq.equal` (seq_map raise x1 `Seq.append` seq_map raise x2));\n rewrite\n (H.pts_to _ _ _)\n (H.pts_to (merge a1 a2) p (seq_map raise (x1 `Seq.append` x2)));\n rewrite\n (H.pts_to _ _ _)\n (pts_to (merge a1 a2) _ _)", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Seq.seq elt)\n (#p: P.perm)\n (a1 a2: array elt)\n (h: squash (adjacent a1 a2))\n: STGhostT unit opened\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to (merge a1 a2) p (x1 `Seq.append` x2))\nlet ghost_join\n #_ #_ #x1 #x2 #p a1 a2 h\n= elim_pts_to a1 p x1;\n elim_pts_to a2 p x2;\n mk_carrier_merge (US.v (ptr_of a1).base_len) ((ptr_of a1).offset) x1 x2 (p);\n change_r_pts_to\n (ptr_of a2).base _\n (ptr_of a1).base (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset + Seq.length x1) x2 p);\n R.gather (ptr_of a1).base\n (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset) x1 (p))\n (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset + Seq.length x1) x2 (p));\n change_r_pts_to\n (ptr_of a1).base _\n (ptr_of (merge a1 a2)).base (mk_carrier (US.v (ptr_of (merge a1 a2)).base_len) ((ptr_of (merge a1 a2)).offset) (x1 `Seq.append` x2) (p));\n intro_pts_to (merge a1 a2) p (Seq.append x1 x2)", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a)\n: stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\n= share #a r #v", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> MR.write r x)", "val Pulse.Reflection.Util.mk_stt_ghost_comp = \n u112: FStar.Stubs.Reflection.Types.universe ->\n a: FStar.Stubs.Reflection.Types.term ->\n pre: FStar.Stubs.Reflection.Types.term ->\n post: FStar.Stubs.Reflection.Types.term\n -> FStar.Stubs.Reflection.Types.term\nlet mk_stt_ghost_comp (u:R.universe) (a pre post:R.term) =\n let t = R.pack_ln (R.Tv_UInst stt_ghost_fv [u]) in\n let t = R.pack_ln (R.Tv_App t (a, R.Q_Explicit)) in\n let t = R.pack_ln (R.Tv_App t (pre, R.Q_Explicit)) in\n R.pack_ln (R.Tv_App t (post, R.Q_Explicit))", "val lpost_ret_act\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post: post_t st a)\n (lpost: l_post pre post)\n (x: a)\n (state: st.mem)\n : l_post (post x) post\nlet lpost_ret_act\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post:post_t st a)\n (lpost:l_post pre post)\n (x:a)\n (state:st.mem)\n : l_post (post x) post\n =\n fun _ x h1 -> lpost (st.core state) x h1", "val lift_observability \r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e1:stt_atomic a #obs opens pre post)\r\n: stt_atomic a #(join_obs obs obs') opens pre post\nlet lift_observability\r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n= e", "val lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift0 e", "val equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\nlet equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_equal (Pointer?.p p1) (Pointer?.p p2)", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val elim_trade_ghost\n (#[T.exact (`invlist_empty)] is : invlist)\n (hyp concl: vprop)\n: stt_ghost unit\n (invlist_v is ** (trade #is hyp concl) ** hyp)\n (fun _ -> invlist_v is ** concl)\nlet elim_trade_ghost #is = __elim_trade_ghost #is", "val lift_ghost_atomic\n (a:Type)\n (opened:inames)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:pure_pre)\n (#[@@@ framing_implicit] ens:pure_post a)\n (f:STAG.repr a framed opened Unobservable pre post req ens)\n : STAG.repr a framed opened Unobservable pre post req ens\nlet lift_ghost_atomic\n (a:Type)\n (opened:inames)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:Type0)\n (#[@@@ framing_implicit] ens:a -> Type0)\n (f:STAG.repr a framed opened Unobservable pre post req ens)\n : STAG.repr a framed opened Unobservable pre post req ens\n = f", "val ghost_alloc\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (x:erased a{compatible pcm x x /\\ pcm.refine x})\r\n: stt_ghost (ghost_ref pcm)\r\n emp\r\n (fun r -> ghost_pts_to r x)\nlet ghost_alloc #a #pcm x = hide_ghost (Ghost.hide <| A.alloc #a x)", "val preserves_frame_stronger_post\n (#st: st)\n (#a: Type)\n (pre: st.hprop)\n (post post_s: post_t st a)\n (x: a)\n (m1 m2: st.mem)\n : Lemma (requires preserves_frame pre (post_s x) m1 m2 /\\ stronger_post post post_s)\n (ensures preserves_frame pre (post x) m1 m2)\nlet preserves_frame_stronger_post (#st:st) (#a:Type)\n (pre:st.hprop) (post post_s:post_t st a) (x:a)\n (m1 m2:st.mem)\n: Lemma\n (requires preserves_frame pre (post_s x) m1 m2 /\\ stronger_post post post_s)\n (ensures preserves_frame pre (post x) m1 m2)\n= let aux (frame:st.hprop)\n : Lemma\n (requires st.interp (st.invariant m1 `st.star` (pre `st.star` frame)) m1)\n (ensures st.interp (st.invariant m2 `st.star` (post x `st.star` frame)) m2)\n [SMTPat ()]\n = assert (st.interp (st.invariant m2 `st.star` (post_s x `st.star` frame)) m2);\n calc (st.equals) {\n st.invariant m2 `st.star` (post_s x `st.star` frame);\n (st.equals) { }\n (st.invariant m2 `st.star` post_s x) `st.star` frame;\n (st.equals) { }\n (post_s x `st.star` st.invariant m2) `st.star` frame;\n (st.equals) { }\n post_s x `st.star` (st.invariant m2 `st.star` frame);\n };\n assert (st.interp (post_s x `st.star` (st.invariant m2 `st.star` frame)) m2);\n assert (st.interp (post x `st.star` (st.invariant m2 `st.star` frame)) m2);\n calc (st.equals) {\n post x `st.star` (st.invariant m2 `st.star` frame);\n (st.equals) { }\n (post x `st.star` st.invariant m2) `st.star` frame;\n (st.equals) { }\n (st.invariant m2 `st.star` post x) `st.star` frame;\n (st.equals) { apply_assoc (st.invariant m2) (post x) frame }\n st.invariant m2 `st.star` (post x `st.star` frame);\n };\n assert (st.interp (st.invariant m2 `st.star` (post x `st.star` frame)) m2)\n in\n ()", "val gen_elim_prop_elim\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Ghost (gen_elim_i & gen_elim_nondep_t)\n (requires gen_elim_prop enable_nondep_opt p a q post)\n (ensures (fun (i, j) ->\n p == compute_gen_elim_p i /\\\n check_gen_elim_nondep_sem i j /\\\n a == compute_gen_elim_nondep_a i j /\\\n q == compute_gen_elim_nondep_q i j /\\\n post == compute_gen_elim_nondep_post i j\n ))\nlet gen_elim_prop_elim enable_nondep_opt p a q post =\n FStar.IndefiniteDescription.indefinite_description_ghost _ (gen_elim_pred enable_nondep_opt p a q post)", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij" ], "closest_src": [ { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.bind_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.stt_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.frame_ghost" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.sub" }, { "project_name": "steel", "file_name": "Pulse.Lib.Pervasives.fst", "name": "Pulse.Lib.Pervasives.perform_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_neutral_ghost" }, { "project_name": "steel", "file_name": "Pulse.Lib.Fixpoints.fst", "name": "Pulse.Lib.Fixpoints.fix_stt_ghost_1" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.conv" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_ghost" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_stt_ghost_comp_post_equiv" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_ghostF" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_atomic" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.bind" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_recall" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.hide_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_witness" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.recall" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_sub_stt_ghost" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Pure.fst", "name": "Pulse.Elaborate.Pure.elab_stghost_equiv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fst", "name": "Pulse.Lib.InvList.with_invlist_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_dep" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_ghost_noeq" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpost" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim'" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic2" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim'" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_invs_stt_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.witness" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.vpattern_rewrite" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.exists_cong" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic1" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_read" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.frame_lpost" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.share" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.elim_forall" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.ghost_put" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.par_lpost" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness2" }, { "project_name": "steel", "file_name": "TwoLockQueue.fst", "name": "TwoLockQueue.ghost_gather" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.stt" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.Ghost.fst", "name": "Steel.ST.Effect.Ghost.admit_" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness_exists2" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.sub" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_pts_to" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.frame" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.elim_exists" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.ghost_join" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.inst_heap_prop_for_par" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.rewrite_value_vprops_prefix_and_suffix" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.elim_pure" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.intro_forall" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.with_pre" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fst", "name": "Pulse.Lib.InvList.lift_ghost_unobservable" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.stt_atomic" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.share" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.gather" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.repr" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.vpattern" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share_gen" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.ghost_join" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.ghost_join" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share2" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_stt_ghost_comp" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.lpost_ret_act" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_observability" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic0" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.equal" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Trade.fst", "name": "Pulse.Lib.Trade.elim_trade_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.Ghost.fst", "name": "Steel.ST.Effect.Ghost.lift_ghost_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_alloc" }, { "project_name": "steel", "file_name": "CSL.Semantics.fst", "name": "CSL.Semantics.preserves_frame_stronger_post" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_prop" } ], "selected_premises": [ "PulseCore.Preorder.history_val", "PulseCore.Action.inames", "PulseCore.Preorder.pcm_history", "Pulse.Lib.Core.hide_div", "Pulse.Lib.Core.iname", "PulseCore.FractionalPermission.full_perm", "FStar.Real.one", "PulseCore.Action.emp_inames", "Pulse.Lib.Core.op_exists_Star", "Pulse.Lib.Core.stt", "Pulse.Lib.Core.sub_invs_atomic", "Pulse.Lib.Core.vprop", "FStar.PCM.composable", "FStar.PCM.compatible", "FStar.FunctionalExtensionality.feq", "Pulse.Lib.Core.sub_stt", "Pulse.Lib.Core.emp", "FStar.Real.two", "Pulse.Lib.Core.vprop_equiv_sym", "Pulse.Lib.Core.vprop_equiv_ext", "Pulse.Lib.Core.op_Star_Star", "FStar.PCM.op", "Pulse.Lib.Core.conv_stt", "Pulse.Lib.Core.pure", "Pulse.Lib.Core.vprop_post_equiv", "Pulse.Lib.Core.vprop_equiv_trans", "PulseCore.FractionalPermission.sum_perm", "Pulse.Lib.Core.stt_atomic", "Pulse.Lib.Core.vprop_equiv_refl", "Pulse.Lib.Core.lift_observability", "Pulse.Lib.Core.bind_stt", "Pulse.Lib.Core.name_of_inv", "Pulse.Lib.Core.inv", "Pulse.Lib.Core.vprop_equiv", "Pulse.Lib.Core.stt_ghost", "Pulse.Lib.Core.join_emp", "Pulse.Lib.Core.elim_vprop_equiv", "PulseCore.FractionalPermission.comp_perm", "Pulse.Lib.Core.lift_atomic1", "Pulse.Lib.Core.new_invariant", "Pulse.Lib.Core.frame_stt", "Pulse.Lib.Core.frame_atomic", "Pulse.Lib.Core.par_stt", "Pulse.Lib.Core.intro_vprop_post_equiv", "Pulse.Lib.Core.vprop_equiv_comm", "Pulse.Lib.Core.vprop_equiv_assoc", "Pulse.Lib.Core.lift_atomic0", "Pulse.Lib.Core.vprop_equiv_unit", "Pulse.Lib.Core.lift_atomic2", "FStar.FunctionalExtensionality.on_dom", "Pulse.Lib.Core.with_invariant", "Pulse.Lib.Core.sub_atomic", "PulseCore.Preorder.p_op", "Pulse.Lib.Core.vprop_equiv_cong", "Pulse.Lib.Core.lift_ghost_neutral", "Pulse.Lib.Core.lift_neutral_ghost", "PulseCore.InstantiatedSemantics.slprop_post_equiv", "Pulse.Lib.Core.elim_vprop_post_equiv", "PulseCore.Preorder.induces_preorder", "Pulse.Lib.Core.bind_atomic", "FStar.Pervasives.reveal_opaque", "Pulse.Lib.Core.return_neutral", "PulseCore.Preorder.vhist", "FStar.Pervasives.Native.fst", "Pulse.Lib.Core.frame_ghost", "Pulse.Lib.Core.bind_ghost", "PulseCore.Preorder.comm_op", "FStar.Pervasives.Native.snd", "PulseCore.Preorder.history_compose", "Pulse.Lib.Core.return_stt_noeq", "PulseCore.FractionalPermission.writeable", "FStar.Real.zero", "PulseCore.Preorder.hval", "PulseCore.Action.mem_inv", "PulseCore.Preorder.extends", "PulseCore.Action.join_inames", "PulseCore.Preorder.history_composable", "Pulse.Lib.Core.return_neutral_noeq", "PulseCore.FractionalPermission.half_perm", "PulseCore.Preorder.extends'", "PulseCore.Preorder.curval", "PulseCore.Preorder.preorder_of_pcm", "Pulse.Lib.Core.add_already_there", "PulseCore.Preorder.p_composable", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.Action.inames_subset", "PulseCore.Preorder.property", "PulseCore.Action.property", "PulseCore.Preorder.unit_history", "PulseCore.Preorder.lift_fact", "FStar.FunctionalExtensionality.on", "PulseCore.Preorder.p", "PulseCore.Preorder.pcm_of_preorder", "FStar.Pervasives.dfst", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "PulseCore.Preorder.flip", "Pulse.Lib.Core.prop_squash_idem", "FStar.Pervasives.dsnd", "PulseCore.Preorder.fact_valid_compat", "PulseCore.Preorder.hperm" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule Pulse.Lib.Core\nmodule I = PulseCore.InstantiatedSemantics\nmodule A = PulseCore.Atomic\nmodule T = FStar.Tactics.V2\nmodule F = FStar.FunctionalExtensionality\nopen PulseCore.InstantiatedSemantics\nopen PulseCore.FractionalPermission\nopen PulseCore.Observability\n\nlet double_one_half () = ()\nlet equate_by_smt = ()\nlet vprop = slprop\nlet emp = emp\nlet op_Star_Star = op_Star_Star\nlet pure = pure\nlet op_exists_Star = op_exists_Star\nlet vprop_equiv = slprop_equiv\nlet elim_vprop_equiv #p #q pf = slprop_equiv_elim p q\nlet vprop_post_equiv = slprop_post_equiv\nlet prop_squash_idem (p:prop)\n : Tot (squash (squash p == p))\n = FStar.PropositionalExtensionality.apply p (squash p)\n\nlet intro_vprop_post_equiv\n (#t:Type u#a)\n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\n = let pf : squash (forall x. vprop_equiv (p x) (q x)) =\n introduce forall x. vprop_equiv (p x) (q x)\n with FStar.Squash.return_squash (pf x)\n in\n coerce_eq (prop_squash_idem _) pf\n\nlet elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop)\n (pf:vprop_post_equiv p q)\n (x:t)\n: vprop_equiv (p x) (q x)\n= let pf\n : squash (vprop_equiv (p x) (q x))\n = eliminate forall x. vprop_equiv (p x) (q x) with x\n in\n coerce_eq (prop_squash_idem _) pf\n\nlet vprop_equiv_refl (v0:vprop)\n : vprop_equiv v0 v0\n = slprop_equiv_refl v0\n\nlet vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p\n\nlet vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p\n\nlet vprop_equiv_unit (x:vprop)\n : vprop_equiv (emp ** x) x\n = slprop_equiv_unit x\n\nlet vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)\n = slprop_equiv_comm p1 p2\n\nlet vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv ((p1 ** p2) ** p3) (p1 ** (p2 ** p3))\n = slprop_equiv_assoc p1 p2 p3\n\nlet vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (f: vprop_equiv p1 p3)\n (g: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)\n = slprop_equiv_elim p1 p3;\n slprop_equiv_elim p2 p4;\n vprop_equiv_refl _\n\nlet vprop_equiv_ext p1 p2 _ = vprop_equiv_refl p1\n\n(* Invariants, just reexport *)\nmodule Act = PulseCore.Action\nlet iname = Act.iname\n\nlet join_sub _ _ = ()\nlet join_emp is =\n Set.lemma_equal_intro (join_inames is emp_inames) (reveal is);\n Set.lemma_equal_intro (join_inames emp_inames is) (reveal is)\n\nlet inv = Act.inv\nlet name_of_inv = Act.name_of_inv\n\nlet add_already_there i is = Set.lemma_equal_intro (add_inv is i) is\n\n////////////////////////////////////////////////////////////////////\n// stt a pre post: The main type of a pulse computation\n////////////////////////////////////////////////////////////////////\nlet stt = I.stt\nlet return_stt_noeq = I.return\nlet bind_stt = I.bind\nlet frame_stt = I.frame\nlet par_stt = I.par\nlet sub_stt = I.sub\nlet conv_stt pf1 pf2 = I.conv #_ _ _ _ _ pf1 pf2\nlet hide_div = I.hide_div\n\n////////////////////////////////////////////////////////////////////\n// Atomic computations\n////////////////////////////////////////////////////////////////////\nlet stt_atomic a #obs inames pre post = A.stt_atomic a #obs inames pre post\nlet lift_observability = A.lift_observability\nlet return_neutral = A.return_atomic\nlet return_neutral_noeq = A.return_atomic_noeq\nlet bind_atomic = A.bind_atomic\nlet frame_atomic = A.frame_atomic\nlet sub_atomic = A.sub_atomic\nlet sub_invs_atomic = A.sub_invs_stt_atomic\nlet lift_atomic0 = A.lift_atomic0\nlet lift_atomic1 = A.lift_atomic1\nlet lift_atomic2 = A.lift_atomic2\nlet new_invariant = A.new_invariant\nlet with_invariant = A.with_invariant\n\n////////////////////////////////////////////////////////////////////\n// Ghost computations\n////////////////////////////////////////////////////////////////////\nlet stt_ghost = A.stt_ghost\nlet bind_ghost = A.bind_ghost\nlet lift_ghost_neutral = A.lift_ghost_neutral\nlet lift_neutral_ghost = A.lift_neutral_ghost\nlet frame_ghost = A.frame_ghost", "sketch": [ "To implement `sub_ghost`, we need to use the provided proofs of equivalence to transform the preconditions and postconditions, and then return a ghost computation with the updated preconditions and postconditions.", "To implement sub_ghost, we need to use the provided proofs to show that the ghost computation with the first set of preconditions and postconditions can be transformed into a ghost computation with the second set of preconditions and postconditions.", "To implement the `sub_ghost` function, we first use the provided proofs to establish the equivalence of preconditions and postconditions. Then, we use the `lift_ghost_neutral` function to lift the ghost computation `e` from precondition `pre1` and postcondition `post1` to precondition `pre2` and postcondition `post2`.", "To implement the sub_ghost function, we will use the provided proofs of equivalence to transform the original ghost computation to have the updated preconditions and postconditions.", "To implement `sub_ghost`, we need to use the provided proofs to transform the pre-condition and post-condition of the input ghost computation `e` from `pre1` and `post1` to `pre2` and `post2` respectively. This involves using the provided proofs to establish equivalence between the pre-conditions and post-conditions, and then applying these equivalences to the input ghost computation.\n\n```fstar\nlet sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\n= lift_neutral_ghost (conv_stt _ _ _ _ _ pf1 pf2) e\n```" ], "generated_solution": [ "let sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\n= lift_neutral_ghost (conv_stt (vprop_equiv_refl pre1) pf1) (conv_stt (vprop_equiv_refl post1) pf2) e", "let sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\n= lift_neutral_ghost (conv_stt pf1 (fun x -> pf2 x) e)", "let sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\n= lift_ghost_neutral pf1 pf2 e", "let sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\n= lift_neutral_ghost (conv_stt pf1 (fun x -> pf2 x) e)" ] }, { "file_name": "Pulse.Typing.Env.fsti", "name": "Pulse.Typing.Env.env_extends", "opens_and_abbrevs": [ { "abbrev": "Pprint", "full_module": "FStar.Stubs.Pprint" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "RT", "full_module": "FStar.Reflection.Typing" }, { "abbrev": "L", "full_module": "FStar.List.Tot" }, { "open": "Pulse.Syntax" }, { "open": "FStar.List.Tot" }, { "open": "Pulse.Typing" }, { "open": "Pulse.Typing" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let env_extends (g1 g2:env) =\n exists g3. extends_with g1 g2 g3", "source_range": { "start_line": 158, "start_col": 0, "end_line": 159, "end_col": 34 }, "interleaved": false, "definition": "fun g1 g2 -> exists (g3: Pulse.Typing.Env.env). Pulse.Typing.Env.extends_with g1 g2 g3", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Typing.Env.env", "Prims.l_Exists", "Pulse.Typing.Env.extends_with", "Prims.logical" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "g1: Pulse.Typing.Env.env -> g2: Pulse.Typing.Env.env -> Prims.logical", "prompt": "let env_extends (g1 g2: env) =\n ", "expected_response": "exists g3. extends_with g1 g2 g3", "source": { "project_name": "steel", "file_name": "lib/steel/pulse/Pulse.Typing.Env.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Typing.Env.fsti", "checked_file": "dataset/Pulse.Typing.Env.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Pulse.Syntax.fst.checked", "dataset/Pulse.RuntimeUtils.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Tactics.Result.fsti.checked", "dataset/FStar.Stubs.Pprint.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Reflection.Typing.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Issue.fsti.checked" ] }, "definitions_in_context": [ "binding", "env_bindings", "val env : Type0", "val fstar_env (g:env) : RT.fstar_top_env", "val bindings (g:env) : env_bindings", "val bindings_with_ppname (g:env) : T.Tac (list (ppname & var & typ))", "val as_map (g:env) : Map.t var typ", "let is_related_to (bs:list (var & typ)) (m:Map.t var typ) =\n (forall (b:var & typ).{:pattern L.memP b bs}\n L.memP b bs ==> (Map.contains m (fst b) /\\\n Map.sel m (fst b) == snd b)) /\\\n \n (forall (x:var).{:pattern Map.contains m x} Map.contains m x ==> (L.memP (x, Map.sel m x) bs))", "val bindings_as_map (g:env)\n : Lemma (bindings g `is_related_to` as_map g)\n [SMTPat (bindings g); SMTPat (as_map g)]", "let dom (g:env) : Set.set var = Map.domain (as_map g)", "let equal (g1 g2:env) =\n fstar_env g1 == fstar_env g2 /\\\n bindings g1 == bindings g2", "val equal_elim (g1 g2:env)\n : Lemma (requires equal g1 g2)\n (ensures g1 == g2)\n [SMTPat (equal g1 g2)]", "val mk_env (f:RT.fstar_top_env) : g:env { fstar_env g == f }", "val mk_env_bs (f:RT.fstar_top_env)\n : Lemma (bindings (mk_env f) == [])\n [SMTPat (bindings (mk_env f))]", "val mk_env_dom (f:RT.fstar_top_env)\n : Lemma (dom (mk_env f) == Set.empty)\n [SMTPat (dom (mk_env f))]", "val push_binding (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : g':env { fstar_env g' == fstar_env g }", "let singleton_env (f:_) (x:var) (t:typ) = push_binding (mk_env f) x ppname_default t", "let push_binding_def (g:env) (x:var { ~ (Set.mem x (dom g)) }) (t:typ)\n = push_binding g x ppname_default t", "val push_binding_bs (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (bindings (push_binding g x n t) == (x, t) :: bindings g)\n [SMTPat (bindings (push_binding g x n t))]", "val push_binding_as_map (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (as_map (push_binding g x n t) == Map.upd (as_map g) x t)\n [SMTPat (as_map (push_binding g x n t))]", "let lookup (g:env) (x:var) : option typ =\n let m = as_map g in\n if Map.contains m x then Some (Map.sel m x) else None", "val fresh (g:env) : v:var { ~ (Set.mem v (dom g)) }", "let contains (g:env) (x:var) = Map.contains (as_map g) x", "let disjoint (g1 g2:env) =\n fstar_env g1 == fstar_env g2 /\\\n Set.disjoint (dom g1) (dom g2)", "let pairwise_disjoint (g g' g'':env) =\n disjoint g g' /\\ disjoint g' g'' /\\ disjoint g g''", "let disjoint_dom (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures dom g1 `Set.disjoint` dom g2) = ()", "val push_env (g1:env) (g2:env { disjoint g1 g2 }) : env", "val push_env_fstar_env (g1:env) (g2:env { disjoint g1 g2 })\n : Lemma (fstar_env (push_env g1 g2) == fstar_env g1)\n [SMTPat (fstar_env (push_env g1 g2))]", "val push_env_bindings (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures bindings (push_env g1 g2) == bindings g2 @ bindings g1)\n [SMTPat (bindings (push_env g1 g2))]", "val push_env_as_map (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures as_map (push_env g1 g2) == Map.concat (as_map g2) (as_map g1))\n [SMTPat (as_map (push_env g1 g2))]", "val push_env_assoc (g1 g2 g3:env)\n : Lemma (requires disjoint g1 g2 /\\ disjoint g2 g3 /\\ disjoint g3 g1)\n (ensures push_env g1 (push_env g2 g3) == push_env (push_env g1 g2) g3)", "val check_disjoint (g:env) (s:Set.set var) : b:bool { b ==> Set.disjoint s (dom g)}", "val remove_binding (g:env { Cons? (bindings g) })\n : Pure (var & typ & env)\n (requires True)\n (ensures fun r ->\n let (x, t, g') = r in\n fstar_env g' == fstar_env g /\\\n (~ (x `Set.mem` dom g')) /\\\n g == push_env (push_binding (mk_env (fstar_env g)) x ppname_default t) g')", "val remove_latest_binding (g:env { Cons? (bindings g) })\n : Pure (var & typ & env)\n (requires True)\n (ensures fun r ->\n let (x, t, g') = r in\n fstar_env g' == fstar_env g /\\\n (~ (x `Set.mem` dom g')) /\\\n g == push_binding g' x ppname_default t)", "let extends_with (g1 g2 g3:env) =\n disjoint g2 g3 /\\\n g1 == push_env g2 g3" ], "closest": [ "val OPLSS2021.STLC.equal = g1: OPLSS2021.STLC.env -> g2: OPLSS2021.STLC.env -> Prims.logical\nlet equal (g1:env) (g2:env) = forall (x:int). g1 x=g2 x", "val elim_env_extends (g1: env) (g2: env{g1 `env_extends` g2})\n : GTot (g3: env{extends_with g1 g2 g3})\nlet elim_env_extends (g1:env) (g2:env { g1 `env_extends` g2 })\n : GTot (g3:env { extends_with g1 g2 g3 }) =\n FStar.IndefiniteDescription.indefinite_description_ghost\n env (fun g3 -> extends_with g1 g2 g3)", "val OPLSS2021.STLC.equalE = e: OPLSS2021.STLC.exp -> g1: OPLSS2021.STLC.env -> g2: OPLSS2021.STLC.env -> Prims.logical\nlet equalE (e:exp) (g1:env) (g2:env) =\n forall (x:int). appears_free_in x e ==> g1 x=g2 x", "val elim_env_extends_tot (g1: env) (g2: env{g1 `env_extends` g2})\n : g3: G.erased env {extends_with g1 g2 (Ghost.reveal g3)}\nlet elim_env_extends_tot (g1:env) (g2:env { g1 `env_extends` g2 })\n : g3:G.erased env { extends_with g1 g2 (Ghost.reveal g3) }\n = G.hide (elim_env_extends g1 g2)", "val env_extends_trans (g1 g2 g3:env)\n : Lemma (requires g1 `env_extends` g2 /\\ g2 `env_extends` g3)\n (ensures g1 `env_extends` g3)\n [SMTPat (g1 `env_extends` g3); SMTPat (g1 `env_extends` g2)]\nlet env_extends_trans (g1 g2 g3:env)\n : Lemma (requires g1 `env_extends` g2 /\\ g2 `env_extends` g3)\n (ensures g1 `env_extends` g3) =\n let g12 = elim_env_extends g1 g2 in\n let g23 = elim_env_extends g2 g3 in\n L.append_assoc g12.bs g23.bs g3.bs;\n assert (equal g1 (push_env g3 (push_env g23 g12)));\n intro_env_extends g1 g3 (push_env g23 g12)", "val FStar.Reflection.Typing.fstar_env_fvs = g: FStar.Stubs.Reflection.Types.env -> Prims.logical\nlet fstar_env_fvs (g:R.env) =\n lookup_fvar g unit_fv == Some (tm_type u_zero) /\\\n lookup_fvar g bool_fv == Some (tm_type u_zero) /\\\n lookup_fvar g b2t_fv == Some b2t_ty", "val STLC.Core.extend_env_l = g: FStar.Stubs.Reflection.Types.env -> sg: STLC.Core.stlc_env -> FStar.Stubs.Reflection.Types.env\nlet extend_env_l (g:R.env) (sg:stlc_env) = \n L.fold_right (fun (x, t) g -> RT.extend_env g x (elab_ty t)) sg g", "val env_extends_refl (g:env)\n : Lemma (g `env_extends` g)\n [SMTPat (g `env_extends` g)]\nlet env_extends_refl (g:env) : Lemma (g `env_extends` g) =\n assert (equal g (push_env g (mk_env g.f)));\n intro_env_extends g g (mk_env g.f)", "val DependentBoolRefinement.extend_env_l = g: FStar.Stubs.Reflection.Types.env -> sg: DependentBoolRefinement.src_env\n -> FStar.Stubs.Reflection.Types.env\nlet extend_env_l (g:R.env) (sg:src_env) = \n L.fold_right \n (fun (x, b) g -> RT.extend_env g x (elab_binding b))\n sg\n g", "val Pulse.Typing.Env.related = \n bs: Prims.list (Pulse.Syntax.Base.var * Pulse.Syntax.Base.typ) ->\n m: FStar.Map.t Pulse.Syntax.Base.var Pulse.Syntax.Base.typ\n -> Prims.logical\nlet related (bs:list (var & typ)) (m:Map.t var typ) =\n (forall (b:var & typ).\n L.memP b bs ==> (Map.contains m (fst b) /\\\n Map.sel m (fst b) == snd b)) /\\\n \n (forall (x:var). Map.contains m x ==> (List.Tot.memP (x, Map.sel m x) bs))", "val PulseCore.Preorder.extends' = h0: PulseCore.Preorder.hist q -> h1: PulseCore.Preorder.hist q -> Prims.logical\nlet rec extends' (#a: Type u#a) (#q:preorder a) (h0 h1:hist q) =\n h0 == h1 \\/ (Cons? h0 /\\ extends' (Cons?.tl h0) h1)", "val BoolRefinement.extend_env_l = g: FStar.Stubs.Reflection.Types.env -> sg: BoolRefinement.src_env\n -> FStar.Stubs.Reflection.Types.env\nlet extend_env_l (g:R.env) (sg:src_env) = \n L.fold_right \n (fun (x, b) g -> RT.extend_env g x (elab_binding b))\n sg\n g", "val extends_with_push (g1 g2 g3:env)\n (x:var { ~ (Set.mem x (dom g1)) }) (n:ppname) (t:typ)\n : Lemma (requires extends_with g1 g2 g3)\n (ensures extends_with (push_binding g1 x n t) g2 (push_binding g3 x n t))\n [SMTPat (extends_with g1 g2 g3);\n SMTPat (push_binding g1 x n t);\n SMTPat (push_binding g3 x n t)]\nlet extends_with_push (g1 g2 g3:env)\n (x:var { ~ (Set.mem x (dom g1)) }) n (t:typ)\n : Lemma (requires extends_with g1 g2 g3)\n (ensures extends_with (push_binding g1 x n t) g2 (push_binding g3 x n t)) =\n assert (equal (push_binding g1 x n t)\n (push_env g2 (push_binding g3 x n t)))", "val PulseCore.Heap.equiv = p1: PulseCore.Heap.slprop -> p2: PulseCore.Heap.slprop -> Prims.logical\nlet equiv (p1 p2:slprop) =\n forall m. interp p1 m <==> interp p2 m", "val push_env (g1:env) (g2:env { disjoint g1 g2 }) : env\nlet push_env (g1:env) (g2:env { disjoint g1 g2 }) : env =\n { f = g1.f; bs = g2.bs @ g1.bs; names= g2.names @ g1.names;\n m = Map.concat g2.m g1.m; ctxt = g1.ctxt }", "val Imp.equiv = p1: Imp.prog -> p2: Imp.prog -> Prims.logical\nlet equiv p1 p2 = eval p1 == eval p2", "val typing_extensional (g g': env) (e: exp)\n : Lemma (requires equal g g') (ensures typing g e == typing g' e)\nlet typing_extensional (g g':env) (e:exp)\n : Lemma\n (requires equal g g')\n (ensures typing g e == typing g' e)\n = context_invariance e g g'", "val extend_evar: g:env -> n:nat -> t:typ -> Tot env\nlet extend_evar g n t =\n let a_env = fun (a:nat) -> lookup_tvar g a in\n let x_env = fun (x:nat) -> if x < n then lookup_evar g x\n else if x = n then Some t\n else lookup_evar g (x - 1) in\n MkEnv a_env x_env", "val typing_extensional : #e:exp -> #g:env -> #t:ty ->\n h:(rtyping g e t) -> g':env{equal g g'} ->\n Tot (rtyping g' e t)\nlet typing_extensional #e #g #t h g' = context_invariance h g'", "val kinding_extensional: #g:env -> #t:typ -> #k:knd -> h:(kinding g t k) ->\n g':env{feq (MkEnv?.a g) (MkEnv?.a g')} ->\n Tot (kinding g' t k) (decreases h)\nlet rec kinding_extensional #g #t #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (kinding_extensional h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (kinding_extensional h1 g') (kinding_extensional h2 g')\n | KiArr h1 h2 -> KiArr (kinding_extensional h1 g') (kinding_extensional h2 g')", "val Binding.eq_typ = env: Binding.env -> t1: Ast.typ -> t2: Ast.typ -> FStar.All.ALL Prims.bool\nlet eq_typ env t1 t2 =\r\n if Ast.eq_typ t1 t2 then true\r\n else Ast.eq_typ (unfold_typ_abbrev_and_enum env t1) (unfold_typ_abbrev_and_enum env t2)", "val push_env_assoc (g1 g2 g3:env)\n : Lemma (requires disjoint g1 g2 /\\ disjoint g2 g3 /\\ disjoint g3 g1)\n (ensures push_env g1 (push_env g2 g3) == push_env (push_env g1 g2) g3)\nlet push_env_assoc g1 g2 g3 =\n L.append_assoc g3.bs g2.bs g1.bs;\n assert (equal (push_env g1 (push_env g2 g3)) (push_env (push_env g1 g2) g3))", "val Steel.Preorder.extends' = h0: Steel.Preorder.hist q -> h1: Steel.Preorder.hist q -> Prims.logical\nlet rec extends' (#a: Type u#a) (#q:preorder a) (h0 h1:hist q) =\n h0 == h1 \\/ (Cons? h0 /\\ extends' (Cons?.tl h0) h1)", "val extend_tvar: g:env -> n:nat -> k:knd -> Tot env\nlet extend_tvar g n k =\n let a_env = fun (a:nat) -> if a < n then lookup_tvar g a\n else if a = n then Some k\n else lookup_tvar g (a - 1) in\n let x_env = fun (x:nat) -> match lookup_evar g x with\n | None -> None\n | Some t -> Some (tshift_up_above n t)\n in\n MkEnv a_env x_env", "val PulseCore.Heap.sl_implies = p: PulseCore.Heap.slprop -> q: PulseCore.Heap.slprop -> Prims.logical\nlet sl_implies (p q:slprop) = forall m. interp p m ==> interp q m", "val PropositionalExtensionalityInconsistent.propExt_Type = Prims.logical\nlet propExt_Type = forall (p1 p2:Type0). (p1 <==> p2) <==> p1==p2", "val PulseCore.Heap.stronger = p: PulseCore.Heap.slprop -> q: PulseCore.Heap.slprop -> Prims.logical\nlet stronger (p q:slprop) =\n forall h. interp p h ==> interp q h", "val BoolRefinement.extend_env_alt = g: FStar.Stubs.Reflection.Types.env -> sg: BoolRefinement.src_env\n -> FStar.Stubs.Reflection.Types.env\nlet extend_env_alt (g:R.env) (sg:src_env) = \n RT.extend_env_l g (as_bindings sg)", "val Steel.Heap.equiv = p1: Steel.Heap.slprop -> p2: Steel.Heap.slprop -> Prims.logical\nlet equiv (p1 p2:slprop) =\n forall m. interp p1 m <==> interp p2 m", "val env_extends_push (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (push_binding g x n t `env_extends` g)\n [SMTPat ((push_binding g x n t) `env_extends` g)]\nlet env_extends_push (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (push_binding g x n t `env_extends` g) =\n assert (equal (push_binding g x n t) (push_env g (push_binding (mk_env g.f) x n t)));\n intro_env_extends (push_binding g x n t) g (push_binding (mk_env g.f) x n t)", "val mk_env (f:RT.fstar_top_env) : g:env { fstar_env g == f }\nlet mk_env (f:RT.fstar_top_env) : env =\n { f; bs = []; names=[]; m = empty_bmap; ctxt = default_context }", "val PulseCore.Heap.mem_equiv = m0: PulseCore.Heap.heap -> m1: PulseCore.Heap.heap -> Prims.logical\nlet mem_equiv (m0 m1:heap) =\n forall a. m0 a == m1 a", "val DependentBoolRefinement.ok = sg: DependentBoolRefinement.src_env -> e: DependentBoolRefinement.src_exp -> Prims.logical\nlet ok (sg:src_env) (e:src_exp) = (forall x. x `Set.mem` freevars e ==> Some? (lookup sg x))", "val extend_gen_typing_conversion\n (#t: typ)\n (#g: env)\n (#e0: exp)\n (#t0: typ)\n (h: typing (extend t g) e0 t0)\n : Tot (typing (extend_gen 0 t g) e0 t0)\nlet rec extend_gen_typing_conversion (#t:typ) (#g:env) (#e0:exp) (#t0:typ) (h:typing (extend t g) e0 t0)\n :Tot (typing (extend_gen 0 t g) e0 t0) = h", "val equal_elim (g1 g2:env)\n : Lemma (requires equal g1 g2)\n (ensures g1 == g2)\n [SMTPat (equal g1 g2)]\nlet equal_elim g1 g2 =\n equal_names g1.names g2.names;\n assert (Map.equal g1.m g2.m)", "val fstar_env (g:env) : RT.fstar_top_env\nlet fstar_env g = RU.env_set_context g.f g.ctxt", "val Prims.subtype_of = p1: Type -> p2: Type -> Prims.logical\nlet subtype_of (p1 p2: Type) = forall (x: p1). has_type x p2", "val Sec2.HIFC.respects = f: Sec2.HIFC.hst a p q -> fs: Sec2.HIFC.flows -> Prims.logical\nlet respects #a #p #q (f:hst a p q) (fs:flows) =\n (forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to)", "val DependentBoolRefinement.ok_ty = sg: DependentBoolRefinement.src_env -> e: DependentBoolRefinement.src_ty -> Prims.logical\nlet ok_ty (sg:src_env) (e:src_ty) = (forall x. x `Set.mem` freevars_ty e ==> Some? (lookup sg x))", "val Zeta.AppSimulate.Helper.app_state_feq = st1: Zeta.AppSimulate.app_state adm -> st2: Zeta.AppSimulate.app_state adm -> Prims.logical\nlet app_state_feq #adm (st1 st2: app_state adm)\n = forall (k: app_key adm). {:pattern (st1 k = st2 k)} st1 k = st2 k", "val Pulse.Reflection.Util.tot_lid = Prims.list Prims.string\nlet tot_lid = [\"Prims\"; \"Tot\"]", "val Pulse.C.Typestring.norm_typestring = Prims.list FStar.Pervasives.norm_step\nlet norm_typestring =\n [\n delta_only [\n `%char_t_of_char;\n `%string_t_of_chars;\n `%mk_string_t;\n ];\n iota; zeta; primops;\n ]", "val Zeta.Intermediate.Thread.sp_is_mp = tl: Zeta.Intermediate.Thread.verifiable_log vcfg -> Prims.GTot Prims.logical\nlet sp_is_mp (#vcfg:_) (tl: verifiable_log vcfg)\n = let st = store tl in\n slot_points_to_is_merkle_points_to st", "val Vale.Math.Poly2.all_defs = Prims.logical\nlet all_defs =\n poly == D.poly /\\\n (forall (p:poly).{:pattern (degree p)} degree p == D.degree (to_poly p)) /\\\n zero == of_poly D.zero /\\\n one == of_poly D.one /\\\n (forall (n:nat).{:pattern (monomial n)} monomial n == of_poly (D.monomial n)) /\\\n (forall (p:poly) (n:int).{:pattern (shift p n)} shift p n == of_poly (D.shift (to_poly p) n)) /\\\n (forall (p:poly) (n:nat).{:pattern (reverse p n)} reverse p n == of_poly (D.reverse (to_poly p) n)) /\\\n (forall (p:poly) (n:int).{:pattern (poly_index p n)} poly_index p n == D.poly_index (to_poly p) n) /\\\n (forall (a b:poly).{:pattern (add a b)} add a b == of_poly (D.add (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (mul a b)} mul a b == of_poly (D.mul (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (div a b)} degree b >= 0 ==> div a b == of_poly (D.div (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (mod a b)} degree b >= 0 ==> mod a b == of_poly (D.mod (to_poly a) (to_poly b)))", "val IfcExample.env = var: Prims.nat -> Prims.GTot IfcRules.label\nlet env (var: nat) = \n if var = addr_of x then Low\n else if var = addr_of y then Low \n else if var = addr_of c then Low\n else if var = addr_of z then High\n else High", "val Pulse.C.Typenat.norm_typenat = Prims.list FStar.Pervasives.norm_step\nlet norm_typenat =\n [\n delta_only [\n `%nat_t_of_nat;\n ];\n iota; zeta; primops;\n ]", "val extend_gen : var -> typ -> env -> Tot env\nlet extend_gen x t g = if x = 0 then extend t g\n else (fun y -> if y < x then g y\n else if y = x then Some t\n else g (y-1))", "val Sec2.HIFC.modifies = w: Sec2.HIFC.label -> s0: Sec2.HIFC.store -> s1: Sec2.HIFC.store -> Prims.logical\nlet modifies (w:label) (s0 s1:store) = (forall l.{:pattern (sel s1 l)} ~(Set.mem l w) ==> sel s0 l == sel s1 l)", "val TranslateForInterpreter.check_in_global_env = env: TranslateForInterpreter.global_env -> i: Ast.ident -> FStar.All.ALL Prims.unit\nlet check_in_global_env (env:global_env) (i:A.ident) =\r\n let _ = B.lookup_expr_name (B.mk_env env.benv) i in ()", "val inversion_elam_typing : #g:env -> s1:typ -> e:exp ->\n t1:typ -> t2:typ -> typing g (ELam s1 e) (TArr t1 t2) ->\n Tot (cand (cand (tequiv t1 s1) (typing (extend_evar g 0 s1) e t2))\n (kinding g s1 KTyp))\nlet inversion_elam_typing #g s1 e t1 t2 h =\n inversion_elam s1 e t1 t2 h (EqRefl (TArr t1 t2))\n (Conj?.h2 (kinding_inversion_arrow (typing_to_kinding h)))", "val as_map (g:env) : Map.t var typ\nlet as_map g = g.m", "val Vale.Transformers.Transform.equiv_states = s1: Vale.X64.Decls.va_state -> s2: Vale.X64.Decls.va_state -> Prims.logical\nlet equiv_states (s1 s2:va_state) = equiv_states s1 s2", "val Vale.X64.StateLemmas.machine_state_eq = s1: Vale.X64.StateLemmas.machine_state -> s2: Vale.X64.StateLemmas.machine_state -> Prims.logical\nlet machine_state_eq (s1 s2:machine_state) =\n s1 == s2", "val PropositionalExtensionalityInconsistent.propExt_sub_singleton = Prims.logical\nlet propExt_sub_singleton = forall (p1 p2:sub_singleton). (p1 <==> p2) <==> p1==p2", "val get_env (e: genv) : env\nlet get_env (e:genv) : env = e.env", "val Zeta.EAC.eac = l: Zeta.EAC.vlog_ext app -> Prims.logical\nlet eac #app (l:vlog_ext app) =\n forall (k: base_key). {:pattern Zeta.SeqMachine.valid (eac_smk app k) l} Zeta.SeqMachine.valid (eac_smk app k) l", "val push_context (g:env) (ctx:string) (r:range) : g':env { g' == g }\nlet push_context g ctx r = { g with ctxt = Pulse.RuntimeUtils.extend_context ctx (Some r) g.ctxt }", "val Vale.X64.StateLemmas.machine_state_equal = s1: Vale.X64.StateLemmas.machine_state -> s2: Vale.X64.StateLemmas.machine_state -> Prims.logical\nlet machine_state_equal (s1 s2:machine_state) =\n let open Vale.X64.Machine_Semantics_s in\n s1.ms_ok == s2.ms_ok /\\\n F.feq s1.ms_regs s2.ms_regs /\\\n F.feq s1.ms_flags s2.ms_flags /\\\n s1.ms_heap == s2.ms_heap /\\\n s1.ms_stack == s2.ms_stack /\\\n s1.ms_stackTaint == s2.ms_stackTaint /\\\n s1.ms_trace == s2.ms_trace /\\\n True", "val RunST.sublist = l1: Prims.list RunST.eff_label -> l2: Prims.list RunST.eff_label -> Prims.logical\nlet sublist (l1 l2 : list eff_label) =\n forall x. memP x l1 ==> memP x l2", "val Zeta.SMap.monotonic_prop = f: Zeta.SMap.smap s1 s2 -> Prims.logical\nlet monotonic_prop (#a:_) (#s1 #s2:seq a) (f: smap s1 s2)\n = forall (i j: seq_index s1). i < j ==> f i < f j", "val Prims.pure_stronger = a: Type -> wp1: Prims.pure_wp a -> wp2: Prims.pure_wp a -> Prims.logical\nlet pure_stronger (a: Type) (wp1 wp2: pure_wp a) = forall (p: pure_post a). wp1 p ==> wp2 p", "val extend_env_equiv (g: R.env) (sg: src_env)\n : Lemma (ensures extend_env_l g sg == extend_env_alt g sg) (decreases sg)\nlet rec extend_env_equiv (g:R.env) (sg:src_env)\n : Lemma \n (ensures extend_env_l g sg == extend_env_alt g sg)\n (decreases sg)\n = match sg with\n | [] -> ()\n | hd::tl -> extend_env_equiv g tl", "val initial_env: Prims.unit -> ML env\nlet initial_env () : ML env = {\r\n binding_env = Binding.initial_global_env ();\r\n typesizes_env = TypeSizes.initial_senv ();\r\n translate_env = \r\n (TranslateForInterpreter.initial_translate_env(), InterpreterTarget.create_env());\r\n}", "val ConstructiveLogic.ex2 = p: Prims.prop -> q: Prims.prop -> Prims.unit\nlet ex2 (p q : prop) =\n assert (p ==> q ==> p)\n by (let bp = implies_intro () in\n let _ = implies_intro () in\n hyp (binding_to_namedv bp);\n qed ())", "val typing_extensional : #e:exp -> #g:env -> #t:typ ->\n h:(typing g e t) -> g':env{feq g g'} -> Tot (typing g' e t) (decreases h)\nlet rec typing_extensional #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyLam t h -> TyLam t (typing_extensional h (extend t g'))\n | TyApp h1 h2 -> TyApp (typing_extensional h1 g') (typing_extensional h2 g')\n | TyUnit -> TyUnit", "val Sec2.HIFC.writes = f: Sec2.HIFC.hst a p q -> writes: Sec2.HIFC.label -> Prims.logical\nlet writes #a #p #q (f:hst a p q) (writes:label) =\n forall (s0:store{p s0}). let x1, s0' = f s0 in modifies writes s0 s0'", "val Steel.Heap.sl_implies = p: Steel.Heap.slprop -> q: Steel.Heap.slprop -> Prims.logical\nlet sl_implies (p q:slprop) = forall m. interp p m ==> interp q m", "val Locals.Effect.wpt_monotonic = wp: Locals.Effect.wp_t0 a -> Prims.logical\nlet wpt_monotonic (#a:Type) (wp:wp_t0 a) =\n forall (p q:post_t a).\n (forall x m. p x m ==> q x m) ==>\n (forall m. wp p m ==> wp q m)", "val GMST.gmst_stronger = s: Type -> a: Type -> wp1: GMST.gmst_wp s a -> wp2: GMST.gmst_wp s a -> Prims.logical\nlet gmst_stronger (s:Type) (a:Type) (wp1:gmst_wp s a) (wp2:gmst_wp s a) =\n forall s0 p. wp1 s0 p ==> wp2 s0 p", "val Zeta.Steel.AppSim.valid_runapp_param = tsm: Zeta.Steel.Rel.s_thread_state -> se: Zeta.Steel.Rel.s_log_entry -> Prims.logical\nlet valid_runapp_param (tsm: s_thread_state) (se: s_log_entry)\n = let open T in\n RunApp? se /\\\n (let RunApp p = se in\n let tsm_ = runapp tsm p in\n not tsm_.failed)", "val Binding.eq_typs = env: Binding.env -> ts: Prims.list (Ast.typ * Ast.typ) -> FStar.All.ML Prims.bool\nlet eq_typs env ts =\r\n List.for_all (fun (t1, t2) -> eq_typ env t1 t2) ts", "val Pulse.Reflection.Util.int_lid = Prims.list Prims.string\nlet int_lid = R.int_lid", "val context_invariance (e: exp) (g g': env)\n : Lemma (requires equalE e g g') (ensures typing g e == typing g' e)\nlet rec context_invariance (e:exp) (g g':env)\n : Lemma\n (requires equalE e g g')\n (ensures typing g e == typing g' e)\n = match e with\n | EAbs x t e1 ->\n context_invariance e1 (extend g x t) (extend g' x t)\n\n | EApp e1 e2 ->\n context_invariance e1 g g';\n context_invariance e2 g g'\n \n | _ -> ()", "val range_of_env (g:env) : T.Tac range\nlet range_of_env (g:env) = \n let ctx = T.unseal g.ctxt in\n match \n T.tryPick\n (fun (_, r) ->\n match r with\n | None -> None\n | Some r -> \n if not (RU.is_range_zero r) then Some r else None) ctx with\n | Some r -> r\n | _ -> FStar.Range.range_0", "val extend_env_l (g: env) (bs: bindings) : env\nlet rec extend_env_l (g:env) (bs:bindings)\n : env\n = match bs with\n | [] -> g\n | (x,t)::bs -> extend_env (extend_env_l g bs) x t", "val Sec2.HIFC.related_runs = f: Sec2.HIFC.hst a p q -> s0: Sec2.HIFC.store{p s0} -> s0': Sec2.HIFC.store{p s0'} -> Prims.logical\nlet related_runs #a #p #q (f:hst a p q) (s0:store{p s0}) (s0':store{p s0'}) =\n (let x1, s1 = f s0 in\n let x1', s1' = f s0' in\n x1 == x1' /\\\n (forall (l:loc). (sel s1 l == sel s1' l \\/ (sel s1 l == sel s0 l /\\ sel s1' l == sel s0' l))))", "val Util.Trigger.trigger = v: ty -> Prims.logical\nlet trigger (#ty: Type) (v: ty) = True", "val GenericTotalDM4A.equiv = w1: GenericTotalDM4A.w a -> w2: GenericTotalDM4A.w a -> Prims.logical\nlet equiv #a (w1 w2 : w a) = w1 `stronger` w2 /\\ w2 `stronger` w1", "val Steel.Heap.stronger = p: Steel.Heap.slprop -> q: Steel.Heap.slprop -> Prims.logical\nlet stronger (p q:slprop) =\n forall h. interp p h ==> interp q h", "val Steel.Effect.Common.can_be_split_dep = p: Prims.prop -> t1: Steel.Effect.Common.pre_t -> t2: Steel.Effect.Common.pre_t -> Prims.logical\nlet can_be_split_dep (p:prop) (t1 t2:pre_t) = p ==> can_be_split t1 t2", "val extend_env_alt_append (g: R.env) (sg0 sg1: src_env)\n : Lemma (ensures extend_env_alt g (sg0 @ sg1) == extend_env_alt (extend_env_alt g sg1) sg0)\n (decreases sg0)\nlet rec extend_env_alt_append (g:R.env) (sg0 sg1:src_env)\n : Lemma \n (ensures \n extend_env_alt g (sg0 @ sg1) == \n extend_env_alt (extend_env_alt g sg1) sg0)\n (decreases sg0)\n = match sg0 with\n | [] -> ()\n | hd::tl -> extend_env_alt_append g tl sg1", "val AlgWP.equiv = w1: AlgWP.st_wp a -> w2: AlgWP.st_wp a -> Prims.logical\nlet equiv #a (w1 w2 : st_wp a) = w1 `stronger` w2 /\\ w2 `stronger` w1", "val TranslateForInterpreter.env_t = Type0\nlet env_t = list (A.ident * T.typ)", "val Pulse.Reflection.Util.vprop_lid = Prims.list Prims.string\nlet vprop_lid = mk_pulse_lib_core_lid \"vprop\"", "val extend (g: env) (x: int) (t: ty) : env\nlet extend (g:env) (x:int) (t:ty) \n : env \n = fun x' -> if x = x' then Some t else g x'", "val b2t_typing (g: fstar_env) (t: R.term) (dt: RT.tot_typing g t RT.bool_ty)\n : RT.tot_typing g (r_b2t t) (RT.tm_type RT.u_zero)\nlet b2t_typing (g:fstar_env) (t:R.term) (dt:RT.tot_typing g t RT.bool_ty)\n : RT.tot_typing g (r_b2t t) (RT.tm_type RT.u_zero)\n = let b2t_typing : RT.tot_typing g _ b2t_ty = RT.T_FVar g b2t_fv in\n let app_ty : _ = RT.T_App _ _ _ _ (RT.tm_type RT.u_zero) _ b2t_typing dt in\n RT.open_with_spec (RT.tm_type RT.u_zero) t;\n app_ty", "val eval: g:Type -> a:Type -> tm g a -> g -> Tot a\nlet rec eval (g:Type) (a:Type) t env = match t with\n | Var _ _ v -> eval_var g a v env\n | Lam 'gg 'arg 'res body ->\n (fun (x:'arg) -> eval (g * 'arg) 'res body (env,x))\n | App 'gg 'arg 'res e1 e2 ->\n (eval g ('arg -> Tot 'res) e1 env <: 'arg -> Tot 'res (* still need this silly annotation; TODO, fix *))\n (eval g 'arg e2 env)", "val GMST.gmst_return = s: Type -> a: Type -> x: a -> s0: s -> p: GMST.gmst_post s a s0 -> Prims.logical\nlet gmst_return (s:Type) (a:Type) (x:a) (s0:s) (p:gmst_post s a s0) \n = forall v. v == x ==> p (fun s0 s1 -> s0 == s1) v s0", "val bindings (g:env) : env_bindings\nlet bindings g = g.bs", "val extend_gen_0 : t:typ -> g:env ->\n Lemma (feq (extend_gen 0 t g) (extend t g))\nlet extend_gen_0 t g =\n forall_intro (extend_gen_0_aux t g)", "val Zeta.Steel.AddMRel.addm_precond1 = a: Zeta.Steel.AddMRel.addm_param -> Prims.GTot Prims.logical\nlet addm_precond1 (a: addm_param) =\n let st' = addm_store_pre a in\n let s = addm_slot a in\n let s' = addm_anc_slot a in\n addm_precond0 a /\\\n s <> s' /\\\n inuse_slot st' s' /\\\n empty_slot st' s /\\\n (let k' = stored_base_key st' s' in\n let gk = addm_key a in\n is_proper_descendent (to_base_key gk) k')", "val Swap.equiv = c_0: Swap.command -> c_1: Swap.command -> Prims.logical\nlet equiv (c_0:command) (c_1:command) = forall h. equiv_on_h c_0 c_1 h", "val Pulse.Lib.Reference.cond = b: Prims.bool -> p: Pulse.Lib.Core.vprop -> q: Pulse.Lib.Core.vprop -> Pulse.Lib.Core.vprop\nlet cond b (p q:vprop) = if b then p else q", "val Vale.Math.Bits.lemmas_i2b_all = Prims.logical\nlet lemmas_i2b_all =\n (forall (#n:pos) (m:pos) (a:uint_t n) (mn:pos).{:pattern (b_i2b #mn (uext #n #m a))} mn == m + n ==> b_i2b #mn (uext #n #m a) == b_uext #n #m (b_i2b #n a)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logand a b))} b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logor a b))} b_i2b #n (logor #n a b) == b_or #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logxor a b))} b_i2b #n (logxor #n a b) == b_xor #n (b_i2b a) (b_i2b b)) /\\\n // TODO: shl and shr should take a nat (see comment above)\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (shift_left a b))} b_i2b #n (shift_left #n a b) == b_shl #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (shift_right a b))} b_i2b #n (shift_right #n a b) == b_shr #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (add_hide a b))} b_i2b #n (add_hide #n a b) == b_add #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (sub_hide a b))} b_i2b #n (sub_hide #n a b) == b_sub #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (mul_hide a b))} b_i2b #n (mul_hide #n a b) == b_mul #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (add_mod a b))} b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (sub_mod a b))} b_i2b #n (sub_mod #n a b) == b_sub #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (mul_mod a b))} b_i2b #n (mul_mod #n a b) == b_mul #n (b_i2b a) b) /\\\n (forall (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}).{:pattern (b_i2b #n (udiv a b))} b_i2b #n (udiv #n a b) == b_div #n (b_i2b a) b) /\\\n (forall (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}).{:pattern (b_i2b #n (mod a b))} b_i2b #n (mod #n a b) == b_mod #n (b_i2b a) b) /\\\n True", "val Zeta.SIdxFn.index_prefix_prop = gs: Zeta.SIdxFn.gen_sseq_base -> Prims.logical\nlet index_prefix_prop (gs:gen_sseq_base)\n = forall (s:seq_t gs.gso) (j:nat{j <= Seq.length s}) (i: nat{i < j}).\n {:pattern gs.index (SA.prefix s j) i}\n (gs.gso.phi_commutes_with_prefix s j;\n gs.index (SA.prefix s j) i = gs.index s i)", "val cur_env: Prims.unit -> Tac env\nlet cur_env () : Tac env = goal_env (_cur_goal ())", "val cur_env: Prims.unit -> Tac env\nlet cur_env () : Tac env = goal_env (_cur_goal ())", "val Zeta.SeqAux.ext_pred = f1: (_: a -> Prims.bool) -> f2: (_: a -> Prims.bool) -> Prims.logical\nlet ext_pred (#a:Type) (f1 f2:a -> bool) =\n forall x. f1 x = f2 x", "val par_env: Type0\nlet par_env = (q: HR.ref task_queue & c: ref int & Lock.lock (inv_task_queue q c))", "val GMST.state = Prims.eqtype\nlet state = int" ], "closest_src": [ { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.equal" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.elim_env_extends" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.equalE" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.elim_env_extends_tot" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.env_extends_trans" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.fstar_env_fvs" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.extend_env_l" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.env_extends_refl" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.extend_env_l" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.related" }, { "project_name": "steel", "file_name": "PulseCore.Preorder.fst", "name": "PulseCore.Preorder.extends'" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.extend_env_l" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.extends_with_push" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.equiv" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.push_env" }, { "project_name": "FStar", "file_name": "Imp.fst", "name": "Imp.equiv" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.typing_extensional" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.extend_evar" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.typing_extensional" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.kinding_extensional" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.eq_typ" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.push_env_assoc" }, { "project_name": "steel", "file_name": "Steel.Preorder.fst", "name": "Steel.Preorder.extends'" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.extend_tvar" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.sl_implies" }, { "project_name": "FStar", "file_name": "PropositionalExtensionalityInconsistent.fst", "name": "PropositionalExtensionalityInconsistent.propExt_Type" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.stronger" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.extend_env_alt" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.equiv" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.env_extends_push" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.mk_env" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.mem_equiv" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.ok" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen_typing_conversion" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.equal_elim" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.fstar_env" }, { "project_name": "FStar", "file_name": "prims.fst", "name": "Prims.subtype_of" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.respects" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.ok_ty" }, { "project_name": "zeta", "file_name": "Zeta.AppSimulate.Helper.fsti", "name": "Zeta.AppSimulate.Helper.app_state_feq" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.tot_lid" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fsti", "name": "Pulse.C.Typestring.norm_typestring" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Thread.fst", "name": "Zeta.Intermediate.Thread.sp_is_mp" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.all_defs" }, { "project_name": "FStar", "file_name": "IfcExample.fst", "name": "IfcExample.env" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fsti", "name": "Pulse.C.Typenat.norm_typenat" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.modifies" }, { "project_name": "everparse", "file_name": "TranslateForInterpreter.fst", "name": "TranslateForInterpreter.check_in_global_env" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.inversion_elam_typing" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.as_map" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.Transform.fsti", "name": "Vale.Transformers.Transform.equiv_states" }, { "project_name": "hacl-star", "file_name": "Vale.X64.StateLemmas.fsti", "name": "Vale.X64.StateLemmas.machine_state_eq" }, { "project_name": "FStar", "file_name": "PropositionalExtensionalityInconsistent.fst", "name": "PropositionalExtensionalityInconsistent.propExt_sub_singleton" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Base.fst", "name": "FStar.InteractiveHelpers.Base.get_env" }, { "project_name": "zeta", "file_name": "Zeta.EAC.fsti", "name": "Zeta.EAC.eac" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.push_context" }, { "project_name": "hacl-star", "file_name": "Vale.X64.StateLemmas.fsti", "name": "Vale.X64.StateLemmas.machine_state_equal" }, { "project_name": "FStar", "file_name": "RunST.fst", "name": "RunST.sublist" }, { "project_name": "zeta", "file_name": "Zeta.SMap.fsti", "name": "Zeta.SMap.monotonic_prop" }, { "project_name": "FStar", "file_name": "prims.fst", "name": "Prims.pure_stronger" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.extend_env_equiv" }, { "project_name": "everparse", "file_name": "Main.fst", "name": "Main.initial_env" }, { "project_name": "FStar", "file_name": "ConstructiveLogic.fst", "name": "ConstructiveLogic.ex2" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.typing_extensional" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.writes" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.sl_implies" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.wpt_monotonic" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_stronger" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AppSim.fsti", "name": "Zeta.Steel.AppSim.valid_runapp_param" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.eq_typs" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.int_lid" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.context_invariance" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.range_of_env" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.extend_env_l" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.related_runs" }, { "project_name": "Armada", "file_name": "Util.Trigger.fst", "name": "Util.Trigger.trigger" }, { "project_name": "FStar", "file_name": "GenericTotalDM4A.fst", "name": "GenericTotalDM4A.equiv" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.stronger" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.can_be_split_dep" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.extend_env_alt_append" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.equiv" }, { "project_name": "everparse", "file_name": "TranslateForInterpreter.fst", "name": "TranslateForInterpreter.env_t" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.vprop_lid" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.extend" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.b2t_typing" }, { "project_name": "FStar", "file_name": "Eval.DB.fst", "name": "Eval.DB.eval" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_return" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.bindings" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen_0" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AddMRel.fsti", "name": "Zeta.Steel.AddMRel.addm_precond1" }, { "project_name": "FStar", "file_name": "Swap.fst", "name": "Swap.equiv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fsti", "name": "Pulse.Lib.Reference.cond" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.lemmas_i2b_all" }, { "project_name": "zeta", "file_name": "Zeta.SIdxFn.fsti", "name": "Zeta.SIdxFn.index_prefix_prop" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.cur_env" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.cur_env" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fsti", "name": "Zeta.SeqAux.ext_pred" }, { "project_name": "steel", "file_name": "Domains.fst", "name": "Domains.par_env" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.state" } ], "selected_premises": [ "Pulse.Typing.Env.equal", "Pulse.Typing.Env.contains", "Pulse.Typing.Env.dom", "Pulse.Typing.Env.lookup", "Pulse.Typing.Env.disjoint", "Pulse.Typing.Env.singleton_env", "Pulse.Typing.Env.pairwise_disjoint", "FStar.Reflection.Typing.extend_env_l", "Pulse.Typing.Env.extends_with", "Pulse.Typing.Env.push_binding_def", "FStar.Reflection.Typing.sort_default", "FStar.Reflection.V2.Data.var", "FStar.Reflection.Typing.sigelt_for", "FStar.Reflection.Typing.var_as_namedv", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Reflection.Typing.lookup_fvar", "FStar.Reflection.Typing.fstar_env_fvs", "FStar.Reflection.Typing.dsl_tac_result_t", "FStar.Reflection.Typing.tm_type", "FStar.Reflection.Typing.pp_name_t", "FStar.Reflection.Typing.constant_as_term", "FStar.Reflection.Typing.blob", "FStar.Reflection.Typing.tun", "FStar.Sealed.Inhabited.seal", "FStar.Reflection.Typing.pp_name_default", "FStar.Reflection.V2.Data.ppname_t", "FStar.Reflection.Typing.extend_env", "FStar.Reflection.Typing.subst_binder", "FStar.Reflection.Typing.binder_of_t_q", "FStar.Reflection.Typing.u_zero", "FStar.Reflection.Typing.binder_offset_patterns", "FStar.Pervasives.dfst", "FStar.Reflection.Typing.subst_match_returns", "FStar.Reflection.Typing.unit_exp", "FStar.Reflection.Typing.subst_patterns", "FStar.Reflection.Typing.binding_to_namedv", "FStar.Reflection.Typing.subst_branches", "FStar.Reflection.Typing.eqtype_lid", "FStar.Reflection.Typing.is_non_informative_name", "FStar.Pervasives.dsnd", "FStar.Reflection.Typing.binder_qual", "FStar.Reflection.Typing.freevars_branch", "FStar.Reflection.Typing.freevars_pattern", "FStar.Reflection.Typing.mk_binder", "FStar.Sealed.Inhabited.sealed", "FStar.Reflection.Typing.subst_pattern", "FStar.Reflection.Typing.sort_t", "FStar.Reflection.Typing.subst_branch", "FStar.Reflection.Typing.open_with_var_elt", "Pulse.Typing.Env.is_related_to", "FStar.Reflection.Typing.b2t_lid", "FStar.Reflection.Typing.binder_offset_pattern", "FStar.Reflection.Typing.freevars_patterns", "FStar.Reflection.V2.Data.as_ppname", "FStar.Reflection.Typing.bindings_ok_for_branch", "FStar.Reflection.Typing.subst_term", "FStar.Reflection.Typing.mk_total", "FStar.Reflection.Typing.subst_comp", "FStar.Reflection.Typing.subst_args", "FStar.Reflection.Typing.make_bv_with_name", "FStar.Reflection.Typing.make_bv", "FStar.Reflection.Typing.bindings", "FStar.Reflection.Typing.mk_ghost", "FStar.Reflection.Typing.freevars_binder", "FStar.Reflection.Typing.open_with_var", "FStar.Reflection.Typing.binding", "FStar.Reflection.Typing.freevars_args", "FStar.Pervasives.reveal_opaque", "FStar.Reflection.Typing.freevars_match_returns", "FStar.Reflection.Typing.freevars_branches", "FStar.Reflection.Typing.shift_subst_n", "FStar.Reflection.Typing.ln'_pattern", "FStar.Reflection.Typing.ln'_branch", "FStar.Reflection.Typing.shift_subst", "FStar.Reflection.Typing.subst_terms", "FStar.Reflection.Typing.freevars_comp", "FStar.Issue.mk_issue", "FStar.Sealed.Inhabited.sealed_", "FStar.Reflection.Typing.mk_comp", "FStar.Reflection.Typing.freevars_comp_typ", "FStar.Reflection.Typing.ln'_comp", "FStar.Sealed.Inhabited.is_sealed", "FStar.Reflection.Typing.ln'_match_returns", "FStar.Reflection.Typing.freevars", "FStar.Reflection.Typing.subst", "FStar.Reflection.Typing.ln'_binder", "FStar.Reflection.Typing.bool_fv", "FStar.Pervasives.id", "FStar.Pervasives.ex_pre", "FStar.Reflection.Typing.ln'", "FStar.Reflection.Typing.ln'_args", "FStar.Reflection.Typing.ln'_branches", "FStar.Reflection.Typing.tm_prop", "FStar.Reflection.Typing.open_comp_typ'", "FStar.Reflection.Typing.zip2prop", "FStar.Reflection.Typing.ln'_patterns", "FStar.Reflection.Typing.bv_index", "FStar.Reflection.Typing.is_non_informative_fv", "FStar.Reflection.Typing.ln'_terms" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Typing.Env\n\nopen FStar.List.Tot\n\nopen Pulse.Syntax\n\nmodule L = FStar.List.Tot\n\nmodule RT = FStar.Reflection.Typing\nmodule T = FStar.Tactics.V2\nmodule Pprint = FStar.Stubs.Pprint\n\ntype binding = var & typ\ntype env_bindings = list binding\n\nval env : Type0\n\nval fstar_env (g:env) : RT.fstar_top_env\n\n//\n// most recent binding at the head of the list\n//\nval bindings (g:env) : env_bindings\nval bindings_with_ppname (g:env) : T.Tac (list (ppname & var & typ))\n\nval as_map (g:env) : Map.t var typ\n\nlet is_related_to (bs:list (var & typ)) (m:Map.t var typ) =\n (forall (b:var & typ).{:pattern L.memP b bs}\n L.memP b bs ==> (Map.contains m (fst b) /\\\n Map.sel m (fst b) == snd b)) /\\\n\n (forall (x:var).{:pattern Map.contains m x} Map.contains m x ==> (L.memP (x, Map.sel m x) bs))\n\nval bindings_as_map (g:env)\n : Lemma (bindings g `is_related_to` as_map g)\n [SMTPat (bindings g); SMTPat (as_map g)]\n\nlet dom (g:env) : Set.set var = Map.domain (as_map g)\n\nlet equal (g1 g2:env) =\n fstar_env g1 == fstar_env g2 /\\\n bindings g1 == bindings g2\n\nval equal_elim (g1 g2:env)\n : Lemma (requires equal g1 g2)\n (ensures g1 == g2)\n [SMTPat (equal g1 g2)]\n\nval mk_env (f:RT.fstar_top_env) : g:env { fstar_env g == f }\n\nval mk_env_bs (f:RT.fstar_top_env)\n : Lemma (bindings (mk_env f) == [])\n [SMTPat (bindings (mk_env f))]\n\nval mk_env_dom (f:RT.fstar_top_env)\n : Lemma (dom (mk_env f) == Set.empty)\n [SMTPat (dom (mk_env f))]\n\nval push_binding (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : g':env { fstar_env g' == fstar_env g }\n\nlet singleton_env (f:_) (x:var) (t:typ) = push_binding (mk_env f) x ppname_default t\n\nlet push_binding_def (g:env) (x:var { ~ (Set.mem x (dom g)) }) (t:typ)\n = push_binding g x ppname_default t\n\nval push_binding_bs (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (bindings (push_binding g x n t) == (x, t) :: bindings g)\n [SMTPat (bindings (push_binding g x n t))]\n\nval push_binding_as_map (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : Lemma (as_map (push_binding g x n t) == Map.upd (as_map g) x t)\n [SMTPat (as_map (push_binding g x n t))]\n\nlet lookup (g:env) (x:var) : option typ =\n let m = as_map g in\n if Map.contains m x then Some (Map.sel m x) else None\n\nval fresh (g:env) : v:var { ~ (Set.mem v (dom g)) }\n\nlet contains (g:env) (x:var) = Map.contains (as_map g) x\n\nlet disjoint (g1 g2:env) =\n fstar_env g1 == fstar_env g2 /\\\n Set.disjoint (dom g1) (dom g2)\n\nlet pairwise_disjoint (g g' g'':env) =\n disjoint g g' /\\ disjoint g' g'' /\\ disjoint g g''\n\nlet disjoint_dom (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures dom g1 `Set.disjoint` dom g2) = ()\n\nval push_env (g1:env) (g2:env { disjoint g1 g2 }) : env\n\nval push_env_fstar_env (g1:env) (g2:env { disjoint g1 g2 })\n : Lemma (fstar_env (push_env g1 g2) == fstar_env g1)\n [SMTPat (fstar_env (push_env g1 g2))]\n\nval push_env_bindings (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures bindings (push_env g1 g2) == bindings g2 @ bindings g1)\n [SMTPat (bindings (push_env g1 g2))]\n\nval push_env_as_map (g1 g2:env)\n : Lemma (requires disjoint g1 g2)\n (ensures as_map (push_env g1 g2) == Map.concat (as_map g2) (as_map g1))\n [SMTPat (as_map (push_env g1 g2))]\n\nval push_env_assoc (g1 g2 g3:env)\n : Lemma (requires disjoint g1 g2 /\\ disjoint g2 g3 /\\ disjoint g3 g1)\n (ensures push_env g1 (push_env g2 g3) == push_env (push_env g1 g2) g3)\n\nval check_disjoint (g:env) (s:Set.set var) : b:bool { b ==> Set.disjoint s (dom g)}\n\n// removes the binding that was added first\n// leftmost when we write env on paper\nval remove_binding (g:env { Cons? (bindings g) })\n : Pure (var & typ & env)\n (requires True)\n (ensures fun r ->\n let (x, t, g') = r in\n fstar_env g' == fstar_env g /\\\n (~ (x `Set.mem` dom g')) /\\\n g == push_env (push_binding (mk_env (fstar_env g)) x ppname_default t) g')\n\nval remove_latest_binding (g:env { Cons? (bindings g) })\n : Pure (var & typ & env)\n (requires True)\n (ensures fun r ->\n let (x, t, g') = r in\n fstar_env g' == fstar_env g /\\\n (~ (x `Set.mem` dom g')) /\\\n g == push_binding g' x ppname_default t)\n\n// g1 extends g2 with g3, i.e. g1.bs == g3.bs @ g2.bs (recall most recent binding at the head)\nlet extends_with (g1 g2 g3:env) =\n disjoint g2 g3 /\\\n g1 == push_env g2 g3\n", "sketch": [ "To implement `env_extends`, we will check if `g1` is a result of extending `g2` with some additional bindings. We will verify that `g1` is the result of pushing `g2` with some other environment `g3`, and that `g2` and `g3` are disjoint.", "To implement the `env_extends` function, we need to check if `g1` extends `g2` by ensuring that `g1` contains all the bindings of `g2` and possibly additional bindings. We can achieve this by comparing the bindings of `g1` and `g2` and ensuring that `g1` is a superset of `g2`.\n\n```fstar\nval env_extends : g1: Pulse.Typing.Env.env -> g2: Pulse.Typing.Env.env -> Prims.logical\n```" ], "generated_solution": [ "val env_extends : g1: Pulse.Typing.Env.env -> g2: Pulse.Typing.Env.env -> Prims.logical\n ensures (env_extends g1 g2) <==> (exists g3. extends_with g1 g2 g3)" ] }, { "file_name": "OPLSS2021.MemCpy.fst", "name": "OPLSS2021.MemCpy.memcpy", "opens_and_abbrevs": [ { "abbrev": "B", "full_module": "LowStar.Buffer" }, { "open": "OPLSS2021.MemCpy.Deps" }, { "open": "LowStar.Buffer" }, { "open": "FStar.HyperStack.ST" }, { "open": "OPLSS2021" }, { "open": "OPLSS2021" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8)\n : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)", "source_definition": "let rec memcpy\n (len:uint32)\n (cur:uint32{cur <= len})\n (src dest:lbuffer len uint8)\n : ST unit \n (requires fun h ->\n live h src /\\\n live h dest /\\\n disjoint src dest /\\\n prefix_equal h src dest cur)\n (ensures fun h0 _ h1 ->\n modifies dest h0 h1 /\\ \n prefix_equal h1 src dest len)\n = if cur < len\n then begin\n dest.(cur) <- src.(cur);\n memcpy len (cur + 1ul) src dest\n end", "source_range": { "start_line": 24, "start_col": 0, "end_line": 41, "end_col": 7 }, "interleaved": false, "definition": "fun len cur src dest ->\n (match cur < len with\n | true ->\n (let _ = src.(cur) in\n dest.(cur) <- _);\n OPLSS2021.MemCpy.memcpy len (cur + 1ul) src dest\n | _ -> ())\n <:\n FStar.HyperStack.ST.ST Prims.unit", "effect": "FStar.HyperStack.ST.ST", "effect_flags": [], "mutual_with": [], "premises": [ "OPLSS2021.MemCpy.Deps.uint32", "Prims.b2t", "OPLSS2021.MemCpy.Deps.op_Less_Equals", "OPLSS2021.MemCpy.Deps.lbuffer", "OPLSS2021.MemCpy.Deps.uint8", "OPLSS2021.MemCpy.Deps.op_Less", "OPLSS2021.MemCpy.memcpy", "OPLSS2021.MemCpy.Deps.op_Plus", "FStar.UInt32.__uint_to_t", "Prims.unit", "OPLSS2021.MemCpy.Deps.op_Array_Assignment", "OPLSS2021.MemCpy.Deps.op_Array_Access", "Prims.bool", "FStar.Monotonic.HyperStack.mem", "Prims.l_and", "OPLSS2021.MemCpy.Deps.live", "OPLSS2021.MemCpy.Deps.disjoint", "OPLSS2021.MemCpy.Deps.prefix_equal", "OPLSS2021.MemCpy.Deps.modifies" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n len: OPLSS2021.MemCpy.Deps.uint32 ->\n cur: OPLSS2021.MemCpy.Deps.uint32{cur <= len} ->\n src: OPLSS2021.MemCpy.Deps.lbuffer len OPLSS2021.MemCpy.Deps.uint8 ->\n dest: OPLSS2021.MemCpy.Deps.lbuffer len OPLSS2021.MemCpy.Deps.uint8\n -> FStar.HyperStack.ST.ST Prims.unit", "prompt": "let rec memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8)\n : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len) =\n ", "expected_response": "if cur < len\nthen\n (dest.(cur) <- src.(cur);\n memcpy len (cur + 1ul) src dest)", "source": { "project_name": "FStar", "file_name": "examples/oplss2021/OPLSS2021.MemCpy.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS2021.MemCpy.fst", "checked_file": "dataset/OPLSS2021.MemCpy.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/OPLSS2021.MemCpy.Deps.fst.checked", "dataset/LowStar.Buffer.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked" ] }, "definitions_in_context": [], "closest": [ "val memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8)\n : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)\nlet rec memcpy\n (len:uint32)\n (cur:uint32{cur <= len})\n (src dest:lbuffer len uint8)\n : ST unit \n (requires fun h ->\n live h src /\\\n live h dest /\\\n disjoint src dest /\\\n prefix_equal h src dest cur)\n (ensures fun h0 _ h1 ->\n modifies dest h0 h1 /\\\n prefix_equal h1 src dest len)\n = if cur < len\n then begin\n dest.(cur) <- src.(cur);\n memcpy len (cur + 1ul) src dest\n end", "val copy3 (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8)\n : ST unit\n (requires fun h -> live h src /\\ live h dest)\n (ensures fun h0 _ h1 -> modifies dest h0 h1)\nlet rec copy3\n (len:uint32)\n (cur:uint32{cur <= len})\n (src dest:lbuffer len uint8)\n : ST unit \n (requires fun h ->\n live h src /\\\n live h dest)\n (ensures fun h0 _ h1 ->\n modifies dest h0 h1)\n = if cur < len\n then begin\n dest.(cur) <- src.(cur);\n copy3 len (cur + 1ul) src dest\n end", "val copy2 (len: uint32) (src dest: lbuffer len uint8)\n : ST unit\n (requires fun h -> live h src /\\ live h dest)\n (ensures fun h0 _ h1 -> modifies dest h0 h1)\nlet copy2 (len:uint32) (src dest:lbuffer len uint8)\n : ST unit \n (requires fun h ->\n live h src /\\\n live h dest)\n (ensures fun h0 _ h1 ->\n modifies dest h0 h1)\n = if 0ul < len\n then dest.(0ul) <- src.(0ul)", "val malloc_copy_free (len: uint32{0ul < len}) (src: lbuffer len uint8)\n : ST (lbuffer len uint8)\n (requires fun h -> live h src /\\ freeable src)\n (ensures\n fun h0 dest h1 ->\n live h1 dest /\\ (forall (j: uint32). j < len ==> get h0 src j == get h1 dest j))\nlet malloc_copy_free (len:uint32 { 0ul < len })\n (src:lbuffer len uint8)\n : ST (lbuffer len uint8)\n (requires fun h -> \n live h src /\\\n freeable src)\n (ensures fun h0 dest h1 -> \n live h1 dest /\\\n (forall (j:uint32). j < len ==> get h0 src j\n == get h1 dest j))\n = let dest = malloc 0uy len in\n memcpy len 0ul src dest;\n free src;\n dest", "val blit: src:buffer U8.t -> idx_src:U32.t -> dst:buffer uint8 -> idx_dst:U32.t -> len:U32.t -> ST unit\n (requires fun h -> \n live h src /\\ live h dst /\\ \n U32.v idx_src + U32.v len <= length src /\\\n U32.v idx_dst + U32.v len <= length dst /\\\n disjoint src dst)\n (ensures fun h0 _ h1 -> \n modifies (loc_buffer dst) h0 h1 /\\\n live h1 dst /\\\n (forall (i:nat). i < U32.v len ==>\n Seq.index (as_seq h1 dst) (U32.v idx_dst + i) ==\n Lib.RawIntTypes.u8_from_UInt8 (Seq.index (as_seq h0 src) (U32.v idx_src + i))) /\\\n Seq.slice (as_seq h1 dst) 0 (U32.v idx_dst) ==\n Seq.slice (as_seq h0 dst) 0 (U32.v idx_dst) /\\\n Seq.slice (as_seq h1 dst) (U32.v idx_dst + U32.v len) (length dst) ==\n Seq.slice (as_seq h0 dst) (U32.v idx_dst + U32.v len) (length dst))\nlet blit src idx_src dst idx_dst len =\n let h0 = get () in\n blit src idx_src dst idx_dst len;\n let h1 = get () in\n assert (forall (i:nat). i < U32.v len ==>\n Seq.index (as_seq h1 dst) (U32.v idx_dst + i) ==\n Seq.index (Seq.slice (as_seq h1 dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len)) i)", "val memcpy \n (#t:eqtype)\n (l:SZ.t)\n (src dst:larray t (SZ.v l))\n (#p:perm)\n (#src0 #dst0:Ghost.erased (Seq.seq t))\n : stt unit\n (requires \n pts_to src #p src0 **\n pts_to dst dst0)\n (ensures (fun _ ->\n pts_to src #p src0 **\n pts_to dst src0))\nlet memcpy = memcpy'", "val copy_buffer_contents_advance\n (#t: typ)\n (a: buffer t) (* source *)\n (b: buffer t) (* destination *)\n (len' : UInt32.t)\n (h: Ghost.erased HS.mem)\n: HST.Stack unit\n (requires (fun h0 ->\n copy_buffer_contents_inv a b len' (Ghost.reveal h) h0 /\\\n UInt32.v len' < UInt32.v (buffer_length a)\n ))\n (ensures (fun h1 _ h2 ->\n copy_buffer_contents_inv a b len' (Ghost.reveal h) h1 /\\\n UInt32.v len' < UInt32.v (buffer_length a) /\\\n copy_buffer_contents_inv a b (UInt32.add len' 1ul) (Ghost.reveal h) h2\n ))\nlet copy_buffer_contents_advance #t a b len' h =\n let v = read_buffer a len' in\n buffer_snoc b 0ul len' v;\n buffer_as_seq_gsub_buffer_snoc (Ghost.reveal h) a 0ul len'", "val memset: b:bytes -> z:u8 -> len:u32 -> STL unit\n (requires (fun h -> live h b /\\ v len = length b))\n (ensures (fun h0 _ h1 -> \n live h1 b /\\ modifies_1 b h0 h1 /\\\n Seq.equal (as_seq h1 b) (Seq.create (v len) z)))\nlet memset b z len =\n let h0 = ST.get() in\n C.Compat.Loops.for 0ul len (fun h1 i -> live h1 b /\\ modifies_1 b h0 h1 /\\ i <= Buffer.length b /\\\n (forall (j:nat{j < i}).{:pattern Seq.index (as_seq h1 b) j} Seq.index (as_seq h1 b) j == z))\n (fun i -> b.(i) <- z)", "val memzero (x: B.buffer UInt8.t) (len sz: UInt32.t)\n : Stack unit\n (requires fun h0 -> B.live h0 x /\\ sz <> 0ul /\\ B.length x = U32.v len * U32.v sz)\n (ensures (fun h0 _ h1 -> let open B in modifies (loc_buffer x) h0 h1))\nlet memzero (x: B.buffer UInt8.t) (len: UInt32.t) (sz: UInt32.t): Stack unit\n (requires fun h0 -> B.live h0 x /\\ sz <> 0ul /\\ B.length x = U32.v len * U32.v sz)\n (ensures (fun h0 _ h1 -> B.(modifies (loc_buffer x) h0 h1)))\n=\n if len `U32.gte` (0xfffffffful `U32.div` sz) then\n trap \"Overflow in memzero; see WasmSupport.fst\";\n let n_bytes = U32.mul len sz in\n let h0 = FStar.HyperStack.ST.get () in\n C.Loops.for 0ul n_bytes (fun h _ ->\n B.live h x /\\\n B.(modifies (loc_buffer x) h0 h)\n ) (fun i ->\n x.(i) <- 0uy\n )", "val copy_buffer_contents\n (#t: typ)\n (a: buffer t) (* source *)\n (idx_a: UInt32.t)\n (b: buffer t) (* destination *)\n (idx_b: UInt32.t)\n (len: UInt32.t)\n: HST.Stack unit\n (requires (fun h ->\n copy_buffer_contents_precond a idx_a b idx_b len h\n ))\n (ensures (fun h0 _ h1 ->\n copy_buffer_contents_postcond a idx_a b idx_b len h0 h1\n ))\nlet copy_buffer_contents = copy_buffer_contents'", "val copy_buffer_contents_aux\n (#t: typ)\n (a: buffer t) (* source *)\n (b: buffer t) (* destination *)\n (len: UInt32.t)\n (len': UInt32.t)\n (h: Ghost.erased HS.mem)\n: HST.Stack unit\n (requires (fun h0 -> \n copy_buffer_contents_inv a b len' (Ghost.reveal h) h0 /\\\n len == buffer_length a\n ))\n (ensures (fun h0 _ h1 ->\n copy_buffer_contents_inv a b len' (Ghost.reveal h) h0 /\\\n copy_buffer_contents_postcond' a b (Ghost.reveal h) h1\n ))\n (decreases (UInt32.v (buffer_length a) - UInt32.v len'))\nlet rec copy_buffer_contents_aux #t a b len len' h =\n if len = len'\n then ()\n else begin\n copy_buffer_contents_advance a b len' h;\n copy_buffer_contents_aux a b len (UInt32.add len' 1ul) h\n end", "val update_sub_opt :\n #ty : buftype ->\n #a : Type0 ->\n (* Warning: len must be valid for extraction *)\n #len : size_t ->\n dst : lbuffer_or_null a len ->\n src : lbuffer_t_or_null ty a len ->\n Stack unit\n (requires (fun h -> live h dst /\\ live h src /\\ disjoint dst src /\\\n (g_is_null dst ==> g_is_null src)))\n (ensures (fun h0 _ h1 ->\n (if g_is_null src then modifies0 h0 h1 else modifies1 dst h0 h1) /\\\n (if g_is_null src then\n (if g_is_null dst then True else h1.[|dst <: lbuffer_t MUT a len|] `S.equal`\n h0.[|dst <: lbuffer_t MUT a len|])\n else h1.[|dst <: lbuffer_t MUT a len|] `S.equal` h0.[|src <: lbuffer_t ty a len|])))\nlet update_sub_opt #ty #a #len dst src =\n (* The first assignement which is computationally useless allows to prevent\n * non-compilable extraction of the following form if the src parameter is null:\n * [> if (!(NULL == NULL))\n * [> memcpy(mremote_static, NULL, (uint32_t)32U * sizeof (void * ));\n * Instead we get:\n * [> uint8_t *src = NULL;\n * [> if (!(src == NULL))\n * [> memcpy(mremote_ephemeral, src, (uint32_t)32U * sizeof(uint_t));\n *)\n let src = src in\n if is_null src then ()\n else update_sub (dst <: lbuffer_t MUT a len) 0ul len src", "val array_memcpy\n (#t: Type)\n (#td: typedef t)\n (#v_src: Ghost.erased (Seq.seq t) {full_seq td v_src /\\ fractionable_seq td v_src})\n (#p_src: P.perm)\n (#v_dst: Ghost.erased (Seq.seq t) {full_seq td v_dst})\n (src dst: array td)\n (len: SZ.t{SZ.v len == array_length src /\\ array_length src == array_length dst})\n : STT unit\n ((array_pts_to src (mk_fraction_seq td v_src p_src)) `star` (array_pts_to dst v_dst))\n (fun _ -> (array_pts_to src (mk_fraction_seq td v_src p_src)) `star` (array_pts_to dst v_src))\nlet array_memcpy\n (#t: Type)\n (#td: typedef t)\n (#v_src: Ghost.erased (Seq.seq t) { full_seq td v_src /\\ fractionable_seq td v_src })\n (#p_src: P.perm)\n (#v_dst: Ghost.erased (Seq.seq t) { full_seq td v_dst })\n (src: array td)\n (dst: array td)\n (len: SZ.t { SZ.v len == array_length src /\\ array_length src == array_length dst })\n: STT unit\n (array_pts_to src (mk_fraction_seq td v_src p_src) `star` array_pts_to dst v_dst)\n (fun _ -> array_pts_to src (mk_fraction_seq td v_src p_src) `star` array_pts_to dst v_src)\n= let _ = array_blit src 0sz dst 0sz len in\n vpattern_rewrite (array_pts_to dst) v_src;\n return ()", "val lbytes_eq: #len:size_t -> b1:lbuffer uint8 len -> b2:lbuffer uint8 len -> Stack bool\n (requires fun h -> live h b1 /\\ live h b2)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\ r == BS.lbytes_eq (as_seq h0 b1) (as_seq h0 b2))\nlet lbytes_eq #len b1 b2 =\n push_frame();\n let res = create 1ul (u8 255) in\n let z = buf_eq_mask b1 b2 len res in\n pop_frame();\n Raw.u8_to_UInt8 z = 255uy", "val new_blit\n (#t: Type)\n (src: New.buffer t)\n (idx_src: U32.t)\n (dst: New.buffer t)\n (idx_dst len: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n New.live h src /\\ New.live h dst /\\ New.disjoint src dst /\\\n U32.v idx_src + U32.v len <= New.length src /\\\n U32.v idx_dst + U32.v len <= New.length dst))\n (ensures\n (fun h _ h' ->\n NewM.modifies (NewM.loc_buffer dst) h h' /\\ New.live h' dst /\\\n Seq.slice (New.as_seq h' dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len) ==\n Seq.slice (New.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len) /\\\n Seq.slice (New.as_seq h' dst) 0 (U32.v idx_dst) ==\n Seq.slice (New.as_seq h dst) 0 (U32.v idx_dst) /\\\n Seq.slice (New.as_seq h' dst) (U32.v idx_dst + U32.v len) (New.length dst) ==\n Seq.slice (New.as_seq h dst) (U32.v idx_dst + U32.v len) (New.length dst)))\nlet new_blit\n (#t: Type)\n (src: New.buffer t)\n (idx_src: U32.t)\n (dst: New.buffer t)\n (idx_dst: U32.t)\n (len: U32.t)\n: HST.Stack unit\n (requires (fun h ->\n New.live h src /\\ New.live h dst /\\ New.disjoint src dst /\\\n U32.v idx_src + U32.v len <= New.length src /\\\n U32.v idx_dst + U32.v len <= New.length dst\n ))\n (ensures (fun h _ h' ->\n NewM.modifies (NewM.loc_buffer dst) h h' /\\\n New.live h' dst /\\\n Seq.slice (New.as_seq h' dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len) ==\n Seq.slice (New.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len) /\\\n Seq.slice (New.as_seq h' dst) 0 (U32.v idx_dst) ==\n Seq.slice (New.as_seq h dst) 0 (U32.v idx_dst) /\\\n Seq.slice (New.as_seq h' dst) (U32.v idx_dst + U32.v len) (New.length dst) ==\n Seq.slice (New.as_seq h dst) (U32.v idx_dst + U32.v len) (New.length dst)\n ))\n= let src' = new_to_old_st src in\n let dst' = new_to_old_st dst in\n Old.blit src' idx_src dst' idx_dst len", "val store_bytes\n (src: BY.bytes)\n (src_from src_to: U32.t)\n (#rrel #rel: _)\n (dst: B.mbuffer byte rrel rel)\n (dst_pos: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n B.live h dst /\\ U32.v src_from <= U32.v src_to /\\ U32.v src_to <= BY.length src /\\\n U32.v dst_pos + (U32.v src_to - U32.v src_from) <= B.length dst /\\\n writable dst (U32.v dst_pos) (U32.v dst_pos + (U32.v src_to - U32.v src_from)) h))\n (ensures\n (fun h _ h' ->\n B.modifies (B.loc_buffer_from_to dst\n dst_pos\n (dst_pos `U32.add` (src_to `U32.sub` src_from)))\n h\n h' /\\\n Seq.slice (B.as_seq h' dst)\n (U32.v dst_pos)\n (U32.v dst_pos + (U32.v src_to - U32.v src_from)) ==\n Seq.slice (BY.reveal src) (U32.v src_from) (U32.v src_to)))\nlet store_bytes\n (src: BY.bytes)\n (src_from src_to: U32.t)\n (#rrel #rel: _)\n (dst: B.mbuffer byte rrel rel)\n (dst_pos: U32.t)\n: HST.Stack unit\n (requires (fun h ->\n B.live h dst /\\\n U32.v src_from <= U32.v src_to /\\ U32.v src_to <= BY.length src /\\\n U32.v dst_pos + (U32.v src_to - U32.v src_from) <= B.length dst /\\\n writable dst (U32.v dst_pos) (U32.v dst_pos + (U32.v src_to - U32.v src_from)) h\n ))\n (ensures (fun h _ h' ->\n B.modifies (B.loc_buffer_from_to dst dst_pos (dst_pos `U32.add` (src_to `U32.sub` src_from))) h h' /\\\n Seq.slice (B.as_seq h' dst) (U32.v dst_pos) (U32.v dst_pos + (U32.v src_to - U32.v src_from)) == Seq.slice (BY.reveal src) (U32.v src_from) (U32.v src_to)\n ))\n= let h0 = HST.get () in\n HST.push_frame ();\n let h1 = HST.get () in\n let bi = BF.alloca 0ul 1ul in\n let h2 = HST.get () in\n let len = src_to `U32.sub` src_from in\n C.Loops.do_while\n (fun h stop ->\n B.modifies (B.loc_union (B.loc_region_only true (HS.get_tip h1)) (B.loc_buffer_from_to dst dst_pos (dst_pos `U32.add` len))) h2 h /\\\n B.live h bi /\\ (\n let i = Seq.index (B.as_seq h bi) 0 in\n U32.v i <= U32.v len /\\\n writable dst (U32.v dst_pos) (U32.v dst_pos + U32.v len) h /\\\n Seq.slice (B.as_seq h dst) (U32.v dst_pos) (U32.v dst_pos + U32.v i) `Seq.equal` Seq.slice (BY.reveal src) (U32.v src_from) (U32.v src_from + U32.v i) /\\\n (stop == true ==> i == len)\n ))\n (fun _ ->\n let i = B.index bi 0ul in\n if i = len\n then true\n else begin\n let x = BY.get src (src_from `U32.add` i) in\n mbuffer_upd dst (Ghost.hide (U32.v dst_pos)) (Ghost.hide (U32.v dst_pos + U32.v len)) (dst_pos `U32.add` i) x;\n let i' = i `U32.add` 1ul in\n B.upd bi 0ul i';\n let h' = HST.get () in\n Seq.lemma_split (Seq.slice (B.as_seq h' dst) (U32.v dst_pos) (U32.v dst_pos + U32.v i')) (U32.v i);\n i' = len\n end\n )\n ;\n HST.pop_frame ()", "val load_uint32: len:UInt32.t { v len <= 4 } -> buf:lbuffer (v len) -> ST UInt32.t\n (requires (fun h0 -> live h0 buf))\n (ensures (fun h0 n h1 ->\n h0 == h1 /\\ live h0 buf /\\\n UInt32.v n == little_endian (sel_bytes h1 len buf)))\nlet rec load_uint32 len buf =\n if len = 0ul then 0ul\n else\n let h = ST.get () in\n let len = len -^ 1ul in\n let m = load_uint32 len (sub buf 1ul len) in\n lemma_little_endian_is_bounded (sel_bytes h len (sub buf 1ul len));\n assert (UInt32.v len <= 3);\n assert (UInt32.v m < pow2 (8 * (UInt32.v len)));\n FStar.Math.Lemmas.pow2_le_compat (8 * 3) (8 * (UInt32.v len));\n FStar.Math.Lemmas.pow2_plus 8 (8 * 3);\n assert (pow2 (8 * (UInt32.v len)) <= pow2 (8 * 3));\n assert (pow2 8 * pow2 (8 * 3) = UInt.max_int 32 + 1);\n assert (UInt32.v m * pow2 8 <= UInt.max_int 32);\n let b = buf.(0ul) in\n assert_norm (pow2 8 == 256);\n FStar.UInt32.(uint8_to_uint32 b +^ 256ul *^ m)", "val fill' (#t: Type) (#rrel #rel: srel t) (b: mbuffer t rrel rel) (z: t) (len: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n live h b /\\ U32.v len <= length b /\\\n rel (as_seq h b)\n (Seq.replace_subseq (as_seq h b) 0 (U32.v len) (Seq.create (U32.v len) z))))\n (ensures\n (fun h0 _ h1 ->\n modifies (loc_buffer b) h0 h1 /\\ live h1 b /\\\n (Seq.slice (as_seq h1 b) 0 (U32.v len)) `Seq.equal` (Seq.create (U32.v len) z) /\\\n (Seq.slice (as_seq h1 b) (U32.v len) (length b))\n `Seq.equal`\n (Seq.slice (as_seq h0 b) (U32.v len) (length b))))\nlet fill' (#t:Type) (#rrel #rel: srel t)\n (b: mbuffer t rrel rel)\n (z:t)\n (len:U32.t)\n: HST.Stack unit\n (requires (fun h ->\n live h b /\\\n U32.v len <= length b /\\\n rel (as_seq h b) (Seq.replace_subseq (as_seq h b) 0 (U32.v len) (Seq.create (U32.v len) z))\n ))\n (ensures (fun h0 _ h1 ->\n modifies (loc_buffer b) h0 h1 /\\\n live h1 b /\\\n Seq.slice (as_seq h1 b) 0 (U32.v len) `Seq.equal` Seq.create (U32.v len) z /\\\n Seq.slice (as_seq h1 b) (U32.v len) (length b) `Seq.equal` Seq.slice (as_seq h0 b) (U32.v len) (length b)\n ))\n= let open HST in\n if len = 0ul then ()\n else begin\n let h = get () in\n let Buffer max_length content idx length = b in\n let s_full = !content in\n let s = Seq.slice s_full (U32.v idx) (U32.v max_length) in\n let s_src = Seq.create (U32.v len) z in\n let s' = Seq.replace_subseq s 0 (U32.v len) s_src in\n let s_full' = Seq.replace_subseq s_full (U32.v idx) (U32.v idx + U32.v len) s_src in\n // AF: Needed to trigger the preorder relation. A bit verbose because the second sequence\n // has a ghost computation (U32.v (Ghost.reveal length))\n assert (s_full' `Seq.equal` Seq.replace_subseq s_full (U32.v idx) (U32.v idx + U32.v length) (Seq.replace_subseq (Seq.slice s_full (U32.v idx) (U32.v idx + U32.v length)) 0 (U32.v len) s_src));\n content := s_full';\n let h' = HST.get () in\n assert (s_full' `Seq.equal` Seq.replace_subseq s_full (U32.v idx) (U32.v idx + U32.v length) (Seq.slice s' 0 (U32.v length)));\n assert (h' == g_upd_seq b (Seq.slice s' 0 (U32.v length)) h);\n g_upd_seq_as_seq b (Seq.slice s' 0 (U32.v length)) h //for modifies clause\n end", "val store_uint32:\n len:UInt32.t {v len <= 4} -> buf:lbuffer (v len) ->\n n:UInt32.t {UInt32.v n < pow2 (8 * v len)} -> Stack unit\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 ->\n Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n UInt32.v n == little_endian (sel_bytes h1 len buf)))\nlet rec store_uint32 len buf n =\n if len <> 0ul then\n let len = len -^ 1ul in\n let b = uint32_to_uint8 n in\n let n1 = n in (* n defined in FStar.UInt32, so was shadowed, so renamed into n1 *)\n let n' = FStar.UInt32.(n1 >>^ 8ul) in\n assert(v n = UInt8.v b + 256 * v n');\n let buf' = Buffer.sub buf 1ul len in\n Math.Lemmas.pow2_plus 8 (8 * v len);\n assert_norm (pow2 8 == 256);\n store_uint32 len buf' n';\n buf.(0ul) <- b", "val lbuffer_or_unit_malloc_copy (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (r : HS.rid) (init : a)\n (i : type_or_unit (lbuffer a len) b) :\n ST (type_or_unit (lbuffer a len) b)\n (requires (fun h0 ->\n B.live h0 (lbuffer_or_unit_to_buffer i) /\\\n ST.is_eternal_region r))\n (ensures (fun h0 o h1 ->\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (lbuffer_or_unit_to_loc o) h0 h1 /\\\n B.(loc_includes (loc_region_only true r) (lbuffer_or_unit_to_loc o)) /\\\n lbuffer_or_unit_freeable o /\\\n B.live h1 (lbuffer_or_unit_to_buffer o) /\\\n lbuffer_or_unit_to_seq h1 o == lbuffer_or_unit_to_seq h0 i))\nlet lbuffer_or_unit_malloc_copy #a #len #b r init i =\n if b then\n begin\n (**) let h0 = HST.get () in\n let o = B.malloc r init len in\n copy #MUT #a #len o (lbuffer_or_unit_to_buffer i);\n (**) let h2 = HST.get () in\n (**) B.(modifies_only_not_unused_in loc_none h0 h2);\n o\n end\n else ()", "val sample (len: nat{len < pow2 32})\n : ST (lbytes len) (requires fun h0 -> True) (ensures fun h0 _ h1 -> modifies_none h0 h1)\nlet sample (len:nat{len < pow2 32}) : ST (lbytes len)\n (requires fun h0 -> True)\n (ensures fun h0 _ h1 -> modifies_none h0 h1)\n =\n sample32 (UInt32.uint_to_t len)", "val pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8)\n : ST.Stack unit\n (requires (fun h -> B.live h dst /\\ B.length dst = pad0_length a (len_v a len)))\n (ensures\n (fun h0 _ h1 ->\n B.(modifies (loc_buffer dst) h0 h1) /\\\n S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))\nlet pad_2 (a: hash_alg{is_md a}) (len: len_t a) (dst: B.buffer uint8):\n ST.Stack unit\n (requires (fun h ->\n B.live h dst /\\ B.length dst = pad0_length a (len_v a len)))\n (ensures (fun h0 _ h1 ->\n B.(modifies (loc_buffer dst) h0 h1) /\\\n S.equal (B.as_seq h1 dst) (S.create (pad0_length a (len_v a len)) (u8 0))))\n=\n let h0 = ST.get () in\n let len_zero = pad0_len a len in\n let inv h1 (i: nat) =\n M.(modifies (loc_buffer dst) h0 h1) /\\\n i <= U32.v len_zero /\\\n S.equal (S.slice (B.as_seq h1 dst) 0 i) (S.slice (S.create (U32.v len_zero) (u8 0)) 0 i)\n in\n let f (i:U32.t { U32.(0 <= v i /\\ v i < U32.v len_zero)}):\n ST.Stack unit\n (requires (fun h -> inv h (U32.v i)))\n (ensures (fun h0 _ h1 -> inv h0 (U32.v i) /\\ inv h1 U32.(v i + 1)))\n =\n dst.(i) <- u8 0;\n (**) let h' = ST.get () in\n (**) create_next (B.as_seq h' dst) (u8 0) (U32.v i)\n in\n C.Loops.for 0ul (pad0_len a len) inv f", "val store_bytes_aux: len:UInt32.t -> buf:lbuffer (v len)\n -> i:UInt32.t{i <=^ len} -> b:lbytes (v len) -> ST unit\n (requires (fun h0 -> Buffer.live h0 buf /\\\n Seq.equal (Seq.slice b 0 (v i)) (sel_bytes h0 i (Buffer.sub buf 0ul i))))\n (ensures (fun h0 r h1 -> Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n Seq.equal b (sel_bytes h1 len buf)))\nlet rec store_bytes_aux len buf i b =\n if i <^ len then\n begin\n Buffer.upd buf i (Seq.index b (v i));\n let h = ST.get () in\n assert (Seq.equal\n (sel_bytes h (i +^ 1ul) (Buffer.sub buf 0ul (i +^ 1ul)))\n (Seq.snoc (sel_bytes h i (Buffer.sub buf 0ul i)) (Seq.index b (v i))));\n store_bytes_aux len buf (i +^ 1ul) b\n end", "val update_sub_opt :\n #a : Type0 ->\n (* Warning: len must be valid for extraction *)\n #len : size_t ->\n #b : bool ->\n dst : lbuffer_or_null a len ->\n src : type_or_unit (lbuffer a len) b ->\n Stack unit\n (requires (fun h ->\n live h dst /\\ lbuffer_or_unit_live h src /\\\n B.(loc_disjoint (loc_buffer (dst <: buffer a)) (lbuffer_or_unit_loc src)) /\\\n (b ==> not (g_is_null dst))))\n (ensures (fun h0 _ h1 ->\n (if not b then modifies0 h0 h1 else modifies1 dst h0 h1) /\\\n (if not b then\n (if g_is_null dst then True else h1.[|dst <: lbuffer_t MUT a len|] `S.equal`\n h0.[|dst <: lbuffer_t MUT a len|])\n else h1.[|dst <: lbuffer_t MUT a len|] `S.equal` lbuffer_or_unit_to_seq h0 src)))\nlet update_sub_opt #a #len #b dst src =\n if b then update_sub (dst <: lbuffer_t MUT a len) 0ul len (src <: lbuffer_t MUT a len)\n else ()", "val lbuffer_or_unit_copy (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (o i : type_or_unit (lbuffer a len) b) :\n Stack unit\n (requires (fun h0 ->\n B.live h0 (lbuffer_or_unit_to_buffer o) /\\\n B.live h0 (lbuffer_or_unit_to_buffer i) /\\\n disjoint (lbuffer_or_unit_to_buffer o) (lbuffer_or_unit_to_buffer i)))\n (ensures (fun h0 _ h1 ->\n let o_loc = if b then B.loc_buffer (o <: buffer a) else B.loc_none in\n B.modifies o_loc h0 h1 /\\\n lbuffer_or_unit_to_seq h1 o == lbuffer_or_unit_to_seq h0 i /\\\n B.live h1 (lbuffer_or_unit_to_buffer o)))\nlet lbuffer_or_unit_copy #a #len #b o i =\n if b then copy #MUT #a #len (lbuffer_or_unit_to_buffer o) (lbuffer_or_unit_to_buffer i)", "val malloc1 :\n #a:Type0 -> r: rid -> init: a -> len: UInt32.t ->\n ST (b:B.buffer a{B.length b == UInt32.v len /\\ not (B.g_is_null b)})\n (requires (fun h0 ->\n is_eternal_region r /\\\n UInt32.v len > 0))\n (ensures (fun h0 b h1 ->\n B.live h1 b /\\ B.modifies B.loc_none h0 h1 /\\ B.freeable b /\\\n region_includes r (B.loc_addr_of_buffer b) /\\\n B.as_seq h1 b == Seq.Base.create (UInt32.v len) init))\nlet malloc1 #a r init len =\n B.malloc r init len", "val store_bytes: l:UInt32.t -> buf:lbuffer (v l) -> b:lbytes (v l) -> ST unit\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 -> Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n Seq.equal b (sel_bytes h1 l buf)))\nlet store_bytes l buf b = store_bytes_aux l buf 0ul b", "val pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8)\n : ST.Stack unit\n (requires (fun h -> B.live h dst /\\ B.length dst = 1))\n (ensures\n (fun h0 _ h1 ->\n B.(modifies (loc_buffer dst) h0 h1) /\\ S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80)))\n )\nlet pad_1 (a: hash_alg{is_md a}) (dst: B.buffer uint8):\n ST.Stack unit\n (requires (fun h ->\n B.live h dst /\\ B.length dst = 1))\n (ensures (fun h0 _ h1 ->\n B.(modifies (loc_buffer dst) h0 h1) /\\\n S.equal (B.as_seq h1 dst) (S.create 1 (u8 0x80))))\n=\n dst.(0ul) <- u8 0x80", "val update_nn :\n #ty : buftype ->\n #a : Type0 ->\n #len : size_t ->\n dst : lbuffer_or_null a len{not (g_is_null dst)} ->\n src : lbuffer_t_or_null ty a len{not (g_is_null src)} ->\n Stack unit\n (requires (fun h -> live h dst /\\ live h src /\\ disjoint dst src))\n (ensures (fun h0 _ h1 ->\n modifies1 dst h0 h1 /\\\n (nn_as_seq h1 dst) `S.equal` (nn_as_seq h0 src)))\nlet update_nn #ty #a #len dst src =\n update_sub (dst <: lbuffer_t MUT a len) 0ul len src", "val move_left (#a: _) (b: B.buffer a) (dst src l: U32.t)\n : HST.Stack unit\n (requires fun h0 -> B.live h0 b /\\ U32.v src + U32.v l <= B.length b /\\ U32.v dst <= U32.v src\n )\n (ensures\n fun h0 _ h1 ->\n B.(modifies (loc_buffer b) h0 h1) /\\\n (let b0 = B.as_seq h0 b in\n let b1 = B.as_seq h1 b in\n let src = U32.v src in\n let dst = U32.v dst in\n let l = U32.v l in\n (S.slice b1 dst (dst + l)) `S.equal` (S.slice b0 src (src + l))))\nlet move_left #a (b: B.buffer a) (dst src: U32.t) (l: U32.t): HST.Stack unit\n (requires fun h0 ->\n B.live h0 b /\\\n U32.v src + U32.v l <= B.length b /\\\n U32.v dst <= U32.v src)\n (ensures fun h0 _ h1 ->\n B.(modifies (loc_buffer b) h0 h1) /\\ (\n\n let b0 = B.as_seq h0 b in\n let b1 = B.as_seq h1 b in\n let src = U32.v src in\n let dst = U32.v dst in\n let l = U32.v l in\n S.slice b1 dst (dst + l) `S.equal` S.slice b0 src (src + l)))\n=\n let h0 = HST.get () in\n [@inline_let]\n let inv (h: HS.mem) (i: nat) =\n let b0 = B.as_seq h0 b in\n let b1 = B.as_seq h b in\n let src = U32.v src in\n let dst = U32.v dst in\n let l = U32.v l in\n i <= l /\\\n B.(modifies (loc_buffer b) h0 h) /\\\n S.slice b1 dst (dst + i) `S.equal` S.slice b0 src (src + i) /\\\n S.slice b1 (src + i) (src + l) `S.equal` S.slice b0 (src + i) (src + l)\n in\n let f (i: U32.t { U32.(0 <= v i /\\ v i < v l) }): HST.Stack unit\n (requires fun h0 -> inv h0 (U32.v i))\n (ensures fun h0 _ h1 -> U32.(inv h0 (v i) /\\ inv h1 (v i + 1)))\n =\n let h00 = HST.get () in\n calc (==) {\n S.index (B.as_seq h0 b) U32.(v src + v i);\n (==) {}\n S.index (S.slice (B.as_seq h0 b) U32.(v src + v i) U32.(v src + v l)) 0;\n (==) {}\n S.index (S.slice (B.as_seq h00 b) U32.(v src + v i) U32.(v src + v l)) 0;\n (==) {}\n S.index (B.as_seq h00 b) U32.(v src + v i);\n };\n b.(dst `U32.add` i) <- b.(src `U32.add` i);\n let h = HST.get () in\n let b0 = B.as_seq h0 b in\n let b1 = B.as_seq h b in\n let src = U32.v src in\n let dst = U32.v dst in\n let l = U32.v l in\n let i = U32.v i in\n calc (S.equal) {\n S.slice b1 dst (dst + (i + 1));\n (S.equal) { lemma_slice_ijk b1 dst (dst + i) (dst + i + 1) }\n S.slice b1 dst (dst + i) `S.append` S.slice b1 (dst + i) (dst + i + 1);\n (S.equal) { }\n S.slice b0 src (src + i) `S.append` S.slice b1 (dst + i) (dst + i + 1);\n (S.equal) { }\n S.slice b0 src (src + i) `S.append` S.cons (S.index b1 (dst + i)) S.empty;\n (S.equal) { }\n S.slice b0 src (src + i) `S.append` S.cons (S.index b0 (src + i)) S.empty;\n (S.equal) { }\n S.slice b0 src (src + i) `S.append` S.slice b0 (src + i) (src + i + 1);\n (S.equal) { lemma_slice_ijk b0 src (src + i) (src + i + 1) }\n S.slice b0 src (src + (i + 1));\n };\n let s1 = S.slice b1 (src + (i + 1)) (src + l) in\n let s0 = S.slice b0 (src + (i + 1)) (src + l) in\n let aux (j: nat { j < S.length s0 }): Lemma (S.index s0 j == S.index s1 j)\n [ SMTPat (S.index s0 j); SMTPat (S.index s1 j) ]\n =\n calc (==) {\n S.index s0 j;\n (==) {}\n S.index (S.slice b0 (src + i) (src + l)) (j + 1);\n (==) {}\n S.index (S.slice b1 (src + i) (src + l)) (j + 1);\n (==) {}\n S.index s1 j;\n }\n in\n ()\n in\n C.Loops.for 0ul l inv f", "val store_big32:\n len:UInt32.t {v len <= 4} -> buf:lbuffer (v len) ->\n n:UInt32.t {UInt32.v n < pow2 (8 * v len)} -> Stack unit\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 ->\n Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n UInt32.v n == big_endian (sel_bytes h1 len buf)))\nlet rec store_big32 len buf n =\n if len <> 0ul then\n let len = len -^ 1ul in\n let b = uint32_to_uint8 n in\n let n1 = n in (* n shadowed by FStar.UInt32.n *)\n let n' = FStar.UInt32.(n1 >>^ 8ul) in\n assert(v n = UInt8.v b + 256 * v n');\n let buf' = Buffer.sub buf 0ul len in\n Math.Lemmas.pow2_plus 8 (8 * v len);\n assert_norm (pow2 8 == 256);\n store_big32 len buf' n';\n buf.(len) <- b", "val xor_bytes:\n len:size_t{v len > 0}\n -> b1:lbuffer uint8 len\n -> b2:lbuffer uint8 len ->\n Stack unit\n (requires fun h -> live h b1 /\\ live h b2 /\\ disjoint b1 b2)\n (ensures fun h0 _ h1 -> modifies (loc b1) h0 h1 /\\\n as_seq h1 b1 == S.xor_bytes (as_seq h0 b1) (as_seq h0 b2))\nlet xor_bytes len b1 b2 =\n map2T len b1 (fun x y -> x ^. y) b1 b2", "val fill: #t:typ\n -> b:buffer t\n -> z: P.type_of_typ t\n -> len:UInt32.t{UInt32.v len <= length b}\n -> HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\\n P.modifies (P.loc_buffer (gsub b 0ul len)) h0 h1\n /\\ Seq.slice (as_seq h1 b) 0 (UInt32.v len) == Seq.create (UInt32.v len) z\n /\\ Seq.slice (as_seq h1 b) (UInt32.v len) (length b) ==\n Seq.slice (as_seq h0 b) (UInt32.v len) (length b) ))\nlet fill #t b z len =\n let h0 = HST.get () in\n P.fill_buffer b 0ul len z;\n let h1 = HST.get () in\n assert (as_seq h1 (gsub b 0ul len) == Seq.slice (as_seq h1 b) 0 (UInt32.v len));\n assert (let g = gsub b len (UInt32.sub (P.buffer_length b) len) in as_seq h1 g == as_seq h0 g)", "val copy_buffer_contents'\n (#t: typ)\n (a: buffer t)\n (idx_a: UInt32.t)\n (b: buffer t)\n (idx_b len: UInt32.t)\n : HST.Stack unit\n (requires (fun h -> copy_buffer_contents_precond a idx_a b idx_b len h))\n (ensures (fun h0 _ h1 -> copy_buffer_contents_postcond a idx_a b idx_b len h0 h1))\nlet copy_buffer_contents'\n (#t: typ)\n (a: buffer t) (* source *)\n (idx_a: UInt32.t)\n (b: buffer t) (* destination *)\n (idx_b: UInt32.t)\n (len: UInt32.t)\n: HST.Stack unit\n (requires (fun h ->\n copy_buffer_contents_precond a idx_a b idx_b len h\n ))\n (ensures (fun h0 _ h1 ->\n copy_buffer_contents_postcond a idx_a b idx_b len h0 h1\n ))\n= let h0 = HST.get () in\n let a' = sub_buffer a idx_a len in\n let b' = sub_buffer b idx_b len in\n copy_buffer_contents_init a' b' h0;\n copy_buffer_contents_aux a' b' len 0ul (Ghost.hide h0);\n let h1 = HST.get () in\n copy_buffer_contents_fin a idx_a b idx_b len h0 h1", "val malloc_gen :\n #a:Type0 -> r: rid -> l:B.loc -> init: a -> len: UInt32.t ->\n ST (b:B.buffer a{B.length b == UInt32.v len /\\ not (B.g_is_null b)})\n (requires (fun h0 ->\n is_eternal_region r /\\\n B.loc_in l h0 /\\\n UInt32.v len > 0))\n (ensures (fun h0 b h1 ->\n B.live h1 b /\\ B.modifies B.loc_none h0 h1 /\\ B.freeable b /\\\n B.loc_in (B.loc_addr_of_buffer b) h1 /\\\n region_includes r (B.loc_addr_of_buffer b) /\\\n B.loc_disjoint l (B.loc_addr_of_buffer b) /\\\n B.as_seq h1 b == Seq.Base.create (UInt32.v len) init))\nlet malloc_gen #a r l init len =\n B.malloc r init len", "val alloc_by_buffer:\n #a:Type -> len:uint32_t{len > 0ul} ->\n buf:B.buffer a{B.len buf = len} ->\n HST.ST (vector a)\n (requires (fun h0 -> B.live h0 buf))\n (ensures (fun h0 vec h1 ->\n frameOf vec = B.frameOf buf /\\ loc_vector vec == B.loc_buffer buf /\\\n live h1 vec /\\ h0 == h1 /\\\n size_of vec = len /\\\n S.equal (as_seq h1 vec) (B.as_seq h0 buf)))\nlet alloc_by_buffer #a len buf =\n Vec len len buf", "val alloca (len:u32)\n : StackInline\n (lbuffer len)\n (requires fun _ -> alloca_pre len)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common h0 b h1 /\\ frameOf b == HS.get_tip h0)\nlet alloca len =\n let h0 = ST.get () in\n \n let b = malloca #_ #prefix_freezable_preorder 0uy (U32.add len 4ul) in\n\n let h = ST.get () in E.le_to_n_zeros (Seq.slice (as_seq h b) 0 4);\n\n assert (fresh_loc (loc_buffer b) h0 h); //TODO: necessary for firing modifies_remove_new_locs lemma?\n update_frozen_until_alloc b;\n b", "val lbytes_eq: #n:size_t -> b1:buffer uint8 -> b2:buffer uint8 -> Stack bool\n (requires fun h -> len b1 == n /\\ len b2 == n /\\ live h b1 /\\ live h b2)\n (ensures fun h0 r h1 -> \n modifies loc_none h0 h1 /\\ \n (r <==> Seq.equal (as_seq h0 b1) (as_seq h0 b2)))\nlet lbytes_eq #n b1 b2 =\n let open LowStar.BufferOps in\n let h0 = get() in\n let inv h i b =\n modifies loc_none h0 h /\\\n i <= U32.v n /\\\n (if b then \n 0 < i /\\ Seq.index (as_seq h0 b1) (i-1) <> Seq.index (as_seq h0 b2) (i-1)\n else\n forall (j:nat).j < i ==> Seq.index (as_seq h0 b1) j == Seq.index (as_seq h0 b2) j)\n in\n let _, b = C.Loops.interruptible_for 0ul n inv (fun i -> b1.(i) <> b2.(i)) in\n not b", "val imalloc_and_blit\n (#a: Type0)\n (r: HS.rid)\n (#rrel1 #rel1: srel a)\n (src: mbuffer a rrel1 rel1)\n (id_src len: U32.t)\n : HST.ST\n (b:\n lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len)\n {frameOf b == r /\\ freeable b})\n (requires fun h0 -> malloc_pre r len /\\ live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures\n fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\ b `value_is` (G.hide s))\nlet imalloc_and_blit (#a:Type0) (r:HS.rid)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.ST (b:lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len){frameOf b == r /\\ freeable b})\n (requires fun h0 ->\n malloc_pre r len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\\n b `value_is` G.hide s)\n = let b = mmalloc_and_blit r src id_src len in\n let h0 = HST.get () in\n witness_p b (seq_eq (G.hide (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len))));\n b", "val suffix (#a: Type) (b: buffer a) (from: U32.t) (len: U32.t{len <=^ length b /\\ from <=^ len})\n : ST (buffer a)\n (requires (fun h -> U32.v from + U32.v len <= U32.v (length b) /\\ live h b))\n (ensures (fun h y h' -> h == h' /\\ y == mgsub _ b from (len -^ from)))\nlet suffix (#a:Type) \n (b:buffer a)\n (from:U32.t) \n (len:U32.t{len <=^ length b /\\ from <=^ len})\n : ST (buffer a)\n (requires (fun h -> \n U32.v from + U32.v len <= U32.v (length b) /\\\n live h b))\n (ensures (fun h y h' -> h == h' /\\ y == mgsub _ b from (len -^ from)))\n = B.sub b from (len -^ from)", "val suffix (#a: Type) (b: buffer a) (from: U32.t) (len: U32.t{len <=^ length b /\\ from <=^ len})\n : ST (buffer a)\n (requires (fun h -> U32.v from + U32.v len <= U32.v (length b) /\\ live h b))\n (ensures (fun h y h' -> h == h' /\\ y == mgsub _ b from (len -^ from)))\nlet suffix (#a:Type) \n (b:buffer a)\n (from:U32.t) \n (len:U32.t{len <=^ length b /\\ from <=^ len})\n : ST (buffer a)\n (requires (fun h -> \n U32.v from + U32.v len <= U32.v (length b) /\\\n live h b))\n (ensures (fun h y h' -> h == h' /\\ y == mgsub _ b from (len -^ from)))\n = B.sub b from (len -^ from)", "val malloc (r:HS.rid) (len:u32)\n : ST\n (b:lbuffer len{frameOf b == r /\\ freeable b})\n (requires fun _ -> malloc_pre r len)\n (ensures alloc_post_mem_common)\nlet malloc r len =\n let h0 = ST.get () in\n \n let b = mmalloc #_ #prefix_freezable_preorder r 0uy (U32.add len 4ul) in\n\n let h = ST.get () in E.le_to_n_zeros (Seq.slice (as_seq h b) 0 4);\n\n assert (fresh_loc (loc_buffer b) h0 h); //TODO: necessary for firing modifies_remove_new_locs lemma?\n update_frozen_until_alloc b;\n b", "val blit_strong\n (#a: Type)\n (#rrel1 #rrel2 #rel1 #rel2: _)\n (src: B.mbuffer a rrel1 rel1)\n (idx_src: U32.t)\n (dst: B.mbuffer a rrel2 rel2)\n (idx_dst len: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n B.live h src /\\ B.live h dst /\\ U32.v idx_src + U32.v len <= B.length src /\\\n U32.v idx_dst + U32.v len <= B.length dst /\\\n B.loc_disjoint (B.loc_buffer_from_to src idx_src (idx_src `U32.add` len))\n (B.loc_buffer_from_to dst idx_dst (idx_dst `U32.add` len)) /\\\n rel2 (B.as_seq h dst)\n (Seq.replace_subseq (B.as_seq h dst)\n (U32.v idx_dst)\n (U32.v idx_dst + U32.v len)\n (Seq.slice (B.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len)))))\n (ensures\n (fun h _ h' ->\n B.modifies (B.loc_buffer_from_to dst idx_dst (idx_dst `U32.add` len)) h h' /\\\n B.live h' dst /\\\n Seq.slice (B.as_seq h' dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len) ==\n Seq.slice (B.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len)))\nlet blit_strong\n (#a:Type) (#rrel1 #rrel2 #rel1 #rel2: _)\n (src: B.mbuffer a rrel1 rel1)\n (idx_src:U32.t)\n (dst: B.mbuffer a rrel2 rel2)\n (idx_dst:U32.t)\n (len:U32.t)\n: HST.Stack unit\n (requires (fun h ->\n B.live h src /\\ B.live h dst /\\\n U32.v idx_src + U32.v len <= B.length src /\\\n U32.v idx_dst + U32.v len <= B.length dst /\\\n B.loc_disjoint (B.loc_buffer_from_to src idx_src (idx_src `U32.add` len)) (B.loc_buffer_from_to dst idx_dst (idx_dst `U32.add` len)) /\\\n rel2 (B.as_seq h dst)\n (Seq.replace_subseq (B.as_seq h dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len)\n\t (Seq.slice (B.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len)))))\n (ensures (fun h _ h' ->\n B.modifies (B.loc_buffer_from_to dst idx_dst (idx_dst `U32.add` len)) h h' /\\\n B.live h' dst /\\\n Seq.slice (B.as_seq h' dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len) ==\n Seq.slice (B.as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len)\n ))\n= let h = HST.get () in\n B.blit src idx_src dst idx_dst len;\n let h' = HST.get () in\n B.modifies_loc_buffer_from_to_intro dst idx_dst (idx_dst `U32.add` len) B.loc_none h h'", "val lbytes_eq :\n #len:size_t\n -> b1:lbuffer uint8 len\n -> b2:lbuffer uint8 len ->\n Stack bool\n (requires (fun h ->\n live h b1 /\\ live h b2))\n (ensures (fun h0 b h1 ->\n modifies0 h0 h1 /\\\n (b = BS.lbytes_eq (as_seq h0 b1) (as_seq h0 b2))))\nlet lbytes_eq #len b1 b2 =\n lbuffers_uint_eq b1 b2", "val load_big32: len:UInt32.t { v len <= 4 } -> buf:lbuffer (v len) -> ST UInt32.t\n (requires (fun h0 -> live h0 buf))\n (ensures (fun h0 n h1 ->\n h0 == h1 /\\ live h0 buf /\\\n UInt32.v n == big_endian (sel_bytes h1 len buf)))\nlet rec load_big32 len buf =\n if len = 0ul then 0ul\n else\n let len = len -^ 1ul in\n let n = load_big32 len (sub buf 0ul len) in\n let b = buf.(len) in\n assert_norm (pow2 8 == 256);\n let n' = n in (* n defined in FStar.UInt32, so was shadowed, so renamed into n' *)\n FStar.UInt32.(uint8_to_uint32 b +^ 256ul *^ n')", "val fill_buffer_advance\n (#t: typ)\n (b: buffer t) (* destination *)\n (len' : UInt32.t)\n (v: type_of_typ t)\n (h: Ghost.erased HS.mem)\n: HST.Stack unit\n (requires (fun h0 ->\n fill_buffer_inv b len' v (Ghost.reveal h) h0 /\\\n UInt32.v len' < UInt32.v (buffer_length b)\n ))\n (ensures (fun h1 _ h2 ->\n fill_buffer_inv b len' v (Ghost.reveal h) h1 /\\\n UInt32.v len' < UInt32.v (buffer_length b) /\\\n fill_buffer_inv b (UInt32.add len' 1ul) v (Ghost.reveal h) h2\n ))\nlet fill_buffer_advance #t b len' v h =\n buffer_snoc b 0ul len' v;\n Seq.lemma_eq_intro (Seq.snoc (Seq.create (UInt32.v len') v) v) (Seq.create (UInt32.v (UInt32.add len' 1ul)) v)", "val store_uint128:\n len:UInt32.t {v len <= 16} -> buf:lbuffer (v len) ->\n n:UInt128.t {UInt128.v n < pow2 (8 * v len)} -> Stack unit\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 ->\n Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n UInt128.v n == little_endian (sel_bytes h1 len buf)))\nlet rec store_uint128 len buf n =\n if len <> 0ul then\n let len = len -^ 1ul in\n let b = uint128_to_uint8 n in\n let n1 = n in (* n defined in FStar.UInt128, so was shadowed, so renamed into n1 *)\n let n' = FStar.UInt128.(n1 >>^ 8ul) in\n assert(UInt128.v n = UInt8.v b + 256 * UInt128.v n');\n let buf' = Buffer.sub buf 1ul len in\n Math.Lemmas.pow2_plus 8 (8 * v len);\n assert_norm (pow2 8 == 256);\n store_uint128 len buf' n';\n buf.(0ul) <- b", "val malloc (init: 'a) (len: U32.t)\n : ST (lbuffer len 'a)\n (requires fun h -> malloc_pre HS.root len)\n (ensures\n fun h0 b h1 -> alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) init) /\\ freeable b)\nlet malloc (init:'a) (len:U32.t)\n : ST (lbuffer len 'a)\n (requires fun h -> malloc_pre HS.root len)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) init) /\\\n freeable b)\n = B.malloc HS.root init len", "val malloc (init: 'a) (len: U32.t)\n : ST (lbuffer len 'a)\n (requires fun h -> malloc_pre HS.root len)\n (ensures\n fun h0 b h1 -> alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) init) /\\ freeable b)\nlet malloc (init:'a) (len:U32.t)\n : ST (lbuffer len 'a)\n (requires fun h -> malloc_pre HS.root len)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) init) /\\\n freeable b)\n = B.malloc HS.root init len", "val va_quick_Memcpy (win: bool) (dst src: buffer64) : (va_quickCode unit (va_code_Memcpy win))\nlet va_quick_Memcpy (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode unit (va_code_Memcpy\n win)) =\n (va_QProc (va_code_Memcpy win) ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Memcpy win dst src)\n (va_wpProof_Memcpy win dst src))", "val load_uint128: len:UInt32.t { v len <= 16 } -> buf:lbuffer (v len) -> ST UInt128.t\n (requires (fun h0 -> live h0 buf))\n (ensures (fun h0 n h1 ->\n h0 == h1 /\\ live h0 buf /\\\n UInt128.v n == little_endian (sel_bytes h1 len buf)))\nlet rec load_uint128 len buf =\n if len = 0ul then uint64_to_uint128 0UL // Need 128-bit constants?\n else\n let n = load_uint128 (len -^ 1ul) (sub buf 1ul (len -^ 1ul)) in\n let b = buf.(0ul) in\n let h = ST.get () in\n lemma_little_endian_is_bounded\n (sel_bytes h (len -^ 1ul) (sub buf 1ul (len -^ 1ul)));\n assert (UInt128.v n <= pow2 (8 * v len - 8) - 1);\n assert (256 * UInt128.v n <= 256 * pow2 (8 * v len - 8) - 256);\n assert_norm (256 * pow2 (8 * 16 - 8) - 256 <= pow2 128 - 256);\n Math.Lemmas.pow2_le_compat (8 * 16 - 8) (8 * v len - 8);\n assert (256 * pow2 (8 * v len - 8) - 256 <= pow2 128 - 256);\n Math.Lemmas.modulo_lemma (256 * UInt128.v n) (pow2 128);\n assert_norm (pow2 (UInt32.v 8ul) == 256);\n let n' = n in (* n shadowed by FStar.UInt128.n *)\n assert (256 * UInt128.v n' == FStar.UInt128.(v (n' <<^ 8ul)));\n FStar.UInt128.(uint8_to_uint128 b +^ (n' <<^ 8ul))", "val ublit\n (#a: Type0)\n (#rrel #rel: srel a)\n (src: mbuffer a rrel rel)\n (idx_src: U32.t)\n (dst: ubuffer a {disjoint src dst})\n (idx_dst: U32.t)\n (len: U32.t{valid_j_for_blit src idx_src dst idx_dst len})\n : HST.Stack unit\n (requires (fun h0 -> live h0 src /\\ live h0 dst))\n (ensures (fun h0 _ h1 -> ublit_post_j src idx_src dst idx_dst len h0 h1))\nlet ublit (#a:Type0) (#rrel #rel:srel a)\n (src:mbuffer a rrel rel) (idx_src:U32.t)\n (dst:ubuffer a{disjoint src dst}) (idx_dst:U32.t)\n (len:U32.t{valid_j_for_blit src idx_src dst idx_dst len})\n :HST.Stack unit (requires (fun h0 -> live h0 src /\\ live h0 dst))\n (ensures (fun h0 _ h1 -> ublit_post_j src idx_src dst idx_dst len h0 h1))\n = let rec aux (j:U32.t{valid_j_for_blit src idx_src dst idx_dst j})\n :HST.Stack unit\n (requires (fun h0 -> live h0 src /\\ live h0 dst /\\ ublit_post_j src idx_src dst idx_dst j h0 h0))\n (ensures (fun h0 _ h1 -> ublit_post_j src idx_src dst idx_dst len h0 h1))\n = let open FStar.UInt32 in\n if j = len then ()\n else if j <^ len then begin\n uupd dst (idx_dst +^ j) (index src (idx_src +^ j));\n\t aux (j +^ 1ul)\n\tend\n in\n aux 0ul", "val malloca_and_blit (#a:Type0) (#rrel:srel a)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.StackInline (lmbuffer a rrel rrel (U32.v len))\n (requires fun h0 ->\n alloca_pre len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common b h0 h1\n (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len)) /\\\n frameOf b == HS.get_tip h0)\nlet malloca_and_blit #a #rrel #_ #_ src id_src len =\n lemma_seq_sub_compatilibity_is_reflexive (U32.v len) rrel;\n let content: HST.mreference (Seq.lseq a (U32.v len)) (srel_to_lsrel (U32.v len) rrel) =\n HST.salloc (read_sub_buffer src id_src len)\n in\n Buffer len content 0ul (Ghost.hide len)", "val new_fill (#t: Type) (b: New.buffer t) (z: t) (len: U32.t)\n : HST.Stack unit\n (requires (fun h -> New.live h b /\\ U32.v len <= New.length b))\n (ensures\n (fun h _ h' ->\n NewM.modifies (NewM.loc_buffer b) h h' /\\\n Seq.slice (New.as_seq h' b) 0 (U32.v len) == Seq.create (U32.v len) z /\\\n Seq.slice (New.as_seq h' b) (U32.v len) (New.length b) ==\n Seq.slice (New.as_seq h b) (U32.v len) (New.length b)))\nlet new_fill\n (#t: Type)\n (b: New.buffer t)\n (z: t)\n (len: U32.t)\n: HST.Stack unit\n (requires (fun h -> New.live h b /\\ U32.v len <= New.length b))\n (ensures (fun h _ h' ->\n NewM.modifies (NewM.loc_buffer b) h h' /\\\n Seq.slice (New.as_seq h' b) 0 (U32.v len) == Seq.create (U32.v len) z /\\\n Seq.slice (New.as_seq h' b) (U32.v len) (New.length b) == Seq.slice (New.as_seq h b) (U32.v len) (New.length b)\n ))\n= let b' = new_to_old_st b in\n Old.fill b' z len", "val fill_buffer_aux\n (#t: typ)\n (b: buffer t) (* destination *)\n (len: UInt32.t)\n (len': UInt32.t)\n (v: type_of_typ t)\n (h: Ghost.erased HS.mem)\n: HST.Stack unit\n (requires (fun h0 -> \n fill_buffer_inv b len' v (Ghost.reveal h) h0 /\\\n len == buffer_length b\n ))\n (ensures (fun h0 _ h1 ->\n fill_buffer_inv b len' v (Ghost.reveal h) h0 /\\\n fill_buffer_postcond' b v (Ghost.reveal h) h1\n ))\n (decreases (UInt32.v (buffer_length b) - UInt32.v len'))\nlet rec fill_buffer_aux #t b len len' v h =\n if len = len'\n then ()\n else begin\n fill_buffer_advance b len' v h;\n fill_buffer_aux b len (UInt32.add len' 1ul) v h\n end", "val lbuffer_malloc_copy (#a : Type0) (#len : size_t{size_v len > 0})\n (r : HS.rid) (init : a)\n (i : lbuffer a len) :\n ST (lbuffer a len)\n (requires (fun h0 ->\n live h0 i /\\\n ST.is_eternal_region r))\n (ensures (fun h0 o h1 ->\n let i : buffer a = i in\n let o : buffer a = o in\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (B.loc_buffer o) h0 h1 /\\\n B.(loc_includes (loc_region_only true r) (B.loc_addr_of_buffer o)) /\\\n B.freeable o /\\\n B.live h1 o /\\\n B.as_seq h1 o == B.as_seq h0 i))\nlet lbuffer_malloc_copy #a #len r init i =\n (**) let h0 = HST.get () in\n let o = B.malloc r init len in\n copy #MUT #a #len o i;\n (**) let h2 = HST.get () in\n (**) B.(modifies_only_not_unused_in loc_none h0 h2);\n o", "val buffer_copy:\n #a:Type ->\n #arg':Ghost.erased (a & nonzero) ->\n arg:(a & nonzero){ arg == Ghost.reveal arg' } ->\n src:B.buffer a -> dst:B.buffer a ->\n HST.ST unit\n (requires (fun h0 ->\n let len = snd arg in\n buffer_r_inv len h0 src /\\ buffer_r_inv len h0 dst /\\\n HS.disjoint (buffer_region_of src) (buffer_region_of dst)))\n (ensures (fun h0 _ h1 ->\n let len = snd arg in\n modifies (loc_all_regions_from false (buffer_region_of dst)) h0 h1 /\\\n buffer_r_inv len h1 dst /\\\n buffer_r_repr len h1 dst == buffer_r_repr len h0 src))\nlet buffer_copy #a #_ (ia, len) src dst =\n B.blit src 0ul dst 0ul len", "val store: #i:id -> l:UInt32.t -> buf: plainBuffer i (v l) -> b:plain i (v l) -> ST unit\n (requires (fun h0 -> live h0 buf))\n (ensures (fun h0 r h1 -> live h1 buf /\\ Buffer.modifies_1 (as_buffer #i #(v l) buf) h0 h1 /\\\n sel_plain h1 l buf == b\n ))\nlet store #i l buf b = store_bytes l buf b", "val from_seq (#a: _) (dst: B.buffer a) (s: S.seq a)\n : Stack unit\n (requires fun h0 -> B.live h0 dst /\\ B.length dst == S.length s)\n (ensures fun h0 _ h1 -> B.modifies (B.loc_buffer dst) h0 h1 /\\ (B.as_seq h1 dst) `S.equal` s)\nlet rec from_seq #a (dst: B.buffer a) (s: S.seq a): Stack unit\n (requires fun h0 ->\n B.live h0 dst /\\\n B.length dst == S.length s)\n (ensures fun h0 _ h1 ->\n B.modifies (B.loc_buffer dst) h0 h1 /\\\n B.as_seq h1 dst `S.equal` s)\n=\n if S.length s = 0 then\n ()\n else begin\n let hd = B.sub dst 0ul 1ul in\n let tl = B.sub dst 1ul (UInt32.uint_to_t (S.length s - 1)) in\n B.upd hd 0ul (S.index s 0);\n from_seq tl (S.slice s 1 (S.length s));\n let h1 = ST.get () in\n calc (S.equal) {\n B.as_seq h1 dst;\n (S.equal) { }\n S.append (S.slice (B.as_seq h1 hd) 0 1) (S.slice (B.as_seq h1 dst) 1 (S.length s));\n (S.equal) { }\n S.append (S.create 1 (S.index s 0)) (S.slice (B.as_seq h1 dst) 1 (S.length s));\n (S.equal) { }\n S.append (S.create 1 (S.index s 0)) (S.slice s 1 (S.length s));\n (S.equal) { }\n s;\n }\n end", "val lbuffer_or_unit_alloca (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (zero : a) :\n StackInline (type_or_unit (lbuffer a len) b)\n (requires (fun _ -> True))\n (ensures (fun h0 p h1 ->\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (lbuffer_or_unit_to_loc p) h0 h1 /\\\n B.(loc_includes (loc_region_only true (HS.get_tip h1)) (lbuffer_or_unit_to_loc p)) /\\\n B.live h1 (lbuffer_or_unit_to_buffer p)))\nlet lbuffer_or_unit_alloca #a #len #b zero =\n if b then B.alloca zero len else ()", "val ialloca_and_blit\n (#a: Type0)\n (#rrel1 #rel1: srel a)\n (src: mbuffer a rrel1 rel1)\n (id_src len: U32.t)\n : HST.StackInline (lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len))\n (requires fun h0 -> alloca_pre len /\\ live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures\n fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\ frameOf b == HS.get_tip h0 /\\ b `value_is` (G.hide s))\nlet ialloca_and_blit (#a:Type0)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.StackInline (lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len))\n (requires fun h0 ->\n alloca_pre len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\\n frameOf b == HS.get_tip h0 /\\\n b `value_is` G.hide s)\n = let b = malloca_and_blit src id_src len in\n let h0 = HST.get () in\n witness_p b (seq_eq (G.hide (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len))));\n b", "val sha256_4 (dst0 dst1 dst2 dst3: lbuffer uint8 32ul) (input_len:size_t) (input0 input1 input2 input3: lbuffer uint8 input_len) :\n Stack unit\n (requires fun h0 -> v input_len `less_than_max_input_length` SHA2_256 /\\\n live4 h0 input0 input1 input2 input3 /\\\n live4 h0 dst0 dst1 dst2 dst3 /\\\n internally_disjoint4 dst0 dst1 dst2 dst3)\n (ensures fun h0 _ h1 -> modifies (loc dst0 |+| loc dst1 |+| loc dst2 |+| loc dst3) h0 h1 /\\\n as_seq h1 dst0 == Spec.hash SHA2_256 (as_seq h0 input0) /\\\n as_seq h1 dst1 == Spec.hash SHA2_256 (as_seq h0 input1) /\\\n as_seq h1 dst2 == Spec.hash SHA2_256 (as_seq h0 input2) /\\\n as_seq h1 dst3 == Spec.hash SHA2_256 (as_seq h0 input3))\nlet sha256_4 dst0 dst1 dst2 dst3 input_len input0 input1 input2 input3 =\n let ib = ntup4 (input0,(input1,(input2,input3))) in\n let rb = ntup4 (dst0,(dst1,(dst2,dst3))) in\n let h0 = ST.get() in\n assert (live_multi h0 ib);\n assert (live_multi h0 rb);\n assert (internally_disjoint rb);\n loc_multi4 rb;\n hash #SHA2_256 #M128 sha256_init4 sha256_update_nblocks4 sha256_update_last4 sha256_finish4 rb input_len ib;\n let h1 = ST.get() in\n Hacl.Spec.SHA2.Equiv.hash_agile_lemma #SHA2_256 #M128 (v input_len) (as_seq_multi h0 ib);\n assert ((as_seq_multi h1 rb).(|0|) == as_seq h1 dst0);\n assert ((as_seq_multi h1 rb).(|1|) == as_seq h1 dst1);\n assert ((as_seq_multi h1 rb).(|2|) == as_seq h1 dst2);\n assert ((as_seq_multi h1 rb).(|3|) == as_seq h1 dst3)", "val sha3_224:\n output:lbuffer uint8 28ul\n -> input:buffer_t MUT uint8\n -> input_len:size_t{v input_len == length input}\n -> Stack unit\n (requires fun h ->\n live h input /\\ live h output /\\ disjoint input output)\n (ensures fun h0 _ h1 ->\n modifies (loc output) h0 h1 /\\\n as_seq h1 output ==\n S.sha3_224 (v input_len) (as_seq h0 (input <: lbuffer uint8 input_len)))\nlet sha3_224 output input input_len =\n keccak 1152ul 448ul input_len input (byte 0x06) 28ul output", "val fill (#t:Type) (#rrel #rel: srel t)\n (b: mbuffer t rrel rel)\n (z:t)\n (len:U32.t)\n: HST.Stack unit\n (requires (fun h ->\n live h b /\\\n U32.v len <= length b /\\\n rel (as_seq h b) (Seq.replace_subseq (as_seq h b) 0 (U32.v len) (Seq.create (U32.v len) z))\n ))\n (ensures (fun h0 _ h1 ->\n modifies (loc_buffer b) h0 h1 /\\\n live h1 b /\\\n Seq.slice (as_seq h1 b) 0 (U32.v len) == Seq.create (U32.v len) z /\\\n Seq.slice (as_seq h1 b) (U32.v len) (length b) == Seq.slice (as_seq h0 b) (U32.v len) (length b)\n ))\nlet fill #t #rrel #rel b z len = fill' b z len", "val va_qcode_Memcpy (va_mods: va_mods_t) (win: bool) (dst src: buffer64)\n : (va_quickCode unit (va_code_Memcpy win))\nlet va_qcode_Memcpy (va_mods:va_mods_t) (win:bool) (dst:buffer64) (src:buffer64) : (va_quickCode\n unit (va_code_Memcpy win)) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 67 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_CreateHeaplets ([declare_buffer64 src 0 Secret Immutable; declare_buffer64 dst 1\n Secret Mutable])) (fun (va_s:va_state) _ -> va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 71 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 73 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_InnerMemcpy dst src) (va_QEmpty (())))) (qblock va_mods (fun (va_s:va_state) ->\n va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 77 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 0 src 0 Secret)\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 77 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRax) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)\n (va_op_reg64_reg64 rRsi) 0 Secret)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 78 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Mem64_lemma (va_op_heaplet_mem_heaplet 0) (va_op_reg64_reg64 rRsi) 8 src 1 Secret)\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 78 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_opr_code_Mem64 (va_op_heaplet_mem_heaplet 0)\n (va_op_reg64_reg64 rRsi) 8 Secret)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 79 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)\n (va_op_reg_opr64_reg64 rRax) 0 Secret dst 0) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 80 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_Store64_buffer (va_op_heaplet_mem_heaplet 1) (va_op_reg_opr64_reg64 rRdi)\n (va_op_reg_opr64_reg64 rRcx) 8 Secret dst 1) (va_QEmpty (())))))))))) (fun (va_s:va_state) va_g\n -> va_qAssert va_range1\n \"***** PRECONDITION NOT MET AT line 82 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (FStar.Seq.Base.equal #(Vale.X64.Memory.base_typ_as_vale_type Vale.X64.Memory.vuint64)\n (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 1 va_s) dst)\n (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem_heaplet 0 va_s) src))\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 84 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))", "val sha3_256:\n output:lbuffer uint8 32ul\n -> input:buffer_t MUT uint8\n -> input_len:size_t{v input_len == length input}\n -> Stack unit\n (requires fun h ->\n live h input /\\ live h output /\\ disjoint input output)\n (ensures fun h0 _ h1 ->\n modifies (loc output) h0 h1 /\\\n as_seq h1 output ==\n S.sha3_256 (v input_len) (as_seq h0 (input <: lbuffer uint8 input_len)))\nlet sha3_256 output input input_len =\n keccak 1088ul 512ul input_len input (byte 0x06) 32ul output", "val store_big128:\n len:UInt32.t {v len <= 16} -> buf:lbuffer (v len) ->\n n:UInt128.t {UInt128.v n < pow2 (8 * v len)} -> Stack unit\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 ->\n Buffer.live h1 buf /\\ Buffer.modifies_1 buf h0 h1 /\\\n UInt128.v n == big_endian (sel_bytes h1 len buf)))\nlet rec store_big128 len buf n =\n if len <> 0ul then\n let len = len -^ 1ul in\n let b = uint128_to_uint8 n in\n let n1 = n in (* n defined in FStar.UInt128, so was shadowed, so renamed into n1 *)\n let n' = FStar.UInt128.(n1 >>^ 8ul) in\n assert(UInt128.v n = UInt8.v b + 256 * UInt128.v n');\n let buf' = Buffer.sub buf 0ul len in\n Math.Lemmas.pow2_plus 8 (8 * v len);\n assert_norm (pow2 8 == 256);\n store_big128 len buf' n';\n buf.(len) <- b", "val igcmalloc_and_blit\n (#a: Type0)\n (r: HS.rid)\n (#rrel1 #rel1: srel a)\n (src: mbuffer a rrel1 rel1)\n (id_src len: U32.t)\n : HST.ST\n (b: lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len) {frameOf b == r})\n (requires fun h0 -> malloc_pre r len /\\ live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures\n fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\ b `value_is` (G.hide s))\nlet igcmalloc_and_blit (#a:Type0) (r:HS.rid)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.ST (b:lmbuffer a (immutable_preorder a) (immutable_preorder a) (U32.v len){frameOf b == r})\n (requires fun h0 ->\n malloc_pre r len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n let s = Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len) in\n alloc_post_mem_common b h0 h1 s /\\\n b `value_is` G.hide s)\n = let b = mgcmalloc_and_blit r src id_src len in\n let h0 = HST.get () in\n witness_p b (seq_eq (G.hide (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len))));\n b", "val blit: #t:typ\n -> a:buffer t\n -> idx_a:UInt32.t\n -> b:buffer t{disjoint a b}\n -> idx_b:UInt32.t\n -> len:UInt32.t{UInt32.v idx_a + UInt32.v len <= length a /\\ UInt32.v idx_b + UInt32.v len <= length b}\n -> HST.Stack unit\n (requires (fun h -> live h a /\\ live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h0 a /\\ live h1 b /\\ live h1 a /\\ P.modifies (P.loc_buffer (gsub b idx_b len)) h0 h1\n /\\ Seq.slice (as_seq h1 b) (UInt32.v idx_b) (UInt32.v idx_b + UInt32.v len) ==\n Seq.slice (as_seq h0 a) (UInt32.v idx_a) (UInt32.v idx_a + UInt32.v len)\n /\\ Seq.slice (as_seq h1 b) 0 (UInt32.v idx_b) ==\n Seq.slice (as_seq h0 b) 0 (UInt32.v idx_b)\n /\\ Seq.slice (as_seq h1 b) (UInt32.v idx_b+UInt32.v len) (length b) ==\n Seq.slice (as_seq h0 b) (UInt32.v idx_b+UInt32.v len) (length b) ))\nlet blit #t a idx_a b idx_b len =\n if len = 0ul\n then ()\n else begin\n let h0 = HST.get () in\n P.copy_buffer_contents a idx_a b idx_b len;\n let h1 = HST.get () in\n P.buffer_readable_modifies_gsub b idx_b len h0 h1 (P.loc_buffer (P.gsub_buffer b idx_b len));\n assert (let g = (gsub b (UInt32.add idx_b len) (UInt32.sub (P.buffer_length b) (UInt32.add idx_b len))) in as_seq h1 g == as_seq h0 g);\n assert (as_seq h1 (gsub b idx_b len) == as_seq h0 (gsub a idx_a len));\n assert (let g = gsub b 0ul idx_b in as_seq h1 g == as_seq h0 g)\n end", "val store_state:\n b:lbuffer uint8 64ul\n -> st:state ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == Lib.ByteSequence.uints_to_bytes_le (as_seq h0 st))\nlet store_state st b =\n uints_to_bytes_le 16ul st b", "val store_state:\n b:lbuffer uint8 64ul\n -> st:state ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == Lib.ByteSequence.uints_to_bytes_le (as_seq h0 st))\nlet store_state st b =\n uints_to_bytes_le 16ul st b", "val fill: #t:Type\n -> b:buffer t\n -> z:t\n -> len:UInt32.t{v len <= length b}\n -> Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\ modifies_1 b h0 h1\n /\\ Seq.slice (as_seq h1 b) 0 (v len) == Seq.create (v len) z\n /\\ Seq.slice (as_seq h1 b) (v len) (length b) ==\n Seq.slice (as_seq h0 b) (v len) (length b) ))\nlet rec fill #t b z len =\n let h0 = HST.get () in\n if len =^ 0ul then ()\n else\n begin\n let len' = len -^ 1ul in\n fill #t b z len';\n b.(len') <- z;\n let h = HST.get() in\n Seq.snoc_slice_index (as_seq h b) 0 (v len');\n Seq.lemma_tail_slice (as_seq h b) (v len') (length b)\n end;\n let h1 = HST.get() in\n Seq.lemma_eq_intro (Seq.slice (as_seq h1 b) 0 (v len)) (Seq.create (v len) z)", "val lbuffer_or_unit_conditional_malloc_copy_relaxed\n (#a : Type0) (#len : size_t{size_v len > 0}) (#b1 : bool)\n (b2 : bool{b2 ==> b1})\n (r : HS.rid) (init : a)\n (i : type_or_unit (lbuffer a len) b1) :\n ST (type_or_unit (lbuffer a len) b2)\n (requires (fun h0 ->\n B.live h0 (lbuffer_or_unit_to_buffer i) /\\\n ST.is_eternal_region r))\n (ensures (fun h0 o h1 ->\n B.(modifies loc_none h0 h1) /\\\n B.(loc_includes (loc_region_only true r) (lbuffer_or_unit_to_loc o)) /\\\n lbuffer_or_unit_freeable o /\\\n B.live h1 (lbuffer_or_unit_to_buffer o) /\\\n (if b2 then lbuffer_or_unit_to_seq h1 o == lbuffer_or_unit_to_seq h0 i else True)))\nlet lbuffer_or_unit_conditional_malloc_copy_relaxed #a #len #b1 b2 r init i =\n if b2 then lbuffer_or_unit_malloc_copy #a #len #b1 r init i\n else (() <: type_or_unit (lbuffer a len) b2)", "val lbuffer_or_unit_live\n (#a: Type0)\n (#len: size_t)\n (#b: bool)\n (h: mem)\n (buf: type_or_unit (lbuffer a len) b)\n : GTot Type0\nlet lbuffer_or_unit_live (#a : Type0) (#len : size_t) (#b : bool)\n (h : mem) (buf : type_or_unit (lbuffer a len) b) : GTot Type0 =\n if b then live h (lbuffer_or_unit_to_buffer buf) else True", "val mmalloc_and_blit (#a:Type0) (#rrel:srel a) (r:HS.rid)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.ST (b:lmbuffer a rrel rrel (U32.v len){frameOf b == r /\\ freeable b})\n (requires fun h0 ->\n malloc_pre r len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common b h0 h1\n (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len)))\nlet mmalloc_and_blit #_ #_ r #_ #_ src id_src len =\n alloc_heap_common r len (read_sub_buffer src id_src len) true", "val zero_out (b: B.buffer uint32) (len: U32.t{U32.v len == B.length b})\n : HST.Stack unit\n (requires (fun h -> B.live h b))\n (ensures (fun h _ h' -> B.modifies (B.loc_buffer b) h h' /\\ B.live h' b))\nlet zero_out\n (b: B.buffer uint32)\n (len: U32.t { U32.v len == B.length b })\n: HST.Stack unit\n (requires (fun h -> B.live h b))\n (ensures (fun h _ h' -> B.modifies (B.loc_buffer b) h h' /\\ B.live h' b))\n= let h0 = HST.get () in\n C.Loops.for 0ul len (fun h _ -> B.live h b /\\ B.modifies (B.loc_buffer b) h0 h) (fun i -> B.upd b i (u32 0))", "val serialize_uint32_t\n (ok: bool)\n (x: uint32_t)\n (buf: uint8_p)\n (sz: uint32_t{B.len buf = sz})\n (pos: uint32_t)\n : HST.ST (bool & uint32_t)\n (requires (fun h0 -> B.live h0 buf))\n (ensures (fun h0 _ h1 -> modifies (B.loc_buffer buf) h0 h1))\nlet serialize_uint32_t (ok:bool) (x:uint32_t) (buf:uint8_p) (sz:uint32_t{B.len buf = sz}) (pos:uint32_t) : HST.ST (bool & uint32_t)\n (requires (fun h0 -> B.live h0 buf))\n (ensures (fun h0 _ h1 -> modifies (B.loc_buffer buf) h0 h1))\n= let ok, pos = serialize_uint16_t ok (Int.Cast.uint32_to_uint16 (U32.shift_right x 16ul)) buf sz pos in\n serialize_uint16_t ok (Int.Cast.uint32_to_uint16 x) buf sz pos", "val mgcmalloc_and_blit (#a:Type0) (#rrel:srel a) (r:HS.rid)\n (#rrel1 #rel1:srel a) (src:mbuffer a rrel1 rel1) (id_src:U32.t) (len:U32.t)\n : HST.ST (b:lmbuffer a rrel rrel (U32.v len){frameOf b == r /\\ recallable b})\n (requires fun h0 ->\n malloc_pre r len /\\\n live h0 src /\\ U32.v id_src + U32.v len <= length src)\n (ensures fun h0 b h1 ->\n alloc_post_mem_common b h0 h1\n (Seq.slice (as_seq h0 src) (U32.v id_src) (U32.v id_src + U32.v len)))\nlet mgcmalloc_and_blit #_ #_ r #_ #_ src id_src len =\n alloc_heap_common r len (read_sub_buffer src id_src len) false", "val sha224_4 (dst0 dst1 dst2 dst3: lbuffer uint8 28ul) (input_len:size_t) (input0 input1 input2 input3: lbuffer uint8 input_len) :\n Stack unit\n (requires fun h0 -> v input_len `less_than_max_input_length` SHA2_224 /\\\n live4 h0 input0 input1 input2 input3 /\\\n live4 h0 dst0 dst1 dst2 dst3 /\\\n internally_disjoint4 dst0 dst1 dst2 dst3)\n (ensures fun h0 _ h1 -> modifies (loc dst0 |+| loc dst1 |+| loc dst2 |+| loc dst3) h0 h1 /\\\n as_seq h1 dst0 == Spec.hash SHA2_224 (as_seq h0 input0) /\\\n as_seq h1 dst1 == Spec.hash SHA2_224 (as_seq h0 input1) /\\\n as_seq h1 dst2 == Spec.hash SHA2_224 (as_seq h0 input2) /\\\n as_seq h1 dst3 == Spec.hash SHA2_224 (as_seq h0 input3))\nlet sha224_4 dst0 dst1 dst2 dst3 input_len input0 input1 input2 input3 =\n let ib = ntup4 (input0,(input1,(input2,input3))) in\n let rb = ntup4 (dst0,(dst1,(dst2,dst3))) in\n let h0 = ST.get() in\n assert (live_multi h0 ib);\n assert (live_multi h0 rb);\n assert (internally_disjoint rb);\n loc_multi4 rb;\n hash #SHA2_224 #M128 sha224_init4 sha224_update_nblocks4 sha224_update_last4 sha224_finish4 rb input_len ib;\n let h1 = ST.get() in\n Hacl.Spec.SHA2.Equiv.hash_agile_lemma #SHA2_224 #M128 (v input_len) (as_seq_multi h0 ib);\n assert ((as_seq_multi h1 rb).(|0|) == as_seq h1 dst0);\n assert ((as_seq_multi h1 rb).(|1|) == as_seq h1 dst1);\n assert ((as_seq_multi h1 rb).(|2|) == as_seq h1 dst2);\n assert ((as_seq_multi h1 rb).(|3|) == as_seq h1 dst3)", "val buffer_snoc\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (v: type_of_typ t)\n: HST.Stack unit\n (requires (fun h ->\n UInt32.v i + UInt32.v len < UInt32.v (buffer_length b) /\\\n buffer_readable h (gsub_buffer b i len)\n ))\n (ensures (fun h _ h' ->\n UInt32.v i + UInt32.v len < UInt32.v (buffer_length b) /\\\n modifies (loc_pointer (gpointer_of_buffer_cell b (UInt32.add i len))) h h' /\\\n buffer_readable h' (gsub_buffer b i (UInt32.add len 1ul)) /\\\n buffer_as_seq h' (gsub_buffer b i (UInt32.add len 1ul)) == Seq.snoc (buffer_as_seq h (gsub_buffer b i len)) v\n ))\nlet buffer_snoc #t b i len v =\n let h = HST.get () in\n buffer_readable_gsub_elim h b i len;\n write_buffer b (UInt32.add i len) v;\n let h' = HST.get () in\n buffer_readable_gsub_intro h' b i (UInt32.add len 1ul);\n buffer_as_seq_gsub_buffer_snoc h' b i len;\n assert (Seq.index (buffer_as_seq h' b) (UInt32.v (UInt32.add i len)) == v)", "val lbuffer_or_unit_malloc (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (r : HS.rid) (init : a) :\n ST (type_or_unit (lbuffer a len) b)\n (requires (fun _ ->\n ST.is_eternal_region r))\n (ensures (fun h0 p h1 ->\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (lbuffer_or_unit_to_loc p) h0 h1 /\\\n B.(loc_includes (loc_region_only true r) (lbuffer_or_unit_to_loc p)) /\\\n lbuffer_or_unit_freeable p /\\\n B.live h1 (lbuffer_or_unit_to_buffer p)))\nlet lbuffer_or_unit_malloc #a #len #b r init =\n if b then B.malloc r init len else ()", "val vecs_store_le:\n #vt:v_inttype\n -> #w:width\n -> #len:size_t{v len * (numbytes vt * w) <= max_size_t}\n -> o:lbuffer uint8 (len *! (size (numbytes vt) *! size w))\n -> i:lbuffer (vec_t vt w) len ->\n Stack unit\n (requires fun h -> live h i /\\ live h o /\\ B.disjoint i o)\n (ensures fun h0 _ h1 ->\n modifies1 o h0 h1 /\\\n as_seq h1 o == vecs_to_bytes_le #vt #w #(v len) (as_seq h0 i))\nlet vecs_store_le #vt #w #len o i =\n let h0 = ST.get () in\n [@ inline_let]\n let a_spec (i:nat{i <= v len}) = unit in\n\n fill_blocks h0 (size (numbytes vt) *! size w) len o a_spec\n (fun _ _ -> ())\n (fun _ -> LowStar.Buffer.loc_none)\n (fun h -> vecs_to_bytes_le_f (as_seq h i))\n (fun j -> vec_store_le (sub o (j *! (size (numbytes vt) *! size w)) (size (numbytes vt) *! size w)) i.(j));\n\n norm_spec [delta_only [`%vecs_to_bytes_le]] (vecs_to_bytes_le (as_seq h0 i))", "val serialize_uint8_t\n (ok: bool)\n (x: uint8_t)\n (buf: uint8_p)\n (sz: uint32_t{B.len buf = sz})\n (pos: uint32_t)\n : HST.ST (bool & uint32_t)\n (requires (fun h0 -> B.live h0 buf))\n (ensures (fun h0 _ h1 -> modifies (B.loc_buffer buf) h0 h1))\nlet serialize_uint8_t (ok:bool) (x:uint8_t) (buf:uint8_p) (sz:uint32_t{B.len buf = sz}) (pos:uint32_t) : HST.ST (bool & uint32_t)\n (requires (fun h0 -> B.live h0 buf))\n (ensures (fun h0 _ h1 -> modifies (B.loc_buffer buf) h0 h1))\n= if not ok || pos >= sz then (false, 0ul)\n else begin B.upd buf pos x;\n (true, pos + 1ul)\n end", "val sha512_4 (dst0 dst1 dst2 dst3: lbuffer uint8 64ul) (input_len:size_t) (input0 input1 input2 input3: lbuffer uint8 input_len) :\n Stack unit\n (requires fun h0 -> v input_len `less_than_max_input_length` SHA2_512 /\\\n live4 h0 input0 input1 input2 input3 /\\\n live4 h0 dst0 dst1 dst2 dst3 /\\\n internally_disjoint4 dst0 dst1 dst2 dst3)\n (ensures fun h0 _ h1 -> modifies (loc dst0 |+| loc dst1 |+| loc dst2 |+| loc dst3) h0 h1 /\\\n as_seq h1 dst0 == Spec.hash SHA2_512 (as_seq h0 input0) /\\\n as_seq h1 dst1 == Spec.hash SHA2_512 (as_seq h0 input1) /\\\n as_seq h1 dst2 == Spec.hash SHA2_512 (as_seq h0 input2) /\\\n as_seq h1 dst3 == Spec.hash SHA2_512 (as_seq h0 input3))\nlet sha512_4 dst0 dst1 dst2 dst3 input_len input0 input1 input2 input3 =\n let ib = ntup4 (input0,(input1,(input2,input3))) in\n let rb = ntup4 (dst0,(dst1,(dst2,dst3))) in\n let h0 = ST.get() in\n assert (live_multi h0 ib);\n assert (live_multi h0 rb);\n assert (internally_disjoint rb);\n loc_multi4 rb;\n hash #SHA2_512 #M256 sha512_init4 sha512_update_nblocks4 sha512_update_last4 sha512_finish4 rb input_len ib;\n let h1 = ST.get() in\n Hacl.Spec.SHA2.Equiv.hash_agile_lemma #SHA2_512 #M256 (v input_len) (as_seq_multi h0 ib);\n assert ((as_seq_multi h1 rb).(|0|) == as_seq h1 dst0);\n assert ((as_seq_multi h1 rb).(|1|) == as_seq h1 dst1);\n assert ((as_seq_multi h1 rb).(|2|) == as_seq h1 dst2);\n assert ((as_seq_multi h1 rb).(|3|) == as_seq h1 dst3)", "val va_wpProof_Memcpy : win:bool -> dst:buffer64 -> src:buffer64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Memcpy win dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Memcpy win) ([va_Mod_mem_heaplet 1;\n va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0\n va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Memcpy win dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Memcpy (va_code_Memcpy win) va_s0 win dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_mem_layout va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64\n rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val sha256_8\n (dst0 dst1 dst2 dst3 dst4 dst5 dst6 dst7 : lbuffer uint8 32ul)\n (input_len:size_t) (input0 input1 input2 input3 input4 input5 input6 input7 : lbuffer uint8 input_len) :\n Stack unit\n (requires fun h0 -> v input_len `less_than_max_input_length` SHA2_256 /\\\n live8 h0 input0 input1 input2 input3 input4 input5 input6 input7 /\\\n live8 h0 dst0 dst1 dst2 dst3 dst4 dst5 dst6 dst7 /\\\n internally_disjoint8 dst0 dst1 dst2 dst3 dst4 dst5 dst6 dst7)\n (ensures fun h0 _ h1 ->\n modifies (loc dst0 |+| (loc dst1 |+| (loc dst2 |+| (loc dst3 |+| (loc dst4 |+| (loc dst5 |+| (loc dst6 |+| loc dst7))))))) h0 h1 /\\\n as_seq h1 dst0 == Spec.hash SHA2_256 (as_seq h0 input0) /\\\n as_seq h1 dst1 == Spec.hash SHA2_256 (as_seq h0 input1) /\\\n as_seq h1 dst2 == Spec.hash SHA2_256 (as_seq h0 input2) /\\\n as_seq h1 dst3 == Spec.hash SHA2_256 (as_seq h0 input3) /\\\n as_seq h1 dst4 == Spec.hash SHA2_256 (as_seq h0 input4) /\\\n as_seq h1 dst5 == Spec.hash SHA2_256 (as_seq h0 input5) /\\\n as_seq h1 dst6 == Spec.hash SHA2_256 (as_seq h0 input6) /\\\n as_seq h1 dst7 == Spec.hash SHA2_256 (as_seq h0 input7))\nlet sha256_8 dst0 dst1 dst2 dst3 dst4 dst5 dst6 dst7 input_len input0 input1 input2 input3 input4 input5 input6 input7 =\n let ib = ntup8 (input0,(input1,(input2,(input3,(input4,(input5,(input6,input7))))))) in\n let rb = ntup8 (dst0,(dst1,(dst2,(dst3,(dst4,(dst5,(dst6,dst7))))))) in\n let h0 = ST.get() in\n assert (live_multi h0 ib);\n assert (live_multi h0 rb);\n assert (internally_disjoint rb);\n loc_multi8 rb;\n hash #SHA2_256 #M256 sha256_init8 sha256_update_nblocks8 sha256_update_last8 sha256_finish8 rb input_len ib;\n let h1 = ST.get() in\n Hacl.Spec.SHA2.Equiv.hash_agile_lemma #SHA2_256 #M256 (v input_len) (as_seq_multi h0 ib);\n assert ((as_seq_multi h1 rb).(|0|) == as_seq h1 dst0);\n assert ((as_seq_multi h1 rb).(|1|) == as_seq h1 dst1);\n assert ((as_seq_multi h1 rb).(|2|) == as_seq h1 dst2);\n assert ((as_seq_multi h1 rb).(|3|) == as_seq h1 dst3);\n assert ((as_seq_multi h1 rb).(|4|) == as_seq h1 dst4);\n assert ((as_seq_multi h1 rb).(|5|) == as_seq h1 dst5);\n assert ((as_seq_multi h1 rb).(|6|) == as_seq h1 dst6);\n assert ((as_seq_multi h1 rb).(|7|) == as_seq h1 dst7)", "val xor_bytes_inplace:\n a: B.buffer uint8 ->\n b: B.buffer uint8 ->\n len: UInt32.t {v len = B.length a /\\ v len = B.length b} ->\n Stack unit\n (requires fun h0 -> B.disjoint a b /\\ B.live h0 a /\\ B.live h0 b)\n (ensures fun h0 _ h1 ->\n B.(modifies (loc_buffer a) h0 h1) /\\\n B.as_seq h1 a == Spec.Loops.seq_map2 ( ^. ) (B.as_seq h0 a) (B.as_seq h0 b))\nlet xor_bytes_inplace a b len =\n C.Loops.in_place_map2 a b len ( ^. )", "val unchanged_lbuffer_or_null (#a: Type0) (#len: size_t) (b: lbuffer_or_null a len) (h0 h1: mem)\n : Type0\nlet unchanged_lbuffer_or_null (#a : Type0) (#len : size_t) (b : lbuffer_or_null a len)\n (h0 h1 : mem) : Type0 =\n if g_is_null b then True\n else let b' : lbuffer a len = b in h1.[|b'|] `S.equal` h0.[|b'|]", "val sha3_512:\n output:lbuffer uint8 64ul\n -> input:buffer_t MUT uint8\n -> input_len:size_t{v input_len == length input}\n -> Stack unit\n (requires fun h ->\n live h input /\\ live h output /\\ disjoint input output)\n (ensures fun h0 _ h1 ->\n modifies (loc output) h0 h1 /\\\n as_seq h1 output ==\n S.sha3_512 (v input_len) (as_seq h0 (input <: lbuffer uint8 input_len)))\nlet sha3_512 output input input_len =\n keccak 576ul 1024ul input_len input (byte 0x06) 64ul output", "val xor_bytes_inplace: output:bytes -> in1:bytes{disjoint in1 output} ->\n len:u32{v len <= length output /\\ v len <= length in1} -> STL unit\n (requires (fun h -> live h output /\\ live h in1))\n (ensures (fun h0 _ h1 -> live h0 output /\\ live h0 in1 /\\ live h1 output /\\ live h1 in1\n /\\ modifies_1 output h0 h1 ))\nlet xor_bytes_inplace output in1 len =\n let h0 = ST.get() in\n C.Compat.Loops.for 0ul len (fun h1 i -> live h1 output /\\ live h1 in1 /\\ modifies_1 output h0 h1)\n (fun i -> let ibyte = index in1 i in\n let obyte = index output i in\n let obyte' = UInt8.logxor ibyte obyte in\n output.(i) <- obyte')", "val clear_words_u8:\n #len:size_t\n -> b:lbytes len\n -> Stack unit\n (requires fun h -> live h b)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1)\nlet clear_words_u8 #len b =\n memzero #uint8 b len", "val drop\n (#len: Ghost.erased U32.t)\n (sl: input_buffer_t len)\n (from: Ghost.erased U32.t)\n (to: Ghost.erased U32.t { U32.v from <= U32.v to /\\ U32.v to <= U32.v (slice_of sl).LPL.len })\n (perm_of: R.perm (slice_of sl).base)\n: HST.Stack unit\n (requires (fun h ->\n R.readable h perm_of from to\n ))\n (ensures (fun h _ h' ->\n B.modifies (R.loc_perm perm_of) h h' /\\\n live_input_buffer h' sl perm_of /\\\n R.preserved perm_of 0ul from h h' /\\\n R.preserved perm_of to (B.len (slice_of sl).LPL.base) h h' /\\\n R.unreadable h' perm_of from to\n ))\nlet drop #len base from to perm_of =\n R.drop #byte #base perm_of from to", "val blit (#a:Type0) (#rrel1 #rrel2 #rel1 #rel2:srel a)\n (src:mbuffer a rrel1 rel1)\n (idx_src:U32.t)\n (dst:mbuffer a rrel2 rel2)\n (idx_dst:U32.t)\n (len:U32.t)\n :HST.Stack unit (requires (fun h -> live h src /\\ live h dst /\\\n U32.v idx_src + U32.v len <= length src /\\\n U32.v idx_dst + U32.v len <= length dst /\\\n (* TODO: remove the rhs part of this disjunction once patterns on loc_buffer_from_to are introduced *)\n (loc_disjoint (loc_buffer_from_to src idx_src (idx_src `U32.add` len)) (loc_buffer_from_to dst idx_dst (idx_dst `U32.add` len)) \\/ disjoint src dst) /\\\n\t\t\t\t rel2 (as_seq h dst)\n\t\t\t\t (Seq.replace_subseq (as_seq h dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len)\n\t\t\t\t\t (Seq.slice (as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len)))))\n (ensures (fun h _ h' -> modifies (loc_buffer dst) h h' /\\\n live h' dst /\\\n Seq.slice (as_seq h' dst) (U32.v idx_dst) (U32.v idx_dst + U32.v len) ==\n Seq.slice (as_seq h src) (U32.v idx_src) (U32.v idx_src + U32.v len) /\\\n Seq.slice (as_seq h' dst) 0 (U32.v idx_dst) ==\n Seq.slice (as_seq h dst) 0 (U32.v idx_dst) /\\\n Seq.slice (as_seq h' dst) (U32.v idx_dst + U32.v len) (length dst) ==\n Seq.slice (as_seq h dst) (U32.v idx_dst + U32.v len) (length dst)))\nlet blit #a #rrel1 #rrel2 #rel1 #rel2 src idx_src dst idx_dst len =\n let open HST in\n match src, dst with\n | Buffer _ _ _ _, Buffer _ _ _ _ ->\n if len = 0ul then ()\n else\n let h = get () in\n let Buffer max_length1 content1 idx1 length1 = src in\n let Buffer max_length2 content2 idx2 length2 = dst in\n let s_full1 = !content1 in\n let s_full2 = !content2 in\n let s1 = Seq.slice s_full1 (U32.v idx1) (U32.v max_length1) in\n let s2 = Seq.slice s_full2 (U32.v idx2) (U32.v max_length2) in\n let s_sub_src = Seq.slice s1 (U32.v idx_src) (U32.v idx_src + U32.v len) in\n let s2' = Seq.replace_subseq s2 (U32.v idx_dst) (U32.v idx_dst + U32.v len) s_sub_src in\n let s_full2' = Seq.replace_subseq s_full2 (U32.v idx2) (U32.v max_length2) s2' in\n\n assert (Seq.equal (Seq.slice s2' (U32.v idx_dst) (U32.v idx_dst + U32.v len)) s_sub_src);\n assert (Seq.equal (Seq.slice s2' 0 (U32.v idx_dst)) (Seq.slice s2 0 (U32.v idx_dst)));\n assert (Seq.equal (Seq.slice s2' (U32.v idx_dst + U32.v len) (length dst))\n (Seq.slice s2 (U32.v idx_dst + U32.v len) (length dst)));\n\n // AF: Needed to trigger the preorder relation. A bit verbose because the second sequence\n // has a ghost computation (U32.v (Ghost.reveal length))\n assert (s_full2' `Seq.equal`\n Seq.replace_subseq s_full2\n (U32.v idx2)\n (U32.v idx2 + U32.v length2)\n (Seq.replace_subseq (as_seq h dst)\n (U32.v idx_dst)\n (U32.v idx_dst + U32.v len)\n\t\t\t (Seq.slice (as_seq h src)\n (U32.v idx_src)\n (U32.v idx_src + U32.v len)\n )\n )\n );\n\n content2 := s_full2';\n\n let h1 = get () in\n assert (s_full2' `Seq.equal` Seq.replace_subseq s_full2 (U32.v idx2) (U32.v idx2 + U32.v length2) (Seq.slice s2' 0 (U32.v length2)));\n assert (h1 == g_upd_seq dst (Seq.slice s2' 0 (U32.v length2)) h);\n g_upd_seq_as_seq dst (Seq.slice s2' 0 (U32.v length2)) h //for modifies clause\n | _, _ -> ()", "val lbuffer_or_unit_free (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (buf : type_or_unit (lbuffer a len) b) :\n ST unit\n (requires (fun h0 ->\n B.live h0 (lbuffer_or_unit_to_buffer buf) /\\\n lbuffer_or_unit_freeable buf))\n (ensures (fun h0 _ h1 ->\n B.modifies (lbuffer_or_unit_to_loc buf) h0 h1))\nlet lbuffer_or_unit_free #a #len #b buf =\n if b then B.free (lbuffer_or_unit_to_buffer buf) else ()", "val blit_ptr (#t:_) (#p0:perm) (#s0 #s1:Ghost.erased (Seq.seq t))\n (src:ptr t)\n (len_src: Ghost.erased nat { offset src + len_src <= base_len (base src) })\n (idx_src: US.t)\n (dst:ptr t)\n (len_dst: Ghost.erased nat { offset dst + len_dst <= base_len (base dst) })\n (idx_dst: US.t)\n (len: US.t)\n : ST unit\n (pts_to (| src, len_src |) p0 s0 `star` pts_to (| dst, len_dst |) full_perm s1)\n (fun _ -> pts_to (| src, len_src |) p0 s0 `star` exists_ (fun s1' ->\n pts_to (| dst, len_dst |) full_perm s1' `star`\n pure (blit_post s0 s1 (| src, len_src |) idx_src (| dst, len_dst |) idx_dst len s1')\n ))\n (\n US.v idx_src + US.v len <= len_src /\\\n US.v idx_dst + US.v len <= len_dst\n )\n (fun _ -> True)\nlet blit_ptr\n src len_src idx_src dst len_dst idx_dst len\n= blit0 _ idx_src _ idx_dst len", "val vecs_load_le:\n #vt:v_inttype\n -> #w:width\n -> #len:size_t{v len * (numbytes vt * w) <= max_size_t}\n -> o:lbuffer (vec_t vt w) len\n -> i:lbuffer uint8 (len *! (size (numbytes vt) *! size w)) ->\n Stack unit\n (requires fun h -> live h i /\\ live h o /\\ B.disjoint i o)\n (ensures fun h0 _ h1 ->\n modifies1 o h0 h1 /\\\n as_seq h1 o == vecs_from_bytes_le vt w (v len) (as_seq h0 i))\nlet vecs_load_le #vt #w #len o i =\n let h0 = ST.get () in\n fill h0 len o\n (fun h -> vecs_from_bytes_le_f vt w (v len) (as_seq h i))\n (fun j ->\n let h = ST.get () in\n let bj = sub i (j *! (size (numbytes vt) *! size w)) (size (numbytes vt) *! size w) in\n let r = vec_load_le vt w bj in\n as_seq_gsub h i (j *! (size (numbytes vt) *! size w)) (size (numbytes vt) *! size w);\n r);\n let h1 = ST.get () in\n eq_intro (as_seq h1 o) (vecs_from_bytes_le vt w (v len) (as_seq h0 i))", "val load_bytes: l:UInt32.t -> buf:lbuffer (v l) -> Stack (lbytes (v l))\n (requires (fun h0 -> Buffer.live h0 buf))\n (ensures (fun h0 r h1 -> h0 == h1 /\\ Buffer.live h0 buf /\\\n Seq.equal r (sel_bytes h1 l buf)))\nlet rec load_bytes l buf =\n if l = 0ul then\n Seq.empty\n else\n let b = Buffer.index buf 0ul in\n let t = load_bytes (l -^ 1ul) (Buffer.sub buf 1ul (l -^ 1ul)) in\n Seq.cons b t", "val ualloca (#a: Type0) (len: U32.t)\n : HST.StackInline (lubuffer a (U32.v len))\n (requires (fun _ -> alloca_pre len))\n (ensures\n (fun h0 b h1 ->\n alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) None) /\\\n frameOf b == HS.get_tip h0))\nlet ualloca (#a:Type0) (len:U32.t)\n :HST.StackInline (lubuffer a (U32.v len))\n (requires (fun _ -> alloca_pre len))\n (ensures (fun h0 b h1 -> alloc_post_mem_common b h0 h1 (Seq.create (U32.v len) None) /\\\n\t\t frameOf b == HS.get_tip h0))\n = malloca None len", "val fill_buffer\n (#t: typ)\n (b: buffer t) (* destination *)\n (idx_b: UInt32.t)\n (len: UInt32.t)\n (v: type_of_typ t)\n: HST.Stack unit\n (requires (fun h ->\n fill_buffer_precond b idx_b len h\n ))\n (ensures (fun h0 _ h1 ->\n fill_buffer_postcond b idx_b len v h0 h1\n ))\nlet fill_buffer = fill_buffer'", "val deserialize_uint8_t\n (ok: bool)\n (buf: const_uint8_p)\n (sz: uint32_t{CB.length buf = U32.v sz})\n (pos: uint32_t)\n : HST.ST (bool & uint32_t & uint8_t)\n (requires (fun h0 -> CB.live h0 buf))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet deserialize_uint8_t (ok:bool) (buf:const_uint8_p) (sz:uint32_t{CB.length buf = U32.v sz}) (pos:uint32_t): HST.ST (bool & uint32_t & uint8_t)\n (requires (fun h0 -> CB.live h0 buf))\n (ensures (fun h0 _ h1 -> h0 == h1))\n= if not ok || pos >= sz then (false, pos, 0uy)\n else (true, pos + 1ul, CB.index buf pos)" ], "closest_src": [ { "project_name": "FStar", "file_name": "Demo.fst", "name": "Demo.memcpy" }, { "project_name": "FStar", "file_name": "Demo.fst", "name": "Demo.copy3" }, { "project_name": "FStar", "file_name": "Demo.fst", "name": "Demo.copy2" }, { "project_name": "FStar", "file_name": "Demo.fst", "name": "Demo.malloc_copy_free" }, { "project_name": "merkle-tree", "file_name": "Lib.RawBuffer.fst", "name": "Lib.RawBuffer.blit" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.fst", "name": "Pulse.Lib.Array.memcpy" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fst", "name": "FStar.Pointer.Derived2.copy_buffer_contents_advance" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Buffer.Utils.fst", "name": "MiTLS.Buffer.Utils.memset" }, { "project_name": "karamel", "file_name": "WasmSupport.fst", "name": "WasmSupport.memzero" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fst", "name": "FStar.Pointer.Derived2.copy_buffer_contents" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fst", "name": "FStar.Pointer.Derived2.copy_buffer_contents_aux" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.update_sub_opt" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_memcpy" }, { "project_name": "hacl-star", "file_name": "Lib.ByteBuffer.fst", "name": "Lib.ByteBuffer.lbytes_eq" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.new_blit" }, { "project_name": "everparse", "file_name": "LowParse.Low.Bytes.fst", "name": "LowParse.Low.Bytes.store_bytes" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.load_uint32" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.fill'" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_uint32" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_malloc_copy" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Random.fst", "name": "MiTLS.Random.sample" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.PadFinish.fst", "name": "Hacl.Hash.PadFinish.pad_2" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_bytes_aux" }, { "project_name": "noise-star", "file_name": "Impl.Noise.HandshakeState.fst", "name": "Impl.Noise.HandshakeState.update_sub_opt" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_copy" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.malloc1" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_bytes" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.PadFinish.fst", "name": "Hacl.Hash.PadFinish.pad_1" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.update_nn" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.VectorExtras.fst", "name": "MerkleTree.Low.VectorExtras.move_left" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_big32" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.Padding.fst", "name": "Hacl.Impl.RSAPSS.Padding.xor_bytes" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.fill" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fst", "name": "FStar.Pointer.Derived2.copy_buffer_contents'" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.malloc_gen" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.alloc_by_buffer" }, { "project_name": "FStar", "file_name": "LowStar.PrefixFreezableBuffer.fst", "name": "LowStar.PrefixFreezableBuffer.alloca" }, { "project_name": "merkle-tree", "file_name": "Lib.RawBuffer.fst", "name": "Lib.RawBuffer.lbytes_eq" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.imalloc_and_blit" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.suffix" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.suffix" }, { "project_name": "FStar", "file_name": "LowStar.PrefixFreezableBuffer.fst", "name": "LowStar.PrefixFreezableBuffer.malloc" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.fst", "name": "LowParse.Low.Base.blit_strong" }, { "project_name": "noise-star", "file_name": "Impl.Noise.BufferEquality.fst", "name": "Impl.Noise.BufferEquality.lbytes_eq" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.load_big32" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived3.fst", "name": "FStar.Pointer.Derived3.fill_buffer_advance" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_uint128" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.malloc" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.malloc" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fsti", "name": "Vale.Test.X64.Vale_memcpy.va_quick_Memcpy" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.load_uint128" }, { "project_name": "FStar", "file_name": "LowStar.UninitializedBuffer.fst", "name": "LowStar.UninitializedBuffer.ublit" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.malloca_and_blit" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.new_fill" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived3.fst", "name": "FStar.Pointer.Derived3.fill_buffer_aux" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_malloc_copy" }, { "project_name": "FStar", "file_name": "LowStar.Regional.Instances.fst", "name": "LowStar.Regional.Instances.buffer_copy" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Plain.fst", "name": "MiTLS.Crypto.Plain.store" }, { "project_name": "everquic-crypto", "file_name": "QUIC.fst", "name": "QUIC.from_seq" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_alloca" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.ialloca_and_blit" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Vec128.fst", "name": "Hacl.SHA2.Vec128.sha256_4" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA3.fst", "name": "Hacl.SHA3.sha3_224" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.fill" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fst", "name": "Vale.Test.X64.Vale_memcpy.va_qcode_Memcpy" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA3.fst", "name": "Hacl.SHA3.sha3_256" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.store_big128" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.igcmalloc_and_blit" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.blit" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32.fst", "name": "Hacl.Impl.Chacha20.Core32.store_state" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Salsa20.Core32.fst", "name": "Hacl.Impl.Salsa20.Core32.store_state" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.fill" }, { "project_name": "noise-star", "file_name": "Impl.Noise.API.DState.fst", "name": "Impl.Noise.API.DState.lbuffer_or_unit_conditional_malloc_copy_relaxed" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fsti", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_live" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.mmalloc_and_blit" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Core.SHA1.fst", "name": "Hacl.Hash.Core.SHA1.zero_out" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.serialize_uint32_t" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.mgcmalloc_and_blit" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Vec128.fst", "name": "Hacl.SHA2.Vec128.sha224_4" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.buffer_snoc" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_malloc" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.Serialize.fst", "name": "Lib.IntVector.Serialize.vecs_store_le" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.serialize_uint8_t" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Vec256.fst", "name": "Hacl.SHA2.Vec256.sha512_4" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fst", "name": "Vale.Test.X64.Vale_memcpy.va_wpProof_Memcpy" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Vec256.fst", "name": "Hacl.SHA2.Vec256.sha256_8" }, { "project_name": "hacl-star", "file_name": "Hacl.HMAC.fst", "name": "Hacl.HMAC.xor_bytes_inplace" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.unchanged_lbuffer_or_null" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA3.fst", "name": "Hacl.SHA3.sha3_512" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Buffer.Utils.fst", "name": "MiTLS.Buffer.Utils.xor_bytes_inplace" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Frodo.KEM.fst", "name": "Hacl.Impl.Frodo.KEM.clear_words_u8" }, { "project_name": "everparse", "file_name": "EverParse3d.InputBuffer.fst", "name": "EverParse3d.InputBuffer.drop" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.blit" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_free" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.blit_ptr" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.Serialize.fst", "name": "Lib.IntVector.Serialize.vecs_load_le" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.load_bytes" }, { "project_name": "FStar", "file_name": "LowStar.UninitializedBuffer.fst", "name": "LowStar.UninitializedBuffer.ualloca" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived3.fst", "name": "FStar.Pointer.Derived3.fill_buffer" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.deserialize_uint8_t" } ], "selected_premises": [ "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "LowStar.Buffer.gcmalloc_of_list", "OPLSS2021.MemCpy.Deps.uint32", "LowStar.Monotonic.Buffer.srel", "FStar.UInt.size", "OPLSS2021.MemCpy.Deps.uint8", "FStar.Mul.op_Star", "OPLSS2021.MemCpy.Deps.length", "FStar.Heap.trivial_preorder", "OPLSS2021.MemCpy.Deps.get", "LowStar.Monotonic.Buffer.upd", "OPLSS2021.MemCpy.Deps.live", "FStar.Pervasives.reveal_opaque", "OPLSS2021.MemCpy.Deps.suffix", "FStar.Monotonic.HyperStack.sel", "LowStar.Monotonic.Buffer.get", "OPLSS2021.MemCpy.Deps.lbuffer", "FStar.Pervasives.Native.fst", "LowStar.Monotonic.Buffer.deref", "LowStar.Monotonic.Buffer.lmbuffer", "FStar.Pervasives.Native.snd", "LowStar.Monotonic.Buffer.loc_addr_of_buffer", "OPLSS2021.MemCpy.Deps.free", "LowStar.Buffer.null", "OPLSS2021.MemCpy.Deps.disjoint", "LowStar.Monotonic.Buffer.disjoint", "FStar.Monotonic.HyperStack.live_region", "OPLSS2021.MemCpy.Deps.prefix_equal", "OPLSS2021.MemCpy.Deps.malloc", "LowStar.Monotonic.Buffer.loc_all_regions_from", "OPLSS2021.MemCpy.Deps.modifies", "LowStar.Monotonic.Buffer.loc_region_only", "FStar.Pervasives.dfst", "LowStar.Buffer.alloca", "FStar.Monotonic.HyperStack.mreference", "FStar.HyperStack.ST.is_eternal_region", "LowStar.Buffer.malloc", "FStar.Pervasives.dsnd", "OPLSS2021.MemCpy.Deps.buffer", "LowStar.Monotonic.Buffer.fresh_loc", "LowStar.Buffer.sub", "FStar.Monotonic.HyperStack.is_heap_color", "LowStar.Monotonic.Buffer.includes", "FStar.Math.Lemmas.pow2_plus", "LowStar.Monotonic.Buffer.compatible_subseq_preorder", "FStar.Monotonic.HyperStack.as_addr", "FStar.HyperStack.ST.gst_post", "LowStar.Monotonic.Buffer.rrel_rel_always_compatible", "FStar.HyperStack.ST.gst_post'", "FStar.Monotonic.HyperStack.frameOf", "LowStar.Monotonic.Buffer.g_upd", "LowStar.Buffer.gcmalloc", "FStar.HyperStack.ST.st_post", "FStar.Monotonic.HyperStack.is_stack_region", "LowStar.Monotonic.Buffer.lmbuffer_or_null", "FStar.HyperStack.ST.st_post'", "FStar.BigOps.normal", "FStar.HyperStack.ST.gst_pre", "LowStar.Buffer.gsub", "OPLSS2021.MemCpy.Deps.modifies_only_not_unused_in", "LowStar.Buffer.alloca_of_list", "LowStar.Monotonic.Buffer.compatible_sub", "FStar.Math.Lemmas.pow2_lt_compat", "OPLSS2021.MemCpy.Deps.op_Subtraction", "FStar.HyperStack.ST.gst_wp", "FStar.Math.Lemmas.pow2_le_compat", "LowStar.Buffer.lbuffer", "LowStar.Monotonic.Buffer.alloc_drgn_pre", "LowStar.Buffer.offset", "LowStar.Monotonic.Buffer.spred", "FStar.HyperStack.ST.st_wp", "FStar.HyperStack.ST.st_pre", "LowStar.Monotonic.Buffer.all_live", "LowStar.Monotonic.Buffer.stable_on", "FStar.Pervasives.st_pre_h", "LowStar.Monotonic.Buffer.buf_t", "LowStar.Buffer.assign_list_t", "FStar.UInt32.lt", "FStar.UInt8.lt", "FStar.Pervasives.st_post_h", "FStar.Pervasives.st_post_h'", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperStack.contains", "LowStar.Monotonic.Buffer.buf", "FStar.Pervasives.st_return", "FStar.Monotonic.HyperStack.modifies_one", "LowStar.Monotonic.Buffer.mmalloc_partial", "FStar.UInt.max_int", "LowStar.Buffer.gsub_inj", "FStar.UInt8.op_Subtraction_Hat", "FStar.UInt32.op_Subtraction_Hat", "FStar.UInt32.op_Plus_Hat", "FStar.UInt8.op_Plus_Hat", "FStar.UInt32.op_Star_Hat", "FStar.UInt8.op_Star_Hat", "LowStar.Monotonic.Buffer.mgcmalloc_partial", "FStar.UInt.to_vec", "FStar.Pervasives.st_trivial", "FStar.Pervasives.st_ite_wp" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule OPLSS2021.MemCpy\nopen FStar.HyperStack.ST\nopen LowStar.Buffer\nopen OPLSS2021.MemCpy.Deps\nmodule B = LowStar.Buffer\n#push-options \"--fuel 0 --ifuel 0\"\n\n/// Copy bytes from src to dest", "sketch": [ "The definition is about a function called memcpy that copies a specified number of bytes from a source buffer to a destination buffer. The function has preconditions to ensure that the source and destination buffers are live, disjoint, and that the source buffer is a prefix of the destination buffer up to a certain index.\n\nThe implementation of the memcpy function involves specifying the length of the bytes to be copied, the current index within the source buffer, and the source and destination buffers. The function ensures that the destination buffer is modified, and that the prefix of the destination buffer from the current index to the end is equal to the source buffer.", "The definition is about a function called memcpy that copies bytes from a source buffer to a destination buffer. It takes the length of the data to be copied, the current position in the source buffer, and the source and destination buffers as input.\n\nThe implementation involves ensuring that the source and destination buffers are live and disjoint, and that the source buffer is a prefix of the destination buffer up to the current position. After the copy operation, the function should modify the destination buffer and ensure that the copied data in the destination buffer matches the source buffer up to the specified length.", "The definition is about a function called memcpy that copies a specified number of bytes from a source buffer to a destination buffer.\n\nThe implementation involves specifying the length of the data to be copied, the current position within the source buffer, and the source and destination buffers. The function should ensure that the source and destination buffers are live, disjoint, and that the prefix of the source buffer up to the current position is equal to the corresponding prefix of the destination buffer. The function should also modify the destination buffer and ensure that the prefix of the destination buffer after the operation is equal to the entire source buffer.", "The definition is about a function called memcpy that copies a specified number of bytes from a source buffer to a destination buffer. The function has preconditions to ensure that the source and destination buffers are live, disjoint, and that the source buffer is a prefix of the destination buffer up to a certain index.\n\nThe implementation of the memcpy function involves specifying the length of the bytes to be copied, the current index within the source buffer, and the source and destination buffers. The function should ensure that the destination buffer is modified, and that the prefix of the destination buffer from the initial index to the end matches the source buffer.", "The definition is about a function called memcpy that copies bytes from a source buffer to a destination buffer. The function takes the length of the data to be copied, the current position in the source buffer, and the source and destination buffers as input.\n\nThe implementation involves ensuring that the source and destination buffers are live and disjoint, and that the prefix of the source buffer up to the current position matches the corresponding prefix in the destination buffer. The function should modify the destination buffer and ensure that the prefix of the destination buffer matches the entire source buffer after the copy.", "The definition is about a function called memcpy, which copies a specified number of bytes from a source buffer to a destination buffer.\n\nThe implementation involves specifying the length of the data to be copied, the current position within the source buffer, and the source and destination buffers. The function needs to ensure that the source and destination buffers are live, disjoint, and that the prefix of the destination buffer matches the source buffer up to the current position.", "The definition is about a function called memcpy that copies a specified number of bytes from a source buffer to a destination buffer. The function has preconditions to ensure that the buffers are live, disjoint, and that the source buffer is a prefix of the destination buffer up to a certain index.\n\nThe implementation of the memcpy function involves using the ST monad to perform the memory copy operation. It takes the length of the data to be copied, the current index within the buffers, and the source and destination buffers as input. The function ensures that the destination buffer is modified as a result of the copy operation and that the prefix relationship between the source and destination buffers is maintained.", "The definition is about a function called memcpy that copies bytes from a source buffer to a destination buffer.\n\nStep 1: The memcpy function takes the length of the data to be copied, the current position in the source buffer, and the source and destination buffers as input parameters.\n\nStep 2: The memcpy function ensures that the source and destination buffers are live, disjoint, and have a prefix equal to the current position. It also modifies the destination buffer and ensures that the prefix of the destination buffer is equal to the entire source buffer after the copy operation.", "The definition is about a function called memcpy that copies a specified number of bytes from a source buffer to a destination buffer. The function has preconditions to ensure that the buffers are live, disjoint, and that the source buffer is a prefix of the destination buffer up to a certain index.\n\nThe implementation of the memcpy function involves specifying the length of the bytes to be copied, the current index within the source buffer, and the source and destination buffers. The function must ensure that the destination buffer is modified, and that the prefix of the destination buffer becomes equal to the entire source buffer after the copy operation.", "The definition is about a function called memcpy that copies bytes from a source buffer to a destination buffer. The function takes the length of the data to be copied, the current position in the source buffer, and the source and destination buffers as input.\n\nThe implementation involves ensuring that the source and destination buffers are live and disjoint, and that the prefix of the source buffer up to the current position matches the corresponding prefix of the destination buffer. After the copy operation, the function modifies the destination buffer and ensures that the prefix of the destination buffer matches the entire source buffer." ], "generated_solution": [ "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len) =\n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len) =\n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures \n (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) = \n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len) =\n ...\n {implementation goes here}", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures\n (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) =\n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) =\n (* Implementation goes here *)", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur)\n (ensures fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len) =\n // Implementation goes here", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) =\n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures \n (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) = \n ...", "let memcpy (len: uint32) (cur: uint32{cur <= len}) (src dest: lbuffer len uint8) : ST unit\n (requires\n (fun h -> live h src /\\ live h dest /\\ disjoint src dest /\\ prefix_equal h src dest cur))\n (ensures \n (fun h0 _ h1 -> modifies dest h0 h1 /\\ prefix_equal h1 src dest len)) = \n ..." ] }, { "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.ovalue_is_readable_struct_elim", "opens_and_abbrevs": [ { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "DM", "full_module": "FStar.DependentMap" }, { "open": "FStar.HyperStack.ST" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HH", "full_module": "FStar.HyperStack" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n : Lemma (requires (ovalue_is_readable (TStruct l) v))\n (ensures\n (let v:ostruct l = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]", "source_definition": "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in (\n Some? v /\\\n ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)\n )))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= let (v: ostruct l) = v in\n assert_norm (ovalue_is_readable (TStruct l) v == List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n assert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n assert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))", "source_range": { "start_line": 526, "start_col": 0, "end_line": 542, "end_col": 75 }, "interleaved": false, "definition": "fun l v fd ->\n (let v = v in\n FStar.Pervasives.assert_norm (FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.TStruct\n l)\n v ==\n FStar.List.Tot.Base.for_all (FStar.Pointer.Base.struct_field_is_readable l\n (fun x y -> FStar.Pointer.Base.ovalue_is_readable x y)\n v)\n (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst (Mkstruct_typ?.fields l)));\n assert (FStar.List.Tot.Base.for_all (FStar.Pointer.Base.struct_field_is_readable l\n (fun x y -> FStar.Pointer.Base.ovalue_is_readable x y)\n v)\n (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst (Mkstruct_typ?.fields l)));\n FStar.List.Tot.Base.for_all_mem (FStar.Pointer.Base.struct_field_is_readable l\n (fun x y -> FStar.Pointer.Base.ovalue_is_readable x y)\n v)\n (FStar.List.Tot.Base.map FStar.Pervasives.Native.fst (Mkstruct_typ?.fields l));\n assert (FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.typ_of_struct_field l fd)\n (FStar.Pointer.Base.ostruct_sel v fd)))\n <:\n FStar.Pervasives.Lemma\n (requires FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.TStruct l) v)\n (ensures\n (let v = v in\n Some? v /\\\n FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.typ_of_struct_field l fd)\n (FStar.Pointer.Base.ostruct_sel v fd)))\n [\n SMTPat (FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.typ_of_struct_field l fd)\n (FStar.Pointer.Base.ostruct_sel v fd))\n ]", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "FStar.Pointer.Base.struct_typ", "FStar.Pointer.Base.otype_of_typ", "FStar.Pointer.Base.TStruct", "FStar.Pointer.Base.struct_field", "Prims._assert", "Prims.b2t", "FStar.Pointer.Base.ovalue_is_readable", "FStar.Pointer.Base.typ_of_struct_field", "FStar.Pointer.Base.ostruct_sel", "Prims.unit", "FStar.List.Tot.Base.for_all_mem", "Prims.string", "FStar.Pointer.Base.struct_field_is_readable", "FStar.Pointer.Base.typ", "Prims.bool", "FStar.List.Tot.Base.map", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.fst", "FStar.Pointer.Base.__proj__Mkstruct_typ__item__fields", "FStar.List.Tot.Base.for_all", "FStar.Pervasives.assert_norm", "Prims.eq2", "FStar.Pointer.Base.ostruct", "Prims.squash", "Prims.l_and", "FStar.Pervasives.Native.uu___is_Some", "FStar.DependentMap.t", "FStar.Pointer.Base.otype_of_struct_field", "Prims.Cons", "FStar.Pervasives.pattern", "FStar.Pervasives.smt_pat", "Prims.Nil" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n l: FStar.Pointer.Base.struct_typ ->\n v: FStar.Pointer.Base.otype_of_typ (FStar.Pointer.Base.TStruct l) ->\n fd: FStar.Pointer.Base.struct_field l\n -> FStar.Pervasives.Lemma\n (requires FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.TStruct l) v)\n (ensures\n (let v = v in\n Some? v /\\\n FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.typ_of_struct_field l fd)\n (FStar.Pointer.Base.ostruct_sel v fd)))\n [\n SMTPat (FStar.Pointer.Base.ovalue_is_readable (FStar.Pointer.Base.typ_of_struct_field l fd)\n (FStar.Pointer.Base.ostruct_sel v fd))\n ]", "prompt": "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n : Lemma (requires (ovalue_is_readable (TStruct l) v))\n (ensures\n (let v:ostruct l = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))] =\n ", "expected_response": "let v:ostruct l = v in\nassert_norm (ovalue_is_readable (TStruct l) v ==\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v)\n (List.Tot.map fst l.fields));\nassert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v)\n (List.Tot.map fst l.fields));\nList.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v)\n (List.Tot.map fst l.fields);\nassert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))", "source": { "project_name": "FStar", "file_name": "ulib/legacy/FStar.Pointer.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Pointer.Base.fst", "checked_file": "dataset/FStar.Pointer.Base.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.UInt16.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.ModifiesGen.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Int8.fsti.checked", "dataset/FStar.Int64.fsti.checked", "dataset/FStar.Int32.fsti.checked", "dataset/FStar.Int16.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.DependentMap.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Char.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "base_typ", "TUInt", "TUInt", "TUInt", "TUInt8", "TUInt8", "TUInt8", "TUInt16", "TUInt16", "TUInt16", "TUInt32", "TUInt32", "TUInt32", "TUInt64", "TUInt64", "TUInt64", "TInt", "TInt", "TInt", "TInt8", "TInt8", "TInt8", "TInt16", "TInt16", "TInt16", "TInt32", "TInt32", "TInt32", "step", "TInt64", "TInt64", "TInt64", "StepField", "StepField", "StepField", "TChar", "TChar", "TChar", "l", "l", "TBool", "TBool", "TBool", "fd", "fd", "TUnit", "TUnit", "TUnit", "StepUField", "StepUField", "StepUField", "l", "l", "array_length_t", "fd", "fd", "typ", "StepCell", "StepCell", "StepCell", "TBase", "TBase", "TBase", "length", "length", "b", "b", "value", "value", "index", "index", "TStruct", "TStruct", "TStruct", "l", "l", "path", "TUnion", "TUnion", "TUnion", "PathBase", "PathBase", "PathBase", "l", "l", "PathStep", "PathStep", "PathStep", "TArray", "TArray", "TArray", "through", "through", "length", "length", "to", "to", "t", "t", "p", "p", "s", "s", "TPointer", "TPointer", "TPointer", "t", "t", "let step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()", "TNPointer", "TNPointer", "TNPointer", "t", "t", "TBuffer", "TBuffer", "TBuffer", "t", "t", "struct_typ'", "struct_typ", "struct_typ", "let rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s", "name", "name", "fields", "fields", "union_typ", "let struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "let struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "let union_field = struct_field", "let typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "let typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "_npointer", "Pointer", "Pointer", "Pointer", "from", "from", "contents", "contents", "let typ_of_union_field\n (l: union_typ)\n (f: union_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field l f", "p", "p", "NullPtr", "NullPtr", "NullPtr", "let npointer (t: typ): Tot Type0 =\n _npointer t", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let nullptr (#t: typ): Tot (npointer t) = NullPtr", "let g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false", "let g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()", "let not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true", "let rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "buffer_root", "BufferRootSingleton", "BufferRootSingleton", "BufferRootSingleton", "p", "p", "BufferRootArray", "BufferRootArray", "BufferRootArray", "max_length", "max_length", "p", "p", "let buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len", "_buffer", "Buffer", "Buffer", "Buffer", "broot", "broot", "bidx", "bidx", "blength", "blength", "let buffer (t: typ): Tot Type0 = _buffer t", "val npointer (t: typ) : Tot Type0", "val nullptr (#t: typ): Tot (npointer t)", "val g_is_null (#t: typ) (p: npointer t) : GTot bool", "val g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n [SMTPat (g_is_null (nullptr #t))]", "let gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )", "let pointer (t: typ) : Tot Type0 = (p: npointer t { g_is_null p == false } )", "let _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u", "val buffer (t: typ): Tot Type0", "let gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u", "let type_of_base_typ\n (t: base_typ)\n: Tot Type0\n= match t with\n | TUInt -> nat\n | TUInt8 -> FStar.UInt8.t\n | TUInt16 -> FStar.UInt16.t\n | TUInt32 -> FStar.UInt32.t\n | TUInt64 -> FStar.UInt64.t\n | TInt -> int\n | TInt8 -> FStar.Int8.t\n | TInt16 -> FStar.Int16.t\n | TInt32 -> FStar.Int32.t\n | TInt64 -> FStar.Int64.t\n | TChar -> FStar.Char.char\n | TBool -> bool\n | TUnit -> unit", "let gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v", "let gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)", "array", "let type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "let gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()", "let type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "val struct (l: struct_typ) : Tot Type0", "val union (l: union_typ) : Tot Type0", "let rec type_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t", "let rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()", "let type_of_typ_array\n (len: array_length_t)\n (t: typ)\n: Lemma\n (type_of_typ (TArray len t) == array len (type_of_typ t))\n [SMTPat (type_of_typ (TArray len t))]\n= ()", "let _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v", "let struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f", "let type_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l (fun (x:typ{x << l}) -> type_of_typ x)", "let struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v", "let type_of_typ_struct\n (l: struct_typ)\n: Lemma\n (type_of_typ (TStruct l) == struct l)\n [SMTPat (type_of_typ (TStruct l))]\n= assert_norm (type_of_typ (TStruct l) == struct l)", "let struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f", "let struct_sel_struct_create_fun l f fd = ()", "let union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v", "let type_of_typ_type_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (type_of_typ (typ_of_struct_field l f) == type_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "let union_get_value #l v fd = gtdata_get_value v fd", "let union_create l fd v = gtdata_create fd v", "val struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f)", "let rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul", "let dfst_struct_field\n (s: struct_typ)\n (p: (x: struct_field s & type_of_struct_field s x))\n: Tot string\n=\n let (| f, _ |) = p in\n f", "let struct_literal (s: struct_typ) : Tot Type0 = list (x: struct_field s & type_of_struct_field s x)", "let struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool =\n List.Tot.sortWith FStar.String.compare (List.Tot.map fst s.fields) =\n List.Tot.sortWith FStar.String.compare\n (List.Tot.map (dfst_struct_field s) l)", "let fun_of_list\n (s: struct_typ)\n (l: struct_literal s)\n (f: struct_field s)\n: Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n=\n let f' : string = f in\n let phi (p: (x: struct_field s & type_of_struct_field s x)) : Tot bool =\n dfst_struct_field s p = f'\n in\n match List.Tot.find phi l with\n | Some p -> let (| _, v |) = p in v\n | _ ->\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map fst s.fields);\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map (dfst_struct_field s) l);\n List.Tot.mem_memP f' (List.Tot.map fst s.fields);\n List.Tot.mem_count (List.Tot.map fst s.fields) f';\n List.Tot.mem_count (List.Tot.map (dfst_struct_field s) l) f';\n List.Tot.mem_memP f' (List.Tot.map (dfst_struct_field s) l);\n List.Tot.memP_map_elim (dfst_struct_field s) f' l;\n Classical.forall_intro (Classical.move_requires (List.Tot.find_none phi l));\n false_elim ()", "val struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l)", "let struct_create\n (s: struct_typ)\n (l: struct_literal s)\n: Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n= struct_create_fun s (fun_of_list s l)", "val struct_sel_struct_create_fun\n (l: struct_typ)\n (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd)))\n (fd: struct_field l)\n: Lemma\n (struct_sel (struct_create_fun l f) fd == f fd)\n [SMTPat (struct_sel (struct_create_fun l f) fd)]", "let rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)", "let type_of_typ_union\n (l: union_typ)\n: Lemma\n (type_of_typ (TUnion l) == union l)\n [SMTPat (type_of_typ (TUnion l))]\n= assert_norm (type_of_typ (TUnion l) == union l)", "val union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l)", "val union_get_value\n (#l: union_typ)\n (v: union l)\n (fd: struct_field l)\n: Pure (type_of_struct_field l fd)\n (requires (union_get_key v == fd))\n (ensures (fun _ -> True))", "let otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ", "val union_create\n (l: union_typ)\n (fd: struct_field l)\n (v: type_of_struct_field l fd)\n: Tot (union l)", "let otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "val equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))", "let otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()", "val as_addr (#t: typ) (p: pointer t): GTot (x: nat { x > 0 } )", "let otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()", "val unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0", "val live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0", "let ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))", "let ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f", "let ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)", "val nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0", "let ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)", "let otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)", "val live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (nlive h p <==> live h p)\n [SMTPat (nlive h p)]", "let ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))", "val g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n: Lemma\n (requires (g_is_null p))\n (ensures (nlive h p))\n [SMTPat (g_is_null p); SMTPat (nlive h p)]", "let ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)", "let ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd", "val live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (ensures (live h p /\\ p `unused_in` h ==> False))\n [SMTPat (live h p); SMTPat (p `unused_in` h)]", "let ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)", "val gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)", "let otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)", "val frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid", "let struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true", "val live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]", "val disjoint_roots_intro_pointer_vs_pointer\n (#value1 value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 =!= as_addr p2))", "let rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v", "val disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))", "val disjoint_roots_intro_reference_vs_pointer\n (#value1: Type)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ p2 `unused_in` h))\n (ensures (HS.frameOf p1 <> frameOf p2 \\/ HS.as_addr p1 =!= as_addr p2))", "val is_mm\n (#value: typ)\n (p: pointer value)\n: GTot bool", "val gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: GTot (pointer (typ_of_struct_field l fd))", "let ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)", "val as_addr_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (as_addr (gfield p fd) == as_addr p))\n [SMTPat (as_addr (gfield p fd))]", "let ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v", "val unused_in_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (unused_in (gfield p fd) h <==> unused_in p h))\n [SMTPat (unused_in (gfield p fd) h)]" ], "closest": [ "val readable_intro\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h: HS.mem)\n: Lemma\n (requires (\n valid h tgs p /\\\n P.readable h (gfield tgs p f)\n ))\n (ensures (P.readable h p))\n [SMTPat (valid #l h tgs p); SMTPat (P.readable h (gfield #l tgs p f))]\nlet readable_intro\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h: HS.mem)\n: Lemma\n (requires (\n valid h tgs p /\\\n P.readable h (gfield tgs p f)\n ))\n (ensures (P.readable h p))\n [SMTPat (valid #l h tgs p); SMTPat (P.readable h (gfield #l tgs p f))]\n= P.readable_struct_fields_readable_struct h p", "val type_of_typ_struct (l: struct_typ)\n : Lemma (type_of_typ (TStruct l) == struct l) [SMTPat (type_of_typ (TStruct l))]\nlet type_of_typ_struct\n (l: struct_typ)\n: Lemma\n (type_of_typ (TStruct l) == struct l)\n [SMTPat (type_of_typ (TStruct l))]\n= assert_norm (type_of_typ (TStruct l) == struct l)", "val struct_get_field_pat\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n : Lemma\n (struct_get_field (struct_set_field field v s) field' ==\n (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\nlet struct_get_field_pat\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n: Lemma\n (struct_get_field (struct_set_field field v s) field' == (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\n= if field' = field\n then ()\n else struct_get_field_other s field v field'", "val struct_get_field_pat\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n : Lemma\n (struct_get_field (struct_set_field field v s) field' ==\n (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\nlet struct_get_field_pat\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n: Lemma\n (struct_get_field (struct_set_field field v s) field' == (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\n= if field' = field\n then ()\n else struct_get_field_other s field v field'", "val field_of_tag_of_field' (#l: P.struct_typ') (tgs: tags' l) (f: P.struct_field' l)\n : Lemma (field_of_tag' #l tgs (tag_of_field' #l tgs f) == f)\n [SMTPat (field_of_tag' #l tgs (tag_of_field' #l tgs f))]\nlet rec field_of_tag_of_field'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (f: P.struct_field' l)\n: Lemma (field_of_tag' #l tgs (tag_of_field' #l tgs f) == f)\n [SMTPat (field_of_tag' #l tgs (tag_of_field' #l tgs f))]\n= let ((f', _) :: l') = l in\n let (t' :: tgs') = tgs in\n if f = f' then ()\n else (\n let ff : string = f in\n field_of_tag_of_field' #l' tgs' ff\n )", "val modifies_1_valid\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h0 h1: HS.mem)\n (#t': P.typ)\n (p': P.pointer t')\n: Lemma\n (requires (\n valid h0 tgs p /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n P.modifies_1 (gfield tgs p f) h0 h1 /\\\n P.includes (gfield tgs p f) p' /\\\n P.readable h1 p'\n ))\n (ensures (valid h1 tgs p))\n [SMTPat (valid #l h0 tgs p);\n SMTPat (P.readable h1 p');\n SMTPat (gfield #l tgs p f)]\nlet modifies_1_valid\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h0 h1: HS.mem)\n (#t': P.typ)\n (p': P.pointer t')\n: Lemma\n (requires (\n valid h0 tgs p /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n P.modifies_1 (gfield tgs p f) h0 h1 /\\\n P.includes (gfield tgs p f) p' /\\\n P.readable h1 p'\n ))\n (ensures (valid h1 tgs p))\n [SMTPat (valid #l h0 tgs p); SMTPat (P.modifies_1 (gfield #l tgs p f) h0 h1);\n SMTPat (P.includes #_ #t' (gfield #l tgs p f) p')]\n=\n let u_ptr = P.gfield p (union_field l) in\n P.is_active_union_field_includes_readable h1 u_ptr f p'", "val includes_gfield_gen\n (#t: typ)\n (p: pointer t)\n (#l: struct_typ)\n (q: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (includes p q))\n (ensures (includes p (gfield q fd)))\n [SMTPat (includes p (gfield q fd))]\nlet includes_gfield_gen #t p #l q fd =\n includes_gfield q fd;\n includes_trans p q (gfield q fd)", "val get_set\n (#t: Type)\n (sd: struct_def t)\n (x: t)\n (f: field_t sd.fields)\n (v: sd.field_desc.fd_type f)\n (f': field_t sd.fields)\n : Lemma (sd.get (set sd x f v) f' == (if f = f' then v else sd.get x f'))\n [SMTPat (sd.get (set sd x f v) f')]\nlet get_set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f' : field_t sd.fields) : Lemma\n (sd.get (set sd x f v) f' == (if f = f' then v else sd.get x f'))\n [SMTPat (sd.get (set sd x f v) f')]\n= sd.get_mk (set_aux sd x f v) f'", "val get_set\n (#t: Type)\n (sd: struct_def t)\n (x: t)\n (f: field_t sd.fields)\n (v: sd.field_desc.fd_type f)\n (f': field_t sd.fields)\n : Lemma (sd.get (set sd x f v) f' == (if f = f' then v else sd.get x f'))\n [SMTPat (sd.get (set sd x f v) f')]\nlet get_set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f' : field_t sd.fields) : Lemma\n (sd.get (set sd x f v) f' == (if f = f' then v else sd.get x f'))\n [SMTPat (sd.get (set sd x f v) f')]\n= sd.get_mk (set_aux sd x f v) f'", "val field_of_tag_of_field\n (#l: P.union_typ)\n (tgs: tags l)\n (f: P.struct_field l)\n: Lemma (field_of_tag #l tgs (tag_of_field #l tgs f) == f)\n [SMTPat (field_of_tag #l tgs (tag_of_field #l tgs f))]\nlet field_of_tag_of_field\n (#l: P.union_typ)\n (tgs: tags l)\n (f: P.struct_field l)\n: Lemma (field_of_tag #l tgs (tag_of_field #l tgs f) == f)\n [SMTPat (field_of_tag #l tgs (tag_of_field #l tgs f))]\n= field_of_tag_of_field' tgs f", "val typ_depth_typ_of_struct_field (l: struct_typ') (f: struct_field' l)\n : Lemma (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l)) (decreases l)\nlet rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "val loc_disjoint_gfield_r\n (p: loc)\n (#l: struct_typ)\n (q: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (loc_disjoint p (loc_pointer q)))\n (ensures (loc_disjoint p (loc_pointer (gfield q fd))))\n [SMTPat (loc_disjoint p (loc_pointer (gfield q fd)))]\nlet loc_disjoint_gfield_r p #l q fd =\n loc_disjoint_includes p (loc_pointer q) p (loc_pointer (gfield q fd))", "val loc_disjoint_gfield_l\n (p: loc)\n (#l: struct_typ)\n (q: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (loc_disjoint (loc_pointer q) p))\n (ensures (loc_disjoint (loc_pointer (gfield q fd)) p))\n [SMTPat (loc_disjoint (loc_pointer (gfield q fd)) p)]\nlet loc_disjoint_gfield_l p #l q fd =\n loc_disjoint_sym (loc_pointer q) p;\n loc_disjoint_gfield_r p q fd;\n loc_disjoint_sym p (loc_pointer (gfield q fd))", "val struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n : stt (ref #(norm norm_field_steps (sd.field_desc.fd_type field))\n (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' ->\n (has_struct_field r field r' **\n pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field)))) **\n pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field))\nlet struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n: stt (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' -> has_struct_field r field r' ** pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))) ** pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field))\n= struct_field0\n (norm norm_field_steps (sd.field_desc.fd_type field))\n r\n field\n (sd.field_desc.fd_typedef field)", "val tag_of_field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)\n : Lemma (requires (List.Tot.mem t tgs))\n (ensures (List.Tot.mem t tgs /\\ tag_of_field' #l tgs (field_of_tag' #l tgs t) == t))\n [SMTPat (tag_of_field' #l tgs (field_of_tag' #l tgs t))]\nlet rec tag_of_field_of_tag'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (t: UInt32.t)\n: Lemma\n (requires (List.Tot.mem t tgs))\n (ensures (\n List.Tot.mem t tgs /\\\n tag_of_field' #l tgs (field_of_tag' #l tgs t) == t\n ))\n [SMTPat (tag_of_field' #l tgs (field_of_tag' #l tgs t))]\n= let ((f', _) :: l') = l in\n let (t' :: tgs') = tgs in\n if t = t' then ()\n else (\n tag_of_field_of_tag' #l' tgs' t\n )", "val struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n : STT\n (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' ->\n ((pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))))\n `star`\n (pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n: STT (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' -> pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))) `star` pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field) `star` has_struct_field r field r')\n= struct_field0\n (norm norm_field_steps (sd.field_desc.fd_type field))\n r\n field\n (sd.field_desc.fd_typedef field)", "val loc_disjoint_gufield_r\n (p: loc)\n (#l: struct_typ)\n (q: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (loc_disjoint p (loc_pointer q)))\n (ensures (loc_disjoint p (loc_pointer (gufield q fd))))\n [SMTPat (loc_disjoint p (loc_pointer (gufield q fd)))]\nlet loc_disjoint_gufield_r p #l q fd =\n loc_disjoint_includes p (loc_pointer q) p (loc_pointer (gufield q fd))", "val struct_field:\n #tn: Type0 ->\n #tf: Type0 ->\n #n: string ->\n #fields: nonempty_field_description_t tf ->\n #v: Ghost.erased (struct_t0 tn n fields) ->\n r: ref (struct0 tn n fields) ->\n field: field_t fields ->\n #t': Type0 ->\n #td': typedef t' ->\n (#[norm_fields ()] sq_t': squash (t' == fields.fd_type field)) ->\n (#[norm_fields ()] sq_td': squash (td' == fields.fd_typedef field)) ->\n Prims.unit\n -> STT (ref td')\n (pts_to r v)\n (fun r' ->\n ((pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v))\n `star`\n (pts_to r' (struct_get_field v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (# [ norm_fields () ] sq_t': squash (t' == fields.fd_type field))\n (# [ norm_fields () ] sq_td': squash (td' == fields.fd_typedef field))\n ()\n: STT (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) `star` pts_to r' (struct_get_field v field) `star` has_struct_field r field r')\n= struct_field0\n t'\n r\n field\n td'", "val struct_field:\n #tn: Type0 ->\n #tf: Type0 ->\n #n: string ->\n #fields: nonempty_field_description_t tf ->\n #v: Ghost.erased (struct_t0 tn n fields) ->\n r: ref (struct0 tn n fields) ->\n field: field_t fields ->\n #t': Type0 ->\n #td': typedef t' ->\n (#[norm_fields ()] sq_t': squash (t' == fields.fd_type field)) ->\n (#[norm_fields ()] sq_td': squash (td' == fields.fd_typedef field)) ->\n Prims.unit\n -> stt (ref td')\n (pts_to r v)\n (fun r' ->\n (pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) **\n pts_to r' (struct_get_field v field)) **\n has_struct_field r field r')\nlet struct_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (# [ norm_fields () ] sq_t': squash (t' == fields.fd_type field))\n (# [ norm_fields () ] sq_td': squash (td' == fields.fd_typedef field))\n ()\n: stt (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) ** pts_to r' (struct_get_field v field) ** has_struct_field r field r')\n= struct_field0\n t'\n r\n field\n td'", "val struct_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : stt (ref td')\n (pts_to r v)\n (fun r' ->\n (pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) **\n pts_to r' (struct_get_field v field)) **\n has_struct_field r field r')\nlet struct_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: stt (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) ** pts_to r' (struct_get_field v field) ** has_struct_field r field r')\n= struct_field0 t' r field td'", "val includes_gufield_gen\n (#t: typ)\n (p: pointer t)\n (#l: union_typ)\n (q: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (includes p q))\n (ensures (includes p (gufield q fd)))\n [SMTPat (includes p (gufield q fd))]\nlet includes_gufield_gen #t p #l q fd =\n includes_gufield q fd;\n includes_trans p q (gufield q fd)", "val unstruct_field_alt\n (#opened: _)\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n (#v': Ghost.erased (sd.field_desc.fd_type field))\n (r': ref (sd.field_desc.fd_typedef field))\n : STGhost (Ghost.erased t)\n opened\n (((has_struct_field r field r') `star` (pts_to r v)) `star` (pts_to r' v'))\n (fun s' -> (has_struct_field r field r') `star` (pts_to r s'))\n (sd.get v field == unknown (sd.field_desc.fd_typedef field))\n (fun s' -> Ghost.reveal s' == set sd v field v')\nlet unstruct_field_alt\n (#opened: _)\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n (#v': Ghost.erased (sd.field_desc.fd_type field))\n (r': ref (sd.field_desc.fd_typedef field))\n: STGhost (Ghost.erased t) opened\n (has_struct_field r field r' `star` pts_to r v `star` pts_to r' v')\n (fun s' -> has_struct_field r field r' `star` pts_to r s')\n (\n sd.get v field == unknown (sd.field_desc.fd_typedef field)\n )\n (fun s' -> Ghost.reveal s' == set sd v field v')\n= unstruct_field r field r';\n _", "val type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (t: typ{t << l} -> Tot Type0))\n (f: struct_field l)\n : Tot Type0\nlet type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "val unstruct_field_and_drop\n (#opened: _)\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (#v': Ghost.erased t')\n (r': ref td')\n : STGhost (Ghost.erased (struct_t0 tn n fields))\n opened\n (((has_struct_field r field r') `star` (pts_to r v)) `star` (pts_to r' v'))\n (fun res -> pts_to r res)\n (struct_get_field v field == unknown (fields.fd_typedef field))\n (fun res ->\n t' == fields.fd_type field /\\ td' == fields.fd_typedef field /\\\n Ghost.reveal res == struct_set_field field (coerce_eq () (Ghost.reveal v')) v)\nlet unstruct_field_and_drop\n (#opened: _)\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (#v': Ghost.erased t')\n (r': ref td')\n: STGhost (Ghost.erased (struct_t0 tn n fields)) opened\n (has_struct_field r field r' `star` pts_to r v `star` pts_to r' v')\n (fun res -> pts_to r res)\n (\n struct_get_field v field == unknown (fields.fd_typedef field)\n )\n (fun res ->\n t' == fields.fd_type field /\\\n td' == fields.fd_typedef field /\\\n Ghost.reveal res == struct_set_field field (coerce_eq () (Ghost.reveal v')) v\n )\n= let res = unstruct_field r field r' in\n drop (has_struct_field _ _ _);\n res", "val type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (t: typ{t << l} -> Tot Type0))\n (f: struct_field' l)\n : Tot Type0\nlet type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "val struct_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : STT (ref td')\n (pts_to r v)\n (fun r' ->\n ((pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v))\n `star`\n (pts_to r' (struct_get_field v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: STT (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) `star` pts_to r' (struct_get_field v field) `star` has_struct_field r field r')\n= struct_field0 t' r field td'", "val typ_of_struct_field (l: struct_typ) (f: struct_field l) : Tot (t: typ{t << l})\nlet typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "val unstruct_field_alt\n (#opened: _)\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#v': Ghost.erased (fields.fd_type field))\n (r': ref (fields.fd_typedef field))\n : STGhost (Ghost.erased (struct_t0 tn n fields))\n opened\n (((has_struct_field r field r') `star` (pts_to r v)) `star` (pts_to r' v'))\n (fun s' -> (has_struct_field r field r') `star` (pts_to r s'))\n (struct_get_field v field == unknown (fields.fd_typedef field))\n (fun s' -> Ghost.reveal s' == struct_set_field field v' v)\nlet unstruct_field_alt\n (#opened: _)\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#v': Ghost.erased (fields.fd_type field))\n (r': ref (fields.fd_typedef field))\n: STGhost (Ghost.erased (struct_t0 tn n fields)) opened\n (has_struct_field r field r' `star` pts_to r v `star` pts_to r' v')\n (fun s' -> has_struct_field r field r' `star` pts_to r s')\n (\n struct_get_field v field == unknown (fields.fd_typedef field)\n )\n (fun s' -> \n Ghost.reveal s' == struct_set_field field v' v\n )\n= unstruct_field r field r'", "val loc_disjoint_gufield_l\n (p: loc)\n (#l: struct_typ)\n (q: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (loc_disjoint (loc_pointer q) p))\n (ensures (loc_disjoint (loc_pointer (gufield q fd)) p))\n [SMTPat (loc_disjoint (loc_pointer (gufield q fd)) p)]\nlet loc_disjoint_gufield_l p #l q fd =\n loc_disjoint_sym (loc_pointer q) p;\n loc_disjoint_gufield_r p q fd;\n loc_disjoint_sym p (loc_pointer (gufield q fd))", "val fun_of_list (s: struct_typ) (l: struct_literal s) (f: struct_field s)\n : Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\nlet fun_of_list\n (s: struct_typ)\n (l: struct_literal s)\n (f: struct_field s)\n: Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n=\n let f' : string = f in\n let phi (p: (x: struct_field s & type_of_struct_field s x)) : Tot bool =\n dfst_struct_field s p = f'\n in\n match List.Tot.find phi l with\n | Some p -> let (| _, v |) = p in v\n | _ ->\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map fst s.fields);\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map (dfst_struct_field s) l);\n List.Tot.mem_memP f' (List.Tot.map fst s.fields);\n List.Tot.mem_count (List.Tot.map fst s.fields) f';\n List.Tot.mem_count (List.Tot.map (dfst_struct_field s) l) f';\n List.Tot.mem_memP f' (List.Tot.map (dfst_struct_field s) l);\n List.Tot.memP_map_elim (dfst_struct_field s) f' l;\n Classical.forall_intro (Classical.move_requires (List.Tot.find_none phi l));\n false_elim ()", "val typ_of_struct_field' (l: struct_typ') (f: struct_field' l) : Tot (t: typ{t << l})\nlet typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "val type_of_struct_field (l: struct_typ) : Tot (struct_field l -> Tot Type0)\nlet type_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l (fun (x:typ{x << l}) -> type_of_typ x)", "val struct_field' (l: struct_typ') : Tot eqtype\nlet struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "val includes_gfield_gen\n (#t: P.typ)\n (q: P.pointer t)\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n : Lemma (requires (P.includes q p))\n (ensures (P.includes q (gfield tgs p f)))\n [SMTPat (P.includes q (gfield tgs p f))]\nlet includes_gfield_gen\n (#t: P.typ)\n (q: P.pointer t)\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: Lemma\n (requires (P.includes q p))\n (ensures (P.includes q (gfield tgs p f)))\n [SMTPat (P.includes q (gfield tgs p f))]\n= includes_gfield tgs p f;\n P.includes_trans q p (gfield tgs p f)", "val readable_frame\n (h: HS.mem)\n (#t: _)\n (#b: B.buffer t)\n (p: perm b)\n (from: U32.t)\n (to: U32.t{U32.v from <= U32.v to /\\ U32.v to <= B.length b})\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (readable h p from to /\\ B.modifies l h h' /\\ B.loc_disjoint (loc_perm p) l /\\ B.live h' b))\n (ensures (readable h' p from to))\n [\n SMTPatOr\n [\n [SMTPat (B.modifies l h h'); SMTPat (readable h p from to)];\n [SMTPat (B.modifies l h h'); SMTPat (readable h' p from to)]\n ]\n ]\nlet readable_frame\n (h: HS.mem)\n (#t: _) (#b: B.buffer t) (p: perm b)\n (from: U32.t)\n (to: U32.t { U32.v from <= U32.v to /\\ U32.v to <= B.length b })\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n readable h p from to /\\\n B.modifies l h h' /\\\n B.loc_disjoint (loc_perm p) l /\\\n B.live h' b // because nothing prevents b from being deallocated\n ))\n (ensures (\n readable h' p from to\n ))\n [SMTPatOr [\n [ SMTPat (B.modifies l h h'); SMTPat (readable h p from to) ] ;\n [ SMTPat (B.modifies l h h'); SMTPat (readable h' p from to) ] ;\n ]]\n=\n valid_perm_frame h p l h' ;\n preserved_split p 0ul from (B.len b) h h' ;\n preserved_split p from to (B.len b) h h' ;\n readable_frame0 h p from to h'", "val write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag #l h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\nlet write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\n=\n let tag_ptr = P.field p (tag_field l) in\n let u_ptr = P.field p (union_field l) in\n let t = tag_of_field #l tgs f in\n P.write tag_ptr t;\n let h11 = HST.get () in\n P.write (P.ufield u_ptr f) v;\n let h1 = HST.get () in\n // SMTPats for this lemma do not seem to trigger?\n// P.no_upd_lemma_1 h11 h1 u_ptr tag_ptr;\n assert (P.readable h1 tag_ptr);\n assert (P.readable h1 u_ptr);\n P.readable_struct_fields_readable_struct h1 p;\n let uf = P.ufield u_ptr f in\n P.is_active_union_field_includes_readable #l h1 u_ptr f uf;\n assert (P.is_active_union_field #l h1 u_ptr f)", "val struct_field (l: struct_typ) : Tot eqtype\nlet struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "val field\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack (P.pointer (P.typ_of_struct_field l f))\n (requires (fun h ->\n valid h tgs p /\\\n gread_tag h tgs p == normalize_term (tag_of_field tgs f)\n ))\n (ensures (fun h0 p' h1 ->\n h0 == h1 /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n p' == gfield tgs p f\n ))\nlet field\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack (P.pointer (P.typ_of_struct_field l f))\n (requires (fun h ->\n valid h tgs p /\\\n gread_tag h tgs p == normalize_term (tag_of_field tgs f)\n ))\n (ensures (fun h0 p' h1 ->\n h0 == h1 /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n p' == gfield tgs p f\n ))\n= P.ufield (P.field p (union_field l)) f", "val src_types_are_closed1 (ty: s_ty) (v: R.term)\n : Lemma (RT.open_with (elab_ty ty) v == elab_ty ty) [SMTPat (RT.open_with (elab_ty ty) v)]\nlet src_types_are_closed1 (ty:s_ty) (v:R.term)\n : Lemma (RT.open_with (elab_ty ty) v == elab_ty ty)\n [SMTPat (RT.open_with (elab_ty ty) v)]\n = src_types_are_closed_core ty (RT.DT 0 v) 0;\n RT.open_with_spec (elab_ty ty) v", "val full_union_set_field\n (#tn #tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n : Lemma (requires True)\n (ensures\n (full (union0 tn n fields) (union_set_field tn n fields field v) <==>\n full (fields.fd_typedef field) v))\n [SMTPat (full (union0 tn n fields) (union_set_field tn n fields field v))]\nlet full_union_set_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n: Lemma\n (requires True)\n (ensures (\n full (union0 tn n fields) (union_set_field tn n fields field v) <==> full (fields.fd_typedef field) v\n ))\n [SMTPat (full (union0 tn n fields) (union_set_field tn n fields field v))]\n= Classical.move_requires (full_union_set_field_intro #tn #tf #n #fields field) v;\n Classical.move_requires (full_union_set_field_elim #tn #tf #n #fields field) v", "val full_union_set_field\n (#tn #tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n : Lemma (requires True)\n (ensures\n (full (union0 tn n fields) (union_set_field tn n fields field v) <==>\n full (fields.fd_typedef field) v))\n [SMTPat (full (union0 tn n fields) (union_set_field tn n fields field v))]\nlet full_union_set_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n: Lemma\n (requires True)\n (ensures (\n full (union0 tn n fields) (union_set_field tn n fields field v) <==> full (fields.fd_typedef field) v\n ))\n [SMTPat (full (union0 tn n fields) (union_set_field tn n fields field v))]\n= Classical.move_requires (full_union_set_field_intro #tn #tf #n #fields field) v;\n Classical.move_requires (full_union_set_field_elim #tn #tf #n #fields field) v", "val tag_of_field_of_tag\n (#l: P.union_typ)\n (tgs: tags l)\n (t: UInt32.t)\n: Lemma\n (requires (List.Tot.mem t tgs))\n (ensures (\n List.Tot.mem t tgs /\\\n tag_of_field #l tgs (field_of_tag #l tgs t) == t\n ))\n [SMTPat (tag_of_field #l tgs (field_of_tag #l tgs t))]\nlet tag_of_field_of_tag\n (#l: P.union_typ)\n (tgs: tags l)\n (t: UInt32.t)\n: Lemma\n (requires (List.Tot.mem t tgs))\n (ensures (\n List.Tot.mem t tgs /\\\n tag_of_field #l tgs (field_of_tag #l tgs t) == t\n ))\n [SMTPat (tag_of_field #l tgs (field_of_tag #l tgs t))]\n= tag_of_field_of_tag' tgs t", "val object_tds_lack_pointer_field_equivalent_to_forall (tds: seq object_td_t)\n : Lemma\n (ensures\n object_tds_lack_pointer_field tds <==>\n (forall td. contains tds td ==> object_td_lacks_pointer_field td))\n (decreases rank tds)\n [SMTPat (object_tds_lack_pointer_field tds)]\nlet rec object_tds_lack_pointer_field_equivalent_to_forall (tds: seq object_td_t)\n : Lemma (ensures object_tds_lack_pointer_field tds <==>\n (forall td. contains tds td ==> object_td_lacks_pointer_field td))\n (decreases rank tds)\n [SMTPat (object_tds_lack_pointer_field tds)] =\n all_seq_facts_lemma ();\n if length tds = 0 then\n ()\n else\n object_tds_lack_pointer_field_equivalent_to_forall (drop tds 1)", "val stlc_types_are_closed1 (ty: stlc_ty) (v: R.term)\n : Lemma (RT.open_with (elab_ty ty) v == elab_ty ty) [SMTPat (RT.open_with (elab_ty ty) v)]\nlet stlc_types_are_closed1 (ty:stlc_ty) (v:R.term)\n : Lemma (RT.open_with (elab_ty ty) v == elab_ty ty)\n [SMTPat (RT.open_with (elab_ty ty) v)]\n = stlc_types_are_closed_core ty [ RT.DT 0 v ];\n RT.open_with_spec (elab_ty ty) v", "val object_storage_to_value_equivalent_to_map (actor: tid_t) (storage: object_storage_t)\n : Lemma\n (ensures\n (let value = object_storage_to_value actor storage in\n match storage with\n | ObjectStorageStruct fields ->\n value == ObjectValueStruct (map (object_storage_to_value actor) fields)\n | ObjectStorageArray element_td elements ->\n value == ObjectValueArray element_td (map (object_storage_to_value actor) elements)\n | _ -> True)) [SMTPat (object_storage_to_value actor storage)]\nlet object_storage_to_value_equivalent_to_map (actor: tid_t) (storage: object_storage_t)\n : Lemma (ensures (let value = object_storage_to_value actor storage in\n match storage with\n | ObjectStorageStruct fields ->\n value == ObjectValueStruct (map (object_storage_to_value actor) fields)\n | ObjectStorageArray element_td elements ->\n value == ObjectValueArray element_td (map (object_storage_to_value actor) elements)\n | _ -> True))\n [SMTPat (object_storage_to_value actor storage)] =\n let value = object_storage_to_value actor storage in\n match storage with\n | ObjectStorageStruct fields ->\n assert (equal (ObjectValueStruct?.fields value) (map (object_storage_to_value actor) fields))\n | ObjectStorageArray element_td elements ->\n assert (equal (ObjectValueArray?.elements value) (map (object_storage_to_value actor) elements))\n | _ -> ()", "val hide_raise_reveal (#a: Type) (v0 v1: erased a)\n : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==> v0 == v1)\n [SMTPat (hide (U.raise_val (reveal v0))); SMTPat (hide (U.raise_val (reveal v1)))]\nlet hide_raise_reveal (#a:Type) (v0:erased a) (v1:erased a)\n : Lemma (hide (U.raise_val (reveal v0)) == hide (U.raise_val (reveal v1)) <==>\n v0 == v1)\n [SMTPat (hide (U.raise_val (reveal v0)));\n SMTPat (hide (U.raise_val (reveal v1)))]\n = let u0 = hide (U.raise_val (reveal v0)) in\n let u1 = hide (U.raise_val (reveal v1)) in\n assert (U.downgrade_val (U.raise_val (reveal v0)) == U.downgrade_val (U.raise_val (reveal v1)) <==>\n v0 == v1)", "val object_storage_to_td_equivalent_to_map (storage: object_storage_t)\n : Lemma\n (ensures\n (let td = object_storage_to_td storage in\n match storage with\n | ObjectStorageStruct fields -> td == ObjectTDStruct (map object_storage_to_td fields)\n | _ -> True)) [SMTPat (object_storage_to_td storage)]\nlet object_storage_to_td_equivalent_to_map (storage: object_storage_t)\n : Lemma (ensures (let td = object_storage_to_td storage in\n match storage with\n | ObjectStorageStruct fields -> td == ObjectTDStruct (map object_storage_to_td fields)\n | _ -> True))\n [SMTPat (object_storage_to_td storage)] =\n let td = object_storage_to_td storage in\n match storage with\n | ObjectStorageStruct fields ->\n assert (equal (ObjectTDStruct?.field_tds td) (map object_storage_to_td fields))\n | _ -> ()", "val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma\n (requires\n loc_disjoint (loc_buffer b) p /\\\n buffer_readable h b /\\\n modifies p h h'\n )\n (ensures\n buffer_readable h b /\\\n buffer_readable h' b /\\\n buffer_as_seq h b == buffer_as_seq h' b\n )\n [SMTPatOr [\n [SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];\n [SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];\n ]]\nlet modifies_buffer_elim #t1 b p h h' =\n let db = get_downview b.bsrc in\n lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;\n same_underlying_seq h h' b;\n assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))", "val modifies_buffer_elim (#t1:base_typ) (b:buffer t1) (p:loc) (h h':vale_heap) : Lemma\n (requires\n loc_disjoint (loc_buffer b) p /\\\n buffer_readable h b /\\\n modifies p h h'\n )\n (ensures\n buffer_readable h b /\\\n buffer_readable h' b /\\\n buffer_as_seq h b == buffer_as_seq h' b\n )\n [SMTPatOr [\n [SMTPat (modifies p h h'); SMTPat (buffer_readable h' b)];\n [SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b)];\n ]]\nlet modifies_buffer_elim #t1 b p h h' =\n let db = get_downview b.bsrc in\n lemma_dv_equal (down_view b.src) b.bsrc (_ih h).hs (_ih h').hs;\n same_underlying_seq h h' b;\n assert (Seq.equal (buffer_as_seq h b) (buffer_as_seq h' b))", "val readable_cons (hd: arg) (tl: list arg) (s: ME.vale_heap)\n : Lemma VSig.(readable (hd :: tl) s <==> (readable_one s hd /\\ readable tl s))\nlet readable_cons (hd:arg) (tl:list arg) (s:ME.vale_heap)\n : Lemma VSig.(readable (hd::tl) s <==> (readable_one s hd /\\ readable tl s))\n = BigOps.big_and'_cons VSig.(readable_one s) hd tl", "val buffer_readable_intro_empty\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (\n buffer_live h b /\\\n UInt32.v (buffer_length b) == 0\n ))\n (ensures (buffer_readable h b))\n [SMTPatOr [\n [SMTPat (buffer_readable h b)];\n [SMTPat (buffer_live h b)];\n ]]\nlet buffer_readable_intro_empty #t h b =\n buffer_readable_intro h b", "val preserved'\n (#t: Type)\n (#[EverParse3d.Util.solve_from_ctx ()] inst: input_stream_inst t)\n (x: t)\n (l: B.loc)\n (h h': HS.mem)\n : Lemma (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures\n (live x h' /\\ get_remaining x h' == get_remaining x h /\\ get_read x h' == get_read x h))\n [\n SMTPatOr\n [\n [SMTPat (live x h); SMTPat (B.modifies l h h')];\n [SMTPat (live x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h'); SMTPat (B.modifies l h h')]\n ]\n ]\nlet preserved'\n (#t: Type)\n (# [EverParse3d.Util.solve_from_ctx ()] inst : input_stream_inst t)\n (x: t)\n (l: B.loc)\n (h: HS.mem)\n (h' : HS.mem)\n : Lemma\n (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures (\n live x h' /\\\n get_remaining x h' == get_remaining x h /\\\n get_read x h' == get_read x h\n ))\n [SMTPatOr [\n [SMTPat (live x h); SMTPat (B.modifies l h h')];\n [SMTPat (live x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h'); SMTPat (B.modifies l h h')];\n ]]\n= preserved x l h h'", "val holds_st_var\n (x: var)\n (v: nstype int)\n (a b: heap)\n: Lemma\n (holds (st_var x v) a b <==> holds v (sel a x) (sel b x))\n [SMTPat (holds (st_var x v) a b)]\nlet holds_st_var\n (x: var)\n (v: nstype int)\n (a b: heap)\n: Lemma\n (holds (st_var x v) a b <==> holds v (sel a x) (sel b x))\n [SMTPat (holds (st_var x v) a b)]\n= holds_equiv (st_var x v) a b", "val struct_create (s: struct_typ) (l: struct_literal s)\n : Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\nlet struct_create\n (s: struct_typ)\n (l: struct_literal s)\n: Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n= struct_create_fun s (fun_of_list s l)", "val is_dom_mem (l: ss_dom) (m: ss_map)\n : Lemma (requires is_dom l m)\n (ensures\n forall (x: var). {:pattern L.memP x l\\/Map.contains m x} L.memP x l <==> Map.contains m x)\n [SMTPat (is_dom l m)]\nlet rec is_dom_mem (l:ss_dom) (m:ss_map)\n : Lemma\n (requires is_dom l m)\n (ensures forall (x:var).{:pattern L.memP x l \\/ Map.contains m x}\n L.memP x l <==> Map.contains m x)\n [SMTPat (is_dom l m)] =\n match l with\n | [] -> ()\n | y::tl -> is_dom_mem tl (remove_map m y)", "val inspect_pack_namedv (t:R.namedv_view)\n : Lemma (ensures R.(inspect_namedv (pack_namedv t) == t))\n [SMTPat R.(inspect_namedv (pack_namedv t))]\nlet inspect_pack_namedv = R.inspect_pack_namedv", "val modifies_refl (s:loc) (h:vale_heap) : Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]\nlet modifies_refl s h = M.modifies_refl s (_ih h).hs", "val modifies_refl (s:loc) (h:vale_heap) : Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]\nlet modifies_refl s h = M.modifies_refl s (_ih h).hs", "val get_value (#l: P.union_typ) (#tgs: tags l) (tu: t l tgs) (f: P.struct_field l)\n : Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (get_field tu == f))\n (ensures (fun _ -> True))\nlet get_value\n (#l: P.union_typ) (#tgs: tags l)\n (tu: t l tgs)\n (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (get_field tu == f))\n (ensures (fun _ -> True))\n=\n raw_get_value #l tu f", "val type_of_typ_union (l: union_typ)\n : Lemma (type_of_typ (TUnion l) == union l) [SMTPat (type_of_typ (TUnion l))]\nlet type_of_typ_union\n (l: union_typ)\n: Lemma\n (type_of_typ (TUnion l) == union l)\n [SMTPat (type_of_typ (TUnion l))]\n= assert_norm (type_of_typ (TUnion l) == union l)", "val elab_ty_open_commute (e: src_ty) (v: var)\n : Lemma (RT.open_term (elab_ty e) v == elab_ty (open_ty e v))\n [SMTPat (RT.open_term (elab_ty e) v)]\nlet elab_ty_open_commute (e:src_ty) (v:var)\n : Lemma (RT.open_term (elab_ty e) v == elab_ty (open_ty e v))\n [SMTPat (RT.open_term (elab_ty e) v)]\n = elab_ty_open_commute' 0 e (EVar v);\n RT.open_term_spec (elab_ty e) v", "val modifies_refl\n (s: loc)\n (h: HS.mem)\n: Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]\nlet modifies_refl = MG.modifies_refl", "val modifies_refl\n (s: loc)\n (h: HS.mem)\n: Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]\nlet modifies_refl = MG.modifies_refl", "val raw_get_value (#l: P.union_typ) (tu: raw l) (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (raw_get_field tu == f))\n (ensures (fun _ -> True))\nlet raw_get_value (#l: P.union_typ) (tu: raw l) (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (raw_get_field tu == f))\n (ensures (fun _ -> True))\n=\n let u : P.union l = P.struct_sel #(typ_l l) tu (union_field l) in\n P.union_get_value u f", "val valid_list_elim\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos pos': U32.t)\n : Lemma (requires (valid_list p h sl pos pos'))\n (ensures\n (k.parser_kind_subkind == Some ParserStrong /\\ k.parser_kind_low > 0 /\\ live_slice h sl /\\\n U32.v pos <= U32.v pos' /\\ U32.v pos' <= U32.v sl.len))\n [SMTPat (valid_list p h sl pos pos')]\nlet valid_list_elim\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos: U32.t)\n (pos' : U32.t)\n: Lemma\n (requires (valid_list p h sl pos pos'))\n (ensures (\n k.parser_kind_subkind == Some ParserStrong /\\\n k.parser_kind_low > 0 /\\\n live_slice h sl /\\\n U32.v pos <= U32.v pos' /\\\n U32.v pos' <= U32.v sl.len\n ))\n [SMTPat (valid_list p h sl pos pos')]\n= valid_list_equiv p h sl pos pos'", "val field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)\n : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))\nlet rec field_of_tag'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (t: UInt32.t)\n: Pure (P.struct_field' l)\n (requires (List.Tot.mem t tgs))\n (ensures (fun _ -> True))\n= let ((f, _) :: l') = l in\n let (t' :: tgs') = tgs in\n if t = t' then f\n else (\n assert (Cons? l');\n let ff' : string = field_of_tag' #l' tgs' t in\n ff'\n )", "val full_union_set_field_elim\n (#tn #tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n : Lemma (requires (full (union0 tn n fields) (union_set_field tn n fields field v)))\n (ensures (full (fields.fd_typedef field) v))\nlet full_union_set_field_elim\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n: Lemma\n (requires (\n full (union0 tn n fields) (union_set_field tn n fields field v)\n ))\n (ensures (\n full (fields.fd_typedef field) v\n ))\n= full_union (union_set_field tn n fields field v) field", "val full_union_set_field_elim\n (#tn #tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n : Lemma (requires (full (union0 tn n fields) (union_set_field tn n fields field v)))\n (ensures (full (fields.fd_typedef field) v))\nlet full_union_set_field_elim\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (field: field_t fields)\n (v: fields.fd_type field)\n: Lemma\n (requires (\n full (union0 tn n fields) (union_set_field tn n fields field v)\n ))\n (ensures (\n full (fields.fd_typedef field) v\n ))\n= full_union (union_set_field tn n fields field v) field", "val define_struct\n (n: string)\n (#tf #tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet define_struct (n: string) (#tf: Type0) (#tn: Type0) (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= define_struct0 tn #tf n fields", "val define_struct\n (n: string)\n (#tf #tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet define_struct (n: string) (#tf: Type0) (#tn: Type0) (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= define_struct0 tn #tf n fields", "val core_create_lemma_readable\n (#max_arity: nat)\n (#arg_reg: IX64.arg_reg_relation max_arity)\n (args: IX64.arg_list)\n (h0: HS.mem{mem_roots_p h0 args})\n : Lemma\n (ensures\n (let va_s = LSig.create_initial_vale_state #max_arity #arg_reg args h0 in\n VSig.readable args (ME.get_vale_heap va_s.VS.vs_heap)))\nlet core_create_lemma_readable\n (#max_arity:nat)\n (#arg_reg:IX64.arg_reg_relation max_arity)\n (args:IX64.arg_list)\n (h0:HS.mem{mem_roots_p h0 args})\n : Lemma\n (ensures\n (let va_s = LSig.create_initial_vale_state #max_arity #arg_reg args h0 in\n VSig.readable args (ME.get_vale_heap va_s.VS.vs_heap)))\n =\n let readable_registered_one (a:arg) (h:ME.vale_heap)\n : Lemma VSig.(arg_is_registered_root h a <==> readable_one h a)\n = match a with\n | (| TD_Buffer src bt _, x |) ->\n Vale.AsLowStar.MemoryHelpers.reveal_readable #src #bt x h;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal src bt x\n | (| TD_ImmBuffer src bt ig, x |) ->\n Vale.AsLowStar.MemoryHelpers.reveal_imm_readable #src #bt x h;\n assert_norm (ME.buffer_readable h (as_vale_immbuffer #src #bt x) <==>\n VSig.readable_one h (| TD_ImmBuffer src bt ig, x |))\n | (| TD_Base _, _ |) -> ()\n in\n let rec readable_registered_all\n (args:list arg)\n (h:ME.vale_heap {forall x. List.memP x args ==> arg_is_registered_root h x})\n : Lemma VSig.(readable args h)\n = match args with\n | [] -> ()\n | hd::tl ->\n readable_cons hd tl h;\n readable_registered_one hd h;\n readable_registered_all tl h\n in\n let readable_mk_mem\n (args:list arg)\n (h:mem_roots args)\n : Lemma\n (let mem = mk_mem args h in\n VSig.readable args (create_initial_vale_heap mem))\n = let mem = mk_mem args h in\n FStar.Classical.forall_intro (FStar.Classical.move_requires (args_b8_lemma args));\n readable_registered_all args (create_initial_vale_heap mem)\n in\n readable_mk_mem args h0", "val choose_m: #k:eqtype -> #v:Type -> #f:cmp k -> m:ordmap k v f\n -> Lemma (requires (~ (equal m (empty #k #v #f))))\n (ensures (Some? (choose #k #v #f m) /\\\n (select #k #v #f (fst (Some?.v (choose #k #v #f m))) m ==\n Some (snd (Some?.v (choose #k #v #f m)))) /\\\n (equal m (update #k #v #f (fst (Some?.v (choose #k #v #f m)))\n (snd (Some?.v (choose #k #v #f m)))\n (remove #k #v #f (fst (Some?.v (choose #k #v #f m))) m)))))\n [SMTPat (choose #k #v #f m)]\nlet choose_m (#k:eqtype) (#v:Type) #f m =\n dom_empty_helper #k #v #f m;\n let c = choose #k #v #f m in\n match c with\n | None -> ()\n | Some (x, y) ->\n let m' = remove #k #v #f x m in\n let (Mk_map s' g') = m' in\n let (Mk_map s'' g'') = update #k #v #f x y m' in\n cut (feq (Mk_map?.m m) g'')", "val struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool\nlet struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool =\n List.Tot.sortWith FStar.String.compare (List.Tot.map fst s.fields) =\n List.Tot.sortWith FStar.String.compare\n (List.Tot.map (dfst_struct_field s) l)", "val upd_sel : #a:Type -> h:heap -> r:ref a ->\n\t Lemma (requires (h `contains_a_well_typed` r))\n\t (ensures (upd h r (sel h r) == h))\n\t [SMTPat (upd h r (sel h r))]\nlet upd_sel #a h r =\n assert (FStar.FunctionalExtensionality.feq (upd h r (sel h r)).memory h.memory)", "val holds_on_raw_data_item_eq_simple (p: (raw_data_item -> bool)) (v: simple_value)\n : Lemma (holds_on_raw_data_item p (Simple v) == p (Simple v))\n [SMTPat (holds_on_raw_data_item p (Simple v))]\nlet holds_on_raw_data_item_eq_simple\n (p: (raw_data_item -> bool))\n (v: simple_value)\n: Lemma\n (holds_on_raw_data_item p (Simple v) == p (Simple v))\n [SMTPat (holds_on_raw_data_item p (Simple v))]\n= holds_on_raw_data_item_eq p (Simple v)", "val global_variables_unaddressed_in_object_values_equivalent_to_forall\n (vs: list var_id_t)\n (values: list object_value_t)\n : Lemma\n (ensures\n global_variables_unaddressed_in_object_values vs values <==>\n (forall value.\n contains_ubool value values ==> global_variables_unaddressed_in_object_value vs value))\n [SMTPat (global_variables_unaddressed_in_object_values vs values)]\nlet global_variables_unaddressed_in_object_values_equivalent_to_forall (vs: list var_id_t) (values: list object_value_t)\n : Lemma (ensures global_variables_unaddressed_in_object_values vs values <==>\n (forall value. contains_ubool value values ==> global_variables_unaddressed_in_object_value vs value))\n [SMTPat (global_variables_unaddressed_in_object_values vs values)] =\n for_all_ghost_equivalent_to_forall (global_variables_unaddressed_in_object_value vs) values", "val lemma_upd_eq (r:flag) (v:flag_val_t) (m:t) : Lemma\n (requires True)\n (ensures sel r (upd r v m) == v)\n [SMTPat (sel r (upd r v m))]\nlet lemma_upd_eq r v m =\n reveal_opaque (`%sel) sel;\n reveal_opaque (`%upd) upd;\n Map.lemma_SelUpd1 m r v", "val d_skip\n (p: sttype)\n: Lemma\n (exec_equiv p p skip skip)\n [SMTPat (exec_equiv p p skip skip)]\nlet d_skip\n (p: sttype)\n: Lemma\n (exec_equiv p p skip skip)\n [SMTPat (exec_equiv p p skip skip)]\n= Benton2004.d_skip p", "val length_functional (#a: _) (h: HS.mem) (c: t a) (l1 l2: list a)\n : Lemma (requires (well_formed h c l1 /\\ well_formed h c l2))\n (ensures (l1 == l2))\n (decreases (G.reveal l1))\n [SMTPat (well_formed h c l1); SMTPat (well_formed h c l2)]\nlet rec length_functional #a (h: HS.mem) (c: t a) (l1 l2: list a):\n Lemma\n (requires (well_formed h c l1 /\\ well_formed h c l2))\n (ensures (l1 == l2))\n (decreases (G.reveal l1))\n [ SMTPat (well_formed h c l1); SMTPat (well_formed h c l2) ] =\n if B.g_is_null c\n then ()\n else\n let { next=next } = B.get h c 0 in\n length_functional h next (G.hide (L.tl l1)) (G.hide (L.tl l2))", "val holds_on_raw_data_item_eq_int64\n (p: (raw_data_item -> bool))\n (typ: major_type_uint64_or_neg_int64)\n (v: U64.t)\n : Lemma (holds_on_raw_data_item p (Int64 typ v) == p (Int64 typ v))\n [SMTPat (holds_on_raw_data_item p (Int64 typ v))]\nlet holds_on_raw_data_item_eq_int64\n (p: (raw_data_item -> bool))\n (typ: major_type_uint64_or_neg_int64)\n (v: U64.t)\n: Lemma\n (holds_on_raw_data_item p (Int64 typ v) == p (Int64 typ v))\n [SMTPat (holds_on_raw_data_item p (Int64 typ v))]\n= holds_on_raw_data_item_eq p (Int64 typ v)", "val object_lacking_pointer_field_global_variables_unaddressed\n (vs: list var_id_t)\n (value: object_value_t)\n : Lemma\n (requires object_td_lacks_pointer_field (object_value_to_td value) /\\ object_value_valid value\n ) (ensures global_variables_unaddressed_in_object_value vs value) (decreases rank value)\nlet rec object_lacking_pointer_field_global_variables_unaddressed\n (vs: list var_id_t)\n (value: object_value_t)\n : Lemma (requires object_td_lacks_pointer_field (object_value_to_td value)\n /\\ object_value_valid value)\n (ensures global_variables_unaddressed_in_object_value vs value)\n (decreases rank value)\n = match value with\n | ObjectValuePrimitive value ->\n ()\n | ObjectValueStruct fields ->\n objects_lacking_pointer_field_global_variables_unaddressed vs fields\n | ObjectValueArray element_td elements -> begin\n objects_lacking_pointer_field_global_variables_unaddressed vs elements;\n global_variables_unaddressed_in_object_value_seq_equivalent_to_forall vs elements\n end\n | ObjectValueAbstract _ _ -> ()\n\nand objects_lacking_pointer_field_global_variables_unaddressed\n (vs: list var_id_t)\n (values: seq object_value_t)\n : Lemma (requires (forall value. contains values value ==> object_value_valid value)\n /\\ (forall value. contains values value ==> object_td_lacks_pointer_field (object_value_to_td value)))\n (ensures forall value. contains values value ==> global_variables_unaddressed_in_object_value vs value)\n (decreases rank values)\n = if length values = 0 then\n ()\n else begin\n object_lacking_pointer_field_global_variables_unaddressed vs (index values 0);\n objects_lacking_pointer_field_global_variables_unaddressed vs (drop values 1)\n end", "val open_exp_freevars (e: src_exp) (v: var) (n: nat)\n : Lemma\n (((freevars e) `Set.subset` (freevars (open_exp' e v n))) /\\\n ((freevars (open_exp' e v n)) `Set.subset` ((freevars e) `Set.union` (Set.singleton v))))\n [SMTPat (freevars (open_exp' e v n))]\nlet rec open_exp_freevars (e:src_exp) (v:var) (n:nat)\n : Lemma ((freevars e `Set.subset` freevars (open_exp' e v n)) /\\\n (freevars (open_exp' e v n) `Set.subset` (freevars e `Set.union` Set.singleton v)))\n [SMTPat (freevars (open_exp' e v n))]\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 ->\n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | EIf b e1 e2 ->\n open_exp_freevars b v n; \n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | ELam t e ->\n open_exp_freevars e v (n + 1)", "val union_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : stt (ref td')\n (pts_to r v)\n (fun r' -> has_union_field r field r' ** pts_to r' (union_get_field v field))\nlet union_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: stt (ref td')\n (pts_to r v)\n (fun r' -> has_union_field r field r' ** pts_to r' (union_get_field v field))\n= union_field0 t' r field td'", "val read : #a:Type -> \n r:ref a -> \n\t ImmutableST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t\t\t\t x == sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val buffer_readable_reveal\n (#max_arity:nat)\n (src bt:base_typ)\n (x:buf_t src bt)\n (args:IX64.arity_ok max_arity arg)\n (h0:HS.mem{mem_roots_p h0 args}) : Lemma (\n let mem = mk_mem args h0 in\n ME.buffer_readable (create_initial_vale_heap mem) (as_vale_buffer x) <==>\n List.memP (mut_to_b8 src x) (ptrs_of_mem mem))\nlet buffer_readable_reveal #max_arity src bt x args h0 = FStar.Pervasives.reveal_opaque (`%ME.get_vale_heap) ME.get_vale_heap", "val pack_inspect_fv (fv:R.fv)\n : Lemma (ensures R.pack_fv (R.inspect_fv fv) == fv)\n [SMTPat (R.pack_fv (R.inspect_fv fv))]\nlet pack_inspect_fv = R.pack_inspect_fv", "val pack_inspect_namedv (t:R.namedv)\n : Lemma (ensures R.(pack_namedv (inspect_namedv t) == t))\n [SMTPat R.(pack_namedv (inspect_namedv t))]\nlet pack_inspect_namedv = R.pack_inspect_namedv", "val holds_on_raw_data_item_eq_string\n (p: (raw_data_item -> bool))\n (typ: major_type_byte_string_or_text_string)\n (v: Seq.seq U8.t {FStar.UInt.fits (Seq.length v) U64.n})\n : Lemma (holds_on_raw_data_item p (String typ v) == p (String typ v))\n [SMTPat (holds_on_raw_data_item p (String typ v))]\nlet holds_on_raw_data_item_eq_string\n (p: (raw_data_item -> bool))\n (typ: major_type_byte_string_or_text_string)\n (v: Seq.seq U8.t { FStar.UInt.fits (Seq.length v) U64.n })\n: Lemma\n (holds_on_raw_data_item p (String typ v) == p (String typ v))\n [SMTPat (holds_on_raw_data_item p (String typ v))]\n= holds_on_raw_data_item_eq p (String typ v)", "val deref_cells_is_v (#a: _) (h: HS.mem) (ll: t a) (l: list a)\n : Lemma (requires well_formed h ll l /\\ invariant h ll l)\n (ensures gmap (deref_data h) (cells h ll l) == l)\n (decreases l)\n [SMTPat (well_formed h ll l)]\nlet rec deref_cells_is_v #a (h: HS.mem) (ll: t a) (l: list a): Lemma\n (requires\n well_formed h ll l /\\\n invariant h ll l)\n (ensures\n gmap (deref_data h) (cells h ll l) == l)\n (decreases l)\n [ SMTPat (well_formed h ll l) ]\n=\n if B.g_is_null ll then\n ()\n else\n deref_cells_is_v h (B.deref h ll).next (List.Tot.tl l)", "val elab_ty_open_with_commute (e: src_ty) (v: src_exp)\n : Lemma (RT.open_with (elab_ty e) (elab_exp v) == elab_ty (open_ty_with e v))\n [SMTPat (RT.open_with (elab_ty e) (elab_exp v))]\nlet elab_ty_open_with_commute (e:src_ty) (v:src_exp)\n : Lemma (RT.open_with (elab_ty e) (elab_exp v) == elab_ty (open_ty_with e v))\n [SMTPat (RT.open_with (elab_ty e) (elab_exp v))]\n = elab_ty_open_commute' 0 e v;\n RT.open_with_spec (elab_ty e) (elab_exp v)", "val d_esub\n (#t: Type0)\n (f f' : exp t)\n (ph ph': sttype)\n (p p': nstype t)\n: Lemma\n (requires (\n eval_equiv ph p f f' /\\\n included ph' ph /\\\n included p p'\n ))\n (ensures (eval_equiv ph' p' f f'))\n [SMTPat (eval_equiv ph' p' f f'); SMTPat (eval_equiv ph p f f')]\nlet d_esub\n (#t: Type0)\n (f f' : exp t)\n (ph ph': sttype)\n (p p': nstype t)\n: Lemma\n (requires (\n eval_equiv ph p f f' /\\\n included ph' ph /\\\n included p p'\n ))\n (ensures (eval_equiv ph' p' f f'))\n [SMTPat (eval_equiv ph' p' f f'); SMTPat (eval_equiv ph p f f')]\n= Benton2004.d_esub f f' ph ph' p p'", "val read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t))\n : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1\n )\nlet read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t)) : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p . (* {:pattern (mk_fraction (scalar t) (mk_scalar v0) p)} *) Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1)\n= let v0 = FStar.IndefiniteDescription.indefinite_description_tot _ (fun v0 -> exists p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p) in\n let p = FStar.IndefiniteDescription.indefinite_description_tot _ (fun p -> Ghost.reveal v == mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p) in\n let prf v0' p' : Lemma\n (requires (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p'))\n (ensures (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = mk_scalar_inj (Ghost.reveal v0) v0' p p'\n in\n let prf' v0' p' : Lemma\n (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p' ==> (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = Classical.move_requires (prf v0') p'\n in\n Classical.forall_intro_2 prf';\n rewrite (pts_to _ _) (pts_to r (mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p));\n let v1 = read0 r in\n rewrite (pts_to _ _) (pts_to r v);\n return v1", "val lemma_valid_descendent_hash_valid_voption: #rrel: _ -> #rel: _ -> s:LL.slice rrel rel -> pos:U32.t -> h:HyperStack.mem -> Lemma\n (requires LL.valid descendent_hash_parser h s pos)\n (ensures (LL.valid voption_parser h s pos /\\ LL.contents voption_parser h s pos == tag_of_descendent_hash (LL.contents descendent_hash_parser h s pos)))\n [SMTPat (LL.valid descendent_hash_parser h s pos)]\nlet lemma_valid_descendent_hash_valid_voption #_ #_ s pos h =\n assert_norm (LP.parse_sum_kind (LP.get_parser_kind voption_repr_parser) descendent_hash_sum parse_descendent_hash_cases == descendent_hash_parser_kind);\n LL.valid_sum_elim_tag h descendent_hash_sum voption_repr_parser parse_descendent_hash_cases s pos;\n lemma_synth_voption_inj ();\n LL.valid_synth h parse_voption_key synth_voption s pos", "val gfield\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: GTot (p': P.pointer (P.typ_of_struct_field l f) { P.includes p p' })\nlet gfield\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: GTot (p': P.pointer (P.typ_of_struct_field l f) { P.includes p p' })\n= P.gufield (P.gfield p (union_field l)) f", "val swap_struct (p: ref point) (v: Ghost.erased (typeof point))\n : ST (Ghost.erased (typeof point))\n (p `pts_to` v)\n (fun v' -> p `pts_to` v')\n (requires\n exists (vx: U32.t) (vy: U32.t).\n struct_get_field v \"x\" == mk_scalar vx /\\ struct_get_field v \"y\" == mk_scalar vy)\n (ensures\n fun v' ->\n struct_get_field v' \"x\" == struct_get_field v \"y\" /\\\n struct_get_field v' \"y\" == struct_get_field v \"x\")\nlet swap_struct (p: ref point) (v: Ghost.erased (typeof point))\n: ST (Ghost.erased (typeof point))\n (p `pts_to` v)\n (fun v' -> p `pts_to` v')\n (requires\n exists (vx vy: U32.t) . struct_get_field v \"x\" == mk_scalar vx /\\ struct_get_field v \"y\" == mk_scalar vy\n )\n (ensures fun v' ->\n struct_get_field v' \"x\" == struct_get_field v \"y\" /\\\n struct_get_field v' \"y\" == struct_get_field v \"x\"\n )\n= let px = struct_field p \"x\" () in\n let py = struct_field p \"y\" () in\n let x = read px in\n let y = read py in\n write px y;\n write py x;\n let _ = unstruct_field p \"x\" px in\n let _ = unstruct_field p \"y\" py in\n drop (has_struct_field _ _ px);\n drop (has_struct_field _ _ _);\n return _", "val swap_struct (p: ref point) (v: Ghost.erased (typeof point))\n : ST (Ghost.erased (typeof point))\n (p `pts_to` v)\n (fun v' -> p `pts_to` v')\n (requires\n exists (vx: U32.t) (vy: U32.t).\n struct_get_field v \"x\" == mk_scalar vx /\\ struct_get_field v \"y\" == mk_scalar vy)\n (ensures\n fun v' ->\n struct_get_field v' \"x\" == struct_get_field v \"y\" /\\\n struct_get_field v' \"y\" == struct_get_field v \"x\")\nlet swap_struct (p: ref point) (v: Ghost.erased (typeof point))\n: ST (Ghost.erased (typeof point))\n (p `pts_to` v)\n (fun v' -> p `pts_to` v')\n (requires\n exists (vx vy: U32.t) . struct_get_field v \"x\" == mk_scalar vx /\\ struct_get_field v \"y\" == mk_scalar vy\n )\n (ensures fun v' ->\n struct_get_field v' \"x\" == struct_get_field v \"y\" /\\\n struct_get_field v' \"y\" == struct_get_field v \"x\"\n )\n= let px = struct_field p \"x\" () in\n let py = struct_field p \"y\" () in\n let x = read px in\n let y = read py in\n write px y;\n write py x;\n let _ = unstruct_field p \"x\" px in\n let _ = unstruct_field p \"y\" py in\n drop (has_struct_field _ _ px);\n drop (has_struct_field _ _ _);\n return _", "val correct (#l: nat) (b:Seq.seq UInt8.t{Seq.length b = l})\n : Lemma (reveal #l (hide b) == b)\n [SMTPat (reveal #l (hide b))]\nlet correct #l (b:Seq.seq UInt8.t{Seq.length b = l})\n : Lemma (reveal #l (hide b) == b)\n [SMTPat (reveal #l (hide b))]\n=\n assert (reveal #l (hide b) `Seq.equal` b)", "val slice_access_frame_strong\n (#rrel #rel: _)\n (h: HS.mem)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n k1.parser_kind_subkind == Some ParserStrong /\\\n valid p1 h sl pos /\\\n cl.clens_cond (contents p1 h sl pos) /\\\n B.modifies l h h' /\\\n B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos))\n ))\n (ensures (\n valid p1 h' sl pos /\\\n cl.clens_cond (contents p1 h' sl pos) /\\\n slice_access h' g sl pos == slice_access h g sl pos\n ))\n [SMTPatOr [\n [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')];\n ]]\nlet slice_access_frame_strong\n (#rrel #rel: _)\n (h: HS.mem)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n k1.parser_kind_subkind == Some ParserStrong /\\\n valid p1 h sl pos /\\\n cl.clens_cond (contents p1 h sl pos) /\\\n B.modifies l h h' /\\\n B.loc_disjoint l (loc_slice_from_to sl pos (get_valid_pos p1 h sl pos))\n ))\n (ensures (\n valid p1 h' sl pos /\\\n cl.clens_cond (contents p1 h' sl pos) /\\\n slice_access h' g sl pos == slice_access h g sl pos\n ))\n [SMTPatOr [\n [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')];\n ]]\n= valid_facts p1 h sl pos;\n valid_facts p1 h' sl pos;\n slice_access_eq h g sl pos;\n slice_access_eq h' g sl pos;\n let pos2 = get_valid_pos p1 h sl pos in\n parse_strong_prefix p1 (bytes_of_slice_from h sl pos) (bytes_of_slice_from_to h sl pos pos2);\n B.modifies_buffer_from_to_elim sl.base pos (get_valid_pos p1 h sl pos) l h h' ;\n parse_strong_prefix p1 (bytes_of_slice_from_to h' sl pos pos2) (bytes_of_slice_from h' sl pos)", "val lemma_valid_value_valid_value_kind: #rrel: _ -> #rel: _ -> s:LL.slice rrel rel -> pos:U32.t -> h:HyperStack.mem -> Lemma\n (requires LL.valid value_parser h s pos)\n (ensures (LL.valid value_kind_parser h s pos /\\ LL.contents value_kind_parser h s pos == tag_of_value (LL.contents value_parser h s pos)))\n [SMTPat (LL.valid value_parser h s pos)]\nlet lemma_valid_value_valid_value_kind #_ #_ s pos h =\n assert_norm (LP.parse_sum_kind (LP.get_parser_kind value_kind_repr_parser) value_sum parse_value_cases == value_parser_kind);\n LL.valid_sum_elim_tag h value_sum value_kind_repr_parser parse_value_cases s pos;\n lemma_synth_value_kind_inj ();\n LL.valid_synth h parse_value_kind_key synth_value_kind s pos", "val open_with_fvar_id (fv: R.fv) (x: R.term)\n : Lemma (RT.open_with (R.pack_ln (R.Tv_FVar fv)) x == (R.pack_ln (R.Tv_FVar fv)))\n [SMTPat (RT.open_with (R.pack_ln (R.Tv_FVar fv)) x)]\nlet open_with_fvar_id (fv:R.fv) (x:R.term)\n : Lemma (RT.open_with (R.pack_ln (R.Tv_FVar fv)) x == (R.pack_ln (R.Tv_FVar fv)))\n [SMTPat (RT.open_with (R.pack_ln (R.Tv_FVar fv)) x)]\n = RT.open_with_spec (R.pack_ln (R.Tv_FVar fv)) x" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.readable_intro" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_typ_struct" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_get_field_pat" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_get_field_pat" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field_of_tag_of_field'" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.modifies_1_valid" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.includes_gfield_gen" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.get_set" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.get_set" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field_of_tag_of_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_depth_typ_of_struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gfield_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gfield_l" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.struct_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.tag_of_field_of_tag'" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gufield_r" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_field" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_field" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_field1" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.includes_gufield_gen" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.unstruct_field_alt" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field'" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.unstruct_field_and_drop" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field''" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_field1" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_of_struct_field" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.unstruct_field_alt" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gufield_l" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.fun_of_list" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_of_struct_field'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_field'" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.includes_gfield_gen" }, { "project_name": "everparse", "file_name": "EverParse3d.Readable.fsti", "name": "EverParse3d.Readable.readable_frame" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.write" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_types_are_closed1" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Union.fsti", "name": "Steel.ST.C.Types.Union.full_union_set_field" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.full_union_set_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.tag_of_field_of_tag" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.fst", "name": "Strategies.GlobalVars.object_tds_lack_pointer_field_equivalent_to_forall" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.stlc_types_are_closed1" }, { "project_name": "Armada", "file_name": "Armada.Memory.fst", "name": "Armada.Memory.object_storage_to_value_equivalent_to_map" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.hide_raise_reveal" }, { "project_name": "Armada", "file_name": "Armada.Memory.fst", "name": "Armada.Memory.object_storage_to_td_equivalent_to_map" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.modifies_buffer_elim" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.modifies_buffer_elim" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Wrapper.fst", "name": "Vale.AsLowStar.Wrapper.readable_cons" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.buffer_readable_intro_empty" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.Base.fst", "name": "EverParse3d.InputStream.Base.preserved'" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fst", "name": "Benton2004.DDCC.holds_st_var" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_create" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Substs.fst", "name": "Pulse.Checker.Prover.Substs.is_dom_mem" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.inspect_pack_namedv" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.modifies_refl" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.modifies_refl" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.get_value" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_typ_union" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.elab_ty_open_commute" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_refl" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_refl" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.raw_get_value" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_list_elim" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.field_of_tag'" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.full_union_set_field_elim" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Union.fsti", "name": "Steel.ST.C.Types.Union.full_union_set_field_elim" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.define_struct" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.define_struct" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Wrapper.fst", "name": "Vale.AsLowStar.Wrapper.core_create_lemma_readable" }, { "project_name": "FStar", "file_name": "FStar.OrdMap.fst", "name": "FStar.OrdMap.choose_m" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_literal_wf" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.fst", "name": "FStar.DM4F.Heap.upd_sel" }, { "project_name": "steel", "file_name": "CBOR.Spec.Type.fsti", "name": "CBOR.Spec.Type.holds_on_raw_data_item_eq_simple" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.fst", "name": "Strategies.GlobalVars.global_variables_unaddressed_in_object_values_equivalent_to_forall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Flags.fst", "name": "Vale.X64.Flags.lemma_upd_eq" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fst", "name": "Benton2004.DDCC.d_skip" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.length_functional" }, { "project_name": "steel", "file_name": "CBOR.Spec.Type.fsti", "name": "CBOR.Spec.Type.holds_on_raw_data_item_eq_int64" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.UnaddressedStatement.fst", "name": "Strategies.GlobalVars.UnaddressedStatement.object_lacking_pointer_field_global_variables_unaddressed" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.open_exp_freevars" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.union_field1" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.read" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.MemoryHelpers.fst", "name": "Vale.AsLowStar.MemoryHelpers.buffer_readable_reveal" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.pack_inspect_fv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.pack_inspect_namedv" }, { "project_name": "steel", "file_name": "CBOR.Spec.Type.fsti", "name": "CBOR.Spec.Type.holds_on_raw_data_item_eq_string" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.deref_cells_is_v" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.elab_ty_open_with_commute" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fst", "name": "Benton2004.DDCC.d_esub" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.read" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Descendent_hash.fst", "name": "Zeta.Formats.Aux.Descendent_hash.lemma_valid_descendent_hash_valid_voption" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.gfield" }, { "project_name": "steel", "file_name": "PointStructDirectDef.fst", "name": "PointStructDirectDef.swap_struct" }, { "project_name": "steel", "file_name": "PointStruct.fst", "name": "PointStruct.swap_struct" }, { "project_name": "everquic-crypto", "file_name": "Model.Helpers.fst", "name": "Model.Helpers.correct" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fst", "name": "LowParse.Low.Base.Spec.slice_access_frame_strong" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Value.fst", "name": "Zeta.Formats.Aux.Value.lemma_valid_value_valid_value_kind" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.open_with_fvar_id" } ], "selected_premises": [ "FStar.Pointer.Base.otype_of_struct_field", "FStar.Pointer.Base.struct_sel", "FStar.Pointer.Base.struct_create_fun", "FStar.Pointer.Base.otype_of_typ", "FStar.Pointer.Base.otype_of_typ_struct", "FStar.Pointer.Base.ounion", "FStar.Pointer.Base.struct_field_is_readable", "FStar.Pointer.Base.ostruct", "FStar.Pointer.Base.dummy_val", "FStar.Pointer.Base.step_typ_depth", "FStar.Pointer.Base.buffer", "FStar.Pointer.Base.npointer", "FStar.Pointer.Base.ovalue_is_readable", "FStar.Pointer.Base.type_of_typ'_eq", "FStar.Pointer.Base.struct", "FStar.Pointer.Base.type_of_typ'", "FStar.Pointer.Base.ovalue_is_readable_struct_intro", "FStar.Pointer.Base.path_typ_depth", "FStar.Heap.trivial_preorder", "FStar.Pointer.Base.union_get_value", "FStar.Pointer.Base.g_is_null", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Pointer.Base.ostruct_sel", "FStar.Pointer.Base.ostruct_create", "FStar.Pointer.Base.ovalue_is_readable_struct_intro'", "FStar.Monotonic.HyperStack.sel", "FStar.Pointer.Base.union_create", "FStar.Pointer.Base.not_an_array_cell", "FStar.UInt.size", "FStar.Pointer.Base.struct_upd", "FStar.Pointer.Base.ostruct_upd", "FStar.Pointer.Base.buffer_root_length", "FStar.Pointer.Base.otype_of_typ_union", "FStar.Pointer.Base.ounion_get_value", "FStar.Pointer.Base.nullptr", "FStar.Monotonic.HyperStack.live_region", "FStar.Pointer.Base.gtdata", "FStar.Pointer.Base.union", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Pointer.Base.ounion_create", "FStar.HyperStack.ST.is_eternal_region", "FStar.Pervasives.reveal_opaque", "FStar.Mul.op_Star", "FStar.Pointer.Base.ounion_get_key", "FStar.Monotonic.HyperStack.mreference", "FStar.Pointer.Base._gtdata_get_key", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Monotonic.HyperStack.as_addr", "FStar.Pointer.Base._union_get_key", "FStar.Pointer.Base.gtdata_get_value", "FStar.Pointer.Base.gtdata_create", "FStar.Monotonic.HyperStack.frameOf", "FStar.Pointer.Base.union_get_key", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Pointer.Base.gtdata_get_key", "FStar.Monotonic.HyperStack.contains", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Monotonic.HyperStack.is_eternal_region_hs", "FStar.Monotonic.HyperStack.is_in", "FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip", "FStar.Int.size", "FStar.ModifiesGen.loc_region_only", "FStar.Monotonic.HyperHeap.modifies", "FStar.ModifiesGen.loc_all_regions_from", "FStar.HyperStack.ST.is_freeable_heap_region", "FStar.Monotonic.HyperStack.poppable", "FStar.Heap.trivial_rel", "FStar.Preorder.preorder_rel", "FStar.Monotonic.HyperStack.is_eternal_region", "FStar.Monotonic.HyperStack.popped", "FStar.Monotonic.HyperStack.is_above", "FStar.HyperStack.ST.contains_region", "FStar.Monotonic.HyperStack.modifies_transitively", "FStar.Monotonic.Heap.mref", "FStar.Monotonic.HyperHeap.disjoint", "FStar.Int.op_At_Percent", "FStar.Ghost.tot_to_gtot", "FStar.Monotonic.HyperStack.top_frame", "FStar.Char.char_of_int", "FStar.Monotonic.HyperStack.mk_mreference", "FStar.Monotonic.HyperHeap.disjoint_regions", "FStar.Pervasives.st_post_h", "FStar.Monotonic.HyperStack.empty_mem", "FStar.Calc.calc_chain_related", "FStar.Map.const_on", "FStar.HyperStack.ST.equal_heap_dom", "FStar.Math.Lemmas.pow2_plus", "FStar.HyperStack.ref", "FStar.Monotonic.HyperStack.remove_elt", "FStar.Pervasives.id", "FStar.Monotonic.HyperStack.mods", "FStar.ModifiesGen.loc_disjoint_addresses", "FStar.Monotonic.Heap.modifies", "FStar.HyperStack.ST.equal_domains", "FStar.Math.Lib.signed_modulo" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Pointer.Base\n\nmodule DM = FStar.DependentMap\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\n(*** Definitions *)\n\n(** Pointers to data of type t.\n\n This defines two main types:\n - `npointer (t: typ)`, a pointer that may be \"NULL\";\n - `pointer (t: typ)`, a pointer that cannot be \"NULL\"\n (defined as a refinement of `npointer`).\n\n `nullptr #t` (of type `npointer t`) represents the \"NULL\" value.\n*)\n\n#set-options \"--initial_fuel 1 --initial_ifuel 1 --max_fuel 1 --max_ifuel 1\"\n\ntype step: (from: typ) -> (to: typ) -> Tot Type0 =\n | StepField:\n (l: struct_typ) ->\n (fd: struct_field l) ->\n step (TStruct l) (typ_of_struct_field l fd)\n | StepUField:\n (l: union_typ) ->\n (fd: struct_field l) ->\n step (TUnion l) (typ_of_struct_field l fd)\n | StepCell:\n (length: UInt32.t) ->\n (value: typ) ->\n (index: UInt32.t { UInt32.v index < UInt32.v length } ) ->\n step (TArray length value) value\n\ntype path (from: typ) : (to: typ) -> Tot Type0 =\n | PathBase:\n path from from\n | PathStep:\n (through: typ) ->\n (to: typ) ->\n (p: path from through) ->\n (s: step through to) ->\n path from to\n\nlet step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()\n\nlet rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s\n\n(*\nprivate\nlet not_cell\n (#from #to: typ)\n (p: path from to)\n: GTot bool\n= match p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nprivate type array_path (from: typ) (to_elem: typ) : (length: UInt32.t) -> Tot Type0 =\n| PSingleton:\n (p: path from to_elem { not_cell p } ) ->\n array_path from to_elem 1ul\n| PArray:\n length: UInt32.t ->\n path from (TArray length to_elem) ->\n array_path from to_elem length\n\nprivate let path' (from: typ) (to: typ) : Tot Type0 =\n if TArray? to\n then\n let length = TArray?.length to in\n (array_path from (TArray?.t to) length * (offset: UInt32.t & (length': UInt32.t {UInt32.v offset + UInt32.v length' <= UInt32.v length})))\n else path from to\n*)\n\nnoeq type _npointer (to : typ): Type0 =\n | Pointer:\n (from: typ) ->\n (contents: HS.aref) ->\n (p: path from to) ->\n _npointer to\n | NullPtr\n\nlet npointer (t: typ): Tot Type0 =\n _npointer t\n\n(** The null pointer *)\n\nlet nullptr (#t: typ): Tot (npointer t) = NullPtr\n\nlet g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false\n\nlet g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()\n\n(** Buffers *)\n\nlet not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nnoeq type buffer_root (t: typ) =\n| BufferRootSingleton:\n (p: pointer t { not_an_array_cell p } ) ->\n buffer_root t\n| BufferRootArray:\n (#max_length: array_length_t) ->\n (p: pointer (TArray max_length t)) ->\n buffer_root t\n\nlet buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len\n\nnoeq type _buffer (t: typ) =\n| Buffer:\n (broot: buffer_root t) ->\n (bidx: UInt32.t) ->\n (blength: UInt32.t { UInt32.v bidx + UInt32.v blength <= UInt32.v (buffer_root_length broot) } ) ->\n _buffer t\nlet buffer (t: typ): Tot Type0 = _buffer t\n\n(** Helper for the interpretation of unions.\n\n A C union is interpreted as a dependent pair of a key and a value (which\n depends on the key). The intent is for the key to be ghost, as it will not\n exist at runtime (C unions are untagged).\n\n Therefore,\n - `gtdata_get_key` (defined below) is in `GTot`, and\n - `gtdata_get_value` asks for the key `k` to read, and a proof that `k`\n matches the ghost key.\n*)\n\nlet gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )\n\nlet _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u\n\nlet gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u\n\nlet gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v\n\nlet gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)\n\nlet gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()\n\n(* Interprets a type code (`typ`) as a FStar type (`Type0`). *)\nlet rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\n\nlet rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()\n\n(** Interpretation of unions, as ghostly-tagged data\n (see `gtdata` for more information).\n*)\nlet _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v\n\nlet struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f\n\nlet struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v\n\nlet struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f\n\nlet struct_sel_struct_create_fun l f fd = ()\n\nlet union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v\n\nlet union_get_value #l v fd = gtdata_get_value v fd\n\nlet union_create l fd v = gtdata_create fd v\n\n(** For any `t: typ`, `dummy_val t` provides a default value of this type.\n\n This is useful to represent uninitialized data.\n*)\nlet rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul\n\n(** The interpretation of type codes (`typ`) defined previously (`type_of_typ`)\n maps codes to fully defined FStar types. In other words, a struct is\n interpreted as a dependent map where all fields have a well defined value.\n\n However, in practice, C structures (or any other type) can be uninitialized\n or partially-initialized.\n\n To account for that:\n\n - First, we define an alternative interpretation of type codes,\n `otype_of_typ`, which makes uninitialized data explicit (essentially\n wrapping all interpretations with `option`).\n\n This concrete interpretation is what is stored in the model of the heap,\n and what is manipulated internally. As it is quite verbose, it is not\n exposed to the user.\n\n - Then, interpretations with explicit uninitialized data (`otype_of_type t`)\n can be mapped to fully-initialized data (`type_of_type t`) by inserting\n dummy values. This is done by the `value_of_ovalue` function.\n\n - Finally, reading from a fully-initialized data is guarded by a `readable`\n predicate, which ensures that the dummy values cannot be accessed, and\n therefore that reading uninitialized data is actually forbidden.\n*)\n\nlet rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)\n\nlet otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ\n\nlet otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()\n\nlet otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()\n\nlet otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()\n\nlet ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))\n\nlet ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f\n\nlet ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)\n\nlet ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)\n\nlet otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)\n\nlet ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))\n\nlet ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)\n\nlet ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd\n\nlet ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)\n\nlet otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)\n\nlet struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true\n\nlet rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v\n\nlet ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)\n\nlet ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v\n", "sketch": [ "We want to prove that if a struct `v` is readable, then for any field `fd` in the struct, the value of that field is also readable. \n\nStep 1: We will assume that the struct `v` is readable, and then we will show that for any field `fd` in the struct, the value of that field is also readable.", "We want to prove that if `ovalue_is_readable` holds for a struct `l` and an ovalue `v`, then for any field `fd` in the struct `l`, the ovalue is readable for the field `fd`. \n\nWe will prove this by using the `ovalue_is_readable_struct_intro` lemma, which states that if `ovalue_is_readable` holds for a struct `l` and an ovalue `v`, then for each field `fd` in the struct `l`, the ovalue is readable for the field `fd`. We will use this lemma to establish the readability of the specific field `fd` in the struct `l` given the initial assumption that `ovalue_is_readable` holds for the entire struct `l` and ovalue `v`.", "We want to prove that if a struct value `v` is readable, then for any field `fd` in the struct, the value of `v` at field `fd` is also readable.", "We want to prove that if a struct type `l` is readable, then for any field `fd` in the struct, the value of the field is also readable.", "We want to prove that if a struct `v` is readable, then for any field `fd` in the struct, the value of the field is also readable. \n\nStep 1: We will assume that the struct `v` is readable, i.e., `ovalue_is_readable (TStruct l) v`. \n\nStep 2: We will then show that for any field `fd` in the struct, the value of the field is also readable, i.e., `Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)`.", "We want to prove that if a struct `v` is readable, then for any field `fd` in the struct, the value of `fd` in `v` is also readable.\n\nStep 1: We assume that the struct `v` is readable, i.e., `ovalue_is_readable (TStruct l) v`.\n\nStep 2: We want to show that for any field `fd` in the struct, the value of `fd` in `v` is also readable, i.e., `ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)`.", "We want to prove that if a struct value `v` of type `TStruct l` is readable, then for any field `fd` in the struct `l`, the value of the field `fd` in `v` is also readable.", "We want to prove that if a struct `v` is readable, then for any field `fd` in the struct, the value of `fd` is also readable. \n\nWe will first assume that `v` is readable, and then show that for any field `fd` in the struct, the value of `fd` is also readable.", "We want to prove that if a struct `v` of type `TStruct l` is readable, then for any field `fd` in the struct `l`, the value of the field `fd` in `v` is also readable.\n\nStep 1: We will assume that the struct `v` is readable, i.e., `ovalue_is_readable (TStruct l) v`.\n\nStep 2: We will then show that for any field `fd` in the struct `l`, the value of the field `fd` in `v` is also readable, i.e., `Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)`.", "We want to prove that if `ovalue_is_readable` holds for a struct `l` and an ovalue `v`, then for any field `fd` in the struct `l`, the ovalue is readable for the field `fd`. This means that the ovalue `v` is not `None` and the field `fd` is readable in `v`." ], "generated_solution": [ "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ovalue_is_readable_struct_intro l v", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in\n (Some? v /\\ ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n ))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= ()" ] }, { "file_name": "LowParse.Endianness.fst", "name": "LowParse.Endianness.slice_seq_rev", "opens_and_abbrevs": [ { "open": "FStar.Math.Lemmas" }, { "abbrev": "U8", "full_module": "FStar.UInt8" }, { "abbrev": "S", "full_module": "FStar.Seq" }, { "open": "FStar.Mul" }, { "open": "FStar.Endianness" }, { "open": "LowParse" }, { "open": "LowParse" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val slice_seq_rev (#t: Type) (x: S.seq t) (i j: nat)\n : Lemma (requires (i <= j /\\ j <= S.length x))\n (ensures\n ((S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))", "source_definition": "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i: nat)\n (j: nat)\n: Lemma\n (requires (i <= j /\\ j <= S.length x))\n (ensures (S.slice (seq_rev x) i j `S.equal` seq_rev (S.slice x (S.length x - j) (S.length x - i))))\n= Classical.forall_intro (index_seq_rev x);\n Classical.forall_intro (index_seq_rev (S.slice x (S.length x - j) (S.length x - i)))", "source_range": { "start_line": 223, "start_col": 0, "end_line": 232, "end_col": 86 }, "interleaved": false, "definition": "fun x i j ->\n (FStar.Classical.forall_intro (LowParse.Endianness.index_seq_rev x);\n FStar.Classical.forall_intro (LowParse.Endianness.index_seq_rev (FStar.Seq.Base.slice x\n (FStar.Seq.Base.length x - j)\n (FStar.Seq.Base.length x - i))))\n <:\n FStar.Pervasives.Lemma (requires i <= j /\\ j <= FStar.Seq.Base.length x)\n (ensures\n FStar.Seq.Base.equal (FStar.Seq.Base.slice (LowParse.Endianness.seq_rev x) i j)\n (LowParse.Endianness.seq_rev (FStar.Seq.Base.slice x\n (FStar.Seq.Base.length x - j)\n (FStar.Seq.Base.length x - i))))", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "FStar.Seq.Base.seq", "Prims.nat", "FStar.Classical.forall_intro", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "Prims.eq2", "FStar.Seq.Base.index", "LowParse.Endianness.seq_rev", "LowParse.Endianness.index_seq_rev", "Prims.unit", "Prims.l_and", "Prims.op_LessThanOrEqual", "Prims.squash", "FStar.Seq.Base.equal", "Prims.Nil", "FStar.Pervasives.pattern" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "x: FStar.Seq.Base.seq t -> i: Prims.nat -> j: Prims.nat\n -> FStar.Pervasives.Lemma (requires i <= j /\\ j <= FStar.Seq.Base.length x)\n (ensures\n FStar.Seq.Base.equal (FStar.Seq.Base.slice (LowParse.Endianness.seq_rev x) i j)\n (LowParse.Endianness.seq_rev (FStar.Seq.Base.slice x\n (FStar.Seq.Base.length x - j)\n (FStar.Seq.Base.length x - i))))", "prompt": "let slice_seq_rev (#t: Type) (x: S.seq t) (i j: nat)\n : Lemma (requires (i <= j /\\ j <= S.length x))\n (ensures\n ((S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n )) =\n ", "expected_response": "Classical.forall_intro (index_seq_rev x);\nClassical.forall_intro (index_seq_rev (S.slice x (S.length x - j) (S.length x - i)))", "source": { "project_name": "everparse", "file_name": "src/lowparse/LowParse.Endianness.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git" }, "dependencies": { "source_file": "LowParse.Endianness.fst", "checked_file": "dataset/LowParse.Endianness.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Math.Lemmas.fst.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "let rec index_be_to_n'\n (b: bytes)\n (i: nat)\n: Lemma\n (requires (\n i < S.length b\n ))\n (ensures (\n U8.v (S.index b i) == (be_to_n b / pow2 (8 * (S.length b - 1 - i))) % pow2 8\n ))\n (decreases (S.length b))\n= reveal_be_to_n b;\n if i = S.length b - 1\n then ()\n else begin\n let l = S.length b in\n let l' = l - 1 in\n let b' = S.slice b 0 l' in\n index_be_to_n' b' i;\n assert (S.index b i == S.index b' i);\n let open FStar.Math.Lemmas in\n let x = be_to_n b in\n let x' = be_to_n b' in\n assert (U8.v (S.index b i) == x' / pow2 (8 * (l' - 1 - i)) % pow2 8);\n let y = (U8.v (S.last b) + pow2 8 * x') / pow2 (8 * (l - 1 - i)) % pow2 8 in\n pow2_plus 8 (8 * (l' - 1 - i));\n division_multiplication_lemma (U8.v (S.last b) + pow2 8 * x') (pow2 8) (pow2 (8 * (l' - 1 - i)));\n assert (pow2 8 * x' == x' * pow2 8);\n division_addition_lemma (U8.v (S.last b)) (pow2 8) x';\n small_division_lemma_1 (U8.v (S.last b)) (pow2 8);\n assert (y == x' / pow2 (8 * (l' - 1 - i)) % pow2 8)\n end", "val index_be_to_n\n (b: bytes)\n (i: nat)\n: Lemma\n (requires (\n i < S.length b\n ))\n (ensures (\n U8.v (S.index b i) == (be_to_n b / pow2 (8 * (S.length b - 1 - i))) % pow2 8\n ))", "val index_n_to_be\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i)) == (n / pow2 (8 * (len - 1 - i)) % pow2 8\n ))", "val index_n_to_be_zero_left\n (len: nat)\n (n: nat)\n (j: nat)\n (i: nat)\n: Lemma\n (requires (\n i < j /\\\n j <= len /\\\n n < pow2 (8 * (len - j))\n ))\n (ensures (\n pow2 (8 * (len - j)) <= pow2 (8 * len) /\\\n U8.v (S.index (n_to_be len n) i) == 0\n ))", "let index_be_to_n = index_be_to_n'", "let index_n_to_be\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i)) == (n / pow2 (8 * (len - 1 - i)) % pow2 8\n ))\n= index_be_to_n (n_to_be len n) i", "val index_n_to_be_zero_right\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len) /\\\n n % pow2 (8 * (len - i)) == 0\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i) == 0\n ))", "let index_n_to_be_zero_left\n (len: nat)\n (n: nat)\n (j: nat)\n (i: nat)\n: Lemma\n (requires (\n i < j /\\\n j <= len /\\\n n < pow2 (8 * (len - j))\n ))\n (ensures (\n pow2 (8 * (len - j)) <= pow2 (8 * len) /\\\n U8.v (S.index (n_to_be len n) i) == 0\n ))\n= let open FStar.Math.Lemmas in\n pow2_le_compat (8 * len) (8 * (len - j));\n pow2_le_compat (8 * (len - 1 - i)) (8 * (len - j));\n small_division_lemma_1 n (pow2 (8 * (len - 1 - i)));\n index_n_to_be len n i", "val be_to_n_append\n (hi lo: bytes)\n: Lemma\n (ensures (be_to_n (hi `S.append` lo) == be_to_n hi * pow2 (8 * S.length lo) + be_to_n lo))", "val n_to_be_append\n (len: nat)\n (n: nat)\n (len_lo: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len) /\\\n len_lo <= len\n ))\n (ensures (\n let hi = n / pow2 (8 * len_lo) in\n let lo = n % pow2 (8 * len_lo) in\n 0 <= hi /\\\n hi < pow2 (8 * (len - len_lo)) /\\\n 0 <= lo /\\\n lo < pow2 (8 * len_lo) /\\\n n_to_be len n == n_to_be (len - len_lo) hi `S.append` n_to_be len_lo lo\n ))", "let index_n_to_be_zero_right\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len) /\\\n n % pow2 (8 * (len - i)) == 0\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i) == 0\n ))\n= index_n_to_be len n i;\n let open FStar.Math.Lemmas in\n modulo_division_lemma n (pow2 (8 * (len - 1 - i))) (pow2 8);\n pow2_plus (8 * (len - 1 - i)) 8", "val reveal_n_to_be\n (len: nat)\n (n: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len)\n ))\n (ensures (\n (len > 0 ==> (0 <= n / pow2 8 /\\ n / pow2 8 < pow2 (8 * (len - 1)))) /\\\n n_to_be len n `S.equal` (if len = 0 then S.empty else n_to_be (len - 1) (n / pow2 8) `S.snoc` (U8.uint_to_t (n % pow2 8)))\n ))", "let rec be_to_n_append'\n (hi lo: bytes)\n: Lemma\n (ensures (be_to_n (hi `S.append` lo) == be_to_n hi * pow2 (8 * S.length lo) + be_to_n lo))\n (decreases (S.length lo))\n= reveal_be_to_n lo;\n let hilo = hi `S.append` lo in\n if S.length lo = 0\n then\n assert (hilo `S.equal` hi)\n else begin\n let lo' = S.slice lo 0 (S.length lo - 1) in\n assert (S.slice hilo 0 (S.length hilo - 1) `S.equal` (hi `S.append` lo'));\n assert (S.last hilo == S.last lo);\n reveal_be_to_n hilo;\n be_to_n_append' hi lo';\n pow2_plus (8 * S.length lo') 8\n end", "val slice_n_to_be\n (len: nat)\n (n: nat)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n let res = (n / pow2 (8 * (len - j))) % pow2 (8 * (j - i)) in\n 0 <= res /\\\n res < pow2 (8 * (j - i)) /\\\n S.slice (n_to_be len n) i j == n_to_be (j - i) res\n ))", "let be_to_n_append = be_to_n_append'", "let lemma_div_zero (x: pos) : Lemma\n (0 / x == 0)\n= ()", "val index_le_to_n\n (b: bytes)\n (i: nat)\n: Lemma\n (requires (\n i < S.length b\n ))\n (ensures (\n U8.v (S.index b i) == (le_to_n b / pow2 (8 * i)) % pow2 8\n ))", "let n_to_be_append\n (len: nat)\n (n: nat)\n (len_lo: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len) /\\\n len_lo <= len\n ))\n (ensures (\n let hi = n / pow2 (8 * len_lo) in\n let lo = n % pow2 (8 * len_lo) in\n 0 <= hi /\\\n hi < pow2 (8 * (len - len_lo)) /\\\n 0 <= lo /\\\n lo < pow2 (8 * len_lo) /\\\n n_to_be len n == n_to_be (len - len_lo) hi `S.append` n_to_be len_lo lo\n ))\n= lemma_div_zero (pow2 (8 * len_lo));\n lemma_div_le 0 n (pow2 (8 * len_lo));\n lemma_mod_lt n (pow2 (8 * len_lo));\n let hi = n / pow2 (8 * len_lo) in\n assert (0 <= hi);\n lemma_div_lt n (8 * len) (8 * len_lo);\n pow2_minus (8 * len) (8 * len_lo);\n let lo = n % pow2 (8 * len_lo) in\n euclidean_division_definition n (pow2 (8 * len_lo));\n let hi_s = n_to_be (len - len_lo) hi in\n let lo_s = n_to_be len_lo lo in\n be_to_n_append hi_s lo_s;\n assert (be_to_n (hi_s `S.append` lo_s) == n);\n be_to_n_inj (hi_s `S.append` lo_s) (n_to_be len n)", "val index_n_to_le\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n U8.v (S.index (n_to_le len n) i)) == (n / pow2 (8 * i) % pow2 8\n ))", "val reveal_n_to_le\n (len: nat)\n (n: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len)\n ))\n (ensures (\n (len > 0 ==> (0 <= n / pow2 8 /\\ n / pow2 8 < pow2 (8 * (len - 1)))) /\\\n n_to_le len n `S.equal` (if len = 0 then S.empty else (U8.uint_to_t (n % pow2 8) `S.cons` n_to_le (len - 1) (n / pow2 8)))\n ))", "let reveal_n_to_be\n (len: nat)\n (n: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len)\n ))\n (ensures (\n (len > 0 ==> (0 <= n / pow2 8 /\\ n / pow2 8 < pow2 (8 * (len - 1)))) /\\\n n_to_be len n `S.equal` (if len = 0 then S.empty else n_to_be (len - 1) (n / pow2 8) `S.snoc` (U8.uint_to_t (n % pow2 8)))\n ))\n= if len = 0\n then ()\n else begin\n n_to_be_append len n 1;\n index_n_to_be 1 (n % pow2 8) 0\n end", "let slice_n_to_be\n (len: nat)\n (n: nat)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n let res = (n / pow2 (8 * (len - j))) % pow2 (8 * (j - i)) in\n 0 <= res /\\\n res < pow2 (8 * (j - i)) /\\\n S.slice (n_to_be len n) i j == n_to_be (j - i) res\n ))\n= let s1 = S.slice (n_to_be len n) 0 j in\n let s2 = S.slice s1 i j in\n n_to_be_append len n (len - j);\n let q = n / pow2 (8 * (len - j)) in\n n_to_be_append j q (j - i);\n let r = q % pow2 (8 * (j - i)) in\n assert (s2 `S.equal` n_to_be (j - i) (q % pow2 (8 * (j - i))))", "let rec seq_rev\n (#t: Type)\n (x: S.seq t)\n: Tot (y: S.seq t {S.length y == S.length x})\n (decreases (S.length x))\n= if S.length x = 0\n then S.empty\n else seq_rev (S.tail x) `S.append` S.create 1 (S.head x)", "let rec index_seq_rev'\n (#t: Type)\n (x: S.seq t)\n (i: nat {i < S.length x})\n: Lemma\n (ensures (S.index (seq_rev x) (S.length x - 1 - i) == S.index x i))\n (decreases (S.length x))\n= if i = 0\n then\n S.lemma_index_create 1 (S.head x) 0\n else\n index_seq_rev' (S.tail x) (i - 1)", "let index_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i: nat {i < S.length x})\n: Lemma\n (ensures (S.index (seq_rev x) i == S.index x (S.length x - 1 - i)))\n= index_seq_rev' x (S.length x - 1 - i)" ], "closest": [ "val lemma_rev_seq (#a: Type) (s: S.seq a) (i: nat)\n : Lemma (requires i < S.length s)\n (ensures\n S.length (rev_seq s) = S.length s /\\ S.index s i == S.index (rev_seq s) (S.length s - 1 - i)\n )\n (decreases (i))\nlet rec lemma_rev_seq (#a:Type) (s:S.seq a) (i:nat) : Lemma\n (requires i < S.length s)\n (ensures\n S.length (rev_seq s) = S.length s /\\\n S.index s i == S.index (rev_seq s) (S.length s-1-i))\n (decreases (i))=\n if S.length s = 0 then ()\n else if i = 0 then ()\n else lemma_rev_seq (S.slice s 1 (S.length s)) (i-1)", "val slice_trans (#a: Type) (b: S.seq a) (i j k: nat)\n : Lemma (requires i <= j /\\ j <= k /\\ k <= S.length b)\n (ensures S.slice b i k == S.(slice b i j @| slice b j k))\nlet slice_trans (#a:Type) (b:S.seq a) (i j k:nat) : Lemma\n (requires i <= j /\\ j <= k /\\ k <= S.length b)\n (ensures S.slice b i k == S.(slice b i j @| slice b j k)) =\n S.lemma_split (S.slice b i k) (j-i)", "val seq_upd_seq_slice_left' (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t) (j1 j2: nat)\n : Lemma (requires (i + Seq.length s' <= Seq.length s /\\ j1 <= j2 /\\ j2 <= i))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s j1 j2))\nlet seq_upd_seq_slice_left'\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n (j1 j2: nat)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s /\\ j1 <= j2 /\\ j2 <= i))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s j1 j2))\n= seq_upd_seq_slice_left s i s';\n Seq.slice_slice (seq_upd_seq s i s') 0 i j1 j2", "val seq_upd_seq_slice' (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t) (j1 j2: nat)\n : Lemma\n (requires\n (i + Seq.length s' <= Seq.length s /\\ i <= j1 /\\ j1 <= j2 /\\ j2 <= i + Seq.length s'))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s' (j1 - i) (j2 - i)))\nlet seq_upd_seq_slice'\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n (j1 j2: nat)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s /\\ i <= j1 /\\ j1 <= j2 /\\ j2 <= i + Seq.length s'))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s' (j1 - i) (j2 - i)))\n= seq_upd_seq_slice s i s';\n Seq.slice_slice (seq_upd_seq s i s') i (i + Seq.length s') (j1 - i) (j2 - i)", "val extensionality_slice (#a: Type) (b1 b2: S.seq a) (i j: nat)\n : Lemma\n (requires\n S.length b1 = S.length b2 /\\ i <= j /\\ j <= S.length b1 /\\\n (forall (k: nat{i <= k /\\ k < j}). S.index b1 k == S.index b2 k))\n (ensures S.equal (S.slice b1 i j) (S.slice b2 i j))\nlet extensionality_slice (#a:Type) (b1 b2:S.seq a) (i j:nat) : Lemma\n (requires\n S.length b1 = S.length b2 /\\\n i <= j /\\ j <= S.length b1 /\\\n (forall (k:nat{i<=k /\\ k 0 then lemma_len_slice' #a (tl s) (i - 1) (j - 1)\n else if j = 0 then ()\n else lemma_len_slice' #a (tl s) i (j - 1)", "val seq_upd_seq_slice (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t)\n : Lemma (requires (i + Seq.length s' <= Seq.length s))\n (ensures (Seq.slice (seq_upd_seq s i s') i (i + Seq.length s') == s'))\nlet seq_upd_seq_slice\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s))\n (ensures (Seq.slice (seq_upd_seq s i s') i (i + Seq.length s') == s'))\n= assert (Seq.slice (seq_upd_seq s i s') i (i + Seq.length s') `Seq.equal` s')", "val lemma_slice_snoc: #a:eqtype -> s:seq a -> i:nat -> j:nat{i < j && j <= length s}\n -> Lemma (ensures (forall x. mem x (slice s i j) <==> (x = index s (j - 1) || mem x (slice s i (j - 1)))))\nlet lemma_slice_snoc #_ s i j =\n cut (equal (slice s i j) (append (slice s i (j - 1)) (create 1 (index s (j - 1)))));\n lemma_mem_append (slice s i (j - 1)) (create 1 (index s (j - 1)))", "val lemma_slice_cons: #a:eqtype -> s:seq a -> i:nat -> j:nat{i < j && j <= length s}\n -> Lemma (ensures (forall x. mem x (slice s i j) <==> (x = index s i || mem x (slice s (i + 1) j))))\nlet lemma_slice_cons #_ s i j =\n cut (equal (slice s i j) (append (create 1 (index s i)) (slice s (i + 1) j)));\n lemma_mem_append (create 1 (index s i)) (slice s (i + 1) j)", "val slice_seq_map_commute (#a #b:Type) (f:a -> b) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice (seq_map f s) i j == seq_map f (slice s i j))\nlet slice_seq_map_commute (#a #b:Type) (f:a -> b) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice (seq_map f s) i j == seq_map f (slice s i j))\n =\n assert (equal (slice (seq_map f s) i j) (seq_map f (slice s i j)));\n ()", "val seq_upd_seq_slice_right (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t)\n : Lemma (requires (i + Seq.length s' <= Seq.length s))\n (ensures\n (Seq.slice (seq_upd_seq s i s') (i + Seq.length s') (Seq.length s) ==\n Seq.slice s (i + Seq.length s') (Seq.length s)))\nlet seq_upd_seq_slice_right\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s))\n (ensures (Seq.slice (seq_upd_seq s i s') (i + Seq.length s') (Seq.length s) == Seq.slice s (i + Seq.length s') (Seq.length s)))\n= assert (Seq.slice (seq_upd_seq s i s') (i + Seq.length s') (Seq.length s) `Seq.equal` Seq.slice s (i + Seq.length s') (Seq.length s))", "val seq_upd_seq_slice_left (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t)\n : Lemma (requires (i + Seq.length s' <= Seq.length s))\n (ensures (Seq.slice (seq_upd_seq s i s') 0 i == Seq.slice s 0 i))\nlet seq_upd_seq_slice_left\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s))\n (ensures (Seq.slice (seq_upd_seq s i s') 0 i == Seq.slice s 0 i))\n= assert (Seq.slice (seq_upd_seq s i s') 0 i `Seq.equal` Seq.slice s 0 i)", "val slice_slice\n (#a: Type)\n (s: seq a)\n (i1: nat)\n (j1: nat {i1 <= j1 /\\ j1 <= length s} )\n (i2: nat)\n (j2: nat {i2 <= j2 /\\ j2 <= j1 - i1} )\n: Lemma\n (requires True)\n (ensures (slice (slice s i1 j1) i2 j2 == slice s (i1 + i2) (i1 + j2)))\n [SMTPat (slice (slice s i1 j1) i2 j2)]\nlet slice_slice #_ s i1 j1 i2 j2 = lemma_eq_elim (slice (slice s i1 j1) i2 j2) (slice s (i1 + i2) (i1 + j2))", "val lemma_tail_slice: #a:Type -> s:seq a -> i:nat -> j:nat{i < j && j <= length s}\n -> Lemma\n (requires True)\n (ensures (tail (slice s i j) == slice s (i + 1) j))\n [SMTPat (tail (slice s i j))]\nlet lemma_tail_slice #_ s i j =\n cut (equal (tail (slice s i j)) (slice s (i + 1) j))", "val seq_append_slice (#t: Type) (s: Seq.seq t) (i1 i2: nat)\n : Lemma (requires (i1 + i2 <= Seq.length s))\n (ensures (Seq.append (Seq.slice s 0 i1) (Seq.slice s i1 (i1 + i2)) == Seq.slice s 0 (i1 + i2))\n )\nlet seq_append_slice\n (#t: Type)\n (s: Seq.seq t)\n (i1 i2: nat)\n: Lemma\n (requires (i1 + i2 <= Seq.length s))\n (ensures (\n Seq.append (Seq.slice s 0 i1) (Seq.slice s i1 (i1 + i2)) == Seq.slice s 0 (i1 + i2)\n ))\n= assert (Seq.append (Seq.slice s 0 i1) (Seq.slice s i1 (i1 + i2)) `Seq.equal` Seq.slice s 0 (i1 + i2))", "val splice_refl : #a:Type -> s:seq a -> i:nat -> j:nat{i <= j && j <= length s}\n -> Lemma\n (ensures (s == splice s i s j))\nlet splice_refl #_ s i j = cut (equal s (splice s i s j))", "val slice_append_back (#a: Type) (x y: seq a) (i: nat)\n : Lemma (requires length x <= i /\\ i <= length x + length y)\n (ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))\nlet slice_append_back (#a:Type) (x y:seq a) (i:nat) : Lemma\n (requires length x <= i /\\ i <= length x + length y)\n (ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))\n =\n assert (equal (slice (append x y) 0 i) (append x (slice y 0 (i - length x))));\n ()", "val slice_append_back (#a: Type) (x y: seq a) (i: nat)\n : Lemma (requires length x <= i /\\ i <= length x + length y)\n (ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))\nlet slice_append_back (#a:Type) (x y:seq a) (i:nat) : Lemma\n (requires length x <= i /\\ i <= length x + length y)\n (ensures slice (append x y) 0 i == append x (slice y 0 (i - length x)))\n =\n assert (equal (slice (append x y) 0 i) (append x (slice y 0 (i - length x))));\n ()", "val slice_append_adds (#a:Type) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice s 0 i @| slice s i j == slice s 0 j)\nlet slice_append_adds (#a:Type) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice s 0 i @| slice s i j == slice s 0 j)\n =\n assert (equal (slice s 0 i @| slice s i j)\n (slice s 0 j));\n ()", "val seq_slice_equal_index:\n #a:Type -> s1:S.seq a -> s2:S.seq a ->\n i:nat -> j:nat{i <= j && j <= S.length s1 && j <= S.length s2} ->\n k:nat{i <= k && k < j} ->\n Lemma (requires S.equal (S.slice s1 i j) (S.slice s2 i j))\n (ensures S.index s1 k == S.index s2 k)\n [SMTPat (S.equal (S.slice s1 i j) (S.slice s2 i j));\n SMTPat (S.index s1 k)]\nlet seq_slice_equal_index #a s1 s2 i j k =\n assert (S.index (S.slice s1 i j) (k - i) == S.index (S.slice s2 i j) (k - i))", "val lemma_index_slice'\n (#a: Type)\n (s: seq a)\n (i: nat)\n (j: nat{i <= j /\\ j <= length s})\n (k: nat{k < j - i})\n : Lemma (requires True)\n (ensures (index (slice s i j) k == index s (k + i)))\n (decreases (length s))\nlet rec lemma_index_slice' (#a:Type) (s:seq a) (i:nat) (j:nat{i <= j /\\ j <= length s}) (k:nat{k < j - i})\n: Lemma\n (requires True)\n (ensures (index (slice s i j) k == index s (k + i))) (decreases (length s))\n= if i > 0\n then (\n lemma_index_slice' #a (tl s) (i - 1) (j - 1) k;\n assert (index (slice (tl s) (i - 1) (j - 1)) k == index (tl s) (k + (i - 1)));\n assert (index (slice (tl s) (i - 1) (j - 1)) k == index s (k + i));\n assert (index (slice s i j) k == index s (k + i))\n )\n else (\n assert (j > 0);\n lemma_index_slice0' #a s j k\n )", "val cons_index_slice\n (#a: Type)\n (s: seq a)\n (i: nat)\n (j: nat {i < j /\\ j <= length s} )\n (k:nat{k == i+1})\n: Lemma\n (requires True)\n (ensures (cons (index s i) (slice s k j) == slice s i j))\n [SMTPat (cons (index s i) (slice s k j))]\nlet cons_index_slice #_ s i j _ = lemma_eq_elim (cons (index s i) (slice s (i + 1) j)) (slice s i j)", "val lemma_len_slice: #a:Type -> s:seq a -> i:nat -> j:nat{i <= j && j <= length s} -> Lemma\n (requires True)\n (ensures (length (slice s i j) = j - i))\n [SMTPat (length (slice s i j))]\nlet lemma_len_slice = lemma_len_slice'", "val as_seq_seq_slice:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n h:HS.mem -> rs:S.seq a ->\n i:nat -> j:nat{i <= j /\\ j <= S.length rs /\\ rs_elems_inv rg h rs i j} ->\n k:nat -> l:nat{k <= l && l <= j - i} ->\n Lemma (S.equal (S.slice (as_seq_seq rg h rs i j) k l)\n (as_seq_seq rg h (S.slice rs (i + k) (i + l)) 0 (l - k)))\nlet rec as_seq_seq_slice #a #rst rg h rs i j k l =\n if k = l then ()\n else (as_seq_seq_slice rg h rs i j k (l - 1);\n as_seq_seq_index rg h rs i j (l - 1);\n as_seq_seq_eq rg h\n (S.slice rs (i + k) (i + l - 1))\n (S.slice rs (i + k) (i + l))\n 0 (l - k - 1) 0 (l - k - 1))", "val snoc_slice_index\n (#a: Type)\n (s: seq a)\n (i: nat)\n (j: nat {i <= j /\\ j < length s} )\n: Lemma\n (requires True)\n (ensures (snoc (slice s i j) (index s j) == slice s i (j + 1)))\n [SMTPat (snoc (slice s i j) (index s j))]\nlet snoc_slice_index #_ s i j = lemma_eq_elim (snoc (slice s i j) (index s j)) (slice s i (j + 1))", "val slice: s:seq 'a -> i:nat -> j:nat{(i <= j /\\ j <= length s)} -> Tot (seq 'a)\nlet slice (Seq c start_i end_i) i j = Seq c (start_i + i) (start_i + j)", "val seq_upd_seq_seq_upd_seq_slice (#t: Type) (s1: Seq.seq t) (i1 hi i2: nat) (s3: Seq.seq t)\n : Lemma (requires (i1 <= hi /\\ hi <= Seq.length s1 /\\ i1 + i2 + Seq.length s3 <= hi))\n (ensures\n (seq_upd_seq s1 i1 (seq_upd_seq (Seq.slice s1 i1 hi) i2 s3) == seq_upd_seq s1 (i1 + i2) s3))\nlet seq_upd_seq_seq_upd_seq_slice\n (#t: Type)\n (s1: Seq.seq t)\n (i1: nat)\n (hi: nat)\n (i2: nat)\n (s3: Seq.seq t)\n: Lemma\n (requires (i1 <= hi /\\ hi <= Seq.length s1 /\\ i1 + i2 + Seq.length s3 <= hi))\n (ensures (\n seq_upd_seq s1 i1 (seq_upd_seq (Seq.slice s1 i1 hi) i2 s3) == seq_upd_seq s1 (i1 + i2) s3\n ))\n= assert (seq_upd_seq s1 i1 (seq_upd_seq (Seq.slice s1 i1 hi) i2 s3) `Seq.equal` seq_upd_seq s1 (i1 + i2) s3)", "val lemma_not_equal_slice: #a:Type -> b1:Seq.seq a -> b2:Seq.seq a -> i:nat -> j:nat ->\n k:nat{i <= j /\\ i <= k /\\ j <= k /\\ k <= Seq.length b1 /\\ k <= Seq.length b2 } ->\n Lemma\n (requires ~(Seq.equal (Seq.slice b1 i j) (Seq.slice b2 i j)))\n (ensures ~(Seq.equal (Seq.slice b1 i k) (Seq.slice b2 i k)))\nlet lemma_not_equal_slice #a b1 b2 i j k =\n assert (forall (n:nat{n < k - i}). Seq.index (Seq.slice b1 i k) n == Seq.index b1 (n + i))", "val sorted_slice_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n j:nat{i <= j /\\ j <= length s} ->\n Lemma (requires (sorted #a f s == true)) (ensures (sorted #a f (slice s i j) == true))\nlet sorted_slice_lemma #a f s i j =\n sorted_sorted_pred_lemma #a f s ;\n sorted_pred_slice_lemma #a f s i j ;\n sorted_pred_sorted_lemma #a f (slice s i j)", "val lemma_sum_seq_left_right (s:seq int) (i j:nat) : Lemma\n (requires i <= j /\\ j <= length s)\n (ensures sum_seq_left s i j == sum_seq_right s i j)\nlet lemma_sum_seq_left_right s i j =\n lemma_sum_seq_left_right_rec s i j j", "val create_next (#a: Type) (s: S.seq a) (v: a) (i: nat)\n : Lemma\n (requires (i < S.length s /\\ S.equal (S.slice s 0 i) (S.create i v) /\\ S.index s i == v))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.create (i + 1) v)))\nlet create_next (#a: Type) (s: S.seq a) (v: a) (i: nat):\n Lemma\n (requires (\n i < S.length s /\\\n S.equal (S.slice s 0 i) (S.create i v) /\\\n S.index s i == v))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.create (i + 1) v)))\n=\n lemma_slice_ijk s 0 i (i + 1)", "val lemma_swap_slice_commute : #a:Type -> s:seq a -> start:nat -> i:nat{start <= i} -> j:nat{i <= j} -> len:nat{j < len && len <= length s}\n -> Lemma (ensures (slice (swap s i j) start len == (swap (slice s start len) (i - start) (j - start))))\nlet lemma_swap_slice_commute #_ s start i j len =\n cut (equal (slice (swap s i j) start len) (swap (slice s start len) (i - start) (j - start)))", "val slice' (#a: Type) (s: seq a) (i: nat) (j: nat{i <= j && j <= length s})\n : Tot (seq a) (decreases (length s))\nlet rec slice' (#a:Type) (s:seq a) (i:nat) (j:nat{i <= j && j <= length s})\n : Tot (seq a)\n (decreases (length s))\n = if i > 0 then slice' #a (tl s) (i - 1) (j - 1)\n else if j = 0 then MkSeq []\n else _cons (hd s) (slice' #a (tl s) i (j - 1))", "val slice (#ty: Type) (s: seq ty) (i: nat) (j: nat{j >= i && j <= length s}) : seq ty\nlet slice (#ty: Type) (s: seq ty) (i: nat) (j: nat{j >= i && j <= length s})\n : seq ty\n = all_seq_facts_lemma();\n drop (take s j) i", "val seq_upd_seq_slice_idem (#t: Type) (s: Seq.seq t) (lo hi: nat)\n : Lemma (requires (lo <= hi /\\ hi <= Seq.length s))\n (ensures (seq_upd_seq s lo (Seq.slice s lo hi) == s))\nlet seq_upd_seq_slice_idem\n (#t: Type)\n (s: Seq.seq t)\n (lo hi: nat)\n: Lemma\n (requires (lo <= hi /\\ hi <= Seq.length s))\n (ensures (seq_upd_seq s lo (Seq.slice s lo hi) == s))\n= assert (seq_upd_seq s lo (Seq.slice s lo hi) `Seq.equal` s)", "val upd_slice: #a:Type -> s:seq a -> i:nat -> j:nat{i <= j /\\ j <= length s}\n -> k:nat{k < j - i} -> v:a -> Lemma\n (requires i + k < j)\n (ensures upd (slice s i j) k v == slice (upd s (i + k) v) i j)\n [SMTPat (upd (slice s i j) k v)]\nlet upd_slice #_ s i j k v =\n lemma_eq_intro (upd (slice s i j) k v) (slice (upd s (i + k) v) i j)", "val lemma_count_slice: #a:eqtype -> s:seq a -> i:nat{i<=length s} -> Lemma\n (requires True)\n (ensures (forall x. count x s = count x (slice s 0 i) + count x (slice s i (length s))))\nlet lemma_count_slice #_ s i =\n cut (equal s (append (slice s 0 i) (slice s i (length s))));\n lemma_append_count (slice s 0 i) (slice s i (length s))", "val init_next (#a: Type) (s: S.seq a) (f: (i: nat{i < S.length s} -> a)) (i: nat)\n : Lemma\n (requires (i < S.length s /\\ S.equal (S.slice s 0 i) (S.init i f) /\\ S.index s i == f i))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.init (i + 1) f)))\nlet init_next (#a: Type) (s: S.seq a) (f: (i:nat { i < S.length s }) -> a) (i: nat):\n Lemma\n (requires (\n i < S.length s /\\\n S.equal (S.slice s 0 i) (S.init i f) /\\\n S.index s i == f i))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.init (i + 1) f)))\n=\n lemma_slice_ijk s 0 i (i + 1)", "val lemma_index_slice: #a:Type -> s:seq a -> i:nat -> j:nat{i <= j /\\ j <= length s} -> k:nat{k < j - i} -> Lemma\n (requires True)\n (ensures (index (slice s i j) k == index s (k + i)))\n [SMTPat (index (slice s i j) k)]\nlet lemma_index_slice = lemma_index_slice'", "val as_seq_seq_eq:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n h:HS.mem -> rs1:S.seq a -> rs2:S.seq a ->\n i:nat ->\n j:nat{i <= j /\\ j <= S.length rs1 /\\ rs_elems_inv rg h rs1 i j} ->\n k:nat ->\n l:nat{k <= l /\\ l <= S.length rs2 /\\ rs_elems_inv rg h rs2 k l} ->\n Lemma (requires (S.equal (S.slice rs1 i j) (S.slice rs2 k l)))\n (ensures (S.equal (as_seq_seq rg h rs1 i j)\n (as_seq_seq rg h rs2 k l)))\nlet as_seq_seq_eq #a #rst rg h rs1 rs2 i j k l =\n assert (forall (a:nat{a < j - i}).\n S.index (as_seq_seq rg h rs1 i j) a ==\n Rgl?.r_repr rg h (S.index rs1 (i + a)));\n assert (forall (a:nat{a < l - k}).\n S.index (as_seq_seq rg h rs2 k l) a ==\n Rgl?.r_repr rg h (S.index rs2 (k + a)));\n assert (S.length (S.slice rs1 i j) = j - i);\n assert (S.length (S.slice rs2 k l) = l - k);\n assert (forall (a:nat{a < j - i}).\n S.index (S.slice rs1 i j) a ==\n S.index (S.slice rs2 k l) a);\n assert (forall (a:nat{a < j - i}).\n S.index rs1 (i + a) == S.index rs2 (k + a))", "val slice (#a: Type) (x: t a) (i: len_t) (j: len_t{let open U32 in v i <= v j /\\ v j <= length x})\n : Tot (t a)\nlet slice\n (#a:Type)\n (x:t a)\n (i:len_t)\n (j:len_t{U32.(v i <= v j /\\ v j <= length x)})\n : Tot (t a)\n = from_raw (sub (as_raw x) i j)", "val forall_as_seq:\n #a:Type -> s0:S.seq a -> s1:S.seq a{S.length s0 = S.length s1} ->\n i:nat -> j:nat{i <= j && j <= S.length s0} ->\n k:nat{i <= k && k < j} ->\n p:(a -> Tot Type0) ->\n Lemma (requires (p (S.index s0 k) /\\ S.slice s0 i j == S.slice s1 i j))\n (ensures (p (S.index s1 k)))\n [SMTPat (p (S.index s0 k));\n SMTPat (S.slice s0 i j);\n SMTPat (S.slice s1 i j)]\nlet forall_as_seq #a s0 s1 i j k p =\n assert (S.index (S.slice s0 i j) (k - i) ==\n S.index (S.slice s1 i j) (k - i))", "val lemma_splitAt_reindex_right (#t: Type) (i: nat) (l: list t) (j: nat)\n : Lemma (requires i <= length l /\\ j + i < length l)\n (ensures\n (let left, right = splitAt i l in\n splitAt_length i l;\n j < length right /\\ index right j == index l (j + i)))\nlet rec lemma_splitAt_reindex_right (#t:Type) (i:nat) (l:list t) (j:nat) :\n Lemma\n (requires i <= length l /\\ j + i < length l)\n (ensures (\n let left, right = splitAt i l in\n splitAt_length i l;\n j < length right /\\ index right j == index l (j + i))) =\n match i with\n | 0 -> ()\n | _ -> lemma_splitAt_reindex_right (i - 1) (tl l) j", "val lemma_slice_cons_pv: #a:Type -> s:seq a -> i:nat -> pivot:nat{i <= pivot} -> j:nat{pivot < j && j <= length s} -> pv:a\n -> Lemma\n (requires (pv == index s pivot))\n (ensures (slice s i j == append (slice s i pivot) (cons pv (slice s (pivot + 1) j))))\nlet lemma_slice_cons_pv #a s i pivot j pv =\n let lo = slice s i pivot in\n let hi = slice s (pivot + 1) j in\n cut (Seq.equal (slice s i j) (append lo (cons pv hi)))", "val slice_upd: #a:Type -> s:seq a -> i:nat -> j:nat{i <= j /\\ j <= length s}\n -> k:nat{k < length s} -> v:a -> Lemma\n (requires k < i \\/ j <= k)\n (ensures slice (upd s k v) i j == slice s i j)\n [SMTPat (slice (upd s k v) i j)]\nlet slice_upd #_ s i j k v =\n lemma_eq_intro (slice (upd s k v) i j) (slice s i j)", "val lemma_seq_frame_hi: #a:Type -> s1:seq a -> s2:seq a{length s1 = length s2} -> i:nat -> j:nat{i <= j} -> m:nat{j <= m} -> n:nat{m < n && n <= length s1}\n -> Lemma\n (requires (s1 == (splice s2 i s1 j)))\n (ensures ((slice s1 m n == slice s2 m n) /\\ (index s1 m == index s2 m)))\nlet lemma_seq_frame_hi #_ s1 s2 i j m n =\n cut (equal (slice s1 m n) (slice s2 m n))", "val seq_upd_seq_seq_upd (#t: Type) (s: Seq.seq t) (i: nat) (x: t)\n : Lemma (requires (i < Seq.length s))\n (ensures (Seq.upd s i x == seq_upd_seq s i (Seq.create 1 x)))\nlet seq_upd_seq_seq_upd\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (x: t)\n: Lemma\n (requires (i < Seq.length s))\n (ensures (Seq.upd s i x == seq_upd_seq s i (Seq.create 1 x)))\n= assert (Seq.upd s i x `Seq.equal` seq_upd_seq s i (Seq.create 1 x))", "val lemma_splitAt_reindex_left (#t: Type) (i: nat) (l: list t) (j: nat)\n : Lemma (requires i <= length l /\\ j < i)\n (ensures\n (let left, right = splitAt i l in\n splitAt_length i l;\n j < length left /\\ index left j == index l j))\nlet rec lemma_splitAt_reindex_left (#t:Type) (i:nat) (l:list t) (j:nat) :\n Lemma\n (requires i <= length l /\\ j < i)\n (ensures (\n let left, right = splitAt i l in\n splitAt_length i l;\n j < length left /\\ index left j == index l j)) =\n match i, j with\n | 1, _ | _, 0 -> ()\n | _ -> lemma_splitAt_reindex_left (i - 1) (tl l) (j - 1)", "val eq_slice: #a:Type0 -> #len:size_nat -> b1:lseq a len -> b2:lseq a len -> i:nat -> j:nat{i <= j /\\ j <= len} -> Lemma\n (requires slice b1 i len == slice b2 i len)\n (ensures slice b1 j len == slice b2 j len)\nlet eq_slice #a #len b1 b2 i j =\n let aux (k:nat{k < len - j}) : Lemma (index (slice b1 j len) k == index (slice b2 j len) k) =\n Seq.lemma_index_slice b1 i len (k + j - i);\n Seq.lemma_index_slice b2 i len (k + j - i);\n () in\n\n Classical.forall_intro aux;\n eq_intro (slice b1 j len) (slice b2 j len)", "val split3_index (#a: eqtype) (s0: seq a) (x: a) (s1: seq a) (j: nat)\n : Lemma (requires j < S.length (S.append s0 s1))\n (ensures\n (let s = S.append s0 (cons x s1) in\n let s' = S.append s0 s1 in\n let n = S.length s0 in\n if j < n then S.index s' j == S.index s j else S.index s' j == S.index s (j + 1)))\nlet split3_index (#a:eqtype) (s0:seq a) (x:a) (s1:seq a) (j:nat)\n : Lemma\n (requires j < S.length (S.append s0 s1))\n (ensures (\n let s = S.append s0 (cons x s1) in\n let s' = S.append s0 s1 in\n let n = S.length s0 in\n if j < n then S.index s' j == S.index s j\n else S.index s' j == S.index s (j + 1)\n ))\n = let n = S.length (S.append s0 s1) in\n if j < n then ()\n else ()", "val bitfield_be_to_n_slice (s: S.seq U8.t) (i j: nat)\n : Lemma (requires (Seq.length s > 0 /\\ i <= j /\\ j <= S.length s))\n (ensures\n (let len = S.length s in\n be_to_n s < pow2 (8 * len) /\\\n be_to_n (S.slice s i j) ==\n BF.get_bitfield #(8 * len) (be_to_n s) (8 * (len - j)) (8 * (len - i))))\nlet bitfield_be_to_n_slice\n (s: S.seq U8.t)\n (i: nat)\n (j: nat)\n: Lemma\n (requires (\n Seq.length s > 0 /\\\n i <= j /\\ j <= S.length s\n ))\n (ensures (\n let len = S.length s in\n be_to_n s < pow2 (8 * len) /\\\n be_to_n (S.slice s i j) == BF.get_bitfield #(8 * len) (be_to_n s) (8 * (len - j)) (8 * (len - i))\n ))\n= let len = S.length s in\n lemma_be_to_n_is_bounded s;\n slice_n_to_be_bitfield len (be_to_n s) i j", "val seq_append_seq_upd_seq_l (#t: Type) (s: Seq.seq t) (i': nat) (s' sl: Seq.seq t)\n : Lemma (requires (i' + Seq.length s' <= Seq.length s))\n (ensures\n (Seq.length sl + i' <= Seq.length (sl `Seq.append` s) /\\\n sl\n `Seq.append`\n (seq_upd_seq s i' s') ==\n seq_upd_seq (sl `Seq.append` s) (Seq.length sl + i') s'))\nlet seq_append_seq_upd_seq_l\n (#t: Type)\n (s: Seq.seq t)\n (i': nat)\n (s' : Seq.seq t)\n (sl : Seq.seq t)\n: Lemma\n (requires (i' + Seq.length s' <= Seq.length s))\n (ensures (\n Seq.length sl + i' <= Seq.length (sl `Seq.append` s) /\\\n sl `Seq.append` seq_upd_seq s i' s' == seq_upd_seq (sl `Seq.append` s) (Seq.length sl + i') s'\n ))\n= assert (sl `Seq.append` seq_upd_seq s i' s' `Seq.equal` seq_upd_seq (sl `Seq.append` s) (Seq.length sl + i') s')", "val extend_equal_up_to_lemma\n (#t: Type0)\n (s0 s1: Seq.seq t)\n (i: nat{i < Seq.length s0 /\\ Seq.length s0 == Seq.length s1})\n : Lemma\n (requires Seq.equal (Seq.slice s0 0 i) (Seq.slice s1 0 i) /\\ Seq.index s0 i == Seq.index s1 i)\n (ensures Seq.equal (Seq.slice s0 0 (i + 1)) (Seq.slice s1 0 (i + 1)))\nlet extend_equal_up_to_lemma (#t:Type0)\n (s0:Seq.seq t)\n (s1:Seq.seq t)\n (i:nat{ i < Seq.length s0 /\\ Seq.length s0 == Seq.length s1 })\n : Lemma\n (requires\n Seq.equal (Seq.slice s0 0 i) (Seq.slice s1 0 i) /\\\n Seq.index s0 i == Seq.index s1 i)\n (ensures\n Seq.equal (Seq.slice s0 0 (i + 1)) (Seq.slice s1 0 (i + 1)))\n = assert (forall k. k < i ==> Seq.index s0 k == Seq.index (Seq.slice s0 0 i) k /\\\n Seq.index s1 k == Seq.index (Seq.slice s1 0 i) k)", "val split3_index (#a: eqtype) (s0: seq a) (x: a) (s1: seq a) (j: nat)\n : Lemma (requires j < Seq.length (Seq.append s0 s1))\n (ensures\n (let s = Seq.append s0 (Seq.cons x s1) in\n let s' = Seq.append s0 s1 in\n let n = Seq.length s0 in\n if j < n then Seq.index s' j == Seq.index s j else Seq.index s' j == Seq.index s (j + 1)))\nlet split3_index (#a:eqtype) (s0:seq a) (x:a) (s1:seq a) (j:nat)\n : Lemma\n (requires j < Seq.length (Seq.append s0 s1))\n (ensures (\n let s = Seq.append s0 (Seq.cons x s1) in\n let s' = Seq.append s0 s1 in\n let n = Seq.length s0 in\n if j < n then Seq.index s' j == Seq.index s j\n else Seq.index s' j == Seq.index s (j + 1)\n ))\n = let n = Seq.length (Seq.append s0 s1) in\n if j < n then ()\n else ()", "val lemma_seq_frame_lo: #a:Type -> s1:seq a -> s2:seq a{length s1 = length s2} -> i:nat -> j:nat{i <= j} -> m:nat{j < m} -> n:nat{m <= n && n <= length s1}\n -> Lemma\n (requires (s1 == (splice s2 m s1 n)))\n (ensures ((slice s1 i j == slice s2 i j) /\\ (index s1 j == index s2 j)))\nlet lemma_seq_frame_lo #_ s1 s2 i j m n =\n cut (equal (slice s1 i j) (slice s2 i j))", "val slice: #a:Type -> s:seq a -> i:nat -> j:nat{i <= j && j <= length s} -> Tot (seq a)\nlet slice = slice'", "val lemma_slice_orig_index (#a: Type) (s s': seq a) (m n: nat)\n : Lemma\n (requires length s == length s' /\\ m <= n /\\ n <= length s /\\ slice s m n == slice s' m n)\n (ensures\n (forall (i: int). {:pattern (index s i)\\/(index s' i)}\n m <= i /\\ i < n ==> index s i == index s' i))\nlet lemma_slice_orig_index (#a:Type) (s s':seq a) (m n:nat) : Lemma\n (requires length s == length s' /\\ m <= n /\\ n <= length s /\\ slice s m n == slice s' m n)\n (ensures (forall (i:int).{:pattern (index s i) \\/ (index s' i)} m <= i /\\ i < n ==> index s i == index s' i))\n =\n let aux (i:nat{m <= i /\\ i < n}) : Lemma (index s i == index s' i) =\n lemma_index_slice s m n (i - m);\n lemma_index_slice s' m n (i - m)\n in Classical.forall_intro aux", "val lemma_slice_orig_index (#a: Type) (s s': seq a) (m n: nat)\n : Lemma\n (requires length s == length s' /\\ m <= n /\\ n <= length s /\\ slice s m n == slice s' m n)\n (ensures\n (forall (i: int). {:pattern (index s i)\\/(index s' i)}\n m <= i /\\ i < n ==> index s i == index s' i))\nlet lemma_slice_orig_index (#a:Type) (s s':seq a) (m n:nat) : Lemma\n (requires length s == length s' /\\ m <= n /\\ n <= length s /\\ slice s m n == slice s' m n)\n (ensures (forall (i:int).{:pattern (index s i) \\/ (index s' i)} m <= i /\\ i < n ==> index s i == index s' i))\n =\n let aux (i:nat{m <= i /\\ i < n}) : Lemma (index s i == index s' i) =\n lemma_index_slice s m n (i - m);\n lemma_index_slice s' m n (i - m)\n in Classical.forall_intro aux", "val lemma_index_slice0' (#a: Type) (s: seq a) (j: nat{j <= length s}) (k: nat{k < j})\n : Lemma (requires True) (ensures (index (slice s 0 j) k == index s k)) (decreases (length s))\nlet rec lemma_index_slice0' (#a:Type) (s:seq a) (j:nat{j <= length s}) (k : nat{k < j})\n: Lemma\n (requires True)\n (ensures (index (slice s 0 j) k == index s k)) (decreases (length s))\n= if k = 0\n then ()\n else lemma_index_slice0' (tl s) (j-1) (k-1)", "val lemma_swap_permutes_aux_frag_eq: #a:Type -> s:seq a -> i:nat{i j:nat{i <= j && j i':nat -> j':nat{i' <= j' /\\ j'<=length s /\\\n (j < i' //high slice\n \\/ j' <= i //low slice\n \\/ (i < i' /\\ j' <= j)) //mid slice\n }\n -> Lemma (ensures (slice s i' j' == slice (swap s i j) i' j'\n /\\ slice s i (i + 1) == slice (swap s i j) j (j + 1)\n /\\ slice s j (j + 1) == slice (swap s i j) i (i + 1)))\nlet lemma_swap_permutes_aux_frag_eq #a s i j i' j' =\n cut (equal (slice s i' j') (slice (swap s i j) i' j'));\n cut (equal (slice s i (i + 1)) (slice (swap s i j) j (j + 1)));\n cut (equal (slice s j (j + 1)) (slice (swap s i j) i (i + 1)))", "val lemma_not_equal_last: #a:Type -> b1:Seq.seq a -> b2:Seq.seq a -> i:nat ->\n j:nat{i < j /\\ j <= Seq.length b1 /\\ j <= Seq.length b2} ->\n Lemma\n (requires ~(Seq.index b1 (j - 1) == Seq.index b2 (j - 1)))\n (ensures ~(Seq.equal (Seq.slice b1 i j) (Seq.slice b2 i j)))\nlet lemma_not_equal_last #a b1 b2 i j =\n Seq.lemma_index_slice b1 i j (j - i - 1);\n Seq.lemma_index_slice b2 i j (j - i - 1)", "val intro_of_list'' (#a: Type) (i: nat) (s: seq a) (l: list a)\n : Lemma (requires (List.Tot.length l + i = length s /\\ i <= length s /\\ explode_and i s l))\n (ensures (equal (seq_of_list l) (slice s i (length s))))\n (decreases (List.Tot.length l))\nlet rec intro_of_list'': #a:Type ->\n i:nat ->\n s:seq a ->\n l:list a ->\n Lemma\n (requires (\n List.Tot.length l + i = length s /\\\n i <= length s /\\\n explode_and i s l))\n (ensures (\n equal (seq_of_list l) (slice s i (length s))))\n (decreases (\n List.Tot.length l))\n= fun #_ i s l ->\n lemma_seq_of_list_induction l;\n match l with\n | [] -> ()\n | hd :: tl -> intro_of_list'' (i + 1) s tl", "val lemma_slice_first_in_append: #a:Type -> s1:seq a -> s2:seq a -> i:nat{i <= length s1} -> Lemma\n (ensures (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)))\nlet lemma_slice_first_in_append = lemma_slice_first_in_append'", "val seq_slice_full (#t: Type) (s: Seq.seq t) : Lemma (s == Seq.slice s 0 (Seq.length s))\nlet seq_slice_full\n (#t: Type)\n (s: Seq.seq t)\n: Lemma\n (s == Seq.slice s 0 (Seq.length s))\n= assert (s `Seq.equal` Seq.slice s 0 (Seq.length s))", "val lemma_swap_splice : #a:Type -> s:seq a -> start:nat -> i:nat{start <= i} -> j:nat{i <= j} -> len:nat{j < len && len <= length s}\n -> Lemma\n (ensures (swap s i j == splice s start (swap s i j) len))\nlet lemma_swap_splice #_ s start i j len = cut (equal (swap s i j) (splice s start (swap s i j) len))", "val seq_append_seq_upd_seq_r (#t: Type) (s: Seq.seq t) (i': nat) (s' sr: Seq.seq t)\n : Lemma (requires (i' + Seq.length s' <= Seq.length s))\n (ensures\n (i' <= Seq.length (s `Seq.append` sr) /\\\n (seq_upd_seq s i' s') `Seq.append` sr == seq_upd_seq (s `Seq.append` sr) i' s'))\nlet seq_append_seq_upd_seq_r\n (#t: Type)\n (s: Seq.seq t)\n (i': nat)\n (s' : Seq.seq t)\n (sr : Seq.seq t)\n: Lemma\n (requires (i' + Seq.length s' <= Seq.length s))\n (ensures (\n i' <= Seq.length (s `Seq.append` sr) /\\\n seq_upd_seq s i' s' `Seq.append` sr == seq_upd_seq (s `Seq.append` sr) i' s'\n ))\n= assert ((seq_upd_seq s i' s' `Seq.append` sr) `Seq.equal` seq_upd_seq (s `Seq.append` sr) i' s')", "val lemma_sum_seq_left_right_rec (s: seq int) (i j k: nat)\n : Lemma (requires i <= j /\\ j <= k /\\ k <= length s)\n (ensures sum_seq_left s i j + sum_seq_right s j k == sum_seq_right s i k)\n (decreases j)\nlet rec lemma_sum_seq_left_right_rec (s:seq int) (i j k:nat) : Lemma\n (requires i <= j /\\ j <= k /\\ k <= length s)\n (ensures sum_seq_left s i j + sum_seq_right s j k == sum_seq_right s i k)\n (decreases j)\n =\n if i < j then lemma_sum_seq_left_right_rec s i (j - 1) k", "val reveal_be_to_n_slice (b: bytes) (i j: nat)\n : Lemma (requires i < j /\\ j <= S.length b)\n (ensures\n (let open FStar.Mul in\n let open FStar.Endianness in\n let h = U8.v (S.index b (j - 1)) in\n be_to_n (S.slice b i j) = h + pow2 8 * be_to_n (S.slice b i (j - 1))))\nlet rec reveal_be_to_n_slice (b:bytes) (i j:nat) : Lemma\n (requires i < j /\\ j <= S.length b)\n (ensures (\n let open FStar.Mul in\n let open FStar.Endianness in\n let h = U8.v (S.index b (j-1)) in\n be_to_n (S.slice b i j) = h + pow2 8 * be_to_n (S.slice b i (j - 1)))) =\n FStar.Endianness.reveal_be_to_n (S.slice b i j)", "val lemma_slice_first_in_append' (#a: Type) (s1 s2: seq a) (i: nat{i <= length s1})\n : Lemma\n (ensures\n (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)\n )) (decreases (length s1))\nlet rec lemma_slice_first_in_append' (#a:Type) (s1:seq a) (s2:seq a)\n (i:nat{i <= length s1})\n: Lemma\n (ensures (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)))\n (decreases (length s1))\n= if i = 0 then ()\n else lemma_slice_first_in_append' (tail s1) s2 (i - 1)", "val sum_seq_right (s: seq int) (i j: nat)\n : Pure int (requires i <= j /\\ j <= length s) (ensures fun _ -> True) (decreases (j - i))\nlet rec sum_seq_right (s:seq int) (i j:nat) : Pure int\n (requires i <= j /\\ j <= length s)\n (ensures fun _ -> True)\n (decreases (j - i))\n =\n if i = j then 0\n else s.[i] + sum_seq_right s (i + 1) j", "val seq_slice_append_r (#t: Type) (s1 s2: Seq.seq t)\n : Lemma (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2)) == s2)\nlet seq_slice_append_r\n (#t: Type)\n (s1 s2: Seq.seq t)\n: Lemma\n (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2)) == s2)\n= assert (Seq.equal (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2))) s2)", "val seq_slice_append_r (#t: Type) (s1 s2: Seq.seq t)\n : Lemma (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2)) == s2)\nlet seq_slice_append_r\n (#t: Type)\n (s1 s2: Seq.seq t)\n: Lemma\n (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2)) == s2)\n= assert (Seq.equal (Seq.slice (Seq.append s1 s2) (Seq.length s1) (Seq.length (Seq.append s1 s2))) s2)", "val map_seq_index (#a #b:Type) (f:a -> Tot b) (s:Seq.seq a) (i:nat{i < Seq.length s})\n : Lemma (ensures (map_seq_len f s; Seq.index (map_seq f s) i == f (Seq.index s i)))\nlet rec map_seq_index #a #b f s i\n : Lemma (ensures (map_seq_len f s; Seq.index (map_seq f s) i == f (Seq.index s i))) (decreases Seq.length s)\n = map_seq_len f s;\n if Seq.length s = 0\n then ()\n else if i = 0\n then ()\n else map_seq_index f (tail s) (i-1)", "val lemma_swap_permutes_slice : #a:eqtype -> s:seq a -> start:nat -> i:nat{start <= i} -> j:nat{i <= j} -> len:nat{j < len && len <= length s}\n -> Lemma (ensures (permutation a (slice s start len) (slice (swap s i j) start len)))\nlet lemma_swap_permutes_slice #_ s start i j len =\n lemma_swap_slice_commute s start i j len;\n lemma_swap_permutes (slice s start len) (i - start) (j - start)", "val seq_upd_seq_right_to_left\n (#t: Type)\n (s1: Seq.seq t)\n (i1: nat)\n (s2: Seq.seq t)\n (i2: nat)\n (s3: Seq.seq t)\n : Lemma (requires (i1 + Seq.length s2 <= Seq.length s1 /\\ i2 + Seq.length s3 <= Seq.length s2))\n (ensures\n (seq_upd_seq s1 i1 (seq_upd_seq s2 i2 s3) == seq_upd_seq (seq_upd_seq s1 i1 s2) (i1 + i2) s3\n ))\nlet seq_upd_seq_right_to_left\n (#t: Type)\n (s1: Seq.seq t)\n (i1: nat)\n (s2: Seq.seq t)\n (i2: nat)\n (s3: Seq.seq t)\n: Lemma\n (requires (i1 + Seq.length s2 <= Seq.length s1 /\\ i2 + Seq.length s3 <= Seq.length s2))\n (ensures (\n seq_upd_seq s1 i1 (seq_upd_seq s2 i2 s3) == seq_upd_seq (seq_upd_seq s1 i1 s2) (i1 + i2) s3\n ))\n= assert (seq_upd_seq s1 i1 (seq_upd_seq s2 i2 s3) `Seq.equal` seq_upd_seq (seq_upd_seq s1 i1 s2) (i1 + i2) s3)", "val lemma_swap_permutes (#a:eqtype) (s:seq a) (i:nat{i count x s = count x (swap s i j))\n (lemma_swap_permutes_aux s i j)", "val seq_upd_seq_left (#t: Type) (s s': Seq.seq t)\n : Lemma (requires (Seq.length s' <= Seq.length s))\n (ensures (seq_upd_seq s 0 s' == Seq.append s' (Seq.slice s (Seq.length s') (Seq.length s))))\nlet seq_upd_seq_left\n (#t: Type)\n (s: Seq.seq t)\n (s' : Seq.seq t)\n: Lemma\n (requires (Seq.length s' <= Seq.length s))\n (ensures (seq_upd_seq s 0 s' == Seq.append s' (Seq.slice s (Seq.length s') (Seq.length s))))\n= assert (seq_upd_seq s 0 s' `Seq.equal` Seq.append s' (Seq.slice s (Seq.length s') (Seq.length s)))", "val lemma_is_prefix_of_slice\n (#a: Type0)\n (s1: seq a)\n (s2: seq a {s1 `is_prefix_of` s2})\n (i: nat)\n (j: nat{j >= i /\\ j <= Seq.length s1})\n : Lemma (requires True)\n (ensures (Seq.slice s1 i j == Seq.slice s2 i j))\n [SMTPat (s1 `is_prefix_of` s2); SMTPat (Seq.slice s1 i j); SMTPat (Seq.slice s2 i j)]\nlet lemma_is_prefix_of_slice\n (#a:Type0) (s1:seq a) (s2:seq a{s1 `is_prefix_of` s2}) (i:nat) (j:nat{j >= i /\\ j <= Seq.length s1})\n :Lemma (requires True)\n (ensures (Seq.slice s1 i j == Seq.slice s2 i j))\n\t [SMTPat (s1 `is_prefix_of` s2); SMTPat (Seq.slice s1 i j); SMTPat (Seq.slice s2 i j)]\n = ArrayUtils.lemma_is_prefix_of_slice s1 s2 i j", "val sum_seq_left (s: seq int) (i j: nat)\n : Pure int (requires i <= j /\\ j <= length s) (ensures fun _ -> True) (decreases j)\nlet rec sum_seq_left (s:seq int) (i j:nat) : Pure int\n (requires i <= j /\\ j <= length s)\n (ensures fun _ -> True)\n (decreases j)\n =\n if i = j then 0\n else s.[j - 1] + sum_seq_left s i (j - 1)", "val reveal_seq_slice\n (#t: Secret.inttype{Secret.unsigned t})\n (#sec: Secret.secrecy_level)\n (x: seq (Secret.uint_t t sec))\n (from: nat)\n (to: nat{from <= to /\\ to <= length x})\n : Lemma (slice (seq_reveal x) from to == seq_reveal (slice x from to))\n [SMTPat (slice (seq_reveal x) from to)]\nlet reveal_seq_slice\n (#t: Secret.inttype { Secret.unsigned t })\n (#sec: Secret.secrecy_level)\n (x: seq (Secret.uint_t t sec))\n (from: nat)\n (to: nat { from <= to /\\ to <= length x })\n: Lemma\n (slice (seq_reveal x) from to == seq_reveal (slice x from to))\n [SMTPat (slice (seq_reveal x) from to)]\n= assert (slice (seq_reveal x) from to `equal` seq_reveal (slice x from to))", "val lemma_split: #a:Type -> #len:size_nat -> s:Seq.lseq a len -> i:size_nat{i <= len} ->\n Lemma (s == Seq.(Seq.sub s 0 i @| Seq.sub s i (len - i)))\nlet lemma_split #a #len s i =\n FStar.Seq.lemma_split s i", "val slice_snoc (#a: _) (s: seq a) (x: a) (from: nat) (to: nat{from <= to /\\ to <= Seq.length s})\n : Lemma (slice s from to == slice (snoc s x) from to)\nlet slice_snoc #a (s:seq a) (x:a) (from:nat) (to:nat{from<=to /\\ to<=Seq.length s})\n : Lemma (slice s from to == slice (snoc s x) from to)\n = assert (slice s from to `Seq.equal` slice (snoc s x) from to)", "val lemma_suffix_index (#a:Type) (s:seq a) (i:nat{i <= length s}) (j:nat{j < i}):\nLemma (requires (True))\n (ensures (index (suffix s i) j == index s (length s - i + j)))\n [SMTPat (index (suffix s i) j)]\nlet lemma_suffix_index (#a:Type) (s:seq a) (i:nat{i <= length s}) (j:nat{j < i}):\n Lemma (requires (True))\n (ensures (index (suffix s i) j == index s (length s - i + j))) =\n lemma_index_slice s (length s - i) (length s) j", "val split_5 : #a:Type -> s:seq a -> i:nat -> j:nat{i < j && j < length s} -> Pure (seq (seq a))\n (requires True)\n (ensures (fun x ->\n (length x = 5\n /\\ equal s (append (index x 0) (append (index x 1) (append (index x 2) (append (index x 3) (index x 4)))))\n /\\ equal (index x 0) (slice s 0 i)\n /\\ equal (index x 1) (slice s i (i+1))\n /\\ equal (index x 2) (slice s (i+1) j)\n /\\ equal (index x 3) (slice s j (j + 1))\n /\\ equal (index x 4) (slice s (j + 1) (length s)))))\nlet split_5 #a s i j =\n let frag_lo = slice s 0 i in\n let frag_i = slice s i (i + 1) in\n let frag_mid = slice s (i + 1) j in\n let frag_j = slice s j (j + 1) in\n let frag_hi = slice s (j + 1) (length s) in\n upd (upd (upd (upd (create 5 frag_lo) 1 frag_i) 2 frag_mid) 3 frag_j) 4 frag_hi", "val sel'_tail (#a #b:_) (v:view a b) (es:Seq.seq a{Seq.length es > 0})\n (i:nat{View?.n v <= i /\\ i < Seq.length es * View?.n v})\n : Lemma (let j = i - View?.n v in\n sel' v es i == sel' v (Seq.tail es) j)\nlet sel'_tail #a #b v es i =\n let len_as = Seq.length es in\n indexing' v len_as i;\n let n = View?.n v in\n let j = i - n in\n let a_i = i / n in\n assert (sel' v es i == Seq.index (View?.get v (Seq.index es a_i)) (i % n));\n FStar.Math.Lemmas.lemma_mod_sub i n 1;\n FStar.Math.Lemmas.add_div_mod_1 j n;\n assert (j / n == (i / n) - 1)", "val seq_slice_append_l (#t: Type) (s1 s2: Seq.seq t)\n : Lemma (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1) == s1)\nlet seq_slice_append_l\n (#t: Type)\n (s1 s2: Seq.seq t)\n: Lemma\n (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1) == s1)\n= assert (Seq.equal (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1)) s1)", "val seq_slice_append_l (#t: Type) (s1 s2: Seq.seq t)\n : Lemma (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1) == s1)\nlet seq_slice_append_l\n (#t: Type)\n (s1 s2: Seq.seq t)\n: Lemma\n (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1) == s1)\n= assert (Seq.equal (Seq.slice (Seq.append s1 s2) 0 (Seq.length s1)) s1)", "val lemma_swap_permutes_aux: #a:eqtype -> s:seq a -> i:nat{i j:nat{i <= j && j x:a -> Lemma\n (requires True)\n (ensures (count x s = count x (swap s i j)))\nlet lemma_swap_permutes_aux #_ s i j x =\n if j=i\n then cut (equal (swap s i j) s)\n else begin\n let s5 = split_5 s i j in\n let frag_lo, frag_i, frag_mid, frag_j, frag_hi =\n index s5 0, index s5 1, index s5 2, index s5 3, index s5 4 in\n lemma_append_count_aux x frag_lo (append frag_i (append frag_mid (append frag_j frag_hi)));\n lemma_append_count_aux x frag_i (append frag_mid (append frag_j frag_hi));\n lemma_append_count_aux x frag_mid (append frag_j frag_hi);\n lemma_append_count_aux x frag_j frag_hi;\n\n let s' = swap s i j in\n let s5' = split_5 s' i j in\n let frag_lo', frag_j', frag_mid', frag_i', frag_hi' =\n index s5' 0, index s5' 1, index s5' 2, index s5' 3, index s5' 4 in\n\n lemma_swap_permutes_aux_frag_eq s i j 0 i;\n lemma_swap_permutes_aux_frag_eq s i j (i + 1) j;\n lemma_swap_permutes_aux_frag_eq s i j (j + 1) (length s);\n\n lemma_append_count_aux x frag_lo (append frag_j (append frag_mid (append frag_i frag_hi)));\n lemma_append_count_aux x frag_j (append frag_mid (append frag_i frag_hi));\n lemma_append_count_aux x frag_mid (append frag_i frag_hi);\n lemma_append_count_aux x frag_i frag_hi\n end", "val intro_of_list': #a:Type ->\n i:nat ->\n s:seq a ->\n l:list a ->\n Lemma\n (requires (\n List.Tot.length l + i = length s /\\\n i <= length s /\\\n explode_and i s l))\n (ensures (\n equal (seq_of_list l) (slice s i (length s))))\nlet intro_of_list' = intro_of_list''", "val slice_seq_hide\n (#t: Secret.inttype{Secret.unsigned t})\n (x: seq (Secret.uint_t t Secret.PUB))\n (from: nat)\n (to: nat{from <= to /\\ to <= length x})\n : Lemma (slice (seq_hide x) from to == seq_hide (slice x from to))\n [SMTPat (slice (seq_hide x) from to)]\nlet slice_seq_hide\n (#t: Secret.inttype { Secret.unsigned t })\n (x: seq (Secret.uint_t t Secret.PUB))\n (from: nat)\n (to: nat { from <= to /\\ to <= length x })\n: Lemma\n (slice (seq_hide x) from to == seq_hide (slice x from to))\n [SMTPat (slice (seq_hide x) from to)]\n= assert (slice (seq_hide x) from to `equal` seq_hide (slice x from to))", "val raw_hashes_slice:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n hs:hashes -> i:nat -> j:nat{i <= j && j <= S.length hs} ->\n Lemma (requires raw_hashes #_ #f hs)\n (ensures raw_hashes #_ #f (S.slice hs i j))\n (decreases (j - i))\nlet rec raw_hashes_slice #hsz #f hs i j =\n if i = j then ()\n else (\n raw_hashes_index #_ #f hs i;\n raw_hashes_slice #_ #f hs (i + 1) j)", "val seq_upd_seq_right (#t: Type) (s s': Seq.seq t)\n : Lemma (requires (Seq.length s' <= Seq.length s))\n (ensures\n (seq_upd_seq s (Seq.length s - Seq.length s') s' ==\n Seq.append (Seq.slice s 0 (Seq.length s - Seq.length s')) s'))\nlet seq_upd_seq_right\n (#t: Type)\n (s: Seq.seq t)\n (s' : Seq.seq t)\n: Lemma\n (requires (Seq.length s' <= Seq.length s))\n (ensures (seq_upd_seq s (Seq.length s - Seq.length s') s' == Seq.append (Seq.slice s 0 (Seq.length s - Seq.length s')) s'))\n= assert (seq_upd_seq s (Seq.length s - Seq.length s') s' `Seq.equal` Seq.append (Seq.slice s 0 (Seq.length s - Seq.length s')) s')", "val as_seq'_slice (#a #b: _)\n (v:view a b)\n (es:Seq.seq a)\n (i:nat{i < Seq.length es * View?.n v})\n : Lemma\n (ensures (\n as_seq'_len es v;\n indexing' v (Seq.length es) i;\n let n = View?.n v in\n View?.get v (Seq.index es (i / n)) ==\n Seq.slice (as_seq' es v) (n * (i /n)) (n * (i / n) + n)))\n (decreases (Seq.length es))\nlet rec as_seq'_slice #a #b v es i =\n let n = View?.n v in\n if Seq.length es = 0 then ()\n else let bs = as_seq' es v in\n if i < n then\n begin\n assert (View?.get v (Seq.index es (i / n)) `Seq.equal`\n Seq.slice (as_seq' es v) (n * (i /n)) (n * (i / n) + n))\n end\n else let as' = Seq.tail es in\n let j = i - n in\n as_seq'_slice v (Seq.tail es) (i - n);\n as_seq'_len as' v;\n indexing' v (Seq.length as') j;\n FStar.Math.Lemmas.add_div_mod_1 j n;\n assert (View?.get v (Seq.index as' (j / n)) `Seq.equal`\n Seq.slice (as_seq' as' v) (n * (j / n)) (n * (j / n) + n));\n assert (Seq.slice (as_seq' as' v) (n * (j / n)) (n * (j / n) + n) `Seq.equal`\n Seq.slice (as_seq' es v) (n * (j / n) + n) (n * (j / n) + n + n));\n FStar.Math.Lemmas.add_div_mod_1 j n;\n assert (j / n == i / n - 1)", "val seq_slice_more_equal:\n #a:Type -> s1:S.seq a -> s2:S.seq a ->\n n:nat -> m:nat{n <= m && m <= S.length s1 && m <= S.length s2} ->\n k:nat{n <= k} -> l:nat{k <= l && l <= m} ->\n Lemma (requires S.equal (S.slice s1 n m) (S.slice s2 n m))\n (ensures S.equal (S.slice s1 k l) (S.slice s2 k l))\n [SMTPat (S.equal (S.slice s1 n m) (S.slice s2 n m));\n SMTPat (S.equal (S.slice s1 k l) (S.slice s2 k l))]\nlet seq_slice_more_equal #a s1 s2 n m k l =\n slice_slice s1 n m (k - n) (l - n);\n slice_slice s2 n m (k - n) (l - n)", "val rev_seq (#a: Type) (s: S.seq a)\n : Pure (S.seq a)\n (requires True)\n (ensures fun s' -> S.length s = S.length s')\n (decreases (S.length s))\nlet rec rev_seq (#a:Type) (s:S.seq a) : Pure (S.seq a)\n (requires True)\n (ensures fun s' -> S.length s = S.length s')\n (decreases (S.length s)) =\n if S.length s = 0 then S.empty\n else\n let _ = S.lemma_empty s in\n S.(rev_seq S.(slice s 1 (length s)) @| create 1 (index s 0))", "val swap_frame_hi : #a:Type -> s:seq a -> i:nat -> j:nat{i <= j} -> k:nat{j < k} -> hi:nat{k <= hi /\\ hi <= length s}\n -> Lemma (ensures (slice s k hi == slice (swap s i j) k hi))\nlet swap_frame_hi #_ s i j k hi = cut (equal (slice s k hi) (slice (swap s i j) k hi))", "val lemma_sseq_extend_len (#a:eqtype) (ss: sseq a) (x:a) (i:seq_index ss):\n Lemma (ensures (flat_length (sseq_extend ss x i) = 1 + flat_length ss))\nlet rec lemma_sseq_extend_len (#a:eqtype) (ss: sseq a) (x:a) (i:seq_index ss):\n Lemma (ensures (flat_length (sseq_extend ss x i) = 1 + flat_length ss))\n (decreases (length ss)) =\n let n = length ss in\n\n if i = n - 1 then (\n lemma_sseq_extend_len_base ss x\n )\n else (\n let ss' = hprefix ss in\n let ssx = sseq_extend ss x i in\n let ssx' = sseq_extend ss' x i in\n\n lemma_sseq_extend_len ss' x i;\n assert(equal ssx (append1 ssx' (telem ss)));\n lemma_flat_length_app1 ssx' (telem ss);\n lemma_hprefix_append1 ss;\n lemma_flat_length_app1 ss' (telem ss)\n )", "val lemma_prefix_suffix (#a: Type) (s: seq a) (i: nat{i <= length s})\n : Lemma (requires (True)) (ensures (append (prefix s i) (suffix s (length s - i)) == s))\nlet lemma_prefix_suffix (#a:Type) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (True))\n (ensures (append (prefix s i) (suffix s (length s - i)) == s)) =\n assert(equal (append (prefix s i) (suffix s (length s - i))) s);\n ()", "val seq_count_i (#a: eqtype) (s: Seq.seq a) (i: seq_index s)\n : Lemma (ensures Seq.count (Seq.index s i) s > 0) (decreases (Seq.length s))\nlet rec seq_count_i (#a:eqtype) (s:Seq.seq a) (i:seq_index s)\n : Lemma\n (ensures Seq.count (Seq.index s i) s > 0)\n (decreases (Seq.length s))\n = if i = 0 then ()\n else seq_count_i (Seq.tail s) (i - 1)" ], "closest_src": [ { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_rev_seq" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.slice_trans" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_left'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice'" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.extensionality_slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_right'" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.lemma_len_slice'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_snoc" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_cons" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.slice_seq_map_commute" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_right" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_left" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.slice_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_tail_slice" }, { "project_name": "FStar", "file_name": "MiniParse.Impl.Combinators.fst", "name": "MiniParse.Impl.Combinators.seq_append_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.splice_refl" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GCM.fst", "name": "Vale.AES.GCM.slice_append_back" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GCM_BE.fst", "name": "Vale.AES.GCM_BE.slice_append_back" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.slice_append_adds" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.seq_slice_equal_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.lemma_index_slice'" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.cons_index_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.lemma_len_slice" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.as_seq_seq_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.snoc_slice_index" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_seq_upd_seq_slice" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.lemma_not_equal_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Sorted.fst", "name": "FStar.Seq.Sorted.sorted_slice_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Lemmas.fst", "name": "Vale.Bignum.Lemmas.lemma_sum_seq_left_right" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Lemmas.fst", "name": "Hacl.Hash.Lemmas.create_next" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_slice_commute" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.slice'" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Util.fst", "name": "FStar.Sequence.Util.slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_idem" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.upd_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_count_slice" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Lemmas.fst", "name": "Hacl.Hash.Lemmas.init_next" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.lemma_index_slice" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.as_seq_seq_eq" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.slice" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.forall_as_seq" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt_reindex_right" }, { "project_name": "FStar", "file_name": "QuickSort.Array.fst", "name": "QuickSort.Array.lemma_slice_cons_pv" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.slice_upd" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_seq_frame_hi" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_seq_upd" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt_reindex_left" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Montgomery.fst", "name": "Hacl.Spec.Bignum.Montgomery.eq_slice" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Permutation.fst", "name": "FStar.Sequence.Permutation.split3_index" }, { "project_name": "everparse", "file_name": "LowParse.Endianness.BitFields.fst", "name": "LowParse.Endianness.BitFields.bitfield_be_to_n_slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_append_seq_upd_seq_l" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.extend_equal_up_to_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Permutation.fst", "name": "FStar.Seq.Permutation.split3_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_seq_frame_lo" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.slice" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GCTR.fst", "name": "Vale.AES.GCTR.lemma_slice_orig_index" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GCTR_BE.fst", "name": "Vale.AES.GCTR_BE.lemma_slice_orig_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.lemma_index_slice0'" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes_aux_frag_eq" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.lemma_not_equal_last" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.intro_of_list''" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_first_in_append" }, { "project_name": "steel", "file_name": "Pulse.Lib.ArraySwap.fst", "name": "Pulse.Lib.ArraySwap.seq_slice_full" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_splice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_append_seq_upd_seq_r" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Lemmas.fst", "name": "Vale.Bignum.Lemmas.lemma_sum_seq_left_right_rec" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.reveal_be_to_n_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_first_in_append'" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fsti", "name": "Vale.Bignum.Defs.sum_seq_right" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.seq_slice_append_r" }, { "project_name": "FStar", "file_name": "MiniParse.Spec.Combinators.fst", "name": "MiniParse.Spec.Combinators.seq_slice_append_r" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.map_seq_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes_slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_right_to_left" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_left" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.lemma_is_prefix_of_slice" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fsti", "name": "Vale.Bignum.Defs.sum_seq_left" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Secret.Seq.fsti", "name": "QUIC.Secret.Seq.reveal_seq_slice" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Frodo.Pack.fst", "name": "Hacl.Impl.Frodo.Pack.lemma_split" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.slice_snoc" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_suffix_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.split_5" }, { "project_name": "FStar", "file_name": "LowStar.BufferView.Down.fst", "name": "LowStar.BufferView.Down.sel'_tail" }, { "project_name": "FStar", "file_name": "MiniParse.Spec.Combinators.fst", "name": "MiniParse.Spec.Combinators.seq_slice_append_l" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.seq_slice_append_l" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes_aux" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.intro_of_list'" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Secret.Seq.fsti", "name": "QUIC.Secret.Seq.slice_seq_hide" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.raw_hashes_slice" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_right" }, { "project_name": "FStar", "file_name": "LowStar.BufferView.Down.fst", "name": "LowStar.BufferView.Down.as_seq'_slice" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.seq_slice_more_equal" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.rev_seq" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.swap_frame_hi" }, { "project_name": "zeta", "file_name": "Zeta.SSeq.fst", "name": "Zeta.SSeq.lemma_sseq_extend_len" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_prefix_suffix" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.seq_count_i" } ], "selected_premises": [ "LowParse.Endianness.index_seq_rev'", "LowParse.Endianness.seq_rev", "FStar.Mul.op_Star", "LowParse.Endianness.index_be_to_n'", "LowParse.Endianness.index_be_to_n", "LowParse.Endianness.be_to_n_append", "LowParse.Endianness.index_seq_rev", "LowParse.Endianness.index_n_to_be_zero_right", "LowParse.Endianness.index_n_to_be", "FStar.Pervasives.reveal_opaque", "LowParse.Endianness.slice_n_to_be", "LowParse.Endianness.reveal_n_to_be", "LowParse.Endianness.index_n_to_be_zero_left", "LowParse.Endianness.n_to_be_append", "LowParse.Endianness.be_to_n_append'", "FStar.Math.Lemmas.pow2_plus", "FStar.Math.Lemmas.pow2_lt_compat", "FStar.Math.Lemmas.pow2_le_compat", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.Math.Lemmas.lemma_div_lt", "FStar.Math.Lemmas.lemma_mod_mul_distr_l", "FStar.Math.Lemmas.distributivity_sub_left", "FStar.Math.Lemmas.lemma_mod_plus", "FStar.Math.Lemmas.distributivity_add_right", "FStar.Math.Lemmas.lemma_mod_sub", "FStar.Math.Lemmas.distributivity_sub_right", "FStar.Math.Lemmas.lemma_mult_lt_sqr", "FStar.Math.Lemmas.lemma_div_lt_nat", "FStar.Math.Lemmas.lemma_div_le", "FStar.Math.Lemmas.division_multiplication_lemma", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1", "FStar.Math.Lib.slash_decr_axiom", "FStar.Math.Lemmas.modulo_distributivity", "FStar.Math.Lemmas.multiple_modulo_lemma", "FStar.Math.Lemmas.lemma_mod_twice", "FStar.Math.Lemmas.lemma_mod_spec2", "FStar.Math.Lemmas.modulo_addition_lemma", "FStar.Math.Lemmas.lemma_div_plus", "FStar.Math.Lemmas.multiple_division_lemma", "FStar.Math.Lemmas.lemma_mul_sub_distr", "FStar.Math.Lemmas.sub_div_mod_1", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_2", "FStar.Math.Lemmas.mod_mul_div_exact", "FStar.Math.Lemmas.modulo_modulo_lemma", "FStar.Pervasives.pure_return", "FStar.Math.Lemmas.modulo_sub_lemma", "FStar.Math.Lemmas.division_addition_lemma", "FStar.Math.Lemmas.div_exact_r", "FStar.Math.Lemmas.lemma_mod_sub_distr", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_1", "FStar.Math.Lemmas.lemma_div_lt_cancel", "FStar.Math.Lemmas.mul_ineq1", "FStar.Math.Lemmas.modulo_division_lemma_0", "FStar.Math.Lemmas.lemma_mod_mod", "FStar.Math.Lemmas.lemma_mod_sub_1", "FStar.Math.Lemmas.lemma_mod_mult_zero", "FStar.Math.Lemmas.pow2_modulo_division_lemma_1", "FStar.Math.Lib.log_2", "FStar.Math.Lemmas.pow2_minus", "FStar.Math.Lemmas.division_definition", "FStar.Math.Lemmas.modulo_scale_lemma", "FStar.Preorder.preorder_rel", "FStar.Pervasives.dfst", "FStar.Math.Lemmas.lemma_mod_spec", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_2", "Prims.returnM", "FStar.Math.Lemmas.mod_mult_exact", "FStar.Preorder.transitive", "FStar.Pervasives.dsnd", "FStar.Math.Lemmas.lemma_mod_plus_injective", "FStar.Pervasives.st_return", "FStar.Math.Lib.max", "FStar.Math.Lib.slash_star_axiom", "FStar.Math.Lemmas.modulo_division_lemma", "FStar.Math.Lemmas.lemma_mod_plus_mul_distr", "FStar.Math.Lemmas.division_definition_lemma_1", "FStar.Math.Lemmas.modulo_sub", "Prims.pure_wp_monotonic", "FStar.Math.Lemmas.cancel_fraction", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.st_post_h'", "FStar.Math.Lib.div", "FStar.Math.Lemmas.pow2_modulo_division_lemma_2", "FStar.Math.Lemmas.swap_neg_mul", "FStar.Math.Lemmas.lemma_mod_add_distr", "FStar.Math.Lib.div_non_eucl_decr_lemma", "FStar.Math.Lemmas.modulo_add", "FStar.Math.Lib.div_non_eucl", "FStar.Math.Lemmas.division_definition_lemma_2", "FStar.Pervasives.trivial_pure_post", "Prims.__cache_version_number__", "Prims.pow2", "Prims.pure_post", "FStar.Math.Lib.abs", "FStar.Math.Lib.signed_modulo" ], "source_upto_this": "module LowParse.Endianness\n\nlet rec index_be_to_n'\n (b: bytes)\n (i: nat)\n: Lemma\n (requires (\n i < S.length b\n ))\n (ensures (\n U8.v (S.index b i) == (be_to_n b / pow2 (8 * (S.length b - 1 - i))) % pow2 8\n ))\n (decreases (S.length b))\n= reveal_be_to_n b;\n if i = S.length b - 1\n then ()\n else begin\n let l = S.length b in\n let l' = l - 1 in\n let b' = S.slice b 0 l' in\n index_be_to_n' b' i;\n assert (S.index b i == S.index b' i);\n let open FStar.Math.Lemmas in\n let x = be_to_n b in\n let x' = be_to_n b' in\n assert (U8.v (S.index b i) == x' / pow2 (8 * (l' - 1 - i)) % pow2 8);\n let y = (U8.v (S.last b) + pow2 8 * x') / pow2 (8 * (l - 1 - i)) % pow2 8 in\n pow2_plus 8 (8 * (l' - 1 - i));\n division_multiplication_lemma (U8.v (S.last b) + pow2 8 * x') (pow2 8) (pow2 (8 * (l' - 1 - i)));\n assert (pow2 8 * x' == x' * pow2 8);\n division_addition_lemma (U8.v (S.last b)) (pow2 8) x';\n small_division_lemma_1 (U8.v (S.last b)) (pow2 8);\n assert (y == x' / pow2 (8 * (l' - 1 - i)) % pow2 8)\n end\n\nlet index_be_to_n = index_be_to_n'\n\nlet index_n_to_be\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i)) == (n / pow2 (8 * (len - 1 - i)) % pow2 8\n ))\n= index_be_to_n (n_to_be len n) i\n\nlet index_n_to_be_zero_left\n (len: nat)\n (n: nat)\n (j: nat)\n (i: nat)\n: Lemma\n (requires (\n i < j /\\\n j <= len /\\\n n < pow2 (8 * (len - j))\n ))\n (ensures (\n pow2 (8 * (len - j)) <= pow2 (8 * len) /\\\n U8.v (S.index (n_to_be len n) i) == 0\n ))\n= let open FStar.Math.Lemmas in\n pow2_le_compat (8 * len) (8 * (len - j));\n pow2_le_compat (8 * (len - 1 - i)) (8 * (len - j));\n small_division_lemma_1 n (pow2 (8 * (len - 1 - i)));\n index_n_to_be len n i\n\nlet index_n_to_be_zero_right\n (len: nat)\n (n: nat)\n (i: nat)\n: Lemma\n (requires (\n i < len /\\\n n < pow2 (8 * len) /\\\n n % pow2 (8 * (len - i)) == 0\n ))\n (ensures (\n U8.v (S.index (n_to_be len n) i) == 0\n ))\n= index_n_to_be len n i;\n let open FStar.Math.Lemmas in\n modulo_division_lemma n (pow2 (8 * (len - 1 - i))) (pow2 8);\n pow2_plus (8 * (len - 1 - i)) 8\n\nopen FStar.Math.Lemmas\n\nlet rec be_to_n_append'\n (hi lo: bytes)\n: Lemma\n (ensures (be_to_n (hi `S.append` lo) == be_to_n hi * pow2 (8 * S.length lo) + be_to_n lo))\n (decreases (S.length lo))\n= reveal_be_to_n lo;\n let hilo = hi `S.append` lo in\n if S.length lo = 0\n then\n assert (hilo `S.equal` hi)\n else begin\n let lo' = S.slice lo 0 (S.length lo - 1) in\n assert (S.slice hilo 0 (S.length hilo - 1) `S.equal` (hi `S.append` lo'));\n assert (S.last hilo == S.last lo);\n reveal_be_to_n hilo;\n be_to_n_append' hi lo';\n pow2_plus (8 * S.length lo') 8\n end\n\nlet be_to_n_append = be_to_n_append'\n\nlet lemma_div_zero (x: pos) : Lemma\n (0 / x == 0)\n= ()\n\nlet n_to_be_append\n (len: nat)\n (n: nat)\n (len_lo: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len) /\\\n len_lo <= len\n ))\n (ensures (\n let hi = n / pow2 (8 * len_lo) in\n let lo = n % pow2 (8 * len_lo) in\n 0 <= hi /\\\n hi < pow2 (8 * (len - len_lo)) /\\\n 0 <= lo /\\\n lo < pow2 (8 * len_lo) /\\\n n_to_be len n == n_to_be (len - len_lo) hi `S.append` n_to_be len_lo lo\n ))\n= lemma_div_zero (pow2 (8 * len_lo));\n lemma_div_le 0 n (pow2 (8 * len_lo));\n lemma_mod_lt n (pow2 (8 * len_lo));\n let hi = n / pow2 (8 * len_lo) in\n assert (0 <= hi);\n lemma_div_lt n (8 * len) (8 * len_lo);\n pow2_minus (8 * len) (8 * len_lo);\n let lo = n % pow2 (8 * len_lo) in\n euclidean_division_definition n (pow2 (8 * len_lo));\n let hi_s = n_to_be (len - len_lo) hi in\n let lo_s = n_to_be len_lo lo in\n be_to_n_append hi_s lo_s;\n assert (be_to_n (hi_s `S.append` lo_s) == n);\n be_to_n_inj (hi_s `S.append` lo_s) (n_to_be len n)\n\nlet reveal_n_to_be\n (len: nat)\n (n: nat)\n: Lemma\n (requires (\n n < pow2 (8 * len)\n ))\n (ensures (\n (len > 0 ==> (0 <= n / pow2 8 /\\ n / pow2 8 < pow2 (8 * (len - 1)))) /\\\n n_to_be len n `S.equal` (if len = 0 then S.empty else n_to_be (len - 1) (n / pow2 8) `S.snoc` (U8.uint_to_t (n % pow2 8)))\n ))\n= if len = 0\n then ()\n else begin\n n_to_be_append len n 1;\n index_n_to_be 1 (n % pow2 8) 0\n end\n\nlet slice_n_to_be\n (len: nat)\n (n: nat)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= len /\\\n n < pow2 (8 * len)\n ))\n (ensures (\n let res = (n / pow2 (8 * (len - j))) % pow2 (8 * (j - i)) in\n 0 <= res /\\\n res < pow2 (8 * (j - i)) /\\\n S.slice (n_to_be len n) i j == n_to_be (j - i) res\n ))\n= let s1 = S.slice (n_to_be len n) 0 j in\n let s2 = S.slice s1 i j in\n n_to_be_append len n (len - j);\n let q = n / pow2 (8 * (len - j)) in\n n_to_be_append j q (j - i);\n let r = q % pow2 (8 * (j - i)) in\n assert (s2 `S.equal` n_to_be (j - i) (q % pow2 (8 * (j - i))))\n\nlet rec seq_rev\n (#t: Type)\n (x: S.seq t)\n: Tot (y: S.seq t {S.length y == S.length x})\n (decreases (S.length x))\n= if S.length x = 0\n then S.empty\n else seq_rev (S.tail x) `S.append` S.create 1 (S.head x)\n\nlet rec index_seq_rev'\n (#t: Type)\n (x: S.seq t)\n (i: nat {i < S.length x})\n: Lemma\n (ensures (S.index (seq_rev x) (S.length x - 1 - i) == S.index x i))\n (decreases (S.length x))\n= if i = 0\n then\n S.lemma_index_create 1 (S.head x) 0\n else\n index_seq_rev' (S.tail x) (i - 1)\n\nlet index_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i: nat {i < S.length x})\n: Lemma\n (ensures (S.index (seq_rev x) i == S.index x (S.length x - 1 - i)))\n= index_seq_rev' x (S.length x - 1 - i)\n", "sketch": [ "Step 1: We will first slice the reversed sequence `x` from index `i` to index `j`.\nStep 2: Then we will slice the original sequence `x` from index `(S.length x - j)` to index `(S.length x - i)`.\nStep 3: We will then prove that the sliced reversed sequence is equal to the reversed slice of the original sequence.", "Step 1: We will first slice the reversed sequence `x` from index `i` to `j`.\nStep 2: Then we will slice the original sequence `x` from index `S.length x - j` to `S.length x - i`.\nStep 3: We will then assert that the sliced reversed sequence is equal to the reversed slice of the original sequence.", "Step 1: We will first slice the reversed sequence `x` from index `i` to `j`.\nStep 2: Then we will slice the original sequence `x` from index `S.length x - j` to `S.length x - i`.\nStep 3: We will then assert that the sliced reversed sequence is equal to the reversed slice of the original sequence.", "Step 1: We will first define a helper function that reverses a sequence. This function will take a sequence as input and return a new sequence with the elements in reverse order. We will use a recursive approach to implement this function.\n\nStep 2: Next, we will define a helper function that retrieves the element at a given index in a sequence. This function will take a sequence and an index as input, and it will return the element at the specified index.\n\nStep 3: Then, we will prove that slicing a reversed sequence is equivalent to reversing the slice of the original sequence. We will use the previously defined helper functions to implement and prove this property.", "Step 1: We will first slice the reversed sequence `x` from index `i` to `j`.\nStep 2: Then we will slice the original sequence `x` from index `S.length x - j` to `S.length x - i`.\nStep 3: We will then show that the sliced sequences are equal.", "Step 1: We will first slice the reversed sequence `x` from index `i` to index `j`. \nStep 2: Then we will slice the original sequence `x` from index `S.length x - j` to index `S.length x - i`.\nStep 3: We will then show that the sliced sequences are equal.", "Step 1: We will first slice the reversed sequence `x` from index `i` to `j`.\nStep 2: Next, we will slice the original sequence `x` from index `S.length x - j` to `S.length x - i`.\nStep 3: We will then show that the sliced sequences from step 1 and step 2 are equal.", "Step 1: We will first slice the sequence `x` from index `S.length x - j` to `S.length x - i`. This will give us a subsequence of `x` in reverse order.\nStep 2: Next, we will reverse the subsequence obtained in step 1 using the `seq_rev` function.\nStep 3: Finally, we will show that the result of step 2 is equal to slicing the original sequence `x` from index `i` to `j`.", "Step 1: We will first slice the reversed sequence `x` from index `i` to index `j`. \nStep 2: Then we will slice the original sequence `x` from index `S.length x - j` to index `S.length x - i`.\nStep 3: We will then assert that the sliced reversed sequence is equal to the reversed slice of the original sequence.", "Step 1: We will first slice the sequence `x` from index `S.length x - j` to `S.length x - i`. \nStep 2: Then, we will reverse the sliced sequence using the `seq_rev` function.\nStep 3: Finally, we will show that the result of slicing and reversing `x` is equal to the result of reversing the original sequence `x` and then slicing it from index `i` to `j`." ], "generated_solution": [ "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= {Your F* code here}", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= ...", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= {Your F* code here}", "let rec seq_rev_helper\n (#t: Type)\n (acc: S.seq t)\n (x: S.seq t)\n: Tot (y: S.seq t {S.length y == S.length acc + S.length x})\n (decreases (S.length x))\n= if S.length x = 0\n then acc\n else seq_rev_helper (acc `S.snoc` (S.last x)) (S.slice x 0 (S.length x - 1))\n\nlet seq_rev\n (#t: Type)\n (x: S.seq t)\n: Tot (y: S.seq t {S.length y == S.length x})\n (decreases (S.length x))\n= seq_rev_helper S.empty x\n\nlet index_seq_helper\n (#t: Type)\n (x: S.seq t)\n (i: nat {i < S.length x})\n: Lemma\n (ensures (S.index x i == S.index (seq_rev x) (S.length x - 1 - i)))\n= index_seq_rev' x (S.length x - 1 - i)\n\nlet slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (i <= j /\\ j <= S.length x))\n (ensures ((S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i))))\n= let rev_x = seq_rev x in\n let rev_slice = S.slice rev_x i j in\n let original_slice = seq_rev (S.slice x (S.length x - j) (S.length x - i)) in\n assert (rev_slice `S.equal` original_slice)", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= {Your F* code here}", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= \n {Your F* code here. You should only generate the completion of the proof. Do not include the lemma definition.}", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= {Your F* code here}", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= let s1 = S.slice x (S.length x - j) (S.length x - i) in\n let s2 = seq_rev s1 in\n let s3 = S.slice (seq_rev x) i j in\n assert (s3 `S.equal` s2)", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= \n {Your F* code here. You should only generate the completion of the proof. Do not include the lemma definition.}", "let slice_seq_rev\n (#t: Type)\n (x: S.seq t)\n (i j: nat)\n: Lemma\n (requires (\n i <= j /\\\n j <= S.length x\n ))\n (ensures (\n (S.slice (seq_rev x) i j) `S.equal` (seq_rev (S.slice x (S.length x - j) (S.length x - i)))\n ))\n= ..." ] }, { "file_name": "Vale.AES.X64.PolyOps.fst", "name": "Vale.AES.X64.PolyOps.va_wpProof_VLow64ToHigh", "opens_and_abbrevs": [ { "open": "Vale.X64.CPU_Features_s" }, { "open": "Vale.X64.QuickCodes" }, { "open": "Vale.X64.QuickCode" }, { "open": "Vale.X64.InsAes" }, { "open": "Vale.X64.InsVector" }, { "open": "Vale.X64.InsMem" }, { "open": "Vale.X64.InsBasic" }, { "open": "Vale.X64.Decls" }, { "open": "Vale.X64.State" }, { "open": "Vale.X64.Machine_s" }, { "open": "Vale.Math.Poly2.Lemmas" }, { "open": "Vale.Math.Poly2.Bits" }, { "open": "Vale.Math.Poly2.Bits_s" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2_s" }, { "open": "Vale.Arch.Types" }, { "open": "Vale.Def.Types_s" }, { "open": "Vale.X64.CPU_Features_s" }, { "open": "Vale.X64.QuickCodes" }, { "open": "Vale.X64.QuickCode" }, { "open": "Vale.X64.InsAes" }, { "open": "Vale.X64.InsVector" }, { "open": "Vale.X64.InsMem" }, { "open": "Vale.X64.InsBasic" }, { "open": "Vale.X64.Decls" }, { "open": "Vale.X64.State" }, { "open": "Vale.X64.Machine_s" }, { "open": "Vale.Math.Poly2.Lemmas" }, { "open": "Vale.Math.Poly2.Bits" }, { "open": "Vale.Math.Poly2.Bits_s" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2_s" }, { "open": "Vale.Arch.Types" }, { "open": "Vale.Def.Types_s" }, { "open": "Vale.AES.X64" }, { "open": "Vale.AES.X64" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val va_wpProof_VLow64ToHigh : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VLow64ToHigh dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VLow64ToHigh dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))", "source_definition": "let va_wpProof_VLow64ToHigh dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VLow64ToHigh (va_code_VLow64ToHigh dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "source_range": { "start_line": 156, "start_col": 0, "end_line": 163, "end_col": 22 }, "interleaved": false, "definition": "fun dst src va_s0 _ ->\n let _ =\n Vale.AES.X64.PolyOps.va_lemma_VLow64ToHigh (Vale.AES.X64.PolyOps.va_code_VLow64ToHigh dst src)\n va_s0\n dst\n src\n in\n (let FStar.Pervasives.Native.Mktuple2 #_ #_ va_sM va_f0 = _ in\n Vale.X64.Decls.va_lemma_upd_update va_sM;\n assert (Vale.X64.Decls.va_state_eq va_sM\n (Vale.X64.Decls.va_update_flags va_sM\n (Vale.X64.Decls.va_update_ok va_sM\n (Vale.X64.Decls.va_update_operand_xmm dst va_sM va_s0))));\n Vale.X64.QuickCode.va_lemma_norm_mods [\n Vale.X64.QuickCode.va_Mod_flags;\n Vale.X64.QuickCode.va_mod_xmm dst\n ]\n va_sM\n va_s0;\n [@@ FStar.Pervasives.inline_let ]let va_g = () in\n va_sM, va_f0, va_g)\n <:\n (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit", "effect": "Prims.Ghost", "effect_flags": [], "mutual_with": [], "premises": [ "Vale.X64.Decls.va_operand_xmm", "Vale.X64.Decls.va_state", "Prims.unit", "Vale.X64.Decls.va_fuel", "FStar.Pervasives.Native.Mktuple3", "Vale.X64.QuickCode.va_lemma_norm_mods", "Prims.Cons", "Vale.X64.QuickCode.mod_t", "Vale.X64.QuickCode.va_Mod_flags", "Vale.X64.QuickCode.va_mod_xmm", "Prims.Nil", "Prims._assert", "Vale.X64.Decls.va_state_eq", "Vale.X64.Decls.va_update_flags", "Vale.X64.Decls.va_update_ok", "Vale.X64.Decls.va_update_operand_xmm", "Vale.X64.Decls.va_lemma_upd_update", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.tuple2", "Vale.X64.State.vale_state", "Vale.AES.X64.PolyOps.va_lemma_VLow64ToHigh", "Vale.AES.X64.PolyOps.va_code_VLow64ToHigh" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n dst: Vale.X64.Decls.va_operand_xmm ->\n src: Vale.X64.Decls.va_operand_xmm ->\n va_s0: Vale.X64.Decls.va_state ->\n va_k: (_: Vale.X64.Decls.va_state -> _: Prims.unit -> Type0)\n -> Prims.Ghost ((Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel) * Prims.unit)", "prompt": "let va_wpProof_VLow64ToHigh dst src va_s0 va_k =\n ", "expected_response": "let va_sM, va_f0 = va_lemma_VLow64ToHigh (va_code_VLow64ToHigh dst src) va_s0 dst src in\nva_lemma_upd_update va_sM;\nassert (va_state_eq va_sM\n (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))));\nva_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\nlet va_g = () in\n(va_sM, va_f0, va_g)", "source": { "project_name": "hacl-star", "file_name": "obj/Vale.AES.X64.PolyOps.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.AES.X64.PolyOps.fst", "checked_file": "dataset/Vale.AES.X64.PolyOps.fst.checked", "interface_file": true, "dependencies": [ "dataset/Vale.X64.State.fsti.checked", "dataset/Vale.X64.QuickCodes.fsti.checked", "dataset/Vale.X64.QuickCode.fst.checked", "dataset/Vale.X64.Machine_s.fst.checked", "dataset/Vale.X64.InsVector.fsti.checked", "dataset/Vale.X64.InsMem.fsti.checked", "dataset/Vale.X64.InsBasic.fsti.checked", "dataset/Vale.X64.InsAes.fsti.checked", "dataset/Vale.X64.Decls.fsti.checked", "dataset/Vale.X64.CPU_Features_s.fst.checked", "dataset/Vale.Math.Poly2_s.fsti.checked", "dataset/Vale.Math.Poly2.Words.fsti.checked", "dataset/Vale.Math.Poly2.Lemmas.fsti.checked", "dataset/Vale.Math.Poly2.Bits_s.fsti.checked", "dataset/Vale.Math.Poly2.Bits.fsti.checked", "dataset/Vale.Math.Poly2.fsti.checked", "dataset/Vale.Def.Types_s.fst.checked", "dataset/Vale.Arch.Types.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "val va_code_VPolyAdd : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_opr128 -> Tot\n va_code", "let va_code_VPolyAdd dst src1 src2 =\n (va_Block (va_CCons (va_code_VPxor dst src1 src2) (va_CNil ())))", "val va_codegen_success_VPolyAdd : dst:va_operand_xmm -> src1:va_operand_xmm ->\n src2:va_operand_opr128 -> Tot va_pbool", "let va_codegen_success_VPolyAdd dst src1 src2 =\n (va_pbool_and (va_codegen_success_VPxor dst src1 src2) (va_ttrue ()))", "val va_lemma_VPolyAdd : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm ->\n src1:va_operand_xmm -> src2:va_operand_opr128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_VPolyAdd dst src1 src2) va_s0 /\\ va_is_dst_xmm dst\n va_s0 /\\ va_is_src_xmm src1 va_s0 /\\ va_is_src_opr128 src2 va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src1) in let\n (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128 va_s0 src2) in\n avx_enabled)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src1) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128 va_s0 src2)\n in Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.add a1 a2) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM\n va_s0)))))", "let va_lemma_VPolyAdd va_b0 va_s0 dst src1 src2 =\n va_reveal_opaque (`%va_code_VPolyAdd) (va_code_VPolyAdd dst src1 src2);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src1) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128 va_s0 src2) in\n Vale.Math.Poly2.Words.lemma_add_quad32 (va_eval_xmm va_s0 src1) (va_eval_opr128 va_s0 src2);\n let (va_s5, va_fc5) = va_lemma_VPxor (va_hd va_b1) va_s0 dst src1 src2 in\n let va_b5 = va_tl va_b1 in\n let (va_sM, va_f5) = va_lemma_empty_total va_s5 va_b5 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc5 va_s5 va_f5 va_sM in\n (va_sM, va_fM)", "let va_wp_VPolyAdd (dst:va_operand_xmm) (src1:va_operand_xmm) (src2:va_operand_opr128)\n (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_is_dst_xmm dst va_s0 /\\ va_is_src_xmm src1 va_s0 /\\ va_is_src_opr128 src2 va_s0 /\\ va_get_ok\n va_s0 /\\ (let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0\n src1) in let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128\n va_s0 src2) in avx_enabled) /\\ (forall (va_x_dst:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) .\n let va_sM = va_upd_flags va_x_efl (va_upd_operand_xmm dst va_x_dst va_s0) in va_get_ok va_sM /\\\n (let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src1) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128 va_s0 src2)\n in Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.add a1 a2) ==>\n va_k va_sM (())))", "let va_wpProof_VPolyAdd dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPolyAdd (va_code_VPolyAdd dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPolyAdd : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_opr128 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPolyAdd dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPolyAdd dst src1 src2)\n ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))", "let va_code_PolyAnd dst src =\n (va_Block (va_CCons (va_code_Pand dst (va_coerce_xmm_to_opr128 src)) (va_CNil ())))", "let va_quick_VPolyAdd (dst:va_operand_xmm) (src1:va_operand_xmm) (src2:va_operand_opr128) :\n (va_quickCode unit (va_code_VPolyAdd dst src1 src2)) =\n (va_QProc (va_code_VPolyAdd dst src1 src2) ([va_Mod_flags; va_mod_xmm dst]) (va_wp_VPolyAdd dst\n src1 src2) (va_wpProof_VPolyAdd dst src1 src2))", "let va_codegen_success_PolyAnd dst src =\n (va_pbool_and (va_codegen_success_Pand dst (va_coerce_xmm_to_opr128 src)) (va_ttrue ()))", "let va_lemma_PolyAnd va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_PolyAnd) (va_code_PolyAnd dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Words.lemma_and_quad32 (va_eval_xmm va_s0 dst) (va_eval_xmm va_s0 src);\n let (va_s5, va_fc5) = va_lemma_Pand (va_hd va_b1) va_s0 dst (va_coerce_xmm_to_opr128 src) in\n let va_b5 = va_tl va_b1 in\n let (va_sM, va_f5) = va_lemma_empty_total va_s5 va_b5 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc5 va_s5 va_f5 va_sM in\n (va_sM, va_fM)", "val va_code_PolyAnd : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_code", "val va_codegen_success_PolyAnd : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_pbool", "val va_lemma_PolyAnd : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> src:va_operand_xmm\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_PolyAnd dst src) va_s0 /\\ va_is_dst_xmm dst va_s0 /\\\n va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let (a1:Vale.Math.Poly2_s.poly) =\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in let (a2:Vale.Math.Poly2_s.poly) =\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in sse_enabled)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2.poly_and a1 a2) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM\n va_s0)))))", "let va_wpProof_PolyAnd dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PolyAnd (va_code_PolyAnd dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "let va_wp_PolyAnd (dst:va_operand_xmm) (src:va_operand_xmm) (va_s0:va_state) (va_k:(va_state ->\n unit -> Type0)) : Type0 =\n (va_is_dst_xmm dst va_s0 /\\ va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in let\n (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n sse_enabled) /\\ (forall (va_x_dst:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) . let va_sM =\n va_upd_flags va_x_efl (va_upd_operand_xmm dst va_x_dst va_s0) in va_get_ok va_sM /\\ (let\n (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in let\n (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2.poly_and a1 a2) ==>\n va_k va_sM (())))", "let va_code_VHigh64ToLow dst src =\n (va_Block (va_CCons (va_code_Vpsrldq8 dst src) (va_CNil ())))", "val va_wpProof_PolyAnd : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_PolyAnd dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_PolyAnd dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))", "let va_codegen_success_VHigh64ToLow dst src =\n (va_pbool_and (va_codegen_success_Vpsrldq8 dst src) (va_ttrue ()))", "let va_lemma_VHigh64ToLow va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_VHigh64ToLow) (va_code_VHigh64ToLow dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n let (va_s3, va_fc3) = va_lemma_Vpsrldq8 (va_hd va_b1) va_s0 dst src in\n let va_b3 = va_tl va_b1 in\n Vale.Math.Poly2.Words.lemma_quad32_double_shift a;\n Vale.Math.Poly2.Lemmas.lemma_shift_is_div a 64;\n Vale.Math.Poly2.Bits.lemma_of_to_quad32 (Vale.Math.Poly2_s.shift a (-64));\n let (va_sM, va_f3) = va_lemma_empty_total va_s3 va_b3 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in\n (va_sM, va_fM)", "let va_quick_PolyAnd (dst:va_operand_xmm) (src:va_operand_xmm) : (va_quickCode unit\n (va_code_PolyAnd dst src)) =\n (va_QProc (va_code_PolyAnd dst src) ([va_Mod_flags; va_mod_xmm dst]) (va_wp_PolyAnd dst src)\n (va_wpProof_PolyAnd dst src))", "val va_code_VHigh64ToLow : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_code", "val va_codegen_success_VHigh64ToLow : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_pbool", "val va_lemma_VHigh64ToLow : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm ->\n src:va_operand_xmm\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_VHigh64ToLow dst src) va_s0 /\\ va_is_dst_xmm dst va_s0\n /\\ va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let (a:Vale.Math.Poly2_s.poly) =\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in avx_enabled)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.shift a (-64)) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM\n va_s0)))))", "let va_wpProof_VHigh64ToLow dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VHigh64ToLow (va_code_VHigh64ToLow dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "let va_wp_VHigh64ToLow (dst:va_operand_xmm) (src:va_operand_xmm) (va_s0:va_state) (va_k:(va_state\n -> unit -> Type0)) : Type0 =\n (va_is_dst_xmm dst va_s0 /\\ va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n avx_enabled) /\\ (forall (va_x_dst:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) . let va_sM =\n va_upd_flags va_x_efl (va_upd_operand_xmm dst va_x_dst va_s0) in va_get_ok va_sM /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.shift a (-64))\n ==> va_k va_sM (())))", "let va_code_VLow64ToHigh dst src =\n (va_Block (va_CCons (va_code_Vpslldq8 dst src) (va_CNil ())))", "let va_codegen_success_VLow64ToHigh dst src =\n (va_pbool_and (va_codegen_success_Vpslldq8 dst src) (va_ttrue ()))", "val va_wpProof_VHigh64ToLow : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VHigh64ToLow dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VHigh64ToLow dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))", "let va_lemma_VLow64ToHigh va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_VLow64ToHigh) (va_code_VLow64ToHigh dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n let (va_s3, va_fc3) = va_lemma_Vpslldq8 (va_hd va_b1) va_s0 dst src in\n let va_b3 = va_tl va_b1 in\n Vale.Math.Poly2.Words.lemma_quad32_double_shift a;\n Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a 64;\n Vale.Math.Poly2.lemma_shift_is_mul (Vale.Math.Poly2.mask a 64) 64;\n Vale.Math.Poly2.Bits.lemma_of_to_quad32 (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a 64) 64);\n let (va_sM, va_f3) = va_lemma_empty_total va_s3 va_b3 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in\n (va_sM, va_fM)", "let va_quick_VHigh64ToLow (dst:va_operand_xmm) (src:va_operand_xmm) : (va_quickCode unit\n (va_code_VHigh64ToLow dst src)) =\n (va_QProc (va_code_VHigh64ToLow dst src) ([va_Mod_flags; va_mod_xmm dst]) (va_wp_VHigh64ToLow dst\n src) (va_wpProof_VHigh64ToLow dst src))", "val va_code_VLow64ToHigh : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_code", "val va_codegen_success_VLow64ToHigh : dst:va_operand_xmm -> src:va_operand_xmm -> Tot va_pbool" ], "closest": [ "val va_wpProof_Low64ToHigh : dst:va_operand_xmm -> a:poly -> va_s0:va_state -> va_k:(va_state ->\n unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Low64ToHigh dst a va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Low64ToHigh dst) ([va_Mod_reg64 rR12;\n va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Low64ToHigh dst a va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst) va_s0 dst a in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rR12 va_sM (va_update_flags va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_reg64 rR12; va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_High64ToLow : dst:va_operand_xmm -> a:poly -> va_s0:va_state -> va_k:(va_state ->\n unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_High64ToLow dst a va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_High64ToLow dst) ([va_Mod_reg64 rR12;\n va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_High64ToLow dst a va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst) va_s0 dst a in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rR12 va_sM (va_update_flags va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_reg64 rR12; va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Low64ToHigh : dst:va_operand_vec_opr -> src:va_operand_vec_opr -> a:poly ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Low64ToHigh dst src a va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Low64ToHigh dst src) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Low64ToHigh dst src a va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Low64ToHigh (va_code_Low64ToHigh dst src) va_s0 dst src a in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vpslldq8 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vpslldq8 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vpslldq8 dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vpslldq8 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vpslldq8 (va_code_Vpslldq8 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPslldq4 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPslldq4 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPslldq4 dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPslldq4 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPslldq4 (va_code_VPslldq4 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_MulLow64 : dst:va_operand_reg_opr -> src1:va_operand_reg_opr ->\n src2:va_operand_reg_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_MulLow64 dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulLow64 dst src1 src2)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_MulLow64 dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_MulLow64 (va_code_MulLow64 dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_High64ToLow : dst:va_operand_vec_opr -> src:va_operand_vec_opr -> a:poly ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_High64ToLow dst src a va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_High64ToLow dst src) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_High64ToLow dst src a va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_High64ToLow (va_code_High64ToLow dst src) va_s0 dst src a in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_And64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_And64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_And64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_And64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_And64 (va_code_And64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vpsrldq8 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vpsrldq8 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vpsrldq8 dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vpsrldq8 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vpsrldq8 (va_code_Vpsrldq8 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Xor64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Xor64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xor64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Xor64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Xor64 (va_code_Xor64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pshufb64 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pshufb64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pshufb64 dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pshufb64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pshufb64 (va_code_Pshufb64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Load_0xc2_msb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Load_0xc2_msb dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_0xc2_msb dst) ([va_Mod_flags;\n va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Load_0xc2_msb dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Load_0xc2_msb (va_code_Load_0xc2_msb dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sbb64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sbb64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sbb64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sbb64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sbb64 (va_code_Sbb64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Adcx_64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adcx_64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx_64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adcx_64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adcx_64 (va_code_Adcx_64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Cmovc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Cmovc64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cmovc64 dst src) ([va_mod_dst_opr64\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Cmovc64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Cmovc64 (va_code_Cmovc64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sr64 : dst:va_operand_reg_opr -> src1:va_operand_reg_opr -> src2:va_operand_reg_opr\n -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sr64 dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sr64 dst src1 src2) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sr64 dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sr64 (va_code_Sr64 dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Add64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Add64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Add64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Add64 (va_code_Add64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sl64 : dst:va_operand_reg_opr -> src1:va_operand_reg_opr -> src2:va_operand_reg_opr\n -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sl64 dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sl64 dst src1 src2) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sl64 dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sl64 (va_code_Sl64 dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_MulLow64Wrap : dst:va_operand_reg_opr -> src1:va_operand_reg_opr ->\n src2:va_operand_reg_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_MulLow64Wrap dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulLow64Wrap dst src1 src2)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_MulLow64Wrap dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_MulLow64Wrap (va_code_MulLow64Wrap dst src1 src2) va_s0 dst src1\n src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_MulHigh64U : dst:va_operand_reg_opr -> src1:va_operand_reg_opr ->\n src2:va_operand_reg_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_MulHigh64U dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_MulHigh64U dst src1 src2)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_MulHigh64U dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_MulHigh64U (va_code_MulHigh64U dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Adox_64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adox_64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox_64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adox_64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adox_64 (va_code_Adox_64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mov64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mov64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mov64 (va_code_Mov64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Adc64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adc64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adc64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adc64 (va_code_Adc64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sr64Imm : dst:va_operand_reg_opr -> src1:va_operand_reg_opr -> src2:bits64 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sr64Imm dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sr64Imm dst src1 src2)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sr64Imm dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sr64Imm (va_code_Sr64Imm dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sub64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sub64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sub64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sub64 (va_code_Sub64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Shl64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Shl64 dst amt va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shl64 dst amt) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Shl64 dst amt va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Shl64 (va_code_Shl64 dst amt) va_s0 dst amt in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Shr64 : dst:va_operand_dst_opr64 -> amt:va_operand_shift_amt64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Shr64 dst amt va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Shr64 dst amt) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Shr64 dst amt va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Shr64 (va_code_Shr64 dst amt) va_s0 dst amt in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_LoadImm64 : dst:va_operand_reg_opr -> src:simm16 -> va_s0:va_state -> va_k:(va_state\n -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_LoadImm64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LoadImm64 dst src) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_LoadImm64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_LoadImm64 (va_code_LoadImm64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mulx64 : dst_hi:va_operand_dst_opr64 -> dst_lo:va_operand_dst_opr64 ->\n src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mulx64 dst_hi dst_lo src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mulx64 dst_hi dst_lo src)\n ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mulx64 dst_hi dst_lo src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mulx64 (va_code_Mulx64 dst_hi dst_lo src) va_s0 dst_hi dst_lo src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst_lo va_sM\n (va_update_operand_dst_opr64 dst_hi va_sM va_s0))));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst_lo; va_mod_dst_opr64 dst_hi]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sl64Imm : dst:va_operand_reg_opr -> src1:va_operand_reg_opr -> src2:bits64 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sl64Imm dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sl64Imm dst src1 src2)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sl64Imm dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sl64Imm (va_code_Sl64Imm dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mov128 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mov128 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov128 dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mov128 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mov128 (va_code_Mov128 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Psrldq : dst:va_operand_xmm -> amt:int -> va_s0:va_state -> va_k:(va_state -> unit\n -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Psrldq dst amt va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Psrldq dst amt) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Psrldq dst amt va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Psrldq (va_code_Psrldq dst amt) va_s0 dst amt in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_ZeroXmm : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_ZeroXmm dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_ZeroXmm dst) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_ZeroXmm dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_ZeroXmm (va_code_ZeroXmm dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_IMul64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_IMul64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_IMul64 dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_IMul64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_IMul64 (va_code_IMul64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Load_two_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Load_two_lsb dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_two_lsb dst) ([va_Mod_flags;\n va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Load_two_lsb dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Load_two_lsb (va_code_Load_two_lsb dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pclmulqdq : dst:va_operand_xmm -> src:va_operand_xmm -> dstHi:bool -> srcHi:bool ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pclmulqdq dst src dstHi srcHi va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pclmulqdq dst src dstHi srcHi)\n ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pclmulqdq dst src dstHi srcHi va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pclmulqdq (va_code_Pclmulqdq dst src dstHi srcHi) va_s0 dst src\n dstHi srcHi in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPclmulqdq : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_xmm ->\n src1Hi:bool -> src2Hi:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPclmulqdq dst src1 src2 src1Hi src2Hi va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPclmulqdq dst src1 src2 src1Hi\n src2Hi) ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPclmulqdq dst src1 src2 src1Hi src2Hi va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPclmulqdq (va_code_VPclmulqdq dst src1 src2 src1Hi src2Hi) va_s0\n dst src1 src2 src1Hi src2Hi in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pshufb : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pshufb dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pshufb dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pshufb dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pshufb (va_code_Pshufb dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AddLea64 : dst:va_operand_dst_opr64 -> src1:va_operand_opr64 ->\n src2:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AddLea64 dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLea64 dst src1 src2)\n ([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AddLea64 dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AddLea64 (va_code_AddLea64 dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPaddd : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_xmm ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPaddd dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPaddd dst src1 src2) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPaddd dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPaddd (va_code_VPaddd dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Add64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Add64Wrap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Add64Wrap dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Add64Wrap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Add64Wrap (va_code_Add64Wrap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Load_one_lsb : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Load_one_lsb dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_one_lsb dst) ([va_Mod_flags;\n va_Mod_reg64 rR11; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Load_one_lsb dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Load_one_lsb (va_code_Load_one_lsb dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPxor : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_opr128 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPxor dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPxor dst src1 src2) ([va_mod_xmm\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPxor dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPxor (va_code_VPxor dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Adcx64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adcx64Wrap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adcx64Wrap dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adcx64Wrap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adcx64Wrap (va_code_Adcx64Wrap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_LoadImmShl64 : dst:va_operand_reg_opr -> src:simm16 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_LoadImmShl64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_LoadImmShl64 dst src) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_LoadImmShl64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_LoadImmShl64 (va_code_LoadImmShl64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Inc32 : dst:va_operand_xmm -> one:va_operand_xmm -> va_s0:va_state -> va_k:(va_state\n -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Inc32 dst one va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Inc32 dst one) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Inc32 dst one va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Inc32 (va_code_Inc32 dst one) va_s0 dst one in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Palignr8 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Palignr8 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Palignr8 dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Palignr8 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Palignr8 (va_code_Palignr8 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wp_VLow64ToHigh\n (dst src: va_operand_xmm)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_VLow64ToHigh (dst:va_operand_xmm) (src:va_operand_xmm) (va_s0:va_state) (va_k:(va_state\n -> unit -> Type0)) : Type0 =\n (va_is_dst_xmm dst va_s0 /\\ va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n avx_enabled) /\\ (forall (va_x_dst:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) . let va_sM =\n va_upd_flags va_x_efl (va_upd_operand_xmm dst va_x_dst va_s0) in va_get_ok va_sM /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.shift\n (Vale.Math.Poly2.mask a 64) 64) ==> va_k va_sM (())))", "val va_wpProof_Adox64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adox64Wrap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adox64Wrap dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adox64Wrap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adox64Wrap (va_code_Adox64Wrap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pslld : dst:va_operand_xmm -> amt:int -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pslld dst amt va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pslld dst amt) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pslld dst amt va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pslld (va_code_Pslld dst amt) va_s0 dst amt in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wp_VHigh64ToLow\n (dst src: va_operand_xmm)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_VHigh64ToLow (dst:va_operand_xmm) (src:va_operand_xmm) (va_s0:va_state) (va_k:(va_state\n -> unit -> Type0)) : Type0 =\n (va_is_dst_xmm dst va_s0 /\\ va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n avx_enabled) /\\ (forall (va_x_dst:va_value_xmm) (va_x_efl:Vale.X64.Flags.t) . let va_sM =\n va_upd_flags va_x_efl (va_upd_operand_xmm dst va_x_dst va_s0) in va_get_ok va_sM /\\ (let\n (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_sM dst) == Vale.Math.Poly2_s.shift a (-64))\n ==> va_k va_sM (())))", "val va_wpProof_Paddd : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state -> va_k:(va_state\n -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Paddd dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Paddd dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Paddd dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Paddd (va_code_Paddd dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pxor : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state -> va_k:(va_state\n -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pxor dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pxor dst src) ([va_mod_xmm dst]) va_s0\n va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pxor dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pxor (va_code_Pxor dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sub64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sub64Wrap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sub64Wrap dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sub64Wrap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sub64Wrap (va_code_Sub64Wrap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_PshufbDup : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_PshufbDup dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_PshufbDup dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_PshufbDup dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PshufbDup (va_code_PshufbDup dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mul64Wrap : src:va_operand_opr64 -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mul64Wrap src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mul64Wrap src) ([va_Mod_reg64 rRdx;\n va_Mod_reg64 rRax; va_Mod_flags]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mul64Wrap src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mul64Wrap (va_code_Mul64Wrap src) va_s0 src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM\n (va_update_flags va_sM (va_update_ok va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax; va_Mod_flags]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPalignr8 : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_xmm ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPalignr8 dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPalignr8 dst src1 src2)\n ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPalignr8 dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPalignr8 (va_code_VPalignr8 dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Nat64Equal : dst:va_operand_reg_opr64 -> src:va_operand_reg_opr64 -> va_s0:va_state\n -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Nat64Equal dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Nat64Equal dst src) ([va_Mod_flags;\n va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Nat64Equal dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Nat64Equal (va_code_Nat64Equal dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_reg_opr64\n src va_sM (va_update_operand_reg_opr64 dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_reg_opr64 src; va_mod_reg_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Palignr4 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Palignr4 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Palignr4 dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Palignr4 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Palignr4 (va_code_Palignr4 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Adc64Wrap : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Adc64Wrap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Adc64Wrap dst src) ([va_Mod_flags;\n va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Adc64Wrap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Adc64Wrap (va_code_Adc64Wrap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_dst_opr64\n dst va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pcmpeqd : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pcmpeqd dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pcmpeqd dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pcmpeqd dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pcmpeqd (va_code_Pcmpeqd dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Gf128ModulusRev : dst:va_operand_xmm -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Gf128ModulusRev dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Gf128ModulusRev dst) ([va_Mod_reg64\n rR12; va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Gf128ModulusRev dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Gf128ModulusRev (va_code_Gf128ModulusRev dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rR12 va_sM (va_update_flags va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_reg64 rR12; va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Load64_stack : dst:va_operand_dst_opr64 -> src:va_operand_reg_opr64 -> offset:int ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Load64_stack dst src offset va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load64_stack dst src offset)\n ([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Load64_stack dst src offset va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Load64_stack (va_code_Load64_stack dst src offset) va_s0 dst src\n offset in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_PshufbStable : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_PshufbStable dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_PshufbStable dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_PshufbStable dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PshufbStable (va_code_PshufbStable dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Psrld : dst:va_operand_xmm -> amt:int -> va_s0:va_state -> va_k:(va_state -> unit ->\n Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Psrld dst amt va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Psrld dst amt) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Psrld dst amt va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Psrld (va_code_Psrld dst amt) va_s0 dst amt in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pand : dst:va_operand_xmm -> src:va_operand_opr128 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pand dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pand dst src) ([va_mod_xmm dst]) va_s0\n va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pand dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pand (va_code_Pand dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mfvsrd : dst:va_operand_reg_opr -> src:va_operand_vec_opr -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mfvsrd dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mfvsrd dst src) ([va_mod_reg_opr dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mfvsrd dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mfvsrd (va_code_Mfvsrd dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Mfvsrld : dst:va_operand_reg_opr -> src:va_operand_vec_opr -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mfvsrld dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mfvsrld dst src) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mfvsrld dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mfvsrld (va_code_Mfvsrld dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vmr : dst:va_operand_vec_opr -> src:va_operand_vec_opr -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vmr dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vmr dst src) ([va_mod_vec_opr dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vmr dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vmr (va_code_Vmr dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_PushXmm : src:va_operand_xmm -> tmp:va_operand_reg_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_PushXmm src tmp va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_PushXmm src tmp) ([va_Mod_stackTaint;\n va_Mod_stack; va_Mod_reg64 rRsp; va_mod_reg_opr64 tmp]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_PushXmm src tmp va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PushXmm (va_code_PushXmm src tmp) va_s0 src tmp in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_reg64\n rRsp va_sM (va_update_ok va_sM (va_update_operand_reg_opr64 tmp va_sM va_s0))))));\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_reg64 rRsp; va_mod_reg_opr64 tmp])\n va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPshufb : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_xmm ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPshufb dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPshufb dst src1 src2) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPshufb dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPshufb (va_code_VPshufb dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vmrghw : dst:va_operand_vec_opr -> src1:va_operand_vec_opr ->\n src2:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vmrghw dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vmrghw dst src1 src2) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vmrghw dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vmrghw (va_code_Vmrghw dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pinsrq : dst:va_operand_xmm -> src:va_operand_opr64 -> index:nat8 -> va_s0:va_state\n -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pinsrq dst src index va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pinsrq dst src index) ([va_mod_xmm\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pinsrq dst src index va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pinsrq (va_code_Pinsrq dst src index) va_s0 dst src index in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VSwap : dst:va_operand_vec_opr -> src:va_operand_vec_opr -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VSwap dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VSwap dst src) ([va_mod_vec_opr dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VSwap dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VSwap (va_code_VSwap dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Xxmrghd : dst:va_operand_vec_opr -> src1:va_operand_vec_opr ->\n src2:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Xxmrghd dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xxmrghd dst src1 src2)\n ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Xxmrghd dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Xxmrghd (va_code_Xxmrghd dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vslw : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr\n -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vslw dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vslw dst src1 src2) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vslw dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vslw (va_code_Vslw dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_PopXmm : dst:va_operand_xmm -> tmp:va_operand_reg_opr64 -> expected_xmm:quad32 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_PopXmm dst tmp expected_xmm va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_PopXmm dst tmp) ([va_Mod_stack;\n va_Mod_reg64 rRsp; va_mod_reg_opr64 tmp; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_PopXmm dst tmp expected_xmm va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PopXmm (va_code_PopXmm dst tmp) va_s0 dst tmp expected_xmm in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg64 rRsp va_sM (va_update_ok va_sM\n (va_update_operand_reg_opr64 tmp va_sM (va_update_operand_xmm dst va_sM va_s0))))));\n va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg64 rRsp; va_mod_reg_opr64 tmp; va_mod_xmm dst])\n va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pextrq : dst:va_operand_dst_opr64 -> src:va_operand_xmm -> index:nat8 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pextrq dst src index va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pextrq dst src index)\n ([va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pextrq dst src index va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pextrq (va_code_Pextrq dst src index) va_s0 dst src index in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VPolyMulLow : dst:va_operand_vec_opr -> src1:va_operand_vec_opr ->\n src2:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VPolyMulLow dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VPolyMulLow dst src1 src2)\n ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VPolyMulLow dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPolyMulLow (va_code_VPolyMulLow dst src1 src2) va_s0 dst src1 src2\n in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vadduwm : dst:va_operand_vec_opr -> src1:va_operand_vec_opr ->\n src2:va_operand_vec_opr -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vadduwm dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vadduwm dst src1 src2)\n ([va_mod_vec_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vadduwm dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vadduwm (va_code_Vadduwm dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Xgetbv_Avx512 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Xgetbv_Avx512 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Xgetbv_Avx512 (va_code_Xgetbv_Avx512 ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AESNI_enc : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AESNI_enc dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AESNI_enc dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AESNI_enc dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AESNI_enc (va_code_AESNI_enc dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_InitPshufbMask : dst:va_operand_xmm -> tmp:va_operand_reg_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_InitPshufbMask dst tmp va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InitPshufbMask dst tmp)\n ([va_Mod_flags; va_mod_reg_opr64 tmp; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_InitPshufbMask dst tmp va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_InitPshufbMask (va_code_InitPshufbMask dst tmp) va_s0 dst tmp in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_reg_opr64\n tmp va_sM (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_reg_opr64 tmp; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pop : dst:va_operand_dst_opr64 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pop dst va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pop dst) ([va_Mod_stack; va_Mod_reg64\n rRsp; va_mod_dst_opr64 dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pop dst va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pop (va_code_Pop dst) va_s0 dst in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stack va_sM (va_update_reg64 rRsp va_sM (va_update_ok va_sM\n (va_update_operand_dst_opr64 dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_stack; va_Mod_reg64 rRsp; va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_InnerMemcpy : dst:buffer64 -> src:buffer64 -> va_s0:va_state -> va_k:(va_state ->\n unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_InnerMemcpy dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InnerMemcpy ()) ([va_Mod_mem_heaplet\n 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,\n va_f0, va_g))))\nlet va_wpProof_InnerMemcpy dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_InnerMemcpy (va_code_InnerMemcpy ()) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))));\n va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_reg64 rR9; va_Mod_reg64 rRcx; va_Mod_reg64\n rRax; va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Load_stack64 : dst:va_operand_reg_opr -> offset:int -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Load_stack64 dst offset va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Load_stack64 dst offset)\n ([va_mod_reg_opr dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Load_stack64 dst offset va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Load_stack64 (va_code_Load_stack64 dst offset) va_s0 dst offset in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AESNI_dec : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AESNI_dec dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AESNI_dec dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AESNI_dec dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AESNI_dec (va_code_AESNI_dec dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_InitPshufb64Mask : dst:va_operand_xmm -> tmp:va_operand_reg_opr64 -> va_s0:va_state\n -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_InitPshufb64Mask dst tmp va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_InitPshufb64Mask dst tmp)\n ([va_Mod_flags; va_mod_reg_opr64 tmp; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_InitPshufb64Mask dst tmp va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_InitPshufb64Mask (va_code_InitPshufb64Mask dst tmp) va_s0 dst tmp in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_reg_opr64\n tmp va_sM (va_update_operand_xmm dst va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_reg_opr64 tmp; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Move : dst:va_operand_reg_opr -> src:va_operand_reg_opr -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Move dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Move dst src) ([va_mod_reg_opr dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Move dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Move (va_code_Move dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AddLa : dst:va_operand_reg_opr -> src1:va_operand_reg_opr -> src2:simm16 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AddLa dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AddLa dst src1 src2) ([va_mod_reg_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AddLa dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AddLa (va_code_AddLa dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_reg_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_reg_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vsrw : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr\n -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vsrw dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vsrw dst src1 src2) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vsrw dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vsrw (va_code_Vsrw dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pinsrd : dst:va_operand_xmm -> src:va_operand_opr64 -> index:nat8 -> va_s0:va_state\n -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pinsrd dst src index va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pinsrd dst src index) ([va_mod_xmm\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pinsrd dst src index va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pinsrd (va_code_Pinsrd dst src index) va_s0 dst src index in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vsl : dst:va_operand_vec_opr -> src1:va_operand_vec_opr -> src2:va_operand_vec_opr\n -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vsl dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vsl dst src1 src2) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vsl dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vsl (va_code_Vsl dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Pshufd : dst:va_operand_xmm -> src:va_operand_xmm -> permutation:nat8 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Pshufd dst src permutation va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Pshufd dst src permutation)\n ([va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Pshufd dst src permutation va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Pshufd (va_code_Pshufd dst src permutation) va_s0 dst src\n permutation in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Store_stack64 : src:va_operand_reg_opr -> offset:int -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Store_stack64 src offset va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Store_stack64 src offset)\n ([va_Mod_stackTaint; va_Mod_stack]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Store_stack64 src offset va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Store_stack64 (va_code_Store_stack64 src offset) va_s0 src offset in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_ok va_sM\n va_s0))));\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Vspltisw : dst:va_operand_vec_opr -> src:sim -> va_s0:va_state -> va_k:(va_state ->\n unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Vspltisw dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Vspltisw dst src) ([va_mod_vec_opr\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Vspltisw dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Vspltisw (va_code_Vspltisw dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_vec_opr dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_vec_opr dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AESNI_enc_last : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AESNI_enc_last dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AESNI_enc_last dst src)\n ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AESNI_enc_last dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AESNI_enc_last (va_code_AESNI_enc_last dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_VAESNI_enc : dst:va_operand_xmm -> src1:va_operand_xmm -> src2:va_operand_xmm ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VAESNI_enc dst src1 src2 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VAESNI_enc dst src1 src2)\n ([va_Mod_flags; va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_VAESNI_enc dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VAESNI_enc (va_code_VAESNI_enc dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_AESNI_imc : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_AESNI_imc dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_AESNI_imc dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_AESNI_imc dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_AESNI_imc (va_code_AESNI_imc dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Vpsrldq8 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> src:va_operand_xmm\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Vpsrldq8 dst src) va_s0 /\\ va_is_dst_xmm dst va_s0 /\\\n va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ avx_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_eval_xmm va_sM dst == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32\n (Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_xmm va_s0 src))\n (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_xmm va_s0 src)) 0 0 /\\ va_state_eq va_sM\n (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0))))\nlet va_lemma_Vpsrldq8 va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Vpsrldq8) (va_code_Vpsrldq8 dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_VPsrldq 8) (OReg dst) (OReg src))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_VPsrldq 8) (OReg dst) (OReg src)))\n va_s0 in\n (va_sM, va_fM)" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GF128_Mul.fst", "name": "Vale.AES.X64.GF128_Mul.va_wpProof_Low64ToHigh" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GF128_Mul.fst", "name": "Vale.AES.X64.GF128_Mul.va_wpProof_High64ToLow" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GF128_Mul.fst", "name": "Vale.AES.PPC64LE.GF128_Mul.va_wpProof_Low64ToHigh" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Vpslldq8" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_VPslldq4" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_MulLow64" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GF128_Mul.fst", "name": "Vale.AES.PPC64LE.GF128_Mul.va_wpProof_High64ToLow" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_And64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Vpsrldq8" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Xor64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pshufb64" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_wpProof_Load_0xc2_msb" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Sbb64" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.X64.fst", "name": "Vale.Bignum.X64.va_wpProof_Adcx_64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Cmovc64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_Sr64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Add64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_Sl64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_MulLow64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_MulHigh64U" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.X64.fst", "name": "Vale.Bignum.X64.va_wpProof_Adox_64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Mov64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Adc64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_Sr64Imm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Sub64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Shl64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Shr64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_LoadImm64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Mulx64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_Sl64Imm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Mov128" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Psrldq" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_ZeroXmm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_IMul64" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_wpProof_Load_two_lsb" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_Pclmulqdq" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_VPclmulqdq" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pshufb" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_AddLea64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_VPaddd" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Add64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_wpProof_Load_one_lsb" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_VPxor" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Adcx64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_LoadImmShl64" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCTR.fst", "name": "Vale.AES.X64.GCTR.va_wpProof_Inc32" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Palignr8" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.PolyOps.fsti", "name": "Vale.AES.X64.PolyOps.va_wp_VLow64ToHigh" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Adox64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pslld" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.PolyOps.fsti", "name": "Vale.AES.X64.PolyOps.va_wp_VHigh64ToLow" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Paddd" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pxor" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Sub64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_PshufbDup" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Mul64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_VPalignr8" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Nat64Equal" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Palignr4" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Adc64Wrap" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pcmpeqd" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GF128_Mul.fst", "name": "Vale.AES.X64.GF128_Mul.va_wpProof_Gf128ModulusRev" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsStack.fst", "name": "Vale.X64.InsStack.va_wpProof_Load64_stack" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_PshufbStable" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Psrld" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pand" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Mfvsrd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Mfvsrld" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vmr" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsStack.fst", "name": "Vale.X64.InsStack.va_wpProof_PushXmm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_VPshufb" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vmrghw" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pinsrq" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.PolyOps.fst", "name": "Vale.AES.PPC64LE.PolyOps.va_wpProof_VSwap" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Xxmrghd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vslw" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsStack.fst", "name": "Vale.X64.InsStack.va_wpProof_PopXmm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pextrq" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.PolyOps.fst", "name": "Vale.AES.PPC64LE.PolyOps.va_wpProof_VPolyMulLow" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vadduwm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Xgetbv_Avx512" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_AESNI_enc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_InitPshufbMask" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsStack.fst", "name": "Vale.X64.InsStack.va_wpProof_Pop" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fst", "name": "Vale.Test.X64.Vale_memcpy.va_wpProof_InnerMemcpy" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsStack.fst", "name": "Vale.PPC64LE.InsStack.va_wpProof_Load_stack64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_AESNI_dec" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_InitPshufb64Mask" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_Move" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_wpProof_AddLa" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vsrw" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pinsrd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vsl" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Pshufd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsStack.fst", "name": "Vale.PPC64LE.InsStack.va_wpProof_Store_stack64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_wpProof_Vspltisw" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_AESNI_enc_last" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_VAESNI_enc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsAes.fst", "name": "Vale.X64.InsAes.va_wpProof_AESNI_imc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_lemma_Vpsrldq8" } ], "selected_premises": [ "Vale.X64.Decls.va_update_xmm", "Vale.X64.Decls.va_update_operand_xmm", "Vale.X64.Decls.va_update_flags", "Vale.X64.Decls.va_update_ok", "Vale.X64.Decls.va_update_reg64", "Vale.X64.Decls.va_state_eq", "Vale.X64.Decls.va_update_mem", "Vale.X64.Decls.va_update_stack", "Vale.AES.X64.PolyOps.va_lemma_VHigh64ToLow", "Vale.AES.X64.PolyOps.va_lemma_VLow64ToHigh", "Vale.X64.Decls.va_update_mem_layout", "Vale.AES.X64.PolyOps.va_lemma_PolyAnd", "Vale.AES.X64.PolyOps.va_lemma_VPolyAdd", "Vale.X64.Decls.va_update_mem_heaplet", "Vale.X64.Decls.update_register", "Vale.X64.Decls.va_update_operand_reg_opr64", "Vale.X64.Decls.va_update_stackTaint", "Vale.X64.Decls.va_update_operand_dst_opr64", "Vale.X64.Decls.va_update_operand_heaplet", "Vale.X64.Decls.update_dst_operand", "Vale.X64.QuickCode.va_Mod_stack", "Vale.X64.QuickCode.va_mods_t", "Vale.X64.Decls.va_update_operand_opr64", "Vale.X64.QuickCode.va_Mod_flags", "Vale.AES.X64.PolyOps.va_wpProof_VHigh64ToLow", "Vale.X64.QuickCode.va_Mod_stackTaint", "Vale.AES.X64.PolyOps.va_wpProof_VPolyAdd", "Vale.X64.QuickCode.va_mod_xmm", "Vale.X64.QuickCode.va_QProc", "Vale.AES.X64.PolyOps.va_wpProof_PolyAnd", "Vale.X64.QuickCode.va_Mod_mem", "Vale.X64.QuickCode.va_mod_heaplet", "Vale.X64.QuickCode.va_mod_reg_opr64", "Vale.X64.Decls.va_ensure_total", "Vale.X64.QuickCode.va_Mod_mem_layout", "Vale.X64.QuickCode.va_Mod_xmm", "Vale.X64.QuickCode.va_Mod_None", "Vale.X64.InsBasic.va_wp_Newline", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.QuickCode.va_Mod_ok", "Vale.X64.Decls.va_expand_state", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.X64.Decls.update_operand", "Vale.X64.InsBasic.va_wp_Space", "Vale.X64.Decls.va_reveal_opaque", "Vale.X64.InsBasic.va_wp_Xgetbv_Avx", "Vale.X64.QuickCode.va_mod_dst_opr64", "Vale.X64.InsAes.va_wp_VPclmulqdq", "Vale.X64.InsMem.va_wp_DestroyHeaplets", "Vale.X64.QuickCode.va_quickCode", "Vale.X64.InsVector.va_wp_InitPshufbStableMask", "Vale.X64.InsMem.va_wp_CreateHeaplets", "Vale.X64.Decls.va_get_flags", "Vale.X64.InsVector.va_wp_VShufpd", "Vale.X64.InsVector.va_wp_Shufpd", "Vale.X64.InsVector.va_wp_XmmEqual", "Vale.X64.InsVector.va_wp_Store128_buffer", "Vale.X64.InsVector.va_wp_Pshufd", "Vale.X64.QuickCodes.va_range1", "Vale.X64.InsVector.va_wp_InitPshufbMask", "Vale.X64.InsVector.va_wp_PinsrdImm", "Vale.X64.InsVector.va_wp_PinsrqImm", "Vale.X64.InsBasic.va_wp_Mul64Wrap", "Vale.X64.InsVector.va_wp_VPshufb", "Vale.X64.InsVector.va_wp_Pshufb", "Vale.X64.InsVector.va_wp_ZeroXmm", "Vale.X64.InsVector.va_wp_Pslld", "Vale.X64.InsAes.va_wp_Pclmulqdq", "Vale.X64.InsVector.va_wp_InitPshufbDupMask", "Vale.X64.Decls.va_tl", "Vale.X64.InsBasic.va_wp_Prefetchnta", "Vale.X64.InsAes.va_wp_AESNI_keygen_assist", "Vale.X64.InsVector.va_wp_PshufbStable", "Vale.X64.InsMem.va_wp_StoreBe64_buffer", "Vale.X64.QuickCodes.va_state_match", "Vale.X64.InsMem.va_wp_Store64_buffer", "Vale.X64.InsVector.va_wp_Psrld", "Vale.X64.InsVector.va_wp_Load128_buffer", "Vale.X64.InsVector.va_wp_Store64_buffer128", "Vale.X64.InsVector.va_wp_Pshufb64", "Vale.X64.InsVector.va_wp_PshufbDup", "Vale.X64.InsVector.va_wp_Mov128", "Vale.X64.InsVector.va_wp_Palignr8", "Vale.X64.InsAes.va_wp_VAESNI_enc", "Vale.X64.InsVector.va_wp_VPslldq4", "Vale.X64.InsVector.va_wp_Palignr4", "Vale.X64.InsVector.va_wp_InitPshufb64Mask", "Vale.X64.InsBasic.va_wp_NoNewline", "Vale.X64.InsAes.va_wp_AESNI_enc_last", "Vale.X64.InsVector.va_wp_Paddd", "Vale.X64.InsVector.va_wp_VPxor", "Vale.X64.InsVector.va_wp_VPaddd", "Vale.X64.InsBasic.va_wp_Xgetbv_Avx512", "Vale.X64.InsAes.va_wp_AESNI_enc", "Vale.X64.InsVector.va_wp_Pinsrq", "Vale.X64.InsVector.va_wp_Vpsrldq8", "Vale.X64.InsAes.va_wp_VAESNI_enc_last", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rR14", "Vale.X64.InsVector.va_wp_Vpslldq8" ], "source_upto_this": "module Vale.AES.X64.PolyOps\nopen Vale.Def.Types_s\nopen Vale.Arch.Types\nopen Vale.Math.Poly2_s\nopen Vale.Math.Poly2\nopen Vale.Math.Poly2.Bits_s\nopen Vale.Math.Poly2.Bits\nopen Vale.Math.Poly2.Lemmas\nopen Vale.X64.Machine_s\nopen Vale.X64.State\nopen Vale.X64.Decls\nopen Vale.X64.InsBasic\nopen Vale.X64.InsMem\nopen Vale.X64.InsVector\nopen Vale.X64.InsAes\nopen Vale.X64.QuickCode\nopen Vale.X64.QuickCodes\nopen Vale.X64.CPU_Features_s\n//-- VPolyAdd\n\n[@ \"opaque_to_smt\"]\nlet va_code_VPolyAdd dst src1 src2 =\n (va_Block (va_CCons (va_code_VPxor dst src1 src2) (va_CNil ())))\n\n[@ \"opaque_to_smt\"]\nlet va_codegen_success_VPolyAdd dst src1 src2 =\n (va_pbool_and (va_codegen_success_VPxor dst src1 src2) (va_ttrue ()))\n\n[@\"opaque_to_smt\"]\nlet va_lemma_VPolyAdd va_b0 va_s0 dst src1 src2 =\n va_reveal_opaque (`%va_code_VPolyAdd) (va_code_VPolyAdd dst src1 src2);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src1) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_opr128 va_s0 src2) in\n Vale.Math.Poly2.Words.lemma_add_quad32 (va_eval_xmm va_s0 src1) (va_eval_opr128 va_s0 src2);\n let (va_s5, va_fc5) = va_lemma_VPxor (va_hd va_b1) va_s0 dst src1 src2 in\n let va_b5 = va_tl va_b1 in\n let (va_sM, va_f5) = va_lemma_empty_total va_s5 va_b5 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc5 va_s5 va_f5 va_sM in\n (va_sM, va_fM)\n\n\n[@\"opaque_to_smt\"]\nlet va_wpProof_VPolyAdd dst src1 src2 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VPolyAdd (va_code_VPolyAdd dst src1 src2) va_s0 dst src1 src2 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)\n\n//--\n//-- PolyAnd\n\n[@ \"opaque_to_smt\"]\nlet va_code_PolyAnd dst src =\n (va_Block (va_CCons (va_code_Pand dst (va_coerce_xmm_to_opr128 src)) (va_CNil ())))\n\n[@ \"opaque_to_smt\"]\nlet va_codegen_success_PolyAnd dst src =\n (va_pbool_and (va_codegen_success_Pand dst (va_coerce_xmm_to_opr128 src)) (va_ttrue ()))\n\n[@\"opaque_to_smt\"]\nlet va_lemma_PolyAnd va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_PolyAnd) (va_code_PolyAnd dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a1:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 dst) in\n let (a2:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n Vale.Math.Poly2.Words.lemma_and_quad32 (va_eval_xmm va_s0 dst) (va_eval_xmm va_s0 src);\n let (va_s5, va_fc5) = va_lemma_Pand (va_hd va_b1) va_s0 dst (va_coerce_xmm_to_opr128 src) in\n let va_b5 = va_tl va_b1 in\n let (va_sM, va_f5) = va_lemma_empty_total va_s5 va_b5 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc5 va_s5 va_f5 va_sM in\n (va_sM, va_fM)\n\n\n[@\"opaque_to_smt\"]\nlet va_wpProof_PolyAnd dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_PolyAnd (va_code_PolyAnd dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)\n\n//--\n//-- VHigh64ToLow\n\n[@ \"opaque_to_smt\"]\nlet va_code_VHigh64ToLow dst src =\n (va_Block (va_CCons (va_code_Vpsrldq8 dst src) (va_CNil ())))\n\n[@ \"opaque_to_smt\"]\nlet va_codegen_success_VHigh64ToLow dst src =\n (va_pbool_and (va_codegen_success_Vpsrldq8 dst src) (va_ttrue ()))\n\n[@\"opaque_to_smt\"]\nlet va_lemma_VHigh64ToLow va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_VHigh64ToLow) (va_code_VHigh64ToLow dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n let (va_s3, va_fc3) = va_lemma_Vpsrldq8 (va_hd va_b1) va_s0 dst src in\n let va_b3 = va_tl va_b1 in\n Vale.Math.Poly2.Words.lemma_quad32_double_shift a;\n Vale.Math.Poly2.Lemmas.lemma_shift_is_div a 64;\n Vale.Math.Poly2.Bits.lemma_of_to_quad32 (Vale.Math.Poly2_s.shift a (-64));\n let (va_sM, va_f3) = va_lemma_empty_total va_s3 va_b3 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in\n (va_sM, va_fM)\n\n\n[@\"opaque_to_smt\"]\nlet va_wpProof_VHigh64ToLow dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_VHigh64ToLow (va_code_VHigh64ToLow dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_ok va_sM (va_update_operand_xmm dst\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_flags; va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)\n\n//--\n//-- VLow64ToHigh\n\n[@ \"opaque_to_smt\"]\nlet va_code_VLow64ToHigh dst src =\n (va_Block (va_CCons (va_code_Vpslldq8 dst src) (va_CNil ())))\n\n[@ \"opaque_to_smt\"]\nlet va_codegen_success_VLow64ToHigh dst src =\n (va_pbool_and (va_codegen_success_Vpslldq8 dst src) (va_ttrue ()))\n\n[@\"opaque_to_smt\"]\nlet va_lemma_VLow64ToHigh va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_VLow64ToHigh) (va_code_VLow64ToHigh dst src);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (a:Vale.Math.Poly2_s.poly) = Vale.Math.Poly2.Bits_s.of_quad32 (va_eval_xmm va_s0 src) in\n let (va_s3, va_fc3) = va_lemma_Vpslldq8 (va_hd va_b1) va_s0 dst src in\n let va_b3 = va_tl va_b1 in\n Vale.Math.Poly2.Words.lemma_quad32_double_shift a;\n Vale.Math.Poly2.Lemmas.lemma_mask_is_mod a 64;\n Vale.Math.Poly2.lemma_shift_is_mul (Vale.Math.Poly2.mask a 64) 64;\n Vale.Math.Poly2.Bits.lemma_of_to_quad32 (Vale.Math.Poly2_s.shift (Vale.Math.Poly2.mask a 64) 64);\n let (va_sM, va_f3) = va_lemma_empty_total va_s3 va_b3 in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc3 va_s3 va_f3 va_sM in\n (va_sM, va_fM)\n\n\n[@\"opaque_to_smt\"]", "sketch": [ "The `va_wpProof_VLow64ToHigh` function first applies the lemma for `VLow64ToHigh` to reveal the opaque code, then it extracts the relevant information from the state and performs necessary operations to prove the correctness of the transformation. It updates the state, asserts the equality of states, normalizes modifications, and finally returns the updated state, fuel, and a ghost unit.\n\n```fstar\nval va_wpProof_VLow64ToHigh : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_VLow64ToHigh dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_VLow64ToHigh dst src) ([va_Mod_flags;\n va_mod_xmm dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\n```" ], "generated_solution": [] }, { "file_name": "EverParse3d.Interpreter.fst", "name": "EverParse3d.Interpreter.interp_disj", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "FStar.List.Tot" }, { "abbrev": "CP", "full_module": "EverParse3d.CopyBuffer" }, { "abbrev": "T", "full_module": "FStar.Tactics" }, { "abbrev": "P", "full_module": "EverParse3d.Prelude" }, { "abbrev": "A", "full_module": "EverParse3d.Actions.All" }, { "abbrev": "U64", "full_module": "FStar.UInt64" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "EverParse3d" }, { "open": "EverParse3d" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 0, "initial_ifuel": 2, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.qi.eager_threshold=10" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let interp_disj = interp_index A.disjointness_trivial", "source_range": { "start_line": 259, "start_col": 0, "end_line": 259, "end_col": 53 }, "interleaved": false, "definition": "EverParse3d.Interpreter.interp_index EverParse3d.Actions.Base.disjointness_trivial", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "EverParse3d.Interpreter.interp_index", "EverParse3d.Actions.Base.disjointness_pre", "EverParse3d.Actions.Base.disjointness_trivial" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre\n -> Prims.GTot EverParse3d.Actions.Base.disjointness_pre", "prompt": "let interp_disj =\n ", "expected_response": "interp_index A.disjointness_trivial", "source": { "project_name": "everparse", "file_name": "src/3d/prelude/EverParse3d.Interpreter.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git" }, "dependencies": { "source_file": "EverParse3d.Interpreter.fst", "checked_file": "dataset/EverParse3d.Interpreter.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/EverParse3d.Prelude.fsti.checked", "dataset/EverParse3d.CopyBuffer.fsti.checked", "dataset/EverParse3d.Actions.BackendFlag.fsti.checked", "dataset/EverParse3d.Actions.All.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "let ___EVERPARSE_COPY_BUFFER_T = CP.copy_buffer_t", "let specialize = ()", "itype", "UInt8", "UInt8", "UInt8", "UInt16", "UInt16", "UInt16", "UInt32", "UInt32", "UInt32", "UInt64", "UInt64", "UInt64", "UInt8BE", "UInt8BE", "UInt8BE", "UInt16BE", "UInt16BE", "UInt16BE", "UInt32BE", "UInt32BE", "UInt32BE", "UInt64BE", "UInt64BE", "UInt64BE", "Unit", "Unit", "Unit", "AllBytes", "AllBytes", "AllBytes", "AllZeros", "AllZeros", "AllZeros", "let itype_as_type (i:itype)\r\n : Type\r\n = match i with\r\n | UInt8 -> P.___UINT8\r\n | UInt16 -> P.___UINT16\r\n | UInt32 -> P.___UINT32\r\n | UInt64 -> P.___UINT64\r\n | UInt8BE -> P.___UINT8BE\r\n | UInt16BE -> P.___UINT16BE\r\n | UInt32BE -> P.___UINT32BE\r\n | UInt64BE -> P.___UINT64BE\r\n | Unit -> unit\r\n | AllBytes -> P.all_bytes\r\n | AllZeros -> P.all_zeros", "let parser_kind_nz_of_itype (i:itype)\r\n : bool\r\n = match i with\r\n | Unit\r\n | AllBytes\r\n | AllZeros -> false\r\n | _ -> true", "let parser_weak_kind_of_itype (i:itype)\r\n : P.weak_kind\r\n = match i with\r\n | AllBytes\r\n | AllZeros -> P.WeakKindConsumesAll\r\n | _ -> P.WeakKindStrongPrefix", "let parser_kind_of_itype (i:itype)\r\n : P.parser_kind (parser_kind_nz_of_itype i)\r\n (parser_weak_kind_of_itype i)\r\n = match i with\r\n | UInt8 -> P.kind____UINT8\r\n | UInt16 -> P.kind____UINT16\r\n | UInt32 -> P.kind____UINT32\r\n | UInt64 -> P.kind____UINT64\r\n | UInt8BE -> P.kind____UINT8BE\r\n | UInt16BE -> P.kind____UINT16BE\r\n | UInt32BE -> P.kind____UINT32BE\r\n | UInt64BE -> P.kind____UINT64BE\r\n | Unit -> P.kind_unit\r\n | AllBytes -> P.kind_all_bytes\r\n | AllZeros -> P.kind_all_zeros", "let itype_as_parser (i:itype)\r\n : P.parser (parser_kind_of_itype i) (itype_as_type i)\r\n = match i with\r\n | UInt8 -> P.parse____UINT8\r\n | UInt16 -> P.parse____UINT16\r\n | UInt32 -> P.parse____UINT32\r\n | UInt64 -> P.parse____UINT64\r\n | UInt8BE -> P.parse____UINT8BE\r\n | UInt16BE -> P.parse____UINT16BE\r\n | UInt32BE -> P.parse____UINT32BE\r\n | UInt64BE -> P.parse____UINT64BE\r\n | Unit -> P.parse_unit\r\n | AllBytes -> P.parse_all_bytes\r\n | AllZeros -> P.parse_all_zeros", "let allow_reader_of_itype (i:itype)\r\n : bool\r\n = match i with\r\n | AllBytes\r\n | AllZeros -> false\r\n | _ -> true", "let itype_as_leaf_reader (i:itype { allow_reader_of_itype i })\r\n : A.leaf_reader (itype_as_parser i)\r\n = match i with\r\n | UInt8 -> A.read____UINT8\r\n | UInt16 -> A.read____UINT16\r\n | UInt32 -> A.read____UINT32\r\n | UInt64 -> A.read____UINT64\r\n | UInt8BE -> A.read____UINT8BE\r\n | UInt16BE -> A.read____UINT16BE\r\n | UInt32BE -> A.read____UINT32BE\r\n | UInt64BE -> A.read____UINT64BE\r\n | Unit -> A.read_unit", "let itype_as_validator (i:itype)\r\n : A.validate_with_action_t\r\n (itype_as_parser i)\r\n A.true_inv\r\n A.disjointness_trivial\r\n A.eloc_none\r\n (allow_reader_of_itype i)\r\n = match i with\r\n | UInt8 -> A.validate____UINT8\r\n | UInt16 -> A.validate____UINT16\r\n | UInt32 -> A.validate____UINT32\r\n | UInt64 -> A.validate____UINT64\r\n | UInt8BE -> A.validate____UINT8BE\r\n | UInt16BE -> A.validate____UINT16BE\r\n | UInt32BE -> A.validate____UINT32BE\r\n | UInt64BE -> A.validate____UINT64BE\r\n | Unit -> A.validate_unit\r\n | AllBytes -> A.validate_all_bytes\r\n | AllZeros -> A.validate_all_zeros", "let leaf_reader #nz #wk (#k: P.parser_kind nz wk) #t (p:P.parser k t)\r\n = _:squash (wk == P.WeakKindStrongPrefix /\\ hasEq t) &\r\n A.leaf_reader p", "index", "Trivial", "Trivial", "Trivial", "NonTrivial", "NonTrivial", "NonTrivial", "let join_index (j:'a -> 'a -> 'a) (i0 i1:index 'a)\r\n: index 'a\r\n= match i0 with\r\n | Trivial -> i1\r\n | _ -> (\r\n match i1 with\r\n | Trivial -> i0\r\n | NonTrivial i1 -> \r\n let NonTrivial i0 = i0 in\r\n NonTrivial (j i0 i1)\r\n )", "let interp_index (triv:'a) (i:index 'a)\r\n: GTot 'a\r\n= match i with\r\n | Trivial -> triv\r\n | NonTrivial i -> i", "let inv_index = index A.slice_inv", "let inv_none : inv_index = Trivial", "let join_inv = join_index A.conj_inv", "let interp_inv = interp_index A.true_inv", "let loc_index = index A.eloc", "let loc_none : loc_index = Trivial", "let join_loc = join_index A.eloc_union", "let interp_loc = interp_index A.eloc_none", "let disj_index = index A.disjointness_pre", "let disj_none : disj_index = Trivial", "let join_disj = join_index A.conj_disjointness" ], "closest": [ "val conj_disjointness (d0 d1:disjointness_pre) : disjointness_pre\nlet conj_disjointness p1 p2 = p1 /\\ p2", "val Pulse.Typing.Env.pairwise_disjoint = g: Pulse.Typing.Env.env -> g': Pulse.Typing.Env.env -> g'': Pulse.Typing.Env.env -> Prims.logical\nlet pairwise_disjoint (g g' g'':env) =\n disjoint g g' /\\ disjoint g' g'' /\\ disjoint g g''", "val Vale.Interop.Base.disjoint_or_eq = l: Prims.list Vale.Interop.Base.arg -> Type0\nlet disjoint_or_eq (l:list arg) =\n BigOps.pairwise_and' disjoint_or_eq_1 l", "val FStar.FiniteSet.Base.disjoint_fact = Prims.logical\nlet disjoint_fact =\n forall (a: eqtype) (s1: set a) (s2: set a).{:pattern disjoint s1 s2}\n disjoint s1 s2 <==> (forall o.{:pattern mem o s1 \\/ mem o s2} not (mem o s1) \\/ not (mem o s2))", "val FStar.FiniteMap.Base.disjoint_fact = Prims.logical\nlet disjoint_fact =\n forall (a: eqtype) (b: Type u#b) (m1: map a b) (m2: map a b).{:pattern disjoint m1 m2}\n disjoint m1 m2 <==> (forall key.{:pattern FSet.mem key (domain m1) \\/ FSet.mem key (domain m2)}\n not (FSet.mem key (domain m1)) || not (FSet.mem key (domain m2)))", "val InterpreterTarget.free_vars_of_disj = i: InterpreterTarget.index InterpreterTarget.disj -> FStar.All.ML (Prims.list Ast.ident)\nlet free_vars_of_disj = map_index [] free_vars_of_disj'", "val Pulse.Typing.Env.disjoint = g1: Pulse.Typing.Env.env -> g2: Pulse.Typing.Env.env -> Prims.logical\nlet disjoint (g1 g2:env) =\n fstar_env g1 == fstar_env g2 /\\\n Set.disjoint (dom g1) (dom g2)", "val Steel.Semantics.Hoare.MST.disjoint_sym = st: Steel.Semantics.Hoare.MST.st0 -> Prims.logical\nlet disjoint_sym (st:st0) =\n forall h0 h1. st.disjoint h0 h1 <==> st.disjoint h1 h0", "val MiTLS.Mem.disjoint = i: FStar.Monotonic.HyperHeap.rid -> j: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet disjoint = HS.disjoint", "val InterpreterTarget.subst_disj = s: Target.subst -> i: InterpreterTarget.index InterpreterTarget.disj\n -> FStar.All.ALL (FStar.Pervasives.Native.option InterpreterTarget.disj)\nlet subst_disj s = subst_index (subst_disj' s)", "val disjointness_trivial : disjointness_pre\nlet disjointness_trivial = True", "val InterpreterTarget.print_disj = mname: Prims.string -> i: InterpreterTarget.index InterpreterTarget.disj\n -> FStar.All.ML Prims.string\nlet print_disj mname = print_index (print_disj' mname)", "val Vale.AsLowStar.ValeSig.disjoint_or_eq = l: Prims.list Vale.Interop.Base.arg -> Type0\nlet disjoint_or_eq (l:list arg) =\n BigOps.pairwise_and' disjoint_or_eq_1 l", "val Steel.Semantics.Hoare.MST.disjoint_join = st: Steel.Semantics.Hoare.MST.st0 -> Prims.logical\nlet disjoint_join (st:st0) =\n forall m0 m1 m2.\n st.disjoint m1 m2 /\\\n st.disjoint m0 (st.join m1 m2) ==>\n st.disjoint m0 m1 /\\\n st.disjoint m0 m2 /\\\n st.disjoint (st.join m0 m1) m2 /\\\n st.disjoint (st.join m0 m2) m1", "val Vale.Interop.Base.disjoint_or_eq_1 = a: Vale.Interop.Base.arg -> b: Vale.Interop.Base.arg -> Prims.logical\nlet disjoint_or_eq_1 (a:arg) (b:arg) =\n match a, b with\n | (| TD_Buffer _ _ {strict_disjointness=true}, xb |), (| TD_Buffer _ _ _, yb |)\n | (| TD_ImmBuffer _ _ {strict_disjointness=true}, xb |), (| TD_ImmBuffer _ _ _, yb |)\n | (| TD_Buffer _ _ _, xb |), (| TD_Buffer _ _ {strict_disjointness=true}, yb |)\n | (| TD_ImmBuffer _ _ _, xb |), (| TD_ImmBuffer _ _ {strict_disjointness=true}, yb |)\n // An immutable buffer and a trivial buffer should not be equal\n | (| TD_ImmBuffer _ _ _, xb |), (| TD_Buffer _ _ _, yb |)\n | (| TD_Buffer _ _ _, xb |), (| TD_ImmBuffer _ _ _, yb |) ->\n disjoint_not_eq xb yb\n | (| TD_Buffer srcx tx {taint=tntx}, xb |), (| TD_Buffer srcy ty {taint=tnty}, yb |)\n | (| TD_ImmBuffer srcx tx {taint=tntx}, xb |), (| TD_ImmBuffer srcy ty {taint=tnty}, yb |) ->\n disjoint_not_eq xb yb \\/ (xb === yb /\\ tntx == tnty /\\ tx == ty /\\ srcx == srcy)\n | _ -> True", "val imp_disjointness (d1 d2:disjointness_pre) : prop\nlet imp_disjointness p1 p2 = p1 ==> p2", "val Vale.Interop.Heap_s.list_disjoint_or_eq_def = ptrs: Prims.list Vale.Interop.Types.b8 -> Prims.logical\nlet list_disjoint_or_eq_def (ptrs:list b8) =\n forall (p1 p2:b8).{:pattern (L.memP p1 ptrs); (L.memP p2 ptrs)}\n L.memP p1 ptrs /\\\n L.memP p2 ptrs ==> disjoint_or_eq_b8 p1 p2", "val disjoint (l1 l2:eloc) : disjointness_pre\nlet disjoint l1 l2 = eloc_disjoint l1 l2", "val Steel.Semantics.Hoare.MST.join_associative = st: Steel.Semantics.Hoare.MST.st0{Steel.Semantics.Hoare.MST.disjoint_join st} -> Prims.logical\nlet join_associative (st:st0{disjoint_join st})=\n forall m0 m1 m2.\n st.disjoint m1 m2 /\\\n st.disjoint m0 (st.join m1 m2) ==>\n st.join m0 (st.join m1 m2) == st.join (st.join m0 m1) m2", "val disjoint_lemma: Prims.unit -> Lemma (disjoint_fact)\nlet disjoint_lemma ()\n: Lemma (disjoint_fact) =\n introduce forall (a: eqtype) (s1: set a) (s2: set a).\n disjoint s1 s2 <==> (forall o.{:pattern mem o s1 \\/ mem o s2} not (mem o s1) \\/ not (mem o s2))\n with (\n introduce (forall o.{:pattern mem o s1 \\/ mem o s2} not (mem o s1) \\/ not (mem o s2)) ==> disjoint s1 s2\n with _. (\n introduce forall x. not (s1 x && s2 x)\n with assert (not (mem x s1) \\/ not (mem x s2))\n )\n )", "val Vale.X64.Decls.locs_disjoint = ls: Prims.list Vale.X64.Memory.loc -> Vale.Def.Prop_s.prop0\nlet locs_disjoint = M.locs_disjoint", "val Vale.Interop.Heap_s.list_disjoint_or_eq = _: Prims.list Vale.Interop.Types.b8 -> Prims.logical\nlet list_disjoint_or_eq = opaque_make list_disjoint_or_eq_def", "val Pulse.Typing.inv_disjointness = inv_p: Pulse.Syntax.Base.term -> inames: Pulse.Syntax.Base.term -> inv: Pulse.Syntax.Base.term\n -> Pulse.Syntax.Base.term\nlet inv_disjointness (inv_p inames inv:term) = \n let g = Pulse.Reflection.Util.inv_disjointness_goal (elab_term inv_p) (elab_term inames) (elab_term inv) in \n tm_fstar g inv.range", "val Steel.Semantics.Hoare.MST.join_commutative = st: Steel.Semantics.Hoare.MST.st0{Steel.Semantics.Hoare.MST.disjoint_sym st} -> Prims.logical\nlet join_commutative (st:st0 { disjoint_sym st }) =\n forall m0 m1.\n st.disjoint m0 m1 ==>\n st.join m0 m1 == st.join m1 m0", "val loc_disjoint (s1 s2:loc) : GTot prop0\nlet loc_disjoint = M.loc_disjoint", "val loc_disjoint (s1 s2:loc) : GTot prop0\nlet loc_disjoint = M.loc_disjoint", "val action_seq\r\n (#[@@@erasable] invf:slice_inv)\r\n (#[@@@erasable] disjf:disjointness_pre)\r\n (#[@@@erasable] lf:eloc)\r\n (#bf:_)\r\n (#a:Type)\r\n (f: action invf disjf lf bf a)\r\n (#[@@@erasable] invg:slice_inv)\r\n (#[@@@erasable] disjg:disjointness_pre)\r\n (#[@@@erasable] lg:eloc)\r\n (#bg:_)\r\n (#b:Type)\r\n (g: action invg disjg lg bg b)\r\n : action\r\n (conj_inv invf invg)\r\n (conj_disjointness disjf disjg)\r\n (eloc_union lf lg)\r\n (bf || bg)\r\n b\nlet action_seq\n (#invf:slice_inv) #disjf (#lf:eloc)\n #bf (#a:Type) (f: action invf disjf lf bf a)\n (#invg:slice_inv) #disjg (#lg:eloc) #bg\n (#b:Type) (g: action invg disjg lg bg b)\n= fun ctxt error_handler_fn input input_length pos posf ->\n let h0 = HST.get () in\n let _ = f ctxt error_handler_fn input input_length pos posf in\n let h1 = HST.get () in\n modifies_address_liveness_insensitive_unused_in h0 h1;\n g ctxt error_handler_fn input input_length pos posf", "val disjoint (i j: rid) : GTot bool\nlet disjoint (i:rid) (j:rid) :GTot bool = not (includes i j) && not (includes j i)", "val Lib.MultiBuffer.internally_disjoint = b: Lib.MultiBuffer.multibuf lanes len -> Prims.logical\nlet internally_disjoint #lanes #len (b:multibuf lanes len) =\n forall i j. (i < lanes /\\ j < lanes /\\ i <> j) ==> disjoint b.(|i|) b.(|j|)", "val action_ite\r\n (#[@@@erasable] invf:slice_inv)\r\n (#[@@@erasable] disjf:disjointness_pre)\r\n (#[@@@erasable] lf:eloc)\r\n (guard:bool)\r\n (#bf:_)\r\n (#a:Type)\r\n (then_: squash guard -> action invf disjf lf bf a)\r\n (#[@@@erasable] invg:slice_inv)\r\n (#[@@@erasable] disjg:disjointness_pre)\r\n (#[@@@erasable] lg:eloc)\r\n (#bg:_)\r\n (else_: squash (not guard) -> action invg disjg lg bg a)\r\n : action\r\n (conj_inv invf invg)\r\n (conj_disjointness disjf disjg)\r\n (eloc_union lf lg)\r\n (bf || bg)\r\n a\nlet action_ite\n (#invf:slice_inv) #disjf (#lf:eloc)\n (guard:bool)\n #bf (#a:Type) (then_: squash guard -> action invf disjf lf bf a)\n (#invg:slice_inv) #disjg (#lg:eloc) #bg\n (else_: squash (not guard) -> action invg disjg lg bg a)\n= fun ctxt error_handler_fn input input_length pos posf ->\n if guard \n then then_ () ctxt error_handler_fn input input_length pos posf\n else else_ () ctxt error_handler_fn input input_length pos posf", "val Vale.PPC64LE.Decls.locs_disjoint = ls: Prims.list Vale.PPC64LE.Memory.loc -> Vale.Def.Prop_s.prop0\nlet locs_disjoint = M.locs_disjoint", "val conj_disjointness_trivial_left_unit (d:disjointness_pre)\r\n : squash ((disjointness_trivial `conj_disjointness` d) == d)\nlet conj_disjointness_trivial_left_unit (d:disjointness_pre)\n = FStar.PropositionalExtensionality.apply (disjointness_trivial `conj_disjointness` d) d", "val FStar.FiniteSet.Base.union_of_disjoint_fact = Prims.logical\nlet union_of_disjoint_fact =\n forall (a: eqtype) (s1: set a) (s2: set a).{:pattern union s1 s2}\n disjoint s1 s2 ==> difference (union s1 s2) s1 == s2 /\\ difference (union s1 s2) s2 == s1", "val inv_disjointness_goal (inv_p inames inv: T.term) : R.term\nlet inv_disjointness_goal (inv_p:T.term) (inames:T.term) (inv:T.term) \n: R.term \n= let p = mk_mem_inv inv_p inames inv in\n let u0 = R.pack_universe R.Uv_Zero in\n let p = mk_reveal u0 bool_tm p in\n mk_eq2 u0 bool_tm (`false) p", "val EverParse3d.Prelude.___Bool = Prims.eqtype\nlet ___Bool = bool", "val Vale.Interop.disjoint = ptr1: Vale.Interop.Types.b8 -> ptr2: Vale.Interop.Types.b8 -> Type0\nlet disjoint (ptr1 ptr2:b8) = MB.loc_disjoint (MB.loc_buffer ptr1.bsrc) (MB.loc_buffer ptr2.bsrc)", "val disjointness_remove_i_i (g: env) (inv_p inames inv: term)\n : T.Tac\n (Pulse.Typing.prop_validity g (inv_disjointness inv_p (remove_iname inv_p inames inv) inv))\nlet disjointness_remove_i_i (g:env) (inv_p inames inv:term)\n: T.Tac (Pulse.Typing.prop_validity g \n (inv_disjointness inv_p (remove_iname inv_p inames inv) inv))\n= RU.magic()", "val g_rowi_disjoint_other: #a:Spec.alg -> #m:m_spec -> #b:Type -> st:state_p a m -> i:index_t -> x:buffer b ->\n Lemma(requires (disjoint st x))\n (ensures (disjoint (g_rowi st i) x))\n [SMTPat (disjoint (g_rowi st i) x)]\nlet g_rowi_disjoint_other #a #m #b st i x =\n assert (v (i *. row_len a m) + v (row_len a m) <= length st);\n LowStar.Monotonic.Buffer.loc_includes_gsub_buffer_r' #_ #(LowStar.Buffer.trivial_preorder (element_t a m)) #(LowStar.Buffer.trivial_preorder (element_t a m)) st (i *. row_len a m) (row_len a m)\n (LowStar.Buffer.trivial_preorder (element_t a m))", "val conj_disjointness_trivial_right_unit (d:disjointness_pre)\r\n : squash ((d `conj_disjointness` disjointness_trivial) == d)\nlet conj_disjointness_trivial_right_unit (d:disjointness_pre)\n = FStar.PropositionalExtensionality.apply (d `conj_disjointness` disjointness_trivial) d", "val InterpreterTarget.join_disj = \n d0: FStar.Pervasives.Native.option InterpreterTarget.disj ->\n d1: FStar.Pervasives.Native.option InterpreterTarget.disj\n -> FStar.Pervasives.Native.option InterpreterTarget.disj\nlet join_disj = join_index Disj_conj", "val action_bind\r\n (name: string)\r\n (#[@@@erasable] invf:slice_inv)\r\n (#[@@@erasable] disjf:disjointness_pre)\r\n (#[@@@erasable] lf:eloc)\r\n (#bf:_)\r\n (#a:Type)\r\n (f: action invf disjf lf bf a)\r\n (#[@@@erasable] invg:slice_inv)\r\n (#[@@@erasable] disjg:disjointness_pre)\r\n (#[@@@erasable] lg:eloc)\r\n (#bg:_)\r\n (#b:Type)\r\n (g: (a -> action invg disjg lg bg b))\r\n : action\r\n (conj_inv invf invg)\r\n (conj_disjointness disjf disjg)\r\n (eloc_union lf lg)\r\n (bf || bg)\r\n b\nlet action_bind\n (name: string)\n (#invf:slice_inv) #disjf (#lf:eloc)\n #bf (#a:Type) (f: action invf disjf lf bf a)\n (#invg:slice_inv) #disjg (#lg:eloc) #bg\n (#b:Type) (g: (a -> action invg disjg lg bg b))\n= fun ctxt error_handler_fn input input_length pos posf ->\n let h0 = HST.get () in\n [@(rename_let (\"\" ^ name))]\n let x = f ctxt error_handler_fn input input_length pos posf in\n let h1 = HST.get () in\n modifies_address_liveness_insensitive_unused_in h0 h1;\n g x ctxt error_handler_fn input input_length pos posf", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val Vale.Interop.Types.disjoint_addr = addr1: Prims.int -> length1: Prims.int -> addr2: Prims.int -> length2: Prims.int -> Prims.bool\nlet disjoint_addr addr1 length1 addr2 length2 =\n (* The first buffer is completely before the second, or the opposite *)\n addr1 + length1 < addr2 ||\n addr2 + length2 < addr1", "val elems_disjoint: #dt:stateful unit -> x:dt_s dt -> y:dt_s dt -> GTot Type0\nlet elems_disjoint #dt x y =\n B.loc_disjoint (dt_footprint x) (dt_footprint y)", "val Zeta.Steel.AddMRel.addm_precond2 = a: Zeta.Steel.AddMRel.addm_param -> Prims.GTot Prims.logical\nlet addm_precond2 (a: addm_param) =\n addm_precond1 a /\\\n (let mv' = addm_anc_val_pre a in\n let d = addm_dir a in\n mv_points_to_none mv' d \\/ // case A: ancestor points to nothing along d\n mv_points_to mv' d (addm_base_key a) \\/ // case B: ancestor points to key being added\n is_proper_descendent (mv_pointed_key mv' d) (addm_base_key a))", "val disjointness_pre : Type u#1\nlet disjointness_pre = prop", "val Lib.MultiBuffer.disjoint_multi_multi = b: Lib.MultiBuffer.multibuf lanes len -> b': Lib.MultiBuffer.multibuf lanes len' -> Prims.logical\nlet disjoint_multi_multi #lanes #len #len' (b:multibuf lanes len) (b':multibuf lanes len') =\n forall i. i < lanes ==> disjoint b.(|i|) b'.(|i|)", "val Pulse.Checker.AssertWithBinders.disjoint = dom: Prims.list Pulse.Syntax.Base.var -> cod: FStar.Set.set Pulse.Syntax.Base.var -> Prims.bool\nlet disjoint (dom:list var) (cod:Set.set var) =\n L.for_all (fun d -> not (Set.mem d cod)) dom", "val Lib.MultiBuffer.disjoint_multi = b: Lib.MultiBuffer.multibuf lanes len -> b': Lib.Buffer.lbuffer a len' -> Prims.logical\nlet disjoint_multi #lanes #len #a #len' (b:multibuf lanes len) (b':lbuffer a len') =\n forall i. i < lanes ==> disjoint b.(|i|) b'", "val rs_loc_elems_each_disj:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n rs:S.seq a -> drid:HS.rid ->\n i:nat -> j:nat{i <= j && j <= S.length rs} ->\n Lemma (requires (V.forall_seq rs i j\n (fun r -> HS.disjoint (Rgl?.region_of rg r) drid)))\n (ensures (loc_disjoint (rs_loc_elems rg rs i j)\n (loc_all_regions_from false drid)))\n (decreases j)\nlet rec rs_loc_elems_each_disj #a #rst rg rs drid i j =\n if i = j then ()\n else rs_loc_elems_each_disj rg rs drid i (j - 1)", "val Zeta.Steel.AddMRel.addm_precond = a: Zeta.Steel.AddMRel.addm_param -> Prims.GTot Prims.logical\nlet addm_precond (a: addm_param) =\n let st = addm_store_pre a in\n let s' = addm_anc_slot a in\n addm_precond2 a /\\\n (let d = addm_dir a in\n (addm_anc_points_null a ==> (addm_value_pre a == init_value (addm_key a) /\\\n points_to_none st s' d)) /\\\n (addm_anc_points_to_key a ==> (addm_desc_hash_dir a == T.Dh_vsome ({ dhd_key = (addm_base_key a);\n dhd_h = (addm_hash_val_pre a);\n evicted_to_blum = T.Vfalse })) /\\\n points_to_none st s' d) /\\\n (addm_anc_points_to_desc a ==> (addm_value_pre a == init_value (addm_key a))))", "val Zeta.Steel.AddMRel.addm_precond1 = a: Zeta.Steel.AddMRel.addm_param -> Prims.GTot Prims.logical\nlet addm_precond1 (a: addm_param) =\n let st' = addm_store_pre a in\n let s = addm_slot a in\n let s' = addm_anc_slot a in\n addm_precond0 a /\\\n s <> s' /\\\n inuse_slot st' s' /\\\n empty_slot st' s /\\\n (let k' = stored_base_key st' s' in\n let gk = addm_key a in\n is_proper_descendent (to_base_key gk) k')", "val rs_loc_elems_parent_disj:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n rs:S.seq a -> prid:HS.rid ->\n i:nat -> j:nat{i <= j && j <= S.length rs} ->\n Lemma (requires (rs_elems_reg rg rs prid i j))\n (ensures (loc_disjoint (rs_loc_elems rg rs i j)\n (loc_region_only false prid)))\n (decreases j)\nlet rec rs_loc_elems_parent_disj #a #rst rg rs prid i j =\n if i = j then ()\n else rs_loc_elems_parent_disj rg rs prid i (j - 1)", "val p:r0: subtls & r1: subtls & r2: subtls{r1 `disjoint` r0 /\\ r2 `disjoint` r0 /\\ r2 `disjoint` r1}\nlet p :\n r0:subtls &\n r1:subtls &\n r2:subtls\n {r1 `disjoint` r0 /\\ r2 `disjoint` r0 /\\ r2 `disjoint` r1} =\n let r0 = new_colored_region tls_region tls_color in\n let r1 = new_colored_region tls_region tls_color in\n let r2 = new_colored_region tls_region tls_color in\n (| r0, r1, r2 |)", "val loc_aux_disjoint (l1 l2: loc_aux) : GTot Type0\nlet loc_aux_disjoint\n (l1 l2: loc_aux)\n: GTot Type0\n= match l2 with\n | LocBuffer b ->\n loc_aux_disjoint_buffer l1 b", "val Vale.Interop.Base.disjoint_not_eq = \n x: LowStar.Monotonic.Buffer.mbuffer (Vale.Interop.Types.base_typ_as_type src1) rel1 rrel1 ->\n y: LowStar.Monotonic.Buffer.mbuffer (Vale.Interop.Types.base_typ_as_type src2) rel2 rrel2\n -> Prims.logical\nlet disjoint_not_eq\n (#src1 #src2:base_typ)\n (#rel1 #rrel1:MB.srel (base_typ_as_type src1))\n (#rel2 #rrel2:MB.srel (base_typ_as_type src2))\n (x:MB.mbuffer (base_typ_as_type src1) rel1 rrel1)\n (y:MB.mbuffer (base_typ_as_type src2) rel2 rrel2) =\n B.loc_disjoint (B.loc_buffer x) (B.loc_buffer y) /\\\n ~ (src1 == src2 /\\ rel1 == rel2 /\\ rrel1 == rrel2 /\\ x == y)", "val Vale.Interop.Heap_s.disjoint_or_eq_b8 = ptr1: Vale.Interop.Types.b8 -> ptr2: Vale.Interop.Types.b8 -> Prims.logical\nlet disjoint_or_eq_b8 (ptr1 ptr2:b8) =\n B.loc_disjoint (B.loc_buffer ptr1.bsrc) (B.loc_buffer ptr2.bsrc) \\/\n ptr1 == ptr2", "val Vale.Interop.Heap_s.list_disjoint_or_eq_reveal = _: Prims.unit\n -> FStar.Pervasives.Lemma\n (ensures Vale.Interop.Heap_s.list_disjoint_or_eq == Vale.Interop.Heap_s.list_disjoint_or_eq_def)\nlet list_disjoint_or_eq_reveal = opaque_revealer (`%list_disjoint_or_eq) list_disjoint_or_eq list_disjoint_or_eq_def", "val rv_loc_elems_each_disj:\n #a:Type0 -> #rst:Type -> #rg:regional rst a ->\n h:HS.mem -> rv:rvector rg ->\n i:uint32_t -> j:uint32_t{i <= j && j <= V.size_of rv} ->\n drid:HS.rid ->\n Lemma (requires (V.forall_ h rv i j\n (fun r -> HS.disjoint (Rgl?.region_of rg r) drid)))\n (ensures (loc_disjoint (rv_loc_elems h rv i j)\n (loc_all_regions_from false drid)))\nlet rv_loc_elems_each_disj #a #rst #rg h rv i j drid =\n rs_loc_elems_each_disj rg (V.as_seq h rv) drid (U32.v i) (U32.v j)", "val rlist_disjoint: subq -> list subq -> Type0\nlet rec rlist_disjoint r = function\n | [] -> True\n | r' :: l -> r `HS.disjoint` r' /\\ rlist_disjoint r l", "val Interop.max_arity = Prims.int\nlet max_arity = 4", "val hash_vv_rv_inv_disjoint:\n #hsz:hash_size_t ->\n h:HS.mem -> hvv:hash_vv hsz ->\n i:uint32_t -> j:uint32_t -> drid:HH.rid ->\n Lemma (requires (RV.rv_inv h hvv /\\\n i < V.size_of hvv /\\\n j < V.size_of (V.get h hvv i) /\\\n HH.disjoint (Rgl?.region_of (hvvreg hsz) hvv) drid))\n (ensures (HH.disjoint (Rgl?.region_of (hreg hsz) (V.get h (V.get h hvv i) j)) drid))\nlet hash_vv_rv_inv_disjoint #hsz h hvv i j drid =\n assert (HH.disjoint (Rgl?.region_of (hvreg hsz) (V.get h hvv i)) drid);\n assert (RV.rv_inv h (V.get h hvv i));\n assert (HH.disjoint (Rgl?.region_of (hreg hsz) (V.get h (V.get h hvv i) j)) drid)", "val path_disjoint_t_rect\n (#from: typ)\n (x:\n (\n #value1: typ ->\n #value2: typ ->\n p1: path from value1 ->\n p2: path from value2 ->\n h: path_disjoint_t p1 p2\n -> GTot Type))\n (h_step:\n (\n #through: typ ->\n #to1: typ ->\n #to2: typ ->\n p: path from through ->\n s1: step through to1 ->\n s2: step through to2 {step_disjoint s1 s2} ->\n h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)\n -> GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n (\n #value1: typ ->\n #value2: typ ->\n p1: path from value1 ->\n p2: path from value2 ->\n #value1': typ ->\n #value2': typ ->\n p1': path from value1' {path_includes p1 p1'} ->\n p2': path from value2' {path_includes p2 p2'} ->\n h: path_disjoint_t p1 p2 ->\n h': path_disjoint_t p1' p2' ->\n ihx: x p1 p2 h\n -> GTot (x p1' p2' h')))\n (#value1 #value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n : Ghost (x p1 p2 h) (requires True) (ensures (fun _ -> True)) (decreases h)\nlet rec path_disjoint_t_rect\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (h: path_disjoint_t p1 p2) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n (h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)) ->\n GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2'}) ->\n (h: path_disjoint_t p1 p2) ->\n (h': path_disjoint_t p1' p2') ->\n (ihx: x p1 p2 h) ->\n GTot (x p1' p2' h')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n: Ghost (x p1 p2 h)\n (requires True)\n (ensures (fun _ -> True))\n (decreases h)\n= match h with\n | PathDisjointStep p s1 s2 -> h_step p s1 s2 h\n | PathDisjointIncludes p1_ p2_ p1' p2' h_ -> h_includes p1_ p2_ p1' p2' h_ h (path_disjoint_t_rect x h_step h_includes p1_ p2_ h_)", "val FStar.GSet.disjoint = s1: FStar.GSet.set a -> s2: FStar.GSet.set a -> Type0\nlet disjoint (#a:Type) (s1: set a) (s2: set a) =\n equal (intersect s1 s2) empty", "val action_weaken\r\n (#[@@@erasable] inv:slice_inv)\r\n (#[@@@erasable] disj:disjointness_pre)\r\n (#[@@@erasable] l:eloc)\r\n (#b:_)\r\n (#a:_)\r\n (act:action inv disj l b a)\r\n (#[@@@erasable] inv':slice_inv{inv' `inv_implies` inv})\r\n (#[@@@erasable] disj':disjointness_pre { disj' `imp_disjointness` disj })\r\n (#l':eloc{l' `eloc_includes` l})\r\n : action inv' disj' l' b a\nlet action_weaken #inv #disj #l #b #a act #inv' #disj' #l' = act", "val lemma_eq_disjoint:\n #a1:Type\n -> #a2:Type\n -> #a3:Type\n -> clen1:size_t\n -> clen2:size_t\n -> clen3:size_t\n -> b1:lbuffer a1 clen1\n -> b2:lbuffer a2 clen2\n -> b3:lbuffer a3 clen3\n -> n:size_t{v n < v clen2 /\\ v n < v clen1}\n -> h0:mem\n -> h1:mem -> Lemma\n (requires\n live h0 b1 /\\ live h0 b2 /\\ live h0 b3 /\\\n eq_or_disjoint b1 b2 /\\ disjoint b1 b3 /\\ disjoint b2 b3 /\\\n modifies (loc (gsub b1 0ul n) |+| loc b3) h0 h1)\n (ensures\n (let b2s = gsub b2 n (clen2 -! n) in\n as_seq h0 b2s == as_seq h1 b2s /\\\n Seq.index (as_seq h0 b2) (v n) == Seq.index (as_seq h1 b2) (v n)))\nlet lemma_eq_disjoint #a1 #a2 #a3 clen1 clen2 clen3 b1 b2 b3 n h0 h1 =\n let b1s = gsub b1 0ul n in\n let b2s = gsub b2 0ul n in\n assert (modifies (loc b1s |+| loc b3) h0 h1);\n assert (disjoint b1 b2 ==> Seq.equal (as_seq h0 b2) (as_seq h1 b2));\n assert (disjoint b1 b2 ==> Seq.equal (as_seq h0 b2s) (as_seq h1 b2s));\n assert (Seq.index (as_seq h1 b2) (v n) == Seq.index (as_seq h1 (gsub b2 n (clen2 -! n))) 0)", "val Lib.Buffer.disjoint = b1: Lib.Buffer.buffer_t t1 a1 -> b2: Lib.Buffer.buffer_t t2 a2 -> Type0\nlet disjoint (#t1 #t2:buftype) (#a1 #a2:Type0) (b1:buffer_t t1 a1) (b2:buffer_t t2 a2) =\n B.loc_disjoint (loc b1) (loc b2)", "val act_with_comment\r\n (s: string)\r\n (#[@@@erasable] inv:slice_inv)\r\n (#[@@@erasable] disj:disjointness_pre)\r\n (#[@@@erasable] l:eloc)\r\n (#b:_)\r\n (res:Type)\r\n (a: action inv disj l b res)\r\n: Tot (action inv disj l b res)\nlet act_with_comment\n s res a\n=\n fun ctxt err sl len pos posf ->\n LPL.comment s;\n a ctxt err sl len pos posf", "val LowStar.Monotonic.Buffer.ubuffer_disjoint0 = b1: LowStar.Monotonic.Buffer.ubuffer r1 a1 -> b2: LowStar.Monotonic.Buffer.ubuffer r2 a2\n -> Prims.logical\nlet ubuffer_disjoint0 (#r1 #r2:HS.rid) (#a1 #a2:nat) (b1:ubuffer r1 a1) (b2:ubuffer r2 a2) =\n r1 == r2 /\\ a1 == a2 /\\\n ubuffer_disjoint' (G.reveal b1) (G.reveal b2)", "val Vale.AsLowStar.ValeSig.disjoint_or_eq_1 = a: Vale.Interop.Base.arg -> b: Vale.Interop.Base.arg -> Type0\nlet disjoint_or_eq_1 (a:arg) (b:arg) =\n match a, b with\n | (| TD_Buffer srcx tx {strict_disjointness=true}, xb |), (| TD_Buffer srcy ty _, yb |)\n | (| TD_Buffer srcx tx _, xb |), (| TD_Buffer srcy ty {strict_disjointness=true}, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_buffer #srcx #tx xb)) (ME.loc_buffer (as_vale_buffer #srcy #ty yb))\n | (| TD_ImmBuffer srcx tx {strict_disjointness=true}, xb |), (| TD_ImmBuffer srcy ty _, yb |)\n | (| TD_ImmBuffer srcx tx _, xb |), (| TD_ImmBuffer srcy ty {strict_disjointness=true}, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_immbuffer #srcx #tx xb)) (ME.loc_buffer (as_vale_immbuffer #srcy #ty yb))\n // An immutable buffer and a trivial buffer should not be equal\n | (| TD_ImmBuffer srcx tx _, xb |), (| TD_Buffer srcy ty _, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_immbuffer #srcx #tx xb)) (ME.loc_buffer (as_vale_buffer #srcy #ty yb))\n | (| TD_Buffer srcx tx _, xb |), (| TD_ImmBuffer srcy ty _, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_buffer #srcx #tx xb)) (ME.loc_buffer (as_vale_immbuffer #srcy #ty yb))\n | (| TD_Buffer srcx tx _, xb |), (| TD_Buffer srcy ty _, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_buffer #srcx #tx xb)) (ME.loc_buffer (as_vale_buffer #srcy #ty yb)) \\/\n xb === yb\n | (| TD_ImmBuffer srcx tx _, xb |), (| TD_ImmBuffer srcy ty _, yb |) ->\n ME.loc_disjoint (ME.loc_buffer (as_vale_immbuffer #srcx #tx xb)) (ME.loc_buffer (as_vale_immbuffer #srcy #ty yb)) \\/\n xb === yb\n | _ -> True", "val disjoint_ind\n (x:\n (#value1: typ -> #value2: typ -> p1: pointer value1 -> p2: pointer value2 {disjoint p1 p2}\n -> GTot Type0))\n (h_root:\n (\n #value1: typ ->\n #value2: typ ->\n p1: pointer value1 ->\n p2: pointer value2 {frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2}\n -> Lemma (x p1 p2)))\n (h_field:\n (\n #l: struct_typ ->\n p: pointer (TStruct l) ->\n fd1: struct_field l ->\n fd2: struct_field l {fd1 <> fd2 /\\ disjoint (gfield p fd1) (gfield p fd2)}\n -> Lemma (x (gfield p fd1) (gfield p fd2))))\n (h_cell:\n (\n #length: array_length_t ->\n #value: typ ->\n p: pointer (TArray length value) ->\n i1: UInt32.t{UInt32.v i1 < UInt32.v length} ->\n i2:\n UInt32.t\n { UInt32.v i2 < UInt32.v length /\\ UInt32.v i1 <> UInt32.v i2 /\\\n disjoint (gcell p i1) (gcell p i2) }\n -> Lemma (x (gcell p i1) (gcell p i2))))\n (h_includes:\n (\n #value1: typ ->\n #value2: typ ->\n p1: pointer value1 ->\n p2: pointer value2 ->\n #value1': typ ->\n #value2': typ ->\n p1': pointer value1' {includes p1 p1'} ->\n p2':\n pointer value2' {includes p2 p2' /\\ disjoint p1 p2 /\\ disjoint p1' p2' /\\ x p1 p2}\n -> Lemma (x p1' p2')))\n (#value1 #value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 {disjoint p1 p2})\n : Lemma (x p1 p2)\nlet disjoint_ind\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 {disjoint p1 p2} ) ->\n GTot Type0))\n (h_root:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 { frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2 } ) ->\n Lemma (x p1 p2)))\n (h_field:\n ((#l: struct_typ) ->\n (p: pointer (TStruct l)) ->\n (fd1: struct_field l) ->\n (fd2: struct_field l { fd1 <> fd2 /\\ disjoint (gfield p fd1) (gfield p fd2) } ) ->\n Lemma (x (gfield p fd1) (gfield p fd2))))\n (h_cell:\n ((#length: array_length_t) ->\n (#value: typ) ->\n (p: pointer (TArray length value)) ->\n (i1: UInt32.t {UInt32.v i1 < UInt32.v length}) ->\n (i2: UInt32.t {UInt32.v i2 < UInt32.v length /\\ UInt32.v i1 <> UInt32.v i2 /\\ disjoint (gcell p i1) (gcell p i2) }) ->\n Lemma (x (gcell p i1) (gcell p i2))\n ))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': pointer value1' {includes p1 p1'}) ->\n (p2': pointer value2' {includes p2 p2' /\\ disjoint p1 p2 /\\ disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 { disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n let (Pointer from contents _) = p1 in\n path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> x (Pointer from contents p1_) (Pointer from contents p2_))\n (fun #through #to1 #to2 p s1 s2 ->\n match s1 with\n | StepField l fd1 ->\n let (StepField _ fd2) = s2 in\n h_field #l (Pointer from contents p) fd1 fd2\n | StepCell le va i1 ->\n let (StepCell _ _ i2) = s2 in\n h_cell #le #va (Pointer from contents p) i1 i2\n )\n (fun #v1 #v2 p1_ p2_ #v1' #v2' p1' p2' -> h_includes (Pointer from contents p1_) (Pointer from contents p2_) (Pointer from contents p1') (Pointer from contents p2'))\n (Pointer?.p p1)\n (Pointer?.p p2);\n assert (x p1 p2)\n else\n h_root p1 p2", "val Lib.MultiBuffer.internally_disjoint4 = \n b0: Lib.Buffer.lbuffer a len ->\n b1: Lib.Buffer.lbuffer a len ->\n b2: Lib.Buffer.lbuffer a len ->\n b3: Lib.Buffer.lbuffer a len\n -> Prims.logical\nlet internally_disjoint4 #len #a (b0 b1 b2 b3: lbuffer a len) =\n disjoint b0 b1 /\\ disjoint b0 b2 /\\ disjoint b0 b3 /\\\n disjoint b1 b2 /\\ disjoint b1 b3 /\\ disjoint b2 b3", "val Zeta.Steel.AddMRel.addm_precond0 = a: Zeta.Steel.AddMRel.addm_param -> Prims.logical\nlet addm_precond0 (a: addm_param)\n = match a with\n | AMP s p s' _ ->\n check_slot_bounds s /\\\n check_slot_bounds s'", "val Imp.equiv = p1: Imp.prog -> p2: Imp.prog -> Prims.logical\nlet equiv p1 p2 = eval p1 == eval p2", "val DoublyLinkedListIface._pred_nl_disjoint = h: FStar.Monotonic.HyperStack.mem -> ns: Prims.list (DoublyLinkedListIface.node 'a) -> Type0\nlet rec _pred_nl_disjoint (h:HS.mem) (ns:list (node 'a)) =\n DLL.nodelist_fp0 ns `B.loc_disjoint` B.loc_region_only false (HS.get_tip h)", "val Steel.Semantics.Hoare.MST.depends_only_on_0_2 = \n interp: (_: hprop -> _: heap -> Prims.prop) ->\n disjoint: (_: heap -> _: heap -> Prims.prop) ->\n join: (h0: heap -> h1: heap{disjoint h0 h1} -> heap) ->\n q: (_: heap -> _: a -> _: heap -> Prims.prop) ->\n fp_pre: hprop ->\n fp_post: (_: a -> hprop)\n -> Prims.logical\nlet depends_only_on_0_2\n (#a:Type)\n (#heap:Type)\n (#hprop:Type)\n (interp:hprop -> heap -> prop)\n (disjoint:heap -> heap -> prop)\n (join:(h0:heap -> h1:heap{disjoint h0 h1} -> heap))\n (q:heap -> a -> heap -> prop) (fp_pre:hprop) (fp_post:a -> hprop)\n\n = //can join any disjoint heap to the pre-heap and q is still valid\n (forall x (h_pre:fp_heap_0 interp fp_pre) h_post (h:heap{disjoint h_pre h}).\n q h_pre x h_post <==> q (join h_pre h) x h_post) /\\\n //can join any disjoint heap to the post-heap and q is still valid\n (forall x h_pre (h_post:fp_heap_0 interp (fp_post x)) (h:heap{disjoint h_post h}).\n q h_pre x h_post <==> q h_pre x (join h_post h))", "val rs_loc_elems_disj:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n rs:S.seq a -> prid:HS.rid ->\n i:nat -> j:nat{i <= j && j <= S.length rs} ->\n k1:nat{i <= k1} ->\n k2:nat{k1 <= k2 && k2 <= j} ->\n l1:nat{i <= l1} ->\n l2:nat{l1 <= l2 && l2 <= j} ->\n Lemma (requires (rs_elems_reg rg rs prid i j /\\ (k2 <= l1 || l2 <= k1)))\n (ensures (loc_disjoint (rs_loc_elems rg rs k1 k2)\n (rs_loc_elems rg rs l1 l2)))\n (decreases k2)\nlet rec rs_loc_elems_disj #a #rst rg rs prid i j k1 k2 l1 l2 =\n if k1 = k2 then ()\n else (rs_loc_elems_elem_disj rg rs prid i j l1 l2 (k2 - 1);\n rs_loc_elems_disj rg rs prid i j k1 (k2 - 1) l1 l2)", "val Zeta.Intermediate.Verifier.addm_precond2 = a: Zeta.Intermediate.Verifier.addm_param vcfg -> Prims.logical\nlet addm_precond2 #vcfg (a: addm_param vcfg) =\r\n addm_precond1 a /\\\r\n (let mv' = addm_anc_val_pre a in\r\n let d = addm_dir a in\r\n Merkle.points_to_none mv' d \\/ // case A: ancestor points to nothing along d\r\n Merkle.points_to mv' d (addm_base_key a) \\/ // case B: ancestor points to key being added\r\n is_proper_desc (Merkle.pointed_key mv' d) (addm_base_key a))", "val validate_with_dep_action\r\n (name: string)\r\n (#nz:_)\r\n (#k:parser_kind nz WeakKindStrongPrefix)\r\n (#t:Type)\r\n (#[@@@erasable] p:parser k t)\r\n (#[@@@erasable] inv:slice_inv)\r\n (#[@@@erasable] disj:disjointness_pre) \r\n (#[@@@erasable] l:eloc)\r\n (v:validate_with_action_t p inv disj l true)\r\n (r:leaf_reader p)\r\n (#b:bool)\r\n (#[@@@erasable] inva:slice_inv)\r\n (#[@@@erasable] disja:disjointness_pre) \r\n (#[@@@erasable] la:eloc)\r\n (a: t -> action inva disja la b bool)\r\n : validate_with_action_t #nz\r\n p\r\n (conj_inv inv inva)\r\n (conj_disjointness disj disja)\r\n (eloc_union l la)\r\n false\nlet validate_with_dep_action\n (name: string)\n #nz (#k:parser_kind nz _) (#t:_) (#p:parser k t)\n #inv #disj #l\n (v:validate_with_action_t p inv disj l true)\n (r:leaf_reader p)\n (#b:bool) #inva #disja (#la:eloc)\n (a: t -> action inva disja la b bool)\n= fun ctxt error_handler_fn input input_length start_position ->\n [@inline_let] let pos0 = start_position in\n let h = HST.get () in\n [@(rename_let (\"positionAfter\" ^ name))]\n let res = v ctxt error_handler_fn input input_length pos0 in\n let h1 = HST.get () in\n if LPE.is_error res\n then res\n else begin\n [@(rename_let (\"\" ^ name))]\n let field_value = r input pos0 in\n let h15 = HST.get () in\n let _ = modifies_address_liveness_insensitive_unused_in h h15 in\n if a field_value ctxt error_handler_fn input input_length pos0 res\n then res\n else LPE.set_validator_error_pos LPE.validator_error_action_failed res\n end", "val pointer_distinct_sel_disjoint\n (#a:Type0) (#rrel1 #rrel2 #rel1 #rel2:srel a)\n (b1:mpointer a rrel1 rel1)\n (b2:mpointer a rrel2 rel2)\n (h:HS.mem)\n :Lemma (requires (live h b1 /\\ live h b2 /\\ get h b1 0 =!= get h b2 0))\n (ensures (disjoint b1 b2))\nlet pointer_distinct_sel_disjoint #a #_ #_ #_ #_ b1 b2 h =\n if frameOf b1 = frameOf b2 && as_addr b1 = as_addr b2\n then begin\n HS.mreference_distinct_sel_disjoint h (Buffer?.content b1) (Buffer?.content b2);\n loc_disjoint_buffer b1 b2\n end\n else\n loc_disjoint_buffer b1 b2", "val Vale.Math.Bits.lemmas_i2b_all = Prims.logical\nlet lemmas_i2b_all =\n (forall (#n:pos) (m:pos) (a:uint_t n) (mn:pos).{:pattern (b_i2b #mn (uext #n #m a))} mn == m + n ==> b_i2b #mn (uext #n #m a) == b_uext #n #m (b_i2b #n a)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logand a b))} b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logor a b))} b_i2b #n (logor #n a b) == b_or #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (logxor a b))} b_i2b #n (logxor #n a b) == b_xor #n (b_i2b a) (b_i2b b)) /\\\n // TODO: shl and shr should take a nat (see comment above)\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (shift_left a b))} b_i2b #n (shift_left #n a b) == b_shl #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (shift_right a b))} b_i2b #n (shift_right #n a b) == b_shr #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (add_hide a b))} b_i2b #n (add_hide #n a b) == b_add #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (sub_hide a b))} b_i2b #n (sub_hide #n a b) == b_sub #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (mul_hide a b))} b_i2b #n (mul_hide #n a b) == b_mul #n (b_i2b a) b) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (add_mod a b))} b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (sub_mod a b))} b_i2b #n (sub_mod #n a b) == b_sub #n (b_i2b a) (b_i2b b)) /\\\n (forall (#n:pos) (a b:uint_t n).{:pattern (b_i2b #n (mul_mod a b))} b_i2b #n (mul_mod #n a b) == b_mul #n (b_i2b a) b) /\\\n (forall (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}).{:pattern (b_i2b #n (udiv a b))} b_i2b #n (udiv #n a b) == b_div #n (b_i2b a) b) /\\\n (forall (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}).{:pattern (b_i2b #n (mod a b))} b_i2b #n (mod #n a b) == b_mod #n (b_i2b a) b) /\\\n True", "val Vale.PPC64LE.Memory.buffer_info_disjoint = bi1: Vale.Arch.HeapImpl.buffer_info -> bi2: Vale.Arch.HeapImpl.buffer_info -> Prims.logical\nlet buffer_info_disjoint (bi1 bi2:buffer_info) =\n bi1.bi_typ =!= bi2.bi_typ \\/ bi1.bi_heaplet =!= bi2.bi_heaplet ==>\n loc_disjoint (loc_buffer bi1.bi_buffer) (loc_buffer bi2.bi_buffer)", "val Benton2004.RHL.interpolable = p: Benton2004.RHL.gexp Prims.bool -> Type0\nlet interpolable (p: gexp bool) = Benton2004.interpolable (interp p)", "val action_abort \r\n : action true_inv disjointness_trivial eloc_none false bool\nlet action_abort\n= fun _ _ _ _ _ _ -> false", "val Ariadne.pre0 = c: Ariadne.case -> w: Ariadne.state -> Prims.logical\nlet pre0 c w = \n match c with \n | Ok u -> True\n | Recover u v\n | Writing u v \n | Crash u v -> w==u \\/ w==v", "val Zeta.Intermediate.Verifier.addm_precond = a: Zeta.Intermediate.Verifier.addm_param vcfg -> Prims.logical\nlet addm_precond #vcfg (a: addm_param vcfg) =\r\n let st = addm_store_pre a in\r\n let s' = addm_anc_slot a in\r\n addm_precond2 a /\\\r\n (let d = addm_dir a in\r\n (addm_anc_points_null a ==> (addm_value_pre a = init_value (addm_key a) /\\\r\n points_to_none st s' d)) /\\\r\n (addm_anc_points_to_key a ==> (addm_desc_hash_dir a = Merkle.Desc (addm_base_key a) (addm_hash_val_pre a) false) /\\\r\n points_to_none st s' d) /\\\r\n (addm_anc_points_to_desc a ==> (addm_value_pre a = init_value (addm_key a))))", "val core_create_lemma_disjointness (args: list arg {disjoint_or_eq args})\n : Lemma (ensures VSig.disjoint_or_eq args)\nlet rec core_create_lemma_disjointness\n (args:list arg{disjoint_or_eq args})\n : Lemma\n (ensures VSig.disjoint_or_eq args)\n = match args with\n | [] -> ()\n | hd::tl ->\n disjoint_or_eq_cons hd tl;\n BigOps.pairwise_and'_cons VSig.disjoint_or_eq_1 hd tl;\n core_create_lemma_disjointness tl;\n assert (VSig.disjoint_or_eq tl);\n let rec aux (n:list arg)\n : Lemma (requires (BigOps.big_and' (disjoint_or_eq_1 hd) n))\n (ensures (BigOps.big_and' (VSig.disjoint_or_eq_1 hd) n)) =\n match n with\n | [] -> ()\n | n::ns ->\n BigOps.big_and'_cons (disjoint_or_eq_1 hd) n ns;\n BigOps.big_and'_cons (VSig.disjoint_or_eq_1 hd) n ns;\n aux ns\n in\n aux tl", "val Steel.Semantics.Hoare.MST.fp_prop_0_2 = \n interp: (_: hprop -> _: heap -> Prims.prop) ->\n disjoint: (_: heap -> _: heap -> Prims.prop) ->\n join: (h0: heap -> h1: heap{disjoint h0 h1} -> heap) ->\n fp_pre: hprop ->\n fp_post: (_: a -> hprop)\n -> Type\nlet fp_prop_0_2\n (#a:Type)\n (#heap #hprop:Type)\n (interp:hprop -> heap -> prop)\n (disjoint:heap -> heap -> prop)\n (join:(h0:heap -> h1:heap{disjoint h0 h1} -> heap))\n (fp_pre:hprop)\n (fp_post:a -> hprop)\n =\n q:(heap -> a -> heap -> prop){depends_only_on_0_2 interp disjoint join q fp_pre fp_post}", "val loc_disjoint' (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0\nlet loc_disjoint'\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n: GTot Type0\n= loc_disjoint_region_liveness_tags l1 l2 /\\\n loc_disjoint_addrs l1 l2 /\\\n loc_disjoint_aux l1 l2", "val Lib.MultiBuffer.internally_disjoint8 = \n b0: Lib.Buffer.lbuffer a len ->\n b1: Lib.Buffer.lbuffer a len ->\n b2: Lib.Buffer.lbuffer a len ->\n b3: Lib.Buffer.lbuffer a len ->\n b4: Lib.Buffer.lbuffer a len ->\n b5: Lib.Buffer.lbuffer a len ->\n b6: Lib.Buffer.lbuffer a len ->\n b7: Lib.Buffer.lbuffer a len\n -> Prims.logical\nlet internally_disjoint8 #len #a (b0 b1 b2 b3 b4 b5 b6 b7: lbuffer a len) =\n disjoint b0 b1 /\\ disjoint b0 b2 /\\ disjoint b0 b3 /\\ disjoint b0 b4 /\\ disjoint b0 b5 /\\ disjoint b0 b6 /\\ disjoint b0 b7 /\\\n disjoint b1 b2 /\\ disjoint b1 b3 /\\ disjoint b1 b4 /\\ disjoint b1 b5 /\\ disjoint b1 b6 /\\ disjoint b1 b7 /\\\n disjoint b2 b3 /\\ disjoint b2 b4 /\\ disjoint b2 b5 /\\ disjoint b2 b6 /\\ disjoint b2 b7 /\\\n disjoint b3 b4 /\\ disjoint b3 b5 /\\ disjoint b3 b6 /\\ disjoint b3 b7 /\\\n disjoint b4 b5 /\\ disjoint b4 b6 /\\ disjoint b4 b7 /\\\n disjoint b5 b6 /\\ disjoint b5 b7 /\\\n disjoint b6 b7", "val path_disjoint_ind\n (#from: typ)\n (x:\n (\n #value1: typ ->\n #value2: typ ->\n p1: path from value1 ->\n p2: path from value2 {path_disjoint p1 p2}\n -> GTot Type))\n (h_step:\n (\n #through: typ ->\n #to1: typ ->\n #to2: typ ->\n p: path from through ->\n s1: step through to1 ->\n s2:\n step through to2\n { step_disjoint s1 s2 /\\\n path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) }\n -> Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2))))\n (h_includes:\n (\n #value1: typ ->\n #value2: typ ->\n p1: path from value1 ->\n p2: path from value2 ->\n #value1': typ ->\n #value2': typ ->\n p1': path from value1' {path_includes p1 p1'} ->\n p2':\n path from value2'\n { path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\\n x p1 p2 }\n -> Lemma (x p1' p2')))\n (#value1 #value2: typ)\n (p1: path from value1)\n (p2: path from value2 {path_disjoint p1 p2})\n : Lemma (x p1 p2)\nlet path_disjoint_ind\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2 {path_disjoint p1 p2} ) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 /\\ path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) } ) ->\n Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2) )))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2 { path_disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun (h: path_disjoint_t p1 p2) ->\n path_disjoint_t_rect\n (fun #v1 #v2 p1 p2 h -> let _ = FStar.Squash.return_squash h in squash (x p1 p2))\n (fun #through #to1 #to2 p s1 s2 h -> let _ = FStar.Squash.return_squash h in h_step p s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' h h' hx ->\n let _ = FStar.Squash.return_squash h in\n let _ = FStar.Squash.return_squash h' in\n let _ = FStar.Squash.return_squash hx in\n h_includes p1 p2 p1' p2')\n p1 p2 h)", "val Vale.Math.Poly2.all_defs = Prims.logical\nlet all_defs =\n poly == D.poly /\\\n (forall (p:poly).{:pattern (degree p)} degree p == D.degree (to_poly p)) /\\\n zero == of_poly D.zero /\\\n one == of_poly D.one /\\\n (forall (n:nat).{:pattern (monomial n)} monomial n == of_poly (D.monomial n)) /\\\n (forall (p:poly) (n:int).{:pattern (shift p n)} shift p n == of_poly (D.shift (to_poly p) n)) /\\\n (forall (p:poly) (n:nat).{:pattern (reverse p n)} reverse p n == of_poly (D.reverse (to_poly p) n)) /\\\n (forall (p:poly) (n:int).{:pattern (poly_index p n)} poly_index p n == D.poly_index (to_poly p) n) /\\\n (forall (a b:poly).{:pattern (add a b)} add a b == of_poly (D.add (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (mul a b)} mul a b == of_poly (D.mul (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (div a b)} degree b >= 0 ==> div a b == of_poly (D.div (to_poly a) (to_poly b))) /\\\n (forall (a b:poly).{:pattern (mod a b)} degree b >= 0 ==> mod a b == of_poly (D.mod (to_poly a) (to_poly b)))", "val Zeta.Intermediate.Interleave.forall_vtls_rel_base = il: Zeta.Intermediate.Interleave.verifiable_log vcfg -> Prims.GTot Prims.logical\nlet forall_vtls_rel_base (#vcfg:_) (il: verifiable_log vcfg)\n = let ilk = to_logk il in\n forall t. (let vss = thread_state t il in\n let vsk = thread_state t ilk in\n vtls_rel vss vsk)", "val FStar.InteractiveHelpers.ParseTest.test3 = 'a: Prims.bool -> l: Prims.list _ -> Prims.int\nlet test3 'a = test2 'a", "val Z3TestGen.type_has_actions = _: InterpreterTarget.typ -> Prims.bool\nlet rec type_has_actions = function\n | I.T_with_dep_action _ _ _\n | I.T_dep_pair_with_action _ _ _ _\n | I.T_refine_with_action _ _ _ _\n | I.T_dep_pair_with_refinement_and_action _ _ _ _ _\n | I.T_with_action _ _ _\n | I.T_probe_then_validate _ _ _ _ _\n -> true\n | I.T_false _\n | I.T_denoted _ _\n | I.T_refine _ _ _\n | I.T_string _ _ _\n -> false\n | I.T_if_else _ t1 t2\n | I.T_pair _ t1 t2 ->\n type_has_actions t1 || type_has_actions t2\n | I.T_at_most _ _ t\n | I.T_exact _ _ t\n | I.T_nlist _ _ t\n | I.T_with_comment _ t _\n | I.T_dep_pair_with_refinement _ _ _ (_, t)\n | I.T_dep_pair _ _ (_, t) ->\n type_has_actions t", "val Zeta.Intermediate.Verifier.addm_precond1 = a: Zeta.Intermediate.Verifier.addm_param vcfg -> Prims.logical\nlet addm_precond1 #vcfg (a: addm_param vcfg) =\r\n let st' = addm_store_pre a in\r\n match a with\r\n | AMP s (gk,gv) s' _ ->\r\n s <> s' /\\\r\n inuse_slot st' s' /\\\r\n empty_slot st' s /\\\r\n (let k' = stored_base_key st' s' in\r\n is_proper_desc (to_base_key gk) k')", "val Vale.Wrapper.X64.GCMencryptOpt256.disjoint_or_eq = b1: Vale.Wrapper.X64.GCMencryptOpt256.uint8_p -> b2: Vale.Wrapper.X64.GCMencryptOpt256.uint8_p\n -> Prims.logical\nlet disjoint_or_eq (b1 b2:uint8_p) = B.disjoint b1 b2 \\/ b1 == b2", "val Steel.Semantics.Hoare.MST.depends_only_on_0 = \n interp: (_: hprop -> _: heap -> Prims.prop) ->\n disjoint: (_: heap -> _: heap -> Prims.prop) ->\n join: (h0: heap -> h1: heap{disjoint h0 h1} -> heap) ->\n q: (_: heap -> Prims.prop) ->\n fp: hprop\n -> Prims.logical\nlet depends_only_on_0\n (#heap:Type)\n (#hprop:Type)\n (interp:hprop -> heap -> prop)\n (disjoint: heap -> heap -> prop)\n (join: (h0:heap -> h1:heap{disjoint h0 h1} -> heap))\n (q:heap -> prop) (fp: hprop)\n =\n forall (h0:fp_heap_0 interp fp) (h1:heap{disjoint h0 h1}). q h0 <==> q (join h0 h1)" ], "closest_src": [ { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.conj_disjointness" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fsti", "name": "Pulse.Typing.Env.pairwise_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.disjoint_or_eq" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fsti", "name": "FStar.FiniteSet.Base.disjoint_fact" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.disjoint_fact" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.free_vars_of_disj" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fsti", "name": "Pulse.Typing.Env.disjoint" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.disjoint_sym" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.disjoint" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.subst_disj" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.disjointness_trivial" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.print_disj" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.ValeSig.fst", "name": "Vale.AsLowStar.ValeSig.disjoint_or_eq" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.disjoint_join" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.disjoint_or_eq_1" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.imp_disjointness" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Heap_s.fst", "name": "Vale.Interop.Heap_s.list_disjoint_or_eq_def" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.disjoint" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.join_associative" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fst", "name": "FStar.FiniteSet.Base.disjoint_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.locs_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Heap_s.fst", "name": "Vale.Interop.Heap_s.list_disjoint_or_eq" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.inv_disjointness" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.join_commutative" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_disjoint" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.action_seq" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fsti", "name": "FStar.Monotonic.HyperHeap.disjoint" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.internally_disjoint" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.action_ite" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.locs_disjoint" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.conj_disjointness_trivial_left_unit" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fsti", "name": "FStar.FiniteSet.Base.union_of_disjoint_fact" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.inv_disjointness_goal" }, { "project_name": "everparse", "file_name": "EverParse3d.Prelude.fsti", "name": "EverParse3d.Prelude.___Bool" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.fsti", "name": "Vale.Interop.disjoint" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.disjointness_remove_i_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Blake2.Core.fst", "name": "Hacl.Impl.Blake2.Core.g_rowi_disjoint_other" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.conj_disjointness_trivial_right_unit" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.join_disj" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.action_bind" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Types.fst", "name": "Vale.Interop.Types.disjoint_addr" }, { "project_name": "noise-star", "file_name": "Impl.Noise.LinkedList.fst", "name": "Impl.Noise.LinkedList.elems_disjoint" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AddMRel.fsti", "name": "Zeta.Steel.AddMRel.addm_precond2" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.disjointness_pre" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.disjoint_multi_multi" }, { "project_name": "steel", "file_name": "Pulse.Checker.AssertWithBinders.fst", "name": "Pulse.Checker.AssertWithBinders.disjoint" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.disjoint_multi" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rs_loc_elems_each_disj" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AddMRel.fsti", "name": "Zeta.Steel.AddMRel.addm_precond" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AddMRel.fsti", "name": "Zeta.Steel.AddMRel.addm_precond1" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rs_loc_elems_parent_disj" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.p" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.disjoint_not_eq" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Heap_s.fst", "name": "Vale.Interop.Heap_s.disjoint_or_eq_b8" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Heap_s.fst", "name": "Vale.Interop.Heap_s.list_disjoint_or_eq_reveal" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rv_loc_elems_each_disj" }, { "project_name": "everquic-crypto", "file_name": "Mem.fst", "name": "Mem.rlist_disjoint" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.max_arity" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Datastructures.fst", "name": "MerkleTree.Low.Datastructures.hash_vv_rv_inv_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.path_disjoint_t_rect" }, { "project_name": "FStar", "file_name": "FStar.GSet.fsti", "name": "FStar.GSet.disjoint" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.action_weaken" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Lib.fst", "name": "Hacl.Impl.Lib.lemma_eq_disjoint" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.disjoint" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.act_with_comment" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.ubuffer_disjoint0" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.ValeSig.fst", "name": "Vale.AsLowStar.ValeSig.disjoint_or_eq_1" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.disjoint_ind" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.internally_disjoint4" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AddMRel.fsti", "name": "Zeta.Steel.AddMRel.addm_precond0" }, { "project_name": "FStar", "file_name": "Imp.fst", "name": "Imp.equiv" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fst", "name": "DoublyLinkedListIface._pred_nl_disjoint" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.depends_only_on_0_2" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rs_loc_elems_disj" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Verifier.fsti", "name": "Zeta.Intermediate.Verifier.addm_precond2" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.validate_with_dep_action" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.pointer_distinct_sel_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.lemmas_i2b_all" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fsti", "name": "Vale.PPC64LE.Memory.buffer_info_disjoint" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.interpolable" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.action_abort" }, { "project_name": "FStar", "file_name": "Ariadne.fst", "name": "Ariadne.pre0" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Verifier.fsti", "name": "Zeta.Intermediate.Verifier.addm_precond" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Wrapper.fst", "name": "Vale.AsLowStar.Wrapper.core_create_lemma_disjointness" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.fp_prop_0_2" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_disjoint'" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.internally_disjoint8" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.path_disjoint_ind" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.all_defs" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Interleave.fst", "name": "Zeta.Intermediate.Interleave.forall_vtls_rel_base" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.test3" }, { "project_name": "everparse", "file_name": "Z3TestGen.fst", "name": "Z3TestGen.type_has_actions" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Verifier.fsti", "name": "Zeta.Intermediate.Verifier.addm_precond1" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCMencryptOpt256.fsti", "name": "Vale.Wrapper.X64.GCMencryptOpt256.disjoint_or_eq" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.depends_only_on_0" } ], "selected_premises": [ "EverParse3d.Interpreter.interp_loc", "EverParse3d.Prelude.refine", "EverParse3d.Interpreter.interp_inv", "EverParse3d.Kinds.weak_kind_glb", "LowStar.Monotonic.Buffer.length", "EverParse3d.Interpreter.loc_none", "EverParse3d.Interpreter.disj_none", "EverParse3d.Interpreter.leaf_reader", "EverParse3d.Interpreter.interp_index", "FStar.UInt.size", "LowStar.Buffer.trivial_preorder", "LowStar.Monotonic.Buffer.srel", "EverParse3d.Interpreter.disj_index", "EverParse3d.Interpreter.allow_reader_of_itype", "EverParse3d.Interpreter.itype_as_parser", "EverParse3d.Interpreter.parser_kind_nz_of_itype", "EverParse3d.Interpreter.parser_kind_of_itype", "FStar.Int.Cast.uint64_to_uint32", "EverParse3d.Prelude.uint32_to_uint64", "FStar.Int.Cast.op_At_Percent", "EverParse3d.Interpreter.join_inv", "EverParse3d.AppCtxt.app_ctxt", "FStar.Int.Cast.uint32_to_uint64", "FStar.Mul.op_Star", "LowStar.Buffer.gcmalloc_of_list", "EverParse3d.Interpreter.loc_index", "EverParse3d.Interpreter.parser_weak_kind_of_itype", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "EverParse3d.Interpreter.join_disj", "EverParse3d.Prelude.uint64_to_uint32", "EverParse3d.Interpreter.join_loc", "EverParse3d.Interpreter.inv_index", "EverParse3d.Prelude.StaticHeader.get_bitfield8", "EverParse3d.AppCtxt.loc_of", "EverParse3d.Prelude.max_int_sizes", "FStar.Heap.trivial_preorder", "FStar.Pervasives.reveal_opaque", "EverParse3d.Interpreter.itype_as_leaf_reader", "EverParse3d.Interpreter.inv_none", "EverParse3d.Kinds.kind_unit", "EverParse3d.Prelude.uint64_to_uint8", "EverParse3d.Interpreter.nz_of_binding", "FStar.Monotonic.HyperStack.sel", "EverParse3d.Prelude.uint8_to_uint64", "EverParse3d.Prelude.uint32_to_uint8", "EverParse3d.Prelude.uint8_to_uint32", "LowStar.Monotonic.Buffer.loc_addr_of_buffer", "EverParse3d.Interpreter.type_of_binding", "LowStar.Monotonic.Buffer.lmbuffer", "EverParse3d.CopyBuffer.probe_fn", "EverParse3d.Prelude.u8_mul", "EverParse3d.Prelude.u64_mul", "EverParse3d.Interpreter.projector_names", "EverParse3d.Prelude.parse_unit", "FStar.Int.Cast.uint32_to_uint8", "EverParse3d.Prelude.___UINT32", "LowStar.Monotonic.Buffer.deref", "EverParse3d.Prelude.___UINT64", "EverParse3d.Interpreter.itype_as_validator", "LowStar.Monotonic.Buffer.upd", "FStar.Monotonic.HyperStack.is_heap_color", "EverParse3d.Prelude.u8_rem", "LowStar.Monotonic.Buffer.get", "EverParse3d.Interpreter.wk_of_binding", "EverParse3d.CopyBuffer.loc_of", "LowStar.Monotonic.Buffer.loc_all_regions_from", "LowStar.Monotonic.Buffer.disjoint", "FStar.Monotonic.HyperStack.live_region", "LowStar.Monotonic.Buffer.loc_region_only", "EverParse3d.Interpreter.pk_of_binding", "FStar.HyperStack.ST.is_eternal_region", "EverParse3d.Prelude.u8_sub", "EverParse3d.Prelude.u16_mul", "EverParse3d.Prelude.u32_mul", "EverParse3d.Prelude.id", "FStar.Int.Cast.uint64_to_uint8", "EverParse3d.Prelude.u64_rem", "EverParse3d.Prelude.u64_sub", "FStar.Pervasives.dfst", "EverParse3d.Interpreter.join_index", "EverParse3d.Interpreter.reader_binding", "LowParse.BitFields.get_bitfield_partition_prop", "EverParse3d.Interpreter.has_reader", "EverParse3d.Prelude.u8_lognot", "LowStar.Buffer.null", "EverParse3d.Prelude.u32_rem", "FStar.Int.size", "EverParse3d.Prelude.u16_rem", "FStar.Pervasives.dsnd", "EverParse3d.Prelude.StaticHeader.get_bitfield8_msb_first", "EverParse3d.Prelude.u16_sub", "LowParse.BitFields.uint_set_bitfield_set_bitfield_other", "EverParse3d.Prelude.u8_logand", "EverParse3d.Interpreter.parser_of_binding", "FStar.BigOps.normal", "EverParse3d.Prelude.uint16_to_uint32", "EverParse3d.Prelude.___UINT8", "EverParse3d.Prelude.u8_logxor", "LowParse.BitFields.get_bitfield_partition_3" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n Authors: N. Swamy, ...\n*)\nmodule EverParse3d.Interpreter\nmodule U32 = FStar.UInt32\nmodule U64 = FStar.UInt64\nmodule A = EverParse3d.Actions.All\nmodule P = EverParse3d.Prelude\nmodule T = FStar.Tactics\nmodule CP = EverParse3d.CopyBuffer\nopen FStar.List.Tot\n\ninline_for_extraction\nnoextract\nlet ___EVERPARSE_COPY_BUFFER_T = CP.copy_buffer_t\n\n(* This module defines a strongly typed abstract syntax for an\n intermediate representation of 3D programs. This is the type `typ`.\n\n The main idea of this module is to give `typ`s a threefold\n denotation:\n\n 1. Type denotation: `as_type` interprets a `typ` as an F* type\n\n 2. Parser denotation: `as_parser` interprets a `t:typ` as a parser\n of values of the type denotation of `t`.\n\n 3. Validate-with-action denotation: `as_validator` inteprets a\n `t:typ` as a low-level validator corresponding to the parser\n denotation of `t`.\n\n The 3rd denotation, validate-with-action, is the main operational\n denotation. That is, given a 3D program `t:typ` we can interpret it\n as validator to check that an input array of bytes conforms to the\n format specified by `t`. But, what we want ultimately is a C\n program for a `t`-validator.\n\n To achieve this, for any given concrete `t`, we partially evaluate\n this interpreter to get an EverParse validator specialized to `t`\n which can be extracted by F*/KaRaMeL as usual---this partial\n evaluation of an interpreter to a compiler producing a C program\n for t-validator is an instance of the 1st Futamura projection.\n *)\n\n(* An attribute to control partial evaluation *)\nlet specialize = ()\n\n(** You can see the basic idea of the whole stack working at first on\n a very simple class of types---just the primitive types *)\n\n(* Primitive types *)\ntype itype =\n | UInt8\n | UInt16\n | UInt32\n | UInt64\n | UInt8BE\n | UInt16BE\n | UInt32BE\n | UInt64BE\n | Unit\n | AllBytes\n | AllZeros\n\n(* Interpretation of itype as an F* type *)\n[@@specialize]\nlet itype_as_type (i:itype)\n : Type\n = match i with\n | UInt8 -> P.___UINT8\n | UInt16 -> P.___UINT16\n | UInt32 -> P.___UINT32\n | UInt64 -> P.___UINT64\n | UInt8BE -> P.___UINT8BE\n | UInt16BE -> P.___UINT16BE\n | UInt32BE -> P.___UINT32BE\n | UInt64BE -> P.___UINT64BE\n | Unit -> unit\n | AllBytes -> P.all_bytes\n | AllZeros -> P.all_zeros\n\n[@@specialize]\nlet parser_kind_nz_of_itype (i:itype)\n : bool\n = match i with\n | Unit\n | AllBytes\n | AllZeros -> false\n | _ -> true\n\n[@@specialize]\nlet parser_weak_kind_of_itype (i:itype)\n : P.weak_kind\n = match i with\n | AllBytes\n | AllZeros -> P.WeakKindConsumesAll\n | _ -> P.WeakKindStrongPrefix\n\n(* Interpretation of itype as a parser kind *)\n[@@specialize]\nlet parser_kind_of_itype (i:itype)\n : P.parser_kind (parser_kind_nz_of_itype i)\n (parser_weak_kind_of_itype i)\n = match i with\n | UInt8 -> P.kind____UINT8\n | UInt16 -> P.kind____UINT16\n | UInt32 -> P.kind____UINT32\n | UInt64 -> P.kind____UINT64\n | UInt8BE -> P.kind____UINT8BE\n | UInt16BE -> P.kind____UINT16BE\n | UInt32BE -> P.kind____UINT32BE\n | UInt64BE -> P.kind____UINT64BE\n | Unit -> P.kind_unit\n | AllBytes -> P.kind_all_bytes\n | AllZeros -> P.kind_all_zeros\n\n(* Interpretation of an itype as a parser *)\nlet itype_as_parser (i:itype)\n : P.parser (parser_kind_of_itype i) (itype_as_type i)\n = match i with\n | UInt8 -> P.parse____UINT8\n | UInt16 -> P.parse____UINT16\n | UInt32 -> P.parse____UINT32\n | UInt64 -> P.parse____UINT64\n | UInt8BE -> P.parse____UINT8BE\n | UInt16BE -> P.parse____UINT16BE\n | UInt32BE -> P.parse____UINT32BE\n | UInt64BE -> P.parse____UINT64BE\n | Unit -> P.parse_unit\n | AllBytes -> P.parse_all_bytes\n | AllZeros -> P.parse_all_zeros\n\n[@@specialize]\nlet allow_reader_of_itype (i:itype)\n : bool\n = match i with\n | AllBytes\n | AllZeros -> false\n | _ -> true\n\n(* Interpretation of an itype as a leaf reader *)\n[@@specialize]\nlet itype_as_leaf_reader (i:itype { allow_reader_of_itype i })\n : A.leaf_reader (itype_as_parser i)\n = match i with\n | UInt8 -> A.read____UINT8\n | UInt16 -> A.read____UINT16\n | UInt32 -> A.read____UINT32\n | UInt64 -> A.read____UINT64\n | UInt8BE -> A.read____UINT8BE\n | UInt16BE -> A.read____UINT16BE\n | UInt32BE -> A.read____UINT32BE\n | UInt64BE -> A.read____UINT64BE\n | Unit -> A.read_unit\n\n(* Interpretation of an itype as a validator\n -- Notice that the type shows that it is related to the parser *)\n[@@specialize]\nlet itype_as_validator (i:itype)\n : A.validate_with_action_t\n (itype_as_parser i)\n A.true_inv\n A.disjointness_trivial\n A.eloc_none\n (allow_reader_of_itype i)\n = match i with\n | UInt8 -> A.validate____UINT8\n | UInt16 -> A.validate____UINT16\n | UInt32 -> A.validate____UINT32\n | UInt64 -> A.validate____UINT64\n | UInt8BE -> A.validate____UINT8BE\n | UInt16BE -> A.validate____UINT16BE\n | UInt32BE -> A.validate____UINT32BE\n | UInt64BE -> A.validate____UINT64BE\n | Unit -> A.validate_unit\n | AllBytes -> A.validate_all_bytes\n | AllZeros -> A.validate_all_zeros\n\n\n(* Our first order of business to scale this up to 3D is to set up\n definitions for type contexts.\n\n A 3D program is a sequence of top-level definitions, where a given\n definition may reference terms defined previously. To model this,\n we'll given a denotation of programs in a _context_, where the\n context provides denotations for all the names defined previously\n which are in scope.\n*)\n\nlet leaf_reader #nz #wk (#k: P.parser_kind nz wk) #t (p:P.parser k t)\n = _:squash (wk == P.WeakKindStrongPrefix /\\ hasEq t) &\n A.leaf_reader p\n\n(* Now, we can define the type of an environment *)\nmodule T = FStar.Tactics\n\n[@@erasable]\nnoeq\ntype index (a:Type) =\n | Trivial : index a\n | NonTrivial : a -> index a\n\n[@@specialize]\nlet join_index (j:'a -> 'a -> 'a) (i0 i1:index 'a)\n: index 'a\n= match i0 with\n | Trivial -> i1\n | _ -> (\n match i1 with\n | Trivial -> i0\n | NonTrivial i1 ->\n let NonTrivial i0 = i0 in\n NonTrivial (j i0 i1)\n )\n[@@specialize]\nlet interp_index (triv:'a) (i:index 'a)\n: GTot 'a\n= match i with\n | Trivial -> triv\n | NonTrivial i -> i\n\n\nlet inv_index = index A.slice_inv\n[@@specialize]\nlet inv_none : inv_index = Trivial\n[@@specialize]\nlet join_inv = join_index A.conj_inv\n[@@specialize]\nlet interp_inv = interp_index A.true_inv\n\nlet loc_index = index A.eloc\n[@@specialize]\nlet loc_none : loc_index = Trivial\n[@@specialize]\nlet join_loc = join_index A.eloc_union\n[@@specialize]\nlet interp_loc = interp_index A.eloc_none\n\nlet disj_index = index A.disjointness_pre\n[@@specialize]\nlet disj_none : disj_index = Trivial\n[@@specialize]\nlet join_disj = join_index A.conj_disjointness\n[@@specialize]", "sketch": [ "The definition `interp_disj` takes an index `i` representing a disjointness precondition and returns the interpretation of the disjointness precondition.\n\nStep 1: The `interp_disj` function interprets the disjointness precondition index and returns the corresponding disjointness precondition.\n\nStep 2: The implementation of `interp_disj` involves pattern matching on the index `i` to determine if it is trivial or non-trivial. If it is trivial, then the interpretation is the trivial disjointness precondition. If it is non-trivial, then the interpretation is the interpretation of the non-trivial disjointness precondition.", "The implementation of `interp_disj` involves pattern matching on the index `i` to handle the cases where it is either trivial or non-trivial. If it is trivial, the result is simply the trivial disjointness precondition. If it is non-trivial, the disjointness preconditions are combined using the `join_disj` function.", "The implementation of `interp_disj` involves pattern matching on the input index `i` to determine if it is trivial or non-trivial. If it is trivial, the computation returns the trivial disjointness precondition. If it is non-trivial, it extracts the non-trivial disjointness precondition and returns it.", "The implementation of `interp_disj` involves pattern matching on the index `i` to handle the cases where it is either `Trivial` or `NonTrivial`. For the `Trivial` case, the implementation simply returns the trivial disjointness precondition. For the `NonTrivial` case, it extracts the disjointness precondition and returns it.", "The implementation of `interp_disj` involves pattern matching on the index `i` to handle the cases where it is either trivial or non-trivial. If it is trivial, the computation returns the trivial disjointness precondition. If it is non-trivial, it extracts the non-trivial disjointness precondition and returns it.", "The implementation of `interp_disj` involves simply returning the interpretation of the input index `i` as a disjointness precondition.", "The implementation of `interp_disj` involves pattern matching on the index `i` to handle the cases where it is either `Trivial` or `NonTrivial`. For the `Trivial` case, the implementation returns the trivial disjointness precondition. For the `NonTrivial` case, it extracts the disjointness precondition and returns it.", "The implementation of `interp_disj` involves pattern matching on the index `i` to determine if it is trivial or non-trivial. If it is trivial, the computation returns the trivial disjointness precondition. If it is non-trivial, it extracts the non-trivial disjointness precondition and returns it.", "The definition `interp_disj` takes an index `i` representing a disjointness precondition and returns the interpretation of the disjointness precondition.\n\nStep 1: The `interp_disj` function takes an index representing a disjointness precondition and returns the interpretation of the disjointness precondition.\n\nStep 2: The implementation of `interp_disj` involves pattern matching on the index to handle the cases of a trivial index and a non-trivial index. For a non-trivial index, it extracts the disjointness preconditions and combines them using the appropriate operation.", "The definition `interp_disj` takes an index `i` representing a disjointness precondition and returns the interpretation of the disjointness precondition.\n\nStep 1: The `interp_disj` function takes an index representing a disjointness precondition and returns the interpretation of the disjointness precondition.\n\nStep 2: The implementation of `interp_disj` involves pattern matching on the index to handle the cases of a trivial index and a non-trivial index. For a non-trivial index, the interpretation of the disjointness precondition is obtained by extracting the actual disjointness precondition value and returning it." ], "generated_solution": [ "let interp_disj (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre)\n : Prims.GTot EverParse3d.Actions.Base.disjointness_pre =\n interp_index A.disjointness_trivial i", "let interp_disj (i: index A.disjointness_pre) : GTot A.disjointness_pre =\n match i with\n | Trivial -> disj_none\n | NonTrivial d -> interp_disj d", "let interp_disj (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre)\n : Prims.GTot EverParse3d.Actions.Base.disjointness_pre =\n match i with\n | Trivial -> GTot (A.conj_disjointness A.disjointness_trivial A.disjointness_trivial)\n | NonTrivial d -> GTot d", "let interp_disj (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre)\n : Prims.GTot EverParse3d.Actions.Base.disjointness_pre =\n match i with\n | Trivial -> GTot.ret A.disjointness_trivial\n | NonTrivial d -> GTot.ret d", "let interp_disj (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre)\n : Prims.GTot EverParse3d.Actions.Base.disjointness_pre =\n interp_index A.disjointness_trivial i", "let interp_disj (i: index A.disjointness_pre) : GTot A.disjointness_pre =\n interp_index A.disjointness_trivial i", "let interp_disj (i: index A.disjointness_pre): GTot A.disjointness_pre =\n match i with\n | Trivial -> A.disjointness_trivial\n | NonTrivial d -> d", "let interp_disj (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.disjointness_pre)\n : Prims.GTot EverParse3d.Actions.Base.disjointness_pre =\n match i with\n | Trivial -> Prims.ret A.disjointness_trivial\n | NonTrivial d -> Prims.ret d", "let interp_disj (i: index A.disjointness_pre): GTot A.disjointness_pre =\n interp_index A.disj_none i", "let interp_disj (i: index A.disjointness_pre): GTot A.disjointness_pre =\n match i with\n | Trivial -> A.disjointness_trivial\n | NonTrivial d -> d" ] }, { "file_name": "PulseCore.NondeterministicMonotonicStateMonad.fst", "name": "PulseCore.NondeterministicMonotonicStateMonad.lift", "opens_and_abbrevs": [ { "abbrev": "M", "full_module": "PulseCore.MonotonicStateMonad" }, { "open": "FStar.Preorder" }, { "abbrev": "M", "full_module": "PulseCore.MonotonicStateMonad" }, { "open": "PulseCore.MonotonicStateMonad" }, { "open": "FStar.Preorder" }, { "open": "PulseCore" }, { "open": "PulseCore" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val lift #s #rel #a #pre #post (f:M.mst #s rel a pre post)\r\n: nmst #s rel a pre post", "source_definition": "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post)\r\n: nmst #s rel a pre post\r\n= fun () s t c -> let x, s1 = f s in (x, s1, c)", "source_range": { "start_line": 28, "start_col": 0, "end_line": 30, "end_col": 47 }, "interleaved": false, "definition": "fun f ->\n (fun _ ->\n fun s _ c ->\n let _ = f s in\n (let FStar.Pervasives.Native.Mktuple2 #_ #_ x s1 = _ in\n x, s1, c)\n <:\n res:\n ((a * s) * PulseCore.NondeterministicMonotonicStateMonad.ctr)\n {post s (Mktuple3?._1 res) (Mktuple3?._2 res) /\\ rel s (Mktuple3?._2 res)})\n <:\n PulseCore.NondeterministicMonotonicStateMonad.nmst rel a pre post", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Preorder.preorder", "Prims.prop", "PulseCore.MonotonicStateMonad.mst", "Prims.unit", "PulseCore.NondeterministicMonotonicStateMonad.tape", "PulseCore.NondeterministicMonotonicStateMonad.ctr", "FStar.Pervasives.Native.Mktuple3", "FStar.Pervasives.Native.tuple3", "Prims.l_and", "FStar.Pervasives.Native.__proj__Mktuple3__item___1", "FStar.Pervasives.Native.__proj__Mktuple3__item___2", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.__proj__Mktuple2__item___1", "FStar.Pervasives.Native.__proj__Mktuple2__item___2", "PulseCore.NondeterministicMonotonicStateMonad.nmst'", "PulseCore.NondeterministicMonotonicStateMonad.nmst" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "f: PulseCore.MonotonicStateMonad.mst rel a pre post\n -> PulseCore.NondeterministicMonotonicStateMonad.nmst rel a pre post", "prompt": "let lift #s #rel #a #pre #post (f: M.mst #s rel a pre post) : nmst #s rel a pre post =\n ", "expected_response": "fun () s t c ->\n let x, s1 = f s in\n (x, s1, c)", "source": { "project_name": "steel", "file_name": "lib/pulse_core/PulseCore.NondeterministicMonotonicStateMonad.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "PulseCore.NondeterministicMonotonicStateMonad.fst", "checked_file": "dataset/PulseCore.NondeterministicMonotonicStateMonad.fst.checked", "interface_file": true, "dependencies": [ "dataset/PulseCore.MonotonicStateMonad.fst.checked", "dataset/prims.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "val nmst (#s:Type u#s)\r\n (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a)\r\n (pre:s -> prop)\r\n (post:s -> a -> s -> prop)\r\n: Type u#0", "let tape = nat -> bool", "let ctr = nat", "let nmst' (#s:Type u#s)\r\n (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a)\r\n (pre:s -> prop)\r\n (post:s -> a -> s -> prop)\r\n = s0:s { pre s0 }\r\n -> tape\r\n -> ctr\r\n -> Dv (\r\n res:(a & s & ctr) {\r\n post s0 res._1 res._2 /\\\r\n rel s0 res._2\r\n }\r\n )", "val lift #s #rel #a #pre #post (f:M.mst #s rel a pre post)\r\n: nmst #s rel a pre post", "val return (#s:Type u#s)\r\n (#rel:preorder s)\r\n (#a:Type u#a)\r\n (x:a)\r\n: nmst rel a (fun _ -> True) (fun s0 v s1 -> x == v /\\ s0 == s1)", "let nmst #s rel a pre post =\r\n unit -> Dv (nmst' #s rel a pre post)" ], "closest": [ "val lift1 (#a:Type u#1) #opens #pre #post\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift1 (#a:Type u#1) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action1 (m #emp_inames)", "val lift (#a:Type u#100) #opens (#pre:slprop) (#post:a -> slprop)\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift (#a:Type u#100) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action (m #emp_inames)", "val lift0 (#a:Type u#0) #opens #pre #post\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift0 (#a:Type u#0) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action0 (m #emp_inames)", "val lift2 (#a:Type u#2) #opens #pre #post\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift2 (#a:Type u#2) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action2 (m #emp_inames)", "val lift_nmst_total_nmst\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req: M.pre_t state)\n (ens: M.post_t state a)\n (f: NMSTTotal.repr a state rel req ens)\n : repr a state rel req ens\nlet lift_nmst_total_nmst (a:Type) (state:Type u#2) (rel:P.preorder state)\n (req:M.pre_t state) (ens:M.post_t state a)\n (f:NMSTTotal.repr a state rel req ens)\n: repr a state rel req ens\n= fun (t, n) -> f (t, n)", "val hide_div #a #pre #post (f:unit -> Dv (stt a pre post))\r\n: stt a pre post\nlet hide_div #a #pre #post (f:unit -> Dv (stt a pre post))\r\n: stt a pre post\r\n= fun _ -> f () ()", "val lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift2 e", "val hide_div #a #pre #post (f:unit -> Dv (stt a pre post))\n: stt a pre post\nlet hide_div = I.hide_div", "val bind_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (#b: Type)\n (#post_b: post_t st b)\n (lpost_b: (x: a -> l_post (post_a x) post_b))\n : l_post pre post_b\nlet bind_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (#b:Type)\n (#post_b:post_t st b)\n (lpost_b:(x:a -> l_post (post_a x) post_b))\n : l_post pre post_b\n =\n fun h0 y h2 -> lpre_a h0 /\\ (exists x h1. lpost_a h0 x h1 /\\ (lpost_b x) h1 y h2)", "val lift_mst_total_mst\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req: pre_t state)\n (ens: post_t state a)\n (f: MSTTotal.repr a state rel req ens)\n : repr a state rel req ens\nlet lift_mst_total_mst (a:Type)\n (state:Type u#2) (rel:P.preorder state)\n (req:pre_t state) (ens:post_t state a)\n (f:MSTTotal.repr a state rel req ens)\n: repr a state rel req ens\n= fun s0 -> f s0", "val lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift1 e", "val perform\n (#a #pre #post : _)\n (f : unit -> stt a pre post)\n : stt a pre post\nlet perform f = f ()", "val of_msttotal (#s:Type u#2) (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a) (pre:s -> prop) (post:s -> a -> s -> prop)\r\n (f:unit -> M.MSTATETOT a s rel pre post)\r\n: mst rel a pre post\nlet of_msttotal (#s:Type u#2) (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a) (pre:s -> prop) (post:s -> a -> s -> prop)\r\n (f:unit -> M.MSTATETOT a s rel pre post)\r\n: mst rel a pre post\r\n= let f = reify_ f in\r\n fun s -> f s", "val lift_m_x\n (#a: Type u#a)\n (#pre: (a -> slprop))\n (#b: Type u#b)\n (#post: post_t b)\n (#req: (x: a -> req_t (pre x)))\n (#ens: (x: a -> ens_t (pre x) b post))\n (f: (x: a -> repr u#b b (pre x) post (req x) (ens x)))\n (x: U.raise_t u#a u#b a)\n : repr u#(max a b)\n (U.raise_t b)\n ((lift_post pre) x)\n (lift_post post)\n ((lift_req_x req) x)\n ((lift_ens_x ens) x)\nlet lift_m_x (#a:Type u#a) (#pre:a -> slprop)\n (#b:Type u#b) (#post:post_t b) (#req:(x:a -> req_t (pre x))) (#ens:(x:a -> ens_t (pre x) b post))\n (f:(x:a -> repr u#b b (pre x) post (req x) (ens x)))\n: x:U.raise_t u#a u#b a ->\n repr u#(max a b) (U.raise_t b)\n ((lift_post pre) x)\n (lift_post post)\n ((lift_req_x req) x) \n ((lift_ens_x ens) x)\n= fun x -> lift_m (f (U.downgrade_val x))", "val lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift0 e", "val put (#s:Type u#s) (#rel:preorder s) (v:s)\r\n : mst rel unit (fun s0 -> rel s0 v /\\ True) (fun s0 x s1 -> v == s1)\nlet put v\r\n= fun _ -> (), v", "val bind\n (#s #a: _)\n (#srel: erel s)\n (#arel: erel a)\n (#b: _)\n (#brel: erel b)\n ($f: st srel arel)\n (g: arel ^--> st_rel srel brel)\n : st srel brel\nlet bind #s #a (#srel:erel s) (#arel:erel a) #b (#brel:erel b)\n ($f:st srel arel)\n (g:arel ^--> st_rel srel brel)\n : st srel brel =\n fun s0 ->\n let x, s1 = f s0 in\n g x s1", "val lift_pure_nmst\n (a: Type)\n (wp: pure_wp a)\n (state: Type u#2)\n (rel: P.preorder state)\n (f: (eqtype_as_type unit -> PURE a wp))\n : repr a\n state\n rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~(wp (fun r -> r =!= x \\/ s0 =!= s1))))\nlet lift_pure_nmst\n (a:Type)\n (wp:pure_wp a)\n (state:Type u#2)\n (rel:P.preorder state)\n (f:eqtype_as_type unit -> PURE a wp)\n : repr a state rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~ (wp (fun r -> r =!= x \\/ s0 =!= s1))))\n =\n fun (_, n) ->\n elim_pure_wp_monotonicity wp;\n let x = f () in\n x, n", "val to_msttotal (#s:Type u#2) (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a) (pre:s -> prop) (post:s -> a -> s -> prop)\r\n (f:mst rel a pre post)\r\n: M.MSTATETOT a s rel pre post\nlet to_msttotal (#s:Type u#2) (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a) (pre:s -> prop) (post:s -> a -> s -> prop)\r\n (f:mst rel a pre post)\r\n: M.MSTATETOT a s rel pre post\r\n= M.MSTATETOT?.reflect (fun s -> f s)", "val bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\nlet bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\r\n= fun _ -> Sem.mbind (e1()) (fun x -> e2 x ())", "val lift_st_steel\n (a:Type)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:pure_pre)\n (#[@@@ framing_implicit] ens:pure_post a)\n (f:STF.repr a framed pre post req ens)\n : SF.repr a framed pre post (fun _ -> req) (fun _ x _ -> ens x)\nlet lift_st_steel\n (a:Type)\n (#framed:eqtype_as_type bool)\n (#pre:pre_t)\n (#post:post_t a)\n (#req:Type0)\n (#ens:a -> Type0)\n (f:STF.repr a framed pre post req ens)\n : SF.repr a framed pre post (fun _ -> req) (fun _ x _ -> ens x)\n = f", "val run (#st: state u#s u#act) (#pre: st.pred) (#a: Type u#a) (#post: post st a) (f: m a pre post)\n : Dv (nmst_sep st a pre post)\nlet rec run (#st:state u#s u#act) \n (#pre:st.pred)\n (#a:Type u#a) \n (#post:post st a)\n (f:m a pre post)\n: Dv (nmst_sep st a pre post)\n= match f with\n | Ret x -> \n weaken <| return x\n | _ ->\n let k (s:step_result a post st.emp)\n : Dv (nmst_sep st a (Step?.next s) post)\n = let Step _ f = s in\n run f\n in\n weaken <| bind (step f st.emp) k", "val lift_atomic0\n(#a:Type u#0)\n (#obs:_)\n (#opens:inames)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_atomic a #obs opens pre post)\n: stt a pre post\nlet lift_atomic0 = A.lift_atomic0", "val lift_atomic2\n (#a:Type u#2)\n (#obs:_)\n (#opens:inames)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_atomic a #obs opens pre post)\n: stt a pre post\nlet lift_atomic2 = A.lift_atomic2", "val lift_atomic1\n (#a:Type u#1)\n (#obs:_)\n (#opens:inames)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_atomic a #obs opens pre post)\n: stt a pre post\nlet lift_atomic1 = A.lift_atomic1", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val lift_pure_mst\n (a: Type)\n (wp: pure_wp a)\n (state: Type u#2)\n (rel: P.preorder state)\n (f: (eqtype_as_type unit -> PURE a wp))\n : repr a\n state\n rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~(wp (fun r -> r =!= x \\/ s0 =!= s1))))\nlet lift_pure_mst\n (a:Type)\n (wp:pure_wp a)\n (state:Type u#2)\n (rel:P.preorder state)\n (f:eqtype_as_type unit -> PURE a wp)\n : repr a state rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~ (wp (fun r -> r =!= x \\/ s0 =!= s1))))\n =\n elim_pure_wp_monotonicity wp;\n fun s0 ->\n let x = f () in\n x, s0", "val act (#st: state u#s u#act) (#t: Type u#act) (a: action st t) : m t a.pre a.post\nlet act\n (#st:state u#s u#act)\n (#t:Type u#act)\n (a:action st t)\n: m t a.pre a.post\n= Act a Ret", "val lift_neutral_ghost\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_atomic a #Neutral emp_inames pre post)\n: stt_ghost a pre post\nlet lift_neutral_ghost = A.lift_neutral_ghost", "val now\n (#a #pre #post : _)\n (f : unit -> stt a pre post)\n : unit -> stt a pre post\nlet now f () = f ()", "val lift_post (#a: _) (post: post_t u#a a) : post_t u#(max a b) (U.raise_t a)\nlet lift_post #a (post:post_t u#a a)\n: post_t u#(max a b) (U.raise_t a)\n= fun x -> post (U.downgrade_val x)", "val bind\r\n (#s:Type u#s)\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#rel:preorder s)\r\n (#req_f:req_t s)\r\n (#ens_f:ens_t s a)\r\n (#req_g:a -> req_t s)\r\n (#ens_g:a -> ens_t s b)\r\n (f:mst rel a req_f ens_f)\r\n (g:(x:a -> mst rel b (req_g x) (ens_g x)))\r\n: mst rel b\r\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\r\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind f g\r\n= fun s0 ->\r\n let x, s1 = f s0 in\r\n g x s1", "val lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\nlet lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\r\n= Ghost.hide e", "val lift_pure_mst_total\n (a: Type)\n (wp: pure_wp a)\n (state: Type u#2)\n (rel: P.preorder state)\n (f: (eqtype_as_type unit -> PURE a wp))\n : repr a\n state\n rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~(wp (fun r -> r =!= x \\/ s0 =!= s1))))\nlet lift_pure_mst_total\n (a:Type)\n (wp:pure_wp a)\n (state:Type u#2)\n (rel:P.preorder state)\n (f:eqtype_as_type unit -> PURE a wp)\n : repr a state rel\n (fun s0 -> wp (fun _ -> True))\n (fun s0 x s1 -> wp (fun _ -> True) /\\ (~ (wp (fun r -> r =!= x \\/ s0 =!= s1))))\n =\n elim_pure_wp_monotonicity wp;\n fun s0 ->\n let x = f () in\n x, s0", "val sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\nlet sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\r\n= coerce_eq (conv pre1 pre2 post1 post2 pf1 pf2) e", "val par_lpost\n (#st: st)\n (#aL: Type)\n (#preL: st.hprop)\n (#postL: post_t st aL)\n (lpreL: l_pre preL)\n (lpostL: l_post preL postL)\n (#aR: Type)\n (#preR: st.hprop)\n (#postR: post_t st aR)\n (lpreR: l_pre preR)\n (lpostR: l_post preR postR)\n : l_post (preL `st.star` preR) (fun (xL, xR) -> (postL xL) `st.star` (postR xR))\nlet par_lpost\n (#st:st)\n (#aL:Type)\n (#preL:st.hprop)\n (#postL:post_t st aL)\n (lpreL:l_pre preL)\n (lpostL:l_post preL postL)\n (#aR:Type)\n (#preR:st.hprop)\n (#postR:post_t st aR)\n (lpreR:l_pre preR)\n (lpostR:l_post preR postR)\n : l_post (preL `st.star` preR) (fun (xL, xR) -> postL xL `st.star` postR xR)\n =\n fun h0 (xL, xR) h1 -> lpreL h0 /\\ lpreR h0 /\\ lpostL h0 xL h1 /\\ lpostR h0 xR h1", "val lift_observability \r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e1:stt_atomic a #obs opens pre post)\r\n: stt_atomic a #(join_obs obs obs') opens pre post\nlet lift_observability\r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n= e", "val lift_id_st_wp (#a #st: _) (w: ID5.wp a) : wp st a\nlet lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =\n elim_pure_wp_monotonicity_forall ();\n fun s0 p -> w (fun x -> p x s0)", "val return (#s:Type u#s)\r\n (#rel:preorder s)\r\n (#a:Type u#a)\r\n (x:a)\r\n: mst rel a (fun _ -> True) (fun s0 v s1 -> x == v /\\ s0 == s1)\nlet return x\r\n= fun s0 -> x, s0", "val get (#s:Type u#s) (#rel:preorder s) (_:unit)\r\n : mst rel s (fun _ -> True) (fun s0 x s1 -> s0 == s1 /\\ x == s0)\nlet get _\r\n= fun s -> s, s", "val weaken\r\n (#s:Type u#s)\r\n (#rel:preorder s)\r\n (#a:Type u#a)\r\n (#req_f:req_t s)\r\n (#ens_f:ens_t s a)\r\n (#req_g:req_t s)\r\n (#ens_g:ens_t s a)\r\n (f:mst rel a req_f ens_f)\r\n : Pure (mst rel a req_g ens_g)\r\n (requires\r\n (forall s. req_g s ==> req_f s) /\\\r\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\r\n (ensures fun _ -> True)\nlet weaken f\r\n= fun s -> f s", "val lift_ens (#pre #a #post: _) (ens: ens_t u#a pre a post)\n : ens_t u#(max a b) pre (U.raise_t a) (lift_post post)\nlet lift_ens #pre #a #post (ens:ens_t u#a pre a post)\n: ens_t u#(max a b) pre (U.raise_t a) (lift_post post)\n= fun m0 x m1 -> ens m0 (U.downgrade_val x) m1", "val fmul_post:VSig.vale_post fmul_dom\nlet fmul_post : VSig.vale_post fmul_dom =\n fun (c:V.va_code)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (f2:b64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FW.va_ens_Fmul_stdcall c va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) va_s1 f", "val fmul_post:VSig.vale_post fmul_dom\nlet fmul_post : VSig.vale_post fmul_dom =\n fun (c:V.va_code)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FW.va_ens_Fmul c va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) va_s1 f", "val mst (#s:Type u#s)\r\n (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a)\r\n (pre:s -> prop)\r\n (post:s -> a -> s -> prop)\r\n: Type u#(max a s)\nlet mst (#s:Type u#s)\r\n (rel:FStar.Preorder.preorder s)\r\n (a:Type u#a)\r\n (pre:s -> prop)\r\n (post:s -> a -> s -> prop)\r\n = s0:s { pre s0 }\r\n -> Tot (\r\n res:(a & s) {\r\n post s0 res._1 res._2 /\\\r\n rel s0 res._2\r\n }\r\n )", "val lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\nlet lift_ghost_neutral = A.lift_ghost_neutral", "val bind\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#opens:inames)\r\n (#pre1 #post1 #post2:_)\r\n (f:act a opens pre1 post1)\r\n (g:(x:a -> act b opens (post1 x) post2))\r\n: act b opens pre1 post2\nlet bind\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#opens:inames)\r\n (#pre1 #post1 #post2:_)\r\n (f:act a opens pre1 post1)\r\n (g:(x:a -> act b opens (post1 x) post2))\r\n: act b opens pre1 post2\r\n= fun #ictx -> bind_action #a #b #ictx #pre1 #post1 #post2 (f #ictx) (fun x -> g x #ictx)", "val frame_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post: post_t st a)\n (lpre: l_pre pre)\n (lpost: l_post pre post)\n (#frame: st.hprop)\n (f_frame: fp_prop frame)\n : l_post (pre `st.star` frame) (fun x -> (post x) `st.star` frame)\nlet frame_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post:post_t st a)\n (lpre:l_pre pre)\n (lpost:l_post pre post)\n (#frame:st.hprop)\n (f_frame:fp_prop frame)\n : l_post (pre `st.star` frame) (fun x -> post x `st.star` frame)\n =\n fun h0 x h1 -> lpre h0 /\\ lpost h0 x h1 /\\ f_frame h1", "val lift_observability\n (#a:Type u#a)\n (#obs #obs':_)\n (#opens:inames)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_atomic a #obs opens pre post)\n: stt_atomic a #(join_obs obs obs') opens pre post\nlet lift_observability = A.lift_observability", "val sub_stt (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt a pre1 post1)\n: stt a pre2 post2\nlet sub_stt = I.sub", "val get (#s: _) (#srel: erel s) : st srel srel\nlet get #s (#srel:erel s) : st srel srel =\n fun s0 -> s0, s0", "val perform_ghost\n (#a #pre #post : _)\n (f : unit -> stt_ghost a pre post)\n : stt_ghost a pre post\nlet perform_ghost f = f ()", "val bind_stt\n (#a:Type u#a) (#b:Type u#b)\n (#pre1:vprop) (#post1:a -> vprop) (#post2:b -> vprop)\n (e1:stt a pre1 post1)\n (e2:(x:a -> stt b (post1 x) post2))\n: stt b pre1 post2\nlet bind_stt = I.bind", "val lift: t1 -> t2\nlet rec lift : t1 -> t2 =\n function\n | A1 -> A2\n | B1 i -> B2 i\n | C1 f -> C2 (fun x -> lift (f x))", "val lift_atomic_st\n (a:Type)\n (o:eqtype_as_type observability)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:pure_pre)\n (#[@@@ framing_implicit] ens:pure_post a)\n (f:repr a framed Set.empty o pre post req ens)\n : Steel.ST.Effect.repr a framed pre post req ens\nlet lift_atomic_st\n (a:Type)\n (o:eqtype_as_type observability)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:Type0)\n (#[@@@ framing_implicit] ens:a -> Type0)\n (f:repr a framed Set.empty o pre post req ens)\n : Steel.ST.Effect.repr a framed pre post req ens\n = let ff : Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ x _ -> ens x)\n = SEA.lift_atomic_steel a o #framed #pre #post #(fun _ -> req) #(fun _ x _ -> ens x) f\n in\n ff", "val with_pre (pre: vprop) (#a: Type) (#post: (a -> vprop)) (m: stt a emp post)\n : stt a pre (fun v -> pre ** post v)\nlet with_pre (pre:vprop) (#a:Type) (#post:a -> vprop)(m:stt a emp post)\n: stt a pre (fun v -> pre ** post v)\n= let m1 = frame_stt pre m in\n let pf_post : vprop_post_equiv (fun r -> post r ** pre) (fun r -> pre ** post r)\n = intro_vprop_post_equiv _ _ (fun r -> vprop_equiv_comm (post r) pre)\n in\n sub_stt _ _ (vprop_equiv_unit pre) pf_post m1", "val lpost_ret_act\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post: post_t st a)\n (lpost: l_post pre post)\n (x: a)\n (state: st.mem)\n : l_post (post x) post\nlet lpost_ret_act\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post:post_t st a)\n (lpost:l_post pre post)\n (x:a)\n (state:st.mem)\n : l_post (post x) post\n =\n fun _ x h1 -> lpost (st.core state) x h1", "val return_lpre (#st: st) (#a: Type) (#post: post_t st a) (x: a) (lpost: l_post (post x) post)\n : l_pre (post x)\nlet return_lpre (#st:st) (#a:Type) (#post:post_t st a) (x:a) (lpost:l_post (post x) post)\n : l_pre (post x)\n =\n fun h -> lpost h x h", "val frame\r\n (#a:Type u#a)\r\n (#pre:slprop) (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt a pre post)\r\n: stt a (pre ** frame) (fun x -> post x ** frame)\nlet frame\r\n (#a:Type u#a)\r\n (#pre:slprop) (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt a pre post)\r\n: stt a (pre `star` frame) (fun x -> post x `star` frame)\r\n= fun _ -> Sem.frame frame (e())", "val conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\nlet conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\r\n= slprop_equiv_elim pre1 pre2;\r\n introduce forall x. post1 x == post2 x\r\n with slprop_equiv_elim (post1 x) (post2 x);\r\n Sem.conv #state a #pre1 #(F.on_dom _ post1) (F.on_dom _ post2);\r\n ()", "val fmul1_post:VSig.vale_post fmul1_dom\nlet fmul1_post : VSig.vale_post fmul1_dom =\n fun (c:V.va_code)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FH.va_ens_Fmul1_stdcall c va_s0 IA.win (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) va_s1 f", "val fmul1_post:VSig.vale_post fmul1_dom\nlet fmul1_post : VSig.vale_post fmul1_dom =\n fun (c:V.va_code)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FH.va_ens_Fmul1 c va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) va_s1 f", "val st_rel (#s #a: _) (srel: erel s) (arel: erel a) : erel (st srel arel)\nlet st_rel #s #a\n (srel: erel s)\n (arel: erel a)\n : erel (st srel arel)\n = arrow_rel srel (arel ** srel)", "val lift_sta_sa\n (a:Type)\n (#framed:eqtype_as_type bool)\n (#o:inames)\n (#obs:eqtype_as_type observability)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:Type0)\n (#[@@@ framing_implicit] ens:a -> Type0)\n (f:STAG.repr a framed o obs pre post req ens)\n : SA.repr a framed o obs pre post (fun _ -> req) (fun _ x _ -> ens x)\nlet lift_sta_sa\n (a:Type)\n (#framed:eqtype_as_type bool)\n (#o:inames)\n (#obs:eqtype_as_type observability)\n (#pre:pre_t)\n (#post:post_t a)\n (#req:Type0)\n (#ens:a -> Type0)\n (f:STAG.repr a framed o obs pre post req ens)\n : SA.repr a framed o obs pre post (fun _ -> req) (fun _ x _ -> ens x)\n = f", "val lift_mval (smv: s_mval)\n : GTot (imv: i_mval { related_mval smv imv })\nlet lift_mval (smv: s_mval)\n = { left = lift_desc_hash smv.l;\n right = lift_desc_hash smv.r }", "val conv_stt (#a:Type u#a)\n (#pre1:vprop)\n (#pre2:vprop)\n (#post1:a -> vprop)\n (#post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\nlet conv_stt pf1 pf2 = I.conv #_ _ _ _ _ pf1 pf2", "val weaken \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens opens':inames)\r\n (f:act a opens pre post)\r\n: act a (Set.union opens opens') pre post\nlet weaken \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens opens':inames)\r\n (f:act a opens pre post)\r\n: act a (Set.union opens opens') pre post\r\n= f", "val sub \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens:inames)\r\n (pre':slprop { slprop_equiv pre pre' })\r\n (post':a -> slprop { forall x. slprop_equiv (post x) (post' x) })\r\n (f:act a opens pre post)\r\n: act a opens pre' post'\nlet sub \r\n (#a:Type)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (#opens:inames)\r\n (pre':slprop { slprop_equiv pre pre' })\r\n (post':a -> slprop { forall x. slprop_equiv (post x) (post' x) })\r\n (f:act a opens pre post)\r\n: act a opens pre' post'\r\n= I.slprop_equiv_elim pre pre';\r\n introduce forall x. post x == post' x\r\n with I.slprop_equiv_elim (post x) (post' x);\r\n f", "val lift_id_st_wp (#a #st: _) (w: pure_wp a) : wp st a\nlet lift_id_st_wp #a #st (w : pure_wp a) : wp st a =\n elim_pure_wp_monotonicity_forall ();\n fun s0 p -> w (fun x -> p x s0)", "val fmul2_post:VSig.vale_post fmul_dom\nlet fmul2_post : VSig.vale_post fmul_dom =\n fun (c:V.va_code)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (f2:b64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FW.va_ens_Fmul2_stdcall c va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) va_s1 f", "val fmul2_post:VSig.vale_post fmul_dom\nlet fmul2_post : VSig.vale_post fmul_dom =\n fun (c:V.va_code)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n FW.va_ens_Fmul2 c va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) va_s1 f", "val ( ^+^ )\n (#a #b: Type0)\n (#rel1: preorder a)\n (#rel2: preorder b)\n (r1: mref a rel1)\n (r2: mref b rel2)\n : GTot (set nat)\nlet op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2)\n :GTot (set nat) = S.union (only r1) (only r2)", "val reflect\n (#a: Type)\n (#pre: pre_t)\n (#post: post_t a)\n (#req: Type0)\n (#ens: (a -> Type0))\n ($f: STF.repr a false pre post req ens)\n : STF.ST a pre post req ens\nlet reflect (#a:Type)\n (#pre:pre_t)\n (#post:post_t a)\n (#req:Type0)\n (#ens:a -> Type0)\n ($f:STF.repr a false pre post req ens)\n : STF.ST a pre post req ens\n = STF.STBase?.reflect f", "val par_stt\n (#preL:vprop)\n (#postL:vprop) \n (#preR:vprop)\n (#postR:vprop)\n (f:stt unit preL (fun _ -> postL))\n (g:stt unit preR (fun _ -> postR))\n: stt unit\n (preL ** preR)\n (fun _ -> postL ** postR)\nlet par_stt = I.par", "val lift_ens_x\n (#a: Type u#a)\n (#pre: (a -> slprop))\n (#b: Type u#b)\n (#post: _)\n (ens: (x: a -> ens_t u#b (pre x) b post))\n (x: U.raise_t u#a u#b a)\n : ens_t u#(max a b) ((lift_post pre) x) (U.raise_t b) (lift_post post)\nlet lift_ens_x (#a:Type u#a) (#pre:a -> slprop)\n (#b:Type u#b) (#post:_)\n (ens:(x:a -> ens_t u#b (pre x) b post))\n: x:U.raise_t u#a u#b a ->\n ens_t u#(max a b) ((lift_post pre) x) (U.raise_t b) (lift_post post)\n= fun x -> (fun m0 y m1 -> (ens (U.downgrade_val x)) m0 (U.downgrade_val y) m1)", "val liftM : ('a -> 'b) -> (tm 'a -> tm 'b)\nlet liftM f x =\n let! xx = x in\n return (f xx)", "val lift_tid (st: s_tid) : i_tid\nlet lift_tid (st: s_tid)\n : i_tid\n = U16.v st", "val bind_lift\n (a: Type u#a)\n (b: Type u#b)\n (pre_f: pre_t)\n (post_f: post_t a)\n (req_f: req_t pre_f)\n (ens_f: ens_t pre_f a post_f)\n (post_g: post_t b)\n (req_g: (x: a -> req_t (post_f x)))\n (ens_g: (x: a -> ens_t (post_f x) b post_g))\n (f: repr a pre_f post_f req_f ens_f)\n (g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n : repr u#(max a b)\n (U.raise_t b)\n pre_f\n (lift_post post_g)\n (Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))\n (Sem.bind_lpost u#(max a b) u#(max a b) #state #(U.raise_t u#a u#b a) #pre_f\n #(lift_post post_f) req_f (lift_ens ens_f) #(U.raise_t b) #(lift_post post_g)\n (lift_ens_x ens_g))\nlet bind_lift (a:Type u#a) (b:Type u#b)\n (pre_f:pre_t) (post_f:post_t a)\n (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (post_g:post_t b)\n (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))\n (f:repr a pre_f post_f req_f ens_f)\n (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n: repr u#(max a b) (U.raise_t b)\n pre_f\n (lift_post post_g)\n (Sem.bind_lpre req_f (lift_ens ens_f) (lift_req_x req_g))\n (Sem.bind_lpost u#(max a b) u#(max a b)\n #state #(U.raise_t u#a u#b a) #pre_f #(lift_post post_f)\n req_f (lift_ens ens_f)\n #(U.raise_t b) #(lift_post post_g)\n (lift_ens_x ens_g))\n= let f = lift_m f in\n let g = lift_m_x g in\n Sem.Bind f g", "val frame\r\n (#a:Type u#a)\r\n (#opens:inames)\r\n (#pre #post #frame:_)\r\n (f:act a opens pre post)\r\n: act a opens (pre ** frame) (fun x -> post x ** frame)\nlet frame\r\n (#a:Type u#a)\r\n (#opens:inames)\r\n (#pre #post #frame:_)\r\n (f:act a opens pre post)\r\n: act a opens (pre `star` frame) (fun x -> post x `star` frame)\r\n= fun #ictx -> frame_action (f #ictx)", "val sel: #a:Type0 -> #rel:preorder a -> heap -> mref a rel -> GTot a\nlet sel #a #rel h r =\n if h `contains_bool` r\n then sel_tot #a h r\n else r.init", "val m (a: Type u#aa) (i: idx) (pre: st_pre) (post: st_bpost a) : Type0\nlet m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =\n unit -> ST a pre (real_post i post)", "val promote_seq: #a: _ -> #pre: _ -> #post: _ -> f: stt a pre post -> par_env -> unit\n -> stt a pre post\nlet promote_seq #a #pre #post\n (f: stt a pre post)\n: par_env -> unit -> stt a pre post\n= (fun _ -> fun _ -> f)", "val lift_read\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n : Tot\n (repr a r (r) (fun _ -> pre) (fun st x st' -> st == st' /\\ post x) (fun _ -> post_err ()) inv)\nlet lift_read\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n: Tot (repr a r (r)\n (fun _ -> pre) // (lift_read_pre pre r)\n (fun st x st' -> st == st' /\\ post x) // (lift_read_post a pre post r)\n (fun _ -> post_err ()) // (lift_read_post_err pre post_err r))\n inv\n )\n= Repr (lift_read_spec a pre post post_err inv r f_read_spec) (lift_read_impl a pre post post_err inv r f_read_spec)", "val frame_stt\n (#a:Type u#a)\n (#pre:vprop) (#post:a -> vprop)\n (frame:vprop)\n (e:stt a pre post)\n: stt a (pre ** frame) (fun x -> post x ** frame)\nlet frame_stt = I.frame", "val ( ! ) (#a: Type) (#rel: preorder a) (r: mref a rel) : STATE a (fun p h -> p (sel h r) h)\nlet op_Bang (#a:Type) (#rel:preorder a) (r:mref a rel)\n : STATE a (fun p h -> p (sel h r) h)\n= read #a #rel r", "val transport_gmst_rel\n (#a: Type)\n (#rel1: relation state)\n (#rel2: relation state {rel1 == rel2})\n (#wp: mst_wp state a rel1)\n (f: (unit -> GMST a (rel1 >< wp)))\n : GMST a (rel2 >< wp)\nlet transport_gmst_rel (#a:Type) (#rel1:relation state) (#rel2:relation state{rel1 == rel2})\n (#wp:mst_wp state a rel1) \n (f:unit -> GMST a (rel1 >< wp)) : GMST a (rel2 >< wp)\n = f ()", "val stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\nlet stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\r\n= lower (Sem.m u#2 u#100 u#a #state a pre (F.on_dom a post))", "val ta_pre:VSig.vale_pre ta_dom\nlet ta_pre : VSig.vale_pre ta_dom =\n fun (c:V.va_code)\n (arg0:ib64)\n (arg1:ib64)\n (arg2:ib64)\n (arg3:ib64)\n (arg4:ib64)\n (arg5:ib64)\n (arg6:ib64)\n (arg7:ib64)\n (va_s0:V.va_state) ->\n TA.va_req_Test c va_s0 IA.win\n (as_vale_immbuffer arg0)\n (as_vale_immbuffer arg1)\n (as_vale_immbuffer arg2)\n (as_vale_immbuffer arg3)\n (as_vale_immbuffer arg4)\n (as_vale_immbuffer arg5)\n (as_vale_immbuffer arg6)\n (as_vale_immbuffer arg7)", "val nat_rel:preorder nat\nlet nat_rel : preorder nat = nat_rel'", "val nat_rel:preorder nat\nlet nat_rel : preorder nat = nat_rel'", "val stt_of_action (#a: Type u#100) (#pre #post: _) (m: action a Set.empty pre post) : stt a pre post\nlet stt_of_action (#a:Type u#100) #pre #post (m:action a Set.empty pre post)\r\n: stt a pre post\r\n= let step (frame:slprop)\r\n : Sem.mst_sep state a (pre `star` frame) (fun x -> post x `star` frame)\r\n = M.weaken (m frame)\r\n in\r\n let action : Sem.action state a = {pre=pre; post=F.on_dom _ post; step} in\r\n let m : Sem.m a pre _ = Sem.act action in\r\n fun _ -> m", "val alloc (#a: Type) (#rel: preorder a) (init: a)\n : ST (mref a rel)\n (fun h -> True)\n (fun h0 r h1 -> fresh r h0 h1 /\\ modifies Set.empty h0 h1 /\\ sel h1 r == init)\nlet alloc (#a:Type) (#rel:preorder a) (init:a)\n :ST (mref a rel)\n (fun h -> True)\n (fun h0 r h1 -> fresh r h0 h1 /\\ modifies Set.empty h0 h1 /\\ sel h1 r == init)\n = let h0 = gst_get () in\n let r, h1 = alloc rel h0 init false in\n gst_put h1;\n gst_witness (contains_pred r);\n r", "val put (#state: Type u#2) (#rel: P.preorder state) (s: state)\n : NMSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)\nlet put (#state:Type u#2) (#rel:P.preorder state) (s:state)\n : NMSTATETOT unit state rel\n (fun s0 -> rel s0 s)\n (fun _ _ s1 -> s1 == s)\n =\n NMSTATETOT?.reflect (fun (_, n) -> MSTTotal.put s, n)", "val wrap (#n: arity{n > 0}) (#pre: vale_pre n) (#post: vale_post n) (v: vale_sig n pre post)\n : as_lowstar_sig n pre post\nlet rec wrap\n (#n:arity{n > 0})\n (#pre:vale_pre n)\n (#post:vale_post n)\n (v:vale_sig n pre post)\n : as_lowstar_sig n pre post\n =\n let rec aux (m:arity{0 < m /\\ m <= n}) //number of arguments still to be received\n (regs:registers) //arguments already received in registers\n : Tot (as_lowstar_sig m (elim_m m pre regs) (elim_m m post regs))\n = let pre0 = pre in\n let post0 = post in\n let pre = elim_m m pre0 regs in\n let post = elim_m m post regs in\n match m with\n | 1 -> //last argument\n let f : x:uint_64\n -> ST unit\n (requires (fun h -> elim #1 pre x h))\n (ensures (fun h0 _ h1 -> elim #1 post x h0 h1)) =\n fun (x:uint_64) ->\n //Get the initial Low* state\n let h0 = get () in\n //Add the last argument into the registers\n let state = {\n registers = Map.upd regs (as_reg (1 + max_arity - m)) x;\n memory = h0;\n } in\n //Apply the vale function\n //and replace the Low* state\n gput (fun () -> (v state).memory)\n in\n (f <: as_lowstar_sig 1 pre post)\n\n | _ ->\n let f : x:uint_64\n -> as_lowstar_sig\n (m - 1)\n (elim_1 pre x)\n (elim_1 post x) =\n fun (x:uint_64) -> \n let i = (1 + max_arity - m) in //`x` is the `i`th argument\n let regs1 = (Map.upd regs (as_reg i) x) in //add it to the registers\n //explicit typing annotation to allow unfolding recursive definition\n let v : as_lowstar_sig (m - 1) (elim_m (m - 1) pre regs1) (elim_m (m - 1) post regs1) =\n aux (m - 1) regs1 //recurse\n in\n v\n in\n f\n in\n aux n (Map.const 0uL)", "val ( ++^ ) (#a: Type0) (#rel: preorder a) (s: set nat) (r: mref a rel) : GTot (set nat)\nlet op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r)", "val stronger_post_par_r\n (#st: st)\n (#aL #aR: Type u#a)\n (postL: post_t st aL)\n (postR next_postR: post_t st aR)\n : Lemma (requires stronger_post postR next_postR)\n (ensures\n forall xL xR frame h.\n st.interp (((postL xL) `st.star` (next_postR xR)) `st.star` frame) h ==>\n st.interp (((postL xL) `st.star` (postR xR)) `st.star` frame) h)\nlet stronger_post_par_r (#st:st) (#aL #aR:Type u#a)\n (postL:post_t st aL) (postR:post_t st aR) (next_postR:post_t st aR)\n: Lemma\n (requires stronger_post postR next_postR)\n (ensures\n forall xL xR frame h.\n st.interp ((postL xL `st.star` next_postR xR) `st.star` frame) h ==>\n st.interp ((postL xL `st.star` postR xR) `st.star` frame) h)\n= let aux xL xR frame h\n : Lemma\n (requires st.interp ((postL xL `st.star` next_postR xR) `st.star` frame) h)\n (ensures st.interp ((postL xL `st.star` postR xR) `st.star` frame) h)\n [SMTPat ()]\n = calc (st.equals) {\n (postL xL `st.star` next_postR xR) `st.star` frame;\n (st.equals) { }\n (next_postR xR `st.star` postL xL) `st.star` frame;\n (st.equals) { }\n next_postR xR `st.star` (postL xL `st.star` frame);\n };\n assert (st.interp (next_postR xR `st.star` (postL xL `st.star` frame)) h);\n assert (st.interp (postR xR `st.star` (postL xL `st.star` frame)) h);\n calc (st.equals) {\n postR xR `st.star` (postL xL `st.star` frame);\n (st.equals) { }\n (postR xR `st.star` postL xL) `st.star` frame;\n (st.equals) { }\n (postL xL `st.star` postR xR) `st.star` frame;\n }\n in\n ()", "val stronger_post_par_r\n (#st: st)\n (#aL #aR: Type u#a)\n (postL: post_t st aL)\n (postR next_postR: post_t st aR)\n : Lemma (requires stronger_post postR next_postR)\n (ensures\n forall xL xR frame h.\n st.interp (((postL xL) `st.star` (next_postR xR)) `st.star` frame) h ==>\n st.interp (((postL xL) `st.star` (postR xR)) `st.star` frame) h)\nlet stronger_post_par_r\n (#st:st)\n (#aL #aR:Type u#a)\n (postL:post_t st aL)\n (postR:post_t st aR)\n (next_postR:post_t st aR)\n : Lemma\n (requires stronger_post postR next_postR)\n (ensures\n forall xL xR frame h.\n st.interp ((postL xL `st.star` next_postR xR) `st.star` frame) h ==>\n st.interp ((postL xL `st.star` postR xR) `st.star` frame) h)\n =\n let aux xL xR frame h\n : Lemma\n (requires st.interp ((postL xL `st.star` next_postR xR) `st.star` frame) h)\n (ensures st.interp ((postL xL `st.star` postR xR) `st.star` frame) h)\n [SMTPat ()]\n =\n calc (st.equals) {\n (postL xL `st.star` next_postR xR) `st.star` frame;\n (st.equals) { }\n (next_postR xR `st.star` postL xL) `st.star` frame;\n (st.equals) { }\n next_postR xR `st.star` (postL xL `st.star` frame);\n };\n assert (st.interp (next_postR xR `st.star` (postL xL `st.star` frame)) h);\n assert (st.interp (postR xR `st.star` (postL xL `st.star` frame)) h);\n calc (st.equals) {\n postR xR `st.star` (postL xL `st.star` frame);\n (st.equals) { }\n (postR xR `st.star` postL xL) `st.star` frame;\n (st.equals) { }\n (postL xL `st.star` postR xR) `st.star` frame;\n }\n in\n ()", "val stt (a:Type u#a) (pre:vprop) (post:a -> vprop) : Type0\nlet stt = I.stt", "val put (#s: _) (#srel: erel s) : (srel ^--> st_rel srel (lo unit))\nlet put #s (#srel:erel s) : (srel ^--> st_rel srel (lo unit)) =\n fun s _ -> (), s", "val ( ^++ ) (#a: Type0) (#rel: preorder a) (r: mref a rel) (s: set nat) : GTot (set nat)\nlet op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s" ], "closest_src": [ { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift1" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift0" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift2" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.lift_nmst_total_nmst" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.hide_div" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.hide_div" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpost" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.lift_mst_total_mst" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic1" }, { "project_name": "steel", "file_name": "Pulse.Lib.Pervasives.fst", "name": "Pulse.Lib.Pervasives.perform" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.of_msttotal" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.lift_m_x" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic0" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.put" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.bind" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.lift_pure_nmst" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.to_msttotal" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.bind" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.lift_st_steel" }, { "project_name": "steel", "file_name": "PulseCore.Semantics.fst", "name": "PulseCore.Semantics.run" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_atomic0" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_atomic2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_atomic1" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.lift_pure_mst" }, { "project_name": "steel", "file_name": "PulseCore.Semantics.fst", "name": "PulseCore.Semantics.act" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_neutral_ghost" }, { "project_name": "steel", "file_name": "Async.fst", "name": "Async.now" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.lift_post" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.bind" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_neutral_ghost" }, { "project_name": "FStar", "file_name": "FStar.MSTTotal.fst", "name": "FStar.MSTTotal.lift_pure_mst_total" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.sub" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.par_lpost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_observability" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.lift_id_st_wp" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.return" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.get" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.weaken" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.lift_ens" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul_post" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul_post" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.mst" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_ghost_neutral" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.bind" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.frame_lpost" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_observability" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.sub_stt" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.get" }, { "project_name": "steel", "file_name": "Pulse.Lib.Pervasives.fst", "name": "Pulse.Lib.Pervasives.perform_ghost" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.bind_stt" }, { "project_name": "FStar", "file_name": "Postprocess.fst", "name": "Postprocess.lift" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.lift_atomic_st" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.with_pre" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.lpost_ret_act" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.return_lpre" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.frame" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.conv" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul1_post" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul1_post" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.st_rel" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.lift_sta_sa" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fst", "name": "Zeta.Steel.Rel.lift_mval" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.conv_stt" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.weaken" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.sub" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.lift_id_st_wp" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul2_post" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul2_post" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Hat_Plus_Hat" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.reflect" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.par_stt" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.lift_ens_x" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Arith.fst", "name": "FStar.Reflection.V2.Arith.liftM" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.lift_tid" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.bind_lift" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.frame" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.sel" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.m" }, { "project_name": "steel", "file_name": "Domains.fst", "name": "Domains.promote_seq" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.lift_read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.frame_stt" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.op_Bang" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.transport_gmst_rel" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.stt" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.ta_pre" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.nat_rel" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.nat_rel" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.stt_of_action" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.alloc" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.put" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.wrap" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Plus_Plus_Hat" }, { "project_name": "steel", "file_name": "CSL.Semantics.fst", "name": "CSL.Semantics.stronger_post_par_r" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.stronger_post_par_r" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.stt" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.put" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Hat_Plus_Plus" } ], "selected_premises": [ "PulseCore.MonotonicStateMonad.get", "PulseCore.NondeterministicMonotonicStateMonad.nmst", "PulseCore.MonotonicStateMonad.weaken", "PulseCore.MonotonicStateMonad.put", "PulseCore.NondeterministicMonotonicStateMonad.tape", "PulseCore.NondeterministicMonotonicStateMonad.ctr", "FStar.Pervasives.reveal_opaque", "PulseCore.MonotonicStateMonad.witnessed", "PulseCore.MonotonicStateMonad.return", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "PulseCore.MonotonicStateMonad.witness", "PulseCore.MonotonicStateMonad.of_msttotal", "PulseCore.NondeterministicMonotonicStateMonad.nmst'", "PulseCore.MonotonicStateMonad.mst", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "PulseCore.MonotonicStateMonad.bind", "PulseCore.MonotonicStateMonad.to_msttotal", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.MSTTotal.get", "FStar.MSTTotal.put", "FStar.MSTTotal.subcomp", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.MSTTotal.return", "FStar.Preorder.preorder_rel", "FStar.MSTTotal.bind", "FStar.Witnessed.Core.s_predicate", "FStar.Pervasives.st_post_h", "FStar.MSTTotal.mst_tot_assert", "FStar.MSTTotal.lift_pure_mst_total", "Prims.op_Hat", "FStar.Monotonic.Pure.is_monotonic", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.ex_pre", "FStar.Pervasives.st_return", "Prims.min", "Prims.pure_post'", "Prims.pure_wp_monotonic", "Prims.returnM", "FStar.Preorder.stable", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_trivial", "Prims.pure_post", "FStar.Pervasives.id", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.ex_post'", "FStar.Preorder.reflexive", "FStar.Pervasives.all_post_h'", "Prims.abs", "FStar.Pervasives.all_post_h", "FStar.Preorder.transitive", "FStar.Pervasives.st_if_then_else", "Prims.pure_trivial", "Prims.pure_pre", "FStar.Pervasives.ex_post", "FStar.Monotonic.Pure.elim_pure", "FStar.Pervasives.pure_return", "FStar.Pervasives.pure_null_wp", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.ex_return", "FStar.Pervasives.pure_ite_wp", "Prims.pure_wp_monotonic0", "Prims.purewp_id", "FStar.Pervasives.all_pre_h", "Prims.as_requires", "Prims.pure_wp", "FStar.Pervasives.all_return", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.all_if_then_else", "Prims.pure_wp'", "Prims.pure_stronger", "FStar.Pervasives.ex_wp", "FStar.Pervasives.lift_div_exn", "FStar.Witnessed.Core.stable", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_trivial", "Prims.subtype_of", "FStar.Pervasives.ex_stronger", "Prims.__cache_version_number__", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.all_close_wp", "Prims.as_ensures", "FStar.Pervasives.ex_bind_wp", "Prims.pow2", "FStar.Pervasives.all_stronger", "Prims.l_True", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.all_wp_h" ], "source_upto_this": "module PulseCore.NondeterministicMonotonicStateMonad\nopen FStar.Preorder\nfriend PulseCore.MonotonicStateMonad\nmodule M = PulseCore.MonotonicStateMonad\n#push-options \"--print_universes\"\n\nlet tape = nat -> bool\nlet ctr = nat\n\nlet nmst' (#s:Type u#s)\n (rel:FStar.Preorder.preorder s)\n (a:Type u#a)\n (pre:s -> prop)\n (post:s -> a -> s -> prop)\n = s0:s { pre s0 }\n -> tape\n -> ctr\n -> Dv (\n res:(a & s & ctr) {\n post s0 res._1 res._2 /\\\n rel s0 res._2\n }\n )\n\nlet nmst #s rel a pre post =\n unit -> Dv (nmst' #s rel a pre post)\n", "sketch": [ "The definition is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 1: We want to define a function that lifts a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 2: The lift function takes a computation from the monotonic state monad and wraps it in the context of the nondeterministic monotonic state monad.", "The definition of `lift` is about lifting a computation from the `MonotonicStateMonad` to the `NondeterministicMonotonicStateMonad`.\n\nThe implementation of the `lift` function involves taking a computation `f` from the `MonotonicStateMonad` and lifting it to the `NondeterministicMonotonicStateMonad` by wrapping it in a `Dv` constructor.", "The definition is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 1: We want to define a function that lifts a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 2: To implement the lift function, we need to take a computation in the monotonic state monad and wrap it in the context of the nondeterministic monotonic state monad.", "The definition is about lifting a computation in the monotonic state monad to the nondeterministic monotonic state monad.\n\nThe implementation involves taking a computation in the monotonic state monad and wrapping it in the context of the nondeterministic monotonic state monad.", "The definition of the function \"lift\" is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nThe implementation of the \"lift\" function involves taking a computation in the monotonic state monad and wrapping it in the context of the nondeterministic monotonic state monad.", "The definition is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 1: We want to define a function that lifts a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 2: The lift function takes a computation in the monotonic state monad and wraps it in the context of the nondeterministic monotonic state monad.", "The definition of the `lift` function is about lifting a computation from the `MonotonicStateMonad` to the `NondeterministicMonotonicStateMonad`.\n\nStep 1: The `lift` function takes a computation in the `MonotonicStateMonad` and lifts it to the `NondeterministicMonotonicStateMonad`.\n\nStep 2: To implement the `lift` function, we need to create a new computation in the `NondeterministicMonotonicStateMonad` that wraps the computation from the `MonotonicStateMonad` and maintains the properties of the `NondeterministicMonotonicStateMonad`.", "The definition is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 1: We want to define a function that lifts a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nStep 2: The lift function takes a computation in the monotonic state monad and wraps it in the context of the nondeterministic monotonic state monad.", "The definition of the function \"lift\" is about lifting a computation from the Monotonic State Monad to the Nondeterministic Monotonic State Monad.\n\nThe implementation of the \"lift\" function involves taking a computation in the Monotonic State Monad and wrapping it in the Nondeterministic Monotonic State Monad, ensuring that the pre and post conditions are preserved.", "The definition of the function `lift` is about lifting a computation from the monotonic state monad to the nondeterministic monotonic state monad.\n\nThe implementation of the `lift` function involves taking a computation in the monotonic state monad and lifting it to the nondeterministic monotonic state monad by wrapping it in the `nmst` constructor." ], "generated_solution": [ "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.runM f", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> Dv (fun s0 tape ctr ->\n f () s0 tape ctr\n )", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.bind f (fun res -> nmst' #s rel a pre post (fun s0 _ _ -> res))", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.runM f", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.bind (f ()) (fun res -> nmst' #s rel a pre post (fun _ -> pre) (fun _ a _ -> post a))", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.bind (f ()) (fun res -> nmst' #s rel a pre post (fun _ -> pre) (fun _ _ _ -> post))", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.runM f", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.runM f", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> M.bind f (fun (x, s, c) -> nmst' #s rel a pre post s x c)", "let lift #s #rel #a #pre #post (f:M.mst #s rel a pre post) : nmst #s rel a pre post =\n fun () -> Dv (fun s0 tape ctr ->\n M.runMst f () s0 tape ctr\n )" ] }, { "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.to_lseq", "opens_and_abbrevs": [ { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Lib" }, { "open": "Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 15, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len", "source_definition": "let to_lseq #a #len l =\n normalize_term (Lib.Sequence.createi len (index l))", "source_range": { "start_line": 76, "start_col": 0, "end_line": 77, "end_col": 53 }, "interleaved": false, "definition": "fun l -> FStar.Pervasives.normalize_term (Lib.Sequence.createi len (Lib.NTuple.index l))", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Lib.NTuple.flen", "Lib.NTuple.ntuple", "FStar.Pervasives.normalize_term", "Lib.Sequence.lseq", "Lib.Sequence.createi", "Lib.NTuple.index" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "l: Lib.NTuple.ntuple a len -> Lib.Sequence.lseq a len", "prompt": "let to_lseq #a #len l =\n ", "expected_response": "normalize_term (Lib.Sequence.createi len (index l))", "source": { "project_name": "hacl-star", "file_name": "lib/Lib.NTuple.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Lib.NTuple.fst", "checked_file": "dataset/Lib.NTuple.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [ "let max_ntuple_len = max_size_t", "let length (#a:Type0) (#len:flen) (s: ntuple a len) : flen = len", "let flen = size_pos", "let fst_ (#a:Type0) (#len:flen) (s:ntuple_ a len) : a =\n if len = 1 then s\n else fst (s <: a & ntuple_ a (len - 1))", "let rec ntuple_ (a:Type0) (len:flen) =\n if len = 1 then a\n else a & ntuple_ a (len-1)", "let fst #a #len (s:ntuple a len) =\n normalize_term (fst_ #a #len s)", "let ntuple (a:Type0) (len:flen) = normalize_term (ntuple_ a len)", "let rest_ (#a:Type0) (#len:flen{len > 1}) (s:ntuple_ a len) : ntuple_ a (len - 1)=\n snd (s <: a & ntuple_ a (len - 1))", "val fst (#a:Type0) (#len:flen) (s:ntuple a len) : a", "let rest #a #len s =\n normalize_term (rest_ #a #len s)", "val rest (#a:Type0) (#len:flen{len > 1}) (s:ntuple a len) : ntuple a (len - 1)", "let rec index_ (#a:Type0) (#len:flen) (s:ntuple a len) (i:nat{i < len}) =\n if i = 0 then fst s\n else (assert (len > 1);\n index_ #a #(len-1) (rest s) (i-1))", "val index (#a:Type0) (#len:flen) (s:ntuple a len) (i:nat{i < len}) : a", "val index_fst_lemma (#a:Type0) (#len:flen) (s:ntuple a len) :\n Lemma (fst s == index s 0)\n [SMTPat (fst s)]", "let index #a #len s i =\n normalize_term (index_ s i)", "val createi (#a:Type0) (len:flen) (f:(i:nat{i < len} -> a)) : ntuple a len", "let index_fst_lemma #a #len s = ()", "val gcreatei (#a:Type0) (len:flen) (f:(i:nat{i < len} -> GTot a)) : GTot (ntuple a len)", "let rec createi_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> a)) :\n Tot (ntuple_ a (max - min)) (decreases (max - min))\n =\n if min + 1 = max then f min\n else f min, createi_ #a (min+1) max f", "val createi_lemma (#a:Type0) (len:flen) (f:(i:nat{i < len} -> a)) (i:nat{i < len}) :\n Lemma (index (createi #a len f) i == f i)\n [SMTPat (index (createi #a len f) i)]", "val gcreatei_lemma (#a:Type0) (len:flen) (f:(i:nat{i < len} -> GTot a)) (i:nat{i < len}) :\n Lemma (index (gcreatei #a len f) i == f i)\n [SMTPat (index (gcreatei #a len f) i)]", "let createi #a len f =\n normalize_term (createi_ #a 0 len f)", "let rec gcreatei_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> GTot a)) :\n GTot (ntuple_ a (max - min)) (decreases (max - min))\n =\n if min + 1 = max then f min\n else f min, gcreatei_ #a (min+1) max f", "val to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len", "val to_lseq_index (#a:Type0) (#len:flen) (l:ntuple a len) (i:nat{i < len}) :\n Lemma (index l i == Lib.Sequence.index (to_lseq l) i)", "let gcreatei #a len f =\n normalize_term (gcreatei_ #a 0 len f)", "val from_lseq (#a:Type0) (#len:flen) (s:Lib.Sequence.lseq a len) : ntuple a len", "let rec createi_lemma_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> a)) (i:nat{i < max - min}) :\n Lemma (ensures (index #a #(max - min) (createi_ #a min max f) i == f (min+i))) (decreases i)\n =\n if i = 0 then ()\n else createi_lemma_ #a (min+1) max f (i-1)", "val create (#a:Type0) (len:flen) (init:a) : ntuple a len", "val create_lemma (#a:Type0) (len:flen) (init:a) (i:nat{i < len}) :\n Lemma (index (create #a len init) i == init)\n [SMTPat (index (create #a len init) i)]", "let createi_lemma #a len f i =\n createi_lemma_ #a 0 len f i", "val concat (#a:Type0) (#len0:flen) (#len1:flen{len0 + len1 <= max_size_t})\n\t (s0:ntuple a len0) (s1:ntuple a len1) : ntuple a (len0 + len1)", "let rec gcreatei_lemma_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> GTot a)) (i:nat{i < max - min}) :\n Lemma (ensures (index #a #(max - min) (gcreatei_ #a min max f) i == f (min+i))) (decreases i)\n =\n if i = 0 then ()\n else gcreatei_lemma_ #a (min+1) max f (i-1)", "val concat_lemma (#a:Type0) (#len0:flen) (#len1:flen) (s0:ntuple a len0) (s1:ntuple a len1) (i:nat):\n Lemma\n (requires (len0 + len1 <= max_size_t /\\ i < len0 + len1))\n (ensures ((i < len0 ==> index (concat s0 s1) i == index s0 i) /\\\n (i >= len0 ==> index (concat s0 s1) i == index s1 (i-len0))))\n [SMTPat (index (concat #a #len0 #len1 s0 s1) i)]", "let gcreatei_lemma #a len f i =\n gcreatei_lemma_ #a 0 len f i" ], "closest": [ "val to_seq (#a: Type0) (#len: size_nat) (l: lseq a len) : seq a\nlet to_seq (#a:Type0) (#len:size_nat) (l:lseq a len) : seq a = l", "val Lib.Sequence.lseq = a: Type0 -> len: Lib.IntTypes.size_nat -> Type0\nlet lseq (a:Type0) (len:size_nat) = s:seq a{Seq.length s == len}", "val as_seq (#t: buftype) (#a: Type0) (#len: size_t) (h: HS.mem) (b: lbuffer_t t a len)\n : GTot (Seq.lseq a (v len))\nlet as_seq (#t:buftype) (#a:Type0) (#len:size_t) (h:HS.mem) (b:lbuffer_t t a len) :\n GTot (Seq.lseq a (v len)) =\n match t with\n | MUT -> B.as_seq h (b <: buffer a)\n | IMMUT -> IB.as_seq h (b <: ibuffer a)\n | CONST -> CB.as_seq h (b <: cbuffer a)", "val pn_as_seq (#t: buftype) (#a: Type0) (#len: size_t) (h: mem) (b: lbuffer_t_or_null t a len)\n : GTot (option (Seq.lseq a (v len)))\nlet pn_as_seq (#t : buftype) (#a : Type0) (#len : size_t)\n (h : mem) (b : lbuffer_t_or_null t a len) :\n GTot (option (Seq.lseq a (v len))) =\n if g_is_null b then None else (Some (as_seq h (b <: lbuffer_t t a len)))", "val to_lseq (#a: Type0) (s: seq a {length s <= max_size_t}) : l: lseq a (length s) {l == s}\nlet to_lseq (#a:Type0) (s:seq a{length s <= max_size_t}) : l:lseq a (length s){l == s} = s", "val Lib.NTuple.ntuple = a: Type0 -> len: Lib.NTuple.flen -> Type0\nlet ntuple (a:Type0) (len:flen) = normalize_term (ntuple_ a len)", "val nn_as_seq (#t: buftype) (#a: Type0) (#len: size_t) (h: mem) (b: lbuffer_t_or_null t a len)\n : Ghost (S.lseq a (v len)) (requires (not (g_is_null b))) (ensures (fun _ -> True))\nlet nn_as_seq (#t : buftype) (#a : Type0) (#len : size_t)\n (h : mem) (b : lbuffer_t_or_null t a len) :\n Ghost (S.lseq a (v len))\n (requires (not (g_is_null b))) (ensures (fun _ -> True)) =\n as_seq h (b <: lbuffer_t t a len)", "val as_seq (#t: buftype) (#a: Type0) (h: mem) (b: buffer_t t a) : GTot (Seq.lseq a (length b))\nlet as_seq (#t:buftype) (#a:Type0) (h:mem) (b:buffer_t t a) :\n GTot (Seq.lseq a (length b)) =\n match t with\n | MUT -> B.as_seq h (b <: buffer a)\n | IMMUT -> IB.as_seq h (b <: ibuffer a)\n | CONST -> CB.as_seq h (b <: cbuffer a)", "val Lib.NTuple.ntuple_ = a: Type0 -> len: Lib.NTuple.flen -> Type0\nlet rec ntuple_ (a:Type0) (len:flen) =\n if len = 1 then a\n else a & ntuple_ a (len-1)", "val ntup1 (#a: _) (#l: flen{l = 1}) (t: a) : ntuple a l\nlet ntup1 #a (#l:flen{l = 1}) (t:a) : ntuple a l =\n assert (ntuple a l == ntuple a 1);\n t <: ntuple a 1", "val tup1 (#a: _) (#l: flen{l = 1}) (t: ntuple a l) : a\nlet tup1 #a (#l:flen{l = 1}) (t:ntuple a l) : a =\n assert (ntuple a l == ntuple a 1);\n t <: ntuple a 1", "val list_to_seq (#a: Type) (l: list a)\n : (s: (S.seq a){S.length s = List.Tot.length l /\\ (forall i. S.index s i == List.Tot.index l i)}\n )\nlet rec list_to_seq (#a:Type) (l:list a) : (s:(S.seq a){S.length s = List.Tot.length l /\\ (forall i. S.index s i == List.Tot.index l i)}) =\n match l with\n | [] -> S.empty\n | h :: t -> S.(create 1 h @| list_to_seq t)", "val equal (#a:Type) (#len:size_nat) (s1:lseq a len) (s2:lseq a len) : Type0\nlet equal #a #len s1 s2 =\n forall (i:size_nat{i < len}).{:pattern (index s1 i); (index s2 i)} index s1 i == index s2 i", "val list_to_seq (#a:Type) (l:list a) : Pure (seq a)\n (requires True)\n (ensures fun s -> Seq.length s == List.length l)\nlet list_to_seq #a l =\n Seq.seq_of_list l", "val compare_lseq (#a: eqtype) (f: cmp a) (l: nat) : cmp (Seq.lseq a l)\nlet compare_lseq (#a:eqtype) (f:cmp a) (l:nat)\n : cmp (Seq.lseq a l)\n = compare_lseq'_total_order f l;\n compare_lseq' f l", "val Lib.ByteSequence.lbytes = len: Lib.IntTypes.size_nat -> Type0\nlet lbytes (len:size_nat) = lbytes_l SEC len", "val ntup4 (#a: _) (#l: flen{l = 4}) (t: a & (a & (a & a))) : ntuple a l\nlet ntup4 #a (#l:flen{l = 4}) (t:a & (a & (a & a))) : ntuple a l =\n assert (ntuple a l == ntuple a 4);\n (t <: ntuple a 4)", "val to_seq: #a:Type -> b:buffer a -> l:UInt32.t{v l <= length b} -> STL (seq a)\n (requires (fun h -> live h b))\n (ensures (fun h0 r h1 -> h0 == h1 /\\ live h1 b /\\ Seq.length r == v l\n (*/\\ r == as_seq #a h1 b *) ))\nlet to_seq #a b l =\n let s = !b.content in\n let i = v b.idx in\n Seq.slice s i (i + v l)", "val of_list (#a: Type) (l: list a) : seq a\nlet of_list (#a:Type) (l:list a) :seq a = seq_of_list l", "val seq_to_list (#a:Type) (s:seq a) : Tot (l:list a{List.length l == length s})\nlet seq_to_list #_ s =\n match s with\n | MkSeq l -> l", "val lbuffer_or_unit_to_seq\n (#a: Type0)\n (#len: size_t)\n (#b: bool)\n (h: HS.mem)\n (buf: type_or_unit (lbuffer a len) b)\n : GTot (seq a)\nlet lbuffer_or_unit_to_seq (#a : Type0) (#len : size_t) (#b : bool)\n (h : HS.mem) (buf : type_or_unit (lbuffer a len) b) :\n GTot (seq a) =\n if b then as_seq #MUT #a #len h buf else Seq.empty", "val ntup8 (#a: _) (#l: flen{l = 8}) (t: a & (a & (a & (a & (a & (a & (a & a))))))) : ntuple a l\nlet ntup8 #a (#l:flen{l = 8}) (t:a & (a & (a & (a & (a & (a & (a & a))))))) : ntuple a l =\n assert (ntuple a l == ntuple a 8);\n (t <: ntuple a 8)", "val f_lseq4 (#t: v_inttype) (vs: lseq (vec_t t 4) 4) (f: (vec_t4 t -> vec_t4 t))\n : lseq (vec_t t 4) 4\nlet f_lseq4 (#t:v_inttype) (vs:lseq (vec_t t 4) 4) (f:vec_t4 t -> vec_t4 t) : lseq (vec_t t 4) 4 =\n let (v0,v1,v2,v3) = (vs.[0],vs.[1],vs.[2],vs.[3]) in\n let (r0,r1,r2,r3) = f (v0,v1,v2,v3) in\n create4 r0 r1 r2 r3", "val f_lseq8 (#t: v_inttype) (vs: lseq (vec_t t 8) 8) (f: (vec_t8 t -> vec_t8 t))\n : lseq (vec_t t 8) 8\nlet f_lseq8 (#t:v_inttype) (vs:lseq (vec_t t 8) 8) (f:vec_t8 t -> vec_t8 t) : lseq (vec_t t 8) 8 =\n let (v0,v1,v2,v3,v4,v5,v6,v7) = (vs.[0],vs.[1],vs.[2],vs.[3],vs.[4],vs.[5],vs.[6],vs.[7]) in\n let (r0,r1,r2,r3,r4,r5,r6,r7) = f (v0,v1,v2,v3,v4,v5,v6,v7) in\n create8 r0 r1 r2 r3 r4 r5 r6 r7", "val sub (#a:Type0) (#n:nat) (arr:t a n) (i:nat) (len:nat{i + len <= n}) :t a len\nlet sub (#a:Type0) (#n:nat) (arr:t a n) (i:nat) (len:nat{i + len <= n}) :t a len\n = let A s_ref o = arr in\n A s_ref (o + i)", "val member: #a:eqtype -> #len: size_nat -> a -> lseq a len -> Tot bool\nlet member #a #len x l = Seq.count x l > 0", "val to_seq (#a:Type0) (s:array a)\n : ST (seq a)\n (requires (fun h -> contains h s))\n (ensures (fun h0 x h1 -> (sel h0 s == x /\\ h0 == h1)))\nlet to_seq #a s = !s", "val as_seq (#a #p #q: _) (#b: B.mbuffer a p q) (#f: flavor b) (v0: view_type_of f) : lseq_of b\nlet as_seq #a #p #q \n (#b:B.mbuffer a p q)\n (#f:flavor b)\n (v0:view_type_of f)\n : lseq_of b\n = match f with\n | Pointer -> Seq.create 1 v0\n | Buffer -> v0", "val length (#a: Type0) (s: seq a) : nat\nlet length (#a:Type0) (s:seq a) : nat = Seq.length s", "val precomp_base_table_lseq\n (#t: Type)\n (#a_t: BE.inttype_a)\n (#len: size_t{v len > 0})\n (#ctx_len: size_t)\n (k: mk_precomp_base_table t a_t len ctx_len)\n (g: t)\n (n: nat{(n + 1) * v len <= max_size_t})\n : LSeq.lseq (uint_t a_t SEC) ((n + 1) * v len)\nlet precomp_base_table_lseq (#t:Type) (#a_t:BE.inttype_a) (#len:size_t{v len > 0}) (#ctx_len:size_t)\n (k:mk_precomp_base_table t a_t len ctx_len) (g:t)\n (n:nat{(n + 1) * v len <= max_size_t}) : LSeq.lseq (uint_t a_t SEC) ((n + 1) * v len) =\n Seq.seq_of_list (precomp_base_table_list k g n)", "val length: #a:Type -> seq a -> Tot nat\nlet length #_ s = List.length (MkSeq?.l s)", "val lbuffer_or_unit_to_opt_lseq\n (#a: Type0)\n (#len: size_t)\n (#b: bool)\n (h: HS.mem)\n (buf: type_or_unit (lbuffer a len) b)\n : GTot (option (lseq a (size_v len)))\nlet lbuffer_or_unit_to_opt_lseq (#a : Type0) (#len : size_t) (#b : bool)\n (h : HS.mem) (buf : type_or_unit (lbuffer a len) b) :\n GTot (option (lseq a (size_v len))) =\n if b then Some (as_seq #MUT #a #len h buf) else None", "val head (#a: Type) (#l: len_t{l <> 0ul}) (v: raw a l) : Tot a\nlet head (#a:Type) (#l:len_t{l <> 0ul}) (v:raw a l)\n : Tot a\n = v.[0ul]", "val tail (#a: Type) (#l: len_t{l <> 0ul}) (v: raw a l) : Tot (raw a U32.(l -^ 1ul))\nlet tail (#a:Type) (#l:len_t{l <> 0ul}) (v:raw a l)\n : Tot (raw a U32.(l -^ 1ul))\n = sub v 1ul l", "val seq_of_sequence (#a:Type) (s:Sequence.seq a) : Seq.seq a\nlet rec seq_of_sequence (#a:Type) (s:Sequence.seq a)\n : Tot (Seq.seq a)\n (decreases (Sequence.length s))\n = if Sequence.length s = 0\n then Seq.empty\n else let prefix = Sequence.take s (Sequence.length s - 1) in\n Seq.snoc (seq_of_sequence prefix)\n (s$@(Sequence.length s - 1))", "val seq_of_list (#a:Type) (l:list a) : Tot (s:seq a{List.length l == length s})\nlet seq_of_list #_ l = MkSeq l", "val Lib.Sequence.seq = a: Type0 -> Type0\nlet seq (a:Type0) = Seq.seq a", "val tup8 (#a: _) (#l: flen{l = 8}) (t: ntuple a l) : (a & (a & (a & (a & (a & (a & (a & a)))))))\nlet tup8 #a (#l:flen{l = 8}) (t:ntuple a l) : (a & (a & (a & (a & (a & (a & (a & a))))))) =\n assert (ntuple a l == ntuple a 8);\n (t <: ntuple a 8)", "val linv (a: LSeq.lseq uint64 5) : Type0\nlet linv (a:LSeq.lseq uint64 5) : Type0 =\n let open Lib.Sequence in\n inv_lazy_reduced2_5 (a.[0],a.[1],a.[2],a.[3],a.[4])", "val len:\n #a:Type\n -> t a\n -> len_t\nlet len #a (| l , _ |) = l", "val tup4 (#a: _) (#l: flen{l = 4}) (t: ntuple a l) : (a & (a & (a & a)))\nlet tup4 #a (#l:flen{l = 4}) (t:ntuple a l) : (a & (a & (a & a))) =\n assert (ntuple a l == ntuple a 4);\n (t <: ntuple a 4)", "val linv (a: LSeq.lseq uint64 4) : Type0\nlet linv (a:LSeq.lseq uint64 4) : Type0 =\n SD.bn_v #U64 #4 a < S.q", "val linv (a: LSeq.lseq uint64 4) : Type0\nlet linv (a:LSeq.lseq uint64 4) : Type0 =\n BD.bn_v a < S.order", "val linv (a: LSeq.lseq uint64 4) : Type0\nlet linv (a:LSeq.lseq uint64 4) : Type0 =\n BD.bn_v a < S.prime", "val createL (#a: Type0) (l: list a)\n : Pure (seq a) (requires True) (ensures (fun s -> createL_post #a l s))\nlet createL (#a:Type0) (l:list a)\n: Pure (seq a)\n (requires True)\n (ensures (fun s -> createL_post #a l s))\n= let s = seq_of_list l in\n lemma_list_seq_bij l;\n s", "val pts_to_len (#a:Type0) (v:vec a) (#p:perm) (#s:Seq.seq a)\n : stt_ghost unit\n (pts_to v #p s)\n (fun _ \u2192 pts_to v #p s ** pure (length v == Seq.length s))\nlet pts_to_len v = A.pts_to_len v", "val as_seq (#a:Type0) (#n:nat) (arr:t a n) (h:heap)\n :GTot (Seq.seq (option a))\nlet as_seq (#a:Type0) (#n:nat) (arr:t a n) (h:heap)\n :GTot (Seq.seq (option a))\n = let A #_ #_ #_ s_ref off = arr in\n let s = fst (sel h s_ref) in\n Seq.slice s off (off + n)", "val length : #ty: Type -> seq ty -> nat\nlet length = FLT.length", "val Lib.NTuple.flen = Type0\nlet flen = size_pos", "val pts_to_len (#t:Type0) (a:array t) (#p:perm) (#x:Seq.seq t)\n : stt_ghost unit\n (pts_to a #p x)\n (fun _ \u2192 pts_to a #p x ** pure (length a == Seq.length x))\nlet pts_to_len = pts_to_len'", "val Lib.Sequence.createL = l: Prims.list a {FStar.List.Tot.Base.length l <= Lib.IntTypes.max_size_t}\n -> s:\n Lib.Sequence.lseq a (FStar.List.Tot.Base.length l)\n {Lib.Sequence.to_seq s == FStar.Seq.Base.seq_of_list l}\nlet createL #a l = of_list #a l", "val make_seq9 (#a: Type0) (v0 v1 v2 v3 v4 v5 v6 v7 v8: a) : seq a\nlet make_seq9 (#a:Type0) (v0 v1 v2 v3 v4 v5 v6 v7 v8:a) : seq a =\n init 9 (fun i ->\n if i = 0 then v0 else\n if i = 1 then v1 else\n if i = 2 then v2 else\n if i = 3 then v3 else\n if i = 4 then v4 else\n if i = 5 then v5 else\n if i = 6 then v6 else\n if i = 7 then v7 else\n v8)", "val linv (a: LSeq.lseq uint64 20) : Type0\nlet linv (a:LSeq.lseq uint64 20) : Type0 =\n let open Hacl.Spec.Curve25519.Field51 in\n mul_inv_t (lseq_as_felem (LSeq.sub a 0 5)) /\\\n mul_inv_t (lseq_as_felem (LSeq.sub a 5 5)) /\\\n mul_inv_t (lseq_as_felem (LSeq.sub a 10 5)) /\\\n mul_inv_t (lseq_as_felem (LSeq.sub a 15 5)) /\\\n inv_ext_point a", "val init: #a:Type -> len:nat -> contents: (i:nat { i < len } -> Tot a) -> Tot (seq a)\nlet init #_ len contents = if len = 0 then MkSeq [] else init_aux len 0 contents", "val concat:\n #a:Type\n -> #len0:size_nat\n -> #len1:size_nat{len0 + len1 <= max_size_t}\n -> s0:lseq a len0\n -> s1:lseq a len1 ->\n Tot (s2:lseq a (len0 + len1){to_seq s2 == Seq.append (to_seq s0) (to_seq s1)})\nlet concat #a #len0 #len1 s0 s1 = Seq.append s0 s1", "val t:Seq.lseq uint32 64\nlet t : Seq.lseq uint32 64 =\n assert_norm (L.length t_as_list == 64);\n Seq.seq_of_list t_as_list", "val raw_length (#a: Type) (#l: len_t) (v: raw a l) : GTot nat\nlet raw_length (#a:Type) (#l:len_t) (v:raw a l) : GTot nat = U32.v l", "val refl (a: LSeq.lseq uint64 5 {linv a}) : GTot S.felem\nlet refl (a:LSeq.lseq uint64 5{linv a}) : GTot S.felem =\n let open Lib.Sequence in\n feval5 (a.[0],a.[1],a.[2],a.[3],a.[4])", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val linv_ctx (a: LSeq.lseq uint64 0) : Type0\nlet linv_ctx (a:LSeq.lseq uint64 0) : Type0 = True", "val sequence_of_seq (#a:Type) (s:Seq.seq a) : Sequence.seq a\nlet rec sequence_of_seq (#a:Type) (s:Seq.seq a)\n : Tot (Sequence.seq a)\n (decreases (Seq.length s))\n = if Seq.length s = 0\n then Sequence.empty\n else let prefix, last = Seq.un_snoc s in\n sequence_of_seq prefix $:: last", "val map_seq_len (#a #b:Type) (f:a -> Tot b) (s:Seq.seq a)\n : Lemma (ensures Seq.length (map_seq f s) == Seq.length s)\nlet rec map_seq_len #a #b f s\n : Lemma (ensures Seq.length (map_seq f s) == Seq.length s) (decreases Seq.length s)\n = if Seq.length s = 0\n then ()\n else map_seq_len f (tail s)", "val compare_seq (#a: eqtype) (f: cmp a) : cmp (Seq.seq a)\nlet compare_seq (#a:eqtype) (f:cmp a)\n : cmp (Seq.seq a)\n = let f = fun (s1 s2:Seq.seq a) ->\n if s1 = s2 then true\n else if Seq.length s1 = Seq.length s2 then compare_lseq f (Seq.length s1) s1 s2\n else Seq.length s1 <= Seq.length s2\n in\n f", "val Lib.Buffer.lbuffer = a: Type0 -> len: Lib.IntTypes.size_t -> Type0\nlet lbuffer (a:Type0) (len:size_t) = lbuffer_t MUT a len", "val Lib.ByteSequence.pub_lbytes = len: Lib.IntTypes.size_nat -> Type0\nlet pub_lbytes (len:size_nat) = lbytes_l PUB len", "val Lib.MultiBuffer.multiseq = lanes: Lib.NTuple.flen -> len: Prims.nat -> Type0\nlet multiseq (lanes:flen) (len:nat) =\n ntuple (Seq.lseq uint8 len) lanes", "val as_seq (#a:Type0) (#rrel #rel:srel a) (h:HS.mem) (b:mbuffer a rrel rel) :GTot (Seq.seq a)\nlet as_seq #_ #_ #_ h b =\n match b with\n | Null -> Seq.empty\n | Buffer max_len content idx len ->\n Seq.slice (HS.sel h content) (U32.v idx) (U32.v idx + U32.v len)", "val s_seq (#a:_) (#n:_) (il: interleaving a n): ss:sseq a{S.length ss = n}\nlet s_seq (#a:_) (#n:_) (il: interleaving a n)\n = init n (s_seq_i il)", "val sub (#a:Type0) (s:array a) (idx:nat) (len:nat)\n : ST (array a)\n (requires (fun h -> contains h s /\\\n Seq.length (sel h s) > 0 /\\\n idx + len <= Seq.length (sel h s)))\n (ensures (fun h0 t h1 -> contains h1 t /\\\n t `unused_in` h0 /\\\n modifies Set.empty h0 h1 /\\\n Seq.slice (sel h0 s) idx (idx + len) == sel h1 t))\nlet sub #a s idx len =\n let h0 = ST.get () in\n let t = create len (index s 0) in\n blit s idx t 0 len;\n let h1 = ST.get () in\n assert (Seq.equal (Seq.slice (sel h0 s) idx (idx + len)) (sel h1 t));\n t", "val flen (#gs:_) (f: idxfn_t gs bool) (s: seq_t gs)\n : l:nat{ l <= Seq.length s}\nlet rec flen (#gs:_) (f: idxfn_t gs bool) (s: seq_t gs)\n : Tot (l:nat{ l <= Seq.length s})\n (decreases Seq.length s)\n = let n = Seq.length s in\n if n = 0 then 0\n else\n let s' = prefix s (n - 1) in\n let l' = flen f s' in\n if f s (n - 1) then 1 + l'\n else l'", "val as_seq (#a: _) (b: B.buffer a) (l: UInt32.t{l == B.len b})\n : Stack (S.seq a)\n (requires fun h0 -> B.live h0 b)\n (ensures fun h0 r h1 -> h0 == h1 /\\ (B.as_seq h0 b) `S.equal` r)\nlet rec as_seq #a (b: B.buffer a) (l: UInt32.t { l == B.len b }): Stack (S.seq a)\n (requires fun h0 ->\n B.live h0 b)\n (ensures fun h0 r h1 ->\n h0 == h1 /\\\n B.as_seq h0 b `S.equal` r)\n=\n let h0 = ST.get () in\n if l = 0ul then\n S.empty\n else\n let hd = B.index b 0ul in\n let l = l `U32.sub` 1ul in\n let b = B.sub b 1ul l in\n S.cons hd (as_seq b l)", "val refl (a: LSeq.lseq uint64 4 {linv a}) : GTot S.felem\nlet refl (a:LSeq.lseq uint64 4{linv a}) : GTot S.felem =\n SM.from_mont (BD.bn_v a)", "val pts_to_len (#t:Type) (a:array t) (#p:perm) (#x:Seq.seq t)\n : stt_ghost unit\n (pts_to a #p x)\n (fun _ \u2192 pts_to a #p x ** pure (length a == Seq.length x))\nlet pts_to_len = pts_to_len'", "val map_seq (#a #b:Type) (f:a -> Tot b) (s:Seq.seq a) : Tot (Seq.seq b)\nlet rec map_seq #a #b f s : Tot (Seq.seq b) (decreases Seq.length s) =\n if Seq.length s = 0\n then Seq.empty\n else let hd, tl = head s, tail s in\n cons (f hd) (map_seq f tl)", "val srel_to_lsrel (#a: Type0) (len: nat) (pre: srel a) : P.preorder (Seq.lseq a len)\nlet srel_to_lsrel (#a:Type0) (len:nat) (pre:srel a) :P.preorder (Seq.lseq a len) = pre", "val length (#a:Type0) (x:t a) : GTot nat\nlet length x = L.length x", "val Lib.Buffer.lbuffer_t = t: Lib.Buffer.buftype -> a: Type0 -> len: Lib.IntTypes.size_t -> Type0\nlet lbuffer_t (t:buftype) (a:Type0) (len:size_t) =\n b:buffer_t t a{length #t #a b == v len}", "val of_seq (#a:Type0) (s:seq a)\n: ST (array a)\n (requires fun _ -> True)\n (ensures create_post s)\nlet of_seq #a s = ST.alloc s", "val Lib.MultiBuffer.op_Lens_Access = s: Lib.NTuple.ntuple a len -> i: Prims.nat{i < len} -> a\nlet op_Lens_Access #a #len = index #a #len", "val Lib.Sequence.op_String_Assignment = s: Lib.Sequence.lseq a len -> n: (n: Prims.nat{n <= Prims.pow2 32 - 1}){n < len} -> x: a\n -> o:\n Lib.Sequence.lseq a len\n { Lib.Sequence.to_seq o == FStar.Seq.Base.upd (Lib.Sequence.to_seq s) n x /\\\n Lib.Sequence.index o n == x /\\\n (forall (i: n: Prims.nat{n <= Prims.pow2 32 - 1}). {:pattern Lib.Sequence.index s i}\n i < len /\\ i <> n ==> Lib.Sequence.index o i == Lib.Sequence.index s i) }\nlet op_String_Assignment #a #len = upd #a #len", "val Lib.Sequence.update_slice = \n i: Lib.Sequence.lseq a len ->\n start: Lib.IntTypes.size_nat ->\n fin: Lib.IntTypes.size_nat{start <= fin /\\ fin <= len} ->\n upd: Lib.Sequence.lseq a (fin - start)\n -> o:\n Lib.Sequence.lseq a len\n { Lib.Sequence.sub o start (fin - start) == upd /\\\n (forall (k: Prims.nat{0 <= k /\\ k < start \\/ start + (fin - start) <= k /\\ k < len}).\n {:pattern Lib.Sequence.index o k}\n Lib.Sequence.index o k == Lib.Sequence.index i k) }\nlet update_slice\n (#a:Type)\n (#len:size_nat)\n (i:lseq a len)\n (start:size_nat)\n (fin:size_nat{start <= fin /\\ fin <= len})\n (upd:lseq a (fin - start))\n =\n update_sub #a i start (fin - start) upd", "val length (#a:Type0) (p:t a)\n : Steel int (llist p) (fun _ -> llist p)\n (requires fun _ -> True)\n (ensures fun h0 x h1 ->\n v_llist p h0 == v_llist p h1 /\\\n L.length (v_llist p h0) == x)\nlet rec length #a p =\n if is_null p then (elim_llist_nil p; 0)\n else (\n let tl = tail p in\n let aux = length tl in\n intro_llist_cons p tl;\n 1 + aux)", "val fill\n (#t:Type0)\n (l:SZ.t)\n (a:larray t (SZ.v l))\n (v:t)\n (#s:Ghost.erased (Seq.seq t))\n : stt unit\n (requires \n pts_to a s)\n (ensures fun _ ->\n exists* (s:Seq.seq t).\n pts_to a s **\n pure (s `Seq.equal` Seq.create (SZ.v l) v))\nlet fill = fill'", "val transpose4x4_lseq (#t: v_inttype{t = U32 \\/ t = U64}) (vs: lseq (vec_t t 4) 4)\n : lseq (vec_t t 4) 4\nlet transpose4x4_lseq (#t:v_inttype{t = U32 \\/ t = U64}) (vs:lseq (vec_t t 4) 4) : lseq (vec_t t 4) 4 =\n let (v0,v1,v2,v3) = (vs.[0],vs.[1],vs.[2],vs.[3]) in\n let (r0,r1,r2,r3) = transpose4x4 (v0,v1,v2,v3) in\n create4 r0 r1 r2 r3", "val Lib.NTuple.op_Lens_Access = s: Lib.NTuple.ntuple a len -> i: Prims.nat{i < len} -> a\nlet op_Lens_Access #a #len = index #a #len", "val length: s:seq 'a -> Tot nat\nlet length s = Seq?.end_i s - Seq?.start_i s", "val map_seq_len (#a #b: Type) (f: (a -> Tot b)) (s: Seq.seq a)\n : Lemma (ensures Seq.length (Seq.map_seq f s) == Seq.length s)\n [SMTPat (Seq.length (Seq.map_seq f s))]\nlet map_seq_len (#a #b:Type) (f:a -> Tot b) (s:Seq.seq a)\n : Lemma (ensures Seq.length (Seq.map_seq f s) == Seq.length s)\n [SMTPat (Seq.length (Seq.map_seq f s))]\n = Seq.map_seq_len f s", "val seq_of_list_tl\n (#a: Type)\n (l: list a { List.Tot.length l > 0 } )\n: Lemma\n (requires True)\n (ensures (seq_of_list (List.Tot.tl l) == tail (seq_of_list l)))\nlet seq_of_list_tl #_ l = lemma_seq_of_list_induction l", "val sort_lseq (#a: eqtype) (#n: _) (f: tot_ord a) (s: lseq a n)\n : s': lseq a n {sorted f s' /\\ permutation a s s'}\nlet sort_lseq (#a:eqtype) #n (f:tot_ord a) (s:lseq a n)\n : s':lseq a n{sorted f s' /\\ permutation a s s'} =\n lemma_seq_sortwith_correctness (L.compare_of_bool f) s;\n let s' = sortWith (L.compare_of_bool f) s in\n perm_len s s';\n sorted_feq f (L.bool_of_compare (L.compare_of_bool f)) s';\n s'", "val to_list:\n #a:Type\n -> s:seq a ->\n Tot (l:list a{List.Tot.length l = length s /\\ l == Seq.seq_to_list s})\nlet to_list #a s = Seq.seq_to_list s", "val length (#a:Type0) (v:vec a) : GTot nat\nlet length v = A.length v", "val of_list (#a:Type0) (l:list a)\n: ST (array a)\n (requires fun _ -> True)\n (ensures create_post (seq_of_list l))\nlet of_list #a l = of_seq (Seq.seq_of_list l)", "val get_last_s (#a: Type) (#len: nat) (blocksize: size_pos) (inp: seq a {length inp == len})\n : lseq a (len % blocksize)\nlet get_last_s\n (#a:Type)\n (#len:nat)\n (blocksize:size_pos)\n (inp:seq a{length inp == len}) :\n lseq a (len % blocksize)\n=\n let rem = len % blocksize in\n let b: lseq a rem = Seq.slice inp (len - rem) len in\n b", "val Lib.Sequence.slice = \n s1: Lib.Sequence.lseq a len ->\n start: Lib.IntTypes.size_nat ->\n fin: Lib.IntTypes.size_nat{start <= fin /\\ fin <= len}\n -> s2:\n Lib.Sequence.lseq a (fin - start)\n { Lib.Sequence.to_seq s2 ==\n FStar.Seq.Base.slice (Lib.Sequence.to_seq s1) start (start + (fin - start)) /\\\n (forall (k: Prims.nat{k < fin - start}). {:pattern Lib.Sequence.index s2 k}\n Lib.Sequence.index s2 k == Lib.Sequence.index s1 (start + k)) }\nlet slice\n (#a:Type)\n (#len:size_nat)\n (s1:lseq a len)\n (start:size_nat)\n (fin:size_nat{start <= fin /\\ fin <= len})\n =\n sub #a s1 start (fin - start)", "val coerce (#a: Type) (#l: len_t) (v: raw a l) (m: len_t{l == m}) : Tot (raw a m)\nlet coerce\n (#a:Type)\n (#l:len_t)\n (v:raw a l)\n (m:len_t{l == m})\n : Tot (raw a m)\n = v" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.to_seq" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.lseq" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.as_seq" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.pn_as_seq" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.to_lseq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.ntuple" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.nn_as_seq" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.as_seq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.ntuple_" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.ntup1" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.tup1" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.list_to_seq" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.equal" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.list_to_seq" }, { "project_name": "zeta", "file_name": "Zeta.MultiSetHashDomain.fst", "name": "Zeta.MultiSetHashDomain.compare_lseq" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.lbytes" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.ntup4" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.to_seq" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.of_list" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.seq_to_list" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fsti", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_to_seq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.ntup8" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.Transpose.fst", "name": "Lib.IntVector.Transpose.f_lseq4" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.Transpose.fst", "name": "Lib.IntVector.Transpose.f_lseq8" }, { "project_name": "FStar", "file_name": "MonotonicArray.fst", "name": "MonotonicArray.sub" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.member" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.to_seq" }, { "project_name": "FStar", "file_name": "LowStar.Lens.Buffer.fsti", "name": "LowStar.Lens.Buffer.as_seq" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.length" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable.fsti", "name": "Hacl.Spec.PrecompBaseTable.precomp_base_table_lseq" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.length" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fsti", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_to_opt_lseq" }, { "project_name": "FStar", "file_name": "FStar.Vector.Properties.fst", "name": "FStar.Vector.Properties.head" }, { "project_name": "FStar", "file_name": "FStar.Vector.Properties.fst", "name": "FStar.Vector.Properties.tail" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Seq.fst", "name": "FStar.Sequence.Seq.seq_of_sequence" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.seq_of_list" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.seq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.tup8" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Finv.fst", "name": "Hacl.Impl.K256.Finv.linv" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fst", "name": "FStar.Vector.Base.len" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.tup4" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Qinv.fst", "name": "Hacl.Impl.K256.Qinv.linv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Qinv.fst", "name": "Hacl.Impl.P256.Qinv.linv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Finv.fst", "name": "Hacl.Impl.P256.Finv.linv" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.createL" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.pts_to_len" }, { "project_name": "FStar", "file_name": "MonotonicArray.fst", "name": "MonotonicArray.as_seq" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Base.fst", "name": "FStar.Sequence.Base.length" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.flen" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.pts_to_len" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.createL" }, { "project_name": "hacl-star", "file_name": "Vale.FDefMulx.X64.fst", "name": "Vale.FDefMulx.X64.make_seq9" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Field51.fst", "name": "Hacl.Impl.Ed25519.Field51.linv" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.init" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.concat" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.t" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.raw_length" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Finv.fst", "name": "Hacl.Impl.K256.Finv.refl" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Group.fst", "name": "Hacl.Impl.Ed25519.Group.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Qinv.fst", "name": "Hacl.Impl.P256.Qinv.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Finv.fst", "name": "Hacl.Impl.P256.Finv.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Finv.fst", "name": "Hacl.Impl.K256.Finv.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Group.fst", "name": "Hacl.Impl.K256.Group.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Qinv.fst", "name": "Hacl.Impl.K256.Qinv.linv_ctx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Group.fst", "name": "Hacl.Impl.P256.Group.linv_ctx" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Seq.fst", "name": "FStar.Sequence.Seq.sequence_of_seq" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.map_seq_len" }, { "project_name": "zeta", "file_name": "Zeta.MultiSetHashDomain.fst", "name": "Zeta.MultiSetHashDomain.compare_seq" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.lbuffer" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.pub_lbytes" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.multiseq" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.as_seq" }, { "project_name": "zeta", "file_name": "Zeta.Interleave.fst", "name": "Zeta.Interleave.s_seq" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.sub" }, { "project_name": "zeta", "file_name": "Zeta.IdxFn.fst", "name": "Zeta.IdxFn.flen" }, { "project_name": "everquic-crypto", "file_name": "QUIC.fst", "name": "QUIC.as_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Finv.fst", "name": "Hacl.Impl.P256.Finv.refl" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.pts_to_len" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.map_seq" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.srel_to_lsrel" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.length" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.lbuffer_t" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.of_seq" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.op_Lens_Access" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.op_String_Assignment" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.update_slice" }, { "project_name": "steel", "file_name": "Selectors.LList.Derived.fst", "name": "Selectors.LList.Derived.length" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.fst", "name": "Pulse.Lib.Array.fill" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.Transpose.fsti", "name": "Lib.IntVector.Transpose.transpose4x4_lseq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.op_Lens_Access" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.length" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.map_seq_len" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.seq_of_list_tl" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.sort_lseq" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.to_list" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.length" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.of_list" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.Lemmas.fsti", "name": "Lib.Sequence.Lemmas.get_last_s" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.slice" }, { "project_name": "FStar", "file_name": "FStar.Vector.Properties.fst", "name": "FStar.Vector.Properties.coerce" } ], "selected_premises": [ "Lib.IntTypes.v", "Lib.IntTypes.size", "Lib.NTuple.fst", "Lib.IntTypes.u8", "Lib.NTuple.rest", "Lib.IntTypes.uint_v", "Lib.IntTypes.max_size_t", "Lib.Sequence.seq", "Lib.NTuple.gcreatei", "Lib.Sequence.to_seq", "Lib.IntTypes.u32", "Lib.IntTypes.range", "Lib.IntTypes.bits", "Lib.Sequence.createL", "Lib.IntTypes.uint_t", "FStar.UInt.size", "Lib.NTuple.length", "Lib.Sequence.length", "Lib.NTuple.index", "Lib.Sequence.lseq", "Lib.Sequence.op_String_Assignment", "Lib.IntTypes.int_t", "Lib.NTuple.index_", "Lib.NTuple.gcreatei_", "Lib.NTuple.createi_", "Lib.NTuple.createi", "Lib.Sequence.op_String_Access", "Lib.IntTypes.numbytes", "Lib.NTuple.fst_", "Lib.IntTypes.unsigned", "Lib.IntTypes.u64", "Lib.IntTypes.uint", "Lib.Sequence.slice", "FStar.Heap.trivial_preorder", "FStar.Mul.op_Star", "Lib.IntTypes.op_Hat_Dot", "Lib.NTuple.max_ntuple_len", "FStar.ST.op_Bang", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.u16", "FStar.Pervasives.Native.fst", "Lib.IntTypes.op_Plus_Dot", "FStar.Pervasives.Native.snd", "Lib.NTuple.gcreatei_lemma", "FStar.Pervasives.reveal_opaque", "Lib.IntTypes.op_Star_Bang", "Lib.IntTypes.op_Subtraction_Dot", "Lib.NTuple.createi_lemma", "Lib.IntTypes.byte", "Lib.NTuple.gcreatei_lemma_", "Lib.IntTypes.size_v", "Lib.IntTypes.op_Amp_Dot", "Lib.IntTypes.op_Percent_Dot", "Lib.IntTypes.op_Subtraction_Bang", "Lib.IntTypes.op_Star_Dot", "Lib.IntTypes.op_Less_Dot", "Lib.IntTypes.maxint", "FStar.ST.alloc", "Lib.IntTypes.u1", "Lib.IntTypes.op_Bar_Dot", "Lib.NTuple.rest_", "Lib.IntTypes.op_Slash_Dot", "Lib.NTuple.createi_lemma_", "Lib.Sequence.op_At_Bar", "FStar.Int.size", "Lib.IntTypes.op_Equals_Dot", "Lib.IntTypes.op_Less_Less_Dot", "FStar.Pervasives.dfst", "FStar.Int.op_At_Percent", "Lib.IntTypes.op_Less_Equals_Dot", "FStar.Pervasives.dsnd", "Lib.IntTypes.pub_int_t", "Lib.IntTypes.sint", "Lib.IntTypes.minint", "Lib.IntTypes.op_Greater_Dot", "Lib.IntTypes.modulus", "Lib.IntTypes.pub_int_v", "FStar.UInt.max_int", "Lib.Sequence.to_lseq", "Lib.IntTypes.op_Greater_Greater_Dot", "Lib.LoopCombinators.fixed_a", "Lib.Sequence.update_slice", "FStar.All.op_Bar_Greater", "FStar.Math.Lemmas.pow2_plus", "Lib.LoopCombinators.fixed_i", "FStar.All.op_Less_Bar", "Lib.Sequence.repeat_blocks_f", "Lib.IntTypes.logxor_v", "Lib.IntTypes.signed", "FStar.Int.max_int", "FStar.Heap.trivial_rel", "FStar.UInt.to_vec", "Lib.IntTypes.op_Tilde_Dot", "FStar.Int.op_Slash", "FStar.Monotonic.Heap.mref", "Lib.IntTypes.op_At_Percent_Dot", "FStar.Math.Lemmas.pow2_lt_compat", "FStar.Preorder.preorder_rel", "FStar.UInt.fits", "FStar.Math.Lemmas.pow2_le_compat" ], "source_upto_this": "module Lib.NTuple\n\nopen FStar.Mul\nopen Lib.IntTypes\n\n#set-options \"--z3rlimit 15 --ifuel 0 --fuel 1\"\n\nlet max_ntuple_len = max_size_t\n\nunfold let length (#a:Type0) (#len:flen) (s: ntuple a len) : flen = len\n\ninline_for_extraction\nlet fst_ (#a:Type0) (#len:flen) (s:ntuple_ a len) : a =\n if len = 1 then s\n else fst (s <: a & ntuple_ a (len - 1))\n\nlet fst #a #len (s:ntuple a len) =\n normalize_term (fst_ #a #len s)\n\ninline_for_extraction\nlet rest_ (#a:Type0) (#len:flen{len > 1}) (s:ntuple_ a len) : ntuple_ a (len - 1)=\n snd (s <: a & ntuple_ a (len - 1))\n\nlet rest #a #len s =\n normalize_term (rest_ #a #len s)\n\ninline_for_extraction\nlet rec index_ (#a:Type0) (#len:flen) (s:ntuple a len) (i:nat{i < len}) =\n if i = 0 then fst s\n else (assert (len > 1);\n index_ #a #(len-1) (rest s) (i-1))\n\nlet index #a #len s i =\n normalize_term (index_ s i)\n\nlet index_fst_lemma #a #len s = ()\n\ninline_for_extraction\nlet rec createi_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> a)) :\n Tot (ntuple_ a (max - min)) (decreases (max - min))\n =\n if min + 1 = max then f min\n else f min, createi_ #a (min+1) max f\n\nlet createi #a len f =\n normalize_term (createi_ #a 0 len f)\n\ninline_for_extraction\nlet rec gcreatei_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> GTot a)) :\n GTot (ntuple_ a (max - min)) (decreases (max - min))\n =\n if min + 1 = max then f min\n else f min, gcreatei_ #a (min+1) max f\n\nlet gcreatei #a len f =\n normalize_term (gcreatei_ #a 0 len f)\n\nlet rec createi_lemma_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> a)) (i:nat{i < max - min}) :\n Lemma (ensures (index #a #(max - min) (createi_ #a min max f) i == f (min+i))) (decreases i)\n =\n if i = 0 then ()\n else createi_lemma_ #a (min+1) max f (i-1)\n\nlet createi_lemma #a len f i =\n createi_lemma_ #a 0 len f i\n\nlet rec gcreatei_lemma_ (#a:Type0) (min:nat) (max:flen{max > min}) (f:(i:nat{i < max} -> GTot a)) (i:nat{i < max - min}) :\n Lemma (ensures (index #a #(max - min) (gcreatei_ #a min max f) i == f (min+i))) (decreases i)\n =\n if i = 0 then ()\n else gcreatei_lemma_ #a (min+1) max f (i-1)\n\nlet gcreatei_lemma #a len f i =\n gcreatei_lemma_ #a 0 len f i\n", "sketch": [ "The function `to_lseq` converts an n-tuple to a length-indexed sequence.\n\nStep 1: We will define a function `to_lseq` that takes an n-tuple and converts it to a length-indexed sequence.\n\nStep 2: To implement `to_lseq`, we will iterate through the n-tuple and construct a length-indexed sequence by adding each element to the sequence in order.", "The function `to_lseq` takes an n-tuple `l` of type `a` and length `len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: To implement this, we will create a sequence and populate it with the elements of the n-tuple using a recursive approach.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: We can implement the `to_lseq` function by recursively extracting the elements of the n-tuple and adding them to the sequence until all elements have been added.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: To implement the `to_lseq` function, we will create a sequence and populate it with the elements of the n-tuple using a recursive approach.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: We can implement the `to_lseq` function by recursively extracting the elements of the n-tuple and adding them to the sequence until all elements have been added.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` of type `Lib.Sequence.lseq a len`.\n\nStep 1: We will iterate through the n-tuple `l` and add each element to the sequence.\n\nStep 2: We will implement the `to_lseq` function by using a recursive approach to iterate through the n-tuple and add each element to the sequence.", "The function to_lseq takes an n-tuple and converts it into a sequence of length n.\n\nStep 1: The to_lseq function converts an n-tuple into a sequence.\n\nStep 2: To implement the to_lseq function, we will create a sequence and populate it with the elements of the n-tuple.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: To implement this, we will iterate through the n-tuple and add each element to the sequence, maintaining the order.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: We can implement the `to_lseq` function by recursively extracting elements from the n-tuple and adding them to the sequence until all elements have been added.", "The function `to_lseq` takes an n-tuple `l` of type `ntuple a len` and converts it into a sequence of length `len` containing elements of type `a`.\n\nStep 1: We want to define a function that converts an n-tuple into a sequence.\n\nStep 2: We can implement the `to_lseq` function by recursively extracting elements from the n-tuple and adding them to the sequence until all elements have been added." ], "generated_solution": [ "let to_lseq #a #len (l:ntuple a len) : Lib.Sequence.lseq a len =\n createi _ len (fun i -> index l i)", "let to_lseq #a #len (l: ntuple a len) : Lib.Sequence.lseq a len =\n createi _ l", "let rec to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len =\n match len with\n | 0 -> Lib.Sequence.empty\n | _ -> Lib.Sequence.append (to_lseq (rest l)) (Lib.Sequence.singleton (fst l))", "let to_lseq #a #len (l:ntuple a len) : Lib.Sequence.lseq a len =\n createi _ len (fun i -> index l i)", "let rec to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len =\n match len with\n | 0 -> Lib.Sequence.empty\n | _ -> Lib.Sequence.append (to_lseq (rest l)) (Lib.Sequence.singleton (fst l))", "let rec to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len =\n match len with\n | 0 -> Lib.Sequence.empty_lseq\n | _ -> Lib.Sequence.append_lseq (to_lseq (rest l)) (Lib.Sequence.singleton_lseq (fst l))", "let to_lseq #a #len (l: ntuple a len) : Lib.Sequence.lseq a len =\n Lib.Sequence.create l", "let to_lseq #a #len (l:ntuple a len) : Lib.Sequence.lseq a len =\n createi _ len (fun i -> index l i)", "let rec to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len =\n match len with\n | 0 -> Lib.Sequence.empty_lseq\n | _ -> Lib.Sequence.append_lseq (to_lseq (rest l)) (Lib.Sequence.singleton_lseq (fst l))", "let rec to_lseq (#a:Type0) (#len:flen) (l:ntuple a len) : Lib.Sequence.lseq a len =\n match len with\n | 0 -> Lib.Sequence.empty\n | _ -> Lib.Sequence.append (to_lseq (rest l)) (Lib.Sequence.singleton (fst l))" ] }, { "file_name": "Hacl.Hash.Core.MD5.fst", "name": "Hacl.Hash.Core.MD5.abcd_idx", "opens_and_abbrevs": [ { "open": "Spec.Hash.Definitions" }, { "open": "Hacl.Hash.Definitions" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "Lib.IntTypes" }, { "abbrev": "Spec", "full_module": "Spec.MD5" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "IB", "full_module": "LowStar.ImmutableBuffer" }, { "abbrev": "B", "full_module": "LowStar.Buffer" }, { "open": "Spec.Hash.Definitions" }, { "open": "Hacl.Hash.Definitions" }, { "open": "Hacl.Hash.Core" }, { "open": "Hacl.Hash.Core" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "", "source_definition": "let abcd_idx = (n: U32.t { U32.v n < 4 } )", "source_range": { "start_line": 74, "start_col": 0, "end_line": 74, "end_col": 42 }, "interleaved": false, "definition": "n: FStar.UInt32.t{FStar.UInt32.v n < 4}", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.UInt32.t", "Prims.b2t", "Prims.op_LessThan", "FStar.UInt32.v" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "Type0", "prompt": "let abcd_idx =\n ", "expected_response": "(n: U32.t{U32.v n < 4})", "source": { "project_name": "hacl-star", "file_name": "code/hash/Hacl.Hash.Core.MD5.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.Hash.Core.MD5.fst", "checked_file": "dataset/Hacl.Hash.Core.MD5.fst.checked", "interface_file": true, "dependencies": [ "dataset/Spec.MD5.fst.checked", "dataset/Spec.MD5.fst.checked", "dataset/Spec.Hash.Definitions.fst.checked", "dataset/Spec.Agile.Hash.fst.checked", "dataset/prims.fst.checked", "dataset/LowStar.ImmutableBuffer.fst.checked", "dataset/LowStar.Buffer.fst.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.ByteSequence.fsti.checked", "dataset/Lib.ByteBuffer.fsti.checked", "dataset/Hacl.Hash.PadFinish.fst.checked", "dataset/Hacl.Hash.Definitions.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/C.Loops.fst.checked" ] }, "definitions_in_context": [ "val alloca: alloca_st (|MD5, ()|)", "val init: init_st (|MD5, ()|)", "val update: update_st (|MD5, ()|)", "val pad: pad_st MD5", "val finish: finish_st (|MD5, ()|)", "let _h0 = IB.igcmalloc_of_list HS.root Spec.init_as_list", "let _t = IB.igcmalloc_of_list HS.root Spec.t_as_list", "let alloca () =\n B.alloca_of_list Spec.init_as_list", "let h0 (i: U32.t { U32.v i < 4 } ) : HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == Seq.index Spec.init (U32.v i)\n ))\n= IB.recall_contents _h0 Spec.init;\n B.index _h0 i", "let t (i: U32.t { U32.v i < 64 } ) : HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == Seq.index Spec.t (U32.v i)\n ))\n= IB.recall_contents _t Spec.t;\n B.index _t i", "let seq_index_upd (#t: Type) (s: Seq.seq t) (i: nat) (v: t) (j: nat) : Lemma\n (requires (i < Seq.length s /\\ j < Seq.length s))\n (ensures (Seq.index (Seq.upd s i v) j == (if j = i then v else Seq.index s j)))\n [SMTPat (Seq.index (Seq.upd s i v) j)]\n= ()", "let init s =\n let h = HST.get () in\n let inv (h' : HS.mem) (i: nat) : GTot Type0 =\n B.live h' s /\\ B.modifies (B.loc_buffer s) h h' /\\ i <= 4 /\\ Seq.slice (B.as_seq h' s) 0 i == Seq.slice Spec.init 0 i\n in\n C.Loops.for 0ul 4ul inv (fun i ->\n B.upd s i (h0 i);\n let h' = HST.get () in\n Seq.snoc_slice_index (B.as_seq h' s) 0 (U32.v i);\n Seq.snoc_slice_index (Spec.init) 0 (U32.v i)\n )", "let abcd_t = (b: B.buffer uint32 { B.length b == 4 } )" ], "closest": [ "val Spec.MD5.abcd_idx = Type0\nlet abcd_idx = (n: nat { n < 4 } )", "val Spec.MD5.abcd_t = Type0\nlet abcd_t = Seq.lseq uint32 4", "val Spec.MD5.t_idx = Type0\nlet t_idx = (n: nat { 1 <= n /\\ n <= 64 } )", "val Spec.MD5.x_idx = Type0\nlet x_idx = (n: nat { n < 16 } )", "val Spec.MD5.rotate_idx = Type0\nlet rotate_idx = rotval U32", "val Hacl.Impl.SHA3.index = Type0\nlet index = n:size_t{v n < 5}", "val Spec.MD5.x_t = Type0\nlet x_t = Seq.lseq uint32 16", "val Hacl.Impl.Blake2.Core.index_t = Type0\nlet index_t = n:size_t{v n < 4}", "val Hacl.Impl.Salsa20.Core32.index = Type0\nlet index = i:size_t{size_v i < 16}", "val Hacl.Streaming.MD5.state_t = Type0\nlet state_t = Hacl.Streaming.MD.state_32", "val Hacl.Impl.Chacha20.Core32.index = Type0\nlet index = i:size_t{size_v i < 16}", "val Hacl.Hash.MD.legacy_alg = Type0\nlet legacy_alg = a:hash_alg { a == MD5 \\/ a == SHA1 }", "val MiTLS.Idx.h_table = Type0\nlet h_table = if model then i_honesty_table else unit", "val Spec.Agile.HPKE.hash_algorithm = Type0\nlet hash_algorithm = a:Hash.hash_alg{is_valid_hash a}", "val Hacl.Streaming.MD.alg = Type0\nlet alg = md_alg", "val Hacl.Impl.Chacha20.Core32xN.index = Type0\nlet index = (i:size_t{size_v i < 16})", "val MiTLS.Hashing.Spec.alg = Type0\nlet alg = a:alg { is_md a }", "val Spec.Hash.Definitions.md_alg = Type0\nlet md_alg = a:hash_alg { is_md a }", "val Zeta.Steel.Rel.i_desc_hash = Type0\nlet i_desc_hash = M.desc_hash_t", "val Hacl.Impl.SHA3.state = Type0\nlet state = lbuffer uint64 25ul", "val Hacl.Blake2b_256.bytes = Type0\nlet bytes = Seq.seq U8.t", "val MiTLS.HMAC.ha = Type0\nlet ha = a:EverCrypt.HMAC.supported_alg{Spec.Hash.Definitions.is_md a}", "val Hacl.Streaming.MD.state_32 = Type0\nlet state_32 = F.state_s hacl_sha2_256 () ((state_t SHA2_256).s ()) (G.erased unit)", "val Zeta.Steel.Rel.i_hash_value = Type0\nlet i_hash_value = Zeta.Hash.hash_value", "val Hacl.Streaming.MD.state_64 = Type0\nlet state_64 = F.state_s hacl_sha2_512 () ((state_t SHA2_512).s ()) (G.erased unit)", "val Hacl.Blake2b_32.bytes = Type0\nlet bytes = Seq.seq U8.t", "val Hacl.Hash.Core.SHA1.w_t = Type0\nlet w_t = B.lbuffer (word SHA1) 80", "val Spec.Hash.Definitions.sha2_alg = Type0\nlet sha2_alg = a:hash_alg { is_sha2 a }", "val HaclExample2.comp_name = Type0\nlet comp_name = normalize (mk_string_t \"HaclExample2.comp\")", "val id:abcd_idx\nlet id : abcd_idx = 3", "val STLC.Core.index = Type0\nlet index = nat", "val HaclExample2.twenty = Type0\nlet twenty = normalize (nat_t_of_nat 20)", "val Hacl.Streaming.Blake2.Common.alg = Type0\nlet alg = Spec.alg", "val Zeta.Steel.Rel.s_hash_value = Type0\nlet s_hash_value = T.hash_value", "val Hacl.Streaming.MD.uint8 = Type0\nlet uint8 = Lib.IntTypes.uint8", "val Hacl.HPKE.Interface.AEAD.iv = a: Spec.Agile.AEAD.alg -> Type0\nlet iv (a:AEAD.alg) = lbuffer uint8 12ul", "val Hacl.HPKE.Interface.AEAD.kv = a: Spec.Agile.AEAD.alg -> Type0\nlet kv (a:AEAD.alg) = lbuffer uint8 (size (AEAD.key_length a))", "val Zeta.Steel.Rel.s_desc_hash = Type0\nlet s_desc_hash = T.descendent_hash", "val Hacl.Streaming.Keccak.hash_buf = Type0\nlet hash_buf = hash_alg & B.buffer uint64", "val Model.AEAD.alg = Type0\nlet alg = I.ea", "val L0.Base.l0_hash_alg = Type0\nlet l0_hash_alg = a:hash_alg{a == SHA2_256}", "val MiTLS.AEAD.iv = alg: MiTLS.Crypto.Indexing.cipherAlg -> Type0\nlet iv (alg:I.cipherAlg) =\n let open FStar.Mul in\n n:U128.t { U128.v n < pow2 (8 * v (ivlen alg)) }", "val Hacl.Streaming.Keccak.hash_buf2 = Type0\nlet hash_buf2 = hash_buf & hash_buf", "val HACL.hashable_len = Type0\nlet hashable_len = v:US.t{ is_hashable_len v }", "val Hacl.Hash.Core.SHA1.block_t = Type0\nlet block_t = (block: B.buffer uint8 { B.length block == block_length SHA1 } )", "val HaclExample.comp_name = Type0\nlet comp_name = normalize (mk_string_t \"HaclExample2.comp\")", "val Hacl.Streaming.SHA1.state_t = Type0\nlet state_t = Hacl.Streaming.MD.state_32", "val HaclExample2.five = Type0\nlet five = normalize (nat_t_of_nat 5)", "val Hacl.Impl.Salsa20.Core32.state = Type0\nlet state = lbuffer uint32 16ul", "val Zeta.Steel.HashAccumulator.iv_t = Type0\nlet iv_t = Seq.lseq U8.t iv_len", "val ib:abcd_idx\nlet ib : abcd_idx = 1", "val MiTLS.AEAD.Pkg.x = Type0\nlet x = keylen", "val HaclExample.twenty = Type0\nlet twenty = normalize (nat_t_of_nat 20)", "val HACL.hkdf_lbl_len = Type0\nlet hkdf_lbl_len = v:US.t{ valid_hkdf_lbl_len v }", "val Hacl.Streaming.Keccak.alg = Type0\nlet alg = keccak_alg", "val Spec.Hash.Definitions.blake_alg = Type0\nlet blake_alg = a:hash_alg { is_blake a }", "val Spec.Blake2.Definitions.row_idx = Type0\nlet row_idx = n:nat {n < 4}", "val Spec.Hash.Definitions.keccak_alg = Type0\nlet keccak_alg = a:hash_alg { is_keccak a }", "val Hacl.HMAC_DRBG.supported_alg = Type0\nlet supported_alg = S.supported_alg", "val Hacl.Streaming.MD.uint32 = Type0\nlet uint32 = Lib.IntTypes.uint32", "val Vale.Stdcalls.X64.AesHash.b128 = Type0\nlet b128 = buf_t TUInt8 TUInt128", "val Hacl.Impl.SHA2.Types.uint8_5p = Type0\nlet uint8_5p = uint8_1p & uint8_4p", "val HaclExample.five = Type0\nlet five = normalize (nat_t_of_nat 5)", "val Hacl.Spec.Poly1305.Vec.pfelem = Type0\nlet pfelem = Scalar.felem", "val Hacl.Streaming.SHA2.state_t_512 = Type0\nlet state_t_512 = Hacl.Streaming.MD.state_64", "val Hacl.Hash.Definitions.fixed_len_impl = Type0\nlet fixed_len_impl = i:impl { not (is_shake (dfst i)) }", "val Spec.SHA2.counter = Type0\nlet counter = nat", "val ic:abcd_idx\nlet ic : abcd_idx = 2", "val Hacl.Bignum25519.felem = Type0\nlet felem = lbuffer uint64 5ul", "val MerkleTree.hash = Type0\nlet hash #hash_size = MTNLD.hash #hash_size", "val Hacl.Bignum.MontArithmetic.bn_mont_ctx_u32 = Type0\nlet bn_mont_ctx_u32 = bn_mont_ctx' U32 (lb U32) (ll U32)", "val ia:abcd_idx\nlet ia : abcd_idx = 0", "val Hacl.Streaming.Poly1305_256.state_t = Type0\nlet state_t = F.state_s (poly1305 M256) () (t M256) (poly1305_key.I.s ())", "val Spec.Hash.Definitions.fixed_len_alg = Type0\nlet fixed_len_alg = a:hash_alg { not (is_shake a) }", "val Hacl.Impl.Chacha20.Core32.state = Type0\nlet state = lbuffer uint32 16ul", "val Hacl.Bignum25519.point = Type0\nlet point = lbuffer uint64 20ul", "val MiTLS.AEAD.nonce = i: MiTLS.Crypto.Indexing.id -> Type0\nlet nonce (i:I.id) = iv (I.cipherAlg_of_id i)", "val Hacl.Spec.Poly1305.Field32xN.tup64_5 = Type0\nlet tup64_5 = (uint64 & uint64 & uint64 & uint64 & uint64)", "val HACL.hkdf_ikm_len = Type0\nlet hkdf_ikm_len = v:US.t{ valid_hkdf_ikm_len v }", "val Hacl.Bignum32.pbn_mont_ctx_u32 = Type0\nlet pbn_mont_ctx_u32 = MA.pbn_mont_ctx_u32", "val cd: Type0\nlet cd: Type0 = unit", "val cd: Type0\nlet cd: Type0 = unit", "val Hacl.Bignum.MontArithmetic.pbn_mont_ctx_u32 = Type0\nlet pbn_mont_ctx_u32 = B.pointer bn_mont_ctx_u32", "val Spec.Agile.AEAD.supported_alg = Type0\nlet supported_alg = a:alg { is_supported_alg a }", "val Hacl.Streaming.Blake2s_128.state_t = Type0\nlet state_t = F.state_s (blake2s_128 0) () (Common.s Spec.Blake2S Core.M128) (Common.empty_key Spec.Blake2S)", "val Hacl.Bignum.MontArithmetic.bn_mont_ctx_u64 = Type0\nlet bn_mont_ctx_u64 = bn_mont_ctx' U64 (lb U64) (ll U64)", "val Hacl.Streaming.Blake2s_32.state_t = Type0\nlet state_t = F.state_s (blake2s_32 0) () (Common.s Spec.Blake2S Core.M32) (Common.empty_key Spec.Blake2S)", "val Hacl.Streaming.SHA2.state_t_256 = Type0\nlet state_t_256 = Hacl.Streaming.MD.state_32", "val EverCrypt.Hash.alg = Type0\nlet alg = fixed_len_alg", "val ZetaHashAccumulator.hash_value_buf = Type0\nlet hash_value_buf = x:A.array U8.t { A.length x == 32 \u2227 A.is_full_array x }", "val Zeta.Steel.HashAccumulator.iv_buffer = Type0\nlet iv_buffer = b:A.array U8.t { A.length b == iv_len }", "val Hacl.Streaming.Poly1305_128.state_t = Type0\nlet state_t = F.state_s (poly1305 M128) () (t M128) (poly1305_key.I.s ())", "val Hacl.K256.Scalar.qelem = Type0\nlet qelem = lbuffer uint64 qnlimb", "val OPLSS.HMACSHA1.msg = Type0\nlet msg = bytes", "val MiTLS.AEAD.address = Type0\nlet address = nat", "val Hacl.Impl.SHA2.Types.uint8_8p = Type0\nlet uint8_8p = uint8_1p & uint8_7p", "val Hacl.Impl.SHA2.Types.uint8_7p = Type0\nlet uint8_7p = uint8_1p & uint8_6p", "val Hacl.Bignum64.pbn_mont_ctx_u64 = Type0\nlet pbn_mont_ctx_u64 = MA.pbn_mont_ctx_u64", "val Model.AEAD.safe_id = Type0\nlet safe_id =\n i:id{is_safe i}", "val Zeta.Steel.LogEntry.Types.hash_value = Type0\nlet hash_value = KU.u256" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.abcd_idx" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.abcd_t" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.t_idx" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.x_idx" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.rotate_idx" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA3.fst", "name": "Hacl.Impl.SHA3.index" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.x_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Blake2.Core.fsti", "name": "Hacl.Impl.Blake2.Core.index_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Salsa20.Core32.fst", "name": "Hacl.Impl.Salsa20.Core32.index" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD5.fst", "name": "Hacl.Streaming.MD5.state_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32.fst", "name": "Hacl.Impl.Chacha20.Core32.index" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.MD.fsti", "name": "Hacl.Hash.MD.legacy_alg" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Idx.fst", "name": "MiTLS.Idx.h_table" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.HPKE.fsti", "name": "Spec.Agile.HPKE.hash_algorithm" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD.fst", "name": "Hacl.Streaming.MD.alg" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32xN.fst", "name": "Hacl.Impl.Chacha20.Core32xN.index" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Hashing.Spec.fst", "name": "MiTLS.Hashing.Spec.alg" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.md_alg" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_desc_hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA3.fst", "name": "Hacl.Impl.SHA3.state" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_256.fsti", "name": "Hacl.Blake2b_256.bytes" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.HMAC.fsti", "name": "MiTLS.HMAC.ha" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD.fst", "name": "Hacl.Streaming.MD.state_32" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_hash_value" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD.fst", "name": "Hacl.Streaming.MD.state_64" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_32.fsti", "name": "Hacl.Blake2b_32.bytes" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Core.SHA1.fst", "name": "Hacl.Hash.Core.SHA1.w_t" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.sha2_alg" }, { "project_name": "steel", "file_name": "HaclExample2.fst", "name": "HaclExample2.comp_name" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.id" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.index" }, { "project_name": "steel", "file_name": "HaclExample2.fst", "name": "HaclExample2.twenty" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.alg" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_hash_value" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD.fst", "name": "Hacl.Streaming.MD.uint8" }, { "project_name": "hacl-star", "file_name": "Hacl.HPKE.Interface.AEAD.fsti", "name": "Hacl.HPKE.Interface.AEAD.iv" }, { "project_name": "hacl-star", "file_name": "Hacl.HPKE.Interface.AEAD.fsti", "name": "Hacl.HPKE.Interface.AEAD.kv" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_desc_hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Keccak.fst", "name": "Hacl.Streaming.Keccak.hash_buf" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.alg" }, { "project_name": "dice-star", "file_name": "L0.Base.fst", "name": "L0.Base.l0_hash_alg" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.iv" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Keccak.fst", "name": "Hacl.Streaming.Keccak.hash_buf2" }, { "project_name": "steel", "file_name": "HACL.fst", "name": "HACL.hashable_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Core.SHA1.fst", "name": "Hacl.Hash.Core.SHA1.block_t" }, { "project_name": "steel", "file_name": "HaclExample.fst", "name": "HaclExample.comp_name" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.SHA1.fst", "name": "Hacl.Streaming.SHA1.state_t" }, { "project_name": "steel", "file_name": "HaclExample2.fst", "name": "HaclExample2.five" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Salsa20.Core32.fst", "name": "Hacl.Impl.Salsa20.Core32.state" }, { "project_name": "zeta", "file_name": "Zeta.Steel.HashAccumulator.fsti", "name": "Zeta.Steel.HashAccumulator.iv_t" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.ib" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.Pkg.fsti", "name": "MiTLS.AEAD.Pkg.x" }, { "project_name": "steel", "file_name": "HaclExample.fst", "name": "HaclExample.twenty" }, { "project_name": "steel", "file_name": "HACL.fst", "name": "HACL.hkdf_lbl_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Keccak.fst", "name": "Hacl.Streaming.Keccak.alg" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.blake_alg" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Definitions.fst", "name": "Spec.Blake2.Definitions.row_idx" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.keccak_alg" }, { "project_name": "hacl-star", "file_name": "Hacl.HMAC_DRBG.fsti", "name": "Hacl.HMAC_DRBG.supported_alg" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.MD.fst", "name": "Hacl.Streaming.MD.uint32" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.b128" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Types.fst", "name": "Hacl.Impl.SHA2.Types.uint8_5p" }, { "project_name": "steel", "file_name": "HaclExample.fst", "name": "HaclExample.five" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Poly1305.Vec.fst", "name": "Hacl.Spec.Poly1305.Vec.pfelem" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.SHA2.fst", "name": "Hacl.Streaming.SHA2.state_t_512" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Definitions.fst", "name": "Hacl.Hash.Definitions.fixed_len_impl" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.counter" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.ic" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum25519.fsti", "name": "Hacl.Bignum25519.felem" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.MontArithmetic.fsti", "name": "Hacl.Bignum.MontArithmetic.bn_mont_ctx_u32" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.ia" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Poly1305_256.fsti", "name": "Hacl.Streaming.Poly1305_256.state_t" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.fixed_len_alg" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32.fst", "name": "Hacl.Impl.Chacha20.Core32.state" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum25519.fsti", "name": "Hacl.Bignum25519.point" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.nonce" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Poly1305.Field32xN.fst", "name": "Hacl.Spec.Poly1305.Field32xN.tup64_5" }, { "project_name": "steel", "file_name": "HACL.fst", "name": "HACL.hkdf_ikm_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum32.fsti", "name": "Hacl.Bignum32.pbn_mont_ctx_u32" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cd" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cd" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.MontArithmetic.fsti", "name": "Hacl.Bignum.MontArithmetic.pbn_mont_ctx_u32" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.AEAD.fsti", "name": "Spec.Agile.AEAD.supported_alg" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2s_128.fst", "name": "Hacl.Streaming.Blake2s_128.state_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.MontArithmetic.fsti", "name": "Hacl.Bignum.MontArithmetic.bn_mont_ctx_u64" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2s_32.fst", "name": "Hacl.Streaming.Blake2s_32.state_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.SHA2.fst", "name": "Hacl.Streaming.SHA2.state_t_256" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.fsti", "name": "EverCrypt.Hash.alg" }, { "project_name": "steel", "file_name": "ZetaHashAccumulator.fst", "name": "ZetaHashAccumulator.hash_value_buf" }, { "project_name": "zeta", "file_name": "Zeta.Steel.HashAccumulator.fsti", "name": "Zeta.Steel.HashAccumulator.iv_buffer" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Poly1305_128.fsti", "name": "Hacl.Streaming.Poly1305_128.state_t" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fsti", "name": "Hacl.K256.Scalar.qelem" }, { "project_name": "FStar", "file_name": "OPLSS.HMACSHA1.fst", "name": "OPLSS.HMACSHA1.msg" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.address" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Types.fst", "name": "Hacl.Impl.SHA2.Types.uint8_8p" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Types.fst", "name": "Hacl.Impl.SHA2.Types.uint8_7p" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum64.fsti", "name": "Hacl.Bignum64.pbn_mont_ctx_u64" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.safe_id" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Types.fst", "name": "Zeta.Steel.LogEntry.Types.hash_value" } ], "selected_premises": [ "Spec.MD5.ic", "Lib.IntTypes.size", "Hacl.Hash.Definitions.prev_len_v", "Spec.MD5.ia", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "Lib.UpdateMulti.uint8", "Spec.MD5.ib", "Spec.MD5.id", "Spec.Agile.Hash.coerce", "Lib.Buffer.as_seq", "Spec.MD5.overwrite_aux", "Lib.IntTypes.u8", "Lib.Buffer.lbuffer", "Hacl.Hash.Core.MD5._h0", "Hacl.Hash.PadFinish.finish", "Spec.SHA2.Constants.h224_l", "LowStar.Buffer.gcmalloc_of_list", "LowStar.ConstBuffer.qbuf_pre", "Lib.Buffer.modifies", "Spec.MD5.init_as_list", "Hacl.Hash.Core.MD5._t", "Lib.Buffer.gsub", "Spec.SHA2.Constants.h256_l", "LowStar.Monotonic.Buffer.srel", "Lib.Buffer.disjoint", "Spec.MD5.overwrite", "Lib.Buffer.loc", "Spec.MD5.round1", "Spec.SHA2.Constants.h256", "Spec.Hash.Definitions.words_state", "Lib.Buffer.lbuffer_t", "LowStar.BufferOps.op_Bang_Star", "Spec.Hash.Definitions.is_shake", "Lib.IntTypes.max_size_t", "Spec.MD5.round2", "Hacl.Hash.Definitions.as_seq", "Spec.MD5.round3", "Lib.IntTypes.range", "Lib.Sequence.createL", "Hacl.Impl.SHA3.state", "Hacl.Hash.Definitions.m_spec", "Spec.SHA2.Constants.h224", "Hacl.Hash.Core.MD5.abcd_t", "Lib.IntTypes.v", "Lib.IntTypes.uint_t", "Lib.IntTypes.u32", "Spec.MD5.t", "Lib.Sequence.lseq", "Spec.Hash.Definitions.hash_length", "Spec.AES.to_elem", "Lib.Buffer.eq_or_disjoint", "LowStar.ImmutableBuffer.immutable_preorder", "Spec.SHA2.Constants.h384_l", "Lib.IntTypes.uint_v", "Lib.Sequence.to_seq", "Lib.Sequence.seq", "Spec.MD5.update", "FStar.Int.Cast.Full.uint64_to_uint128", "Hacl.Impl.Blake2.Core.blake2b_params_v", "Spec.SHA2.Constants.h512", "Lib.IntVector.width", "Lib.IntTypes.int_t", "Hacl.Hash.Definitions.mk_impl", "Hacl.Impl.SHA3.set", "Spec.SHA2.Constants.k384_512", "Spec.MD5.round3_op", "Spec.MD5.abcd_idx", "Spec.MD5.round4", "Hacl.Hash.Definitions.impl_word", "FStar.Int.Cast.uint64_to_uint32", "Hacl.Impl.SHA3.state_chi_inner", "Hacl.Impl.Blake2.Generic.get_iv", "Spec.MD5.x_t", "Spec.SHA2.Constants.k224_256", "Lib.Buffer.op_Bar_Plus_Bar", "Lib.Sequence.length", "Spec.SHA2.Constants.h384", "Hacl.Impl.Blake2.Core.blake2b_params_loc", "Spec.Hash.Definitions.is_keccak", "Spec.MD5.round1_aux", "Hacl.Impl.Blake2.Core.blake2s_params_v", "Spec.MD5.round1_op", "FStar.Int.Cast.uint32_to_uint64", "Spec.Agile.Hash.init", "Lib.IntVector.v_inttype", "Spec.AES.elem", "FStar.UInt.size", "Lib.Buffer.buffer_t", "Hacl.Impl.SHA3.get", "Spec.MD5.t_as_list", "Spec.MD5.abcd_t", "C.Loops.do_while", "C.Loops.total_while_gen", "Lib.ByteSequence.lbytes", "Hacl.Hash.Core.MD5.legacy_alloca", "Lib.IntTypes.bits", "Hacl.Impl.SHA3.state_iota", "Spec.MD5.round_op_gen", "Hacl.Impl.SHA3.absorb_next" ], "source_upto_this": "module Hacl.Hash.Core.MD5\n\nmodule B = LowStar.Buffer\nmodule IB = LowStar.ImmutableBuffer\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\nmodule Spec = Spec.MD5\nopen Lib.IntTypes\n\nmodule U32 = FStar.UInt32\n\nopen Hacl.Hash.Definitions\nopen Spec.Hash.Definitions\n\nfriend Spec.MD5\nfriend Hacl.Hash.PadFinish\nfriend Spec.Agile.Hash\n\n(** Top-level constant arrays for the MD5 algorithm. *)\nlet _h0 = IB.igcmalloc_of_list HS.root Spec.init_as_list\nlet _t = IB.igcmalloc_of_list HS.root Spec.t_as_list\n\nnoextract inline_for_extraction\nlet alloca () =\n B.alloca_of_list Spec.init_as_list\n\n(* We read values from constant buffers through accessors to isolate\n all recall/liveness issues away. Thus, clients will not need to\n know that their output buffers be disjoint from our constant\n immutable buffers. *)\n\ninline_for_extraction\nlet h0 (i: U32.t { U32.v i < 4 } ) : HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == Seq.index Spec.init (U32.v i)\n ))\n= IB.recall_contents _h0 Spec.init;\n B.index _h0 i\n\ninline_for_extraction\nlet t (i: U32.t { U32.v i < 64 } ) : HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == Seq.index Spec.t (U32.v i)\n ))\n= IB.recall_contents _t Spec.t;\n B.index _t i\n\nlet seq_index_upd (#t: Type) (s: Seq.seq t) (i: nat) (v: t) (j: nat) : Lemma\n (requires (i < Seq.length s /\\ j < Seq.length s))\n (ensures (Seq.index (Seq.upd s i v) j == (if j = i then v else Seq.index s j)))\n [SMTPat (Seq.index (Seq.upd s i v) j)]\n= ()\n\nlet init s =\n let h = HST.get () in\n let inv (h' : HS.mem) (i: nat) : GTot Type0 =\n B.live h' s /\\ B.modifies (B.loc_buffer s) h h' /\\ i <= 4 /\\ Seq.slice (B.as_seq h' s) 0 i == Seq.slice Spec.init 0 i\n in\n C.Loops.for 0ul 4ul inv (fun i ->\n B.upd s i (h0 i);\n let h' = HST.get () in\n Seq.snoc_slice_index (B.as_seq h' s) 0 (U32.v i);\n Seq.snoc_slice_index (Spec.init) 0 (U32.v i)\n )\n\ninline_for_extraction\nlet abcd_t = (b: B.buffer uint32 { B.length b == 4 } )\n\ninline_for_extraction", "sketch": [ "The definition `abcd_idx` is about indexing the elements of the `abcd` array used in the MD5 algorithm.\n\nStep 1: We define a type `abcd_idx` to represent the indices of the `abcd` array.\n\nStep 2: We implement the `abcd_idx` type as a simple alias for the `U32.t` type, which represents 32-bit unsigned integers.", "The definition `abcd_idx` is a type representing the indices for the `abcd` array used in the MD5 algorithm.", "The definition `abcd_idx` is a type representing the indices for the `abcd` array used in the MD5 algorithm.", "The definition `abcd_idx` is about defining the index type for the `abcd` array used in the MD5 algorithm.\n\nStep 1: We define a new type `abcd_idx` to represent the indices for the `abcd` array.\n\nStep 2: The `abcd_idx` type is implemented as a simple alias for the `U32.t` type, representing 32-bit unsigned integers.", "The definition `abcd_idx` is about defining the index type for the MD5 algorithm's internal state array.\n\nStep 1: We define a new type `abcd_idx` to represent the indices used to access elements of the internal state array in the MD5 algorithm.\n\nStep 2: The `abcd_idx` type is implemented as a simple alias for the `nat` type, representing natural numbers, as the indices for the internal state array are based on natural numbers.", "The definition `abcd_idx` is about defining an index type for the MD5 algorithm.\n\nStep 1: We define a new type `abcd_idx` to represent the indices used in the MD5 algorithm.\n\nStep 2: We implement the definition by creating a new type `abcd_idx` and specifying its properties and constraints.", "The `abcd_idx` function is implemented by taking the `abcd_t` buffer and the index of the element to be retrieved as input. It then returns the value at the specified index in the `abcd_t` buffer.", "The `abcd_idx` function is implemented by taking the `abcd_t` buffer and the index of the element to be retrieved as input. It then uses the `B.index` function to retrieve the element at the specified index from the `abcd_t` buffer.", "The definition `abcd_idx` is about defining the index type for the MD5 algorithm's internal state array.\n\nStep 1: We define the `abcd_idx` type to represent the indices of the internal state array used in the MD5 algorithm.\n\nStep 2: The `abcd_idx` type is implemented as a simple enumeration type with four possible values representing the indices 0, 1, 2, and 3.", "The definition `abcd_idx` is about defining the index type for the MD5 algorithm's internal state array.\n\nStep 1: We define a new type `abcd_idx` to represent the indices for the internal state array used in the MD5 algorithm.\n\nStep 2: We implement the definition by specifying the type `abcd_idx` and any constraints or properties associated with it." ], "generated_solution": [ "type abcd_idx = U32.t", "type abcd_idx = U32.t { U32.v abcd_idx < 4 }", "type abcd_idx = U32.t { U32.v abcd_idx < 4 }", "type abcd_idx = U32.t", "type abcd_idx = nat", "type abcd_idx = U32.t { U32.v abcd_idx < 4 }", "val abcd_idx : abcd_t: B.buffer uint32 { B.length abcd_t == 4 } -> i: nat { i < 4 } -> HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == B.index abcd_t i\n ))", "val abcd_idx : abcd_t:B.buffer uint32 { B.length abcd_t == 4 } -> i:U32.t { U32.v i < 4 } -> HST.Stack uint32\n (requires (fun _ -> True))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == B.index abcd_t i\n ))", "type abcd_idx = | A | B | C | D", "type abcd_idx = U32.t { U32.v abcd_idx < 4 }" ] }, { "file_name": "EverParse3d.Interpreter.fst", "name": "EverParse3d.Interpreter.interp_loc", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "FStar.List.Tot" }, { "abbrev": "CP", "full_module": "EverParse3d.CopyBuffer" }, { "abbrev": "T", "full_module": "FStar.Tactics" }, { "abbrev": "P", "full_module": "EverParse3d.Prelude" }, { "abbrev": "A", "full_module": "EverParse3d.Actions.All" }, { "abbrev": "U64", "full_module": "FStar.UInt64" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "EverParse3d" }, { "open": "EverParse3d" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 0, "initial_ifuel": 2, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.qi.eager_threshold=10" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let interp_loc = interp_index A.eloc_none", "source_range": { "start_line": 251, "start_col": 0, "end_line": 251, "end_col": 41 }, "interleaved": false, "definition": "EverParse3d.Interpreter.interp_index EverParse3d.Actions.Base.eloc_none", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "EverParse3d.Interpreter.interp_index", "EverParse3d.Actions.Base.eloc", "EverParse3d.Actions.Base.eloc_none" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc\n -> Prims.GTot EverParse3d.Actions.Base.eloc", "prompt": "let interp_loc =\n ", "expected_response": "interp_index A.eloc_none", "source": { "project_name": "everparse", "file_name": "src/3d/prelude/EverParse3d.Interpreter.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git" }, "dependencies": { "source_file": "EverParse3d.Interpreter.fst", "checked_file": "dataset/EverParse3d.Interpreter.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/EverParse3d.Prelude.fsti.checked", "dataset/EverParse3d.CopyBuffer.fsti.checked", "dataset/EverParse3d.Actions.BackendFlag.fsti.checked", "dataset/EverParse3d.Actions.All.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "let ___EVERPARSE_COPY_BUFFER_T = CP.copy_buffer_t", "let specialize = ()", "itype", "UInt8", "UInt8", "UInt8", "UInt16", "UInt16", "UInt16", "UInt32", "UInt32", "UInt32", "UInt64", "UInt64", "UInt64", "UInt8BE", "UInt8BE", "UInt8BE", "UInt16BE", "UInt16BE", "UInt16BE", "UInt32BE", "UInt32BE", "UInt32BE", "UInt64BE", "UInt64BE", "UInt64BE", "Unit", "Unit", "Unit", "AllBytes", "AllBytes", "AllBytes", "AllZeros", "AllZeros", "AllZeros", "let itype_as_type (i:itype)\r\n : Type\r\n = match i with\r\n | UInt8 -> P.___UINT8\r\n | UInt16 -> P.___UINT16\r\n | UInt32 -> P.___UINT32\r\n | UInt64 -> P.___UINT64\r\n | UInt8BE -> P.___UINT8BE\r\n | UInt16BE -> P.___UINT16BE\r\n | UInt32BE -> P.___UINT32BE\r\n | UInt64BE -> P.___UINT64BE\r\n | Unit -> unit\r\n | AllBytes -> P.all_bytes\r\n | AllZeros -> P.all_zeros", "let parser_kind_nz_of_itype (i:itype)\r\n : bool\r\n = match i with\r\n | Unit\r\n | AllBytes\r\n | AllZeros -> false\r\n | _ -> true", "let parser_weak_kind_of_itype (i:itype)\r\n : P.weak_kind\r\n = match i with\r\n | AllBytes\r\n | AllZeros -> P.WeakKindConsumesAll\r\n | _ -> P.WeakKindStrongPrefix", "let parser_kind_of_itype (i:itype)\r\n : P.parser_kind (parser_kind_nz_of_itype i)\r\n (parser_weak_kind_of_itype i)\r\n = match i with\r\n | UInt8 -> P.kind____UINT8\r\n | UInt16 -> P.kind____UINT16\r\n | UInt32 -> P.kind____UINT32\r\n | UInt64 -> P.kind____UINT64\r\n | UInt8BE -> P.kind____UINT8BE\r\n | UInt16BE -> P.kind____UINT16BE\r\n | UInt32BE -> P.kind____UINT32BE\r\n | UInt64BE -> P.kind____UINT64BE\r\n | Unit -> P.kind_unit\r\n | AllBytes -> P.kind_all_bytes\r\n | AllZeros -> P.kind_all_zeros", "let itype_as_parser (i:itype)\r\n : P.parser (parser_kind_of_itype i) (itype_as_type i)\r\n = match i with\r\n | UInt8 -> P.parse____UINT8\r\n | UInt16 -> P.parse____UINT16\r\n | UInt32 -> P.parse____UINT32\r\n | UInt64 -> P.parse____UINT64\r\n | UInt8BE -> P.parse____UINT8BE\r\n | UInt16BE -> P.parse____UINT16BE\r\n | UInt32BE -> P.parse____UINT32BE\r\n | UInt64BE -> P.parse____UINT64BE\r\n | Unit -> P.parse_unit\r\n | AllBytes -> P.parse_all_bytes\r\n | AllZeros -> P.parse_all_zeros", "let allow_reader_of_itype (i:itype)\r\n : bool\r\n = match i with\r\n | AllBytes\r\n | AllZeros -> false\r\n | _ -> true", "let itype_as_leaf_reader (i:itype { allow_reader_of_itype i })\r\n : A.leaf_reader (itype_as_parser i)\r\n = match i with\r\n | UInt8 -> A.read____UINT8\r\n | UInt16 -> A.read____UINT16\r\n | UInt32 -> A.read____UINT32\r\n | UInt64 -> A.read____UINT64\r\n | UInt8BE -> A.read____UINT8BE\r\n | UInt16BE -> A.read____UINT16BE\r\n | UInt32BE -> A.read____UINT32BE\r\n | UInt64BE -> A.read____UINT64BE\r\n | Unit -> A.read_unit", "let itype_as_validator (i:itype)\r\n : A.validate_with_action_t\r\n (itype_as_parser i)\r\n A.true_inv\r\n A.disjointness_trivial\r\n A.eloc_none\r\n (allow_reader_of_itype i)\r\n = match i with\r\n | UInt8 -> A.validate____UINT8\r\n | UInt16 -> A.validate____UINT16\r\n | UInt32 -> A.validate____UINT32\r\n | UInt64 -> A.validate____UINT64\r\n | UInt8BE -> A.validate____UINT8BE\r\n | UInt16BE -> A.validate____UINT16BE\r\n | UInt32BE -> A.validate____UINT32BE\r\n | UInt64BE -> A.validate____UINT64BE\r\n | Unit -> A.validate_unit\r\n | AllBytes -> A.validate_all_bytes\r\n | AllZeros -> A.validate_all_zeros", "let leaf_reader #nz #wk (#k: P.parser_kind nz wk) #t (p:P.parser k t)\r\n = _:squash (wk == P.WeakKindStrongPrefix /\\ hasEq t) &\r\n A.leaf_reader p", "index", "Trivial", "Trivial", "Trivial", "NonTrivial", "NonTrivial", "NonTrivial", "let join_index (j:'a -> 'a -> 'a) (i0 i1:index 'a)\r\n: index 'a\r\n= match i0 with\r\n | Trivial -> i1\r\n | _ -> (\r\n match i1 with\r\n | Trivial -> i0\r\n | NonTrivial i1 -> \r\n let NonTrivial i0 = i0 in\r\n NonTrivial (j i0 i1)\r\n )", "let interp_index (triv:'a) (i:index 'a)\r\n: GTot 'a\r\n= match i with\r\n | Trivial -> triv\r\n | NonTrivial i -> i", "let inv_index = index A.slice_inv", "let inv_none : inv_index = Trivial", "let join_inv = join_index A.conj_inv", "let interp_inv = interp_index A.true_inv", "let loc_index = index A.eloc", "let loc_none : loc_index = Trivial", "let join_loc = join_index A.eloc_union" ], "closest": [ "val as_loc (x: eloc) : GTot B.loc\nlet as_loc (x:eloc) : GTot B.loc = Ghost.reveal x", "val InterpreterTarget.subst_eloc = s: Target.subst -> i: InterpreterTarget.index InterpreterTarget.eloc\n -> FStar.All.ALL (FStar.Pervasives.Native.option InterpreterTarget.eloc)\nlet subst_eloc s = subst_index (subst_eloc' s)", "val InterpreterTarget.free_vars_of_eloc = i: InterpreterTarget.index InterpreterTarget.eloc -> FStar.All.ML (Prims.list Ast.ident)\nlet free_vars_of_eloc = map_index [] free_vars_of_eloc'", "val LowStar.Lens.put_modifies_loc = el: LowStar.Lens.eloc -> put: LowStar.Lens.put_t (LowStar.Lens.imem inv) b -> Prims.logical\nlet put_modifies_loc #b #inv (el:eloc) (put:put_t (imem inv) b) =\n forall (h0:imem inv) (v:b).{:pattern (put v h0)}\n B.modifies (as_loc el) h0 (put v h0)", "val InterpreterTarget.print_eloc = mname: Prims.string -> i: InterpreterTarget.index InterpreterTarget.eloc\n -> FStar.All.ML Prims.string\nlet print_eloc mname = print_index (print_eloc' mname)", "val LowStar.Lens.get_reads_loc = el: LowStar.Lens.eloc -> get: LowStar.Lens.get_t (LowStar.Lens.imem inv) b -> Prims.logical\nlet get_reads_loc #b #inv (el:eloc) (get:get_t (imem inv) b) =\n forall (h0 h1:imem inv) loc. {:pattern (B.modifies loc h0 h1); (get h1)}\n B.loc_disjoint (as_loc el) loc /\\\n B.modifies loc h0 h1 ==>\n get h0 == get h1", "val arg_loc (x: arg) : GTot B.loc\nlet arg_loc (x:arg) : GTot B.loc =\n match x with\n | (|TD_Buffer _ _ _, x|) -> B.loc_buffer x\n | (|TD_ImmBuffer _ _ _, x|) -> B.loc_buffer x\n | (|TD_Base _, _|) -> B.loc_none", "val path_loc: path_p -> GTot loc\nlet path_loc p = B.loc_all_regions_from false (B.frameOf p)", "val Vale.X64.Decls.loc_buffer = b: Vale.X64.Memory.buffer t -> Prims.GTot Vale.X64.Memory.loc\nlet loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b", "val InterpreterTarget.id_as_expr = i: Ast.ident -> Target.expr' * (Ast.pos * Ast.pos)\nlet id_as_expr (i:A.ident) = T.mk_expr (T.Identifier i)", "val rs_loc_elem:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n rs:S.seq a -> i:nat{i < S.length rs} ->\n GTot loc\nlet rs_loc_elem #a #rst rg rs i =\n loc_all_regions_from false (Rgl?.region_of rg (S.index rs i))", "val loc (#t: buftype) (#a: Type0) (b: buffer_t t a) : GTot B.loc\nlet loc (#t:buftype) (#a:Type0) (b:buffer_t t a) : GTot B.loc =\n match t with\n | MUT -> B.loc_buffer (b <: buffer a)\n | IMMUT -> B.loc_buffer (b <: ibuffer a)\n | CONST -> CB.loc_buffer (b <: cbuffer a)", "val Vale.PPC64LE.Decls.loc_buffer = b: Vale.PPC64LE.Memory.buffer t -> Prims.GTot Vale.PPC64LE.Memory.loc\nlet loc_buffer(#t:M.base_typ) (b:M.buffer t) = M.loc_buffer #t b", "val modified_arg_loc (x: arg) : GTot B.loc\nlet modified_arg_loc (x:arg) : GTot B.loc =\n match x with\n | (|TD_Buffer _ _ {modified=true}, x|) -> B.loc_buffer x\n | _ -> B.loc_none", "val WithLocal.eloc = Type0\nlet eloc = Ghost.erased B.loc", "val OPLSS2021.IFC.does_not_read_loc = f: OPLSS2021.IFC.comp a -> l: OPLSS2021.IFC.loc -> s0: OPLSS2021.IFC.store -> Prims.logical\nlet does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v", "val InterpreterTarget.eq_tags = e: InterpreterTarget.eloc -> e': InterpreterTarget.eloc -> Prims.bool\nlet eq_tags e e' =\r\n match e, e' with\r\n | Eloc_output, Eloc_output\r\n | Eloc_union _ _, Eloc_union _ _ \r\n | Eloc_ptr _, Eloc_ptr _ \r\n | Eloc_copy_buf _, Eloc_copy_buf _ -> true\r\n | _ -> false", "val LowStar.ConstBuffer.loc_buffer = c: LowStar.ConstBuffer.const_buffer 'a -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet loc_buffer (c:const_buffer 'a) = B.loc_buffer (as_mbuf c)", "val norm_loc (l: loc) : loc\nlet norm_loc (l:loc) : loc =\n norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l", "val norm_loc (l: loc) : loc\nlet norm_loc (l:loc) : loc =\n norm [zeta; iota; delta_only [`%loc_mutable_buffers]; delta_attr [`%norm_loc_attr]] l", "val modified_arg_mloc (x: arg) : GTot ME.loc\nlet modified_arg_mloc (x:arg) : GTot ME.loc =\n match x with\n | (|TD_Buffer src t {modified=true}, x|) -> ME.loc_buffer (as_vale_buffer #src #t x)\n | _ -> ME.loc_none", "val rv_loc_elems:\n #a:Type0 -> #rst:Type -> #rg:regional rst a ->\n h:HS.mem -> rv:rvector rg ->\n i:uint32_t -> j:uint32_t{i <= j && j <= V.size_of rv} ->\n GTot loc\nlet rv_loc_elems #a #rst #rg h rv i j =\n rs_loc_elems rg (V.as_seq h rv) (U32.v i) (U32.v j)", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l =\n assert_norm (MG.cls abuffer == MG.cls ubuffer);\n coerce (MG.loc cloc_cls) l", "val Vale.PPC64LE.Decls.loc_union = s1: Vale.PPC64LE.Memory.loc -> s2: Vale.PPC64LE.Memory.loc -> Prims.GTot Vale.PPC64LE.Memory.loc\nlet loc_union = M.loc_union", "val LowStar.Monotonic.Buffer.loc_union_l = l: Prims.list LowStar.Monotonic.Buffer.loc -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet loc_union_l (l:list loc) =\n BigOps.normal (List.Tot.fold_right_gtot l loc_union loc_none)", "val loc_regions\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions false", "val loc_vector: #a:Type -> vector a -> GTot loc\nlet loc_vector #a vec =\n B.loc_buffer (Vec?.vs vec)", "val rv_loc_elem:\n #a:Type0 -> #rst:Type -> #rg:regional rst a ->\n h:HS.mem -> rv:rvector rg ->\n i:uint32_t{i < V.size_of rv} ->\n GTot loc\nlet rv_loc_elem #a #rst #rg h rv i =\n rs_loc_elems rg (V.as_seq h rv) (U32.v i) (U32.v i+1)", "val loc_all_args (args: list arg) : GTot B.loc\nlet loc_all_args (args:list arg) : GTot B.loc =\n let l = List.Tot.map_gtot arg_loc args in\n List.Tot.fold_right_gtot l B.loc_union B.loc_none", "val ptr_loc (#a: _) (x: bpointer a) : Tot eloc\nlet ptr_loc #a (x:B.pointer a) : Tot eloc = B.loc_buffer x", "val Sec2.IFC.does_not_read_loc = f: Sec2.IFC.comp a -> reads: Sec2.IFC.label -> l: Sec2.IFC.loc -> s0: Sec2.IFC.store\n -> Prims.logical\nlet does_not_read_loc #a (f:comp a) (reads:label) (l:loc) (s0:store) =\n forall v.\n does_not_read_loc_v f reads l s0 v", "val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc\nlet loc_of_cloc l =\n assert_norm (MG.cls abuffer == MG.cls ubuffer);\n coerce loc l", "val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc\nlet loc_of_cloc l = l", "val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc\nlet loc_of_cloc l = l", "val mt_loc: mt_p -> GTot loc\nlet mt_loc mt = B.loc_all_regions_from false (B.frameOf mt)", "val Sec2.IFC.havoc = s: Sec2.IFC.store -> l: Sec2.IFC.loc -> x: Prims.int -> Sec2.IFC.store\nlet havoc s l x = upd s l x", "val LowStar.ConstBuffer.loc_addr_of_buffer = c: LowStar.ConstBuffer.const_buffer 'a -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet loc_addr_of_buffer (c:const_buffer 'a) = B.loc_addr_of_buffer (as_mbuf c)", "val mloc_modified_args (args: list arg) : GTot ME.loc\nlet mloc_modified_args (args:list arg) : GTot ME.loc =\n List.fold_right_gtot (List.map_gtot modified_arg_mloc args) ME.loc_union ME.loc_none", "val OPLSS2021.IFC.does_not_read_loc_v = f: OPLSS2021.IFC.comp a -> l: OPLSS2021.IFC.loc -> s0: OPLSS2021.IFC.store -> v: Prims.int\n -> Prims.logical\nlet does_not_read_loc_v #a (f:comp a) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in //s0 and s0' agree except on l\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in // run f twice, once on s0, once on s0'\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same in both runs\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))", "val loc_pointer\n (#t: typ)\n (p: pointer t)\n: GTot loc\nlet loc_pointer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p)", "val app_loc (x: AppCtxt.app_ctxt) (l: eloc) : eloc\nlet app_loc (x:AppCtxt.app_ctxt) (l:eloc) : eloc = \n AppCtxt.properties x;\n AppCtxt.loc_of x `loc_union` l", "val loc_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot (loc c)\nlet loc_addresses #al #c preserve_liveness r n =\n let regions = (Ghost.hide (Set.singleton r)) in\n Loc\n regions\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> if preserve_liveness then GSet.empty else GSet.of_set n))\n (mk_live_addrs (fun _ -> GSet.of_set n))\n (Ghost.hide (aloc_domain c regions (fun _ -> GSet.of_set n)))", "val external_action (l: eloc) : Tot Type0\nlet external_action l =\n unit -> Stack unit (fun _ -> True) (fun h0 _ h1 -> B.modifies l h0 h1)", "val Vale.X64.Decls.loc_union = s1: Vale.X64.Memory.loc -> s2: Vale.X64.Memory.loc -> Prims.GTot Vale.X64.Memory.loc\nlet loc_union = M.loc_union", "val loc_modified_args (args: list arg) : GTot B.loc\nlet loc_modified_args (args:list arg) : GTot B.loc =\n let maybe_union_loc (x:arg) l =\n match x with\n | (|TD_Buffer _ _ {modified=true}, x|) -> B.loc_union (B.loc_buffer x) l\n | _ -> l\n in\n List.Tot.fold_right_gtot args maybe_union_loc B.loc_none", "val InterpreterTarget.print_ityp = i: InterpreterTarget.itype -> Prims.string\nlet print_ityp (i:itype) =\r\n match i with\r\n | UInt8 -> \"UInt8\"\r\n | UInt16 -> \"UInt16\"\r\n | UInt32 -> \"UInt32\"\r\n | UInt64 -> \"UInt64\"\r\n | UInt8BE -> \"UInt8BE\"\r\n | UInt16BE -> \"UInt16BE\"\r\n | UInt32BE -> \"UInt32BE\"\r\n | UInt64BE -> \"UInt64BE\"\r\n | Unit -> \"Unit\"\r\n | AllBytes -> \"AllBytes\"\r\n | AllZeros -> \"AllZeros\"", "val Steel.Memory.set_add = i: Steel.Memory.iname -> s: Steel.Memory.inames -> Prims.GTot (FStar.Set.set Steel.Memory.iname)\nlet set_add (i:iname) (s:inames) = Set.union (Set.singleton i) s", "val old_to_union_loc (l: OldM.loc) : GTot (M.loc old_and_new_cl_union)\nlet old_to_union_loc (l: OldM.loc) : GTot (M.loc old_and_new_cl_union) =\n M.union_loc_of_loc old_and_new_cl false (OldM.cloc_of_loc l)", "val TranslateForInterpreter.check_in_global_env = env: TranslateForInterpreter.global_env -> i: Ast.ident -> FStar.All.ALL Prims.unit\nlet check_in_global_env (env:global_env) (i:A.ident) =\r\n let _ = B.lookup_expr_name (B.mk_env env.benv) i in ()", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val loc_of_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b: aloc r n)\n: GTot (loc c)\nlet loc_of_aloc #al #c #r #n b =\n let regions = (Ghost.hide (Set.singleton r)) in\n let region_liveness_tags = (Ghost.hide (Set.empty)) in\n Loc\n regions\n region_liveness_tags\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide (GSet.singleton (ALoc r n (Some b))))", "val lower_loc (#al: aloc_t u#x) (#c: cls al) (l: loc (raise_cls u#x u#y c)) : Tot (loc c)\nlet lower_loc #al #c l =\n let (Loc regions region_liveness_tags non_live_addrs live_addrs aux) = l in\n Loc\n regions\n region_liveness_tags\n non_live_addrs\n live_addrs\n (Ghost.hide (GSet.comprehend (lower_loc_aux_pred c aux)))", "val locations_of_explicit (t: instr_operand_explicit) (i: instr_operand_t t) : locations & locations\nlet locations_of_explicit (t:instr_operand_explicit) (i:instr_operand_t t) : locations & locations =\n match t with\n | IOp64 -> locations_of_operand64 i\n | IOpXmm -> locations_of_operand128 i", "val Sec2.IFC.does_not_read_loc_v = f: Sec2.IFC.comp a -> reads: Sec2.IFC.label -> l: Sec2.IFC.loc -> s0: Sec2.IFC.store -> v: Prims.int\n -> Prims.logical\nlet does_not_read_loc_v #a (f:comp a) (reads:label) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same on both sides\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))", "val rs_loc_elems:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n rs:S.seq a -> i:nat -> j:nat{i <= j && j <= S.length rs} ->\n GTot loc (decreases j)\nlet rec rs_loc_elems #a #rst rg rs i j =\n if i = j then loc_none\n else loc_union (rs_loc_elems rg rs i (j - 1))\n (rs_loc_elem rg rs (j - 1))", "val EverParse3d.Actions.Base.liveness_inv = Type\nlet liveness_inv = i:hinv {\n forall l h0 h1. {:pattern (i h1); (modifies l h0 h1)} i h0 /\\ modifies l h0 h1 /\\ address_liveness_insensitive_locs `loc_includes` l ==> i h1\n}", "val loc_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot (loc c)\nlet loc_regions #al #c preserve_liveness r =\n let region_liveness_tags = loc_regions_region_liveness_tags preserve_liveness r in\n let addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { r' `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y } ) =\n GSet.complement GSet.empty\n in\n let live_addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { addrs r' `GSet.subset` y } ) =\n addrs r'\n in\n Loc\n (Ghost.hide r)\n region_liveness_tags\n (mk_non_live_addrs addrs)\n (mk_live_addrs live_addrs)\n (Ghost.hide (aloc_domain c (Ghost.hide r) addrs))", "val DoublyLinkedListIface.loc_equiv = a: LowStar.Monotonic.Buffer.loc -> b: LowStar.Monotonic.Buffer.loc -> Prims.logical\nlet loc_equiv (a b:B.loc) =\n B.loc_includes a b /\\ B.loc_includes b a", "val InterpreterTarget.join_eloc = \n d0: FStar.Pervasives.Native.option InterpreterTarget.eloc ->\n d1: FStar.Pervasives.Native.option InterpreterTarget.eloc\n -> FStar.Pervasives.Native.option InterpreterTarget.eloc\nlet join_eloc = join_index Eloc_union", "val InterpreterTarget.free_vars_of_inv = i: InterpreterTarget.index InterpreterTarget.inv -> FStar.All.ML (Prims.list Ast.ident)\nlet free_vars_of_inv = map_index [] free_vars_of_inv'", "val raise_loc (#al: aloc_t u#x) (#c: cls al) (l: loc c) : Tot (loc (raise_cls u#x u#y c))\nlet raise_loc #al #c l =\n let (Loc regions region_liveness_tags non_live_addrs live_addrs aux) = l in\n Loc\n regions\n region_liveness_tags\n non_live_addrs\n live_addrs\n (Ghost.hide (GSet.comprehend (raise_loc_aux_pred c aux)))", "val loc_mreference\n (#aloc: aloc_t)\n (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n : GTot (loc c)\nlet loc_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses true (HS.frameOf b) (Set.singleton (HS.as_addr b))", "val Benton2004.RHL.interpolable = p: Benton2004.RHL.gexp Prims.bool -> Type0\nlet interpolable (p: gexp bool) = Benton2004.interpolable (interp p)", "val interp (ge: gexp bool) : GTot sttype\nlet interp (ge: gexp bool) : GTot sttype =\n let g s1 s2 : GTot Type0 = ge s1 s2 == true in\n g", "val read (l: loc) : IST int bot (single l) []\nlet read (l:loc) : IST int bot (single l) [] = IST?.reflect (iread l)", "val read (l: loc) : IST int bot (single l) []\nlet read (l:loc) : IST int bot (single l) [] = IST?.reflect (iread l)", "val MerkleTree.EverCrypt.mt_loc = mt: MerkleTree.Low.mt_p -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet mt_loc = MerkleTree.Low.mt_loc", "val footprint: #i:index -> HS.mem -> state i -> GTot B.loc\nlet footprint #i h s =\n if I.model then\n QModel.rfootprint (mstate s).reader `B.loc_union` QModel.footprint (mstate s).writer\n else QImpl.footprint h (istate s)", "val LowParse.Low.Base.Spec.gaccessor_injective = f: LowParse.Low.Base.Spec.gaccessor' p1 p2 cl -> Prims.logical\nlet gaccessor_injective\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (f: gaccessor' p1 p2 cl)\n= (forall (sl sl' : bytes) . {:pattern (f sl); (f sl')} (gaccessor_pre p1 p2 cl sl /\\ gaccessor_pre p1 p2 cl sl' /\\ injective_precond p1 sl sl') ==> f sl == f sl')", "val Vale.Transformers.DebugPrint.print_ins = i: Vale.X64.Machine_Semantics_s.ins -> _: _ -> Prims.string\nlet print_ins i _ =\n get_non_space (list_of_string (print_ins i gcc))", "val action_field_ptr_after_with_setter\n (u:squash (EverParse3d.Actions.BackendFlag.backend_flag == BackendFlagExtern))\n (sz: FStar.UInt64.t)\n (#output_loc: eloc)\n (write_to: (___PUINT8 -> Tot (external_action output_loc)))\n : action true_inv disjointness_trivial output_loc false bool\nlet action_field_ptr_after_with_setter _ n write_to =\n fun ctxt _err input _len _posBefore currentPosition ->\n let buf = EverParse3d.InputStream.Extern.peep input currentPosition n in\n let buf_not_null = not (LowStar.Buffer.is_null buf) in\n if buf_not_null\n then\n write_to buf ()\n ;\n buf_not_null", "val fresh_loc (l: loc) (h h': HS.mem) : GTot Type0\nlet fresh_loc (l: loc) (h h' : HS.mem) : GTot Type0 =\n loc_unused_in h `loc_includes` l /\\\n loc_not_unused_in h' `loc_includes` l", "val nodelist_fp0 (#t: Type) (n: nodelist t) : GTot Mod.loc\nlet rec nodelist_fp0 (#t:Type) (n:nodelist t) : GTot Mod.loc =\n match n with\n | [] -> Mod.loc_none\n | n :: ns -> Mod.loc_union (Mod.loc_buffer n) (nodelist_fp0 ns)", "val iread (l: loc) : ist int bot (single l) []\nlet iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s", "val iread (l: loc) : ist int bot (single l) []\nlet iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s", "val wf_string_loc_addr (#ty: buftype) (#length: G.erased size_nat) (s: string ty length)\n : GTot B.loc\nlet wf_string_loc_addr (#ty:buftype) (#length : G.erased size_nat) (s : string ty length) :\n GTot B.loc =\n loc_addr_of_buffer s", "val Sec2.IFC.loc = Prims.eqtype\nlet loc = int", "val OPLSS2021.IFC.havoc = s: OPLSS2021.IFC.store -> l: OPLSS2021.IFC.loc -> x: Prims.int -> OPLSS2021.IFC.store\nlet havoc s l x = upd s l x", "val Z3TestGen.ident_to_string = i: Ast.with_meta_t Ast.ident' -> Prims.string\nlet ident_to_string = A.ident_to_string", "val sized_buffer_to_loc (b: sized_buffer) : GTot B.loc\nlet sized_buffer_to_loc (b : sized_buffer) : GTot B.loc =\n if g_is_null b.buffer then B.loc_buffer (b.buffer <: buffer uint8)\n else B.loc_addr_of_buffer (b.buffer <: buffer uint8)", "val Lib.MultiBuffer.loc_multi = b: Lib.MultiBuffer.multibuf lanes len -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet loc_multi #lanes #len b = normalize_term (loc_multi_ #lanes #len 0 b)", "val Vale.Transformers.BoundedInstructionEffects.both = x: (Vale.Transformers.Locations.locations * Vale.Transformers.Locations.locations)\n -> Prims.list Vale.Transformers.Locations.location\nlet both (x: locations & locations) =\n let a, b = x in\n a `L.append` b", "val loc_addresses\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc\nlet loc_addresses = MG.loc_addresses", "val loc_addresses\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc\nlet loc_addresses = MG.loc_addresses", "val Lib.LoopCombinators.fixed_i = f: _ -> i: Prims.nat -> _\nlet fixed_i f (i:nat) = f", "val region_of: #t_k:eqtype -> #t_v:Type0 -> ll:t t_k t_v -> GTot B.loc\nlet region_of #_ #_ ll =\n LL2.region_of ll", "val loc_rvector:\n #a:Type0 -> #rst:Type -> #rg:regional rst a -> rv:rvector rg -> GTot loc\nlet loc_rvector #a #rst #rg rv =\n loc_all_regions_from false (V.frameOf rv)", "val Vale.X64.Decls.locs_disjoint = ls: Prims.list Vale.X64.Memory.loc -> Vale.Def.Prop_s.prop0\nlet locs_disjoint = M.locs_disjoint", "val Sec2.HIFC.does_not_read_loc = f: Sec2.HIFC.hst a p q -> reads: Sec2.HIFC.label -> l: Sec2.HIFC.loc -> s0: Sec2.HIFC.store{p s0}\n -> Prims.logical\nlet does_not_read_loc #a #p #q (f:hst a p q) (reads:label) (l:loc) (s0:store{p s0}) =\n forall v. does_not_read_loc_v f reads l s0 v", "val loc_addresses\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc\nlet loc_addresses = MG.loc_addresses #_ #cls false", "val loc_idx_region: unit -> GTot loc\nlet loc_idx_region _ = loc_region_only true q_idx_region", "val InterpreterTarget.free_vars_of_typ_indexes = i: InterpreterTarget.typ_indexes -> FStar.All.ALL (Prims.list Ast.ident)\nlet free_vars_of_typ_indexes (i:typ_indexes) =\r\n let i, j, d, _ = i in\r\n free_vars_of_inv i @\r\n free_vars_of_eloc j @\r\n free_vars_of_disj d", "val Interop.max_arity = Prims.int\nlet max_arity = 4", "val IntervalIntersect.ppInterval = _: IntervalIntersect.interval -> Prims.string\nlet ppInterval (I f t) = sprintf \"0x%d-0x%d\" (v f) (v t)", "val wf_string_loc (#ty: buftype) (#length: G.erased size_nat) (s: string ty length) : GTot B.loc\nlet wf_string_loc (#ty:buftype) (#length : G.erased size_nat) (s : string ty length) :\n GTot B.loc =\n loc s", "val t_add_i2g\n (#vspec #n: _)\n (ep: epoch)\n (il: verifiable_log vspec n)\n (t: nat{t < n})\n (i: SA.seq_index (t_add_seq_il ep il t))\n : j:\n SA.seq_index (t_add_seq_gl ep il t)\n {S.index (t_add_seq_il ep il t) i = S.index (t_add_seq_gl ep il t) j}\nlet t_add_i2g (#vspec #n:_) (ep: epoch) (il: verifiable_log vspec n) (t:nat{t < n})\n (i:SA.seq_index (t_add_seq_il ep il t))\n : j:SA.seq_index (t_add_seq_gl ep il t){S.index (t_add_seq_il ep il t) i = S.index (t_add_seq_gl ep il t) j}\n = let ta_il = t_add_seq_il ep il t in\n let ta_gl = t_add_seq_gl ep il t in\n let fm = IF.to_fm (is_blum_add_epoch_ifn #vspec #n ep) (blum_add_elem_src_ifn #vspec #n) in\n let a_il = add_il ep il in\n let gl = to_glog il in\n let tl = G.index gl t in\n\n (* index in the add seq sequence *)\n let i1 = s2i_map a_il (t,i) in\n assert(i2s_map a_il i1 = (t,i));\n assert(src a_il i1 = t);\n\n (* index in the interleaved sequence il *)\n let i2 = IF.filter_map_invmap fm il i1 in\n assert(blum_add_elem il i2 = S.index ta_il i);\n assert(src il i2 = t);\n\n (* index in the original log of the t'th thread *)\n let _,i3 = i2s_map il i2 in\n assert(T.blum_add_elem tl i3 = blum_add_elem il i2);\n\n (* map i3 to the add seq - the index with ta_gl *)\n T.add_seq_map tl i3", "val Interop.as_reg = n: Interop.ireg -> Interop.reg\nlet as_reg (n:ireg) =\n match n with\n | 1 -> R1\n | 2 -> R2\n | 3 -> R3\n | 4 -> R4" ], "closest_src": [ { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.as_loc" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.subst_eloc" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.free_vars_of_eloc" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.put_modifies_loc" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.print_eloc" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.get_reads_loc" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.arg_loc" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.path_loc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.loc_buffer" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.id_as_expr" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rs_loc_elem" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.loc" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.loc_buffer" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.modified_arg_loc" }, { "project_name": "FStar", "file_name": "WithLocal.fst", "name": "WithLocal.eloc" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.does_not_read_loc" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.eq_tags" }, { "project_name": "FStar", "file_name": "LowStar.ConstBuffer.fsti", "name": "LowStar.ConstBuffer.loc_buffer" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsMem.fsti", "name": "Vale.X64.InsMem.norm_loc" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsMem.fsti", "name": "Vale.PPC64LE.InsMem.norm_loc" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.ValeSig.fst", "name": "Vale.AsLowStar.ValeSig.modified_arg_mloc" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rv_loc_elems" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.cloc_of_loc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.cloc_of_loc" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.loc_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_union_l" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.loc_vector" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rv_loc_elem" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.loc_all_args" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.ptr_loc" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.does_not_read_loc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_of_cloc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_of_cloc" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_of_cloc" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_loc" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.havoc" }, { "project_name": "FStar", "file_name": "LowStar.ConstBuffer.fsti", "name": "LowStar.ConstBuffer.loc_addr_of_buffer" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.ValeSig.fst", "name": "Vale.AsLowStar.ValeSig.mloc_modified_args" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.does_not_read_loc_v" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_pointer" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.app_loc" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_addresses" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.external_action" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.loc_union" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.loc_modified_args" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.print_ityp" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.set_add" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc" }, { "project_name": "everparse", "file_name": "TranslateForInterpreter.fst", "name": "TranslateForInterpreter.check_in_global_env" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_regions" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_regions" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_of_aloc" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.lower_loc" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.BoundedInstructionEffects.fst", "name": "Vale.Transformers.BoundedInstructionEffects.locations_of_explicit" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.does_not_read_loc_v" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.rs_loc_elems" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.Base.fst", "name": "EverParse3d.Actions.Base.liveness_inv" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_regions" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fsti", "name": "DoublyLinkedListIface.loc_equiv" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.join_eloc" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.free_vars_of_inv" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.raise_loc" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_mreference" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.interpolable" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.interp" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.read" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.read" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.EverCrypt.fsti", "name": "MerkleTree.EverCrypt.mt_loc" }, { "project_name": "everquic-crypto", "file_name": "QUIC.fst", "name": "QUIC.footprint" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.gaccessor_injective" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.DebugPrint.fst", "name": "Vale.Transformers.DebugPrint.print_ins" }, { "project_name": "everparse", "file_name": "EverParse3d.Actions.All.fst", "name": "EverParse3d.Actions.All.action_field_ptr_after_with_setter" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.fresh_loc" }, { "project_name": "FStar", "file_name": "DoublyLinkedList.fst", "name": "DoublyLinkedList.nodelist_fp0" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.iread" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.iread" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.wf_string_loc_addr" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.loc" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.havoc" }, { "project_name": "everparse", "file_name": "Z3TestGen.fst", "name": "Z3TestGen.ident_to_string" }, { "project_name": "noise-star", "file_name": "Impl.Noise.API.Device.fsti", "name": "Impl.Noise.API.Device.sized_buffer_to_loc" }, { "project_name": "hacl-star", "file_name": "Lib.MultiBuffer.fst", "name": "Lib.MultiBuffer.loc_multi" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.BoundedInstructionEffects.fst", "name": "Vale.Transformers.BoundedInstructionEffects.both" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_addresses" }, { "project_name": "hacl-star", "file_name": "Lib.LoopCombinators.fsti", "name": "Lib.LoopCombinators.fixed_i" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.region_of" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.loc_rvector" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.locs_disjoint" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.does_not_read_loc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_addresses" }, { "project_name": "everquic-crypto", "file_name": "Mem.fst", "name": "Mem.loc_idx_region" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.free_vars_of_typ_indexes" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.max_arity" }, { "project_name": "FStar", "file_name": "IntervalIntersect.fst", "name": "IntervalIntersect.ppInterval" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.wf_string_loc" }, { "project_name": "zeta", "file_name": "Zeta.Generic.Blum.fst", "name": "Zeta.Generic.Blum.t_add_i2g" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.as_reg" } ], "selected_premises": [ "EverParse3d.Interpreter.interp_inv", "LowStar.Monotonic.Buffer.length", "LowStar.Buffer.trivial_preorder", "EverParse3d.Interpreter.leaf_reader", "EverParse3d.Kinds.weak_kind_glb", "EverParse3d.Interpreter.allow_reader_of_itype", "EverParse3d.Prelude.refine", "EverParse3d.Interpreter.parser_kind_of_itype", "LowStar.Monotonic.Buffer.srel", "EverParse3d.Interpreter.loc_none", "LowStar.Buffer.gcmalloc_of_list", "EverParse3d.Interpreter.itype_as_parser", "FStar.UInt.size", "EverParse3d.Interpreter.parser_weak_kind_of_itype", "EverParse3d.Interpreter.parser_kind_nz_of_itype", "EverParse3d.Interpreter.interp_index", "EverParse3d.AppCtxt.app_ctxt", "FStar.Int.Cast.uint64_to_uint32", "EverParse3d.Kinds.kind_unit", "FStar.Mul.op_Star", "EverParse3d.AppCtxt.loc_of", "FStar.Pervasives.reveal_opaque", "EverParse3d.Prelude.uint32_to_uint64", "FStar.Int.Cast.uint32_to_uint64", "EverParse3d.Interpreter.join_loc", "EverParse3d.Interpreter.itype_as_leaf_reader", "EverParse3d.Interpreter.join_inv", "FStar.Int.Cast.op_At_Percent", "EverParse3d.Interpreter.nz_of_binding", "FStar.Heap.trivial_preorder", "EverParse3d.Prelude.StaticHeader.get_bitfield8", "LowStar.Monotonic.Buffer.loc_addr_of_buffer", "EverParse3d.Prelude.uint64_to_uint32", "FStar.Pervasives.Native.snd", "EverParse3d.Interpreter.loc_index", "FStar.Pervasives.Native.fst", "EverParse3d.Prelude.max_int_sizes", "EverParse3d.Prelude.parse_unit", "EverParse3d.Interpreter.inv_index", "FStar.Monotonic.HyperStack.sel", "EverParse3d.CopyBuffer.loc_of", "EverParse3d.Interpreter.wk_of_binding", "EverParse3d.CopyBuffer.probe_fn", "LowStar.Monotonic.Buffer.upd", "LowStar.Monotonic.Buffer.loc_all_regions_from", "EverParse3d.Prelude.uint64_to_uint8", "EverParse3d.Interpreter.projector_names", "EverParse3d.Prelude.u8_mul", "EverParse3d.Prelude.uint8_to_uint64", "LowStar.Monotonic.Buffer.disjoint", "LowStar.Monotonic.Buffer.deref", "EverParse3d.Interpreter.type_of_binding", "EverParse3d.Prelude.u8_rem", "LowStar.Monotonic.Buffer.lmbuffer", "EverParse3d.Interpreter.pk_of_binding", "LowStar.Monotonic.Buffer.loc_region_only", "LowStar.Monotonic.Buffer.get", "EverParse3d.Interpreter.inv_none", "EverParse3d.Prelude.u64_mul", "EverParse3d.Prelude.uint32_to_uint8", "EverParse3d.Prelude.uint8_to_uint32", "EverParse3d.CopyBuffer.liveness_preserved", "EverParse3d.Interpreter.itype_as_validator", "FStar.Monotonic.HyperStack.live_region", "LowStar.Buffer.null", "EverParse3d.Interpreter.___EVERPARSE_COPY_BUFFER_T", "FStar.Int.Cast.uint32_to_uint8", "EverParse3d.Prelude.___UINT64", "EverParse3d.Interpreter.loc_of_binding", "FStar.HyperStack.ST.is_eternal_region", "EverParse3d.Prelude.___UINT32", "EverParse3d.Prelude.u8_sub", "EverParse3d.Interpreter.parser_of_binding", "LowStar.Monotonic.Buffer.fresh_loc", "EverParse3d.Interpreter.has_reader", "EverParse3d.Prelude.u16_mul", "EverParse3d.Prelude.___UINT8", "FStar.Int.Cast.uint64_to_uint8", "EverParse3d.Prelude.u64_rem", "EverParse3d.Prelude.u8_lognot", "FStar.Pervasives.dfst", "FStar.Monotonic.HyperStack.is_heap_color", "EverParse3d.Prelude.u8_logand", "EverParse3d.Prelude.u32_mul", "FStar.Pervasives.dsnd", "EverParse3d.Prelude.StaticHeader.get_bitfield8_msb_first", "EverParse3d.Prelude.u16_rem", "FStar.Monotonic.HyperStack.mreference", "EverParse3d.Interpreter.join_index", "EverParse3d.Prelude.u32_rem", "EverParse3d.Prelude.u64_sub", "LowParse.BitFields.get_bitfield_partition_prop", "EverParse3d.Interpreter.inv_of_binding", "EverParse3d.Prelude.u8_add", "EverParse3d.Interpreter.leaf_reader_of_binding", "LowStar.Monotonic.Buffer.compatible_subseq_preorder", "EverParse3d.Prelude.u8_logxor", "FStar.BigOps.normal", "EverParse3d.Prelude.u16_sub", "FStar.Monotonic.HyperStack.as_addr" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n Authors: N. Swamy, ...\n*)\nmodule EverParse3d.Interpreter\nmodule U32 = FStar.UInt32\nmodule U64 = FStar.UInt64\nmodule A = EverParse3d.Actions.All\nmodule P = EverParse3d.Prelude\nmodule T = FStar.Tactics\nmodule CP = EverParse3d.CopyBuffer\nopen FStar.List.Tot\n\ninline_for_extraction\nnoextract\nlet ___EVERPARSE_COPY_BUFFER_T = CP.copy_buffer_t\n\n(* This module defines a strongly typed abstract syntax for an\n intermediate representation of 3D programs. This is the type `typ`.\n\n The main idea of this module is to give `typ`s a threefold\n denotation:\n\n 1. Type denotation: `as_type` interprets a `typ` as an F* type\n\n 2. Parser denotation: `as_parser` interprets a `t:typ` as a parser\n of values of the type denotation of `t`.\n\n 3. Validate-with-action denotation: `as_validator` inteprets a\n `t:typ` as a low-level validator corresponding to the parser\n denotation of `t`.\n\n The 3rd denotation, validate-with-action, is the main operational\n denotation. That is, given a 3D program `t:typ` we can interpret it\n as validator to check that an input array of bytes conforms to the\n format specified by `t`. But, what we want ultimately is a C\n program for a `t`-validator.\n\n To achieve this, for any given concrete `t`, we partially evaluate\n this interpreter to get an EverParse validator specialized to `t`\n which can be extracted by F*/KaRaMeL as usual---this partial\n evaluation of an interpreter to a compiler producing a C program\n for t-validator is an instance of the 1st Futamura projection.\n *)\n\n(* An attribute to control partial evaluation *)\nlet specialize = ()\n\n(** You can see the basic idea of the whole stack working at first on\n a very simple class of types---just the primitive types *)\n\n(* Primitive types *)\ntype itype =\n | UInt8\n | UInt16\n | UInt32\n | UInt64\n | UInt8BE\n | UInt16BE\n | UInt32BE\n | UInt64BE\n | Unit\n | AllBytes\n | AllZeros\n\n(* Interpretation of itype as an F* type *)\n[@@specialize]\nlet itype_as_type (i:itype)\n : Type\n = match i with\n | UInt8 -> P.___UINT8\n | UInt16 -> P.___UINT16\n | UInt32 -> P.___UINT32\n | UInt64 -> P.___UINT64\n | UInt8BE -> P.___UINT8BE\n | UInt16BE -> P.___UINT16BE\n | UInt32BE -> P.___UINT32BE\n | UInt64BE -> P.___UINT64BE\n | Unit -> unit\n | AllBytes -> P.all_bytes\n | AllZeros -> P.all_zeros\n\n[@@specialize]\nlet parser_kind_nz_of_itype (i:itype)\n : bool\n = match i with\n | Unit\n | AllBytes\n | AllZeros -> false\n | _ -> true\n\n[@@specialize]\nlet parser_weak_kind_of_itype (i:itype)\n : P.weak_kind\n = match i with\n | AllBytes\n | AllZeros -> P.WeakKindConsumesAll\n | _ -> P.WeakKindStrongPrefix\n\n(* Interpretation of itype as a parser kind *)\n[@@specialize]\nlet parser_kind_of_itype (i:itype)\n : P.parser_kind (parser_kind_nz_of_itype i)\n (parser_weak_kind_of_itype i)\n = match i with\n | UInt8 -> P.kind____UINT8\n | UInt16 -> P.kind____UINT16\n | UInt32 -> P.kind____UINT32\n | UInt64 -> P.kind____UINT64\n | UInt8BE -> P.kind____UINT8BE\n | UInt16BE -> P.kind____UINT16BE\n | UInt32BE -> P.kind____UINT32BE\n | UInt64BE -> P.kind____UINT64BE\n | Unit -> P.kind_unit\n | AllBytes -> P.kind_all_bytes\n | AllZeros -> P.kind_all_zeros\n\n(* Interpretation of an itype as a parser *)\nlet itype_as_parser (i:itype)\n : P.parser (parser_kind_of_itype i) (itype_as_type i)\n = match i with\n | UInt8 -> P.parse____UINT8\n | UInt16 -> P.parse____UINT16\n | UInt32 -> P.parse____UINT32\n | UInt64 -> P.parse____UINT64\n | UInt8BE -> P.parse____UINT8BE\n | UInt16BE -> P.parse____UINT16BE\n | UInt32BE -> P.parse____UINT32BE\n | UInt64BE -> P.parse____UINT64BE\n | Unit -> P.parse_unit\n | AllBytes -> P.parse_all_bytes\n | AllZeros -> P.parse_all_zeros\n\n[@@specialize]\nlet allow_reader_of_itype (i:itype)\n : bool\n = match i with\n | AllBytes\n | AllZeros -> false\n | _ -> true\n\n(* Interpretation of an itype as a leaf reader *)\n[@@specialize]\nlet itype_as_leaf_reader (i:itype { allow_reader_of_itype i })\n : A.leaf_reader (itype_as_parser i)\n = match i with\n | UInt8 -> A.read____UINT8\n | UInt16 -> A.read____UINT16\n | UInt32 -> A.read____UINT32\n | UInt64 -> A.read____UINT64\n | UInt8BE -> A.read____UINT8BE\n | UInt16BE -> A.read____UINT16BE\n | UInt32BE -> A.read____UINT32BE\n | UInt64BE -> A.read____UINT64BE\n | Unit -> A.read_unit\n\n(* Interpretation of an itype as a validator\n -- Notice that the type shows that it is related to the parser *)\n[@@specialize]\nlet itype_as_validator (i:itype)\n : A.validate_with_action_t\n (itype_as_parser i)\n A.true_inv\n A.disjointness_trivial\n A.eloc_none\n (allow_reader_of_itype i)\n = match i with\n | UInt8 -> A.validate____UINT8\n | UInt16 -> A.validate____UINT16\n | UInt32 -> A.validate____UINT32\n | UInt64 -> A.validate____UINT64\n | UInt8BE -> A.validate____UINT8BE\n | UInt16BE -> A.validate____UINT16BE\n | UInt32BE -> A.validate____UINT32BE\n | UInt64BE -> A.validate____UINT64BE\n | Unit -> A.validate_unit\n | AllBytes -> A.validate_all_bytes\n | AllZeros -> A.validate_all_zeros\n\n\n(* Our first order of business to scale this up to 3D is to set up\n definitions for type contexts.\n\n A 3D program is a sequence of top-level definitions, where a given\n definition may reference terms defined previously. To model this,\n we'll given a denotation of programs in a _context_, where the\n context provides denotations for all the names defined previously\n which are in scope.\n*)\n\nlet leaf_reader #nz #wk (#k: P.parser_kind nz wk) #t (p:P.parser k t)\n = _:squash (wk == P.WeakKindStrongPrefix /\\ hasEq t) &\n A.leaf_reader p\n\n(* Now, we can define the type of an environment *)\nmodule T = FStar.Tactics\n\n[@@erasable]\nnoeq\ntype index (a:Type) =\n | Trivial : index a\n | NonTrivial : a -> index a\n\n[@@specialize]\nlet join_index (j:'a -> 'a -> 'a) (i0 i1:index 'a)\n: index 'a\n= match i0 with\n | Trivial -> i1\n | _ -> (\n match i1 with\n | Trivial -> i0\n | NonTrivial i1 ->\n let NonTrivial i0 = i0 in\n NonTrivial (j i0 i1)\n )\n[@@specialize]\nlet interp_index (triv:'a) (i:index 'a)\n: GTot 'a\n= match i with\n | Trivial -> triv\n | NonTrivial i -> i\n\n\nlet inv_index = index A.slice_inv\n[@@specialize]\nlet inv_none : inv_index = Trivial\n[@@specialize]\nlet join_inv = join_index A.conj_inv\n[@@specialize]\nlet interp_inv = interp_index A.true_inv\n\nlet loc_index = index A.eloc\n[@@specialize]\nlet loc_none : loc_index = Trivial\n[@@specialize]\nlet join_loc = join_index A.eloc_union\n[@@specialize]", "sketch": [ "The `interp_loc` function implementation matches the index `i` and returns the corresponding `eloc` value. If the index is `Trivial`, it returns the default `eloc` value. If the index is `NonTrivial`, it returns the `eloc` value associated with the index.", "The `interp_loc` function pattern matches on the index `i` to determine if it is `Trivial` or `NonTrivial`. If it is `Trivial`, it returns the default location. If it is `NonTrivial`, it extracts the location and returns it.", "To implement `interp_loc`, we pattern match on the index `i` and return the location if it is non-trivial, otherwise we return a default location.", "The `interp_loc` function is implemented by pattern matching on the input index `i`. If the index is `Trivial`, it returns the default location value. If the index is `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function pattern matches on the index `i` to determine if it is `Trivial` or `NonTrivial`. If it is `Trivial`, it returns the default location value. If it is `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function is implemented by pattern matching on the input index `i` to handle the cases of `Trivial` and `NonTrivial`. For `Trivial`, it returns the default location value. For `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function is implemented by pattern matching on the input index `i`. If the index is `Trivial`, then the function returns the default location value. If the index is `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function implementation pattern matches on the input index `i` and returns the corresponding location value. If the index is `Trivial`, it returns the default location value. If the index is `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function is implemented by pattern matching on the input index `i`. If the index is `Trivial`, it returns the default location. If the index is `NonTrivial`, it extracts the location value and returns it.", "The `interp_loc` function implementation will pattern match on the input index `i` to handle the cases of `Trivial` and `NonTrivial`. If the index is `Trivial`, it will return the default location value. If the index is `NonTrivial`, it will extract the location value and return it." ], "generated_solution": [ "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n interp_index A.eloc_none i", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial l -> l", "let interp_loc (i: index A.eloc): GTot A.eloc =\n match i with\n | Trivial -> A.eloc_none\n | NonTrivial loc -> loc", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial loc -> loc", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial l -> l", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial loc -> loc", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial l -> l", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> A.eloc_none\n | NonTrivial l -> l", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> A.eloc_none\n | NonTrivial loc -> loc", "let interp_loc (i: EverParse3d.Interpreter.index EverParse3d.Actions.Base.eloc)\n : Prims.GTot EverParse3d.Actions.Base.eloc =\n match i with\n | Trivial -> loc_none\n | NonTrivial loc -> loc" ] }, { "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share", "opens_and_abbrevs": [ { "open": "Pulse.Lib.PCM.Fraction" }, { "open": "FStar.PCM" }, { "open": "Pulse.Main" }, { "open": "Pulse.Lib.Core" }, { "abbrev": "T", "full_module": "FStar.Tactics" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "FStar.Ghost" }, { "open": "PulseCore.FractionalPermission" }, { "open": "Pulse.Lib.Core" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "source_definition": "let share = share'", "source_range": { "start_line": 105, "start_col": 0, "end_line": 105, "end_col": 18 }, "interleaved": false, "definition": "Pulse.Lib.HigherReference.share'", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Lib.HigherReference.share'" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "r: Pulse.Lib.HigherReference.ref a\n -> Pulse.Lib.Core.stt_ghost Prims.unit\n (Pulse.Lib.HigherReference.pts_to r (FStar.Ghost.reveal v))\n (fun _ ->\n Pulse.Lib.HigherReference.pts_to r (FStar.Ghost.reveal v) **\n Pulse.Lib.HigherReference.pts_to r (FStar.Ghost.reveal v))", "prompt": "let share =\n ", "expected_response": "share'", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.HigherReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.HigherReference.fst", "checked_file": "dataset/Pulse.Lib.HigherReference.fst.checked", "interface_file": true, "dependencies": [ "dataset/Pulse.Main.fsti.checked", "dataset/Pulse.Lib.PCM.Fraction.fst.checked", "dataset/Pulse.Lib.Core.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked" ] }, "definitions_in_context": [ "val ref ([@@@unused]a:Type u#1) : Type u#0", "let ref (a:Type u#1) = pcm_ref (pcm_frac #a)", "let pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)", "val pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a) : vprop", "```pulse\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```", "val alloc (#a:Type) (x:a)\n : stt (ref a) emp (fun r -> pts_to r x)", "val ( ! ) (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt a\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (reveal n == x))", "val ( := ) (#a:Type) (r:ref a) (x:a) (#n:erased a)\n : stt unit\n (pts_to r n)\n (fun _ -> pts_to r x)", "let alloc = alloc'", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt unit (pts_to r n) (fun _ -> emp)", "let read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "```pulse\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:a\nensures pts_to r #p n ** pure (reveal n == x)\n{\n unfold pts_to r #p n;\n with w. assert (pcm_pts_to r w);\n let x = Pulse.Lib.Core.read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (pcm_pts_to r w);\n fold (pts_to r #p n);\n fst (Some?.v x)\n}\n```", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))", "let read = read'", "let ( ! ) #a = read #a", "```pulse\nfn write (#a:Type u#1) (r:ref a) (x:a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures pts_to r #full_perm x\n{\n unfold pts_to r #full_perm n;\n with w. assert (pcm_pts_to r w);\n Pulse.Lib.Core.write r _ _ (mk_frame_preserving_upd n x);\n fold pts_to r #full_perm x;\n}\n```", "val with_local\n (#a:Type u#1)\n (init:a)\n (#pre:vprop)\n (#ret_t:Type)\n (#post:ret_t -> vprop)\n (body:(r:ref a) -> stt ret_t (pre ** pts_to r init)\n (fun v -> post v ** (exists* (x:a). pts_to r x)))\n : stt ret_t pre post", "let ( := ) #a = write #a", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))", "```pulse\nfn free' #a (r:ref a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures emp\n{\n unfold pts_to r #full_perm n;\n with w. assert (pcm_pts_to r w);\n Pulse.Lib.Core.write r _ _ (mk_frame_preserving_upd_none n);\n Pulse.Lib.Core.drop_ _;\n}\n```", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))", "let free = free'", "```pulse\nghost\nfn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _; //writing an underscore for the first arg also causes a crash\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}\n```" ], "closest": [ "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:box a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share b = R.share b", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share\n r\n= RST.share r.reveal", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share r)", "val share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share_pt r)", "val share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\nlet share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\n = coerce_ghost (fun _ -> R.ghost_share_pt r)", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a)\n: stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\n= share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "val share (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type) #uses (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n= share_gen r (half_perm p) (half_perm p)", "val share_pt (#a:Type0) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share_pt #a #uses #p #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share r;\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ());\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ())", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share = share'", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n: stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share #a arr #s #p = H.share arr #(raise_seq s) #p", "val free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\nlet free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_ghost (fun _ -> R.ghost_free_pt r)", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val share2 (#a:Type) (r:box a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 b = R.share2 b", "val free (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit opened\n (pts_to r full_perm v) (fun _ -> emp)\nlet free\n #_ #a #v r\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_free gr)", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val share_gen (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : STGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n r p1 p2\n= coerce_ghost (fun _ -> R.share_gen_pt r p1 p2)", "val ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n = H.ghost_share #_ #_ #_ #(raise_erased x) r", "val share (#a:Type0) (#uses:_) (#p: perm) (r:ref a)\n : SteelGhost unit uses\n (vptrp r p)\n (fun _ -> vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r (half_perm p)) == h (vptrp r p)\n )\nlet share\n #_ #_ #p r\n= elim_vptrp r p;\n A.share r p (half_perm p) (half_perm p);\n intro_vptrp' r (half_perm p);\n intro_vptrp' r (half_perm p)", "val share (#a:Type0) (#uses:_) (#p: perm) (r:ref a)\n : SteelGhost unit uses\n (vptrp r p)\n (fun _ -> vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r (half_perm p)) == h (vptrp r p)\n )\nlet share #a #_ #p r =\n let x = elim_vptr r p in\n share_pt r;\n intro_vptr r _ x;\n intro_vptr r _ x", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val ghost_share (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share r = share (reveal r)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val free (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_steel(fun _ -> R.free r);\n return ()", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val share_gen_pt (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen_pt #a #uses #p #v r p1 p2 =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share_gen r p1 p2;\n rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ());\n rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ())", "val share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (pts_to r p x)\n (fun _ -> pts_to r p1 x `star`\n pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop\n (pts_to r p v)\n (pts_to' r p v)\n (fun _ -> ());\n elim_pure (perm_ok p);\n share_atomic_raw_gen r v p1 p2;\n intro_pts_to p1 r;\n intro_pts_to p2 r", "val write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write r x);\n return ()", "val free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_steel(fun _ -> R.free_pt r);\n return ()", "val share_gen\n (#t: Type)\n (#opened: _)\n (#p: perm)\n (#v: t)\n (r: ref t)\n (p1 p2: perm)\n: STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n #_ #_ #_ #v r p1 p2\n= coerce_ghost (fun _ -> R.ghost_share_gen_pt #_ #_ #_ #v r p1 p2)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (hide (U.raise_val (reveal v)))", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.split r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read r) in\n return u", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read_pt r) in\n return u", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather\n p1 r\n= RST.gather p1 r.reveal", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather (#a:Type)\n (#uses:_)\n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost (fun _ -> R.gather #a #uses #p0 #p1 #v0 #v1 r)", "val write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write_pt r x);\n return ()", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.share r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (U.raise_val v)", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\nlet alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_alloc_pt x)", "val share_atomic_raw (#a #uses: _) (#p: perm) (r: ref a {perm_ok p}) (v0: erased a)\n : SteelGhostT unit\n uses\n (pts_to_raw r p v0)\n (fun _ -> (pts_to_raw r (half_perm p) v0) `star` (pts_to_raw r (half_perm p) v0))\nlet share_atomic_raw #a #uses (#p:perm) (r:ref a{perm_ok p}) (v0:erased a)\n : SteelGhostT unit uses\n (pts_to_raw r p v0)\n (fun _ -> pts_to_raw r (half_perm p) v0 `star` pts_to_raw r (half_perm p) v0)\n= share_atomic_raw_gen r v0 (half_perm p) (half_perm p)", "val ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\n = H.ghost_write r (raise_erased x)", "val gather (#a:Type) (r:box a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather b = R.gather b", "val read (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n : Steel a (pts_to r p v) (fun x -> pts_to r p x)\n (requires fun h -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet read (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n = let v1 : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop (pts_to r p v) (RP.pts_to r v1 `star` pure (perm_ok p)) (fun _ -> ());\n elim_pure (perm_ok p);\n let v2 = RP.read r v1 in\n rewrite_slprop (RP.pts_to r v1) (pts_to r p v)\n (fun m ->\n emp_unit (hp_of (pts_to_raw r p v));\n pure_star_interp (hp_of (pts_to_raw r p v)) (perm_ok p) m);\n assert (compatible pcm_frac v1 v2);\n let Some (x, _) = v2 in\n rewrite_slprop (pts_to r p v) (pts_to r p x) (fun _ -> ());\n return x", "val ghost_share (#a:Type0) (#uses:_) (#p: perm) (r:ghost_ref a)\n : SteelGhost unit uses\n (ghost_vptrp r p)\n (fun _ -> ghost_vptrp r (half_perm p) `star` ghost_vptrp r (half_perm p))\n (fun _ -> True)\n (fun h res h' ->\n h' (ghost_vptrp r (half_perm p)) == h (ghost_vptrp r p)\n )\nlet ghost_share #a #_ #p r =\n let x = elim_ghost_vptr r p in\n ghost_share_pt r;\n intro_ghost_vptr r _ x;\n intro_ghost_vptr r _ x", "val free (#a:Type) (#v:erased a) (r:ref a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type) (#v:erased a) (r:ref a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> emp)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, full_perm)) in\n rewrite_slprop\n (pts_to r full_perm v)\n (RP.pts_to r v_old `star` pure (perm_ok full_perm))\n (fun _ -> ());\n elim_pure (perm_ok full_perm);\n RP.free r v_old;\n drop (RP.pts_to r (Mkpcm'?.one (Mkpcm?.p pcm_frac)))", "val ghost_share_gen_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen_pt\n #_ #_ #_ #x r p1 p2\n= H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2", "val ghost_write (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write r x =\n ghost_write_aux (reveal r) (reveal x);\n rewrite_slprop\n (pts_to (reveal r) full_perm (hide (reveal x)))\n (ghost_pts_to r full_perm x)\n (fun _ -> ())", "val read_pt (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n : Steel a (pts_to r p v) (fun x -> pts_to r p x)\n (requires fun _ -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet read_pt #a #p #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n let x = H.read r in\n let v':a = U.downgrade_val x in\n rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ());\n return v'", "val write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, full_perm)) in\n let v_new : fractional a = Some (x, full_perm) in\n rewrite_slprop (pts_to r full_perm v) (RP.pts_to r v_old `star` pure (perm_ok full_perm)) (fun _ -> ());\n\n elim_pure (perm_ok full_perm);\n\n RP.write r v_old v_new;\n rewrite_slprop (RP.pts_to r v_new) (pts_to r full_perm x)\n (fun m -> emp_unit (hp_of (pts_to_raw r full_perm x));\n pure_star_interp (hp_of (pts_to_raw r full_perm x)) (perm_ok full_perm) m)", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= rewrite\n (pts_to a _ _)\n (H.pts_to a p (seq_map raise x));\n H.share a p p1 p2;\n rewrite\n (H.pts_to a p1 _)\n (pts_to a p1 x);\n rewrite\n (H.pts_to a p2 _)\n (pts_to a p2 x)", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= elim_pts_to a p x;\n mk_carrier_share (US.v (ptr_of a).base_len) (ptr_of a).offset x p1 p2;\n R.split (ptr_of a).base _\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p1)\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p2);\n intro_pts_to a p1 x;\n intro_pts_to a p2 x", "val share_atomic_raw_gen\n (#a #uses: _)\n (#p: perm)\n (r: ref a {perm_ok p})\n (v0: erased a)\n (p1 p2: perm)\n : SteelGhost unit\n uses\n (pts_to_raw r p v0)\n (fun _ -> (pts_to_raw r p1 v0) `star` (pts_to_raw r p2 v0))\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_atomic_raw_gen #a #uses (#p:perm) (r:ref a{perm_ok p}) (v0:erased a) (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to_raw r p v0)\n (fun _ -> pts_to_raw r p1 v0 `star` pts_to_raw r p2 v0)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = rewrite_slprop\n (pts_to_raw r p v0)\n (RP.pts_to r _)\n (fun _ -> ());\n RP.split r (Some (Ghost.reveal v0, p)) (Some (Ghost.reveal v0, p1)) (Some (Ghost.reveal v0, p2));\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p1 v0)\n (fun _ -> ());\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p2 v0)\n (fun _ -> ())", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val ghost_free_pt (#a:Type0) (#u:_) (#v:erased a) (r:ghost_ref a)\n : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> emp)\nlet ghost_free_pt r = H.ghost_free r", "val ghost_share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen r p1 p2 = share_gen (reveal r) p1 p2", "val gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\nlet gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\n = coerce_ghost (fun _ -> R.ghost_gather_pt #a #u #p0 #p1 #x0 #x1 r)", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : STGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n True\n (fun _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm\n r\n= coerce_ghost (fun _ -> R.pts_to_perm r)", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : STGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n True\n (fun _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm r = coerce_ghost (fun _ -> R.ghost_pts_to_perm r)", "val gather (#a:Type) (#uses:_) (#p0:perm) (#p1:perm) (#v0 #v1:erased a) (r:ref a)\n : SteelGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet gather (#a:Type) (#uses:_) (#p0:perm) (#p1:perm) (#v0 #v1:erased a) (r:ref a)\n = let v0_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v0, p0)) in\n let v1_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v1, p1)) in\n rewrite_slprop\n (pts_to r p0 v0)\n (pts_to_raw r p0 v0 `star` pure (perm_ok p0))\n (fun _ -> ());\n rewrite_slprop\n (pts_to r p1 v1)\n (pts_to_raw r p1 v1 `star` pure (perm_ok p1))\n (fun _ -> ());\n elim_pure (perm_ok p0);\n elim_pure (perm_ok p1);\n let _ = gather_atomic_raw r v0 v1 in\n intro_pts_to (sum_perm p0 p1) r", "val gather\n (#a:Type)\n (v:vec a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n : stt_ghost unit\n (requires pts_to v #p0 s0 ** pts_to v #p1 s1)\n (ensures fun _ -> pts_to v #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather v = A.gather v", "val ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\n = H.ghost_gather r", "val ghost_share (#uses: inames) (v1 #v2: G.erased int) (r: ghost_ref int)\n : SteelGhost unit\n uses\n (ghost_pts_to r full_perm v1)\n (fun _ ->\n (ghost_pts_to r (P.half_perm full_perm) v1)\n `star`\n (ghost_pts_to r (P.half_perm full_perm) v2))\n (fun _ -> v1 == v2)\n (fun _ _ _ -> True)\nlet ghost_share (#uses:inames) (v1 #v2:G.erased int) (r:ghost_ref int)\n : SteelGhost unit uses\n (ghost_pts_to r full_perm v1)\n (fun _ -> ghost_pts_to r (P.half_perm full_perm) v1 `star`\n ghost_pts_to r (P.half_perm full_perm) v2)\n (fun _ -> v1 == v2)\n (fun _ _ _ -> True)\n = ghost_share_pt #_ #_ #_ #v1 r; ()", "val ghost_read_pt (#a:Type) (#u:_) (#p:perm) (#v:erased a) (r:ghost_ref a)\n : SteelGhost (erased a) u (ghost_pts_to r p v) (fun x -> ghost_pts_to r p x)\n (requires fun _ -> True)\n (ensures fun _ x _ -> x == v)\nlet ghost_read_pt #a #u #p #v r =\n let x = H.ghost_read r in\n let x' = hide (U.downgrade_val (reveal x)) in\n rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ());\n x'", "val write_pt (#a:Type0) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write_pt #a #v r x =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ());\n let x' = U.raise_val x in\n H.write r x';\n rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ())", "val rewrite_perm (#a: Type) (#v: G.erased a) (r: ghost_ref a) (p1 p2: P.perm)\n : Steel unit\n (ghost_pts_to r p1 v)\n (fun _ -> ghost_pts_to r p2 v)\n (fun _ -> p1 == p2)\n (fun _ _ _ -> True)\nlet rewrite_perm(#a:Type) (#v:G.erased a) (r:ghost_ref a) (p1 p2:P.perm)\n : Steel unit\n (ghost_pts_to r p1 v)\n (fun _ -> ghost_pts_to r p2 v)\n (fun _ -> p1 == p2)\n (fun _ _ _ -> True)\n = rewrite_slprop (ghost_pts_to r p1 v)\n (ghost_pts_to r p2 v)\n (fun _ -> ())", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> MR.write r x)", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : SteelGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (fun _ -> True)\n (fun _ _ _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm\n #_ #_ #p #v r\n= rewrite_slprop (pts_to r p v) (pts_to' r p v) (fun _ -> ());\n elim_pure (perm_ok p);\n intro_pure (perm_ok p);\n rewrite_slprop (pts_to' r p v) (pts_to r p v) (fun _ -> ())", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : SteelGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (fun _ -> True)\n (fun _ _ _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm\n r\n= H.pts_to_perm r", "val read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t))\n : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1\n )\nlet read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t)) : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p . (* {:pattern (mk_fraction (scalar t) (mk_scalar v0) p)} *) Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1)\n= let v0 = FStar.IndefiniteDescription.indefinite_description_tot _ (fun v0 -> exists p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p) in\n let p = FStar.IndefiniteDescription.indefinite_description_tot _ (fun p -> Ghost.reveal v == mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p) in\n let prf v0' p' : Lemma\n (requires (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p'))\n (ensures (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = mk_scalar_inj (Ghost.reveal v0) v0' p p'\n in\n let prf' v0' p' : Lemma\n (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p' ==> (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = Classical.move_requires (prf v0') p'\n in\n Classical.forall_intro_2 prf';\n rewrite (pts_to _ _) (pts_to r (mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p));\n let v1 = read0 r in\n rewrite (pts_to _ _) (pts_to r v);\n return v1", "val ghost_gather (#a: Type0) (#uses: _) (#p: perm) (r: ghost_ref a)\n : SteelGhost unit\n uses\n ((ghost_vptrp r (half_perm p)) `star` (ghost_vptrp r (half_perm p)))\n (fun _ -> ghost_vptrp r p)\n (fun _ -> True)\n (fun h _ h' -> h' (ghost_vptrp r p) == h (ghost_vptrp r (half_perm p)))\nlet ghost_gather (#a: Type0) (#uses: _) (#p: perm) (r: ghost_ref a)\n : SteelGhost unit uses\n (ghost_vptrp r (half_perm p) `star` ghost_vptrp r (half_perm p))\n (fun _ -> ghost_vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (ghost_vptrp r p) == h (ghost_vptrp r (half_perm p))\n )\n= let _ = ghost_gather_gen r _ _ in\n change_equal_slprop\n (ghost_vptrp r _)\n (ghost_vptrp r p)", "val free_pt (#a:Type0) (#v:erased a) (r:ref a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> emp)\nlet free_pt #a #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ());\n H.free r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r #x0 #x1 #one_half #one_half", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n: stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun () -> pts_to r x0 ** pure (x0 == x1))\n= gather r", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_steel (fun _ -> MR.write r x)", "val share\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ref a pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\r\n: stt_ghost unit\r\n (pts_to r (v0 `op pcm` v1))\r\n (fun _ -> pts_to r v0 ** pts_to r v1)\nlet share #a #pcm r v0 v1 = Ghost.hide (A.share r v0 v1)", "val ghost_gather (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather r = gather (reveal r)", "val ghost_pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p v)\n (fun _ -> ghost_pts_to r p v)\n (fun _ -> True)\n (fun _ _ _ -> p `lesser_equal_perm` full_perm)\nlet ghost_pts_to_perm r = H.ghost_pts_to_perm r", "val ghost_pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p v)\n (fun _ -> ghost_pts_to r p v)\n (fun _ -> True)\n (fun _ _ _ -> p `lesser_equal_perm` full_perm)\nlet ghost_pts_to_perm #a #_ #p #v r =\n let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop\n (ghost_pts_to r p v)\n (RP.pts_to r v_old `star` pure (perm_ok p))\n (fun _ -> ());\n elim_pure (perm_ok p);\n intro_pure (perm_ok p);\n rewrite_slprop\n (RP.pts_to r v_old `star` pure (perm_ok p))\n (ghost_pts_to r p v)\n (fun _ -> ())", "val gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\nlet gather\n #_ #_ #p r\n= let p' = gather_gen r (half_perm p) (half_perm p) in\n change_equal_slprop\n (vptrp r p')\n (vptrp r p)", "val gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\nlet gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\n = let _ = gather_gen r _ _ in\n change_equal_slprop\n (vptrp r _)\n (vptrp r p)", "val ghost_alloc_pt (#a:Type) (#u:_) (x:erased a)\n : SteelGhostT (ghost_ref a) u\n emp\n (fun r -> ghost_pts_to r full_perm x)\nlet ghost_alloc_pt (#a:Type) (#u:_) (x:erased a)\n : SteelGhostT (ghost_ref a) u\n emp\n (fun r -> ghost_pts_to r full_perm x)\n = H.ghost_alloc (raise_erased x)", "val share\n (#a:Type)\n (#pcm:pcm a)\n (r:pcm_ref pcm)\n (v0:FStar.Ghost.erased a)\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\n: stt_ghost unit\n (pcm_pts_to r (v0 `op pcm` v1))\n (fun _ -> pcm_pts_to r v0 ** pcm_pts_to r v1)\nlet share = A.share", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = let h_old_e = witness_exists #_ #_ #(pts_to_body r full_perm v) () in\n let _ = elim_pure r v h_old_e in\n\n let h_old = read r h_old_e in\n let h: history a p = extend_history' h_old x in\n write r h_old_e h;\n\n intro_pure_full r x h", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = MHR.write r (U.raise_val x);\n rewrite_slprop\n (MHR.pts_to _ _ _)\n (pts_to r full_perm x)\n (fun _ -> ())" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.share2" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share2" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share_gen" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_pt" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.read" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.free" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.read" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.read" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.write" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.alloc" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_atomic_raw" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_write_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.gather" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.read" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.free" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_write" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.read_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_atomic_raw_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.free" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_free_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_gather_pt" }, { "project_name": "steel", "file_name": "OWGCounterInv.fst", "name": "OWGCounterInv.ghost_share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_read_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.write_pt" }, { "project_name": "steel", "file_name": "OWGCounter.fst", "name": "OWGCounter.rewrite_perm" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.read" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.free_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather2" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.write" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_alloc_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.write" } ], "selected_premises": [ "FStar.Real.one", "FStar.Real.two", "Pulse.Lib.PCM.Fraction.compose", "Pulse.Lib.PCM.Fraction.composable", "PulseCore.FractionalPermission.sum_perm", "PulseCore.FractionalPermission.full_perm", "PulseCore.FractionalPermission.comp_perm", "Pulse.Lib.Core.one_half", "FStar.PCM.composable", "Pulse.Lib.Core.all_inames", "FStar.PCM.compatible", "FStar.UInt.size", "Pulse.Lib.PCM.Fraction.pcm_frac", "Pulse.Lib.Core.inames", "FStar.PCM.op", "Pulse.Lib.PCM.Fraction.fractional", "Pulse.Lib.Core.emp_inames", "FStar.Mul.op_Star", "FStar.Pervasives.Native.snd", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.fst", "Pulse.Lib.PCM.Fraction.full_values_compatible", "Pulse.Lib.HigherReference.alloc", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd_none", "Pulse.Lib.HigherReference.read_compat", "Pulse.Lib.Core.join_inames", "Pulse.Lib.HigherReference.free", "PulseCore.FractionalPermission.half_perm", "Pulse.Lib.HigherReference.pts_to", "Pulse.Lib.HigherReference.read", "Pulse.Lib.Core.prop_non_informative", "Pulse.Lib.Core.squash_non_informative", "Pulse.Lib.Core.unit_non_informative", "Pulse.Lib.Core.add_iname", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd", "PulseCore.FractionalPermission.lesser_perm", "FStar.Real.zero", "FStar.Pervasives.dfst", "PulseCore.FractionalPermission.writeable", "Pulse.Lib.Core.inames_subset", "FStar.Pervasives.dsnd", "Pulse.Lib.Core.erased_non_informative", "PulseCore.Observability.join_obs", "Pulse.Lib.Core.mem_iname", "PulseCore.Observability.at_most_one_observable", "Pulse.Lib.HigherReference.ref", "PulseCore.FractionalPermission.lesser_equal_perm", "FStar.Math.Lemmas.pow2_plus", "FStar.PCM.lem_commutative", "PulseCore.FractionalPermission.sum_halves", "FStar.Preorder.preorder_rel", "FStar.Math.Lemmas.pow2_lt_compat", "FStar.Math.Lemmas.pow2_le_compat", "FStar.Math.Lib.slash_decr_axiom", "FStar.PCM.lem_assoc_l", "FStar.UInt.max_int", "FStar.Pervasives.id", "FStar.Math.Lemmas.lemma_mod_twice", "FStar.Math.Lemmas.multiple_division_lemma", "FStar.BitVector.logor_vec", "FStar.Real.mul_dist", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "FStar.UInt.to_vec", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.UInt32.lt", "FStar.UInt32.n", "FStar.Math.Lemmas.lemma_mod_mult_zero", "FStar.PCM.compatible_elim", "FStar.PCM.compatible_trans", "FStar.PCM.lem_assoc_r", "FStar.Set.add", "FStar.UInt32.op_Plus_Hat", "FStar.Calc.calc_chain_related", "FStar.UInt32.op_Plus_Percent_Hat", "FStar.Math.Lemmas.modulo_division_lemma", "FStar.UInt32.op_Star_Percent_Hat", "FStar.Math.Lemmas.modulo_distributivity", "FStar.Math.Lemmas.mod_mul_div_exact", "FStar.PCM.exclusive", "FStar.Math.Lemmas.lemma_mod_mod", "FStar.UInt.one_extend_vec", "FStar.Math.Lemmas.division_definition_lemma_1", "FStar.PCM.joinable", "FStar.UInt32.op_Bar_Hat", "FStar.Preorder.transitive", "FStar.Math.Lemmas.distributivity_add_right", "Pulse.Lib.Core.add_inv", "FStar.Math.Lemmas.modulo_add", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "FStar.Math.Lemmas.division_definition", "FStar.Math.Lib.signed_modulo", "FStar.BitVector.logand_vec", "FStar.Math.Lib.op_Plus_Percent", "FStar.Real.test", "FStar.UInt32.gte_mask", "FStar.Pervasives.st_post_h", "FStar.BitVector.logxor_vec", "FStar.Math.Lemmas.modulo_division_lemma_0", "Pulse.Lib.Core.mem_inv", "FStar.UInt32.op_Star_Hat" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.HigherReference\nopen Pulse.Lib.Core\nopen Pulse.Main\nopen FStar.PCM\nopen Pulse.Lib.PCM.Fraction\n\nlet ref (a:Type u#1) = pcm_ref (pcm_frac #a)\nlet pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)\n\n```pulse\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```\nlet alloc = alloc'\n\nlet read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x\n\n```pulse\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:a\nensures pts_to r #p n ** pure (reveal n == x)\n{\n unfold pts_to r #p n;\n with w. assert (pcm_pts_to r w);\n let x = Pulse.Lib.Core.read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (pcm_pts_to r w);\n fold (pts_to r #p n);\n fst (Some?.v x)\n}\n```\nlet read = read'\nlet ( ! ) #a = read #a\n\n```pulse\nfn write (#a:Type u#1) (r:ref a) (x:a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures pts_to r #full_perm x\n{\n unfold pts_to r #full_perm n;\n with w. assert (pcm_pts_to r w);\n Pulse.Lib.Core.write r _ _ (mk_frame_preserving_upd n x);\n fold pts_to r #full_perm x;\n}\n```\nlet ( := ) #a = write #a\n\n```pulse\nfn free' #a (r:ref a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures emp\n{\n unfold pts_to r #full_perm n;\n with w. assert (pcm_pts_to r w);\n Pulse.Lib.Core.write r _ _ (mk_frame_preserving_upd_none n);\n Pulse.Lib.Core.drop_ _;\n}\n```\nlet free = free'\n\n```pulse\nghost\nfn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _; //writing an underscore for the first arg also causes a crash\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}\n```", "sketch": [ "The definition is about a function called share that takes a reference, a value, and a permission as input. It ensures that the reference points to the value with the given permission, and then it splits the permission into two half permissions.\n\nStep 1: The share function takes a reference, a value, and a permission as input.\nStep 2: It ensures that the reference points to the value with the given permission and then splits the permission into two half permissions.", "To implement the `share` function, we first unfold the points-to assertion for reference `r` with value `v` and permission `p`. Then we rewrite the points-to assertion to split the permission `p` into two equal parts. Finally, we use the `Pulse.Lib.Core.share` function to update the reference `r` with the split permissions, and fold the points-to assertions for both permissions.", "The share function first unfolds the points-to assertion for the given reference, value, and permission. Then it rewrites the points-to assertion using the half permission. Finally, it uses the Pulse.Lib.Core.share function to duplicate the reference with half of the permission for each duplicate.", "The share function first unfolds the points-to assertion for the given reference, value, and permission. Then it rewrites the points-to assertion using the pcm_pts_to function to create two points-to assertions with half of the original permission for each. Finally, it uses the Pulse.Lib.Core.share function to duplicate the reference with the updated permission.", "The `share` function takes a reference `r`, an erased value `v`, and a permission `p`. It ensures that the reference `r` points to the value `v` with permission `p`, and then splits the permission `p` into two half permissions, ensuring that the reference `r` points to the value `v` with each half permission.", "The \"share\" function first unfolds the points-to assertion for reference \"r\" pointing to value \"v\" with permission \"p\". Then, it rewrites the points-to assertion using the pcm_pts_to function to split the permission \"p\" into two half permissions. Finally, it calls the Pulse.Lib.Core.share function to update the permission, and then folds the points-to assertion twice to ensure that the reference \"r\" points to the value \"v\" with the two half permissions.", "The implementation of the share function involves unfolding the points-to assertion for reference r and value v with permission p, rewriting the points-to assertion to split the permission into two half permissions, and then using the Pulse.Lib.Core.share function to achieve the desired splitting of permissions.", "The implementation of the share function involves unfolding the points-to assertion for the reference and the value with the original permission. Then, it rewrites the points-to assertion using the half of the original permission and updates the reference accordingly. Finally, it folds the points-to assertion for the reference and the value with the updated permissions.", "The share function first unfolds the original points-to assertion to obtain the original permission and value. Then it rewrites the points-to assertion to duplicate the reference with half of the original permission for the same value. Finally, it uses the Pulse.Lib.Core.share function to achieve the duplication, and folds the points-to assertion twice to reflect the duplication.", "The share function is implemented by unfolding the points-to assertion for the given reference, value, and permission. Then, it rewrites the points-to assertion using the half of the given permission and duplicates the reference pointing to the same value with the updated permission." ], "generated_solution": [ "fn share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "let share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "fn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _;\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}", "fn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _;\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}", "let share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "fn share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "fn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _;\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}", "fn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _;\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}", "let share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "fn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite pcm_pts_to r (Some (reveal v, p))\n as pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.share r (Some (reveal v, half_perm p)) _;\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}" ] }, { "file_name": "Vale.Stdcalls.X64.Fswap.fsti", "name": "Vale.Stdcalls.X64.Fswap.uint64", "opens_and_abbrevs": [ { "abbrev": "FW", "full_module": "Vale.Curve25519.X64.FastWide" }, { "abbrev": "FH", "full_module": "Vale.Curve25519.X64.FastHybrid" }, { "abbrev": "FU", "full_module": "Vale.Curve25519.X64.FastUtil" }, { "open": "Vale.AsLowStar.MemoryHelpers" }, { "abbrev": "MS", "full_module": "Vale.X64.Machine_s" }, { "abbrev": "VS", "full_module": "Vale.X64.State" }, { "open": "Vale.X64.MemoryAdapters" }, { "abbrev": "W", "full_module": "Vale.AsLowStar.Wrapper" }, { "abbrev": "IA", "full_module": "Vale.Interop.Assumptions" }, { "abbrev": "V", "full_module": "Vale.X64.Decls" }, { "abbrev": "ME", "full_module": "Vale.X64.Memory" }, { "abbrev": "LSig", "full_module": "Vale.AsLowStar.LowStarSig" }, { "abbrev": "VSig", "full_module": "Vale.AsLowStar.ValeSig" }, { "abbrev": "IX64", "full_module": "Vale.Interop.X64" }, { "open": "Vale.Interop.Base" }, { "open": "Vale.Def.Types_s" }, { "abbrev": "DV", "full_module": "LowStar.BufferView.Down" }, { "abbrev": "B", "full_module": "LowStar.Buffer" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar.HyperStack.ST" }, { "open": "FStar.Mul" }, { "open": "Vale.Stdcalls.X64" }, { "open": "Vale.Stdcalls.X64" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "", "source_definition": "let uint64 = UInt64.t", "source_range": { "start_line": 30, "start_col": 0, "end_line": 30, "end_col": 21 }, "interleaved": false, "definition": "FStar.UInt64.t", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.UInt64.t" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "Prims.eqtype", "prompt": "let uint64 =\n ", "expected_response": "UInt64.t", "source": { "project_name": "hacl-star", "file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Fswap.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.Stdcalls.X64.Fswap.fsti", "checked_file": "dataset/Vale.Stdcalls.X64.Fswap.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Vale.X64.State.fsti.checked", "dataset/Vale.X64.MemoryAdapters.fsti.checked", "dataset/Vale.X64.Memory.fsti.checked", "dataset/Vale.X64.Machine_s.fst.checked", "dataset/Vale.X64.Decls.fsti.checked", "dataset/Vale.Interop.X64.fsti.checked", "dataset/Vale.Interop.Base.fst.checked", "dataset/Vale.Interop.Assumptions.fst.checked", "dataset/Vale.Def.Types_s.fst.checked", "dataset/Vale.Curve25519.X64.FastWide.fsti.checked", "dataset/Vale.Curve25519.X64.FastUtil.fsti.checked", "dataset/Vale.Curve25519.X64.FastHybrid.fsti.checked", "dataset/Vale.AsLowStar.Wrapper.fsti.checked", "dataset/Vale.AsLowStar.ValeSig.fst.checked", "dataset/Vale.AsLowStar.MemoryHelpers.fsti.checked", "dataset/Vale.AsLowStar.LowStarSig.fst.checked", "dataset/prims.fst.checked", "dataset/LowStar.BufferView.Down.fsti.checked", "dataset/LowStar.Buffer.fst.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked" ] }, "definitions_in_context": [ "val z3rlimit_hack (x:nat) : squash (x < x + x + 1)" ], "closest": [ "val Vale.Inline.X64.Fswap_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fsub.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fmul.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Sha.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Aes.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.GCTR.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fadd.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Poly.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.AesHash.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fsqr.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.GCM_IV.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Inline.X64.Fmul_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.GCMdecryptOpt.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Inline.X64.Fadd_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.GCMencryptOpt.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Inline.X64.Fsqr_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Wrapper.X64.Poly.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint64 = Prims.eqtype\nlet tuint64 = UInt64.t", "val Vale.Wrapper.X64.GCTR.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint32 = Prims.eqtype\nlet tuint32 = UInt32.t", "val Vale.PPC64LE.Memory.tuint64 = Prims.eqtype\nlet tuint64 = UInt64.t", "val Vale.X64.Memory.tuint16 = Prims.eqtype\nlet tuint16 = UInt16.t", "val Vale.Wrapper.X64.GCMdecryptOpt.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Wrapper.X64.GCM_IV.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.PPC64LE.Memory.tuint32 = Prims.eqtype\nlet tuint32 = UInt32.t", "val Vale.Wrapper.X64.GCMencryptOpt.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint8 = Prims.eqtype\nlet tuint8 = UInt8.t", "val Vale.Wrapper.X64.GCMencryptOpt256.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.PPC64LE.Memory.tuint16 = Prims.eqtype\nlet tuint16 = UInt16.t", "val Vale.X64.Memory.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Vale.Wrapper.X64.GCMdecryptOpt256.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Decls.quad32 = Prims.eqtype\nlet quad32 = quad32", "val Vale.PPC64LE.Memory.tuint8 = Prims.eqtype\nlet tuint8 = UInt8.t", "val Vale.X64.Decls.va_operand_dst_opr64 = Prims.eqtype\nlet va_operand_dst_opr64 = operand64", "val Vale.PPC64LE.Memory.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Vale.X64.Machine_s.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Vale.X64.Decls.va_operand_opr64 = Prims.eqtype\nlet va_operand_opr64 = operand64", "val Vale.PPC64LE.Machine_s.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Vale.X64.Decls.va_value_xmm = Prims.eqtype\nlet va_value_xmm = quad32", "val Vale.X64.Decls.va_operand_opr128 = Prims.eqtype\nlet va_operand_opr128 = operand128", "val EverCrypt.Helpers.uint64_t = Prims.eqtype\nlet uint64_t = UInt64.t", "val Vale.X64.Decls.va_operand_shift_amt64 = Prims.eqtype\nlet va_operand_shift_amt64 = operand64", "val Vale.X64.Machine_Semantics_s.ocmp = Prims.eqtype\nlet ocmp = BC.ocmp", "val MiTLS.Crypto.Symmetric.Bytes.u64 = Prims.eqtype\nlet u64 = UInt64.t", "val MiTLS.FStar.Old.Endianness.u64 = Prims.eqtype\nlet u64 = UInt64.t", "val Vale.X64.Lemmas.ocmp = Prims.eqtype\nlet ocmp = BS.ocmp", "val EverCrypt.Helpers.uint32_t = Prims.eqtype\nlet uint32_t = UInt32.t", "val OPLSS2021.MemCpy.Deps.uint32 = Prims.eqtype\nlet uint32 = U32.t", "val EverCrypt.Helpers.uint16_t = Prims.eqtype\nlet uint16_t = UInt16.t", "val MiTLS.Crypto.Symmetric.Bytes.u32 = Prims.eqtype\nlet u32 = UInt32.t", "val MiTLS.FStar.Old.Endianness.u32 = Prims.eqtype\nlet u32 = UInt32.t", "val Vale.PPC64LE.Decls.va_value_vec_opr = Prims.eqtype\nlet va_value_vec_opr = quad32", "val EverCrypt.Helpers.uint8_t = Prims.eqtype\nlet uint8_t = UInt8.t", "val Vale.Inline.X64.Fswap_inline.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val MerkleTree.Low.Serialization.uint64_t = Prims.eqtype\nlet uint64_t = U64.t", "val Demo.Deps.uint32 = Prims.eqtype\nlet uint32 = U32.t", "val Hacl.Blake2b_32.size_t = Prims.eqtype\nlet size_t = U32.t", "val MiTLS.FStar.Old.Endianness.u8 = Prims.eqtype\nlet u8 = UInt8.t", "val OPLSS2021.MemCpy.Deps.uint8 = Prims.eqtype\nlet uint8 = U8.t", "val Vale.Inline.X64.Fswap_inline.u256 = Type0\nlet u256 = b:B.buffer UInt64.t{B.length b == 4}", "val MerkleTree.Low.Serialization.uint32_t = Prims.eqtype\nlet uint32_t = U32.t", "val Hacl.Blake2b_256.size_t = Prims.eqtype\nlet size_t = U32.t", "val MiTLS.Crypto.Symmetric.Bytes.u8 = Prims.eqtype\nlet u8 = UInt8.t", "val MiTLS.Buffer.Utils.u32 = Prims.eqtype\nlet u32 = FStar.UInt32.t", "val Vale.Stdcalls.X64.Fsub.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.Inline.X64.Fswap_inline.u512 = Type0\nlet u512 = b:B.buffer UInt64.t{B.length b == 8}", "val MerkleTree.Low.Serialization.uint16_t = Prims.eqtype\nlet uint16_t = U16.t", "val MerkleTree.Low.Serialization.uint8_t = Prims.eqtype\nlet uint8_t = U8.t", "val Vale.Stdcalls.X64.Fmul.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Bug96.mini_t = Prims.eqtype\nlet mini_t = int", "val Demo.Deps.uint8 = Prims.eqtype\nlet uint8 = U8.t", "val Vale.Inline.X64.Fswap_inline.u1024 = Type0\nlet u1024 = b:B.buffer UInt64.t{B.length b == 16}", "val Vale.Stdcalls.X64.Fsqr.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.Inline.X64.Fswap_inline.b64 = Type0\nlet b64 = buf_t TUInt64 TUInt64", "val Vale.Stdcalls.X64.Fsub.b64 = Type0\nlet b64 = buf_t TUInt64 TUInt64", "val ASN1.Low.Base.size_t = Prims.eqtype\nlet size_t = U32.t", "val Vale.X64.Machine_s.pow2_64 = Prims.int\nlet pow2_64 = Vale.Def.Words_s.pow2_64", "val Vale.Stdcalls.X64.Fmul.b64 = Type0\nlet b64 = buf_t TUInt64 TUInt64", "val Vale.Inline.X64.Fswap_inline.t64_no_mod = Vale.Interop.Base.td\nlet t64_no_mod = TD_Buffer TUInt64 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})", "val Vale.Inline.X64.Fswap_inline.t64_mod = Vale.Interop.Base.td\nlet t64_mod = TD_Buffer TUInt64 TUInt64 default_bq", "val Vale.Stdcalls.X64.Fadd.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.Stdcalls.X64.Sha.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.Stdcalls.X64.GCTR.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.Stdcalls.X64.Poly.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Vale.X64.Machine_s.pow2_32 = Prims.int\nlet pow2_32 = Vale.Def.Words_s.pow2_32", "val Vale.Inline.X64.Fswap_inline.lowstar_cswap_t = Type0\nlet lowstar_cswap_t =\n assert_norm (List.length cswap_dom + List.length ([]<:list arg) <= 3);\n IX64.as_lowstar_sig_t_weak\n 3\n arg_reg\n cswap_regs_modified\n cswap_xmms_modified\n code_cswap\n cswap_dom\n []\n _\n _\n // The boolean here doesn't matter\n (W.mk_prediction code_cswap cswap_dom [] (cswap_lemma code_cswap IA.win))", "val Vale.Stdcalls.X64.Fadd.b64 = Type0\nlet b64 = buf_t TUInt64 TUInt64", "val Vale.Wrapper.X64.Sha.uint32_i = Type0\nlet uint32_i = IB.ibuffer uint32", "val Vale.Stdcalls.X64.Fsqr.b64 = Type0\nlet b64 = buf_t TUInt64 TUInt64", "val Vale.Stdcalls.X64.Fsub.t64_mod = Vale.Interop.Base.td\nlet t64_mod = TD_Buffer TUInt64 TUInt64 default_bq", "val Vale.Wrapper.X64.Sha.uint32_p = Type0\nlet uint32_p = B.buffer uint32", "val FStar.Bytes.u32 = Prims.eqtype\nlet u32 = U32.t", "val Vale.Stdcalls.X64.Sha.b8_128 = Type0\nlet b8_128 = buf_t TUInt8 TUInt128", "val MiTLS.Buffer.Utils.u8 = Prims.eqtype\nlet u8 = FStar.UInt8.t", "val Vale.Stdcalls.X64.Poly.b64 = Type0\nlet b64 = buf_t TUInt8 TUInt64", "val Vale.Wrapper.X64.Sha.uint64 = Type0\nlet uint64 = uint_t U64 PUB", "val Vale.Stdcalls.X64.Fsub.t64_no_mod = Vale.Interop.Base.td\nlet t64_no_mod = TD_Buffer TUInt64 TUInt64 ({modified=false; strict_disjointness=false; taint=MS.Secret})", "val EverParse3d.Prelude.___Bool = Prims.eqtype\nlet ___Bool = bool", "val Vale.Inline.X64.Fmul_inline.tuint64 = Vale.Interop.Base.td\nlet tuint64 = TD_Base TUInt64", "val Steel.ST.Printf.__printf_reduce__ = Prims.eqtype\nlet __printf_reduce__ = unit" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Aes.fsti", "name": "Vale.Stdcalls.X64.Aes.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCM_IV.fst", "name": "Vale.Stdcalls.X64.GCM_IV.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMdecryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMdecryptOpt.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMencryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMencryptOpt.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.Poly.fsti", "name": "Vale.Wrapper.X64.Poly.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCTR.fsti", "name": "Vale.Wrapper.X64.GCTR.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint32" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint16" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCMdecryptOpt.fsti", "name": "Vale.Wrapper.X64.GCMdecryptOpt.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCM_IV.fsti", "name": "Vale.Wrapper.X64.GCM_IV.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint32" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCMencryptOpt.fsti", "name": "Vale.Wrapper.X64.GCMencryptOpt.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint8" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCMencryptOpt256.fsti", "name": "Vale.Wrapper.X64.GCMencryptOpt256.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint16" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCMdecryptOpt256.fsti", "name": "Vale.Wrapper.X64.GCMdecryptOpt256.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint8" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_dst_opr64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fsti", "name": "Vale.PPC64LE.Memory.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_s.fst", "name": "Vale.X64.Machine_s.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_opr64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Machine_s.fst", "name": "Vale.PPC64LE.Machine_s.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_value_xmm" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_opr128" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Helpers.fsti", "name": "EverCrypt.Helpers.uint64_t" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_shift_amt64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.ocmp" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.u64" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FStar.Old.Endianness.fst", "name": "MiTLS.FStar.Old.Endianness.u64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Lemmas.fsti", "name": "Vale.X64.Lemmas.ocmp" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Helpers.fsti", "name": "EverCrypt.Helpers.uint32_t" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.uint32" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Helpers.fsti", "name": "EverCrypt.Helpers.uint16_t" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.u32" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FStar.Old.Endianness.fst", "name": "MiTLS.FStar.Old.Endianness.u32" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_value_vec_opr" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Helpers.fsti", "name": "EverCrypt.Helpers.uint8_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.tuint64" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.uint64_t" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.uint32" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_32.fsti", "name": "Hacl.Blake2b_32.size_t" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FStar.Old.Endianness.fst", "name": "MiTLS.FStar.Old.Endianness.u8" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.uint8" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fsti", "name": "Vale.Inline.X64.Fswap_inline.u256" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.uint32_t" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_256.fsti", "name": "Hacl.Blake2b_256.size_t" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Crypto.Symmetric.Bytes.fst", "name": "MiTLS.Crypto.Symmetric.Bytes.u8" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Buffer.Utils.fst", "name": "MiTLS.Buffer.Utils.u32" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fsti", "name": "Vale.Inline.X64.Fswap_inline.u512" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.uint16_t" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.Serialization.fst", "name": "MerkleTree.Low.Serialization.uint8_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.tuint64" }, { "project_name": "steel", "file_name": "Bug96.fst", "name": "Bug96.mini_t" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.uint8" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fsti", "name": "Vale.Inline.X64.Fswap_inline.u1024" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.b64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.b64" }, { "project_name": "dice-star", "file_name": "ASN1.Low.Base.fst", "name": "ASN1.Low.Base.size_t" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_s.fst", "name": "Vale.X64.Machine_s.pow2_64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.b64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.t64_no_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.t64_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_s.fst", "name": "Vale.X64.Machine_s.pow2_32" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.lowstar_cswap_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.b64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.Sha.fsti", "name": "Vale.Wrapper.X64.Sha.uint32_i" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.b64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.t64_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.Sha.fsti", "name": "Vale.Wrapper.X64.Sha.uint32_p" }, { "project_name": "FStar", "file_name": "FStar.Bytes.fsti", "name": "FStar.Bytes.u32" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.b8_128" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Buffer.Utils.fst", "name": "MiTLS.Buffer.Utils.u8" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.b64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.Sha.fsti", "name": "Vale.Wrapper.X64.Sha.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.t64_no_mod" }, { "project_name": "everparse", "file_name": "EverParse3d.Prelude.fsti", "name": "EverParse3d.Prelude.___Bool" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.tuint64" }, { "project_name": "steel", "file_name": "Steel.ST.Printf.fst", "name": "Steel.ST.Printf.__printf_reduce__" } ], "selected_premises": [ "Vale.Def.Words_s.nat64", "Vale.X64.Machine_s.nat64", "Vale.Interop.X64.registers", "Vale.Def.Types_s.nat64", "Vale.X64.Memory.nat64", "Vale.Arch.MachineHeap_s.valid_addr64", "Vale.X64.Machine_s.pow2_64", "Vale.Interop.Views.up_view64", "Vale.X64.Machine_s.operand64", "Vale.X64.Instruction_s.one64Reg", "Vale.X64.Machine_s.reg_64", "Vale.Interop.Views.down_view64", "Vale.AsLowStar.ValeSig.vale_sig_stdcall", "Vale.AsLowStar.LowStarSig.arg_as_nat64", "Vale.Def.Words_s.pow2_64", "Vale.X64.Decls.va_upd_reg64", "Vale.X64.CPU_Features_s.sse_enabled", "Vale.X64.Decls.va_if", "Vale.Interop.X64.als_ret", "Vale.Interop.X64.max_stdcall", "Vale.X64.Decls.va_state", "Vale.X64.Instruction_s.op64", "Vale.X64.CPU_Features_s.avx_enabled", "Vale.Interop.X64.arg_as_nat64", "Vale.X64.Decls.validSrcAddrs64", "Vale.Interop.Base.buf_t", "Vale.Interop.Base.ibuf_t", "Vale.Def.Words_s.nat32", "Vale.Interop.X64.regs_modified_stdcall", "Vale.Curve25519.Fast_defs.prime", "Vale.Interop.X64.register_of_arg_i", "Vale.Arch.Types.iand64", "Vale.X64.Decls.va_upd_flags", "Vale.X64.Decls.va_get_ok", "Vale.X64.Machine_Semantics_s.ins", "Vale.X64.Machine_s.reg_xmm", "Vale.Arch.MachineHeap_s.get_heap_val64_reveal", "Vale.X64.InsBasic.vale_stack", "Vale.X64.Decls.va_get_reg64", "Vale.X64.MemoryAdapters.as_vale_stack", "Vale.AsLowStar.Wrapper.pre_rel_generic", "Vale.X64.Decls.va_int_range", "Vale.X64.Decls.va_get_mem_layout", "Vale.X64.InsBasic.vale_heap", "Vale.Interop.X64.xmms_modified_stdcall", "Vale.Interop.Base.default_bq", "Vale.Interop.Base.stack_bq", "Vale.AsLowStar.Wrapper.post_rel_generic", "Vale.Interop.X64.as_lowstar_sig_t_weak_stdcall", "Vale.AsLowStar.LowStarSig.vale_pre_hyp", "LowStar.Buffer.trivial_preorder", "FStar.UInt.size", "Vale.Curve25519.Fast_defs.pow2_four", "Vale.X64.Memory.nat8", "Vale.Def.Types_s.nat8", "Vale.X64.Decls.va_code", "Vale.Interop.X64.reg_nat", "Vale.X64.Decls.va_get_mem_heaplet", "Vale.Def.Words_s.natN", "FStar.Mul.op_Star", "Vale.X64.Decls.va_upd_mem_heaplet", "Vale.X64.Memory.vuint64", "Vale.X64.Decls.va_upd_xmm", "Vale.X64.Decls.quad32", "Vale.X64.Decls.va_upd_mem", "Vale.X64.Decls.va_mul_nat", "Vale.X64.Instruction_s.instr_out", "Vale.Curve25519.Fast_defs.pow2_five", "Vale.Interop.X64.wrap_weak_stdcall", "FStar.List.Tot.Base.length", "LowStar.Monotonic.Buffer.length", "Vale.AsLowStar.LowStarSig.create_initial_vale_state", "Vale.X64.Machine_s.quad32", "Vale.X64.Memory.quad32", "Vale.X64.CPU_Features_s.avx2_enabled", "Vale.X64.QuickCodes.label", "Vale.X64.Decls.buffer64_read", "Vale.Arch.MachineHeap_s.machine_heap", "LowStar.BufferView.Down.buffer", "Vale.Interop.Types.get_downview", "Vale.AsLowStar.LowStarSig.uint_to_nat", "Vale.AsLowStar.ValeSig.sprop", "Vale.Arch.MachineHeap_s.get_heap_val64", "Vale.X64.Decls.va_upd_stack", "Vale.Interop.X64.arg_of_register", "Vale.AsLowStar.Wrapper.prediction_pre_rel", "Vale.AsLowStar.Wrapper.mk_prediction", "Vale.X64.Decls.validDstAddrs64", "Vale.Interop.Types.base_typ_as_type", "Vale.X64.Instruction_s.inOut", "Vale.X64.Decls.va_upd_mem_layout", "Vale.X64.State.eval_reg_64", "Vale.AsLowStar.LowStarSig.to_low_pre", "Vale.X64.Instruction_s.opXmm", "Vale.AsLowStar.LowStarSig.nat_to_uint", "LowStar.BufferView.buffer", "Vale.AsLowStar.LowStarSig.view_of_base_typ", "Vale.Interop.Base.valid_base_type", "Vale.X64.Decls.va_get_mem", "Vale.Arch.MachineHeap_s.update_heap64_reveal" ], "source_upto_this": "module Vale.Stdcalls.X64.Fswap\nopen FStar.Mul\n\nval z3rlimit_hack (x:nat) : squash (x < x + x + 1)\n#reset-options \"--z3rlimit 50\"\n\nopen FStar.HyperStack.ST\nmodule HS = FStar.HyperStack\nmodule B = LowStar.Buffer\nmodule DV = LowStar.BufferView.Down\nopen Vale.Def.Types_s\n\nopen Vale.Interop.Base\nmodule IX64 = Vale.Interop.X64\nmodule VSig = Vale.AsLowStar.ValeSig\nmodule LSig = Vale.AsLowStar.LowStarSig\nmodule ME = Vale.X64.Memory\nmodule V = Vale.X64.Decls\nmodule IA = Vale.Interop.Assumptions\nmodule W = Vale.AsLowStar.Wrapper\nopen Vale.X64.MemoryAdapters\nmodule VS = Vale.X64.State\nmodule MS = Vale.X64.Machine_s\nopen Vale.AsLowStar.MemoryHelpers\n\nmodule FU = Vale.Curve25519.X64.FastUtil\nmodule FH = Vale.Curve25519.X64.FastHybrid\nmodule FW = Vale.Curve25519.X64.FastWide\n", "sketch": [ "The definition is about defining a type for 64-bit unsigned integers.\n\nStep 1: We define a type for 64-bit unsigned integers.\n\nStep 2: The definition is implemented by using the `uint64` type as an alias for the `uint64_t` type, which represents 64-bit unsigned integers in F*.", "The definition is about defining a type for 64-bit unsigned integers.\n\nStep 1: We define a type representing 64-bit unsigned integers.\nStep 2: We implement the definition by using F* syntax to define the uint64 type.", "The definition is about specifying the type uint64 as an equality type, indicating that it supports equality comparison.\n\nStep 1: Define the type uint64 as an equality type.\nStep 2: Implement the equality type for uint64.", "The definition is about defining a type representing 64-bit unsigned integers.\n\nStep 1: We define a type representing 64-bit unsigned integers.\n\nStep 2: The definition is implemented by using the existing F* type system to define a new type for 64-bit unsigned integers.", "The definition is about defining a type representing 64-bit unsigned integers.\n\nStep 1: We define a type representing 64-bit unsigned integers.\n\nStep 2: We implement the definition by using F*'s built-in type system to define a new type representing 64-bit unsigned integers.", "The definition is about defining a type representing 64-bit unsigned integers.\n\nStep 1: We define a type representing 64-bit unsigned integers.\n\nStep 2: The definition is implemented by specifying the type as uint64.", "The definition is about defining a type representing 64-bit unsigned integers.\n\nStep 1: We define a type representing 64-bit unsigned integers.\n\nStep 2: The definition is implemented by using the `uint64` type as an alias for the `uint64_t` type, which represents 64-bit unsigned integers in F*.", "The definition is about defining a type for 64-bit unsigned integers.\n\nStep 1: We define a type for 64-bit unsigned integers.\nStep 2: We implement the definition by using the `uint64` type in F*.", "The definition is about specifying the type uint64 as an equality type.\n\nStep 1: We are defining the type uint64 as an equality type, which means that we can compare two values of type uint64 for equality.\n\nStep 2: We implement the definition by specifying uint64 as an equality type using the `eqtype` keyword in F*.", "The definition is about defining a type representing 64-bit unsigned integers.\n\nStep 1: We need to define a type for 64-bit unsigned integers.\nStep 2: We can use the existing F* type system to define a new type representing 64-bit unsigned integers." ], "generated_solution": [ "val uint64 : Type", "val uint64 : Prims.eqtype", "val uint64 : Prims.eqtype", "val uint64 : Prims.eqtype", "val uint64 : FStar.UInt64.t", "val uint64 : Prims.eqtype", "val uint64 : Prims.eqtype = uint64_t", "val uint64 : Type", "val uint64 : Prims.eqtype", "val uint64 : FStar.UInt64.t" ] }, { "file_name": "FStar.Monotonic.HyperStack.fst", "name": "FStar.Monotonic.HyperStack.lemma_upd_same_addr", "opens_and_abbrevs": [ { "abbrev": "Map", "full_module": "FStar.Map" }, { "open": "FStar.Preorder" }, { "open": "FStar.Monotonic.HyperHeap" }, { "abbrev": "Map", "full_module": "FStar.Map" }, { "open": "FStar.Preorder" }, { "open": "FStar.Monotonic" }, { "open": "FStar.Monotonic" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val lemma_upd_same_addr (#a:Type0) (#rel:preorder a) (h:mem) (r1 r2:mreference a rel) (x: a)\n :Lemma (requires (frameOf r1 == frameOf r2 /\\ (h `contains` r1 \\/ h `contains` r2) /\\\n as_addr r1 == as_addr r2 /\\ is_mm r1 == is_mm r2))\n (ensures (h `contains` r1 /\\ h `contains` r2 /\\ upd h r1 x == upd h r2 x))", "source_definition": "let lemma_upd_same_addr #_ #_ h r1 r2 x =\n FStar.Monotonic.Heap.lemma_heap_equality_upd_same_addr (Map.sel h.h (frameOf r1)) (as_ref r1) (as_ref r2) x;\n Classical.or_elim #(h `contains` r1) #(~ (h `contains` r1))\n #(fun _ -> h `contains` r1 /\\ h `contains` r2 /\\ upd h r1 x == upd h r2 x)\n (fun _ -> lemma_sel_same_addr h r1 r2) (fun _ -> lemma_sel_same_addr h r2 r1)", "source_range": { "start_line": 77, "start_col": 0, "end_line": 81, "end_col": 97 }, "interleaved": false, "definition": "fun h r1 r2 x ->\n FStar.Monotonic.Heap.lemma_heap_equality_upd_same_addr (FStar.Map.sel (HS?.h h)\n (FStar.Monotonic.HyperStack.frameOf r1))\n (FStar.Monotonic.HyperStack.as_ref r1)\n (FStar.Monotonic.HyperStack.as_ref r2)\n x;\n FStar.Classical.or_elim (fun _ -> FStar.Monotonic.HyperStack.lemma_sel_same_addr h r1 r2)\n (fun _ -> FStar.Monotonic.HyperStack.lemma_sel_same_addr h r2 r1)", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "FStar.Preorder.preorder", "FStar.Monotonic.HyperStack.mem", "FStar.Monotonic.HyperStack.mreference", "FStar.Classical.or_elim", "FStar.Monotonic.HyperStack.contains", "Prims.l_not", "Prims.squash", "Prims.l_or", "Prims.l_and", "Prims.eq2", "FStar.Monotonic.HyperStack.upd", "FStar.Monotonic.HyperStack.lemma_sel_same_addr", "Prims.unit", "FStar.Monotonic.Heap.lemma_heap_equality_upd_same_addr", "FStar.Map.sel", "FStar.Monotonic.HyperHeap.rid", "FStar.Monotonic.Heap.heap", "FStar.Monotonic.HyperStack.__proj__HS__item__h", "FStar.Monotonic.HyperStack.frameOf", "FStar.Monotonic.HyperStack.as_ref" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n h: FStar.Monotonic.HyperStack.mem ->\n r1: FStar.Monotonic.HyperStack.mreference a rel ->\n r2: FStar.Monotonic.HyperStack.mreference a rel ->\n x: a\n -> FStar.Pervasives.Lemma\n (requires\n FStar.Monotonic.HyperStack.frameOf r1 == FStar.Monotonic.HyperStack.frameOf r2 /\\\n (FStar.Monotonic.HyperStack.contains h r1 \\/ FStar.Monotonic.HyperStack.contains h r2) /\\\n FStar.Monotonic.HyperStack.as_addr r1 == FStar.Monotonic.HyperStack.as_addr r2 /\\\n FStar.Monotonic.HyperStack.is_mm r1 == FStar.Monotonic.HyperStack.is_mm r2)\n (ensures\n FStar.Monotonic.HyperStack.contains h r1 /\\ FStar.Monotonic.HyperStack.contains h r2 /\\\n FStar.Monotonic.HyperStack.upd h r1 x == FStar.Monotonic.HyperStack.upd h r2 x)", "prompt": "let lemma_upd_same_addr #_ #_ h r1 r2 x =\n ", "expected_response": "FStar.Monotonic.Heap.lemma_heap_equality_upd_same_addr (Map.sel h.h (frameOf r1))\n (as_ref r1)\n (as_ref r2)\n x;\nClassical.or_elim #(h `contains` r1)\n #(~(h `contains` r1))\n #(fun _ -> h `contains` r1 /\\ h `contains` r2 /\\ upd h r1 x == upd h r2 x)\n (fun _ -> lemma_sel_same_addr h r1 r2)\n (fun _ -> lemma_sel_same_addr h r2 r1)", "source": { "project_name": "FStar", "file_name": "ulib/FStar.Monotonic.HyperStack.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Monotonic.HyperStack.fst", "checked_file": "dataset/FStar.Monotonic.HyperStack.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Heap.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "let map_invariant = map_invariant_predicate", "let downward_closed = downward_closed_predicate", "let tip_top = tip_top_predicate", "let is_in (r:rid) (h:hmap) = h `Map.contains` r", "let rid_ctr_pred = rid_ctr_pred_predicate", "let is_stack_region r = color r > 0", "let is_heap_color c = c <= 0", "mem'", "HS", "HS", "HS", "rid_ctr", "rid_ctr", "h", "h", "tip", "tip", "let is_eternal_region r = is_heap_color (color r) && not (rid_freeable r)", "let mk_mem rid_ctr h tip = HS rid_ctr h tip", "let is_eternal_region_hs r = is_heap_color (color r) && not (rid_freeable r)", "let get_hmap m = m.h", "let get_rid_ctr m = m.rid_ctr", "sid", "let get_tip m = m.tip", "let lemma_mk_mem'_projectors _ _ _ = ()", "let lemma_mem_projectors_are_in_wf_relation _ = ()", "let is_above r1 r2 = r1 `includes` r2", "let is_just_below r1 r2 = r1 `extends` r2", "let lemma_is_wf_ctr_and_tip_intro _ _ _ = root_is_not_freeable ()", "let is_below r1 r2 = r2 `is_above` r1", "let is_strictly_below r1 r2 = r1 `is_below` r2 && r1 <> r2", "let lemma_is_wf_ctr_and_tip_elim _ = ()", "let is_strictly_above r1 r2 = r1 `is_above` r2 && r1 <> r2", "let lemma_map_invariant _ _ _ = ()", "let lemma_downward_closed _ _ _ = ()", "let map_invariant_predicate (m:hmap) :Type0 =\n forall r. Map.contains m r ==>\n (forall s. includes s r ==> Map.contains m s)", "let lemma_tip_top _ _ = ()", "let lemma_tip_top_smt _ _ = ()", "let downward_closed_predicate (h:hmap) :Type0 =\n forall (r:rid). r `is_in` h //for any region in the memory\n ==> (r=root //either is the root\n \\/ (forall (s:rid). (r `is_above` s //or, any region beneath it\n /\\ s `is_in` h) //that is also in the memory\n ==> ((is_stack_region r = is_stack_region s) /\\ //must be of the same flavor as itself\n ((is_heap_color (color r) /\\ rid_freeable r) ==> s == r))))", "let lemma_rid_ctr_pred _ = ()", "let as_ref #_ #_ x = MkRef?.ref x", "let lemma_as_ref_inj #_ #_ _ = ()", "val lemma_extends_fresh_disjoint: i:rid -> j:rid -> ipar:rid -> jpar:rid\n -> (m0:mem) -> (m1:mem) ->\n Lemma (requires (let h0, h1 = get_hmap m0, get_hmap m1 in\n (map_invariant h0 /\\\n\t\t map_invariant h1 /\\\n fresh_region i m0 m1 /\\\n fresh_region j m0 m1 /\\\n h0 `Map.contains` ipar /\\\n h0 `Map.contains` jpar /\\\n extends i ipar /\\\n extends j jpar /\\\n i<>j)))\n (ensures (disjoint i j))", "let tip_top_predicate (tip:rid) (h:hmap) :Type0 =\n forall (r:sid). r `is_in` h <==> r `is_above` tip", "let rid_ctr_pred_predicate (h:hmap) (n:int) :Type0 =\n forall (r:rid). h `Map.contains` r ==> rid_last_component r < n", "let lemma_extends_fresh_disjoint i j ipar jpar m0 m1 = ()", "val map_invariant (m:hmap) :Type0", "let lemma_sel_same_addr #_ #_ _ _ _ = ()", "val downward_closed (h:hmap) :Type0" ], "closest": [ "val lemma_heap_equality_upd_same_addr (#a: Type0) (#rel: preorder a) (h: heap) (r1 r2: mref a rel) (x: a)\n :Lemma (requires ((h `contains` r1 \\/ h `contains` r2) /\\ addr_of r1 = addr_of r2 /\\ is_mm r1 == is_mm r2))\n (ensures (upd h r1 x == upd h r2 x))\nlet lemma_heap_equality_upd_same_addr #a #rel h r1 r2 x =\n assert (equal (upd h r1 x) (upd h r2 x))", "val lemma_heap_equality_commute_distinct_upds\n (#a:Type) (#b:Type) (#rel_a:preorder a) (#rel_b:preorder b) (h:heap) (r1:mref a rel_a) (r2:mref b rel_b)\n (x:a) (y:b)\n :Lemma (requires (addr_of r1 =!= addr_of r2))\n (ensures (upd (upd h r1 x) r2 y == upd (upd h r2 y) r1 x))\nlet lemma_heap_equality_commute_distinct_upds #a #b #rel_a #rel_b h r1 r2 x y =\n let h0 = upd (upd h r1 x) r2 y in\n let h1 = upd (upd h r2 y) r1 x in\n assert (equal h0 h1)", "val lemma_heap_equality_cancel_same_mref_upd\n (#a:Type) (#rel:preorder a) (h:heap) (r:mref a rel)\n (x:a) (y:a)\n :Lemma (requires True)\n (ensures (upd (upd h r x) r y == upd h r y))\nlet lemma_heap_equality_cancel_same_mref_upd #a #rel h r x y =\n let h0 = upd (upd h r x) r y in\n let h1 = upd h r y in\n assert (equal h0 h1)", "val lemma_heap_equality_upd_with_sel\n (#a:Type) (#rel:preorder a) (h:heap) (r:mref a rel)\n :Lemma (requires (h `contains` r))\n (ensures (upd h r (sel h r) == h))\nlet lemma_heap_equality_upd_with_sel #a #rel h r =\n let h' = upd h r (sel h r) in\n let Some (| _, _, _, _ |) = h.memory r.addr in\n assert (equal h h')", "val live_same_addresses_equal_types_and_preorders\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n (h: HS.mem)\n: Lemma\n ((frameOf b1 == frameOf b2 /\\ as_addr b1 == as_addr b2 /\\ live h b1 /\\ live h b2 /\\ (~ (g_is_null b1 /\\ g_is_null b2))) ==> (a1 == a2 /\\ rrel1 == rrel2))\nlet live_same_addresses_equal_types_and_preorders\n #_ #_ #_ #_ #_ #_ b1 b2 h\n= Classical.move_requires (live_same_addresses_equal_types_and_preorders' b1 b2) h", "val lemma_upd (#a: Type) (h: mem) (x: reference a {live_region h (HS.frameOf x)}) (v: a)\n : Lemma (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\nlet lemma_upd (#a:Type) (h:mem) (x:reference a{live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\n = let m = HS.get_hmap h in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')", "val live_same_addresses_equal_types_and_preorders'\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n (h: HS.mem)\n : Lemma\n (requires\n frameOf b1 == frameOf b2 /\\ as_addr b1 == as_addr b2 /\\ live h b1 /\\ live h b2 /\\\n (~(g_is_null b1 /\\ g_is_null b2))) (ensures a1 == a2 /\\ rrel1 == rrel2)\nlet live_same_addresses_equal_types_and_preorders'\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n (h: HS.mem)\n: Lemma\n (requires \n frameOf b1 == frameOf b2 /\\\n as_addr b1 == as_addr b2 /\\\n live h b1 /\\\n live h b2 /\\\n (~ (g_is_null b1 /\\ g_is_null b2)))\n (ensures \n a1 == a2 /\\\n rrel1 == rrel2)\n= Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n let s1 : Seq.seq a1 = as_seq h b1 in\n assert (Seq.seq a1 == Seq.seq a2);\n let s1' : Seq.seq a2 = coerce_eq _ s1 in\n assert (s1 === s1');\n lemma_equal_instances_implies_equal_types a1 a2 s1 s1'", "val lemma_g_upd_with_same_seq (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (h:HS.mem)\n :Lemma (requires (live h b)) (ensures (g_upd_seq b (as_seq h b) h == h))\nlet lemma_g_upd_with_same_seq #_ #_ #_ b h =\n if Null? b then ()\n else\n let open FStar.UInt32 in\n let Buffer _ content idx length = b in\n let s = HS.sel h content in\n assert (Seq.equal (Seq.replace_subseq s (v idx) (v idx + v length) (Seq.slice s (v idx) (v idx + v length))) s);\n HS.lemma_heap_equality_upd_with_sel h (Buffer?.content b)", "val upd : #a:Type ->\n\t #r:preorder a ->\n h0:heap ->\n m:mref a r{contains h0 m} ->\n x:a ->\n Tot (h1:heap{contains h1 m /\\\n\t sel h1 m == x /\\\n\t\t (forall b r' (m':mref b r') .\n\t\t\t contains h0 m'\n\t\t\t ==>\n\t\t\t contains h1 m') /\\\n\t\t (forall b r' (m':mref b r'{contains h0 m'}).{:pattern (sel h0 m') \\/ (sel h1 m')}\n\t\t ((addr_of m' <> addr_of m) \\/\n ~(m === m')) ==>\n\t\t\t sel h0 m' == sel h1 m')})\nlet upd #a #r h0 m x =\n (fst h0 , (fun m' -> if m = m' then Some (| a , (x , r) |)\n else snd h0 m'))", "val does_not_contain_addr_elim\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n m `does_not_contain_addr` x /\\\n HS.frameOf r == fst x /\\\n HS.as_addr r == snd x\n ))\n (ensures (~ (m `HS.contains` r)))\nlet does_not_contain_addr_elim = MG.does_not_contain_addr_elim", "val does_not_contain_addr_elim\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n m `does_not_contain_addr` x /\\\n HS.frameOf r == fst x /\\\n HS.as_addr r == snd x\n ))\n (ensures (~ (m `HS.contains` r)))\nlet does_not_contain_addr_elim = MG.does_not_contain_addr_elim", "val upd_ref_of\n (a: aref)\n (t: Type0)\n (rel: preorder t)\n (h1 h2: heap)\n (x: t)\n: Lemma\n (requires (aref_live_at h1 a t rel /\\ aref_live_at h2 a t rel))\n (ensures (aref_live_at h2 a t rel /\\ upd h1 (ref_of h2 a t rel) x == upd h1 (gref_of a t rel) x))\n [SMTPat (upd h1 (ref_of h2 a t rel) x)]\nlet upd_ref_of a t rel h1 h2 x =\n lemma_heap_equality_upd_same_addr h1 (ref_of h2 a t rel) (gref_of a t rel) x", "val reference_distinct_sel_disjoint (#a: Type0) (h: mem) (r1 r2: reference a)\n : Lemma\n (requires\n (h `contains` r1 /\\ h `contains` r2 /\\ frameOf r1 == frameOf r2 /\\ as_addr r1 == as_addr r2)\n ) (ensures (sel h r1 == sel h r2))\nlet reference_distinct_sel_disjoint\n (#a:Type0) (h: mem) (r1: reference a) (r2: reference a)\n: Lemma\n (requires (\n h `contains` r1 /\\\n h `contains` r2 /\\\n frameOf r1 == frameOf r2 /\\\n as_addr r1 == as_addr r2\n ))\n (ensures (\n sel h r1 == sel h r2\n ))\n= mreference_distinct_sel_disjoint h r1 r2", "val unused_in_does_not_contain_addr\n (h: HS.mem)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n: Lemma\n (requires (r `HS.unused_in` h))\n (ensures (h `does_not_contain_addr` (HS.frameOf r, HS.as_addr r)))\nlet unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr", "val unused_in_does_not_contain_addr\n (h: HS.mem)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n: Lemma\n (requires (r `HS.unused_in` h))\n (ensures (h `does_not_contain_addr` (HS.frameOf r, HS.as_addr r)))\nlet unused_in_does_not_contain_addr = MG.unused_in_does_not_contain_addr", "val lemma_g_upd_with_same_seq\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h: HS.mem{B.live h b})\n (s: _)\n : Lemma (Seq.equal s (B.as_seq h b) ==> B.g_upd_seq b s h == h)\nlet lemma_g_upd_with_same_seq (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (h:HS.mem{B.live h b}) (s:_)\n : Lemma (Seq.equal s (B.as_seq h b) ==>\n B.g_upd_seq b s h == h)\n = B.lemma_g_upd_with_same_seq b h", "val liveness_preservation_intro (#a:Type0) (#rrel:srel a) (#rel:srel a)\n (h h':HS.mem) (b:mbuffer a rrel rel)\n (f: (\n (t':Type0) ->\n (pre: Preorder.preorder t') ->\n (r: HS.mreference t' pre) ->\n Lemma\n (requires (HS.frameOf r == frameOf b /\\ HS.as_addr r == as_addr b /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\n ))\n :Lemma (requires (live h b)) (ensures (live h' b))\nlet liveness_preservation_intro #_ #_ #_ _ _ b f =\n if Null? b\n then ()\n else f _ _ (Buffer?.content b)", "val lemma_alloc (#a:Type0) (rel:preorder a) (h0:heap) (x:a) (mm:bool)\n :Lemma (requires True)\n (ensures (let r, h1 = alloc rel h0 x mm in\n fresh r h0 h1 /\\ h1 == upd h0 r x /\\ is_mm r = mm /\\ addr_of r == next_addr h0))\n\t [SMTPat (alloc rel h0 x mm)]\nlet lemma_alloc #a rel h0 x mm =\n let r, h1 = alloc rel h0 x mm in\n let h1' = upd h0 r x in\n assert (equal h1 h1')", "val modifies_preserves_mreferences_intro\n (#al: aloc_t)\n (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f:\n (t: Type -> pre: Preorder.preorder t -> p: HS.mreference t pre\n -> Lemma\n (requires\n (HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==>\n ~(GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))))\n (ensures (HS.contains h2 p /\\ HS.sel h2 p == HS.sel h1 p))))\n : Lemma (modifies_preserves_mreferences s h1 h2)\nlet modifies_preserves_mreferences_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p /\\ HS.sel h2 p == HS.sel h1 p))\n ))\n: Lemma\n (modifies_preserves_mreferences s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p /\\ h2 `HS.sel` p == h1 `HS.sel` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'", "val modifies_upd\n (#aloc: aloc_t) (#c: cls aloc)\n (#t: Type) (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (v: t)\n (h: HS.mem)\n: Lemma\n (requires (HS.contains h r))\n (ensures (modifies #_ #c (loc_mreference r) h (HS.upd h r v)))\nlet modifies_upd #al #c #t #pre r v h =\n let h' = HS.upd h r v in\n modifies_intro #_ #c (loc_mreference r) h h'\n (fun r -> ())\n (fun t pre b -> ())\n (fun t pre b -> ())\n (fun r n -> ())\n (fun r a b -> c.same_mreference_aloc_preserved #r #a b h h' (fun a' pre' r' -> ()))", "val ( := ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) (x: a)\n : HoareST unit\n (fun h -> rel (sel h r) x)\n (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\ sel h1 r == x\n )\nlet op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)\n: HoareST unit\n (fun h -> rel (sel h r) x)\n (fun h0 _ h1 ->\n modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\\n sel h1 r == x)\n= HoareST?.reflect (fun _ -> write r x)", "val ( := ) (#a: Type) (#rel: P.preorder a) (r: mref a rel) (x: a)\n : HoareST unit\n (fun h -> rel (sel h r) x)\n (fun h0 _ h1 -> modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\ sel h1 r == x\n )\nlet op_Colon_Equals (#a:Type) (#rel:P.preorder a) (r:mref a rel) (x:a)\n: HoareST unit\n (fun h -> rel (sel h r) x)\n (fun h0 _ h1 ->\n modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\\n sel h1 r == x)\n= HoareST?.reflect (fun _ -> write r x)", "val modifies_addr_of_modifies\n (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :Lemma (requires (modifies_addr_of b h1 h2))\n (ensures (modifies (loc_addr_of_buffer b) h1 h2))\nlet modifies_addr_of_modifies #t #_ #_ b h1 h2 =\n MG.modifies_address_intro #_ #cls (frameOf b) (as_addr b) h1 h2\n (fun r -> modifies_addr_of_live_region b h1 h2 r)\n (fun t pre p ->\n modifies_addr_of_mreference b h1 h2 p\n )\n (fun r n ->\n modifies_addr_of_unused_in b h1 h2 r n\n )", "val modifies_addr_of_preserves_not_unused_in\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_addr_of_preserves_not_unused_in (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :GTot Type0\n = forall (r: HS.rid) (n: nat) .\n ((r <> frameOf b \\/ n <> as_addr b) /\\\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r)) ==>\n (n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r))", "val recall_p (#a:Type0) (#rel:preorder a) (r:mreference a rel) (p:mem_predicate)\n :ST unit (fun h0 -> ((is_eternal_region (HS.frameOf r) /\\ not (HS.is_mm r)) \\/ h0 `HS.contains` r) /\\ token_p r p)\n (fun h0 _ h1 -> h0 == h1 /\\ h0 `HS.contains` r /\\ p h0)\nlet recall_p #_ #_ r p =\n gst_recall (ref_contains_pred r);\n gst_recall (region_contains_pred (HS.frameOf r));\n gst_recall (mem_rel_predicate r p)", "val free_does_not_contain_addr\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n HS.is_mm r /\\\n m `HS.contains` r /\\\n fst x == HS.frameOf r /\\\n snd x == HS.as_addr r\n ))\n (ensures (\n HS.free r m `does_not_contain_addr` x\n ))\n [SMTPat (HS.free r m `does_not_contain_addr` x)]\nlet free_does_not_contain_addr = MG.free_does_not_contain_addr", "val free_does_not_contain_addr\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n HS.is_mm r /\\\n m `HS.contains` r /\\\n fst x == HS.frameOf r /\\\n snd x == HS.as_addr r\n ))\n (ensures (\n HS.free r m `does_not_contain_addr` x\n ))\n [SMTPat (HS.free r m `does_not_contain_addr` x)]\nlet free_does_not_contain_addr = MG.free_does_not_contain_addr", "val upd_sel : h:heap ->\n a:Type -> \n\t r:ref a{contains #a h r} -> \n\t Lemma (requires (True))\n\t (ensures (upd h r (sel h r) == h))\n\t [SMTPat (upd h r (sel h r))]\nlet upd_sel h a r = \n assert (FStar.FunctionalExtensionality.feq (snd (upd h r (sel h r))) (snd h))", "val recall (#a:Type) (#rel:preorder a) (r:mreference a rel{not (HS.is_mm r)})\n :Stack unit (requires (fun m -> is_eternal_region (HS.frameOf r) \\/ m `contains_region` (HS.frameOf r)))\n (ensures (fun m0 _ m1 -> m0 == m1 /\\ m1 `contains` r))\nlet recall #_ #_ r =\n gst_recall (ref_contains_pred r);\n gst_recall (region_contains_pred (HS.frameOf r))", "val same_mreference_ubuffer_preserved\n (#r: HS.rid)\n (#a: nat)\n (b: ubuffer r a)\n (h1 h2: HS.mem)\n (f: (\n (a' : Type) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ r == HS.frameOf r' /\\ a == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (ubuffer_preserved b h1 h2)\nlet same_mreference_ubuffer_preserved #r #a b h1 h2 f =\n ubuffer_preserved_intro b h1 h2\n (fun t' _ _ b' ->\n if Null? b'\n then ()\n else\n f _ _ (Buffer?.content b')\n )\n (fun t' _ _ b' ->\n if Null? b'\n then ()\n else\n f _ _ (Buffer?.content b')\n )", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro #_ #cls", "val modifies_liveness_insensitive_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\nlet modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_regions (Set.singleton r)) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses r a) l) h1 h2))\nlet modifies_loc_addresses_intro r a l h1 h2 =\n MG.modifies_loc_addresses_intro r a l h1 h2;\n MG.loc_includes_addresses_addresses #_ cls false true r a a;\n MG.loc_includes_refl l;\n MG.loc_includes_union_l (loc_addresses r a) l l;\n MG.loc_includes_union_l (loc_addresses r a) l (MG.loc_addresses true r a);\n MG.loc_includes_union_r (loc_union (loc_addresses r a) l) (MG.loc_addresses true r a) l;\n MG.modifies_loc_includes (loc_union (loc_addresses r a) l) h1 h2 (loc_union (MG.loc_addresses true r a) l)", "val modifies_preserves_liveness_strong\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (x: aloc (HS.frameOf r) (HS.as_addr r))\n: Lemma\n (requires (modifies (loc_union s1 s2) h h' /\\ loc_disjoint s1 (loc_of_aloc #_ #c #(HS.frameOf r) #(HS.as_addr r) x) /\\ loc_includes (address_liveness_insensitive_locs c) s2 /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\nlet modifies_preserves_liveness_strong #al #c s1 s2 h h' #t #pre r x =\n let rg = HS.frameOf r in\n let ad = HS.as_addr r in\n let la = loc_of_aloc #_ #c #rg #ad x in\n if Set.mem rg (regions_of_loc s2)\n then begin\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` Loc?.non_live_addrs (address_liveness_insensitive_locs c) rg);\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` GSet.empty);\n assert (~ (GSet.mem ad (Loc?.non_live_addrs s2 rg)));\n if Set.mem rg (regions_of_loc s1)\n then begin\n if GSet.mem ad (Loc?.non_live_addrs s1 rg)\n then begin\n assert (loc_disjoint_aux s1 la);\n assert (GSet.subset (Loc?.non_live_addrs s1 rg) (Loc?.live_addrs s1 rg));\n assert (aloc_domain c (Loc?.regions s1) (Loc?.live_addrs s1) `GSet.subset` (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad None) (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad (Some x)) (Ghost.reveal (Loc?.aux la)));\n assert (aloc_disjoint (ALoc rg ad None) (ALoc #_ #c rg ad (Some x)));\n ()\n end else ()\n end else ()\n end else ()", "val alloc_ref : h0:heap ->\n\t\ta:Type ->\n\t\tr:preorder a ->\n\t x:a ->\n\t\tTot (mh1:(mref a r * heap){~(contains #a #r h0 (fst mh1)) /\\\n\t\t contains (snd mh1) (fst mh1) /\\\n\t\t sel (snd mh1) (fst mh1) == x /\\\n\t\t\t\t\t (forall b r' (m:mref b r') .\n\t\t\t contains h0 m\n\t\t\t ==>\n\t\t\t contains (snd mh1) m) /\\\n\t\t\t (forall b r' (m:mref b r'{contains h0 m}) y .\n\t\t\t sel #b h0 m == y\n\t\t ==>\n\t\t\t sel #b (snd mh1) m == y)})\nlet alloc_ref h a r x =\n (fst h , (fst h + 1 , (fun n -> if n = fst h then Some (| a , (x , r) |)\n\t\t\t\t\t else snd h n)))", "val upd : #a:Type -> \n h0:heap -> \n r:ref a{contains h0 r} -> \n x:a -> \n Tot (h1:heap{contains h1 r /\\ \n\t sel h1 r == x /\\\n\t\t (forall b (r':ref b) . {:pattern (contains h0 r')}\n\t\t\t contains h0 r' \n\t\t\t ==> \n\t\t\t contains h1 r') /\\\n\t\t (forall b (r':ref b{contains h0 r'}) . {:pattern sel h0 r'}\n\t\t ~(r === r') ==>\n\t\t\t sel h0 r' == sel h1 r')})\nlet upd #a h0 r x = \n (fst h0 , F.on_dom nat (fun r' -> if r = r' then Some (| a , x |)\n else snd h0 r'))", "val modifies_upd\n (#t: Type) (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (v: t)\n (h: HS.mem)\n: Lemma\n (requires (HS.contains h r))\n (ensures (modifies (loc_mreference r) h (HS.upd h r v)))\n [SMTPat (HS.upd h r v)]\nlet modifies_upd = MG.modifies_upd #_ #cls", "val upd_sel : #a:Type -> h:heap -> r:ref a ->\n\t Lemma (requires (h `contains_a_well_typed` r))\n\t (ensures (upd h r (sel h r) == h))\n\t [SMTPat (upd h r (sel h r))]\nlet upd_sel #a h r =\n assert (FStar.FunctionalExtensionality.feq (upd h r (sel h r)).memory h.memory)", "val modifies_loc_addresses_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro #al #c r s l h1 h2 =\n loc_includes_loc_regions_restrict_to_regions l (Set.singleton r);\n loc_includes_loc_union_restrict_to_regions l (Set.singleton r);\n assert (modifies (loc_union (loc_region_only false r) (loc_union (restrict_to_regions l (Set.singleton r)) (restrict_to_regions l (Set.complement (Set.singleton r))))) h1 h2);\n let l' = restrict_to_regions l (Set.complement (Set.singleton r)) in\n loc_includes_refl (loc_region_only #_ #c false r) ;\n loc_includes_loc_regions_restrict_to_regions l (Set.complement (Set.singleton r));\n loc_disjoint_regions #_ #c false false (Set.complement (Set.singleton r)) (Set.singleton r);\n loc_disjoint_includes (loc_regions #_ #c false (Set.complement (Set.singleton r))) (loc_region_only false r) l' (loc_region_only false r);\n modifies_loc_addresses_intro_weak r s l' h1 h2;\n loc_includes_restrict_to_regions l (Set.complement (Set.singleton r))", "val lemma_upd_ne (r r':reg) (v:t_reg r') (m:t) : Lemma\n (requires r =!= r')\n (ensures sel r (upd r' v m) == sel r m)\n [SMTPat (sel r (upd r' v m))]\nlet lemma_upd_ne r r' v m =\n assert_norm (sel r (upd r' v m) == sel r m)", "val modifies_ralloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (i: HS.rid)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HST.is_eternal_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.ralloc_post i init h x h'))\n (ensures (modifies loc_none h h'))\nlet modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls", "val modifies_reference_elim\n (#t: Type0)\n (b: HS.reference t)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_addresses (HS.frameOf b) (Set.singleton (HS.as_addr b))) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_reference_elim #t b p h h' =\n MG.loc_includes_addresses_addresses #_ cls false true (HS.frameOf b) (Set.singleton (HS.as_addr b)) (Set.singleton (HS.as_addr b));\n MG.loc_includes_refl p;\n MG.loc_disjoint_includes (MG.loc_freed_mreference b) p (MG.loc_mreference b) p;\n MG.modifies_mreference_elim b p h h'", "val modifies_only_live_addresses\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_addresses = MG.modifies_only_live_addresses", "val modifies_only_live_addresses\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_addresses = MG.modifies_only_live_addresses", "val modifies_liveness_insensitive_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n ]]\nlet modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness", "val recall (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\\ h1 `Heap.contains` r)\nlet recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST unit\n (fun _ -> True)\n (fun h0 _ h1 ->\n h0 == h1 /\\\n h1 `Heap.contains` r)\n= HoareST?.reflect (fun _ -> recall r)", "val recall (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST unit (fun _ -> True) (fun h0 _ h1 -> h0 == h1 /\\ h1 `Heap.contains` r)\nlet recall (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST unit\n (fun _ -> True)\n (fun h0 _ h1 ->\n h0 == h1 /\\\n h1 `Heap.contains` r)\n= HoareST?.reflect (fun _ -> recall r)", "val upd_tot: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel{h `contains` r} -> x:a -> Tot heap\nlet upd_tot #a #rel h r x = upd_tot' h r x", "val modifies_addr_of (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem) :GTot Type0\nlet modifies_addr_of = modifies_addr_of'", "val pointer_preserved_intro\n (#t: typ)\n (p: pointer t)\n (h1 h2: HS.mem)\n (f:\n (a': Type0 -> pre: Preorder.preorder a' -> r': HS.mreference a' pre\n -> Lemma\n (requires\n (h1 `HS.contains` r' /\\ frameOf p == HS.frameOf r' /\\ as_addr p == HS.as_addr r'\n )) (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))))\n : Lemma (pointer_preserved p h1 h2)\nlet pointer_preserved_intro\n (#t: typ)\n (p: pointer t)\n (h1 h2 : HS.mem)\n (f: (\n (a' : Type0) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ frameOf p == HS.frameOf r' /\\ as_addr p == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (pointer_preserved p h1 h2)\n= let g () : Lemma\n (requires (live h1 p))\n (ensures (pointer_preserved p h1 h2))\n = f _ _ (greference_of p)\n in\n Classical.move_requires g ()", "val lemma_upd_eq (r:reg) (v:t_reg r) (m:t) : Lemma\n (requires True)\n (ensures sel r (upd r v m) == v)\n [SMTPat (sel r (upd r v m))]\nlet lemma_upd_eq r v m =\n assert_norm (sel r (upd r v m) == v)", "val modifies_strengthen\n (#al: aloc_t) (#c: cls al) (l: loc c) (#r0: HS.rid) (#a0: nat) (al0: al r0 a0) (h h' : HS.mem)\n (alocs: (\n (f: ((t: Type) -> (pre: Preorder.preorder t) -> (m: HS.mreference t pre) -> Lemma\n (requires (HS.frameOf m == r0 /\\ HS.as_addr m == a0 /\\ HS.contains h m))\n (ensures (HS.contains h' m))\n )) ->\n (x: al r0 a0) ->\n Lemma\n (requires (c.aloc_disjoint x al0 /\\ loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (requires (modifies (loc_union l (loc_addresses true r0 (Set.singleton a0))) h h'))\n (ensures (modifies (loc_union l (loc_of_aloc al0)) h h'))\nlet modifies_strengthen #al #c l #r0 #a0 al0 h h' alocs =\n if a0 `GSet.mem` addrs_of_loc_weak l r0\n then begin\n addrs_of_loc_weak_loc_includes l r0 a0;\n loc_includes_refl l;\n loc_includes_union_r l l (loc_addresses true r0 (Set.singleton a0));\n loc_includes_union_l l (loc_of_aloc al0) l;\n loc_includes_trans (loc_union l (loc_of_aloc al0)) l (loc_union l (loc_addresses true r0 (Set.singleton a0)));\n modifies_loc_includes (loc_union l (loc_of_aloc al0)) h h' (loc_union l (loc_addresses true r0 (Set.singleton a0)))\n end\n else\n modifies_strengthen' l al0 h h' alocs", "val unused_in_equiv (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (h:HS.mem)\n :Lemma (unused_in b h <==>\n (HS.live_region h (frameOf b) ==> as_addr b `Heap.addr_unused_in` (Map.sel (HS.get_hmap h) (frameOf b))))\nlet unused_in_equiv #_ #_ #_ b h =\n if g_is_null b then Heap.not_addr_unused_in_nullptr (Map.sel (HS.get_hmap h) HS.root) else ()", "val modifies_salloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies loc_none h h'))\nlet modifies_salloc_post = MG.modifies_salloc_post #_ #cls", "val modifies_1_preserves_mreferences\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_mreferences (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre).\n ((frameOf b <> HS.frameOf r' \\/ as_addr b <> HS.as_addr r') /\\ h1 `HS.contains` r') ==>\n (h2 `HS.contains` r' /\\ HS.sel h1 r' == HS.sel h2 r')", "val modifies_1_modifies\n (#a:Type0)(#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :Lemma (requires (modifies_1 b h1 h2))\n (ensures (modifies (loc_buffer b) h1 h2))\nlet modifies_1_modifies #t #_ #_ b h1 h2 =\n if g_is_null b\n then begin\n modifies_1_null b h1 h2;\n modifies_0_modifies h1 h2\n end else\n MG.modifies_intro (loc_buffer b) h1 h2\n (fun r -> modifies_1_live_region b h1 h2 r)\n (fun t pre p ->\n loc_disjoint_sym (loc_mreference p) (loc_buffer b);\n MG.loc_disjoint_aloc_addresses_elim #_ #cls #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) true (HS.frameOf p) (Set.singleton (HS.as_addr p));\n modifies_1_mreference b h1 h2 p\n )\n (fun t pre p ->\n modifies_1_liveness b h1 h2 p\n )\n (fun r n ->\n modifies_1_unused_in b h1 h2 r n\n )\n (fun r' a' b' ->\n loc_disjoint_sym (MG.loc_of_aloc b') (loc_buffer b);\n MG.loc_disjoint_aloc_elim #_ #cls #(frameOf b) #(as_addr b) #r' #a' (ubuffer_of_buffer b) b';\n if frameOf b = r' && as_addr b = a'\n then\n modifies_1_ubuffer #t b h1 h2 b'\n else\n same_mreference_ubuffer_preserved #r' #a' b' h1 h2\n (fun a_ pre_ r_ -> modifies_1_mreference b h1 h2 r_)\n )", "val g_upd_seq_as_seq (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (s:Seq.lseq a (length b))\n (h:HS.mem{live h b})\n : Lemma (let h' = g_upd_seq b s h in\n (Seq.length s > 0 ==> not (g_is_null b)) /\\\n modifies (loc_buffer b) h h' /\\\n live h' b /\\\n HST.equal_domains h h' /\\\n as_seq h' b == s)\nlet g_upd_seq_as_seq #a #_ #_ b s h =\n let h' = g_upd_seq b s h in\n if g_is_null b then assert (Seq.equal s Seq.empty)\n else begin\n assert (Seq.equal (as_seq h' b) s);\n // prove modifies_1_preserves_ubuffers\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n s_lemma_equal_instances_implies_equal_types ();\n modifies_1_modifies b h h'\n end", "val ( := ) (#a: Type) (#rel: preorder a) (r: mref a rel) (v: a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 ->\n rel (sel h0 r) v /\\ h0 `contains` r /\\ modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\ sel h1 r == v)\nlet op_Colon_Equals (#a:Type) (#rel:preorder a) (r:mref a rel) (v:a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 -> rel (sel h0 r) v /\\ h0 `contains` r /\\\n modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\\n sel h1 r == v)\n= write #a #rel r v", "val domain_upd (#a: Type) (h: HS.mem) (x: HS.reference a {HS.live_region h (HS.frameOf x)}) (v: a)\n : Lemma (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (HS.upd h x v))))\nlet domain_upd (#a:Type) (h:HS.mem) (x:HS.reference a{HS.live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (HS.upd h x v))))\n = let m = (HS.get_hmap h) in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')", "val modifies_address_intro\n (#al: aloc_t) (#c: cls al) (r: HS.rid) (n: nat) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (addr_unused_in: (\n (r': HS.rid) ->\n (n' : nat) ->\n Lemma\n (requires ((r' <> r \\/ n' <> n) /\\ HS.live_region h r' /\\ HS.live_region h' r' /\\ n' `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r')))\n (ensures (n' `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r')))\n ))\n: Lemma\n (modifies (loc_addresses #_ #c false r (Set.singleton n)) h h')\nlet modifies_address_intro #al #c r n h h' regions mrefs unused_ins =\n Classical.forall_intro (Classical.move_requires regions);\n let l : loc c = loc_addresses #_ #c false r (Set.singleton n) in\n modifies_preserves_mreferences_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_livenesses_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_not_unused_in_intro l h h'\n (fun r n -> unused_ins r n)\n ;\n modifies_preserves_alocs_intro l h h' ()\n (fun r a b ->\n c.same_mreference_aloc_preserved b h h' (fun t pre p -> mrefs t pre p)\n )", "val unused_in_ubuffer_preserved\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h h': HS.mem)\n : Lemma (requires (b `unused_in` h))\n (ensures (ubuffer_preserved #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) h h'))\nlet unused_in_ubuffer_preserved (#a:Type0) (#rrel:srel a) (#rel:srel a)\n (b:mbuffer a rrel rel) (h h':HS.mem)\n : Lemma (requires (b `unused_in` h))\n (ensures (ubuffer_preserved #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) h h'))\n = Classical.move_requires (fun b -> live_not_unused_in h b) b;\n live_null a rrel rel h;\n null_unique b;\n unused_in_equiv b h;\n addr_unused_in_ubuffer_preserved #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) h h'", "val upd\n (#a: Type)\n (#rel: preorder a)\n (m: mem)\n (s: mreference a rel {live_region m (frameOf s)})\n (v: a)\n : GTot mem\nlet upd (#a:Type) (#rel:preorder a) (m:mem) (s:mreference a rel{live_region m (frameOf s)}) (v:a)\n :GTot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf s in\n let h = Map.upd h i (Heap.upd (Map.sel h i) (as_ref s) v) in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val pointer_distinct_sel_disjoint\n (#a:Type0) (#rrel1 #rrel2 #rel1 #rel2:srel a)\n (b1:mpointer a rrel1 rel1)\n (b2:mpointer a rrel2 rel2)\n (h:HS.mem)\n :Lemma (requires (live h b1 /\\ live h b2 /\\ get h b1 0 =!= get h b2 0))\n (ensures (disjoint b1 b2))\nlet pointer_distinct_sel_disjoint #a #_ #_ #_ #_ b1 b2 h =\n if frameOf b1 = frameOf b2 && as_addr b1 = as_addr b2\n then begin\n HS.mreference_distinct_sel_disjoint h (Buffer?.content b1) (Buffer?.content b2);\n loc_disjoint_buffer b1 b2\n end\n else\n loc_disjoint_buffer b1 b2", "val modifies_ralloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (i: HS.rid)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel)\n (h' : HS.mem)\n: Lemma\n (requires (HST.ralloc_post i init h x h'))\n (ensures (modifies loc_none h h'))\n [SMTPat (HST.ralloc_post i init h x h')]\nlet modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls", "val upd: #a:Type0 -> #rel:preorder a -> h:heap -> r:mref a rel -> x:a -> GTot heap\nlet upd #a #rel h r x =\n if h `contains_bool` r\n then upd_tot' h r x\n else\n if r.addr >= h.next_addr\n then\n { next_addr = r.addr + 1;\n memory = F.on_dom pos (fun r' -> if r' = r.addr\n\t \t\t then Some (| a, Some rel, r.mm, x |)\n else h.memory r') }\n else\n { h with memory = F.on_dom pos (fun r' -> if r' = r.addr\n\t\t\t\t then Some (| a, Some rel, r.mm, x |)\n else h.memory r') }", "val upd'\n (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (i:U32.t)\n (v:a)\n :HST.Stack unit (requires (fun h -> live h b /\\ U32.v i < length b /\\\n rel (as_seq h b) (Seq.upd (as_seq h b) (U32.v i) v)))\n (ensures (fun h _ h' -> h' == g_upd b (U32.v i) v h))\nlet upd' #_ #_ #_ b i v =\n let open HST in\n let h = get() in\n let Buffer max_length content idx len = b in\n let s0 = !content in\n let sb0 = Seq.slice s0 (U32.v idx) (U32.v max_length) in\n let s_upd = Seq.upd sb0 (U32.v i) v in\n let sf = Seq.replace_subseq s0 (U32.v idx) (U32.v max_length) s_upd in\n assert (sf `Seq.equal`\n Seq.replace_subseq s0 (U32.v idx) (U32.v idx + U32.v len) (Seq.upd (as_seq h b) (U32.v i) v));\n content := sf", "val unpack_ind_lemma (#a: Type0) (r: ref (ref a)) (p: ref a) (v: a) (m: mem)\n : Lemma (requires interp (ind_ptr_sl r) m /\\ ind_ptr_sel_full r m == (p, v))\n (ensures\n interp ((ptr r) `Mem.star` (ptr p)) m /\\ sel_of (vptr r) m == p /\\ sel_of (vptr p) m == v)\nlet unpack_ind_lemma (#a:Type0) (r:ref (ref a)) (p:ref a) (v:a) (m:mem) : Lemma\n (requires interp (ind_ptr_sl r) m /\\ ind_ptr_sel_full r m == (p, v))\n (ensures\n interp (ptr r `Mem.star` ptr p) m /\\\n sel_of (vptr r) m == p /\\\n sel_of (vptr p) m == v)\n = intro_ptr_frame_lemma r p (ptr p) m", "val upd_tot (#a: Type) (#rel: preorder a) (m: mem) (r: mreference a rel {m `contains` r}) (v: a)\n : Tot mem\nlet upd_tot (#a:Type) (#rel:preorder a) (m:mem) (r:mreference a rel{m `contains` r}) (v:a)\n :Tot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf r in\n let i_h = h `Map.sel` i in\n let i_h = Heap.upd_tot i_h (as_ref r) v in\n let h = Map.upd h i i_h in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)\n : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)\nlet rec lemma_frame_refl' (frame:vprop) (h0:rmem frame) (h1:rmem frame)\n : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)\n = match frame with\n | VUnit _ -> ()\n | VStar p1 p2 ->\n can_be_split_star_l p1 p2;\n can_be_split_star_r p1 p2;\n\n let h01 : rmem p1 = focus_rmem h0 p1 in\n let h11 : rmem p1 = focus_rmem h1 p1 in\n let h02 = focus_rmem h0 p2 in\n let h12 = focus_rmem h1 p2 in\n\n\n lemma_frame_refl' p1 h01 h11;\n lemma_frame_refl' p2 h02 h12", "val g_upd\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (i: nat{i < length b})\n (v: a)\n (h: HS.mem{live h b})\n : GTot HS.mem\nlet g_upd (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (i:nat{i < length b})\n (v:a)\n (h:HS.mem{live h b})\n : GTot HS.mem\n = g_upd_seq b (Seq.upd (as_seq h b) i v) h", "val no_upd_fresh_region\n (#aloc: aloc_t) (#c: cls aloc)\n (r:HS.rid)\n (l:loc c)\n (h0:HS.mem)\n (h1:HS.mem)\n: Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\nlet no_upd_fresh_region #al #c r l h0 h1 =\n modifies_only_live_regions (HS.mod_set (Set.singleton r)) l h0 h1", "val unpack_ind_lemma (#a: Type0) (r: ref (t a)) (p: t a) (l: list a) (m: mem)\n : Lemma (requires interp (ind_llist_sl r) m /\\ ind_llist_sel_full r m == (p, l))\n (ensures\n interp ((ptr r) `Mem.star` (llist_sl p)) m /\\ sel_of (vptr r) m == p /\\\n sel_of (llist p) m == l)\nlet unpack_ind_lemma (#a:Type0) (r:ref (t a)) (p:t a) (l:list a) (m:mem) : Lemma\n (requires interp (ind_llist_sl r) m /\\ ind_llist_sel_full r m == (p, l))\n (ensures\n interp (ptr r `Mem.star` llist_sl p) m /\\\n sel_of (vptr r) m == p /\\\n sel_of (llist p) m == l)\n = intro_ptr_frame_lemma r p (llist_sl p) m", "val modifies_only_live_addresses\n (#aloc: aloc_t)\n (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h h': HS.mem)\n : Lemma\n (requires\n (modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x. Set.mem x a ==> h `does_not_contain_addr` (r, x)))) (ensures (modifies l h h'))\nlet modifies_only_live_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\n= loc_addresses_unused_in c r a h;\n loc_includes_refl l;\n loc_includes_union_l (loc_unused_in c h) l l;\n loc_includes_union_l (loc_unused_in c h) l (loc_addresses false r a);\n loc_includes_union_r (loc_union (loc_unused_in c h) l) (loc_addresses false r a) l;\n modifies_loc_includes (loc_union (loc_unused_in c h) l) h h' (loc_union (loc_addresses false r a) l);\n modifies_only_not_unused_in l h h'", "val modifies_loc_addresses_intro_weak\n (#al: aloc_t)\n (#c: cls al)\n (r: HS.rid)\n (s: Set.set nat)\n (l: loc c)\n (h1 h2: HS.mem)\n : Lemma\n (requires\n (HS.live_region h2 r /\\ modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r s h1 h2 /\\ loc_disjoint l (loc_region_only false r)))\n (ensures (modifies (loc_union (loc_addresses true r s) l) h1 h2))\nlet modifies_loc_addresses_intro_weak\n (#al: aloc_t) (#c: cls al)\n (r: HS.rid)\n (s: Set.set nat)\n (l: loc c)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r s h1 h2 /\\\n loc_disjoint l (loc_region_only false r)\n ))\n (ensures (modifies (loc_union (loc_addresses true r s) l) h1 h2))\n= modifies_preserves_mreferences_intro (loc_union (loc_addresses true r s) l) h1 h2 (fun r' a' b' ->\n ()\n );\n modifies_preserves_livenesses_intro (loc_union (loc_addresses true r s) l) h1 h2 (fun r' a' b' ->\n ()\n );\n modifies_preserves_not_unused_in_intro (loc_union (loc_addresses true r s) l) h1 h2 (fun r' n' ->\n ()\n );\n let f (a: nat) (b: al r a) : Lemma\n (requires (not (Set.mem a s)))\n (ensures (c.aloc_preserved b h1 h2))\n = c.same_mreference_aloc_preserved #r #a b h1 h2 (fun a' pre r_ -> ())\n in\n modifies_preserves_alocs_intro (loc_union (loc_addresses true r s) l) h1 h2 () (fun r' a b -> if r = r' then f a b else ()\n )", "val includes_frameOf_as_addr (#a1 #a2:Type0) (#rrel1 #rel1:srel a1) (#rrel2 #rel2:srel a2)\n (larger:mbuffer a1 rrel1 rel1) (smaller:mbuffer a2 rrel2 rel2)\n :Lemma (requires (larger `includes` smaller))\n (ensures (g_is_null larger == g_is_null smaller /\\ frameOf larger == frameOf smaller /\\ as_addr larger == as_addr smaller))\n [SMTPat (larger `includes` smaller)]\nlet includes_frameOf_as_addr #_ #_ #_ #_ #_ #_ larger smaller =\n if Null? larger || Null? smaller then ()\n else\n MG.loc_includes_aloc_elim #_ #cls #(frameOf larger) #(frameOf smaller) #(as_addr larger) #(as_addr smaller) (ubuffer_of_buffer larger) (ubuffer_of_buffer smaller)", "val compare_addrs\n (#a #b: Type0)\n (#rel1: preorder a)\n (#rel2: preorder b)\n (r1: mref a rel1)\n (r2: mref b rel2)\n : GTot bool\nlet compare_addrs (#a #b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2)\n :GTot bool = addr_of r1 = addr_of r2", "val write : #a:Type -> \n r:ref a -> \n\t x:a -> \n\t AllocST unit (fun h0 -> True)\n (fun h0 _ h1 -> contains r h0 /\\ \n\t\t\t h1 == upd h0 r x)\nlet write #a r x = \n let h0 = ist_get () in\n ist_recall (contains r); //recalling that the current heap must contain the given reference\n let h1 = upd h0 r x in\n ist_put h1", "val write (#a: Type) (#rel: preorder a) (r: mref a rel) (v: a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 ->\n rel (sel h0 r) v /\\ h0 `contains` r /\\ modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\ sel h1 r == v)\nlet write (#a:Type) (#rel:preorder a) (r:mref a rel) (v:a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 -> rel (sel h0 r) v /\\ h0 `contains` r /\\\n modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\\n sel h1 r == v)\n = let h0 = gst_get () in\n gst_recall (contains_pred r);\n let h1 = upd_tot h0 r v in\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n Heap.lemma_upd_equals_upd_tot_for_contained_refs h0 r v;\n gst_put h1", "val modifies_strengthen'\n (#al: aloc_t) (#c: cls al) (l: loc c) (#r0: HS.rid) (#a0: nat) (al0: al r0 a0) (h h' : HS.mem)\n (alocs: (\n (f: ((t: Type) -> (pre: Preorder.preorder t) -> (m: HS.mreference t pre) -> Lemma\n (requires (HS.frameOf m == r0 /\\ HS.as_addr m == a0 /\\ HS.contains h m))\n (ensures (HS.contains h' m))\n )) ->\n (x: al r0 a0) ->\n Lemma\n (requires (c.aloc_disjoint x al0 /\\ loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (requires ((~ (a0 `GSet.mem` addrs_of_loc_weak l r0)) /\\ modifies (loc_union l (loc_addresses true r0 (Set.singleton a0))) h h'))\n (ensures (modifies (loc_union l (loc_of_aloc al0)) h h'))\nlet modifies_strengthen' #al #c l #r0 #a0 al0 h h' alocs =\n Classical.forall_intro (addrs_of_loc_loc_union_loc_of_aloc_eq_loc_union_loc_addresses_singleton l al0);\n assert (modifies_preserves_regions (loc_union l (loc_of_aloc al0)) h h');\n assert (modifies_preserves_mreferences (loc_union l (loc_of_aloc al0)) h h');\n assert (modifies_preserves_not_unused_in (loc_union l (loc_of_aloc al0)) h h');\n assert (modifies_preserves_livenesses (loc_union l (loc_of_aloc al0)) h h');\n modifies_preserves_alocs_intro (loc_union l (loc_of_aloc al0)) h h' () (fun r a b ->\n if r = r0 && a = a0\n then begin\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_union l (loc_of_aloc al0)))) (GSet.singleton (ALoc r0 a0 (Some b))));\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux l)) (GSet.singleton (ALoc r0 a0 (Some b))));\n assert (loc_disjoint l (loc_of_aloc b));\n loc_disjoint_sym l (loc_of_aloc b);\n assert (loc_aux_disjoint #_ #c (Ghost.reveal (Loc?.aux (loc_of_aloc al0))) (GSet.singleton (ALoc r0 a0 (Some b))));\n assert (loc_aux_disjoint #_ #c (GSet.singleton (ALoc r0 a0 (Some al0))) (GSet.singleton (ALoc r0 a0 (Some b))));\n assert (GSet.mem (ALoc r0 a0 (Some al0)) (GSet.singleton (ALoc #_ #c r0 a0 (Some al0))));\n assert (GSet.mem (ALoc r0 a0 (Some b)) (GSet.singleton (ALoc #_ #c r0 a0 (Some b))));\n assert (aloc_disjoint #_ #c (ALoc r0 a0 (Some al0)) (ALoc r0 a0 (Some b)));\n assert (c.aloc_disjoint al0 b);\n c.aloc_disjoint_sym al0 b;\n alocs (fun t pre m -> ()) b\n end\n else begin\n assert (loc_disjoint (loc_union l (loc_addresses true r0 (Set.singleton a0))) (loc_of_aloc b))\n by (let open FStar.Stubs.Tactics.V2.Builtins in\n let open FStar.Tactics.SMT in\n set_rlimit 64;\n set_options \"--z3cliopt 'smt.qi.eager_threshold=5'\";\n ())\n end\n );\n assert (modifies (loc_union l (loc_of_aloc al0)) h h')", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\\ x == sel h1 r)\nlet op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST a\n (fun _ -> True)\n (fun h0 x h1 ->\n h0 == h1 /\\\n x == sel h1 r)\n= HoareST?.reflect (fun _ -> read r)", "val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\\ x == sel h1 r)\nlet op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST a\n (fun _ -> True)\n (fun h0 x h1 ->\n h0 == h1 /\\\n x == sel h1 r)\n= HoareST?.reflect (fun _ -> read r)", "val modifies_mreference_elim\n (#t: Type)\n (#pre: Preorder.preorder t)\n (b: HS.mreference t pre)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_mreference b) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_mreference_elim = MG.modifies_mreference_elim", "val modifies_mreference_elim\n (#t: Type)\n (#pre: Preorder.preorder t)\n (b: HS.mreference t pre)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_mreference b) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_mreference_elim = MG.modifies_mreference_elim", "val modifies_salloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies loc_none h h'))\n [SMTPat (HST.salloc_post init h x h')]\nlet modifies_salloc_post = MG.modifies_salloc_post #_ #cls", "val lemma_upd_ne (r r':flag) (v:flag_val_t) (m:t) : Lemma\n (requires r =!= r')\n (ensures sel r (upd r' v m) == sel r m)\n [SMTPat (sel r (upd r' v m))]\nlet lemma_upd_ne r r' v m =\n reveal_opaque (`%sel) sel;\n reveal_opaque (`%upd) upd;\n Map.lemma_SelUpd2 m r r' v", "val lemma_frame_emp (h0:rmem emp) (h1:rmem emp) (p:Type0)\n : Lemma (requires True == p)\n (ensures frame_equalities' emp h0 h1 == p)\nlet lemma_frame_emp h0 h1 p =\n FStar.PropositionalExtensionality.apply True (h0 (VUnit emp') == h1 (VUnit emp'))", "val witness_p (#a:Type0) (#rel:preorder a) (r:mreference a rel) (p:mem_predicate)\n :ST unit (fun h0 -> p h0 /\\ p `stable_on` r)\n (fun h0 _ h1 -> h0 == h1 /\\ token_p r p)\nlet witness_p #_ #_ r p =\n gst_recall (ref_contains_pred r);\n gst_recall (region_contains_pred (HS.frameOf r));\n HS.lemma_next_addr_contained_refs_addr ();\n gst_witness (mem_rel_predicate r p)", "val modifies_aloc_intro\n (#al: aloc_t) (#c: cls al) (#r: HS.rid) (#n: nat) (z: al r n) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (HS.live_region h r /\\ HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (x: al r n) ->\n Lemma\n (requires (c.aloc_disjoint x z))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies (loc_of_aloc #_ #c z) h h')\nlet modifies_aloc_intro #al #c #r #n x h h' regions mrefs livenesses unused_ins alocs =\n modifies_intro_strong #_ #c (loc_of_aloc x) h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> livenesses t pre b)\n (fun r n -> unused_ins r n)\n (fun r' n' z ->\n if r' = r && n' = n\n then begin\n loc_disjoint_aloc_elim #_ #c z x;\n alocs z\n end else\n c.same_mreference_aloc_preserved z h h' (fun t pre p ->\n mrefs t pre p\n )\n )", "val g_upd_seq (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (s:Seq.lseq a (length b))\n\t (h:HS.mem{live h b})\n :GTot HS.mem\nlet g_upd_seq #_ #_ #_ b s h =\n if Seq.length s = 0 then h\n else\n let s0 = HS.sel h (Buffer?.content b) in\n let Buffer _ content idx length = b in\n HS.upd h (Buffer?.content b) (Seq.replace_subseq s0 (U32.v idx) (U32.v idx + U32.v length) s)", "val free (#a: Type0) (#rel: preorder a) (r: mreference a rel {is_mm r}) (m: mem{m `contains` r})\n : Tot mem\nlet free (#a:Type0) (#rel:preorder a) (r:mreference a rel{is_mm r}) (m:mem{m `contains` r})\n :Tot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf r in\n let i_h = h `Map.sel` i in\n let i_h = Heap.free_mm i_h (as_ref r) in\n let h = Map.upd h i i_h in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val modifies_1_preserves_livenesses\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_livenesses (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n : GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre). h1 `HS.contains` r' ==> h2 `HS.contains` r'", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma (requires (modifies l h h' /\\\n address_liveness_insensitive_locs `loc_includes` l /\\\n\t\t h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n = modifies_liveness_insensitive_mreference loc_none l h h' x", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n= modifies_liveness_insensitive_mreference loc_none l h h' x", "val modifies_free\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel { HS.is_mm r } )\n (m: HS.mem { m `HS.contains` r } )\n: Lemma\n (modifies (loc_freed_mreference r) m (HS.free r m))\nlet modifies_free = MG.modifies_free #_ #cls", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val loc_includes_as_seq (#a:Type0) (#rrel #rel1 #rel2:srel a)\n (h1 h2:HS.mem) (larger:mbuffer a rrel rel1) (smaller:mbuffer a rrel rel2)\n :Lemma (requires (loc_includes (loc_buffer larger) (loc_buffer smaller) /\\\n as_seq h1 larger == as_seq h2 larger /\\\n\t\t (live h1 larger \\/ live h1 smaller) /\\ (live h2 larger \\/ live h2 smaller)))\n (ensures (as_seq h1 smaller == as_seq h2 smaller))\nlet loc_includes_as_seq #_ #rrel #_ #_ h1 h2 larger smaller =\n if Null? smaller then () else\n if Null? larger then begin\n MG.loc_includes_none_elim (loc_buffer smaller);\n MG.loc_of_aloc_not_none #_ #cls #(frameOf smaller) #(as_addr smaller) (ubuffer_of_buffer smaller)\n end else begin\n MG.loc_includes_aloc_elim #_ #cls #(frameOf larger) #(frameOf smaller) #(as_addr larger) #(as_addr smaller) (ubuffer_of_buffer larger) (ubuffer_of_buffer smaller);\n let ul = Ghost.reveal (ubuffer_of_buffer larger) in\n let us = Ghost.reveal (ubuffer_of_buffer smaller) in\n assert (as_seq h1 smaller == Seq.slice (as_seq h1 larger) (us.b_offset - ul.b_offset) (us.b_offset - ul.b_offset + length smaller));\n assert (as_seq h2 smaller == Seq.slice (as_seq h2 larger) (us.b_offset - ul.b_offset) (us.b_offset - ul.b_offset + length smaller))\n end", "val disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))\nlet disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))\n= let r = greference_of p1 in\n assert (HS.contains h r)", "val addr_of_gref_of\n (a: aref)\n (t: Type0)\n (rel: preorder t)\n: Lemma\n (requires (exists h . aref_live_at h a t rel))\n (ensures ((exists h . aref_live_at h a t rel) /\\ addr_of (gref_of a t rel) == addr_of_aref a))\n [SMTPat (addr_of (gref_of a t rel))]\nlet addr_of_gref_of a t rel = addr_of_aref_of (gref_of a t rel)" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.lemma_heap_equality_upd_same_addr" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.lemma_heap_equality_commute_distinct_upds" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.lemma_heap_equality_cancel_same_mref_upd" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.lemma_heap_equality_upd_with_sel" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.live_same_addresses_equal_types_and_preorders" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.lemma_upd" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.live_same_addresses_equal_types_and_preorders'" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.lemma_g_upd_with_same_seq" }, { "project_name": "FStar", "file_name": "MRefHeap.fst", "name": "MRefHeap.upd" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.does_not_contain_addr_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.does_not_contain_addr_elim" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.upd_ref_of" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.reference_distinct_sel_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.unused_in_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.unused_in_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowStar.BufferView.Down.fst", "name": "LowStar.BufferView.Down.lemma_g_upd_with_same_seq" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.liveness_preservation_intro" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.lemma_alloc" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_mreferences_intro" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_upd" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.op_Colon_Equals" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.op_Colon_Equals" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_addr_of_modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_addr_of_preserves_not_unused_in" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.recall_p" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.free_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.free_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "NatHeap.fst", "name": "NatHeap.upd_sel" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.recall" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.same_mreference_ubuffer_preserved" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_mreference" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_liveness_strong" }, { "project_name": "FStar", "file_name": "MRefHeap.fst", "name": "MRefHeap.alloc_ref" }, { "project_name": "FStar", "file_name": "NatHeap.fst", "name": "NatHeap.upd" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_upd" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.fst", "name": "FStar.DM4F.Heap.upd_sel" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_loc_addresses_intro" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Regs.fst", "name": "Vale.X64.Regs.lemma_upd_ne" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_ralloc_post" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_reference_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.recall" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.recall" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.upd_tot" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_addr_of" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.pointer_preserved_intro" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Regs.fst", "name": "Vale.X64.Regs.lemma_upd_eq" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_strengthen" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.unused_in_equiv" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_salloc_post" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_mreferences" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.g_upd_seq_as_seq" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.op_Colon_Equals" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.domain_upd" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_address_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.unused_in_ubuffer_preserved" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.upd" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.pointer_distinct_sel_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_ralloc_post" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.upd" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.upd'" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.unpack_ind_lemma" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.upd_tot" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.lemma_frame_refl'" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.g_upd" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.no_upd_fresh_region" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.unpack_ind_lemma" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_loc_addresses_intro_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.includes_frameOf_as_addr" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.compare_addrs" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.write" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.write" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_strengthen'" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.op_Bang" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.op_Bang" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_mreference_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_mreference_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_salloc_post" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Flags.fst", "name": "Vale.X64.Flags.lemma_upd_ne" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.lemma_frame_emp" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.witness_p" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_aloc_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.g_upd_seq" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.free" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_livenesses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_free" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_as_seq" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.disjoint_roots_intro_pointer_vs_reference" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.addr_of_gref_of" } ], "selected_premises": [ "FStar.Monotonic.HyperStack.get_tip", "FStar.Monotonic.HyperStack.get_rid_ctr", "FStar.Monotonic.HyperStack.get_hmap", "FStar.Monotonic.HyperStack.map_invariant", "FStar.Monotonic.HyperStack.as_ref", "FStar.Monotonic.HyperStack.rid_ctr_pred", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Monotonic.HyperStack.downward_closed", "FStar.Monotonic.Heap.mref", "FStar.Monotonic.HyperStack.mk_mem", "FStar.Preorder.preorder_rel", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.Heap.only", "FStar.Pervasives.dfst", "FStar.Monotonic.Heap.fresh", "FStar.Monotonic.Heap.equal_dom", "FStar.Monotonic.Heap.only_t", "FStar.Monotonic.Heap.compare_addrs", "FStar.Preorder.stable", "FStar.Pervasives.dsnd", "FStar.Monotonic.HyperStack.tip_top", "FStar.Monotonic.Heap.modifies_t", "FStar.Pervasives.st_post_h", "FStar.Pervasives.id", "FStar.Monotonic.Heap.modifies", "FStar.Preorder.reflexive", "FStar.Monotonic.HyperStack.lemma_is_wf_ctr_and_tip_intro", "FStar.Preorder.transitive", "FStar.Pervasives.st_pre_h", "FStar.Monotonic.Heap.op_Hat_Plus_Hat", "FStar.Monotonic.Heap.op_Hat_Plus_Plus", "FStar.Monotonic.Heap.op_Plus_Plus_Hat", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.all_pre_h", "FStar.Map.const_on", "FStar.Map.has_dom", "FStar.Pervasives.st_stronger", "Prims.returnM", "Prims.pure_pre", "FStar.Pervasives.st_return", "FStar.Map.disjoint_dom", "FStar.Pervasives.all_post_h", "FStar.Set.subset", "Prims.min", "FStar.Pervasives.ex_pre", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.all_return", "FStar.Monotonic.Heap.set", "Prims.__cache_version_number__", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.st_trivial", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.st_wp_h", "Prims.pure_post'", "Prims.abs", "FStar.Pervasives.all_stronger", "Prims.pow2", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.st_close_wp", "Prims.auto_squash", "FStar.Set.as_set'", "FStar.Pervasives.st_ite_wp", "FStar.Monotonic.Heap.tset", "FStar.Pervasives.all_trivial", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.ex_post'", "Prims.subtype_of", "FStar.Set.as_set", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_if_then_else", "FStar.TSet.subset", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.ex_post", "Prims.op_Hat", "Prims.pure_post", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.all_wp_h", "Prims.pure_wp_monotonic", "Prims.as_requires", "FStar.Pervasives.pure_return", "FStar.TSet.as_set'", "FStar.Set.add", "Prims.purewp_id", "Prims.pure_trivial", "FStar.Pervasives.pure_ite_wp", "Prims.pure_wp", "Prims.pure_stronger", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.div_hoare_to_wp", "Prims.pure_wp_monotonic0", "Prims.l_True", "FStar.Set.disjoint", "Prims.as_ensures", "FStar.Pervasives.ex_wp", "FStar.Pervasives.ex_close_wp", "Prims.l_False" ], "source_upto_this": "(*\n Copyright 2008-2014 Aseem Rastogi, and Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Monotonic.HyperStack\n\nopen FStar.Preorder\nmodule Map = FStar.Map\n\nlet map_invariant = map_invariant_predicate\n\nlet downward_closed = downward_closed_predicate\n\nlet tip_top = tip_top_predicate\n\nlet rid_ctr_pred = rid_ctr_pred_predicate\n\nnoeq type mem' =\n | HS :rid_ctr:int -> h:hmap -> tip:rid -> mem'\n\nlet mk_mem rid_ctr h tip = HS rid_ctr h tip\n\nlet get_hmap m = m.h\nlet get_rid_ctr m = m.rid_ctr\nlet get_tip m = m.tip\n\nlet lemma_mk_mem'_projectors _ _ _ = ()\n\nlet lemma_mem_projectors_are_in_wf_relation _ = ()\n\nlet lemma_is_wf_ctr_and_tip_intro _ _ _ = root_is_not_freeable ()\n\nlet lemma_is_wf_ctr_and_tip_elim _ = ()\n\nlet lemma_map_invariant _ _ _ = ()\n\nlet lemma_downward_closed _ _ _ = ()\n\nlet lemma_tip_top _ _ = ()\n\nlet lemma_tip_top_smt _ _ = ()\n\nlet lemma_rid_ctr_pred _ = ()\n\nlet as_ref #_ #_ x = MkRef?.ref x\n\nlet lemma_as_ref_inj #_ #_ _ = ()\n\nprivate val lemma_extends_fresh_disjoint: i:rid -> j:rid -> ipar:rid -> jpar:rid\n -> (m0:mem) -> (m1:mem) ->\n Lemma (requires (let h0, h1 = get_hmap m0, get_hmap m1 in\n (map_invariant h0 /\\\n\t\t map_invariant h1 /\\\n fresh_region i m0 m1 /\\\n fresh_region j m0 m1 /\\\n h0 `Map.contains` ipar /\\\n h0 `Map.contains` jpar /\\\n extends i ipar /\\\n extends j jpar /\\\n i<>j)))\n (ensures (disjoint i j))\nlet lemma_extends_fresh_disjoint i j ipar jpar m0 m1 = ()\n\nlet lemma_sel_same_addr #_ #_ _ _ _ = ()\n" }, { "file_name": "FStar.Monotonic.HyperStack.fst", "name": "FStar.Monotonic.HyperStack.rid_ctr_pred", "opens_and_abbrevs": [ { "abbrev": "Map", "full_module": "FStar.Map" }, { "open": "FStar.Preorder" }, { "open": "FStar.Monotonic.HyperHeap" }, { "abbrev": "Map", "full_module": "FStar.Map" }, { "open": "FStar.Preorder" }, { "open": "FStar.Monotonic" }, { "open": "FStar.Monotonic" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val rid_ctr_pred (h:hmap) (n:int) :Type0", "source_definition": "let rid_ctr_pred = rid_ctr_pred_predicate", "source_range": { "start_line": 27, "start_col": 0, "end_line": 27, "end_col": 41 }, "interleaved": false, "definition": "FStar.Monotonic.HyperStack.rid_ctr_pred_predicate", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Monotonic.HyperStack.rid_ctr_pred_predicate" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "h: FStar.Monotonic.HyperHeap.hmap -> n: Prims.int -> Type0", "prompt": "let rid_ctr_pred =\n ", "expected_response": "rid_ctr_pred_predicate", "source": { "project_name": "FStar", "file_name": "ulib/FStar.Monotonic.HyperStack.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Monotonic.HyperStack.fst", "checked_file": "dataset/FStar.Monotonic.HyperStack.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Heap.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "let map_invariant = map_invariant_predicate", "let downward_closed = downward_closed_predicate", "let tip_top = tip_top_predicate", "let is_in (r:rid) (h:hmap) = h `Map.contains` r" ], "closest": [ "val rid_ctr_pred_predicate (h: hmap) (n: int) : Type0\nlet rid_ctr_pred_predicate (h:hmap) (n:int) :Type0 =\n forall (r:rid). h `Map.contains` r ==> rid_last_component r < n", "val rid_ctr_pred (m1 m2: mem) : Type0\nlet rid_ctr_pred (m1 m2:mem) :Type0 = get_rid_ctr m1 <= get_rid_ctr m2", "val tip_top_predicate (tip: rid) (h: hmap) : Type0\nlet tip_top_predicate (tip:rid) (h:hmap) :Type0 =\n forall (r:sid). r `is_in` h <==> r `is_above` tip", "val concrete_ctr (r: erid) (i: id) : Tot Type0\nlet concrete_ctr (r:erid) (i:id) : Tot Type0 =\n m_rref r counter increases", "val rid_last_component_pred (m1 m2: mem) : Type0\nlet rid_last_component_pred (m1 m2:mem) :Type0\n = forall (r:HS.rid).{:pattern (m1 `contains_region` r)}\n ((~ (m1 `contains_region` r)) /\\ rid_last_component r < get_rid_ctr m1) ==>\n\t\t (~ (m2 `contains_region` r))", "val concrete_ctr (r: rgn) (i: id) : Tot Type0\nlet concrete_ctr (r:rgn) (i:id) : Tot Type0 =\n m_rref r (counter (alg i)) increases", "val ctr_ref (#l r: erid) (i: id) (log: log_ref l i) : Tot Type0\nlet ctr_ref (#l:erid) (r:erid) (i:id) (log:log_ref l i) : Tot Type0 =\n if authId i\n then ideal_ctr r i (log <: ideal_log l i)\n else m_rref r counter increases", "val array_pred (#t: Type) (n: nat) (s: list t) : GTot Type0\nlet array_pred (#t: Type) (n: nat) (s: list t) : GTot Type0 =\n L.length s == n", "val heap_ctr_valid (ctr: nat) (h: H.heap u#a) : prop\nlet heap_ctr_valid (ctr:nat) (h:H.heap u#a) : prop =\n h `H.free_above_addr` ctr", "val heap_ctr_valid (ctr: nat) (h: H.heap u#a) : prop\nlet heap_ctr_valid (ctr:nat) (h:H.heap u#a) : prop =\n h `H.free_above_addr` ctr", "val ideal_ctr (#l r: erid) (i: id) (log: ideal_log l i) : Tot Type0\nlet ideal_ctr (#l:erid) (r: erid) (i:id) (log:ideal_log l i) : Tot Type0 =\n FStar.Monotonic.Seq.seqn r log max_ctr", "val counter_pred (#rand: randomness) (n: nat) (es_ref: mref (entries rand) (entries_rel rand))\n : (p: heap_predicate{stable p})\nlet counter_pred (#rand:randomness) (n:nat) (es_ref:mref (entries rand) (entries_rel rand)) :(p:heap_predicate{stable p})\n = fun h -> h `contains` es_ref /\\ n <= length (sel h es_ref)", "val ctr_ref (#l r: rgn) (i: id) (log: log_ref l i) : Tot Type0\nlet ctr_ref (#l:rgn) (r:rgn) (i:id) (log:log_ref l i) : Tot Type0 =\n if authId i\n then ideal_ctr r i (ilog log)\n else m_rref r (counter (alg i)) increases", "val aloc (r: HS.rid) (n: nat) : Tot Type0\nlet aloc (r: HS.rid) (n: nat) : Tot Type0 =\n (l: loc_aux { loc_aux_in_addr l r n } )", "val downward_closed_predicate (h: hmap) : Type0\nlet downward_closed_predicate (h:hmap) :Type0 =\n forall (r:rid). r `is_in` h //for any region in the memory\n ==> (r=root //either is the root\n \\/ (forall (s:rid). (r `is_above` s //or, any region beneath it\n /\\ s `is_in` h) //that is also in the memory\n ==> ((is_stack_region r = is_stack_region s) /\\ //must be of the same flavor as itself\n ((is_heap_color (color r) /\\ rid_freeable r) ==> s == r))))", "val region_contains_pred (r:HS.rid) :mem_predicate\nlet region_contains_pred r =\n fun m -> (not (HS.is_eternal_region_hs r)) \\/ m `contains_region` r", "val identity_map (n: nat) (r: regmap int) : regmap int\nlet rec identity_map (n:nat) (r:regmap int) : regmap int =\n if n = 0 then r\n else identity_map (n - 1) (upd r n n)", "val map_invariant_predicate (m: hmap) : Type0\nlet map_invariant_predicate (m:hmap) :Type0 =\n forall r. Map.contains m r ==>\n (forall s. includes s r ==> Map.contains m s)", "val ideal_ctr (#l r: rgn) (i: id) (log: ideal_log l i) : Tot Type0\nlet ideal_ctr (#l:rgn) (r:rgn) (i:id) (log:ideal_log l i) : Tot Type0 =\n FStar.Monotonic.Seq.seqn r log (max_ctr (alg i))", "val mods (rs: some_refs) (h0 h1: mem) : GTot Type0\nlet mods (rs:some_refs) (h0 h1:mem) :GTot Type0 =\n (norm norm_steps (modifies (regions_of_some_refs rs) h0 h1)) /\\\n (norm norm_steps (modifies_some_refs rs rs h0 h1))", "val hs (i:hsId) : Type0\nlet hs (i:hsId) = H.tag (hsId_hash i)", "val writerT (#rid: rgn) (#n: random) (e: epochs rid n) (h: mem)\n : GTot (epoch_ctr_inv rid (get_epochs e))\nlet writerT (#rid:rgn) (#n:random) (e:epochs rid n) (h:mem) : GTot (epoch_ctr_inv rid (get_epochs e)) =\n let MkEpochs es r w _ = e in sel h r", "val incr_epoch_ctr :\n #a:Type0 ->\n #p:(seq a -> Type0) ->\n #r:rgn ->\n #is:MS.i_seq r a p ->\n ctr:epoch_ctr r is ->\n ST unit\n (requires fun h -> 1 + sel h ctr < Seq.length (i_sel h is))\n (ensures (fun h0 _ h1 ->\n let ctr_as_hsref = ctr in\n modifies_one r h0 h1 /\\\n HS.modifies_ref r (Set.singleton (Heap.addr_of (as_ref ctr_as_hsref))) ( h0) ( h1) /\\\n sel h1 ctr = sel h0 ctr + 1))\nlet incr_epoch_ctr #a #p #r #is ctr =\n HST.recall ctr;\n let cur = HST.op_Bang ctr in\n MS.int_at_most_is_stable is (cur + 1);\n HST.mr_witness is (int_at_most (cur + 1) is);\n HST.op_Colon_Equals ctr (cur + 1)", "val size (x: int) (n: pos) : Tot Type0\nlet size (x:int) (n:pos) : Tot Type0 = b2t(fits x n)", "val modifies_r (#n: nat) (c: connection{receiver c}) (arr: array byte n) (h0 h1: heap) : Type0\nlet modifies_r (#n:nat) (c:connection{receiver c}) (arr:array byte n) (h0 h1:heap) :Type0\n = modifies (Set.union (connection_footprint c)\n (array_footprint arr)) h0 h1", "val read (#a: Type0) (n: nat)\n : LV a\n (fun m0 -> m0.m `M.contains` n /\\ dfst (m0.m `M.sel` n) == a)\n (fun m0 r m1 ->\n m0.m `M.contains` n /\\ dfst (m0.m `M.sel` n) == a /\\ r == dsnd (m0.m `M.sel` n) /\\\n m0 == m1)\nlet read (#a:Type0) (n:nat)\n : LV a (fun m0 -> m0.m `M.contains` n /\\\n dfst (m0.m `M.sel` n) == a)\n (fun m0 r m1 ->\n m0.m `M.contains` n /\\\n dfst (m0.m `M.sel` n) == a /\\\n r == dsnd (m0.m `M.sel` n) /\\ m0 == m1)\n= LVARS?.reflect (fun m -> dsnd (m.m `M.sel` n), m)", "val loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0\nlet loc_aux_in_addr\n (l: loc_aux)\n (r: HS.rid)\n (n: nat)\n: GTot Type0\n= match l with\n | LocBuffer b ->\n frameOf_buffer b == r /\\\n buffer_as_addr b == n\n | LocPointer p ->\n frameOf p == r /\\\n as_addr p == n", "val loc_aux_in_addr (l: loc_aux) (r: HS.rid) (n: nat) : GTot Type0\nlet loc_aux_in_addr\n (l: loc_aux)\n (r: HS.rid)\n (n: nat)\n: GTot Type0\n= match l with\n | LocBuffer b ->\n B.frameOf b == r /\\\n B.as_addr b == n", "val test_abs0' (n: int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True)\nlet test_abs0' (n:int) : RWI nat RO (fun _ -> True) (fun h0 _ h1 -> True) =\n let r = labs0 n in\n let r : nat = r in // need this! an ascription won't work!\n r", "val stable (p:mem_predicate) :Type0\nlet stable p = forall (h1:mem) (h2:mem).{:pattern (mem_rel h1 h2)} (p h1 /\\ mem_rel h1 h2) ==> p h2", "val size (x: int) (n: nat) : Tot Type0\nlet size (x:int) (n:nat) : Tot Type0 = b2t(fits x n)", "val contains (#a:Type) (#r:preorder_t a) (h:heap) (m:mref a r) : Type0\nlet contains (#a:Type) (#r:preorder_t a) (h:heap) (m:mref a r) : GTot Type0 =\n exists (v:heap_cell).\n snd h m == Some v /\\\n dfst v == a /\\\n snd #(dfst v) #(preorder_t a) (dsnd v) == r", "val rid_length (r:rid) :GTot nat\nlet rid_length r = List.Tot.length (reveal r)", "val loop_inv\n (h0: mem)\n (n: size_t)\n (a_spec: (i: size_nat{i <= v n} -> Type))\n (refl: (mem -> i: size_nat{i <= v n} -> GTot (a_spec i)))\n (footprint: (i: size_nat{i <= v n} -> GTot B.loc))\n (spec: (mem -> GTot (i: size_nat{i < v n} -> a_spec i -> a_spec (i + 1))))\n (i: size_nat{i <= v n})\n (h: mem)\n : Type0\nlet loop_inv\n (h0:mem)\n (n:size_t)\n (a_spec:(i:size_nat{i <= v n} -> Type))\n (refl:(mem -> i:size_nat{i <= v n} -> GTot (a_spec i)))\n (footprint:(i:size_nat{i <= v n} -> GTot B.loc))\n (spec:(mem -> GTot (i:size_nat{i < v n} -> a_spec i -> a_spec (i + 1))))\n (i:size_nat{i <= v n})\n (h:mem):\n Type0\n=\n modifies (footprint i) h0 h /\\\n refl h i == Loop.repeat_gen i a_spec (spec h0) (refl h0 0)", "val contains_array (#a:Type) (#n:nat) (h:heap) (arr:t a n) : Type0\nlet contains_array (#a:Type) (#n:nat) (h:heap) (arr:t a n)\n = let A #_ #_ #_ s_ref _ = arr in\n h `Heap.contains` s_ref", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val mm_refs_pred (m1 m2: mem) : Type0\nlet mm_refs_pred (m1 m2:mem) :Type0\n = forall (a:Type) (rel:preorder a) (r:HS.mreference a rel).{:pattern (m1 `HS.contains` r)}\n (not (is_mm r)) \\/\n (m1 `HS.contains` r ==>\n (m2 `HS.contains` r /\\ rel (HS.sel m1 r) (HS.sel m2 r) \\/\n r `HS.unused_in` m2))", "val ctr: #a:alg -> h:HS.mem -> state a -> GTot Spec.ctr\nlet ctr #a (h: HS.mem) (s: state a) =\n UInt32.v (State?.ctr (B.deref h s))", "val init_r1 (h:vale_stack) : (n:nat64{n >= 65536})\nlet init_r1 h = h.initial_r1", "val contained_region: mem -> mem -> rid -> Type0\nlet contained_region :mem -> mem -> rid -> Type0\n = fun m0 m1 r -> m0 `contains_region` r /\\ m1 `contains_region` r", "val unchanged_node_val (h0 h1: HS.mem) (n: node 'a) : GTot prop\nlet unchanged_node_val (h0 h1:HS.mem) (n:node 'a) : GTot prop =\n (B.live h0 n ==>\n (g_node_val h0 n == g_node_val h1 n /\\ B.live h1 n))", "val ctr_validity (ctr: nat) (h: H.heap) : slprop\nlet ctr_validity (ctr:nat) (h:H.heap) : slprop =\n H.pure (heap_ctr_valid ctr h)", "val ctr_validity (ctr: nat) (h: H.heap) : slprop\nlet ctr_validity (ctr:nat) (h:H.heap) : slprop =\n H.pure (heap_ctr_valid ctr h)", "val test0: r:rid -> a:m_rref r (seq nat) grows -> k:nat -> ST unit\n (requires (fun h -> k < Seq.length (HS.sel h a)))\n (ensures (fun h0 result h1 -> True))\nlet test0 r a k =\n let h0 = HST.get() in\n let _ = \n let s = HS.sel h0 a in \n at_least_is_stable k (Seq.index (HS.sel h0 a) k) a;\n Seq.contains_intro s k (Seq.index s k) in\n mr_witness a (at_least k (Seq.index (HS.sel h0 a) k) a)", "val alloc_log_and_ctrs: #a:Type0 -> #p:(seq a -> Type0) -> r:rgn ->\n ST (is:MS.i_seq r a p & c1:epoch_ctr r is & c2:epoch_ctr r is)\n (requires (fun h -> p Seq.empty))\n (ensures (fun h0 x h1 ->\n modifies_one r h0 h1 /\\\n HS.modifies_ref r Set.empty ( h0) ( h1) /\\\n (let (| is, c1, c2 |) = x in\n i_contains is h1 /\\\n h1 `contains` c1 /\\\n h1 `contains` c2 /\\\n i_sel h1 is == Seq.empty)))\nlet alloc_log_and_ctrs #a #p r =\n let init = Seq.empty in\n let is = alloc_mref_iseq p r init in\n HST.mr_witness is (int_at_most (-1) is);\n let c1 : epoch_ctr #a #p r is = HST.ralloc r (-1) in\n let c2 : epoch_ctr #a #p r is = HST.ralloc r (-1) in\n (| is, c1, c2 |)", "val fresh (#a: Type0) (r: ref a) (h0 h1: heap) : Type0\nlet fresh (#a:Type0) (r:ref a) (h0:heap) (h1:heap) : Type0\n = Heap.fresh r h0 h1", "val modifies_0 (h1 h2: HS.mem) : GTot Type0\nlet modifies_0 = modifies_0'", "val max_ctr:n: nat{n = 18446744073709551615}\nlet max_ctr: n:nat{n = 18446744073709551615} =\n assert_norm (pow2 64 - 1 = 18446744073709551615);\n pow2 64 - 1", "val modifies_0 (h0 h1: HS.mem) : GTot Type0\nlet modifies_0 (h0 h1: HS.mem) : GTot Type0 =\n modifies loc_none h0 h1", "val log_ref (r: erid) (i: id) : Tot Type0\nlet log_ref (r:erid) (i:id) : Tot Type0 =\n if authId i then ideal_log r i else unit", "val loop_refl_inv\n (h0: mem)\n (n: size_t)\n (a_spec: Type)\n (refl: (mem -> GTot a_spec))\n (footprint: B.loc)\n (spec: (mem -> GTot (i: size_nat{i < v n} -> a_spec -> a_spec)))\n (i: size_nat{i <= v n})\n (h: mem)\n : Type0\nlet loop_refl_inv\n (h0:mem)\n (n:size_t)\n (a_spec: Type)\n (refl:(mem -> GTot a_spec))\n (footprint:B.loc)\n (spec:(mem -> GTot (i:size_nat{i < v n} -> a_spec -> a_spec)))\n (i:size_nat{i <= v n})\n (h:mem):\n Type0\n=\n modifies footprint h0 h /\\\n refl h == Loop.repeati i (spec h0) (refl h0)", "val modifies_0 (h0 h1: mem) : Type0\nlet modifies_0 (h0 h1:mem) :Type0 =\n modifies_one (HS.get_tip h0) h0 h1\n /\\ modifies_buf_0 (HS.get_tip h0) h0 h1\n /\\ HS.get_tip h0 == HS.get_tip h1", "val snapshot_pred (x: t) (m: repr) (m': PM.map tid aval) : prop\nlet snapshot_pred (x:t)\r\n (m:repr)\r\n (m':PM.map tid aval)\r\n : prop\r\n = related_domains m m' /\\\r\n (forall tid. has_key m' tid ==>\r\n get m' tid == Some?.v (Map.sel m tid) /\\\r\n no_ownership m' tid)", "val i_contains (#r: rid) (#a: Type) (#p: (seq a -> Type)) (m: i_seq r a p) (h: mem) : GTot Type0\nlet i_contains (#r:rid) (#a:Type) (#p:seq a -> Type) (m:i_seq r a p) (h:mem)\n : GTot Type0\n = HS.contains h m", "val alloc_ref : h0:heap ->\n a:Type -> \n\t\tx:a -> \n\t\tTot (rh1:(ref a * heap)\n\t\t\t {~(contains h0 (fst rh1)) /\\ \n\t\t\t contains (snd rh1) (fst rh1) /\\\n\t\t sel (snd rh1) (fst rh1) == x /\\\n\t\t\t (forall b (r:ref b) .{:pattern (contains h0 r)}\n\t\t\t contains h0 r \n\t\t\t ==> \n\t\t\t contains (snd rh1) r) /\\\n\t\t\t (forall b (r:ref b{contains h0 r}) . {:pattern sel #b h0 r}\n\t\t\t sel #b h0 r == sel #b (snd rh1) r)})\nlet alloc_ref h0 a x = \n (fst h0 , (fst h0 + 1 , F.on_dom nat (fun r -> if r = fst h0 then Some (| a , x |)\n\t\t\t\t\t else snd h0 r)))", "val aloc (r: HS.rid) (n: nat) : Tot (Type u#1)\nlet aloc (r: HS.rid) (n: nat) : Tot (Type u#1) =\n (l: loc_aux { loc_aux_in_addr l r n } )", "val modifies1 (l: loc) (h0 h1: state) : Type0\nlet modifies1 (l:loc) (h0 h1 : state) : Type0 =\n forall y. y <> l ==> Map.sel h0 y == Map.sel h1 y", "val modifies_0' (h1 h2: HS.mem) : GTot Type0\nlet modifies_0' (h1 h2: HS.mem) : GTot Type0 =\n modifies_0_preserves_mreferences h1 h2 /\\\n modifies_0_preserves_regions h1 h2 /\\\n modifies_0_preserves_not_unused_in h1 h2", "val defined (#r #a #b #inv: _) (m: t r a b inv) (x: a) (h: HS.mem) : GTot Type0\nlet defined #r #a #b #inv (m:t r a b inv) (x:a) (h:HS.mem)\n : GTot Type0\n = Some? (sel (HS.sel h m) x)", "val readerT (#rid: rgn) (#n: random) (e: epochs rid n) (h: mem)\n : GTot (epoch_ctr_inv rid (get_epochs e))\nlet readerT (#rid:rgn) (#n:random) (e:epochs rid n) (h:mem) : GTot (epoch_ctr_inv rid (get_epochs e)) =\n let MkEpochs es r w _ = e in\n sel h r", "val get_ctr (#r: rgn) (#n: random) (es: epochs r n) (rw: rw)\n : ST int (requires (fun h -> True)) (ensures (get_ctr_post es rw))\nlet get_ctr (#r:rgn) (#n:random) (es:epochs r n) (rw:rw)\n : ST int (requires (fun h -> True)) (ensures (get_ctr_post es rw))\n=\n let epochs = es.es in\n let n = HST.op_Bang (ctr es rw) in\n testify (MS.int_at_most n epochs);\n n", "val consistent (h0:heap) (h1:heap) : GTot Type0\nlet consistent (h0:heap) (h1:heap) : GTot Type0 =\n forall n x y . (snd h0 n == Some x /\\ snd h1 n == Some y) ==> dfst x == dfst y", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val lock_inv_pred (r: ref bool) (p: vprop) (v: bool) : vprop\nlet lock_inv_pred (r:ref bool) (p:vprop) (v:bool) : vprop =\n pts_to r full_perm v `star` maybe_p p v", "val contains (#a:Type) (h:heap) (r:ref a): Tot Type0\nlet contains (#a:Type) (h:heap) (r:ref a): Tot Type0 = Some? (h.memory r.addr)", "val MerkleTree.Spec.rpmt = n: Prims.nat -> i: Prims.nat{i <= Prims.pow2 n} -> Type0\nlet rpmt (#hsz:pos) (#f:hash_fun_t) (n:nat) (i:nat{i <= pow2 n}) =\n mt:merkle_tree #hsz n {\n raw_hashes #_ #f (S.slice mt 0 i) /\\\n pad_hashes #_ #f (S.slice mt i (S.length mt)) }", "val pred : nat -> Tot nat\nlet pred n =\n match n with\n | O -> O\n | S n' -> n'", "val init_rsp (h:vale_stack) : (n:nat64{n >= 4096})\nlet init_rsp h = h.BS.initial_rsp", "val contains (#a: Type0) (h: heap) (r: ref a) : GTot Type0\nlet contains (#a:Type0) (h:heap) (r:ref a) :GTot Type0\n = Heap.contains h r", "val inv_0 (h: heap) (fp: fp) : Type0\nlet inv_0 (h:heap) (fp:fp) :Type0 =\n h `contains_well_typed_refs` fp /\\ length fp = 1", "val contained_non_tip_region: mem -> mem -> rid -> Type0\nlet contained_non_tip_region :mem -> mem -> rid -> Type0\n = fun m0 m1 r -> r =!= get_tip m0 /\\ r =!= get_tip m1 /\\ contained_region m0 m1 r", "val inv (#roots:_) (#view:_) (l:hs_lens roots view) (h:HS.mem) : Type0\nlet inv #roots #view (l:hs_lens roots view) (h:HS.mem) =\n l.invariant l.x h /\\\n mods l h", "val hiddenTree_mem : #h:nat -> int -> hiddenTree h -> bool\nlet hiddenTree_mem #h x = function\n | HB root\n | HR root -> mem x root", "val Vale.Interop.X64.prediction_pre = \n n: Prims.nat ->\n arg_reg: Vale.Interop.X64.arg_reg_relation n ->\n c: Vale.X64.Machine_Semantics_s.code ->\n args: Vale.Interop.X64.arg_list ->\n pre_rel: Vale.Interop.X64.prediction_pre_rel_t c args ->\n h0: Vale.Interop.Base.mem_roots args ->\n s0: Vale.X64.Machine_Semantics_s.machine_state\n -> Prims.logical\nlet prediction_pre\n (n:nat)\n (arg_reg:arg_reg_relation n)\n (c:BS.code)\n (args:arg_list)\n (pre_rel: prediction_pre_rel_t c args)\n (h0:mem_roots args)\n (s0:BS.machine_state)\n =\n pre_rel h0 /\\\n s0 == fst (create_initial_trusted_state n arg_reg args h0)", "val labs0 (n: int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\\ h1 == h0)\nlet labs0 (n:int) : RWI int RO (fun _ -> True) (fun h0 x h1 -> x >= 0 /\\ h1 == h0) =\n if n < 0\n then -n\n else n", "val elim_predict_t_cons\n (#n: nat)\n (#arg_reg: arg_reg_relation n)\n (#regs_modified: (MS.reg_64 -> bool))\n (#xmms_modified: (MS.reg_xmm -> bool))\n (#c: BS.code)\n (hd: td)\n (tl: list td)\n (#args: arg_list{List.length args + List.length tl <= 19})\n (#pre_rel #post_rel: _)\n (p: prediction_t n arg_reg regs_modified xmms_modified c (hd :: tl) args pre_rel post_rel)\n (x: td_as_type hd)\n : prediction_t n\n arg_reg\n regs_modified\n xmms_modified\n c\n tl\n (x ++ args)\n (elim_rel_gen_t_cons hd tl pre_rel x)\n (elim_rel_gen_t_cons hd tl post_rel x)\nlet elim_predict_t_cons\n (#n:nat)\n (#arg_reg:arg_reg_relation n)\n (#regs_modified:MS.reg_64 -> bool)\n (#xmms_modified:MS.reg_xmm -> bool)\n (#c:BS.code)\n (hd:td)\n (tl:list td)\n (#args:arg_list{List.length args + List.length tl <= 19})\n (#pre_rel:_)\n (#post_rel:_)\n (p:prediction_t n arg_reg regs_modified xmms_modified c (hd::tl) args pre_rel post_rel)\n : x:td_as_type hd ->\n prediction_t n arg_reg regs_modified xmms_modified c tl (x ++ args)\n (elim_rel_gen_t_cons hd tl pre_rel x)\n (elim_rel_gen_t_cons hd tl post_rel x)\n = p", "val extend (r:rid) (n:int) (c:int)\n: Pure rid (requires True) (extend_post r n c (rid_freeable r))\nlet extend r n c =\n elift1 (fun r ->\n let freeable = rid_freeable (hide r) in\n (c, n, freeable)::r\n ) r", "val read (#a:Type0) (r:ref a) :STATE a (fun p h -> p (sel h r) h)\nlet read #_ r = read r", "val lockinv_predicate: p: vprop -> r: ref U32.t -> U32.t -> vprop\nlet lockinv_predicate (p:vprop) (r:ref U32.t)\n : U32.t -> vprop\n = fun b ->\n pts_to r full_perm b\n `star`\n pure (b == locked \\/ b == unlocked)\n `star`\n (if is_locked b then emp else p)", "val xor_reverse_inc32lite_6 (n i0: int) (ctr_BE rndkey: quad32) : GTot quad32_6\nlet xor_reverse_inc32lite_6 (n i0:int) (ctr_BE rndkey:quad32) : GTot quad32_6 =\n make_six_of (fun i ->\n let r = reverse_bytes_quad32 (inc32lite ctr_BE (i0 + i)) in\n if i < n then quad32_xor r rndkey else r)", "val PulseCore.NondeterministicMonotonicStateMonad.ctr = Type0\nlet ctr = nat", "val count (n: nat) : ID int (as_pure_wp (fun p -> forall r. p r))\nlet rec count (n:nat) : ID int (as_pure_wp (fun p -> forall r. p r)) =\n if n = 0 then 0 else count (n-1)", "val lock_inv_pred: r: ref bool -> v: vprop -> bool -> vprop\nlet lock_inv_pred (r:ref bool) (v:vprop) : bool -> vprop =\n fun b -> pts_to r full_perm b `star` (if b then v else emp)", "val alloc_rid:\n #a:Type -> len:uint32_t{len > 0ul} -> v:a ->\n rid:HS.rid{HST.is_eternal_region rid} ->\n HST.ST (vector a)\n (requires (fun h0 -> true))\n (ensures (fun h0 vec h1 ->\n frameOf vec = rid /\\\n live h1 vec /\\ freeable vec /\\\n modifies loc_none h0 h1 /\\\n Set.equal (Map.domain (HS.get_hmap h0))\n (Map.domain (HS.get_hmap h1)) /\\\n size_of vec = len /\\\n S.equal (as_seq h1 vec) (S.create (U32.v len) v) /\\\n B.fresh_loc (loc_vector vec) h0 h1))\nlet alloc_rid #a len v rid =\n Vec len len (B.malloc rid v len)", "val alloc_rid:\n #a:Type0 -> #rst:Type -> rg:regional rst a ->\n len:uint32_t{len > 0ul} -> rid:HST.erid ->\n HST.ST (rvector rg)\n (requires (fun h0 -> true))\n (ensures (fun h0 rv h1 ->\n modifies (V.loc_vector rv) h0 h1 /\\\n rv_inv h1 rv /\\\n V.frameOf rv = rid /\\\n V.size_of rv = len /\\\n V.forall_all h1 rv (fun r -> Rgl?.r_alloc_p rg r) /\\\n S.equal (as_seq h1 rv)\n (S.create (U32.v len) (Ghost.reveal (Rgl?.irepr rg)))))\nlet alloc_rid #a #rst rg len rid =\n let vec = V.alloc_rid len (rg_dummy rg) rid in\n alloc_ #a #rst #rg vec len;\n V.loc_vector_within_included vec 0ul len;\n vec", "val folded_pts_to (r: ref U32.t) (n: erased U32.t) : vprop\nlet folded_pts_to (r:ref U32.t) (n:erased U32.t) : vprop = pts_to r n", "val incr: c:ctr -> w:state -> All unit \n(requires fun h0 -> \n let Counter _ c0 = sel h0 c in\n pre1 c0)\n(ensures fun h0 r h1 -> \n let v0 = sel h0 c in \n let Counter n0 c0 = v0 in \n pre1 c0 /\\ (\n let c1 = step1 c0 in \n let v1 = Counter (n0+1) c1 in \n match r with \n | V _ -> sel h1 c == v1\n | _ -> sel h1 c == v0 \\/ sel h1 c == v1 ))\nlet incr c w = \n let x = read c in\n let Counter n0 c0 = x in \n if n0 = 3 then failwith \"crash\" else\n write c (Counter (n0+1) (step1 c0))", "val range (n: int) (t: inttype) : Type0\nlet range (n:int) (t:inttype) : Type0 =\n minint t <= n /\\ n <= maxint t", "val rpmt_right: #hsz:pos -> #f:hash_fun_t #hsz -> #n:pos -> #i:nat{i <= pow2 n} -> rpmt #hsz #f n i ->\n rpmt #_ #f (n-1) (if i <= pow2 (n-1) then 0 else i - pow2 (n-1))\nlet rpmt_right #hsz #f #n #i mt =\n if i <= pow2 (n-1)\n then pad_hashes_slice #_ #f (S.slice mt i (S.length mt)) (pow2 (n-1) - i) (pow2 n - i)\n else raw_hashes_slice #_ #f (S.slice mt 0 i) (pow2 (n-1)) i;\n mt_right mt", "val create (a:Type0) (n:nat)\n :ST (array a n) (requires (fun _ -> True))\n (ensures (fun h0 arr h1 -> fresh_arr arr h0 h1 /\\ //it's fresh\n\t\t modifies Set.empty h0 h1 /\\ //no existing refs are changed\n\t\t\t\t\t is_full_array arr))\nlet create (a:Type0) (n:nat)\n :ST (array a n) (requires (fun _ -> True))\n (ensures (fun h0 arr h1 -> fresh_arr arr h0 h1 /\\ //it's fresh\n\t\t modifies Set.empty h0 h1 /\\ //no existing refs are changed\n\t\t\t\t\t is_full_array arr)) //and has the full view of the underlying sequence\n = let arr = A #a #n #n (alloc ((Seq.create n None), Mutable)) 0 in\n gst_witness (mutable_pred arr);\n arr", "val incr' (r: ref int)\n : ST unit (fun h0 -> h0 `contains_a_well_typed` r) (fun h0 _ h1 -> h1 `contains_a_well_typed` r)\nlet incr' (r:ref int) :ST unit (fun h0 -> h0 `contains_a_well_typed` r)\n (fun h0 _ h1 -> h1 `contains_a_well_typed` r)\n = write_weak r (read_weak r + 1)", "val reveal (r:rid) :GTot (list (int * int))\nlet reveal r = FStar.List.Tot.map (fun (i, j, _) -> i, j) (reveal r)", "val v_c (n: Ghost.erased nat) (#a: Type0) (r: t a) (c: normal (t_of (vptr r))) : GTot prop\nlet v_c\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (c: normal (t_of (vptr r)))\n: GTot prop\n= (Ghost.reveal c.tail_fuel < Ghost.reveal n) == true", "val v_c (n: Ghost.erased nat) (#a: Type0) (r: t a) (c: normal (t_of (vptr r))) : GTot prop\nlet v_c\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (c: normal (t_of (vptr r)))\n: GTot prop\n= (Ghost.reveal c.tail_fuel < Ghost.reveal n) == true", "val assign (r: var) (n: exp int) : Tot computation\nlet assign (r: var) (n: exp int) : Tot computation =\n let g _ : ISNull bool =\n let n = n () in\n write r n;\n true\n in\n g", "val inv (p: vprop) : Type0\nlet inv (p:vprop) : Type0 = Mem.inv (hp_of p)", "val wrap'\n (n:nat)\n (arg_reg:arg_reg_relation n)\n (regs_modified:MS.reg_64 -> bool)\n (xmms_modified:MS.reg_xmm -> bool)\n (c:BS.code)\n (dom:list td{List.length dom <= 20})\n (#pre_rel:rel_gen_t c dom [] (prediction_pre_rel_t c))\n (#post_rel:rel_gen_t c dom [] (prediction_post_rel_t c))\n (predict:prediction_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel)\n : as_lowstar_sig_t n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict\nlet wrap' n arg_reg regs_modified xmms_modified c dom #pre_rel #post_rel predict =\n wrap_aux n arg_reg regs_modified xmms_modified c dom [] pre_rel post_rel predict" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.rid_ctr_pred_predicate" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.rid_ctr_pred" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.tip_top_predicate" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.StreamAE.fst", "name": "MiTLS.StreamAE.concrete_ctr" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.rid_last_component_pred" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD_GCM.fst", "name": "MiTLS.AEAD_GCM.concrete_ctr" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.StreamAE.fst", "name": "MiTLS.StreamAE.ctr_ref" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Array.fst", "name": "LowParse.Spec.Array.array_pred" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.heap_ctr_valid" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.heap_ctr_valid" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.StreamAE.fst", "name": "MiTLS.StreamAE.ideal_ctr" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.counter_pred" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD_GCM.fst", "name": "MiTLS.AEAD_GCM.ctr_ref" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.aloc" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.downward_closed_predicate" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.region_contains_pred" }, { "project_name": "FStar", "file_name": "Registers.List.fst", "name": "Registers.List.identity_map" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.map_invariant_predicate" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD_GCM.fst", "name": "MiTLS.AEAD_GCM.ideal_ctr" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.mods" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.KeySchedule.fst", "name": "MiTLS.Old.KeySchedule.hs" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fsti", "name": "MiTLS.Old.Epochs.writerT" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fst", "name": "MiTLS.Old.Epochs.incr_epoch_ctr" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.size" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.modifies_r" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.read" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_in_addr" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_in_addr" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.test_abs0'" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.stable" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.size" }, { "project_name": "FStar", "file_name": "MRefHeap.fst", "name": "MRefHeap.contains" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fst", "name": "FStar.Monotonic.HyperHeap.rid_length" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.loop_inv" }, { "project_name": "FStar", "file_name": "MonotonicArray.fst", "name": "MonotonicArray.contains_array" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.count" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.count" }, { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.count" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.mm_refs_pred" }, { "project_name": "everquic-crypto", "file_name": "NotEverCrypt.CTR.fst", "name": "NotEverCrypt.CTR.ctr" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Stack_i.fst", "name": "Vale.PPC64LE.Stack_i.init_r1" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.contained_region" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fst", "name": "DoublyLinkedListIface.unchanged_node_val" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.ctr_validity" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.ctr_validity" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Seq.fst", "name": "FStar.Monotonic.Seq.test0" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fst", "name": "MiTLS.Old.Epochs.alloc_log_and_ctrs" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.fresh" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_0" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.StreamAE.fst", "name": "MiTLS.StreamAE.max_ctr" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.modifies_0" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.StreamAE.fst", "name": "MiTLS.StreamAE.log_ref" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.loop_refl_inv" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_0" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadLogMap.fst", "name": "Zeta.Steel.ThreadLogMap.snapshot_pred" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Seq.fst", "name": "FStar.Monotonic.Seq.i_contains" }, { "project_name": "FStar", "file_name": "NatHeap.fst", "name": "NatHeap.alloc_ref" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.aloc" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.modifies1" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_0'" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Map.fst", "name": "FStar.Monotonic.Map.defined" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fsti", "name": "MiTLS.Old.Epochs.readerT" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fsti", "name": "MiTLS.Old.Epochs.get_ctr" }, { "project_name": "FStar", "file_name": "NatHeap.fst", "name": "NatHeap.consistent" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.read" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.fst", "name": "Steel.Primitive.ForkJoin.lock_inv_pred" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.fst", "name": "FStar.DM4F.Heap.contains" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.rpmt" }, { "project_name": "FStar", "file_name": "SfBasic.fst", "name": "SfBasic.pred" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Stack_i.fst", "name": "Vale.X64.Stack_i.init_rsp" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.contains" }, { "project_name": "FStar", "file_name": "ProgramEquivalence.fst", "name": "ProgramEquivalence.inv_0" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.contained_non_tip_region" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fst", "name": "LowStar.Lens.inv" }, { "project_name": "FStar", "file_name": "RBTreeIntrinsic.fst", "name": "RBTreeIntrinsic.hiddenTree_mem" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.X64.fsti", "name": "Vale.Interop.X64.prediction_pre" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.labs0" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.X64.fsti", "name": "Vale.Interop.X64.elim_predict_t_cons" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fst", "name": "FStar.Monotonic.HyperHeap.extend" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.read" }, { "project_name": "steel", "file_name": "Steel.ST.SpinLock.fst", "name": "Steel.ST.SpinLock.lockinv_predicate" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fsti", "name": "Vale.AES.X64.AESopt.xor_reverse_inc32lite_6" }, { "project_name": "steel", "file_name": "PulseCore.NondeterministicMonotonicStateMonad.fst", "name": "PulseCore.NondeterministicMonotonicStateMonad.ctr" }, { "project_name": "FStar", "file_name": "ID2.fst", "name": "ID2.count" }, { "project_name": "steel", "file_name": "Steel.ST.CancellableSpinLock.fst", "name": "Steel.ST.CancellableSpinLock.lock_inv_pred" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.alloc_rid" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.alloc_rid" }, { "project_name": "steel", "file_name": "CustomSyntax.fst", "name": "CustomSyntax.folded_pts_to" }, { "project_name": "FStar", "file_name": "Ariadne.fst", "name": "Ariadne.incr" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.fsti", "name": "Lib.IntTypes.range" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.rpmt_right" }, { "project_name": "FStar", "file_name": "MonotonicArray.fst", "name": "MonotonicArray.create" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.ST.fsti", "name": "FStar.DM4F.Heap.ST.incr'" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fst", "name": "FStar.Monotonic.HyperHeap.reveal" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.v_c" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.v_c" }, { "project_name": "FStar", "file_name": "Benton2004.fst", "name": "Benton2004.assign" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.inv" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.X64.fst", "name": "Vale.Interop.X64.wrap'" } ], "selected_premises": [ "FStar.Monotonic.HyperStack.map_invariant", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Monotonic.HyperStack.downward_closed", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.HyperStack.tip_top", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Monotonic.Heap.mref", "Prims.abs", "FStar.Monotonic.Heap.fresh", "Prims.min", "FStar.Monotonic.Heap.only", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.all_post_h", "FStar.Pervasives.st_post_h", "FStar.Monotonic.Heap.modifies_t", "FStar.Monotonic.Heap.equal_dom", "FStar.Pervasives.all_wp_h", "FStar.Monotonic.Heap.modifies", "FStar.Preorder.preorder_rel", "FStar.Pervasives.st_stronger", "FStar.Map.disjoint_dom", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.ex_pre", "Prims.pure_wp'", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.st_close_wp", "FStar.Map.const_on", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.all_bind_wp", "FStar.Monotonic.Heap.only_t", "FStar.Pervasives.all_stronger", "FStar.Pervasives.all_return", "FStar.Pervasives.all_trivial", "Prims.pure_post'", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.id", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.pure_close_wp", "FStar.Monotonic.Heap.compare_addrs", "Prims.__cache_version_number__", "Prims.pure_wp_monotonic", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.ex_post'", "Prims.auto_squash", "FStar.Pervasives.div_hoare_to_wp", "Prims.pure_wp_monotonic0", "FStar.Monotonic.Heap.set", "Prims.returnM", "FStar.Map.has_dom", "FStar.Pervasives.pure_null_wp", "Prims.pure_trivial", "Prims.l_True", "FStar.Set.as_set'", "FStar.Pervasives.ex_close_wp", "Prims.pure_wp", "FStar.Set.subset", "Prims.purewp_id", "FStar.Pervasives.st_trivial", "Prims.as_requires", "FStar.Pervasives.st_return", "Prims.pure_pre", "FStar.Pervasives.ex_wp", "FStar.Pervasives.st_bind_wp", "Prims.l_False", "FStar.Pervasives.pure_ite_wp", "FStar.Set.as_set", "FStar.Monotonic.Heap.op_Hat_Plus_Plus", "FStar.Monotonic.Heap.op_Plus_Plus_Hat", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.pure_bind_wp", "Prims.pure_post", "FStar.Pervasives.ex_if_then_else", "Prims.pure_stronger", "Prims.as_ensures", "FStar.Pervasives.ex_post", "Prims.subtype_of", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.pure_return", "FStar.Pervasives.lift_div_exn", "Prims.pow2", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.ex_return", "FStar.Pervasives.ex_bind_wp", "FStar.Monotonic.Heap.op_Hat_Plus_Hat", "FStar.Pervasives.ex_trivial", "FStar.Set.add", "FStar.Pervasives.ex_ite_wp", "FStar.Monotonic.Heap.tset", "FStar.Preorder.reflexive", "FStar.TSet.subset", "FStar.Set.remove", "FStar.Preorder.stable", "FStar.TSet.as_set'", "Prims.op_Hat", "FStar.Preorder.transitive" ], "source_upto_this": "(*\n Copyright 2008-2014 Aseem Rastogi, and Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Monotonic.HyperStack\n\nopen FStar.Preorder\nmodule Map = FStar.Map\n\nlet map_invariant = map_invariant_predicate\n\nlet downward_closed = downward_closed_predicate\n\nlet tip_top = tip_top_predicate\n", "sketch": [ "The definition `rid_ctr_pred` is about defining a predicate that checks whether a given heap map `h` contains a counter `n`.\n\nStep 1: We define a predicate `rid_ctr_pred` that takes a heap map `h` and an integer `n` as input.\n\nStep 2: The implementation checks if the heap map `h` contains a counter `n` and returns a type representing the result.", "The definition `rid_ctr_pred` is about a predicate that specifies the relationship between a hyperstack `h` and an integer `n`.\n\nStep 1: The `rid_ctr_pred` predicate specifies a relationship between a hyperstack `h` and an integer `n`. It likely enforces some constraints or properties on the hyperstack with respect to the integer.\n\nStep 2: The `rid_ctr_pred` is likely implemented by defining a predicate that checks certain conditions or constraints on the hyperstack `h` and the integer `n`.", "The definition `rid_ctr_pred` is about defining a predicate that represents the property of a hyperstack map `hmap` having a certain number `n` of elements with unique identifiers.\n\nStep 1: We want to define a predicate that checks whether a hyperstack map `hmap` contains `n` elements with unique identifiers.\n\nStep 2: We will implement the `rid_ctr_pred` by iterating through the hyperstack map `h` and checking if the number of elements with unique identifiers is equal to `n`.", "The definition `rid_ctr_pred` is about a predicate that relates a hyperstack `h` and an integer `n`.\n\nStep 1: This predicate checks if the counter at position `n` in the hyperstack `h` is a read-only counter.\n\nStep 2: The implementation will involve checking if the counter at position `n` in the hyperstack `h` is read-only.", "The definition `rid_ctr_pred` is about a predicate that specifies the relationship between a hyperstack `h` and an integer `n`.\n\nStep 1: The `rid_ctr_pred` predicate specifies a relationship between a hyperstack `h` and an integer `n`. It likely enforces some constraints or properties on the hyperstack with respect to the integer `n`.\n\nStep 2: The `rid_ctr_pred` predicate is implemented by defining the constraints or properties that the hyperstack `h` must satisfy with respect to the integer `n`. This could involve checking the structure of the hyperstack and its elements to ensure that it meets the specified conditions.", "The definition `rid_ctr_pred` is about defining a predicate that represents the relationship between a hyperstack `h` and an integer `n`.\n\nStep 1: We want to define a predicate that captures the relationship between a hyperstack `h` and an integer `n`.\n\nStep 2: The predicate `rid_ctr_pred` will check if the hyperstack `h` contains a certain number of elements equal to `n`.", "The definition `rid_ctr_pred` is about defining a predicate that checks whether a given heap map `h` contains a certain number `n` as a key.\n\nStep 1: We want to define a predicate that checks if a given heap map contains a specific number as a key.\nStep 2: We will implement the `rid_ctr_pred` by checking if the key `n` exists in the heap map `h`.", "The definition `rid_ctr_pred` is about defining a predicate that represents the relationship between a hyperstack `h` and an integer `n`.\n\nStep 1: We want to define a predicate that captures the relationship between a hyperstack `h` and an integer `n`.\n\nStep 2: The predicate `rid_ctr_pred` will check if the given hyperstack `h` has a certain relationship with the integer `n`. This relationship could be based on the structure or content of the hyperstack.", "The definition `rid_ctr_pred` is about a predicate that checks whether a given heap map `h` contains a certain number `n` of elements.\n\nStep 1: We will define a predicate `rid_ctr_pred` that takes a heap map `h` and an integer `n` as input and checks whether the heap map `h` contains exactly `n` elements.\n\nStep 2: We will implement the `rid_ctr_pred` predicate by comparing the size of the heap map `h` with the integer `n` and returning a boolean indicating whether they are equal.", "The definition `rid_ctr_pred` is about defining a predicate that checks if a given heap map `h` contains a counter `n`.\n\nStep 1: We define a predicate `rid_ctr_pred` that takes a heap map `h` and an integer `n` as input.\n\nStep 2: The predicate implementation checks if the counter `n` is present in the heap map `h`." ], "generated_solution": [ "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n // Implementation goes here", "val rid_ctr_pred (h:hmap) (n:int) : Type0\n (predicate (hmap, int) (fun (h:hmap) (n:int) -> bool)\n (fun h n -> {predicate body}))", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n forall (p: hmap -> Prop).\n (map_invariant p h) ->\n (downward_closed p) ->\n (tip_top p) ->\n (forall (m: hmap) (k: hkey) (v: hvalue),\n p m -> (not (map_in_domain m k)) -> p (map_update m k v)) ->\n (forall (m: hmap) (k: hkey) (v: hvalue),\n p m -> p (map_update m k v)) ->\n (forall (m: hmap) (k: hkey),\n p m -> (map_in_domain m k) -> p (map_remove m k)) ->\n (forall (m: hmap) (k1: hkey) (k2: hkey),\n p m -> (map_in_domain m k1) -> (map_in_domain m k2) -> (k1 <> k2) -> p m) ->\n (forall (m: hmap) (k: hkey) (v: hvalue),\n p m -> p (map_update m k v) -> (map_in_domain m k)) ->\n (forall (m: hmap) (k: hkey) (v: hvalue),\n p m -> p (map_update m k v) -> p (map_update m k v)) ->\n (forall (m: hmap) (k: hkey),\n p m -> p (map_remove m k) -> not (map_in_domain m k)) ->\n (forall (m: hmap) (k1: hkey) (k2: hkey),\n p m -> p (map_remove m k1) -> p (map_remove m k2)) ->\n (forall (m: hmap) (k: hkey),\n p m -> (map_in_domain m k) -> p (map_remove m k)) ->\n (forall (m: hmap),\n p m -> (cardinality m) = n) ->\n p h", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n h.n = ReadOnly", "val rid_ctr_pred (h:hmap) (n:int) : Type0\n (requires (fun r -> map_invariant r h))\n (ensures (fun r result -> result <==> (downward_closed r h && tip_top r h n)))", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n forall (p:ptr). (h p = Some n) ==> (is_ptr p)", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n exists (fun k -> k = n) (map_domain h)", "val rid_ctr_pred (h:hmap) (n:int) : Type0\n (requires (map_invariant h) && (downward_closed h) && (tip_top h))\n (ensures (fun r -> r <==> (* predicate definition based on h and n *)))", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n (hmap_size h) = n", "val rid_ctr_pred (h:hmap) (n:int) : Type0 =\n exists (fun c -> h[c] = Some n)" ] }, { "file_name": "Lib.IntVector.fsti", "name": "Lib.IntVector.width", "opens_and_abbrevs": [ { "open": "Lib.IntTypes" }, { "open": "Lib.Sequence" }, { "open": "FStar.Mul" }, { "open": "Lib" }, { "open": "Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 0, "initial_ifuel": 1, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "", "source_definition": "let width = n:size_nat{n == 1 \\/ n == 2 \\/ n == 4 \\/ n == 8 \\/ n == 16 \\/ n == 32}", "source_range": { "start_line": 11, "start_col": 0, "end_line": 11, "end_col": 82 }, "interleaved": false, "definition": "n: Lib.IntTypes.size_nat{n == 1 \\/ n == 2 \\/ n == 4 \\/ n == 8 \\/ n == 16 \\/ n == 32}", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Lib.IntTypes.size_nat", "Prims.l_or", "Prims.eq2", "Prims.int" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "Type0", "prompt": "let width =\n ", "expected_response": "n: size_nat{n == 1 \\/ n == 2 \\/ n == 4 \\/ n == 8 \\/ n == 16 \\/ n == 32}", "source": { "project_name": "hacl-star", "file_name": "lib/Lib.IntVector.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Lib.IntVector.fsti", "checked_file": "dataset/Lib.IntVector.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Spec.AES.fst.checked", "dataset/prims.fst.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.ByteSequence.fsti.checked", "dataset/Lib.Buffer.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked" ] }, "definitions_in_context": [ "let v_inttype = t:inttype{unsigned t /\\ ~(U1? t)}" ], "closest": [ "val Lib.NTuple.flen = Type0\nlet flen = size_pos", "val Param.int_int_t = Type0\nlet int_int_t = int -> int", "val Interop.arity = Type0\nlet arity = n:nat { n <= max_arity }", "val Lib.ByteSequence.bytes = Type0\nlet bytes = bytes_l SEC", "val FStar.Integers.fixed_width = Type0\nlet fixed_width = w:width{w <> Winfinite}", "val Lib.IntTypes.Compatibility.inttype = Type0\nlet inttype = t:inttype{unsigned t}", "val Lib.ByteSequence.bytes_t = Type0\nlet bytes_t = bytes", "val IntervalIntersect.intervals = Type0\nlet intervals = is:list interval{good is}", "val Ast.range = Type0\nlet range = pos * pos", "val ci: Type0\nlet ci: Type0 = unit", "val ci: Type0\nlet ci: Type0 = unit", "val TypeSizes.alignment = Type0\nlet alignment = option (x:int{x == 1 \\/ x == 2 \\/ x == 4 \\/ x == 8})", "val Spec.Matrix.elem = Type0\nlet elem = uint16", "val TypeSizes.typename = Type0\nlet typename = ident'", "val decl:Type0\nlet decl : Type0 = either not_type_decl type_decl", "val Param.fvmap = Type0\nlet fvmap = list (fv * fv)", "val t : Type0\nlet t = t", "val t : Type0\nlet t = G.ref _ pcm", "val t : Type0\nlet t = bool & bool", "val env : Type0\nlet env = H.t A.ident' type_decl", "val Lib.NatMod.prime = Type0\nlet prime = m:pos{1 < m /\\ Euclid.is_prime m}", "val cr: Type0\nlet cr: Type0 = unit", "val cr: Type0\nlet cr: Type0 = unit", "val Lib.UpdateMulti.uint8 = Type0\nlet uint8 = Lib.IntTypes.uint8", "val Hacl.Test.ECDSA.siggen_vector = Type0\nlet siggen_vector = vec8 & vec8 & vec8 & vec8 & vec8 & vec8 & vec8", "val z: Type0\nlet z = unit", "val z: Type0\nlet z = unit", "val ins : Type0\nlet ins = BS.ins", "val ins : Type0\nlet ins = S.ins", "val Hacl.Test.ECDSA.vec8 = Type0\nlet vec8 = L.lbuffer UInt8.t", "val cx: Type0\nlet cx: Type0 = unit", "val cx: Type0\nlet cx: Type0 = unit", "val co: Type0\nlet co: Type0 = unit", "val co: Type0\nlet co: Type0 = unit", "val Param.test_int_to_int = Type0\nlet test_int_to_int = int -> int", "val c0: Type0\nlet c0: Type0 = unit", "val c0: Type0\nlet c0: Type0 = unit", "val Lib.ByteSequence.pub_bytes = Type0\nlet pub_bytes = bytes_l PUB", "val Interop.ireg = Type0\nlet ireg = n:pos{ n <= 4 }", "val Lib.ByteSequence.pub_bytes_t = Type0\nlet pub_bytes_t = pub_bytes", "val loc : Type0\nlet loc = MG.loc cls", "val Vale.X64.Memory.nat64 = Type0\nlet nat64 = Vale.Def.Words_s.nat64", "val Lib.IntTypes.pub_int_t = _: Lib.IntTypes.inttype -> Type0\nlet pub_int_t = function\n | U1 -> n:UInt8.t{UInt8.v n < 2}\n | U8 -> UInt8.t\n | U16 -> UInt16.t\n | U32 -> UInt32.t\n | U64 -> UInt64.t\n | U128 -> UInt128.t\n | S8 -> Int8.t\n | S16 -> Int16.t\n | S32 -> Int32.t\n | S64 -> Int64.t\n | S128 -> Int128.t", "val STLC.Core.var = Type0\nlet var = nat", "val Hacl.Impl.P256.Bignum.widefelem = Type0\nlet widefelem = lbuffer uint64 (size 8)", "val BoolRefinement.var = Type0\nlet var = nat", "val Hacl.Impl.Matrix.elem = Type0\nlet elem = uint16", "val Vale.Poly1305.Equiv.nat128 = Type0\nlet nat128 = Vale.Def.Words_s.nat128", "val cl: Type0\nlet cl: Type0 = unit", "val cl: Type0\nlet cl: Type0 = unit", "val Hacl.Test.ECDSA.sigver_vector = Type0\nlet sigver_vector = vec8 & vec8 & vec8 & vec8 & vec8 & bool", "val Vale.X64.Memory.nat32 = Type0\nlet nat32 = Vale.Def.Words_s.nat32", "val Mem.rgn = Type0\nlet rgn = r:erid{r =!= root}", "val cf: Type0\nlet cf: Type0 = unit", "val cf: Type0\nlet cf: Type0 = unit", "val Vale.Interop.Base.arg = Type0\nlet arg = t:td & td_as_type t", "val DependentBoolRefinement.var = Type0\nlet var = nat", "val memory_invariant:Type0\nlet memory_invariant : Type0 = nat", "val Setoids.t_two = Type0\nlet t_two = lo int ^--> st_rel state_rel (lo bool)", "val cw: Type0\nlet cw: Type0 = unit", "val cw: Type0\nlet cw: Type0 = unit", "val ch: Type0\nlet ch: Type0 = unit", "val ch: Type0\nlet ch: Type0 = unit", "val Ast.field_bitwidth_t = Type0\nlet field_bitwidth_t = either (with_meta_t int) bitfield_attr", "val Steel.ST.C.Types.Array.array_size_t = Type0\nlet array_size_t = (n: SZ.t { SZ.v n > 0 })", "val Vale.X64.Lemmas.code = Type0\nlet code = BS.code", "val cz: Type0\nlet cz: Type0 = unit", "val cz: Type0\nlet cz: Type0 = unit", "val c1: Type0\nlet c1: Type0 = unit", "val c1: Type0\nlet c1: Type0 = unit", "val FStar.Integers.pos = Type0\nlet pos = i:nat{ 0 < i }", "val Pulse.C.Types.Array.array_size_t = Type0\nlet array_size_t = (n: SZ.t { SZ.v n > 0 })", "val Hacl.Impl.BignumQ.Mul.qelem_wide = Type0\nlet qelem_wide = lbuffer uint64 10ul", "val Vale.X64.Memory.nat16 = Type0\nlet nat16 = Vale.Def.Words_s.nat16", "val word:Type0\nlet word = Lib.IntTypes.uint32", "val word:Type0\nlet word = Lib.IntTypes.uint32", "val HACL.hashable_len = Type0\nlet hashable_len = v:US.t{ is_hashable_len v }", "val WithLocal.eloc = Type0\nlet eloc = Ghost.erased B.loc", "val Vale.X64.Memory.nat8 = Type0\nlet nat8 = Vale.Def.Words_s.nat8", "val Vale.Def.Types_s.nat64 = Type0\nlet nat64 = Vale.Def.Words_s.nat64", "val DependentBoolRefinement.index = Type0\nlet index = nat", "val PulsePointStruct._x = Type0\nlet _x = norm Pulse.C.Typestring.norm_typestring (Pulse.C.Typestring.mk_string_t \"x\")", "val Vale.Def.Types_s.nat8 = Type0\nlet nat8 = Vale.Def.Words_s.nat8", "val vector (a: Type0): Tot Type0\nlet vector a = vector_str a", "val cs: Type0\nlet cs: Type0 = unit", "val cs: Type0\nlet cs: Type0 = unit", "val Options.vstring = Type0\nlet vstring = valid_string always_valid", "val Alg.baseop = Type0\nlet baseop = o:op{not (Other? o)}", "val Lib.IntTypes.max_size_t = Prims.int\nlet max_size_t = maxint U32", "val BoolRefinement.index = Type0\nlet index = nat", "val common_long_t:Type0\nlet common_long_t\n: Type0\n= (U32.t & (LP.parse_bounded_vlbytes_t 0 20 & LP.parse_bounded_vlbytes_t 0 20))", "val StackMachine.stack = Type0\nlet stack = list nat", "val Vale.Interop.X64.arg_list = Type0\nlet arg_list = l:list arg{List.Tot.length l <= 20}", "val LList32.llist = Type0\nlet llist = llist u32", "val Setoids.t_one = Type0\nlet t_one = lo int ^--> st_rel state_rel (lo int)", "val Lib.UpdateMulti.Lemmas.uint8 = Type0\nlet uint8 = Lib.IntTypes.uint8", "val Ast.subst = Type0\nlet subst = H.t ident' expr", "val cy: Type0\nlet cy: Type0 = unit", "val cy: Type0\nlet cy: Type0 = unit", "val BitFields.bitfield_group = Type0\nlet bitfield_group = int & typ & list atomic_field" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.flen" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.int_int_t" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.arity" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.bytes" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.fixed_width" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.Compatibility.fst", "name": "Lib.IntTypes.Compatibility.inttype" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.bytes_t" }, { "project_name": "FStar", "file_name": "IntervalIntersect.fst", "name": "IntervalIntersect.intervals" }, { "project_name": "everparse", "file_name": "Ast.fst", "name": "Ast.range" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ci" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ci" }, { "project_name": "everparse", "file_name": "TypeSizes.fst", "name": "TypeSizes.alignment" }, { "project_name": "hacl-star", "file_name": "Spec.Matrix.fst", "name": "Spec.Matrix.elem" }, { "project_name": "everparse", "file_name": "TypeSizes.fst", "name": "TypeSizes.typename" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fsti", "name": "InterpreterTarget.decl" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.fvmap" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.All.fst", "name": "EverParse3d.InputStream.All.t" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadLogMap.fst", "name": "Zeta.Steel.ThreadLogMap.t" }, { "project_name": "dice-star", "file_name": "HWState.fst", "name": "HWState.t" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.env" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fsti", "name": "Lib.NatMod.prime" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cr" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cr" }, { "project_name": "hacl-star", "file_name": "Lib.UpdateMulti.fst", "name": "Lib.UpdateMulti.uint8" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.ECDSA.fst", "name": "Hacl.Test.ECDSA.siggen_vector" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fst", "name": "Pulse.C.Typenat.z" }, { "project_name": "steel", "file_name": "Steel.C.Typenat.fst", "name": "Steel.C.Typenat.z" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fst", "name": "Vale.X64.Decls.ins" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fst", "name": "Vale.PPC64LE.Decls.ins" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.ECDSA.fst", "name": "Hacl.Test.ECDSA.vec8" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cx" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cx" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.co" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.co" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.test_int_to_int" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c0" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c0" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.pub_bytes" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.ireg" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.pub_bytes_t" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.nat64" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.fsti", "name": "Lib.IntTypes.pub_int_t" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.var" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fsti", "name": "Hacl.Impl.P256.Bignum.widefelem" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.var" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Matrix.fst", "name": "Hacl.Impl.Matrix.elem" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.Equiv.fsti", "name": "Vale.Poly1305.Equiv.nat128" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cl" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cl" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.ECDSA.fst", "name": "Hacl.Test.ECDSA.sigver_vector" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.nat32" }, { "project_name": "everquic-crypto", "file_name": "Mem.fst", "name": "Mem.rgn" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cf" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cf" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.arg" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.var" }, { "project_name": "FStar", "file_name": "BUGSLowParseWriters.fst", "name": "BUGSLowParseWriters.memory_invariant" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.t_two" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cw" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cw" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ch" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ch" }, { "project_name": "everparse", "file_name": "Ast.fst", "name": "Ast.field_bitwidth_t" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_size_t" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Lemmas.fsti", "name": "Vale.X64.Lemmas.code" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cz" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cz" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c1" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c1" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.pos" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.array_size_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.BignumQ.Mul.fsti", "name": "Hacl.Impl.BignumQ.Mul.qelem_wide" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.nat16" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.word" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.word" }, { "project_name": "steel", "file_name": "HACL.fst", "name": "HACL.hashable_len" }, { "project_name": "FStar", "file_name": "WithLocal.fst", "name": "WithLocal.eloc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.nat8" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Types_s.fst", "name": "Vale.Def.Types_s.nat64" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.index" }, { "project_name": "steel", "file_name": "PulsePointStruct.fst", "name": "PulsePointStruct._x" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Types_s.fst", "name": "Vale.Def.Types_s.nat8" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.vector" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cs" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cs" }, { "project_name": "everparse", "file_name": "Options.fst", "name": "Options.vstring" }, { "project_name": "FStar", "file_name": "Alg.fst", "name": "Alg.baseop" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.fsti", "name": "Lib.IntTypes.max_size_t" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.index" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Header.Public.fst", "name": "QUIC.Spec.Header.Public.common_long_t" }, { "project_name": "FStar", "file_name": "StackMachine.fst", "name": "StackMachine.stack" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.X64.fsti", "name": "Vale.Interop.X64.arg_list" }, { "project_name": "steel", "file_name": "LList32.fst", "name": "LList32.llist" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.t_one" }, { "project_name": "hacl-star", "file_name": "Lib.UpdateMulti.Lemmas.fsti", "name": "Lib.UpdateMulti.Lemmas.uint8" }, { "project_name": "everparse", "file_name": "Ast.fst", "name": "Ast.subst" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cy" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cy" }, { "project_name": "everparse", "file_name": "BitFields.fst", "name": "BitFields.bitfield_group" } ], "selected_premises": [ "Lib.IntTypes.size", "Lib.IntTypes.max_size_t", "Lib.IntTypes.u8", "Lib.IntTypes.uint_v", "Lib.IntTypes.range", "Lib.IntTypes.u32", "Lib.IntVector.v_inttype", "Lib.IntTypes.v", "Lib.IntTypes.bits", "LowStar.Monotonic.Buffer.length", "Lib.Buffer.lbuffer", "LowStar.Buffer.trivial_preorder", "Lib.Buffer.gsub", "FStar.UInt.size", "Spec.AES.to_elem", "Lib.Sequence.to_seq", "Lib.IntTypes.uint_t", "Lib.Sequence.lseq", "Lib.Buffer.lbuffer_t", "Lib.IntTypes.int_t", "Lib.Sequence.op_String_Assignment", "Lib.Buffer.as_seq", "Lib.Sequence.seq", "Lib.Sequence.length", "Spec.AES.elem", "Lib.Buffer.eq_or_disjoint", "Lib.Sequence.op_String_Access", "Lib.Buffer.modifies", "Lib.Buffer.op_Bar_Plus_Bar", "LowStar.Monotonic.Buffer.srel", "Lib.Buffer.op_Array_Assignment", "Lib.Buffer.disjoint", "Lib.IntTypes.u64", "Lib.Buffer.loc", "LowStar.ConstBuffer.qbuf_pre", "Lib.Buffer.op_Array_Access", "Lib.ByteSequence.lbytes", "LowStar.ImmutableBuffer.immutable_preorder", "Lib.Sequence.createL", "LowStar.Buffer.gcmalloc_of_list", "Lib.IntTypes.unsigned", "Lib.Buffer.clbuffer", "Spec.AES.gf8", "FStar.Mul.op_Star", "Lib.IntTypes.numbytes", "Lib.IntTypes.op_Hat_Dot", "Spec.AES.irred", "Lib.IntTypes.op_Plus_Bang", "Lib.Sequence.slice", "Lib.Buffer.buffer_t", "Lib.IntTypes.op_Plus_Dot", "Spec.GaloisField.fmul", "Spec.AES.op_Hat_Dot", "Lib.IntTypes.uint", "Lib.IntTypes.op_Star_Bang", "Lib.Buffer.cbuffer", "Lib.IntTypes.op_Subtraction_Dot", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.fst", "Lib.IntTypes.u16", "FStar.Heap.trivial_preorder", "Lib.IntTypes.op_Amp_Dot", "Spec.AES.sub_word", "Spec.GaloisField.fexp", "FStar.Pervasives.Native.snd", "Lib.Buffer.ibuffer", "Lib.IntTypes.op_Percent_Dot", "Lib.Buffer.modifies0", "Lib.Buffer.null", "Lib.IntTypes.op_Less_Dot", "Lib.IntTypes.op_Bar_Dot", "Lib.ByteSequence.nat_from_bytes_le", "Lib.IntTypes.op_Subtraction_Bang", "Lib.IntTypes.size_v", "Lib.Buffer.length", "Lib.IntTypes.op_Star_Dot", "Lib.IntTypes.byte", "FStar.ST.op_Bang", "Lib.IntTypes.op_Slash_Dot", "Lib.Buffer.buffer", "Lib.Buffer.recallable", "Lib.IntTypes.maxint", "Lib.ByteSequence.lbytes_empty", "Lib.ByteSequence.nat_from_bytes_be", "Spec.GaloisField.fadd", "LowStar.ConstBuffer.qbuf", "FStar.Monotonic.HyperStack.sel", "FStar.HyperStack.ST.is_eternal_region", "FStar.Monotonic.HyperStack.live_region", "Lib.Buffer.op_Brack_Lens_Access", "LowStar.Monotonic.Buffer.loc_all_regions_from", "LowStar.Monotonic.Buffer.lmbuffer", "Spec.AES.sub_byte", "Lib.IntTypes.u1", "Lib.Buffer.modifies1", "LowStar.ConstBuffer.qbuf_qual", "LowStar.Monotonic.Buffer.loc_region_only", "Lib.IntTypes.op_Equals_Dot", "FStar.Monotonic.HyperStack.is_heap_color", "LowStar.Monotonic.Buffer.deref" ], "source_upto_this": "module Lib.IntVector\n\nopen FStar.Mul\nopen Lib.Sequence\nopen Lib.IntTypes\n\n#set-options \"--z3rlimit 20 --max_fuel 0 --max_ifuel 0\"\n\nlet v_inttype = t:inttype{unsigned t /\\ ~(U1? t)}\n", "sketch": [ "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the `width` type to represent the width of the integer type.\n\nStep 2: The implementation will involve specifying the properties and constraints of the `width` type based on the integer type.", "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the `width` type to represent the width of the integer type.\n\nStep 2: The `width` type will be implemented as a new type representing the width of the integer type, ensuring that it satisfies the conditions specified for the integer type.", "The definition \"width\" is about determining the width of the integer type.\n\nStep 1: The \"width\" definition will return the number of bits required to represent the integer type.\n\nStep 2: To implement the \"width\" definition, we will calculate the width based on the integer type using bitwise operations and bit manipulation.", "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the `width` type to represent the width of the integer type.\n\nStep 2: The `width` type will be implemented as a new type representing the width of the integer type, ensuring that it satisfies the necessary constraints.", "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the width type to represent the width of the integer type.\n\nStep 2: The width will be implemented as a simple algebraic data type with constructors representing different widths.", "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the `width` type to represent the width of the integer type.\n\nStep 2: The `width` type will be implemented as a new type in F* that represents the width of the integer type.", "The definition of `width` is about defining a type that represents the width of an integer vector.\n\nStep 1: We define a new type `width` to represent the width of an integer vector.\n\nStep 2: The `width` type is implemented as a new type declaration with no additional constraints or properties.", "The definition of `width` is about defining a type that represents the width of an integer vector.\n\nStep 1: We define a new type `width` to represent the width of an integer vector.\n\nStep 2: The `width` type is implemented as a simple alias for `uint32`, which represents an unsigned 32-bit integer.", "The definition is about defining the type `width` in the context of integer vectors.\n\nStep 1: The `width` type represents the number of bits required to store an element of the integer vector.\n\nStep 2: The `width` type is implemented as an alias for `int`.", "The definition `width` is about determining the width of the integer type.\n\nStep 1: We will define the `width` type to represent the width of the integer type.\n\nStep 2: The `width` type will be implemented as a new type in F* to represent the width of the integer type." ], "generated_solution": [ "type width = int", "type width = int", "val width : Type0 -> int\nlet width (t: Type0) : int = \n match t with\n | inttype n -> n", "type width = int", "type width = \n | W8\n | W16\n | W32\n | W64", "type width = int", "type width = int", "type width = uint32", "type width = int", "type width = int" ] }, { "file_name": "Deps.fst", "name": "Deps.parse_config", "opens_and_abbrevs": [ { "abbrev": "H", "full_module": "Hashtable" }, { "open": "Ast" }, { "open": "FStar.All" }, { "open": "FStar.IO" }, { "open": "FStar.List.Tot" }, { "open": "FStar.All" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let parse_config () =\r\n match Options.get_config_file () with\r\n | None -> None\r\n | Some fn -> \r\n let module_name = Options.config_module_name () in\r\n if None? module_name then failwith \"Impossible\"\r\n else if not (OS.file_exists fn)\r\n then raise (Error (\"Unable to file configuration file: \" ^ fn))\r\n else \r\n let s = \r\n try OS.file_contents fn\r\n with\r\n | _ -> raise (Error (\"Unable to read configuration file: \"^fn))\r\n in\r\n match JSON.config_of_json s with\r\n | Pervasives.Inl c -> Some (c, Some?.v module_name)\r\n | Pervasives.Inr err -> \r\n let msg = \r\n Printf.sprintf \"Unable to parse configuration: %s\\n\\\r\n A sample configuration is shown below:\\n\\\r\n %s\"\r\n err\r\n (JSON.config_to_json { compile_time_flags = { flags = [\"FLAG1\"; \"FLAG2\"; \"FLAG3\"];\r\n include_file = \"flags.h\" }}) in\r\n raise (Error msg)", "source_range": { "start_line": 324, "start_col": 0, "end_line": 348, "end_col": 25 }, "interleaved": false, "definition": "fun _ ->\n let _ = Options.get_config_file () in\n (match _ with\n | FStar.Pervasives.Native.None #_ -> FStar.Pervasives.Native.None\n | FStar.Pervasives.Native.Some #_ fn ->\n let module_name = Options.config_module_name () in\n (match None? module_name with\n | true -> FStar.All.failwith \"Impossible\"\n | _ ->\n let _ =\n (let _ = OS.file_exists fn in\n Prims.op_Negation _)\n <:\n Prims.bool\n in\n (match _ with\n | true -> FStar.Exn.raise (Ast.Error (\"Unable to file configuration file: \" ^ fn))\n | _ ->\n let s = try OS.file_contents fn <: Prims.string with in\n (match JSON.config_of_json s with\n | FStar.Pervasives.Inl #_ #_ c ->\n FStar.Pervasives.Native.Some (c, Some?.v module_name)\n | FStar.Pervasives.Inr #_ #_ err ->\n let msg =\n FStar.Printf.sprintf \"Unable to parse configuration: %s\\nA sample configuration is shown below:\\n%s\"\n err\n (JSON.config_to_json (Config.Mkconfig\n (Config.Mkcompile_time_flags [\"FLAG1\"; \"FLAG2\"; \"FLAG3\"] \"flags.h\")))\n in\n FStar.Exn.raise (Ast.Error msg))\n <:\n FStar.Pervasives.Native.option (Config.config * Prims.string))\n <:\n FStar.Pervasives.Native.option (Config.config * Prims.string))\n <:\n FStar.Pervasives.Native.option (Config.config * Prims.string))\n <:\n FStar.Pervasives.Native.option (Config.config * Prims.string)", "effect": "FStar.All.ALL", "effect_flags": [], "mutual_with": [], "premises": [ "Prims.unit", "FStar.Pervasives.Native.None", "FStar.Pervasives.Native.tuple2", "Config.config", "Prims.string", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.uu___is_None", "FStar.All.failwith", "Prims.bool", "FStar.Exn.raise", "Ast.Error", "Prims.op_Hat", "JSON.config_of_json", "FStar.Pervasives.Native.Some", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.__proj__Some__item__v", "FStar.Printf.sprintf", "JSON.config_to_json", "Config.Mkconfig", "Config.Mkcompile_time_flags", "Prims.Cons", "Prims.Nil", "FStar.All.try_with", "OS.file_contents", "Prims.exn", "Prims.op_Negation", "OS.file_exists", "Options.config_module_name", "Options.get_config_file" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "_: Prims.unit -> FStar.All.ALL (FStar.Pervasives.Native.option (Config.config * Prims.string))", "prompt": "let parse_config () =\n ", "expected_response": "match Options.get_config_file () with\n| None -> None\n| Some fn ->\n let module_name = Options.config_module_name () in\n if None? module_name\n then failwith \"Impossible\"\n else\n if not (OS.file_exists fn)\n then raise (Error (\"Unable to file configuration file: \" ^ fn))\n else\n let s =\n try OS.file_contents fn\n with\n | _ -> raise (Error (\"Unable to read configuration file: \" ^ fn))\n in\n match JSON.config_of_json s with\n | Pervasives.Inl c -> Some (c, Some?.v module_name)\n | Pervasives.Inr err ->\n let msg =\n Printf.sprintf \"Unable to parse configuration: %s\\nA sample configuration is shown below:\\n%s\"\n err\n (JSON.config_to_json ({\n compile_time_flags\n =\n { flags = [\"FLAG1\"; \"FLAG2\"; \"FLAG3\"]; include_file = \"flags.h\" }\n }))\n in\n raise (Error msg)", "source": { "project_name": "everparse", "file_name": "src/3d/Deps.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git" }, "dependencies": { "source_file": "Deps.fst", "checked_file": "dataset/Deps.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/ParserDriver.fsti.checked", "dataset/OS.fsti.checked", "dataset/Options.fsti.checked", "dataset/JSON.fsti.checked", "dataset/Hashtable.fsti.checked", "dataset/FStar.String.fsti.checked", "dataset/FStar.ST.fst.checked", "dataset/FStar.Printf.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.IO.fst.checked", "dataset/FStar.All.fst.checked", "dataset/Config.fst.checked", "dataset/Ast.fst.checked" ] }, "definitions_in_context": [ "", "val dep_graph : Type0", "val dependencies (graph: dep_graph) (modul: string) : Tot (list string)", "edge", "val build_dep_graph_from_list (files: list string) : ML dep_graph", "dep_graph'", "val collect_and_sort_dependencies_from_graph (g: dep_graph) (files:list string) : ML (list string)", "dep_graph", "dep_graph", "let collect_and_sort_dependencies (files:list string) : ML (list string) =\r\n collect_and_sort_dependencies_from_graph (build_dep_graph_from_list files) files", "graph", "graph", "modules_with_entrypoint", "modules_with_entrypoint", "modules_with_static_assertions", "modules_with_static_assertions", "val has_entrypoint (g: dep_graph) (modul: string) : Tot bool", "modules_with_output_types", "modules_with_output_types", "modules_with_out_exprs", "modules_with_out_exprs", "val has_static_assertions (g: dep_graph) (modul: string) : Tot bool", "modules_with_extern_types", "modules_with_extern_types", "modules_with_extern_functions", "modules_with_extern_functions", "val has_output_types (g:dep_graph) (modul:string) : bool", "modules_with_extern_probe", "modules_with_extern_probe", "val has_out_exprs (g:dep_graph) (modul:string) : bool", "let all_edges_from (g:dep_graph') (node:string) : Tot (list edge) =\r\n List.Tot.filter (fun (src, _dst) -> src = node) g", "val has_extern_types (g:dep_graph) (modul:string) : bool", "val has_extern_functions (g:dep_graph) (modul:string) : bool", "let dependencies graph modul =\r\n List.Tot.map snd (all_edges_from graph.graph modul)", "val has_extern_probe (g:dep_graph) (modul:string) : bool", "let dep_exists dirname name =\r\n OS.file_exists (Options.get_file_name (OS.concat dirname name))", "val get_config (_:unit) : ML (option (Config.config & string))", "let rec topsort_aux (g:dep_graph') (root:string) (acc:list string & list string)\r\n : ML (list string & list string) = //grey nodes & finished nodes\r\n\r\n let finish (acc:list string & list string) : ML (list string & list string) =\r\n let grey, finished = acc in\r\n List.filter (fun s -> s <> root) grey, root::finished in\r\n\r\n let all_edges_from_root = all_edges_from g root in\r\n if List.length all_edges_from_root = 0\r\n then finish acc\r\n else\r\n all_edges_from_root\r\n |> List.fold_left (fun (grey, finished) (_src, dst) ->\r\n if List.mem dst grey\r\n then raise (Error (Printf.sprintf \"Cycle in the dependency graph (%s)\"\r\n (List.fold_left (fun s m -> Printf.sprintf \"%s <== %s\" s m) dst grey)))\r\n else if List.mem dst finished then (grey, finished)\r\n else topsort_aux g dst (dst::grey, finished)) acc\r\n |> finish", "let topsort (g:dep_graph') (root:string) : ML (list string) =\r\n topsort_aux g root ([root], []) |> snd |> List.rev", "scan_deps_t", "scan_deps_t", "sd_deps", "sd_deps", "sd_has_entrypoint", "sd_has_entrypoint", "sd_has_static_assertions", "sd_has_static_assertions", "sd_has_output_types", "sd_has_output_types", "sd_has_out_exprs", "sd_has_out_exprs", "sd_has_extern_types", "sd_has_extern_types", "sd_has_extern_functions", "sd_has_extern_functions", "sd_has_extern_probe", "sd_has_extern_probe", "let scan_deps (fn:string) : ML scan_deps_t =\r\n let dirname = OS.dirname fn in\r\n let decls, refinement = ParserDriver.parse fn in //AR: TODO: look into refinement too?\r\n\r\n let has_entrypoint = List.Tot.existsb is_entrypoint decls in\r\n let has_static_assertions = Some? refinement in\r\n\r\n let abbrevs = H.create 10 in\r\n\r\n let maybe_dep (i:ident) : ML (list string) =\r\n match i.v.modul_name with\r\n | None -> []\r\n | Some s ->\r\n let dep =\r\n match H.try_find abbrevs s with\r\n | None -> s\r\n | Some m -> m\r\n in\r\n if dep_exists dirname dep\r\n then [dep]\r\n else error (Printf.sprintf \"Dependency not found: %s\" dep) i.range\r\n in\r\n\r\n let deps_of_opt (#a:Type) (f:a -> ML (list string)) (x:option a) : ML (list string) =\r\n match x with\r\n | None -> []\r\n | Some x -> f x in\r\n\r\n let rec deps_of_expr (e:expr) : ML (list string) =\r\n match e.v with\r\n | Constant _ -> []\r\n | Identifier i -> maybe_dep i\r\n | This -> []\r\n | Static e -> deps_of_expr e\r\n | App _op args -> List.collect deps_of_expr args in\r\n\r\n let deps_of_typ_param (p:typ_param) : ML (list string) =\r\n match p with\r\n | Inl e -> deps_of_expr e\r\n | _ -> [] in //AR: no dependencies from the output expressions\r\n\r\n let rec deps_of_typ (t:typ) : ML (list string) =\r\n match t.v with\r\n | Type_app hd _ args -> (maybe_dep hd)@(List.collect deps_of_typ_param args)\r\n | Pointer t -> deps_of_typ t in\r\n\r\n let deps_of_atomic_action (ac:atomic_action) : ML (list string) =\r\n match ac with\r\n | Action_return e -> deps_of_expr e\r\n | Action_abort | Action_field_pos_64 | Action_field_pos_32 | Action_field_ptr -> []\r\n | Action_deref _i -> [] //a local variable\r\n | Action_field_ptr_after sz _write_to -> deps_of_expr sz\r\n | Action_assignment _lhs rhs -> deps_of_expr rhs\r\n | Action_call hd args -> (maybe_dep hd)@(List.collect deps_of_expr args) in\r\n\r\n let rec deps_of_action (a:action) : ML (list string) =\r\n match a.v with\r\n | Atomic_action ac -> deps_of_atomic_action ac\r\n | Action_seq hd tl -> (deps_of_atomic_action hd)@(deps_of_action tl)\r\n | Action_ite hd then_ else_ ->\r\n (deps_of_expr hd)@\r\n (deps_of_action then_)@\r\n (deps_of_opt deps_of_action else_)\r\n | Action_let _i a k -> (deps_of_atomic_action a)@(deps_of_action k)\r\n | Action_act a -> deps_of_action a in\r\n\r\n let deps_of_params params : ML (list string) =\r\n params |> List.collect (fun (t, _, _) -> deps_of_typ t) in\r\n\r\n let deps_of_bitfield_attr (b:bitfield_attr) : ML (list string) =\r\n deps_of_typ b.v.bitfield_type in\r\n\r\n let deps_of_field_bitwidth_t (fb:field_bitwidth_t) : ML (list string) =\r\n match fb with\r\n | Inr b -> deps_of_bitfield_attr b\r\n | _ -> [] in\r\n\r\n let deps_of_field_array_t (fa:field_array_t) : ML (list string) =\r\n match fa with\r\n | FieldScalar -> []\r\n | FieldArrayQualified (e, _) -> deps_of_expr e\r\n | FieldString eopt -> deps_of_opt deps_of_expr eopt\r\n | FieldConsumeAll -> []\r\n in\r\n\r\n let deps_of_atomic_field (af:atomic_field) : ML (list string) =\r\n let af = af.v in\r\n (deps_of_typ af.field_type)@\r\n (deps_of_field_array_t af.field_array_opt)@\r\n (deps_of_opt deps_of_expr af.field_constraint)@\r\n (deps_of_opt deps_of_field_bitwidth_t af.field_bitwidth)@\r\n (deps_of_opt (fun (a, _) -> deps_of_action a) af.field_action) in\r\n\r\n let rec deps_of_field (f:field) : ML (list string) = \r\n match f.v with\r\n | AtomicField af -> deps_of_atomic_field af\r\n | RecordField fs _ -> List.collect deps_of_field fs\r\n | SwitchCaseField swc _ -> deps_of_switch_case swc\r\n and deps_of_case (c:case) : ML (list string) =\r\n match c with\r\n | Case e f -> (deps_of_expr e)@(deps_of_field f)\r\n | DefaultCase f -> deps_of_field f\r\n \r\n and deps_of_switch_case (sc:switch_case) : ML (list string) =\r\n let e, l = sc in\r\n (deps_of_expr e)@(List.collect deps_of_case l) in\r\n\r\n let deps_of_enum_case (ec:enum_case) : ML (list string) =\r\n match snd ec with\r\n | Some (Inr i) -> maybe_dep i\r\n | _ -> [] in\r\n\r\n let deps_of_decl (d:decl) : ML (list string) =\r\n match d.d_decl.v with\r\n | ModuleAbbrev i m ->\r\n H.insert abbrevs i.v.name m.v.name;\r\n [m.v.name]\r\n | Define _ None _ -> []\r\n | Define _ (Some t) _ -> deps_of_typ t\r\n | TypeAbbrev t _ -> deps_of_typ t\r\n | Enum _base_t _ l -> List.collect deps_of_enum_case l\r\n | Record _ params wopt flds ->\r\n (deps_of_params params)@\r\n (deps_of_opt deps_of_expr wopt)@\r\n (List.collect deps_of_field flds)\r\n | CaseType _ params sc ->\r\n (deps_of_params params)@\r\n (deps_of_switch_case sc)\r\n | OutputType _\r\n | ExternType _\r\n | ExternFn _ _ _\r\n | ExternProbe _ -> [] //AR: no dependencies from the output/extern types yet\r\n in\r\n\r\n let has_output_types (ds:list decl) : bool =\r\n List.Tot.existsb (fun d -> OutputType? d.d_decl.v) ds in\r\n\r\n let has_out_exprs (ds:list decl) : bool =\r\n List.Tot.existsb decl_has_out_expr ds in\r\n\r\n let has_extern_types (ds:list decl) : bool =\r\n List.Tot.existsb (fun d -> ExternType? d.d_decl.v) ds in\r\n\r\n let has_extern_functions (ds:list decl) : bool =\r\n List.Tot.existsb (fun d -> ExternFn? d.d_decl.v) ds in\r\n\r\n let has_extern_probe (ds: list decl) : bool =\r\n List.Tot.existsb (fun d -> ExternProbe? d.d_decl.v) ds in\r\n\r\n {\r\n sd_deps = List.collect deps_of_decl decls;\r\n sd_has_entrypoint = has_entrypoint;\r\n sd_has_static_assertions = has_static_assertions;\r\n sd_has_output_types = has_output_types decls;\r\n sd_has_out_exprs = has_out_exprs decls;\r\n sd_has_extern_types = has_extern_types decls;\r\n sd_has_extern_functions = has_extern_functions decls;\r\n sd_has_extern_probe = has_extern_probe decls;\r\n }", "let rec build_dep_graph_aux (dirname:string) (mname:string) (acc:dep_graph & list string)\r\n : ML (dep_graph & list string) = //seen\r\n\r\n let g, seen = acc in\r\n if List.mem mname seen then acc\r\n else\r\n let {sd_has_entrypoint = has_entrypoint;\r\n sd_deps = deps;\r\n sd_has_static_assertions = has_static_assertions;\r\n sd_has_output_types = has_output_types;\r\n sd_has_out_exprs = has_out_exprs;\r\n sd_has_extern_types = has_extern_types;\r\n sd_has_extern_functions = has_extern_functions;\r\n sd_has_extern_probe = has_extern_probe;\r\n } =\r\n scan_deps (Options.get_file_name (OS.concat dirname mname))\r\n in\r\n let edges = List.fold_left (fun edges dep ->\r\n if List.mem (mname, dep) edges\r\n then edges\r\n else (mname, dep)::edges) [] deps in\r\n let g' = {\r\n graph = g.graph @ edges;\r\n modules_with_entrypoint = (if has_entrypoint then mname :: g.modules_with_entrypoint else g.modules_with_entrypoint);\r\n modules_with_static_assertions = (if has_static_assertions then mname :: g.modules_with_static_assertions else g.modules_with_static_assertions);\r\n modules_with_output_types = (if has_output_types then mname::g.modules_with_output_types else g.modules_with_output_types);\r\n modules_with_out_exprs = (if has_out_exprs then mname::g.modules_with_out_exprs else g.modules_with_out_exprs);\r\n modules_with_extern_types = (if has_extern_types then mname::g.modules_with_extern_types else g.modules_with_extern_types);\r\n modules_with_extern_functions = (if has_extern_functions then mname::g.modules_with_extern_functions else g.modules_with_extern_functions);\r\n modules_with_extern_probe = (if has_extern_probe then mname::g.modules_with_extern_probe else g.modules_with_extern_probe);\r\n }\r\n in\r\n List.fold_left (fun acc dep -> build_dep_graph_aux dirname dep acc)\r\n (g', mname::seen) deps", "let build_dep_graph_from_list files =\r\n let g0 = {\r\n graph = [];\r\n modules_with_entrypoint = [];\r\n modules_with_static_assertions = [];\r\n modules_with_output_types = [];\r\n modules_with_out_exprs = [];\r\n modules_with_extern_types = [];\r\n modules_with_extern_functions = [];\r\n modules_with_extern_probe = [];\r\n }\r\n in\r\n let g1 = List.fold_left (fun acc fn -> build_dep_graph_aux (OS.dirname fn) (Options.get_module_name fn) acc) (g0, []) files\r\n |> fst\r\n in\r\n {g1 with graph =\r\n List.Tot.sortWith\r\n (fun (l1, r1) (l2, r2) ->\r\n let c = String.compare l1 l2 in\r\n if c = 0\r\n then String.compare r1 r2\r\n else c\r\n )\r\n g1.graph\r\n }", "let get_sorted_deps (g: dep_graph) (ml: list string) : ML (list string) =\r\n List.collect (fun m -> topsort g.graph m) (List.Tot.sortWith String.compare ml)", "let collect_and_sort_dependencies_from_graph (g: dep_graph) (files:list string) : ML (list string) =\r\n let dirname = files |> List.hd |> OS.dirname in\r\n let filename_of modul = Options.get_file_name (OS.concat dirname modul) in\r\n files\r\n |> List.map Options.get_module_name\r\n |> get_sorted_deps g\r\n |> List.fold_left (fun acc mod -> if List.mem mod acc then acc else mod::acc) []\r\n |> List.rev\r\n |> List.map filename_of", "let has_entrypoint g m = List.Tot.mem m g.modules_with_entrypoint", "let has_static_assertions g m = List.Tot.mem m g.modules_with_static_assertions", "let has_output_types g m = List.Tot.mem m g.modules_with_output_types", "let has_out_exprs g m = List.Tot.mem m g.modules_with_out_exprs", "let has_extern_types g m = List.Tot.mem m g.modules_with_extern_types", "let has_extern_functions g m = List.Tot.mem m g.modules_with_extern_functions", "let has_extern_probe g m = List.Tot.mem m g.modules_with_extern_probe", "let parsed_config : ref (option (Config.config & string)) = ST.alloc None" ], "closest": [ "val produce_config_fst_file_rule: Prims.unit -> FStar.All.ML (list rule_t)\nlet produce_config_fst_file_rule ()\n: FStar.All.ML (list rule_t)\n= match Options.config_module_name (), Options.get_config_file() with\n | Some module_name, Some cfg_file_name ->\n let fst_file_name = mk_filename module_name \"fst\" in\n let checked_file_name = mk_filename module_name \"fst.checked\" in\n let krml_file_name = mk_filename module_name \"krml\" in\n let fst_rule = {\n ty = EverParse;\n from = [cfg_file_name];\n to = fst_file_name;\n args = \"--__micro_step emit_config\"\n } in\n let fst_checked_rule = {\n ty = EverParse;\n from = [fst_file_name];\n to = checked_file_name;\n args = Printf.sprintf \"--__micro_step verify %s\" fst_file_name;\n } in\n let krml_rule = {\n ty = EverParse;\n from = [checked_file_name];\n to = krml_file_name;\n args = Printf.sprintf \"--__micro_step extract %s\" fst_file_name; \n } in\n [fst_rule; fst_checked_rule; krml_rule]\n | _ -> []", "val Config.emit_config_as_fstar_module = module_name: Prims.string -> c: Config.config -> FStar.All.ALL Prims.string\nlet emit_config_as_fstar_module (module_name:string) (c:config) = \n let flags = \n List.map \n (Printf.sprintf \"[@@ CIfDef]\\nassume\\nval ___%s : bool\" )\n c.compile_time_flags.flags\n in\n let assumes = String.concat \"\\n\\n\" flags in\n Printf.sprintf \"module %s\\n%s\\n\" module_name assumes", "val emit_config_as_fstar_module: Prims.unit -> ML unit\nlet emit_config_as_fstar_module ()\r\n : ML unit\r\n = match Deps.get_config () with\r\n | Some (cfg, config_module_name) ->\r\n let fst_file_contents = Config.emit_config_as_fstar_module config_module_name cfg in\r\n let fst_file =\r\n open_write_file\r\n (Printf.sprintf \"%s/%s.fst\"\r\n (Options.get_output_dir())\r\n config_module_name) in\r\n FStar.IO.write_string fst_file fst_file_contents;\r\n FStar.IO.close_write_file fst_file\r\n | _ -> ()", "val Options.get_z3_executable = _: Prims.unit -> FStar.ST.STATE Prims.string\nlet get_z3_executable () =\r\n match !z3_executable with\r\n | None -> \"z3\"\r\n | Some z3 -> z3", "val equiv: Prims.unit -> FStar.Tactics.Tac unit\nlet equiv () : FStar.Tactics.Tac unit =\n let open FStar.Tactics in\n mapply (`vprop_equiv_refl_eq);\n smt()", "val Spec.Hash.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHash: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHash: Failure :(\\n\"; false end", "val FStar.Real.test = Prims.unit\nlet test = assert (two >. one)", "val Postprocess.fext = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet fext () = apply_lemma (`apply_feq_lem); dismiss (); ignore (forall_intros ())", "val Spec.Poly1305.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let mac = poly1305_mac msg key in\n let res = PS.print_compare true (length mac) expected mac in\n\n if res then begin IO.print_string \"\\nPoly1305: Success!\\n\"; true end\n else begin IO.print_string \"\\nPoly1305: Failure :(\\n\"; false end", "val Preprocess.test = _: Prims.unit -> Prims.unit\nlet test () =\n assert (test_add_1' 5 == 7)", "val Spec.Chacha20.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let cipher = chacha20_encrypt_bytes test_key test_nonce test_counter test_plaintext in\n let res = PS.print_compare true (length test_plaintext) test_ciphertext cipher in\n\n if res\n then begin IO.print_string \"\\n\\nChacha20 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nChacha20: Failure :(\\n\"; false end", "val FStar.Real.test1 = Prims.unit\nlet test1 = assert (one = 1.0R)", "val Spec.Box.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let pk1 : lbytes 32 = Spec.Curve25519.secret_to_public sk1 in\n let pk2 : lbytes 32 = Spec.Curve25519.secret_to_public sk2 in\n let mac_cipher = box_detached sk1 pk2 nonce plain in\n let (mac, cipher) =\n match mac_cipher with | Some p -> p | None -> (create 16 (u8 0), create 72 (u8 0)) in\n\n let dec = box_open_detached pk1 sk2 nonce mac cipher in\n let dec_p = match dec with | Some p -> p | None -> create 72 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plain in\n\n if result_decryption\n then begin IO.print_string \"\\nCryptoBox: Success!\\n\"; true end\n else begin IO.print_string \"\\nCryptoBox: Failure :(\"; false end", "val FStar.Real.mul_nil_l = Prims.unit\nlet mul_nil_l = assert (forall n. 0.0R *. n = 0.0R)", "val Spec.Salsa20.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let result = test_quarter_round () &&\n test_row_round () &&\n test_column_round () &&\n test_column_round2 () &&\n test_salsa20_core () in\n if result then begin IO.print_string \"\\nSuccess!\\n\"; true end\n else begin IO.print_string \"\\nFailure :(\"; false end", "val Spec.Blake2.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nAll tests successful !\\n\"; true end\n else begin IO.print_string \"\\n\\nSome test failed !\\n\"; false end", "val Spec.HKDF.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHKDF: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHKDF: Failure :(\\n\"; false end", "val Param.unit_param = _: Prims.unit -> _: Prims.unit -> Type0\nlet unit_param = param_of_eqtype unit", "val FStar.Real.mul_nil_r = Prims.unit\nlet mul_nil_r = assert (forall n. n *. 0.0R = 0.0R)", "val test_dep_f: Prims.unit -> HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True)\nlet test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =\n dep_f (pure_g ())", "val FStar.Real.mul_assoc = Prims.unit\nlet mul_assoc = assert (forall x y z. ((x *. y) *.z) = (x *. (y *. z)))", "val Pulse.Lib.Pervasives.default_arg = t: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.unit\nlet default_arg (t:T.term) = T.exact t", "val Spec.Curve25519.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res1 = test_scalarmult scalar1 point1 expected1 in\n let res2 = test_scalarmult scalar2 point2 expected2 in\n \n let res = res1 && res2 in\n if res then begin IO.print_string \"\\n\\nCurve25519 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nCurve25519: Failure :(\\n\"; false end", "val Spec.SHA3.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nSHA3 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nSHA3: Failure :(\\n\"; false end", "val test_inline: Prims.unit -> FStar.All.ML unit\nlet test_inline () : FStar.All.ML unit =\n test_inline_mov_input ();\n test_inline_mov_add_input ();\n test_inline_mul_inputs ();\n test_inline_mov_mul_rax_100 ();\n test_inline_mov_mul_inputs ();\n// This test leads (rightfully) to a failure in the printer due to a gcc bug\n// test_inline_mov_add_input_dummy_mul ();\n test_inline_comment_add ();\n test_inline_same_line ();\n test_inline_same_line_newline ();\n ()", "val FStar.Real.add_assoc = Prims.unit\nlet add_assoc = assert (forall x y z. ((x +. y) +.z) = (x +. (y +. z)))", "val SimpleTactic.test = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet test () =\n dump \"Test\";\n print \"hello\";\n admit_all()", "val FStar.Tactics.V2.Derived.tadmit = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tadmit () = tadmit_t (`())", "val FStar.Real.mul_dist = Prims.unit\nlet mul_dist = assert (forall x y z. x *. (y +. z) = (x *. y) +. (x *.z))", "val dep_enum_destr_tac: Prims.unit -> T.Tac unit\nlet rec dep_enum_destr_tac () : T.Tac unit =\n let (goal_fun, goal_arg) = T.app_head_tail (T.cur_goal ()) in\n let _ = T.tassert (goal_fun `T.is_fvar` (`%dep_enum_destr)) in\n match goal_arg with\n | [_; _; (te, _); _] ->\n let (te_fun, te_arg) = T.app_head_tail (T.norm_term [delta; iota; zeta] te) in\n let _ = T.tassert (te_fun `T.is_fvar` (`%Cons)) in\n begin match te_arg with\n | [_; _; (tl, _)] ->\n let (tl_fun, _) = T.app_head_tail tl in\n if tl_fun `T.is_fvar` (`%Cons)\n then begin\n T.apply (`dep_enum_destr_cons);\n T.iseq [\n (fun () -> T.trivial (); T.qed ());\n dep_enum_destr_tac\n ];\n T.qed ()\n end\n else if tl_fun `T.is_fvar` (`%Nil)\n then begin\n T.apply (`dep_enum_destr_cons_nil);\n T.trivial ();\n T.qed ()\n end\n else T.fail \"Unknown enum shape: not a cons/nil\"\n | _ -> T.fail \"Not the right arguments to cons\"\n end\n | _ -> T.fail (\"Not the right argument to dep_enum_destr\")", "val ExtractionTest.zero = _: Prims.unit -> FStar.UInt32.t\nlet zero () = 0ul", "val Spec.SecretBox.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let (mac, cipher) = secretbox_detached key nonce plaintext in\n let result_encryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) cipher xcipher in\n let result_mac_compare =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) mac xmac in\n\n let dec = secretbox_open_detached key nonce xmac xcipher in\n let dec_p = match dec with | Some p -> p | None -> create 131 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plaintext in\n\n if result_encryption && result_mac_compare && result_decryption\n then begin IO.print_string \"\\nSuccess!\\n\"; true end\n else begin IO.print_string \"\\nFailure :(\"; false end", "val test: Prims.unit -> FStar.All.ML bool\nlet test () : FStar.All.ML bool =\n let t0 : bool = test_secret_to_public test2_sk test2_pk in\n let t1 : bool = test_verify test1_pk test1_msg test1_sgnt in\n let t2 : bool = test_sign_and_verify test2_sk test2_pk test2_nonce test2_msgHash test2_sgnt in\n let t3 : bool = test_public_key_compressed test2_pk in\n let t4 : bool = test_public_key_uncompressed test2_pk in\n\n if t0 && t1 && t2 && t3 && t4\n then begin IO.print_string \"Test K256 ecdsa: Success!\\n\"; true end\n else begin IO.print_string \"Test K256 ecdsa: Failure :(\\n\"; false end", "val test: Prims.unit -> FStar.All.ML bool\nlet test () : FStar.All.ML bool =\n IO.print_string \"\\n[P-256 ECDSA-verify with SHA2-256]\\n\";\n let res1 = List.for_all (test_sigver (Hash SHA2_256)) sigver_vectors_sha2_256 in\n print_result res1;\n\n IO.print_string \"\\n[P-256 ECDSA-sign with SHA2-256]\\n\";\n let res2 = List.for_all (test_siggen (Hash SHA2_256)) siggen_vectors_sha2_256 in\n print_result res2;\n\n\n IO.print_string \"\\n[P-256 ECDSA-verify with SHA2-384]\\n\";\n let res3 = List.for_all (test_sigver (Hash SHA2_384)) sigver_vectors_sha2_384 in\n print_result res3;\n\n IO.print_string \"\\n[P-256 ECDSA-sign with SHA2-384]\\n\";\n let res4 = List.for_all (test_siggen (Hash SHA2_384)) siggen_vectors_sha2_384 in\n print_result res4;\n\n IO.print_string \"\\n[P-256 ECDSA-verify with SHA2-512]\\n\";\n let res5 = List.for_all (test_sigver (Hash SHA2_512)) sigver_vectors_sha2_512 in\n print_result res5;\n\n IO.print_string \"\\n[P-256 ECDSA-sign with SHA2-512]\\n\";\n let res6 = List.for_all (test_siggen (Hash SHA2_512)) siggen_vectors_sha2_512 in\n print_result res6;\n\n IO.print_string \"\\n[P-256 compressed keys]\\n\";\n let res7 = List.for_all (test_pk_compressed (Hash SHA2_256)) sigver_vectors_sha2_256 in\n print_result res7;\n\n let res : bool = res1 && res2 && res3 && res4 && res5 && res6 && res7 in\n if res then begin IO.print_string \"\\n\\n[P-256] PASS\\n\"; true end\n else begin IO.print_string \"\\n\\n[P-256] FAIL\\n\"; false end", "val test: Prims.unit -> FStar.All.ML bool\nlet test() : FStar.All.ML bool =\n // print_sbox (); // TODO: rm?\n\n IO.print_string \"\\n\\nAES Encryption\\n\";\n let res_enc = List.for_all (fun (v:vec) -> test_one_encrypt v) test_vectors in\n IO.print_string \"\\n\\nAES Decryption\\n\";\n let res_dec = List.for_all (fun (v:vec) -> test_one_decrypt v) test_vectors in\n IO.print_string \"\\n\\nAES Key Expansion\\n\";\n let computed1 = aes_key_expansion AES256 test1_input_key1 in\n let res_key = PS.print_compare true (length computed1) test1_output_expanded computed1 in\n\n let res = res_enc && res_dec && res_key in\n if res then begin IO.print_string \"\\n\\nAES: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nAES: Failure :(\\n\"; false end", "val dummy: Prims.unit\n -> St (option string * FStar.Error.optResult string unit * FStar.Tcp.recv_result 0)\nlet dummy (): St (\n // This one needed by KaRaMeL FStar.Bytes\n option string *\n // These two needed by transport.h\n FStar.Error.optResult string unit *\n FStar.Tcp.recv_result 0\n) =\n Some \"\",\n FStar.Error.Correct (),\n FStar.Tcp.RecvWouldBlock", "val FStar.Real.test_div_eq = Prims.unit\nlet test_div_eq = assert (8.0R /. 2.0R = 4.0R)", "val FStar.Tactics.CanonCommSemiring.ddump = m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit\nlet ddump m = if debugging () then dump m", "val FStar.Real.test_add_eq = Prims.unit\nlet test_add_eq = assert (1.0R +. 1.0R = 2.0R)", "val Postprocess.onL = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet onL () = apply_lemma (`_onL)", "val SimplePrintfReify.xxx = FStar.Pervasives.Native.option (Prims.list SimplePrintfReify.dir)\nlet xxx = parse_format_pure ['%'; 'd'; '='; '%'; 's']", "val FStar.Real.mul_comm = Prims.unit\nlet mul_comm = assert (forall x y. x *. y = y *.x)", "val FStar.Tactics.V1.Derived.tadmit = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tadmit () = tadmit_t (`())", "val SimplePrintf.test = _: Prims.unit -> (Prims.string <: Type0)\nlet test () = sprintf \"%d: Hello %s, sprintf %s\" 0 \"#fstar-hackery\" \"works!\"", "val LowParse.Norm.norm_steps = Prims.list FStar.Pervasives.norm_step\nlet norm_steps = [delta_attr [`%Norm]; iota; zeta; primops]", "val FStar.Real.test_add_eq' = Prims.unit\nlet test_add_eq' = assert (1.0R +. 3.0R = 4.0R)", "val FStar.Tactics.V2.Derived.dump1 = m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit\nlet dump1 (m : string) = focus (fun () -> dump m)", "val test: Prims.unit -> St unit\nlet test (): St unit =\n let r = HS.(new_region root) in\n let b = B.malloc HS.root 0ul 1ul in\n let l: t UInt32.t = create_in r in\n push l 0ul;\n push l 1ul;\n push l 2ul;\n B.upd b 0ul 1ul;\n let h0 = ST.get () in\n assert (v h0 l == [ 2ul; 1ul; 0ul ]);\n assert (B.deref h0 b == 1ul);\n ignore (pop l);\n let h1 = ST.get () in\n assert (v h1 l == [ 1ul; 0ul ]);\n assert (B.deref h0 b == 1ul);\n clear l;\n let h2 = ST.get () in\n assert (v h2 l == []);\n assert (B.deref h2 b == 1ul);\n free l;\n ()", "val test_inline_same_line: Prims.unit -> FStar.All.ML unit\nlet test_inline_same_line () : FStar.All.ML unit =\n let args = [\n (\"first_arg\", TD_Base TUInt64, rR15);\n ] in\n let regs_mod r = (r = rR15 || r = rRax) in\n let c = Block [\n Ins (make_instr_annotate (ins_Space 0) (AnnotateSpace 0));\n Ins (make_instr ins_Add64 (OReg rR15) (OReg rR15));\n Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));\n ] in\n print_function \"test_inline_same_line\" (Some \"result\") args regs_mod c", "val cur_env: Prims.unit -> Tac env\nlet cur_env () : Tac env = goal_env (_cur_goal ())", "val cur_env: Prims.unit -> Tac env\nlet cur_env () : Tac env = goal_env (_cur_goal ())", "val test_dep_f2: Prims.unit -> HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True)\nlet test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =\n let x = pure_g () in\n dep_f x", "val go: Prims.unit -> ML unit\nlet go () : ML unit =\r\n (* Parse command-line options. This action is only accumulating values into globals, without any further action (other than --help and --version, which interrupt the execution.) *)\r\n let cmd_line_files = Options.parse_cmd_line() in\r\n let cfg_opt = Deps.get_config () in\r\n (* Special mode: --check_inplace_hashes *)\r\n let inplace_hashes = Options.get_check_inplace_hashes () in\r\n if Cons? inplace_hashes\r\n then Batch.check_inplace_hashes inplace_hashes\r\n else\r\n let micro_step = Options.get_micro_step () in\r\n if micro_step = Some HashingOptions.MicroStepEmitConfig\r\n then (\r\n emit_config_as_fstar_module ();\r\n exit 0\r\n )\r\n else\r\n if micro_step = Some HashingOptions.MicroStepCopyClangFormat\r\n then\r\n (* Special mode: --__micro_step copy_clang_format *)\r\n let _ = Batch.copy_clang_format (Options.get_output_dir ()) in\r\n exit 0\r\n else\r\n if micro_step = Some HashingOptions.MicroStepCopyEverParseH\r\n then\r\n (* Special mode: --__micro_step copy_everparse_h *)\r\n let _ = Batch.copy_everparse_h\r\n (Options.get_clang_format ())\r\n (Options.get_clang_format_executable ())\r\n (Options.get_input_stream_binding ())\r\n (Options.get_output_dir ())\r\n in\r\n exit 0\r\n else\r\n (* for other modes, a nonempty list of files is needed on the command line, so if none are there, then we shall print the help message *)\r\n let input_stream_binding = Options.get_input_stream_binding () in\r\n if Nil? cmd_line_files\r\n then let _ = Options.display_usage () in exit 1\r\n else\r\n let out_dir = Options.get_output_dir () in\r\n (* Special mode: --__micro_step *)\r\n match micro_step with\r\n | Some step ->\r\n let f = match step with\r\n | HashingOptions.MicroStepExtract -> Batch.extract_fst_file\r\n | HashingOptions.MicroStepVerify -> Batch.verify_fst_file\r\n in\r\n List.iter (f input_stream_binding out_dir) cmd_line_files\r\n | None ->\r\n (* Special mode: --makefile\" *)\r\n match Options.get_makefile () with\r\n | Some t ->\r\n GenMakefile.write_makefile\r\n t\r\n input_stream_binding\r\n (not (Options.get_no_everparse_h ()))\r\n (Options.get_emit_output_types_defs ())\r\n (Options.get_skip_o_rules ())\r\n (Options.get_clang_format ())\r\n cmd_line_files\r\n | None ->\r\n (* Special mode: --__produce_c_from_existing_krml *)\r\n if Options.get_produce_c_from_existing_krml ()\r\n then\r\n let _ = List.iter\r\n (produce_and_postprocess_c out_dir)\r\n cmd_line_files\r\n in\r\n FStar.IO.print_string \"EverParse succeeded!\\n\"\r\n else\r\n (* for other modes, the list of files provided on the command line is assumed to be a list of .3d files, and the list of all .3d files in dependency order has to be inferred from the list of .3d input files provided by the user, unless --__skip_deps is provided *)\r\n let all_files =\r\n if Options.get_skip_deps ()\r\n then List.Tot.rev cmd_line_files (* files are accumulated in reverse on the command line *)\r\n else Deps.collect_and_sort_dependencies cmd_line_files\r\n in\r\n let all_files_and_modules = List.map (fun file -> (file, Options.get_module_name file)) all_files in\r\n (* Special mode: --check_hashes *)\r\n let check_hashes = Options.get_check_hashes () in\r\n if Some? check_hashes\r\n then Batch.check_all_hashes (Some?.v check_hashes) out_dir all_files_and_modules\r\n else\r\n (* Special mode: --emit_smt_encoding *)\r\n if Options.get_emit_smt_encoding ()\r\n then produce_z3 all_files_and_modules\r\n else\r\n (* Default mode: process .3d files *)\r\n let batch = Options.get_batch () in\r\n let should_emit_fstar_code : string -> ML bool =\r\n let cmd_line_modules = List.map Options.get_module_name cmd_line_files in\r\n fun modul ->\r\n batch || List.Tot.mem modul cmd_line_modules in\r\n let process : process_files_t =\r\n (* Special mode: --test_checker *)\r\n let test_checker = Options.get_test_checker () in\r\n if Some? test_checker\r\n then produce_test_checker_exe batch out_dir (Some?.v test_checker)\r\n else\r\n (* Special mode: --z3_diff_test *)\r\n let z3_diff_test = Options.get_z3_diff_test () in\r\n if Some? z3_diff_test\r\n then produce_z3_and_diff_test batch out_dir (Some?.v z3_diff_test)\r\n else\r\n (* Special mode: --z3_test *)\r\n let z3_test = Options.get_z3_test () in\r\n if Some? z3_test\r\n then produce_z3_and_test batch out_dir (Some?.v z3_test)\r\n else process_files\r\n in\r\n match process all_files_and_modules should_emit_fstar_code (Options.get_emit_output_types_defs ()) with\r\n | None -> ()\r\n | Some finalize ->\r\n (* we need to pretty-print source modules in all cases, regardless of --batch,\r\n because of the Makefile scenario\r\n *)\r\n (*\r\n * pretty print only the modules we emitted code for\r\n *)\r\n Batch.pretty_print_source_modules input_stream_binding out_dir\r\n (List.filter (fun (_, m) -> should_emit_fstar_code m) all_files_and_modules);\r\n (* Sub-mode of the default mode: --batch *)\r\n let _ =\r\n if batch\r\n then\r\n let _ = Batch.postprocess_fst\r\n input_stream_binding\r\n (Options.get_emit_output_types_defs ())\r\n (Options.get_add_include ())\r\n (Options.get_clang_format ())\r\n (Options.get_clang_format_executable ())\r\n (Options.get_skip_c_makefiles ())\r\n (Options.get_cleanup ())\r\n (Options.get_no_everparse_h ())\r\n (Options.get_save_hashes ())\r\n out_dir all_files_and_modules\r\n in\r\n FStar.IO.print_string \"EverParse succeeded!\\n\"\r\n else\r\n (* If --batch is not set, then we also need to postprocess the wrappers and assertions\r\n (copyright header and clang-format) *)\r\n Batch.postprocess_wrappers\r\n input_stream_binding\r\n (Options.get_clang_format ())\r\n (Options.get_clang_format_executable ())\r\n out_dir all_files_and_modules\r\n in\r\n finalize ()", "val FStar.InteractiveHelpers.ParseTest.test4 = b: Prims.bool -> l: Prims.list _ -> Prims.unit\nlet test4 b l =\n assert(test2 b l == test2 b l)", "val dep_maybe_enum_destr_t_tac: Prims.unit -> T.Tac unit\nlet dep_maybe_enum_destr_t_tac () : T.Tac unit =\n T.set_guard_policy T.Goal;\n let (goal_fun, _) = T.app_head_tail (T.cur_goal ()) in\n let _ = T.tassert (goal_fun `T.is_fvar` (`%dep_maybe_enum_destr_t)) in\n T.apply (`dep_maybe_enum_destr_t_intro);\n dep_maybe_enum_destr_t'_tac ()", "val Spec.Noise.AuthConf.x1c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x1c = hsk_conf_levels [~<<~ [PS]; ~>~ [E; ES; S; SS]; ~<~ [E; EE; SE; PSK]; ~>~ []; ~<~ []]", "val Spec.Chacha20Poly1305.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res =\n test_aead\n test_key test_nonce test_plaintext test_aad test_cipher test_mac in\n\n if res\n then begin IO.print_string \"\\nChacha20Poly1305: Success! \\o/ \\n\"; true end\n else begin IO.print_string \"\\nChacha20Poly1305: Failure :(\\n\"; false end", "val Steel.ST.GenElim.Base.init_resolve_tac = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet init_resolve_tac () = init_resolve_tac'\n [(`gen_elim_prop_placeholder), solve_gen_elim_prop_placeholder]", "val FStar.Real.test_div_lt = Prims.unit\nlet test_div_lt = assert (8.0R /. 2.0R <. 5.0R)", "val FStar.Real.mul_id_r = Prims.unit\nlet mul_id_r = assert (forall n. n *. 1.0R = n)", "val FStar.Real.mul_id_l = Prims.unit\nlet mul_id_l = assert (forall n. 1.0R *. n = n)", "val Spec.HMAC.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHMAC: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHMAC: Failure :(\\n\"; false end", "val Desugar.prim_consts = Prims.list Prims.string\nlet prim_consts = [\r\n \"unit\"; \"Bool\"; \"UINT8\"; \"UINT16\"; \"UINT32\"; \"UINT64\";\r\n \"UINT8BE\"; \"UINT16BE\"; \"UINT32BE\"; \"UINT64BE\";\r\n \"field_id\"; \"PUINT8\"; \"EVERPARSE_COPY_BUFFER_T\";\r\n \"all_bytes\"; \"all_zeros\";\r\n \"is_range_okay\";\r\n \"void\" ]", "val Cut.tau = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tau =\n (fun () ->\n let psi' = `psi in\n let _ = tcut psi' in\n flip ();\n exact (`p1); // TODO: kinda pointless example\n apply (`p2);\n exact (`p1))", "val Spec.Noise.AuthConf.x7c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x7c = hsk_conf_levels [~>~ [E]; ~<~ [E; EE]; ~>~ [S; SE]; ~<~ []]", "val FStar.Real.test_le3 = Prims.unit\nlet test_le3 = assert (~ (2.0R <=. 1.0R))", "val Spec.Noise.AuthConf.x10c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x10c = hsk_conf_levels [~>>~ [PS]; ~>~ [E]; ~<~ [E; EE; SE]; ~>~ []; ~<~ []]", "val FStar.Tactics.V2.Derived.join_all_smt_goals = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet join_all_smt_goals () =\n let gs, sgs = goals (), smt_goals () in\n set_smt_goals [];\n set_goals sgs;\n repeat' join;\n let sgs' = goals () in // should be a single one\n set_goals gs;\n set_smt_goals sgs'", "val Zeta.KeyValueStore.Formats.Spec.parse_vget_result = LowParse.Spec.Base.parser LowParse.Spec.Combinators.parse_ret_kind Prims.unit\nlet parse_vget_result = LP.parse_empty", "val get_config_file : unit -> ML (option string)\nlet get_config_file () = \r\n match !config_file with\r\n | None -> None\r\n | Some s -> Some s", "val Spec.Noise.AuthConf.x2c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x2c = hsk_conf_levels [~>>~ [PS]; ~>~ [E]; ~<~ [E; EE; SE]; ~>~ []; ~<~ []]", "val FStar.Tactics.V1.Derived.join_all_smt_goals = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet join_all_smt_goals () =\n let gs, sgs = goals (), smt_goals () in\n set_smt_goals [];\n set_goals sgs;\n repeat' join;\n let sgs' = goals () in // should be a single one\n set_goals gs;\n set_smt_goals sgs'", "val MiTLS.QUIC.quic_check = config: MiTLS.TLSConstants.config -> FStar.HyperStack.ST.STATE Prims.unit\nlet quic_check config =\n if config.min_version <> TLS_1p3 then trace \"WARNING: not TLS 1.3\";\n if not config.non_blocking_read then trace \"WARNING: reads are blocking\";\n if None? config.alpn then trace \"WARNING: missing ALPN\";\n if not config.is_quic then trace \"WARNING: missing QUIC config, using TLS key labels\"", "val Nest.tau = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tau = fun () -> pointwise (fun () -> pointwise trefl; trefl ())", "val FStar.Tactics.V1.Derived.dump1 = m: Prims.string -> FStar.Tactics.Effect.Tac Prims.unit\nlet dump1 (m : string) = focus (fun () -> dump m)", "val FStar.Real.add_comm = Prims.unit\nlet add_comm = assert (forall x y. x +. y = y +.x)", "val FStar.Real.test_le1 = Prims.unit\nlet test_le1 = assert (1.0R <=. 2.0R)", "val FStar.Real.test_le2 = Prims.unit\nlet test_le2 = assert (1.0R <=. 1.0R)", "val FStar.Reflection.Const.unit_lid = Prims.list Prims.string\nlet unit_lid = [\"Prims\"; \"unit\"]", "val Effects.Def.morphism_lift_st_exn = Prims.unit\nlet morphism_lift_st_exn =\n morphism_laws_via_eq st stexn eq_stexn\n\t\t return_st bind_st \n\t\t return_stexn bind_stexn \n\t\t lift_st_stexn", "val Spec.Noise.AuthConf.x5c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x5c = hsk_conf_levels [~>~ [E]; ~<~ [E; EE]; ~>~ []]", "val test_inline_mov_input: Prims.unit -> FStar.All.ML unit\nlet test_inline_mov_input () : FStar.All.ML unit =\n let args = [\n (\"first_arg\", TD_Base TUInt64, rR15);\n ] in\n let regs_mod r = (r = rRax || r = rRdx) in\n let c = Block [\n Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));\n ] in\n print_function \"test_inline_mov_input\" (Some \"result\") args regs_mod c", "val MutualUnion.test_fun = _: Prims.unit -> FStar.Int16.t\nlet test_fun () = 0s", "val MerkleTree.Init.init = _: Prims.unit -> FStar.HyperStack.ST.Stack Prims.unit\nlet init = EverCrypt.AutoConfig2.init", "val Spec.Noise.AuthConf.x11c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x11c = hsk_conf_levels [~>>~ [PS]; ~<<~ [PS]; ~>~ [E; ES; SS]; ~<~ [E; EE; SE]; ~>~ []; ~<~ []]", "val test_inline_mov_add_input: Prims.unit -> FStar.All.ML unit\nlet test_inline_mov_add_input () : FStar.All.ML unit =\n let args = [\n (\"first_arg\", TD_Base TUInt64, rR15);\n ] in\n let regs_mod r = (r = rRax || r = rRdx) in\n let c = Block [\n Ins (make_instr ins_Mov64 (OReg rRax) (OReg rR15));\n Ins (make_instr ins_Add64 (OReg rRax) (OConst 1));\n ] in\n print_function \"test_inline_mov_add_input\" (Some \"result\") args regs_mod c", "val Steel.ST.GenElim1.Base.init_resolve_tac = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet init_resolve_tac () = init_resolve_tac'\n [(`gen_elim_prop_placeholder), solve_gen_elim_prop_placeholder]", "val CanonDeep.check_canon_deep = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet check_canon_deep () =\n canon_deep ();\n or_else qed\n (fun () -> dump \"`canon deep` left the following goals\";\n fail \"\")", "val Spec.Noise.AuthConf.x4c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x4c = hsk_conf_levels [~<<~ [PS]; ~>~ [E; ES]; ~<~ [E; EE]; ~>~ []]", "val Spec.Noise.AuthConf.x3c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x3c = hsk_conf_levels [~>>~ [PS]; ~>~ [E]; ~<~ [E; EE; SE; S; ES]; ~>~ []; ~<~ []]", "val Spec.Noise.AuthConf.x9c = FStar.Pervasives.Native.option (Prims.list Spec.Noise.AuthConf.conf_level)\nlet x9c = hsk_conf_levels [~>~ [E]; ~<~ [E; EE; S; ES]; ~>~ [S; SE]; ~<~ []]", "val config_module_name : unit -> ML (option string)\nlet config_module_name () =\r\n match !config_file with\r\n | None -> None\r\n | Some s -> Some (strip_suffix (OS.basename s) \".3d.config\")", "val FStar.Real.test_mul_eq = Prims.unit\nlet test_mul_eq = assert (2.0R *. 2.0R = 4.0R)", "val Pulse.Extract.Main.debug_ = g: Pulse.Extract.Main.env -> f: (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.string)\n -> FStar.Tactics.Effect.Tac Prims.unit\nlet debug_ = debug", "val FStar.InteractiveHelpers.ParseTest.a'_ = Prims.int\nlet a'_ = 3", "val admit_all: Prims.unit -> Tac unit\nlet admit_all () : Tac unit =\n let _ = repeat tadmit in\n ()", "val admit_all: Prims.unit -> Tac unit\nlet admit_all () : Tac unit =\n let _ = repeat tadmit in\n ()", "val Effects.Def.morphism_lift_ex_stexn = Prims.unit\nlet morphism_lift_ex_stexn = \n morphism_laws_via_eq ex stexn eq_stexn\n\t\t return_ex bind_ex \n\t\t return_stexn bind_stexn \n\t\t lift_ex_stexn", "val FStar.Tactics.BV.bv_tac = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet bv_tac () = focus (fun () ->\n mapply (`eq_to_bv);\n mapply (`trans);\n arith_to_bv_tac ();\n arith_to_bv_tac ();\n set_options \"--smtencoding.elim_box true\";\n norm [delta] ;\n smt ()\n)", "val MiniParse.Tac.Base.tsplit = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tsplit () = T.split ()" ], "closest_src": [ { "project_name": "everparse", "file_name": "GenMakefile.fst", "name": "GenMakefile.produce_config_fst_file_rule" }, { "project_name": "everparse", "file_name": "Config.fst", "name": "Config.emit_config_as_fstar_module" }, { "project_name": "everparse", "file_name": "Main.fst", "name": "Main.emit_config_as_fstar_module" }, { "project_name": "everparse", "file_name": "Options.fst", "name": "Options.get_z3_executable" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.equiv" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Test.fst", "name": "Spec.Hash.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test" }, { "project_name": "FStar", "file_name": "Postprocess.fst", "name": "Postprocess.fext" }, { "project_name": "hacl-star", "file_name": "Spec.Poly1305.Test.fst", "name": "Spec.Poly1305.Test.test" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.test" }, { "project_name": "hacl-star", "file_name": "Spec.Chacha20.Test.fst", "name": "Spec.Chacha20.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test1" }, { "project_name": "hacl-star", "file_name": "Spec.Box.Test.fst", "name": "Spec.Box.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_nil_l" }, { "project_name": "hacl-star", "file_name": "Spec.Salsa20.Test.fst", "name": "Spec.Salsa20.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Test.fst", "name": "Spec.Blake2.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.HKDF.Test.fst", "name": "Spec.HKDF.Test.test" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.unit_param" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_nil_r" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test_dep_f" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_assoc" }, { "project_name": "steel", "file_name": "Pulse.Lib.Pervasives.fst", "name": "Pulse.Lib.Pervasives.default_arg" }, { "project_name": "hacl-star", "file_name": "Spec.Curve25519.Test.fst", "name": "Spec.Curve25519.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.Test.fst", "name": "Spec.SHA3.Test.test" }, { "project_name": "hacl-star", "file_name": "Vale.Test.TestInline.fst", "name": "Vale.Test.TestInline.test_inline" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.add_assoc" }, { "project_name": "FStar", "file_name": "SimpleTactic.fst", "name": "SimpleTactic.test" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.tadmit" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_dist" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Tac.Sum.fst", "name": "LowParse.Spec.Tac.Sum.dep_enum_destr_tac" }, { "project_name": "steel", "file_name": "ExtractionTest.fst", "name": "ExtractionTest.zero" }, { "project_name": "hacl-star", "file_name": "Spec.SecretBox.Test.fst", "name": "Spec.SecretBox.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.K256.Test.fst", "name": "Spec.K256.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.P256.Test.fst", "name": "Spec.P256.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.AES.Test.fst", "name": "Spec.AES.Test.test" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FStar.Test.fst", "name": "MiTLS.FStar.Test.dummy" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_div_eq" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.ddump" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_add_eq" }, { "project_name": "FStar", "file_name": "Postprocess.fst", "name": "Postprocess.onL" }, { "project_name": "FStar", "file_name": "SimplePrintfReify.fst", "name": "SimplePrintfReify.xxx" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_comm" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.tadmit" }, { "project_name": "FStar", "file_name": "SimplePrintf.fst", "name": "SimplePrintf.test" }, { "project_name": "everparse", "file_name": "LowParse.Norm.fst", "name": "LowParse.Norm.norm_steps" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_add_eq'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.dump1" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.test" }, { "project_name": "hacl-star", "file_name": "Vale.Test.TestInline.fst", "name": "Vale.Test.TestInline.test_inline_same_line" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.cur_env" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.cur_env" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test_dep_f2" }, { "project_name": "everparse", "file_name": "Main.fst", "name": "Main.go" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.test4" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Tac.Sum.fst", "name": "LowParse.Spec.Tac.Sum.dep_maybe_enum_destr_t_tac" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x1c" }, { "project_name": "hacl-star", "file_name": "Spec.Chacha20Poly1305.Test.fst", "name": "Spec.Chacha20Poly1305.Test.test" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fsti", "name": "Steel.ST.GenElim.Base.init_resolve_tac" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_div_lt" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_id_r" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.mul_id_l" }, { "project_name": "hacl-star", "file_name": "Spec.HMAC.Test.fst", "name": "Spec.HMAC.Test.test" }, { "project_name": "everparse", "file_name": "Desugar.fst", "name": "Desugar.prim_consts" }, { "project_name": "FStar", "file_name": "Cut.fst", "name": "Cut.tau" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x7c" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le3" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x10c" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.join_all_smt_goals" }, { "project_name": "zeta", "file_name": "Zeta.KeyValueStore.Formats.Spec.fst", "name": "Zeta.KeyValueStore.Formats.Spec.parse_vget_result" }, { "project_name": "everparse", "file_name": "Options.fst", "name": "Options.get_config_file" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x2c" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.join_all_smt_goals" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.QUIC.fst", "name": "MiTLS.QUIC.quic_check" }, { "project_name": "FStar", "file_name": "Nest.fst", "name": "Nest.tau" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.dump1" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.add_comm" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le1" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le2" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.unit_lid" }, { "project_name": "FStar", "file_name": "Effects.Def.fst", "name": "Effects.Def.morphism_lift_st_exn" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x5c" }, { "project_name": "hacl-star", "file_name": "Vale.Test.TestInline.fst", "name": "Vale.Test.TestInline.test_inline_mov_input" }, { "project_name": "steel", "file_name": "MutualUnion.fst", "name": "MutualUnion.test_fun" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Init.fst", "name": "MerkleTree.Init.init" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x11c" }, { "project_name": "hacl-star", "file_name": "Vale.Test.TestInline.fst", "name": "Vale.Test.TestInline.test_inline_mov_add_input" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.init_resolve_tac" }, { "project_name": "FStar", "file_name": "CanonDeep.fst", "name": "CanonDeep.check_canon_deep" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x4c" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x3c" }, { "project_name": "noise-star", "file_name": "Spec.Noise.AuthConf.fst", "name": "Spec.Noise.AuthConf.x9c" }, { "project_name": "everparse", "file_name": "Options.fst", "name": "Options.config_module_name" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_mul_eq" }, { "project_name": "steel", "file_name": "Pulse.Extract.Main.fst", "name": "Pulse.Extract.Main.debug_" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.a'_" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.admit_all" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.admit_all" }, { "project_name": "FStar", "file_name": "Effects.Def.fst", "name": "Effects.Def.morphism_lift_ex_stexn" }, { "project_name": "FStar", "file_name": "FStar.Tactics.BV.fst", "name": "FStar.Tactics.BV.bv_tac" }, { "project_name": "FStar", "file_name": "MiniParse.Tac.Base.fst", "name": "MiniParse.Tac.Base.tsplit" } ], "selected_premises": [ "Ast.prog", "FStar.Printf.sprintf", "Ast.with_range", "Ast.with_dummy_range", "Ast.ident", "Ast.field_typ", "Ast.mk_prim_t", "Ast.print_weak_kind", "Ast.to_ident'", "Ast.reserved_prefix", "Ast.comments", "Ast.dummy_pos", "Ast.ident_to_string", "Ast.range", "Ast.weak_kind_glb", "Ast.out_expr_is_out_type_expr", "Ast.dummy_range", "FStar.Heap.trivial_preorder", "FStar.ST.op_Bang", "Deps.has_out_exprs", "FStar.Printf.arg_type", "Ast.enum_case", "Ast.print_decls", "Deps.has_output_types", "Deps.scan_deps", "Ast.eq_out_expr", "Ast.print_ident", "Ast.ident_name", "Ast.print_record", "Deps.has_extern_types", "Ast.decl_with_v", "Ast.field_bitwidth_t", "Ast.print_field", "Ast.print_bitfield_bit_order", "Config.emit_config_as_fstar_module", "Deps.has_entrypoint", "Deps.parsed_config", "Ast.print_decl", "Ast.print_decl'", "Ast.print_switch_case", "Ast.print_atomic_field", "Deps.has_extern_functions", "Ast.as_integer_typ", "Ast.string_of_pos", "FStar.ST.alloc", "FStar.String.strlen", "FStar.Integers.op_Less_Equals", "Deps.build_dep_graph_aux", "FStar.Integers.op_Greater_Equals", "Ast.subst_out_expr", "Deps.has_static_assertions", "Ast.string_of_range", "Ast.print_integer_type", "Ast.typ_as_integer_type", "FStar.Integers.op_Less", "FStar.Integers.op_Greater", "Ast.eq_idents", "Ast.atomic_field_has_out_expr", "Ast.action_has_out_expr", "FStar.Printf.ext_sprintf", "Ast.print_expr", "FStar.Pervasives.Native.fst", "FStar.Integers.op_Plus", "Ast.prog_prune_actions", "Ast.subst", "Ast.is_entrypoint_or_export", "FStar.Integers.op_Percent", "Ast.eq_typ_param", "FStar.UInt.size", "Ast.eq_typ", "Ast.field_action_has_out_expr", "Ast.print_constant", "FStar.Pervasives.Native.snd", "Ast.check_reserved_identifier", "FStar.Printf.dir_type", "Ast.tunit", "FStar.Integers.within_bounds", "Deps.dep_exists", "Ast.print_bitfield", "Ast.print_op", "FStar.Integers.op_Subtraction", "Ast.atomic_field'_prune_actions", "FStar.String.length", "Ast.print_opt", "Ast.print_qual", "FStar.Integers.op_Slash", "Ast.parse_int_suffix", "Ast.print_exprs", "FStar.Printf.string_of_dirs", "Ast.eq_typ_params", "Ast.has_entrypoint", "Ast.print_params", "Ast.tcopybuffer", "Deps.dependencies", "Ast.bit_order_of_typ", "FStar.Mul.op_Star", "Ast.decl_prune_actions", "FStar.Pervasives.reveal_opaque", "Ast.field_has_out_expr", "Ast.tuint64" ], "source_upto_this": "module Deps\nopen FStar.List.Tot\nopen FStar.IO\nopen FStar.All\nopen Ast\n\nmodule H = Hashtable\n\ntype edge = string & string\n\ntype dep_graph' = list edge\n\ntype dep_graph = {\n graph: dep_graph';\n modules_with_entrypoint: list string;\n modules_with_static_assertions: list string;\n modules_with_output_types: list string;\n modules_with_out_exprs: list string;\n modules_with_extern_types: list string;\n modules_with_extern_functions: list string;\n modules_with_extern_probe: list string;\n}\n\nlet all_edges_from (g:dep_graph') (node:string) : Tot (list edge) =\n List.Tot.filter (fun (src, _dst) -> src = node) g\n\nlet dependencies graph modul =\n List.Tot.map snd (all_edges_from graph.graph modul)\n\nlet dep_exists dirname name =\n OS.file_exists (Options.get_file_name (OS.concat dirname name))\n\n(*\n * root is already greyed\n *)\nlet rec topsort_aux (g:dep_graph') (root:string) (acc:list string & list string)\n : ML (list string & list string) = //grey nodes & finished nodes\n\n let finish (acc:list string & list string) : ML (list string & list string) =\n let grey, finished = acc in\n List.filter (fun s -> s <> root) grey, root::finished in\n\n let all_edges_from_root = all_edges_from g root in\n if List.length all_edges_from_root = 0\n then finish acc\n else\n all_edges_from_root\n |> List.fold_left (fun (grey, finished) (_src, dst) ->\n if List.mem dst grey\n then raise (Error (Printf.sprintf \"Cycle in the dependency graph (%s)\"\n (List.fold_left (fun s m -> Printf.sprintf \"%s <== %s\" s m) dst grey)))\n else if List.mem dst finished then (grey, finished)\n else topsort_aux g dst (dst::grey, finished)) acc\n |> finish\n\nlet topsort (g:dep_graph') (root:string) : ML (list string) =\n topsort_aux g root ([root], []) |> snd |> List.rev\n\nnoeq\ntype scan_deps_t = {\n sd_deps: list string;\n sd_has_entrypoint: bool;\n sd_has_static_assertions: bool;\n sd_has_output_types: bool;\n sd_has_out_exprs: bool;\n sd_has_extern_types: bool;\n sd_has_extern_functions: bool;\n sd_has_extern_probe: bool;\n}\n\nlet scan_deps (fn:string) : ML scan_deps_t =\n let dirname = OS.dirname fn in\n let decls, refinement = ParserDriver.parse fn in //AR: TODO: look into refinement too?\n\n let has_entrypoint = List.Tot.existsb is_entrypoint decls in\n let has_static_assertions = Some? refinement in\n\n let abbrevs = H.create 10 in\n\n let maybe_dep (i:ident) : ML (list string) =\n match i.v.modul_name with\n | None -> []\n | Some s ->\n let dep =\n match H.try_find abbrevs s with\n | None -> s\n | Some m -> m\n in\n if dep_exists dirname dep\n then [dep]\n else error (Printf.sprintf \"Dependency not found: %s\" dep) i.range\n in\n\n let deps_of_opt (#a:Type) (f:a -> ML (list string)) (x:option a) : ML (list string) =\n match x with\n | None -> []\n | Some x -> f x in\n\n let rec deps_of_expr (e:expr) : ML (list string) =\n match e.v with\n | Constant _ -> []\n | Identifier i -> maybe_dep i\n | This -> []\n | Static e -> deps_of_expr e\n | App _op args -> List.collect deps_of_expr args in\n\n let deps_of_typ_param (p:typ_param) : ML (list string) =\n match p with\n | Inl e -> deps_of_expr e\n | _ -> [] in //AR: no dependencies from the output expressions\n\n let rec deps_of_typ (t:typ) : ML (list string) =\n match t.v with\n | Type_app hd _ args -> (maybe_dep hd)@(List.collect deps_of_typ_param args)\n | Pointer t -> deps_of_typ t in\n\n let deps_of_atomic_action (ac:atomic_action) : ML (list string) =\n match ac with\n | Action_return e -> deps_of_expr e\n | Action_abort | Action_field_pos_64 | Action_field_pos_32 | Action_field_ptr -> []\n | Action_deref _i -> [] //a local variable\n | Action_field_ptr_after sz _write_to -> deps_of_expr sz\n | Action_assignment _lhs rhs -> deps_of_expr rhs\n | Action_call hd args -> (maybe_dep hd)@(List.collect deps_of_expr args) in\n\n let rec deps_of_action (a:action) : ML (list string) =\n match a.v with\n | Atomic_action ac -> deps_of_atomic_action ac\n | Action_seq hd tl -> (deps_of_atomic_action hd)@(deps_of_action tl)\n | Action_ite hd then_ else_ ->\n (deps_of_expr hd)@\n (deps_of_action then_)@\n (deps_of_opt deps_of_action else_)\n | Action_let _i a k -> (deps_of_atomic_action a)@(deps_of_action k)\n | Action_act a -> deps_of_action a in\n\n let deps_of_params params : ML (list string) =\n params |> List.collect (fun (t, _, _) -> deps_of_typ t) in\n\n let deps_of_bitfield_attr (b:bitfield_attr) : ML (list string) =\n deps_of_typ b.v.bitfield_type in\n\n let deps_of_field_bitwidth_t (fb:field_bitwidth_t) : ML (list string) =\n match fb with\n | Inr b -> deps_of_bitfield_attr b\n | _ -> [] in\n\n let deps_of_field_array_t (fa:field_array_t) : ML (list string) =\n match fa with\n | FieldScalar -> []\n | FieldArrayQualified (e, _) -> deps_of_expr e\n | FieldString eopt -> deps_of_opt deps_of_expr eopt\n | FieldConsumeAll -> []\n in\n\n let deps_of_atomic_field (af:atomic_field) : ML (list string) =\n let af = af.v in\n (deps_of_typ af.field_type)@\n (deps_of_field_array_t af.field_array_opt)@\n (deps_of_opt deps_of_expr af.field_constraint)@\n (deps_of_opt deps_of_field_bitwidth_t af.field_bitwidth)@\n (deps_of_opt (fun (a, _) -> deps_of_action a) af.field_action) in\n\n let rec deps_of_field (f:field) : ML (list string) =\n match f.v with\n | AtomicField af -> deps_of_atomic_field af\n | RecordField fs _ -> List.collect deps_of_field fs\n | SwitchCaseField swc _ -> deps_of_switch_case swc\n and deps_of_case (c:case) : ML (list string) =\n match c with\n | Case e f -> (deps_of_expr e)@(deps_of_field f)\n | DefaultCase f -> deps_of_field f\n\n and deps_of_switch_case (sc:switch_case) : ML (list string) =\n let e, l = sc in\n (deps_of_expr e)@(List.collect deps_of_case l) in\n\n let deps_of_enum_case (ec:enum_case) : ML (list string) =\n match snd ec with\n | Some (Inr i) -> maybe_dep i\n | _ -> [] in\n\n let deps_of_decl (d:decl) : ML (list string) =\n match d.d_decl.v with\n | ModuleAbbrev i m ->\n H.insert abbrevs i.v.name m.v.name;\n [m.v.name]\n | Define _ None _ -> []\n | Define _ (Some t) _ -> deps_of_typ t\n | TypeAbbrev t _ -> deps_of_typ t\n | Enum _base_t _ l -> List.collect deps_of_enum_case l\n | Record _ params wopt flds ->\n (deps_of_params params)@\n (deps_of_opt deps_of_expr wopt)@\n (List.collect deps_of_field flds)\n | CaseType _ params sc ->\n (deps_of_params params)@\n (deps_of_switch_case sc)\n | OutputType _\n | ExternType _\n | ExternFn _ _ _\n | ExternProbe _ -> [] //AR: no dependencies from the output/extern types yet\n in\n\n let has_output_types (ds:list decl) : bool =\n List.Tot.existsb (fun d -> OutputType? d.d_decl.v) ds in\n\n let has_out_exprs (ds:list decl) : bool =\n List.Tot.existsb decl_has_out_expr ds in\n\n let has_extern_types (ds:list decl) : bool =\n List.Tot.existsb (fun d -> ExternType? d.d_decl.v) ds in\n\n let has_extern_functions (ds:list decl) : bool =\n List.Tot.existsb (fun d -> ExternFn? d.d_decl.v) ds in\n\n let has_extern_probe (ds: list decl) : bool =\n List.Tot.existsb (fun d -> ExternProbe? d.d_decl.v) ds in\n\n {\n sd_deps = List.collect deps_of_decl decls;\n sd_has_entrypoint = has_entrypoint;\n sd_has_static_assertions = has_static_assertions;\n sd_has_output_types = has_output_types decls;\n sd_has_out_exprs = has_out_exprs decls;\n sd_has_extern_types = has_extern_types decls;\n sd_has_extern_functions = has_extern_functions decls;\n sd_has_extern_probe = has_extern_probe decls;\n }\n\nlet rec build_dep_graph_aux (dirname:string) (mname:string) (acc:dep_graph & list string)\n : ML (dep_graph & list string) = //seen\n\n let g, seen = acc in\n if List.mem mname seen then acc\n else\n let {sd_has_entrypoint = has_entrypoint;\n sd_deps = deps;\n sd_has_static_assertions = has_static_assertions;\n sd_has_output_types = has_output_types;\n sd_has_out_exprs = has_out_exprs;\n sd_has_extern_types = has_extern_types;\n sd_has_extern_functions = has_extern_functions;\n sd_has_extern_probe = has_extern_probe;\n } =\n scan_deps (Options.get_file_name (OS.concat dirname mname))\n in\n let edges = List.fold_left (fun edges dep ->\n if List.mem (mname, dep) edges\n then edges\n else (mname, dep)::edges) [] deps in\n let g' = {\n graph = g.graph @ edges;\n modules_with_entrypoint = (if has_entrypoint then mname :: g.modules_with_entrypoint else g.modules_with_entrypoint);\n modules_with_static_assertions = (if has_static_assertions then mname :: g.modules_with_static_assertions else g.modules_with_static_assertions);\n modules_with_output_types = (if has_output_types then mname::g.modules_with_output_types else g.modules_with_output_types);\n modules_with_out_exprs = (if has_out_exprs then mname::g.modules_with_out_exprs else g.modules_with_out_exprs);\n modules_with_extern_types = (if has_extern_types then mname::g.modules_with_extern_types else g.modules_with_extern_types);\n modules_with_extern_functions = (if has_extern_functions then mname::g.modules_with_extern_functions else g.modules_with_extern_functions);\n modules_with_extern_probe = (if has_extern_probe then mname::g.modules_with_extern_probe else g.modules_with_extern_probe);\n }\n in\n List.fold_left (fun acc dep -> build_dep_graph_aux dirname dep acc)\n (g', mname::seen) deps\n\nlet build_dep_graph_from_list files =\n let g0 = {\n graph = [];\n modules_with_entrypoint = [];\n modules_with_static_assertions = [];\n modules_with_output_types = [];\n modules_with_out_exprs = [];\n modules_with_extern_types = [];\n modules_with_extern_functions = [];\n modules_with_extern_probe = [];\n }\n in\n let g1 = List.fold_left (fun acc fn -> build_dep_graph_aux (OS.dirname fn) (Options.get_module_name fn) acc) (g0, []) files\n |> fst\n in\n {g1 with graph =\n List.Tot.sortWith\n (fun (l1, r1) (l2, r2) ->\n let c = String.compare l1 l2 in\n if c = 0\n then String.compare r1 r2\n else c\n )\n g1.graph\n }\n\nlet get_sorted_deps (g: dep_graph) (ml: list string) : ML (list string) =\n List.collect (fun m -> topsort g.graph m) (List.Tot.sortWith String.compare ml)\n\nlet collect_and_sort_dependencies_from_graph (g: dep_graph) (files:list string) : ML (list string) =\n let dirname = files |> List.hd |> OS.dirname in\n let filename_of modul = Options.get_file_name (OS.concat dirname modul) in\n files\n |> List.map Options.get_module_name\n |> get_sorted_deps g\n |> List.fold_left (fun acc mod -> if List.mem mod acc then acc else mod::acc) []\n |> List.rev\n |> List.map filename_of\n\nlet has_entrypoint g m = List.Tot.mem m g.modules_with_entrypoint\n\nlet has_static_assertions g m = List.Tot.mem m g.modules_with_static_assertions\n\nlet has_output_types g m = List.Tot.mem m g.modules_with_output_types\n\nlet has_out_exprs g m = List.Tot.mem m g.modules_with_out_exprs\n\nlet has_extern_types g m = List.Tot.mem m g.modules_with_extern_types\n\nlet has_extern_functions g m = List.Tot.mem m g.modules_with_extern_functions\n\nlet has_extern_probe g m = List.Tot.mem m g.modules_with_extern_probe\n\n\n#push-options \"--warn_error -272\"\nlet parsed_config : ref (option (Config.config & string)) = ST.alloc None\n#pop-options\n", "sketch": [ "The `parse_config` function initializes a reference to hold an optional pair of `Config.config` and string. It allocates memory for the reference and initializes it with `None`. The function signature is as follows:\n- It takes no arguments and returns a value of type `FStar.All.ALL (FStar.Pervasives.Native.option (Config.config * Prims.string))`.", "The `parse_config` function initializes a reference to hold an optional value of type `Config.config` and string. It does not take any arguments and simply returns the reference.", "The `parse_config` function is implemented by simply returning the value of the `parsed_config` reference, which is of type `ref (option (Config.config & string))`.\n\n```fstar\nval parse_config : _: Prims.unit -> FStar.All.ALL (FStar.Pervasives.Native.option (Config.config * Prims.string))\n```" ], "generated_solution": [ "val parse_config : _: Prims.unit -> FStar.All.ALL (FStar.Pervasives.Native.option (Config.config * Prims.string)) = \"parse_config\"", "val parse_config : _: Prims.unit -> FStar.All.ALL (FStar.Pervasives.Native.option (Config.config * Prims.string))" ] }, { "file_name": "FStar.Seq.Sorted.fst", "name": "FStar.Seq.Sorted.sorted_split_lemma", "opens_and_abbrevs": [ { "open": "FStar.Seq" }, { "open": "FStar.Seq" }, { "open": "FStar.Seq" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val sorted_split_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n Lemma (requires (sorted #a f s == true))\n (ensures (let s1, s2 = split s i in sorted #a f s1 == true /\\ sorted #a f s2 == true))", "source_definition": "let sorted_split_lemma #a f s i =\n sorted_slice_lemma #a f s 0 i ;\n sorted_slice_lemma #a f s i (length s)", "source_range": { "start_line": 106, "start_col": 0, "end_line": 108, "end_col": 40 }, "interleaved": false, "definition": "fun f s i ->\n FStar.Seq.Sorted.sorted_slice_lemma f s 0 i;\n FStar.Seq.Sorted.sorted_slice_lemma f s i (FStar.Seq.Base.length s)", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Prims.eqtype", "FStar.Seq.Properties.tot_ord", "FStar.Seq.Base.seq", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "FStar.Seq.Base.length", "FStar.Seq.Sorted.sorted_slice_lemma", "Prims.unit" ], "proof_features": [], "is_simple_lemma": true, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n f: FStar.Seq.Properties.tot_ord a ->\n s: FStar.Seq.Base.seq a ->\n i: Prims.nat{i < FStar.Seq.Base.length s}\n -> FStar.Pervasives.Lemma (requires FStar.Seq.Properties.sorted f s == true)\n (ensures\n (let _ = FStar.Seq.Properties.split s i in\n (let FStar.Pervasives.Native.Mktuple2 #_ #_ s1 s2 = _ in\n FStar.Seq.Properties.sorted f s1 == true /\\ FStar.Seq.Properties.sorted f s2 == true)\n <:\n Type0))", "prompt": "let sorted_split_lemma #a f s i =\n ", "expected_response": "sorted_slice_lemma #a f s 0 i;\nsorted_slice_lemma #a f s i (length s)", "source": { "project_name": "FStar", "file_name": "ulib/FStar.Seq.Sorted.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Seq.Sorted.fst", "checked_file": "dataset/FStar.Seq.Sorted.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "sorted_pred", "val sorted_pred_tail :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a{length s > 0} ->\n Lemma (requires (sorted_pred #a f s)) (ensures (sorted_pred #a f (tail s)))", "let sorted_pred_tail #a f s = ()", "val sorted_pred_sorted_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n Lemma (requires (sorted_pred f s)) (ensures (sorted #a f s == true)) (decreases (length s))", "let rec sorted_pred_sorted_lemma #a f s =\n if length s <= 1 then ()\n else begin\n assert (f (index s 0) (index s 1)) ;\n sorted_pred_tail #a f s;\n sorted_pred_sorted_lemma #a f (tail s)\n end", "let intro_sorted_pred (#a:eqtype) (f:tot_ord a) (s:seq a)\n ($g:(i:nat{i < length s} -> j:nat{j < length s} -> Lemma (requires (i <= j)) (ensures (f (index s i) (index s j)))))\n : Lemma (sorted_pred #a f s)\n= let aux (i j : (k:nat{k < length s})) (p:squash (i <= j)) : GTot (squash (f (index s i) (index s j))) =\n FStar.Squash.give_proof p ;\n g i j ;\n FStar.Squash.get_proof (f (index s i) (index s j))\n in\n FStar.Classical.forall_intro_2 (fun (i j:(k:nat{k < length s})) ->\n FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (aux i j)) <: Lemma (i <= j ==> f (index s i) (index s j)))", "val sorted_pred_cons_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a{length s > 1} ->\n Lemma (requires (f (index s 0) (index s 1) /\\ sorted_pred #a f (tail s))) (ensures (sorted_pred #a f s))", "let sorted_pred_cons_lemma #a f s =\n let aux (i j : (k:nat{k < length s})) : Lemma (requires (i <= j)) (ensures (f (index s i) (index s j))) =\n if i = 0 then\n if j = 0 then ()\n else assert (f (index s 0) (index (tail s) 0) /\\ f (index (tail s) 0) (index (tail s) (j-1)))\n else assert (f (index (tail s) (i - 1)) (index (tail s) (j - 1)))\n in\n intro_sorted_pred #a f s aux", "val sorted_sorted_pred_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n Lemma (requires (sorted #a f s == true)) (ensures (sorted_pred #a f s)) (decreases (length s))", "let rec sorted_sorted_pred_lemma #a f s =\n if length s = 0 then ()\n else if length s = 1 then ()\n else (sorted_sorted_pred_lemma #a f (tail s) ; sorted_pred_cons_lemma #a f s)", "val sorted_pred_slice_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n j:nat{i <= j /\\ j <= length s} ->\n Lemma (requires (sorted_pred #a f s)) (ensures (sorted_pred #a f (slice s i j)))", "let sorted_pred_slice_lemma #a f s i j = ()", "val sorted_slice_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n j:nat{i <= j /\\ j <= length s} ->\n Lemma (requires (sorted #a f s == true)) (ensures (sorted #a f (slice s i j) == true))", "let sorted_slice_lemma #a f s i j =\n sorted_sorted_pred_lemma #a f s ;\n sorted_pred_slice_lemma #a f s i j ;\n sorted_pred_sorted_lemma #a f (slice s i j)", "val sorted_split_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n Lemma (requires (sorted #a f s == true))\n (ensures (let s1, s2 = split s i in sorted #a f s1 == true /\\ sorted #a f s2 == true))" ], "closest": [ "val lemma_split : #a:Type -> s:seq a -> i:nat{(0 <= i /\\ i <= length s)} -> Lemma\n (ensures (append (fst (split s i)) (snd (split s i)) == s))\nlet lemma_split #_ s i =\n cut (equal (append (fst (split s i)) (snd (split s i))) s)", "val lemma_split: #a:Type -> #len:size_nat -> s:Seq.lseq a len -> i:size_nat{i <= len} ->\n Lemma (s == Seq.(Seq.sub s 0 i @| Seq.sub s i (len - i)))\nlet lemma_split #a #len s i =\n FStar.Seq.lemma_split s i", "val sorted_concat_lemma: #a:eqtype\n -> f:(a -> a -> Tot bool){total_order a f}\n -> lo:seq a{sorted f lo}\n -> pivot:a\n -> hi:seq a{sorted f hi}\n -> Lemma (requires (forall y. (mem y lo ==> f y pivot)\n /\\ (mem y hi ==> f pivot y)))\n (ensures (sorted f (append lo (cons pivot hi))))\nlet sorted_concat_lemma = sorted_concat_lemma'", "val lemma_seq_sortwith_correctness (#a:eqtype) (f:a -> a -> Tot int) (s:seq a)\n :Lemma (requires (total_order a (List.Tot.Base.bool_of_compare f)))\n (ensures (let s' = sortWith f s in sorted (List.Tot.Base.bool_of_compare f) s' /\\ permutation a s s'))\nlet lemma_seq_sortwith_correctness #_ f s\n = let l = seq_to_list s in\n let l' = List.Tot.Base.sortWith f l in\n let s' = seq_of_list l' in\n let cmp = List.Tot.Base.bool_of_compare f in\n\n (* sortedness *)\n List.Tot.Properties.sortWith_sorted f l; //the list returned by List.sortWith is sorted\n lemma_seq_of_list_sorted cmp l'; //seq_of_list preserves sortedness\n\n (* permutation *)\n lemma_seq_to_list_permutation s; //seq_to_list is a permutation\n List.Tot.Properties.sortWith_permutation f l; //List.sortWith is a permutation\n lemma_seq_of_list_permutation l'", "val union_sort_lemma (#a: eqtype) (#f: _) (h: a) (t1 t2: ordset a f)\n : Lemma (requires sorted f (h :: t1) /\\ sorted f (h :: t2))\n (ensures sorted f (h :: (union t1 t2)))\nlet union_sort_lemma (#a:eqtype) #f (h:a) (t1 t2: ordset a f)\n : Lemma (requires sorted f (h::t1) /\\ sorted f (h::t2))\n (ensures sorted f (h::(union t1 t2))) = \n if size t1 = 0 then union_with_empty t2\n else if size t2 = 0 then union_with_empty t1 \n else begin \n union_mem_forall t1 t2;\n set_props t1;\n set_props t2;\n set_props (union t1 t2) \n end", "val sorted_concat_lemma'\n (#a: eqtype)\n (f: (a -> a -> Tot bool){total_order a f})\n (lo: seq a {sorted f lo})\n (pivot: a)\n (hi: seq a {sorted f hi})\n : Lemma (requires (forall y. (mem y lo ==> f y pivot) /\\ (mem y hi ==> f pivot y)))\n (ensures (sorted f (append lo (cons pivot hi))))\n (decreases (length lo))\nlet rec sorted_concat_lemma': #a:eqtype\n -> f:(a -> a -> Tot bool){total_order a f}\n -> lo:seq a{sorted f lo}\n -> pivot:a\n -> hi:seq a{sorted f hi}\n -> Lemma (requires (forall y. (mem y lo ==> f y pivot)\n /\\ (mem y hi ==> f pivot y)))\n (ensures (sorted f (append lo (cons pivot hi))))\n (decreases (length lo))\n= fun #_ f lo pivot hi ->\n if length lo = 0\n then (cut (equal (append lo (cons pivot hi)) (cons pivot hi));\n cut (equal (tail (cons pivot hi)) hi))\n else (sorted_concat_lemma' f (tail lo) pivot hi;\n lemma_append_cons lo (cons pivot hi);\n lemma_tl (head lo) (append (tail lo) (cons pivot hi)))", "val lemma_split : s:bytes -> i:nat{(0 <= i /\\ i <= length s)} -> Lemma\n (ensures ((fst (split s i)) @| (snd (split s i)) = s))\nlet lemma_split s i =\n cut (Seq.equal ((fst (split s i)) @| (snd (split s i))) s)", "val sorted_feq (#a:Type)\n (f g : (a -> a -> Tot bool))\n (s:seq a{forall x y. f x y == g x y})\n : Lemma (ensures (sorted f s <==> sorted g s))\nlet sorted_feq = sorted_feq'", "val sorted_feq' (#a: Type) (f g: (a -> a -> Tot bool)) (s: seq a {forall x y. f x y == g x y})\n : Lemma (ensures (sorted f s <==> sorted g s)) (decreases (length s))\nlet rec sorted_feq' (#a:Type)\n (f g : (a -> a -> Tot bool))\n (s:seq a{forall x y. f x y == g x y})\n : Lemma (ensures (sorted f s <==> sorted g s))\n (decreases (length s))\n = if length s <= 1 then ()\n else sorted_feq' f g (tail s)", "val lemma_first_index_correct2 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (exists_sat_elems f s /\\ first_index f s <= i))\nlet lemma_first_index_correct2 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (exists_sat_elems f s /\\ first_index f s <= i)) =\n lemma_last_index_correct2 f s i;\n let fi = first_index f s in\n if fi > i then\n lemma_first_index_correct1 f s i\n else ()", "val lemma_seq_refine_equal (#a:Type) (f:a->bool) (s:seq a{all f s}) (i:seq_index s):\nLemma (requires True)\n (ensures (index (seq_refine f s) i == index s i))\n [SMTPat (index (seq_refine f s) i)]\nlet lemma_seq_refine_equal = lemma_seq_refine_equal_aux", "val lemma_seq_refine_equal_aux (#a: Type) (f: (a -> bool)) (s: seq a {all f s}) (i: seq_index s)\n : Lemma (requires True) (ensures (index (seq_refine f s) i == index s i)) (decreases (length s))\nlet rec lemma_seq_refine_equal_aux (#a:Type) (f:a->bool) (s:seq a{all f s}) (i:seq_index s):\n Lemma (requires True)\n (ensures (index (seq_refine f s) i == index s i))\n (decreases (length s)) =\n let n = length s in\n if n = 0 then ()\n else if i = n - 1 then ()\n else lemma_seq_refine_equal_aux f (prefix s (n - 1)) i", "val lemma_splitAt_reindex_left (#t: Type) (i: nat) (l: list t) (j: nat)\n : Lemma (requires i <= length l /\\ j < i)\n (ensures\n (let left, right = splitAt i l in\n splitAt_length i l;\n j < length left /\\ index left j == index l j))\nlet rec lemma_splitAt_reindex_left (#t:Type) (i:nat) (l:list t) (j:nat) :\n Lemma\n (requires i <= length l /\\ j < i)\n (ensures (\n let left, right = splitAt i l in\n splitAt_length i l;\n j < length left /\\ index left j == index l j)) =\n match i, j with\n | 1, _ | _, 0 -> ()\n | _ -> lemma_splitAt_reindex_left (i - 1) (tl l) (j - 1)", "val lemma_strict_subset_size (#a:eqtype) (#f:cmp a) (s1:ordset a f) (s2:ordset a f)\n : Lemma (requires (strict_subset s1 s2))\n (ensures (subset s1 s2 /\\ size s1 < size s2))\n [SMTPat (strict_subset s1 s2)]\nlet lemma_strict_subset_size #a #f s1 s2 = \n let eql (p q: ordset a f) \n : Lemma (requires forall x. mem x p = mem x q) \n (ensures p=q) \n = eq_lemma p q in Classical.move_requires_2 eql s1 s2;\n eliminate exists x. mem x s2 && not (mem x s1) \n returns size s2 > size s1 with _.\n begin\n Classical.forall_intro (mem_insert x s1);\n precise_size_insert s1 x;\n assert (subset (insert' x s1) s2)\n end", "val lemma_filter_correct1_aux (#a: Type) (f: (a -> bool)) (s: seq a) (i: seq_index (filter f s))\n : Lemma (requires (True)) (ensures (f (index (filter f s) i) = true)) (decreases (length s))\nlet rec lemma_filter_correct1_aux (#a: Type) (f:a -> bool) (s:seq a) (i:seq_index (filter f s)):\n Lemma (requires (True))\n (ensures (f (index (filter f s) i) = true))\n (decreases (length s)) =\n let n = length s in\n let fs = filter f s in\n if n = 0 then ()\n else\n let s' = prefix s (n - 1) in\n let e = index s (n - 1) in\n if f e then\n if i = (length fs) - 1 then ()\n else\n lemma_filter_correct1_aux f s' i\n else\n lemma_filter_correct1_aux f s' i", "val split_eq (#a: Type) (s: seq a) (i: nat{(0 <= i /\\ i <= length s)})\n : Pure (seq a * seq a) (requires True) (ensures (fun x -> (append (fst x) (snd x) == s)))\nlet split_eq (#a:Type) (s:seq a) (i:nat{(0 <= i /\\ i <= length s)})\n: Pure\n (seq a * seq a)\n (requires True)\n (ensures (fun x -> (append (fst x) (snd x) == s)))\n= let x = split s i in\n lemma_split s i;\n x", "val init_next (#a: Type) (s: S.seq a) (f: (i: nat{i < S.length s} -> a)) (i: nat)\n : Lemma\n (requires (i < S.length s /\\ S.equal (S.slice s 0 i) (S.init i f) /\\ S.index s i == f i))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.init (i + 1) f)))\nlet init_next (#a: Type) (s: S.seq a) (f: (i:nat { i < S.length s }) -> a) (i: nat):\n Lemma\n (requires (\n i < S.length s /\\\n S.equal (S.slice s 0 i) (S.init i f) /\\\n S.index s i == f i))\n (ensures (S.equal (S.slice s 0 (i + 1)) (S.init (i + 1) f)))\n=\n lemma_slice_ijk s 0 i (i + 1)", "val lemma_filter_unique (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s)\n: Lemma (requires (f (index s i) /\\ (forall j. j <> i ==> not (f (index s j)))))\n (ensures (filter f s == create 1 (index s i)))\nlet lemma_filter_unique (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s)\n : Lemma (requires (f (index s i) /\\ (forall j. j <> i ==> not (f (index s j)))))\n (ensures (filter f s == create 1 (index s i)))\n = lemma_filter_unique_aux f s i", "val lemma_last_index_prefix (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (exists_sat_elems f s /\\ i > last_index f s))\n (ensures (exists_sat_elems f (prefix s i) /\\\n last_index f s = last_index f (prefix s i)))\nlet lemma_last_index_prefix (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (exists_sat_elems f s /\\ i > last_index f s))\n (ensures (exists_sat_elems f (prefix s i) /\\\n last_index f s = last_index f (prefix s i))) =\n let li = last_index f s in\n let s' = prefix s i in\n lemma_prefix_index s i li;\n assert(f (index s' li));\n assert(li < length s');\n let r' = filter_index_inv_map f s' li in\n assert(exists_sat_elems f s');\n let li' = last_index f s' in\n if li < li' then (\n lemma_prefix_index s i li';\n lemma_last_index_correct1 f s li'\n )\n else if li > li' then\n lemma_last_index_correct1 f s' li\n else ()", "val lemma_filter_correct1 (#a: Type) (f:a -> bool) (s:seq a) (i:seq_index (filter f s)):\nLemma (requires (True))\n (ensures (f (index (filter f s) i) = true))\n [SMTPat (f (index (filter f s) i))]\nlet lemma_filter_correct1 (#a: Type) (f:a -> bool) (s:seq a) (i:seq_index (filter f s)):\n Lemma (requires (True))\n (ensures (f (index (filter f s) i) = true)) = lemma_filter_correct1_aux f s i", "val lemma_swap_permutes (#a:eqtype) (s:seq a) (i:nat{i count x s = count x (swap s i j))\n (lemma_swap_permutes_aux s i j)", "val index_mapi_lemma (#a:Type) (#b:Type) (#len:flen) (f:(i:nat{i < len} -> a -> b)) (s:ntuple a len) (i:nat{i < len}) :\n Lemma (index (mapi #a #b #len f s) i == f i (index s i))\n [SMTPat (index (mapi #a #b #len f s) i)]\nlet index_mapi_lemma #a #b #len f s i =\n createi_lemma len (fun i -> f i (index s i)) i", "val lemma_last_index_correct2 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (exists_sat_elems f s /\\ last_index f s >= i))\nlet lemma_last_index_correct2 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (exists_sat_elems f s /\\ last_index f s >= i)) =\n let n = length s in\n let ri = filter_index_inv_map f s i in\n assert (exists_sat_elems f s);\n let j = last_index f s in\n if j < i then\n lemma_filter_index_inv_map_monotonic f s j i\n else ()", "val sorted_app_lemma: #a:eqtype -> f:total_order a\n -> l1:list a{sorted f l1} -> l2:list a{sorted f l2} -> pivot:a\n -> Lemma (requires (forall y. (mem y l1 ==> ~(f pivot y))\n\t\t /\\ (mem y l2 ==> f pivot y)))\n (ensures (sorted f (l1 @ pivot :: l2)))\n [SMTPat (sorted f (l1 @ pivot::l2))]\nlet rec sorted_app_lemma #a f l1 l2 pivot =\n match l1 with\n | hd::tl -> sorted_app_lemma f tl l2 pivot\n | _ -> ()", "val lemma_splitAt_shorten_left\n (#t: Type)\n (l1 l2: list t)\n (i: nat{i <= length l1 /\\ i <= length l2})\n (j: nat{j <= i})\n : Lemma (requires (fst (splitAt i l1) == fst (splitAt i l2)))\n (ensures (fst (splitAt j l1) == fst (splitAt j l2)))\nlet rec lemma_splitAt_shorten_left\n (#t:Type) (l1 l2:list t) (i:nat{i <= length l1 /\\ i <= length l2}) (j:nat{j <= i}) :\n Lemma\n (requires (fst (splitAt i l1) == fst (splitAt i l2)))\n (ensures (fst (splitAt j l1) == fst (splitAt j l2))) =\n match j with\n | 0 -> ()\n | _ ->\n lemma_splitAt_shorten_left (tl l1) (tl l2) (i-1) (j-1)", "val lemma_first_index_correct1 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (exists_sat_elems f s /\\ i < first_index f s))\n (ensures (not (f (index s i))))\nlet lemma_first_index_correct1 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (exists_sat_elems f s /\\ i < first_index f s))\n (ensures (not (f (index s i)))) =\n let fi = first_index f s in\n if f (index s i) then\n lemma_filter_index_inv_map_monotonic f s i fi\n else ()", "val index_map_lemma (#a:Type) (#b:Type) (#len:flen) (f:(a -> b)) (s:ntuple a len) (i:nat{i < len}) :\n Lemma (index (map #a #b #len f s) i == f (index s i))\n [SMTPat (index (map #a #b #len f s) i)]\nlet index_map_lemma #a #b #len f s i =\n createi_lemma len (fun i -> f (index s i)) i", "val lemma_seq_of_list_sorted (#a:Type) (f:a -> a -> Tot bool) (l:list a)\n :Lemma (requires (List.Tot.Properties.sorted f l)) (ensures (sorted f (seq_of_list l)))\nlet rec lemma_seq_of_list_sorted #a f l\n =\n lemma_seq_of_list_induction l;\n if List.Tot.length l > 1 then begin\n lemma_seq_of_list_induction (List.Tot.Base.tl l);\n lemma_seq_of_list_sorted f (List.Tot.Base.tl l) \n end", "val lemma_filter_unique_aux (#a: Type) (f: (a -> bool)) (s: seq a) (i: seq_index s)\n : Lemma (requires (f (index s i) /\\ (forall j. j <> i ==> not (f (index s j)))))\n (ensures (filter f s == create 1 (index s i)))\n (decreases (length s))\nlet rec lemma_filter_unique_aux (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s)\n : Lemma (requires (f (index s i) /\\ (forall j. j <> i ==> not (f (index s j)))))\n (ensures (filter f s == create 1 (index s i)))\n (decreases (length s)) =\n let n = length s in\n if n = 0 then ()\n else let e = index s (n - 1) in\n let s' = prefix s (n - 1) in\n if i < n - 1 \n then lemma_filter_unique_aux f s' i\n else (\n lemma_filter_all_not_inv f s';\n assert (equal (append1 empty e) (create 1 (index s i)))\n )", "val lemma_strict_subset_exists_diff (#a:eqtype) (#f:cmp a) (s1:ordset a f) (s2:ordset a f) \n : Lemma (requires subset s1 s2)\n (ensures (strict_subset s1 s2) <==> (exists x. (mem x s2 /\\ not (mem x s1))))\nlet lemma_strict_subset_exists_diff #a #f (s1 s2: ordset a f)\n : Lemma (requires subset s1 s2)\n (ensures (strict_subset s1 s2) <==> (exists x. (mem x s2 /\\ not (mem x s1)))) \n = Classical.move_requires_2 strict_subset_implies_diff_element s1 s2", "val lemma_splitAt_reindex_right (#t: Type) (i: nat) (l: list t) (j: nat)\n : Lemma (requires i <= length l /\\ j + i < length l)\n (ensures\n (let left, right = splitAt i l in\n splitAt_length i l;\n j < length right /\\ index right j == index l (j + i)))\nlet rec lemma_splitAt_reindex_right (#t:Type) (i:nat) (l:list t) (j:nat) :\n Lemma\n (requires i <= length l /\\ j + i < length l)\n (ensures (\n let left, right = splitAt i l in\n splitAt_length i l;\n j < length right /\\ index right j == index l (j + i))) =\n match i with\n | 0 -> ()\n | _ -> lemma_splitAt_reindex_right (i - 1) (tl l) j", "val sort_lseq (#a: eqtype) (#n: _) (f: tot_ord a) (s: lseq a n)\n : s': lseq a n {sorted f s' /\\ permutation a s s'}\nlet sort_lseq (#a:eqtype) #n (f:tot_ord a) (s:lseq a n)\n : s':lseq a n{sorted f s' /\\ permutation a s s'} =\n lemma_seq_sortwith_correctness (L.compare_of_bool f) s;\n let s' = sortWith (L.compare_of_bool f) s in\n perm_len s s';\n sorted_feq f (L.bool_of_compare (L.compare_of_bool f)) s';\n s'", "val lemma_filter_len_monotonic (#a: Type) (f: (a -> bool)) (s: seq a) (i: nat{i <= length s})\n : Lemma (requires (True))\n (ensures (length (filter f s) >= length (filter f (prefix s i))))\n (decreases (length s))\nlet rec lemma_filter_len_monotonic (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (True))\n (ensures (length (filter f s) >= length (filter f (prefix s i))))\n (decreases (length s)) =\n let n = length s in\n if n = 0 then ()\n else if i = n then () // s == prefix s i\n else (\n let s' = prefix s (n - 1) in\n lemma_len_slice s 0 (n - 1);\n lemma_filter_len_monotonic f s' i\n )", "val lemma_prefix_suffix (#a: Type) (s: seq a) (i: nat{i <= length s})\n : Lemma (requires (True)) (ensures (append (prefix s i) (suffix s (length s - i)) == s))\nlet lemma_prefix_suffix (#a:Type) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (True))\n (ensures (append (prefix s i) (suffix s (length s - i)) == s)) =\n assert(equal (append (prefix s i) (suffix s (length s - i))) s);\n ()", "val lemma_last_index_correct1 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (exists_sat_elems f s /\\ i > last_index f s))\n (ensures (not (f (index s i))))\nlet lemma_last_index_correct1 (#a:Type) (f:a -> bool) (s:seq a) (i:seq_index s):\n Lemma (requires (exists_sat_elems f s /\\ i > last_index f s))\n (ensures (not (f (index s i)))) =\n let j = last_index f s in\n if f (index s i) then\n lemma_filter_index_inv_map_monotonic f s j i\n else ()", "val eq_lemma: #a:eqtype -> #f:cmp a -> s1:ordset a f -> s2:ordset a f\n -> Lemma (requires (equal s1 s2))\n (ensures (s1 = s2))\n [SMTPat (equal s1 s2)]\nlet eq_lemma #a #f s1 s2 = same_members_means_eq s1 s2", "val sortWith_sorted: #a:eqtype -> f:(a -> a -> Tot int) -> l:list a ->\n Lemma (requires (total_order #a (bool_of_compare f)))\n (ensures ((sorted (bool_of_compare f) (sortWith f l)) /\\ (forall x. mem x l = mem x (sortWith f l))))\n (decreases (length l))\nlet rec sortWith_sorted #a f l = match l with\n | [] -> ()\n | pivot::tl ->\n let hi, lo = partition (bool_of_compare f pivot) tl in\n partition_length (bool_of_compare f pivot) tl;\n partition_mem_forall (bool_of_compare f pivot) tl;\n partition_mem_p_forall (bool_of_compare f pivot) tl;\n sortWith_sorted f lo;\n sortWith_sorted f hi;\n append_mem_forall (sortWith f lo) (pivot::sortWith f hi);\n append_sorted (bool_of_compare f) (sortWith f lo) (sortWith f hi) pivot", "val lemma_map_suffix (#a #b: Type) (f:a -> b) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires True)\n (ensures (map f (suffix s i) == suffix (map f s) i))\nlet lemma_map_suffix (#a #b: Type) (f:a -> b) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires True)\n (ensures (map f (suffix s i) == suffix (map f s) i)) =\n let ms = map f (suffix s i) in\n let sm = suffix (map f s) i in\n assert(equal ms sm);\n ()", "val splitAt_incr_lem (#a:Type) (n:nat) (l:list a) :\n Lemma\n (requires (n < List.Tot.length l))\n (ensures (\n let _, l1 = List.Tot.splitAt n l in\n let _, l2 = List.Tot.splitAt (n+1) l in\n Cons? l1 /\\ Cons?.tl l1 == l2))\nlet splitAt_incr_lem #a n l =\n splitAt_eq_lem n l;\n splitAt_eq_lem (n+1) l;\n let l1, l2 = List.Tot.splitAt n l in\n let l3, l4 = List.Tot.splitAt (n+1) l in\n assert(Cons? l2);\n let x :: l2' = l2 in\n List.Tot.append_l_cons x l2' l1;\n assert(List.Tot.append l1 (x :: l2') == List.Tot.append (List.Tot.append l1 [x]) l2');\n List.Tot.append_assoc l1 [x] l2';\n List.Tot.append_length l1 [x];\n assert_norm(List.Tot.length [x] = 1);\n assert(List.Tot.length (List.Tot.append l1 [x]) = List.Tot.length l3);\n assert(List.Tot.append l1 l2 == l);\n assert(List.Tot.append (List.Tot.append l1 [x]) l2' == l);\n assert(List.Tot.append l3 l4 == l);\n assert(List.Tot.length (List.Tot.append l1 [x]) = n+1);\n List.Tot.append_length_inv_head (List.Tot.append l1 [x]) l2' l3 l4", "val lemma_map_prefix (#a #b: Type) (f:a -> b) (s:seq a) (i: seq_index s):\n Lemma (requires True)\n (ensures (map f (prefix s i) == prefix (map f s) i))\nlet lemma_map_prefix (#a #b: Type) (f:a -> b) (s:seq a) (i: seq_index s):\n Lemma (requires True)\n (ensures (map f (prefix s i) == prefix (map f s) i)) =\n let mp = map f (prefix s i) in\n let pm = prefix (map f s) i in\n assert(equal mp pm);\n ()", "val index_map2i_lemma (#a:Type) (#b:Type) (#c:Type) (#len:flen) (f:(i:nat{i < len} -> a -> b -> c)) (s1:ntuple a len) (s2:ntuple b len) (i:nat{i < len}) :\n Lemma (index (map2i #a #b #c #len f s1 s2) i == f i (index s1 i) (index s2 i))\n [SMTPat (index (map2i #a #b #c #len f s1 s2) i)]\nlet index_map2i_lemma #a #b #c #len f s1 s2 i =\n createi_lemma len (fun i -> f i (index s1 i) (index s2 i)) i", "val lemma_slice_first_in_append: #a:Type -> s1:seq a -> s2:seq a -> i:nat{i <= length s1} -> Lemma\n (ensures (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)))\nlet lemma_slice_first_in_append = lemma_slice_first_in_append'", "val lemma_filter_maps_correct2 (#a:Type) (f:a -> bool) (s: seq a) (i: seq_index (filter f s)):\n Lemma (requires(True))\n (ensures (filter_index_inv_map f s (filter_index_map f s i) = i))\n [SMTPat (filter_index_map f s i)]\nlet lemma_filter_maps_correct2 (#a:Type) (f:a -> bool) (s: seq a) (i: seq_index (filter f s)):\n Lemma (filter_index_inv_map f s (filter_index_map f s i) = i) =\n let j = filter_index_map f s i in\n let i' = filter_index_inv_map f s j in\n let j' = filter_index_map f s i' in\n lemma_filter_maps_correct f s j;\n assert(j = j');\n if i < i' then\n lemma_filter_index_map_monotonic f s i i'\n else if i > i' then\n lemma_filter_index_map_monotonic f s i' i\n else ()", "val lemma_ordering_hi_cons: #a:eqtype -> f:tot_ord a -> s:seq a -> back:nat -> len:nat{back < len && len <= length s} -> pv:a\n -> Lemma (requires ((forall y. mem y (slice s (back + 1) len) ==> f pv y) /\\ f pv (index s back)))\n (ensures ((forall y. mem y (slice s back len) ==> f pv y)))\nlet lemma_ordering_hi_cons #_ f s back len pv =\n cut (equal (slice s back len) (append (create 1 (index s back)) (slice s (back + 1) len)));\n lemma_mem_append (create 1 (index s back)) (slice s (back + 1) len)", "val lemma_filter_maps_correct (#a:Type) (f:a -> bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter_index_map f s (filter_index_inv_map f s i) = i))\nlet lemma_filter_maps_correct (#a:Type) (f:a -> bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter_index_map f s (filter_index_inv_map f s i) = i)) =\n lemma_filter_maps_aux f s i", "val lemma_exists_prefix_implies_exists (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (exists_sat_elems f (prefix s i)))\n (ensures (exists_sat_elems f s))\n [SMTPat (exists_sat_elems f (prefix s i))]\nlet lemma_exists_prefix_implies_exists (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (exists_sat_elems f (prefix s i)))\n (ensures (exists_sat_elems f s)) =\n let s' = prefix s i in\n let li = last_index f s' in\n lemma_last_index_correct2 f s li", "val sorted_merge (#t: _) {| _: ordered t |} (a b: list t)\n : Lemma (requires sorted #t a /\\ sorted #t b) (ensures sorted (merge #t a b))\nlet rec sorted_merge #t {| _ : ordered t |} (a b: list t):\n Lemma (requires sorted #t a /\\ sorted #t b) (ensures sorted (merge #t a b))\n= match a, b with\n | ta::qa, tb::qb -> if (leq ta tb)\n then sorted_merge #t qa b\n else (sorted_merge #t a qb; total_order ta tb)\n | _ -> ()", "val lemma_split3_r_hd (#t: Type) (l: list t) (i: nat{i < length l})\n : Lemma\n (ensures\n (let a, b, c = split3 l i in\n lemma_split3_length l i;\n length c > 0 ==> i + 1 < length l /\\ hd c == index l (i + 1)))\nlet rec lemma_split3_r_hd (#t:Type) (l:list t) (i:nat{i < length l}) :\n Lemma\n (ensures (let a, b, c = split3 l i in\n lemma_split3_length l i;\n length c > 0 ==> i + 1 < length l /\\ hd c == index l (i + 1))) =\n match i with\n | 0 -> ()\n | _ -> lemma_split3_r_hd (tl l) (i - 1)", "val lemma_disjoint_union_subset (#a:eqtype) (#f:cmp a) (s1:ordset a f) (s2:ordset a f)\n : Lemma (requires (~ (s1 == empty) /\\ ~ (s2 == empty) /\\ intersect s1 s2 == empty))\n (ensures (strict_subset s1 (union s1 s2) /\\ strict_subset s2 (union s1 s2)))\n [SMTPatOr [[SMTPat (strict_subset s1 (union s1 s2))]; [SMTPat (strict_subset s2 (union s1 s2))]]]\nlet lemma_disjoint_union_subset #_ #_ s1 s2 = size_of_union s1 s2", "val seq_map_internal_associative (#a:Type) (#b:eqtype) (f:int->a->b) (s:seq a) (pivot:int{0 <= pivot /\\ pivot < length s}) :\n Lemma (let left,right = split s pivot in\n seq_map_i f s == seq_map_i_indexed f left 0 @| seq_map_i_indexed f right pivot )\nlet seq_map_internal_associative (#a:Type) (#b:eqtype) (f:int->a->b) (s:seq a) (pivot:int{0 <= pivot /\\ pivot < length s}) :\n Lemma (let left,right = split s pivot in\n seq_map_i f s == seq_map_i_indexed f left 0 @| seq_map_i_indexed f right pivot )\n =\n let left,right = split s pivot in\n let full_map = seq_map_i f s in\n let part1 = seq_map_i_indexed f left 0 in\n let part2 = seq_map_i_indexed f right pivot in\n assert (equal (seq_map_i f s) (seq_map_i_indexed f left 0 @| seq_map_i_indexed f right pivot));\n ()", "val index_gmapi_lemma (#a:Type) (#b:Type) (#len:flen) (f:(i:nat{i < len} -> a -> GTot b)) (s:ntuple a len) (i:nat{i < len}) :\n Lemma (index (gmapi #a #b #len f s) i == f i (index s i))\n [SMTPat (index (gmapi #a #b #len f s) i)]\nlet index_gmapi_lemma #a #b #len f s i =\n gcreatei_lemma len (fun i -> f i (index s i)) i", "val lemma_filter_prefix_comm (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter f (prefix s i) == prefix (filter f s) (filter_index_inv_map f s i)))\nlet lemma_filter_prefix_comm (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter f (prefix s i) == prefix (filter f s) (filter_index_inv_map f s i))) =\n lemma_filter_prefix f s (prefix s i)", "val union_lemma': #a:eqtype -> #f:cmp a -> s1:ordset a f -> s2:ordset a f\n -> Lemma (requires (True))\n (ensures (union s1 s2 = union' s1 s2))\nlet union_lemma' (#a:eqtype) #f s1 s2 =\n union_lemma s1 s2;\n eq_lemma (union s1 s2) (union' s1 s2)", "val lemma_filter_prefix_comm2 (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter f (prefix s (i+1)) == prefix (filter f s) (1 + (filter_index_inv_map f s i))))\nlet lemma_filter_prefix_comm2 (#a:Type) (f:a->bool) (s: seq a) (i:seq_index s):\n Lemma (requires (f (index s i)))\n (ensures (filter f (prefix s (i+1)) == prefix (filter f s) (1 + (filter_index_inv_map f s i)))) = \n rank_increases_by_atmost_one f s i;\n lemma_filter_prefix f s (prefix s (i + 1))", "val split3_index (#a: eqtype) (s0: seq a) (x: a) (s1: seq a) (j: nat)\n : Lemma (requires j < S.length (S.append s0 s1))\n (ensures\n (let s = S.append s0 (cons x s1) in\n let s' = S.append s0 s1 in\n let n = S.length s0 in\n if j < n then S.index s' j == S.index s j else S.index s' j == S.index s (j + 1)))\nlet split3_index (#a:eqtype) (s0:seq a) (x:a) (s1:seq a) (j:nat)\n : Lemma\n (requires j < S.length (S.append s0 s1))\n (ensures (\n let s = S.append s0 (cons x s1) in\n let s' = S.append s0 s1 in\n let n = S.length s0 in\n if j < n then S.index s' j == S.index s j\n else S.index s' j == S.index s (j + 1)\n ))\n = let n = S.length (S.append s0 s1) in\n if j < n then ()\n else ()", "val splitAt_eq_lem (#a:Type) (n:nat) (l:list a) :\n Lemma\n (requires (n <= List.Tot.length l))\n (ensures (\n let l1, l2 = List.Tot.splitAt n l in\n List.Tot.length l1 = n /\\\n List.Tot.length l2 = List.Tot.length l - n /\\\n l == List.Tot.append l1 l2))\n (decreases l)\nlet rec splitAt_eq_lem n l =\n match l with\n | [] -> ()\n | x :: l' ->\n if n = 0 then ()\n else splitAt_eq_lem (n-1) l'", "val lemma_filter_index_map_monotonic (#a:Type) (f:a -> bool) (s:seq a)\n(i:seq_index (filter f s))(j:seq_index (filter f s){j > i}):\nLemma (filter_index_map f s i < filter_index_map f s j)\nlet lemma_filter_index_map_monotonic (#a:Type) (f:a -> bool) (s:seq a)\n (i:seq_index (filter f s))(j:seq_index (filter f s){j > i}):\n Lemma (filter_index_map f s i < filter_index_map f s j) =\n lemma_proj_monotonic (filter f s) s (filter_is_proj_prf f s) i j", "val append_sorted: #a:eqtype\n -> f:(a -> a -> Tot bool)\n -> l1:list a{sorted f l1}\n -> l2:list a{sorted f l2}\n -> pivot:a\n -> Lemma (requires (total_order #a f\n /\\ (forall y. mem y l1 ==> not(f pivot y))\n /\\ (forall y. mem y l2 ==> f pivot y)))\n (ensures (sorted f (l1@(pivot::l2))))\n [SMTPat (sorted f (l1@(pivot::l2)))]\nlet rec append_sorted #a f l1 l2 pivot = match l1 with\n | [] -> ()\n | hd::tl -> append_sorted f tl l2 pivot", "val lemma_unsnoc_split3 (#t: Type) (l: list t) (i: nat{i < length l})\n : Lemma (requires (i <> length l - 1))\n (ensures\n (let xs, x = unsnoc l in\n i < length xs /\\\n (let a0, b0, c0 = split3 l i in\n let a1, b1, c1 = split3 xs i in\n a0 == a1 /\\ b0 == b1)))\nlet lemma_unsnoc_split3 (#t:Type) (l:list t) (i:nat{i < length l}) :\n Lemma\n (requires (i <> length l - 1))\n (ensures (\n let xs, x = unsnoc l in\n i < length xs /\\ (\n let a0, b0, c0 = split3 l i in\n let a1, b1, c1 = split3 xs i in\n a0 == a1 /\\ b0 == b1))) =\n let xs, x = unsnoc l in\n lemma_unsnoc_length l;\n let a0, b0, c0 = split3 l i in\n let a1, b1, c1 = split3 xs i in\n splitAt_length_total xs;\n // assert (fst (splitAt (length xs) xs) == xs);\n // assert (fst (splitAt (length xs) xs) == fst (splitAt (length xs) l));\n // assert (i+1 <= length xs);\n lemma_splitAt_shorten_left xs l (length xs) (i+1);\n // assert (fst (splitAt (i+1) xs) == fst (splitAt (i+1) l));\n lemma_split3_on_same_leftprefix l xs i", "val sort: #a:eqtype -> f:(a -> a -> Tot bool){total_order a f}\n -> s1:seq a\n -> Tot (s2:seq a{sorted f s2 /\\ permutation a s1 s2})\n (decreases (length s1))\nlet rec sort #a f s =\n if length s <= 1 then s\n else let lo, hi = partition f s 0 (length s - 1) in\n let pivot = head hi in\n\n let hi_tl = tail hi in\n let l = sort f lo in\n let h = sort f hi_tl in\n\n let result = Seq.append l (cons pivot h) in\n\n sorted_concat_lemma f l pivot h;\n lemma_append_count l (cons pivot h);\n cons_perm h hi;\n\n result", "val strict_subset_implies_diff_element (#a #f: _) (s1 s2: ordset a f)\n : Lemma (requires strict_subset s1 s2) (ensures exists x. (mem x s2 /\\ not (mem x s1)))\nlet rec strict_subset_implies_diff_element #a #f (s1 s2: ordset a f) \n : Lemma (requires strict_subset s1 s2)\n (ensures exists x. (mem x s2 /\\ not (mem x s1))) = \n match s1,s2 with\n | [], h::t -> ()\n | h1::t1, h2::t2 -> Classical.move_requires (mem_implies_f s1) h2;\n if h1=h2 then begin\n strict_subset_implies_diff_element #a #f t1 t2; \n set_props s2 \n end", "val merge'_sorted: #a:eqtype ->\n (l1:list a) ->\n (l2:list a) ->\n k:(a -> Tot int) ->\n Lemma (requires (sorted l1 k /\\ sorted l2 k))\n (ensures sorted (merge' l1 l2 k) k)\nlet rec merge'_sorted #a l1 l2 k = match (l1, l2) with\n | [], _ -> ()\n | _, [] -> ()\n | h1::tl1, h2::tl2 ->\n if k h1 <= k h2\n then (merge'_sorted tl1 l2 k)\n else (merge'_sorted l1 tl2 k)", "val lemma_as_set_disjoint_left (#a #f: _) (s1 s2: ordset a f)\n : Lemma (requires S.disjoint (as_set s1) (as_set s2)) (ensures intersect s1 s2 = empty)\nlet lemma_as_set_disjoint_left #a #f (s1 s2: ordset a f)\n : Lemma (requires S.disjoint (as_set s1) (as_set s2)) \n (ensures intersect s1 s2 = empty) = \n let mem_eq p q : Lemma (S.mem p (as_set q) <==> mem #a #f p q) = () in\n Classical.forall_intro_2 mem_eq", "val lemma_not_exists_prefix (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (not (exists_sat_elems f s)))\n (ensures (not (exists_sat_elems f (prefix s i))))\nlet lemma_not_exists_prefix (#a:Type) (f:a -> bool) (s:seq a) (i:nat{i <= length s}):\n Lemma (requires (not (exists_sat_elems f s)))\n (ensures (not (exists_sat_elems f (prefix s i)))) =\n let s' = prefix s i in\n if exists_sat_elems f s' then (\n let li' = last_index f s' in\n lemma_prefix_index s i li';\n lemma_last_index_correct2 f s li'\n )\n else ()", "val lemma_slice_cons: #a:eqtype -> s:seq a -> i:nat -> j:nat{i < j && j <= length s}\n -> Lemma (ensures (forall x. mem x (slice s i j) <==> (x = index s i || mem x (slice s (i + 1) j))))\nlet lemma_slice_cons #_ s i j =\n cut (equal (slice s i j) (append (create 1 (index s i)) (slice s (i + 1) j)));\n lemma_mem_append (create 1 (index s i)) (slice s (i + 1) j)", "val lemma_swap_splice : #a:Type -> s:seq a -> start:nat -> i:nat{start <= i} -> j:nat{i <= j} -> len:nat{j < len && len <= length s}\n -> Lemma\n (ensures (swap s i j == splice s start (swap s i j) len))\nlet lemma_swap_splice #_ s start i j len = cut (equal (swap s i j) (splice s start (swap s i j) len))", "val sorted_tl: #a:eqtype -> l:list a{Cons? l} -> k:(a -> Tot int) ->\n Lemma (requires (sorted l k))\n (ensures (sorted (Cons?.tl l) k))\nlet rec sorted_tl #a l k =\n match l with\n | [_] -> ()\n | a::b::xs -> sorted_tl (b::xs) k", "val lemma_filter_index_inv_map_monotonic (#a:Type) (f:a -> bool) (s: seq a)\n(i:seq_index s) (j: seq_index s {j > i}):\n Lemma (requires (f (index s i) /\\ f (index s j)))\n (ensures (filter_index_inv_map f s i < filter_index_inv_map f s j))\nlet lemma_filter_index_inv_map_monotonic (#a:Type) (f:a -> bool) (s: seq a)\n (i:seq_index s) (j: seq_index s {j > i}):\n Lemma (requires (f (index s i) /\\ f (index s j)))\n (ensures (filter_index_inv_map f s i < filter_index_inv_map f s j)) =\n lemma_filter_len_monotonic f (prefix s j) (i+1)", "val split3_index (#a: eqtype) (s0: seq a) (x: a) (s1: seq a) (j: nat)\n : Lemma (requires j < Seq.length (Seq.append s0 s1))\n (ensures\n (let s = Seq.append s0 (Seq.cons x s1) in\n let s' = Seq.append s0 s1 in\n let n = Seq.length s0 in\n if j < n then Seq.index s' j == Seq.index s j else Seq.index s' j == Seq.index s (j + 1)))\nlet split3_index (#a:eqtype) (s0:seq a) (x:a) (s1:seq a) (j:nat)\n : Lemma\n (requires j < Seq.length (Seq.append s0 s1))\n (ensures (\n let s = Seq.append s0 (Seq.cons x s1) in\n let s' = Seq.append s0 s1 in\n let n = Seq.length s0 in\n if j < n then Seq.index s' j == Seq.index s j\n else Seq.index s' j == Seq.index s (j + 1)\n ))\n = let n = Seq.length (Seq.append s0 s1) in\n if j < n then ()\n else ()", "val lemma_swap_permutes_aux_frag_eq: #a:Type -> s:seq a -> i:nat{i j:nat{i <= j && j i':nat -> j':nat{i' <= j' /\\ j'<=length s /\\\n (j < i' //high slice\n \\/ j' <= i //low slice\n \\/ (i < i' /\\ j' <= j)) //mid slice\n }\n -> Lemma (ensures (slice s i' j' == slice (swap s i j) i' j'\n /\\ slice s i (i + 1) == slice (swap s i j) j (j + 1)\n /\\ slice s j (j + 1) == slice (swap s i j) i (i + 1)))\nlet lemma_swap_permutes_aux_frag_eq #a s i j i' j' =\n cut (equal (slice s i' j') (slice (swap s i j) i' j'));\n cut (equal (slice s i (i + 1)) (slice (swap s i j) j (j + 1)));\n cut (equal (slice s j (j + 1)) (slice (swap s i j) i (i + 1)))", "val index_gmap_lemma (#a:Type) (#b:Type) (#len:flen) (f:(a -> GTot b)) (s:ntuple a len) (i:nat{i < len}) :\n Lemma (index (gmap #a #b #len f s) i == f (index s i))\n [SMTPat (index (gmap #a #b #len f s) i)]\nlet index_gmap_lemma #a #b #len f s i =\n gcreatei_lemma len (fun i -> f (index s i)) i", "val slice_seq_map_commute (#a #b:Type) (f:a -> b) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice (seq_map f s) i j == seq_map f (slice s i j))\nlet slice_seq_map_commute (#a #b:Type) (f:a -> b) (s:seq a) (i:nat) (j:nat{ i <= j /\\ j <= length s }) :\n Lemma (slice (seq_map f s) i j == seq_map f (slice s i j))\n =\n assert (equal (slice (seq_map f s) i j) (seq_map f (slice s i j)));\n ()", "val lemma_swap_permutes_aux: #a:eqtype -> s:seq a -> i:nat{i j:nat{i <= j && j x:a -> Lemma\n (requires True)\n (ensures (count x s = count x (swap s i j)))\nlet lemma_swap_permutes_aux #_ s i j x =\n if j=i\n then cut (equal (swap s i j) s)\n else begin\n let s5 = split_5 s i j in\n let frag_lo, frag_i, frag_mid, frag_j, frag_hi =\n index s5 0, index s5 1, index s5 2, index s5 3, index s5 4 in\n lemma_append_count_aux x frag_lo (append frag_i (append frag_mid (append frag_j frag_hi)));\n lemma_append_count_aux x frag_i (append frag_mid (append frag_j frag_hi));\n lemma_append_count_aux x frag_mid (append frag_j frag_hi);\n lemma_append_count_aux x frag_j frag_hi;\n\n let s' = swap s i j in\n let s5' = split_5 s' i j in\n let frag_lo', frag_j', frag_mid', frag_i', frag_hi' =\n index s5' 0, index s5' 1, index s5' 2, index s5' 3, index s5' 4 in\n\n lemma_swap_permutes_aux_frag_eq s i j 0 i;\n lemma_swap_permutes_aux_frag_eq s i j (i + 1) j;\n lemma_swap_permutes_aux_frag_eq s i j (j + 1) (length s);\n\n lemma_append_count_aux x frag_lo (append frag_j (append frag_mid (append frag_i frag_hi)));\n lemma_append_count_aux x frag_j (append frag_mid (append frag_i frag_hi));\n lemma_append_count_aux x frag_mid (append frag_i frag_hi);\n lemma_append_count_aux x frag_i frag_hi\n end", "val lemma_splitAt (#t: Type) (l l1 l2: list t) (n: nat{n <= length l})\n : Lemma (splitAt n l == (l1, l2) <==> l == l1 @ l2 /\\ length l1 = n)\nlet lemma_splitAt (#t: Type) (l l1 l2:list t) (n:nat{n <= length l}) :\n Lemma (splitAt n l == (l1, l2) <==> l == l1 @ l2 /\\ length l1 = n) =\n lemma_splitAt_append n l;\n lemma_append_splitAt l1 l2", "val lemma_slice_first_in_append' (#a: Type) (s1 s2: seq a) (i: nat{i <= length s1})\n : Lemma\n (ensures\n (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)\n )) (decreases (length s1))\nlet rec lemma_slice_first_in_append' (#a:Type) (s1:seq a) (s2:seq a)\n (i:nat{i <= length s1})\n: Lemma\n (ensures (equal (slice (append s1 s2) i (length (append s1 s2))) (append (slice s1 i (length s1)) s2)))\n (decreases (length s1))\n= if i = 0 then ()\n else lemma_slice_first_in_append' (tail s1) s2 (i - 1)", "val lemma_splitAt_fst_length (#a: Type) (n: nat) (l: list a)\n : Lemma (requires (n <= length l)) (ensures (length (fst (splitAt n l)) = n))\nlet rec lemma_splitAt_fst_length (#a: Type) (n: nat) (l: list a) :\n Lemma\n (requires (n <= length l))\n (ensures (length (fst (splitAt n l)) = n)) =\n match n, l with\n | 0, _ -> ()\n | _, [] -> ()\n | _, _ :: l' -> lemma_splitAt_fst_length (n - 1) l'", "val split (#a: _) (s: seq a) (i: nat{i <= length s}) : seq a & seq a\nlet split #a (s:seq a) (i:nat{ i <= length s})\n : seq a & seq a\n = take s i,\n drop s i", "val lemma_intersect_symmetric (#a:eqtype) (#f:cmp a) (s1:ordset a f) (s2:ordset a f)\n : Lemma (requires True) (ensures (intersect s1 s2 == intersect s2 s1))\n [SMTPatOr [[SMTPat (intersect s1 s2)]; [SMTPat (intersect s2 s1)]]]\nlet lemma_intersect_symmetric = intersect_is_symmetric", "val lemma_count_slice: #a:eqtype -> s:seq a -> i:nat{i<=length s} -> Lemma\n (requires True)\n (ensures (forall x. count x s = count x (slice s 0 i) + count x (slice s i (length s))))\nlet lemma_count_slice #_ s i =\n cut (equal s (append (slice s 0 i) (slice s i (length s))));\n lemma_append_count (slice s 0 i) (slice s i (length s))", "val split (#a: Type) (s: seq a) (i: nat{(0 <= i /\\ i <= length s)}) : Tot (seq a * seq a)\nlet split (#a:Type) (s:seq a) (i:nat{(0 <= i /\\ i <= length s)}) : Tot (seq a * seq a)\n = slice s 0 i, slice s i (length s)", "val lemma_exists_sat_elems_exists (#a:Type) (f:a -> bool) (s:seq a)\n : Lemma (exists_sat_elems f s <==> (exists (i:seq_index s). f (Seq.index s i)))\nlet lemma_exists_sat_elems_exists (#a:Type) (f:a \u2192 bool) (s:seq a)\n : Lemma (exists_sat_elems f s <==> (\u2203 (i:seq_index s). f (Seq.index s i)))\n = if length (filter f s) = 0 \n then lemma_filter_all_not f s", "val lem_upd_spliced (#a: _) (l: nat) (s1 s2: S.seq a) (i: nat)\n : Lemma (requires S.length s1 == l /\\ S.length s2 == l /\\ 0 <= i /\\ i < l)\n (ensures\n S.upd ((stake i s1) `S.append` (sdrop i s2)) i (S.index s1 i) ==\n ((stake (i + 1) s1) `S.append` (sdrop (i + 1) s2)))\nlet lem_upd_spliced #a (l:nat) (s1 s2 : S.seq a) (i : nat)\n : Lemma\n (requires S.length s1 == l /\\ S.length s2 == l /\\ 0 <= i /\\ i < l )\n (ensures\n S.upd (stake i s1 `S.append` sdrop i s2) i (S.index s1 i) ==\n (stake (i+1) s1 `S.append` sdrop (i+1) s2))\n = assert (S.equal (S.upd (stake i s1 `S.append` sdrop i s2) i (S.index s1 i))\n (stake (i+1) s1 `S.append` sdrop (i+1) s2));\n ()", "val lemma_tail_slice: #a:Type -> s:seq a -> i:nat -> j:nat{i < j && j <= length s}\n -> Lemma\n (requires True)\n (ensures (tail (slice s i j) == slice s (i + 1) j))\n [SMTPat (tail (slice s i j))]\nlet lemma_tail_slice #_ s i j =\n cut (equal (tail (slice s i j)) (slice s (i + 1) j))", "val elim_of_list': #a:Type ->\n i:nat ->\n s:seq a ->\n l:list a ->\n Lemma\n (requires (\n List.Tot.length l + i = length s /\\\n i <= length s /\\\n slice s i (length s) == seq_of_list l))\n (ensures (\n explode_and i s l))\nlet elim_of_list' = elim_of_list''", "val lemma_idx2fidx_idem (#gs:_) (f: idxfn_t gs bool) (s: seq_t gs{flen f s = Seq.length s}) (i: seq_index s)\n : Lemma (ensures (f s i /\\ idx2fidx f s i = i))\nlet rec lemma_idx2fidx_idem (#gs:_) (f: idxfn_t gs bool) (s: seq_t gs{flen f s = Seq.length s}) (i: seq_index s)\n : Lemma (ensures (f s i /\\ idx2fidx f s i = i))\n (decreases (Seq.length s))\n = let j = Seq.length s - 1 in\n let s' = prefix s j in\n if i <> j then\n lemma_idx2fidx_idem f s' i", "val splice_refl : #a:Type -> s:seq a -> i:nat -> j:nat{i <= j && j <= length s}\n -> Lemma\n (ensures (s == splice s i s j))\nlet splice_refl #_ s i j = cut (equal s (splice s i s j))", "val lemma_filter_exists (#a:Type) (f:a -> bool) (s:seq a):\nLemma (requires (exists (i:seq_index s). f (index s i)))\n (ensures (length (filter f s) > 0))\nlet lemma_filter_exists (#a:Type) (f:a -> bool) (s:seq a):\n Lemma (requires (exists (i:seq_index s). f (index s i)))\n (ensures (length (filter f s) > 0)) =\n if length (filter f s) = 0\n then lemma_filter_all_not f s", "val index_map2_lemma (#a:Type) (#b:Type) (#c:Type) (#len:flen) (f:a -> b -> c) (s1:ntuple a len) (s2:ntuple b len) (i:nat{i < len}) :\n Lemma (index (map2 #a #b #c #len f s1 s2) i == f (index s1 i) (index s2 i))\n [SMTPat (index (map2 #a #b #c #len f s1 s2) i)]\nlet index_map2_lemma #a #b #c #len f s1 s2 i =\n createi_lemma len (fun i -> f (index s1 i) (index s2 i)) i", "val lemma_ordering_lo_snoc: #a:eqtype -> f:tot_ord a -> s:seq a -> i:nat -> j:nat{i <= j && j < length s} -> pv:a\n -> Lemma (requires ((forall y. mem y (slice s i j) ==> f y pv) /\\ f (index s j) pv))\n (ensures ((forall y. mem y (slice s i (j + 1)) ==> f y pv)))\nlet lemma_ordering_lo_snoc #_ f s i j pv =\n cut (equal (slice s i (j + 1)) (append (slice s i j) (create 1 (index s j))));\n lemma_mem_append (slice s i j) (create 1 (index s j))", "val lemma_splitAt_fst_length (#a: Type) (n: nat) (l: list a)\n : Lemma (requires (n <= length l)) (ensures (length (fst (FLT.splitAt n l)) = n))\nlet rec lemma_splitAt_fst_length (#a:Type) (n:nat) (l:list a) :\n Lemma\n (requires (n <= length l))\n (ensures (length (fst (FLT.splitAt n l)) = n)) =\n match n, l with\n | 0, _ -> ()\n | _, [] -> ()\n | _, _ :: l' -> lemma_splitAt_fst_length (n - 1) l'", "val lemma_weaken_perm_right: #a:eqtype -> s1:seq a -> s2:seq a{length s1 = length s2} -> i:nat -> j:nat -> k:nat{i <= j /\\ j <= k /\\ k <= length s1}\n -> Lemma\n (requires (s1 == splice s2 i s1 j /\\ permutation a (slice s2 i j) (slice s1 i j)))\n (ensures (permutation a (slice s2 i k) (slice s1 i k)))\nlet lemma_weaken_perm_right #_ s1 s2 i j k =\n cut (equal (slice s2 i k) (append (slice s2 i j)\n (slice s2 j k)));\n cut (equal (slice s1 i k) (append (slice s1 i j)\n (slice s2 j k)));\n lemma_append_count (slice s2 i j) (slice s2 j k);\n lemma_append_count (slice s1 i j) (slice s2 j k)", "val lemma_index_is_nth: #a:Type -> s:seq a -> i:nat{i < length s} -> Lemma\n (requires True)\n (ensures (L.index (seq_to_list s) i == index s i))\nlet lemma_index_is_nth = lemma_index_is_nth'", "val lemma_map_index (#a #b: Type) (f:a -> b) (s:seq a) (i:seq_index s):\n Lemma (requires (True))\n (ensures (f (index s i) == index (map f s) i))\n [SMTPat (index (map f s) i)]\nlet lemma_map_index (#a #b: Type) (f:a -> b) (s:seq a) (i:seq_index s):\n Lemma (requires (True))\n (ensures (f (index s i) == index (map f s) i)) =\n lemma_map_index_aux f s i", "val partition_lemma: #a:eqtype -> f:(a -> Tot bool) -> l:list a ->\n Lemma (requires True)\n (ensures (let (hi, lo) = partition f l in\n length l = length hi + length lo\n /\\ (forall x.{:pattern f x} (mem x hi ==> f x)\n /\\ (mem x lo ==> ~(f x)))\n /\\ (forall x.{:pattern (count x hi) \\/ (count x lo)}\n (count x l = count x hi + count x lo))))\n [SMTPat (partition f l)]\nlet rec partition_lemma #a f l = match l with\n | [] -> ()\n | hd::tl -> partition_lemma f tl", "val map_seq_index (#a #b:Type) (f:a -> Tot b) (s:Seq.seq a) (i:nat{i < Seq.length s})\n : Lemma (ensures (map_seq_len f s; Seq.index (map_seq f s) i == f (Seq.index s i)))\nlet rec map_seq_index #a #b f s i\n : Lemma (ensures (map_seq_len f s; Seq.index (map_seq f s) i == f (Seq.index s i))) (decreases Seq.length s)\n = map_seq_len f s;\n if Seq.length s = 0\n then ()\n else if i = 0\n then ()\n else map_seq_index f (tail s) (i-1)", "val seq_upd_seq_slice_left' (#t: Type) (s: Seq.seq t) (i: nat) (s': Seq.seq t) (j1 j2: nat)\n : Lemma (requires (i + Seq.length s' <= Seq.length s /\\ j1 <= j2 /\\ j2 <= i))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s j1 j2))\nlet seq_upd_seq_slice_left'\n (#t: Type)\n (s: Seq.seq t)\n (i: nat)\n (s' : Seq.seq t)\n (j1 j2: nat)\n: Lemma\n (requires (i + Seq.length s' <= Seq.length s /\\ j1 <= j2 /\\ j2 <= i))\n (ensures (Seq.slice (seq_upd_seq s i s') j1 j2 == Seq.slice s j1 j2))\n= seq_upd_seq_slice_left s i s';\n Seq.slice_slice (seq_upd_seq s i s') 0 i j1 j2", "val lemma_split3_index (#t: Type) (l: list t) (n: nat{n < length l})\n : Lemma (requires True)\n (ensures\n (let a, b, c = split3 l n in\n b == index l n))\nlet lemma_split3_index (#t:Type) (l:list t) (n:nat{n < length l}) :\n Lemma\n (requires True)\n (ensures (\n let a, b, c = split3 l n in\n b == index l n)) =\n lemma_splitAt_index_hd n l", "val i_seq_union_all_eq (#a: eqtype) (f: cmp a) (s: sseq a)\n : Lemma\n (seq2mset (i_seq (some_interleaving s)) == union_all #a #f (Zeta.SeqAux.map (seq2mset #a #f) s))\nlet i_seq_union_all_eq (#a:eqtype) (f:cmp a) (s: sseq a)\n : Lemma (seq2mset (i_seq (some_interleaving s)) == union_all #a #f (Zeta.SeqAux.map (seq2mset #a #f) s))\n = let lhs = seq2mset #a #f (i_seq (some_interleaving s)) in\n let rhs = union_all (Zeta.SeqAux.map (seq2mset #a #f) s) in\n introduce forall x. mem x lhs == mem x rhs\n with (\n Zeta.Interleave.i_seq_count #a s x;\n union_all_sum_count #a #f s x;\n seq2mset_mem #a #f (i_seq (some_interleaving s)) x\n );\n eq_intro lhs rhs;\n eq_elim lhs rhs", "val lemma_is_prefix_of_slice\n (#a: Type0)\n (s1: seq a)\n (s2: seq a {s1 `is_prefix_of` s2})\n (i: nat)\n (j: nat{j >= i /\\ j <= Seq.length s1})\n : Lemma (requires True)\n (ensures (Seq.slice s1 i j == Seq.slice s2 i j))\n [SMTPat (s1 `is_prefix_of` s2); SMTPat (Seq.slice s1 i j); SMTPat (Seq.slice s2 i j)]\nlet lemma_is_prefix_of_slice\n (#a:Type0) (s1:seq a) (s2:seq a{s1 `is_prefix_of` s2}) (i:nat) (j:nat{j >= i /\\ j <= Seq.length s1})\n :Lemma (requires True)\n (ensures (Seq.slice s1 i j == Seq.slice s2 i j))\n\t [SMTPat (s1 `is_prefix_of` s2); SMTPat (Seq.slice s1 i j); SMTPat (Seq.slice s2 i j)]\n = ArrayUtils.lemma_is_prefix_of_slice s1 s2 i j", "val lemma_seq_refine_len (#a:Type) (f:a->bool) (s:seq a{all f s}):\nLemma (requires True)\n (ensures (length (seq_refine f s) = length s))\n [SMTPat (seq_refine f s)]\nlet lemma_seq_refine_len = lemma_seq_refine_len_aux" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_split" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Frodo.Pack.fst", "name": "Hacl.Impl.Frodo.Pack.lemma_split" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.sorted_concat_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_seq_sortwith_correctness" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.union_sort_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.sorted_concat_lemma'" }, { "project_name": "FStar", "file_name": "Platform.Bytes.fst", "name": "Platform.Bytes.lemma_split" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.sorted_feq" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.sorted_feq'" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_first_index_correct2" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_seq_refine_equal" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_seq_refine_equal_aux" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt_reindex_left" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.lemma_strict_subset_size" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_correct1_aux" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.split_eq" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Lemmas.fst", "name": "Hacl.Hash.Lemmas.init_next" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_unique" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_last_index_prefix" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_correct1" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_mapi_lemma" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_last_index_correct2" }, { "project_name": "FStar", "file_name": "QuickSort.List.fst", "name": "QuickSort.List.sorted_app_lemma" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt_shorten_left" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_first_index_correct1" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_map_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_seq_of_list_sorted" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_unique_aux" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.lemma_strict_subset_exists_diff" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt_reindex_right" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.sort_lseq" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_len_monotonic" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_prefix_suffix" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_last_index_correct1" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.eq_lemma" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.sortWith_sorted" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_map_suffix" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.splitAt_incr_lem" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_map_prefix" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_map2i_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_first_in_append" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_maps_correct2" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_ordering_hi_cons" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_maps_correct" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_exists_prefix_implies_exists" }, { "project_name": "FStar", "file_name": "LeftistHeap.fst", "name": "LeftistHeap.sorted_merge" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_split3_r_hd" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.lemma_disjoint_union_subset" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.seq_map_internal_associative" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_gmapi_lemma" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_prefix_comm" }, { "project_name": "FStar", "file_name": "FStar.OrdSetProps.fst", "name": "FStar.OrdSetProps.union_lemma'" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_prefix_comm2" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Permutation.fst", "name": "FStar.Sequence.Permutation.split3_index" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.splitAt_eq_lem" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_index_map_monotonic" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_sorted" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_unsnoc_split3" }, { "project_name": "FStar", "file_name": "QuickSort.Seq.fst", "name": "QuickSort.Seq.sort" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.strict_subset_implies_diff_element" }, { "project_name": "FStar", "file_name": "MergeSort2.fst", "name": "MergeSort2.merge'_sorted" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.lemma_as_set_disjoint_left" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_not_exists_prefix" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_cons" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_splice" }, { "project_name": "FStar", "file_name": "GenericSort.fst", "name": "GenericSort.sorted_tl" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_index_inv_map_monotonic" }, { "project_name": "FStar", "file_name": "FStar.Seq.Permutation.fst", "name": "FStar.Seq.Permutation.split3_index" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes_aux_frag_eq" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_gmap_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.slice_seq_map_commute" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_swap_permutes_aux" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_splitAt" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_slice_first_in_append'" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.lemma_splitAt_fst_length" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Util.fst", "name": "FStar.Sequence.Util.split" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.lemma_intersect_symmetric" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_count_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.split" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_exists_sat_elems_exists" }, { "project_name": "steel", "file_name": "MSort.SeqLemmas.fst", "name": "MSort.SeqLemmas.lem_upd_spliced" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_tail_slice" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.elim_of_list'" }, { "project_name": "zeta", "file_name": "Zeta.IdxFn.fst", "name": "Zeta.IdxFn.lemma_idx2fidx_idem" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.splice_refl" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_filter_exists" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.index_map2_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_ordering_lo_snoc" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Base.fst", "name": "FStar.Sequence.Base.lemma_splitAt_fst_length" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_weaken_perm_right" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_index_is_nth" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_map_index" }, { "project_name": "FStar", "file_name": "QuickSort.List.fst", "name": "QuickSort.List.partition_lemma" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.map_seq_index" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.seq_upd_seq_slice_left'" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Properties.fst", "name": "FStar.List.Pure.Properties.lemma_split3_index" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.SSeq.fst", "name": "Zeta.MultiSet.SSeq.i_seq_union_all_eq" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.lemma_is_prefix_of_slice" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_seq_refine_len" } ], "selected_premises": [ "FStar.Seq.Sorted.sorted_sorted_pred_lemma", "FStar.Seq.Sorted.sorted_pred_sorted_lemma", "FStar.Seq.Sorted.sorted_slice_lemma", "FStar.Seq.Sorted.intro_sorted_pred", "FStar.Seq.Sorted.sorted_pred_cons_lemma", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "Prims.min", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "Prims.abs", "Prims.pure_post", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.all_post_h", "FStar.Pervasives.all_post_h'", "Prims.pure_post'", "Prims.as_ensures", "Prims.purewp_id", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.all_return", "Prims.pure_trivial", "Prims.as_requires", "Prims.subtype_of", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.all_wp_h", "Prims.pure_stronger", "FStar.Pervasives.st_stronger", "Prims.l_True", "FStar.Pervasives.id", "Prims.__cache_version_number__", "Prims.pure_wp_monotonic", "Prims.pure_wp_monotonic0", "FStar.Pervasives.all_trivial", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.lift_div_exn", "Prims.pure_wp'", "Prims.pure_pre", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.st_post_h", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_stronger", "FStar.Pervasives.ex_pre", "FStar.Pervasives.ex_post", "FStar.Pervasives.st_trivial", "Prims.returnM", "Prims.op_Hat", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.ex_ite_wp", "Prims.l_False", "FStar.Pervasives.ex_post'", "FStar.Pervasives.st_pre_h", "Prims.pure_wp", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.ex_return", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.st_return", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.pure_return", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.st_bind_wp", "Prims.auto_squash", "Prims.pow2" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Seq.Sorted\n\nopen FStar.Seq\n\ntype sorted_pred (#a:eqtype) (f:tot_ord a) (s:seq a) : Type0 =\n forall (i j: (k:nat{k f (index s i) (index s j)\n\nval sorted_pred_tail :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a{length s > 0} ->\n Lemma (requires (sorted_pred #a f s)) (ensures (sorted_pred #a f (tail s)))\nlet sorted_pred_tail #a f s = ()\n\nval sorted_pred_sorted_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n Lemma (requires (sorted_pred f s)) (ensures (sorted #a f s == true)) (decreases (length s))\nlet rec sorted_pred_sorted_lemma #a f s =\n if length s <= 1 then ()\n else begin\n assert (f (index s 0) (index s 1)) ;\n sorted_pred_tail #a f s;\n sorted_pred_sorted_lemma #a f (tail s)\n end\n\nlet intro_sorted_pred (#a:eqtype) (f:tot_ord a) (s:seq a)\n ($g:(i:nat{i < length s} -> j:nat{j < length s} -> Lemma (requires (i <= j)) (ensures (f (index s i) (index s j)))))\n : Lemma (sorted_pred #a f s)\n= let aux (i j : (k:nat{k < length s})) (p:squash (i <= j)) : GTot (squash (f (index s i) (index s j))) =\n FStar.Squash.give_proof p ;\n g i j ;\n FStar.Squash.get_proof (f (index s i) (index s j))\n in\n FStar.Classical.forall_intro_2 (fun (i j:(k:nat{k < length s})) ->\n FStar.Classical.give_witness (FStar.Classical.arrow_to_impl (aux i j)) <: Lemma (i <= j ==> f (index s i) (index s j)))\n\nval sorted_pred_cons_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a{length s > 1} ->\n Lemma (requires (f (index s 0) (index s 1) /\\ sorted_pred #a f (tail s))) (ensures (sorted_pred #a f s))\nlet sorted_pred_cons_lemma #a f s =\n let aux (i j : (k:nat{k < length s})) : Lemma (requires (i <= j)) (ensures (f (index s i) (index s j))) =\n if i = 0 then\n if j = 0 then ()\n else assert (f (index s 0) (index (tail s) 0) /\\ f (index (tail s) 0) (index (tail s) (j-1)))\n else assert (f (index (tail s) (i - 1)) (index (tail s) (j - 1)))\n in\n intro_sorted_pred #a f s aux\n\nval sorted_sorted_pred_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n Lemma (requires (sorted #a f s == true)) (ensures (sorted_pred #a f s)) (decreases (length s))\nlet rec sorted_sorted_pred_lemma #a f s =\n if length s = 0 then ()\n else if length s = 1 then ()\n else (sorted_sorted_pred_lemma #a f (tail s) ; sorted_pred_cons_lemma #a f s)\n\nval sorted_pred_slice_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n j:nat{i <= j /\\ j <= length s} ->\n Lemma (requires (sorted_pred #a f s)) (ensures (sorted_pred #a f (slice s i j)))\nlet sorted_pred_slice_lemma #a f s i j = ()\n\nval sorted_slice_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n j:nat{i <= j /\\ j <= length s} ->\n Lemma (requires (sorted #a f s == true)) (ensures (sorted #a f (slice s i j) == true))\nlet sorted_slice_lemma #a f s i j =\n sorted_sorted_pred_lemma #a f s ;\n sorted_pred_slice_lemma #a f s i j ;\n sorted_pred_sorted_lemma #a f (slice s i j)\n\nval sorted_split_lemma :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n Lemma (requires (sorted #a f s == true))\n (ensures (let s1, s2 = split s i in sorted #a f s1 == true /\\ sorted #a f s2 == true))", "sketch": [ "Step 1: We want to prove that if the sequence `s` is sorted according to the total order `f`, then after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to the same total order `f`.\n\nStep 2: We start by assuming that `s` is sorted according to the total order `f`. \n\nStep 3: We then use the `sorted_sorted_pred_lemma` to prove that `s` satisfies the `sorted_pred` property.\n\nStep 4: Next, we use the `sorted_pred_slice_lemma` to prove that the slice of `s` from index `i` to the end also satisfies the `sorted_pred` property.\n\nStep 5: Finally, we combine the results from step 3 and step 4 to show that after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to the total order `f`.", "Step 1: We will start by assuming that the sequence `s` is sorted according to the total order `f`. This assumption will be used to prove that after splitting the sequence `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to the same total order `f`.\n\nStep 2: We will use the assumption of the sortedness of `s` to show that the elements in `s1` are sorted according to the total order `f`.\n\nStep 3: Similarly, we will use the assumption of the sortedness of `s` to show that the elements in `s2` are also sorted according to the total order `f`.", "Step 1: We will first use the `sorted_sorted_pred_lemma` to ensure that the input sequence `s` is sorted. This will give us the assurance that the split point `i` divides the sequence into two sorted subsequences `s1` and `s2`.\n\nStep 2: Next, we will use the `sorted_pred_slice_lemma` to ensure that both `s1` and `s2` are sorted subsequences of the original sequence `s`.\n\nStep 3: Finally, we will combine the results from Step 1 and Step 2 to prove that the split sequence `s1` and `s2` are both sorted.", "Step 1: We want to prove that if the sequence `s` is sorted according to the total order `f`, then after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to `f`.\nStep 2: We will use the `sorted_sorted_pred_lemma` to show that `s` is sorted according to `f`.\nStep 3: Then, we will use the `sorted_pred_slice_lemma` to show that the sorted property is preserved when we slice `s` into `s1` and `s2`.\nStep 4: Finally, we will combine the results from steps 2 and 3 to prove that both `s1` and `s2` are sorted according to `f`.", "Step 1: We need to prove that if the sequence `s` is sorted according to the total order `f`, then splitting `s` at index `i` into subsequences `s1` and `s2` will result in both `s1` and `s2` being sorted according to the same total order `f`.\nStep 2: We will first use the `sorted_sorted_pred_lemma` to establish that `s` is sorted according to `f`.\nStep 3: Then, we will use the `sorted_pred_slice_lemma` to show that slicing `s` at index `i` into `s1` and `s2` preserves the sorted property according to `f`.\nStep 4: Finally, we will combine the results from step 2 and step 3 to conclude that both `s1` and `s2` are sorted according to the total order `f`.", "Step 1: We need to prove that if the sequence `s` is sorted according to the total order `f`, then after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to `f`.\n\nStep 2: We will use the `sorted_sorted_pred_lemma` to prove that `s` is sorted according to `f`.\n\nStep 3: Then we will use the `sorted_pred_slice_lemma` to prove that the sequences `s1` and `s2` resulting from the split are also sorted according to `f`.", "Step 1: We want to prove that if the sequence `s` is sorted according to the total order `f`, then after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to `f`.\n\nStep 2: We start by assuming that `s` is sorted according to `f`. Then we use the `sorted_sorted_pred_lemma` to prove that `s` satisfies the `sorted_pred` property.\n\nStep 3: Next, we use the `sorted_pred_slice_lemma` to prove that after splitting `s` at index `i`, the resulting sequences `s1` and `s2` satisfy the `sorted_pred` property.\n\nStep 4: Finally, we use the `sorted_pred_sorted_lemma` to conclude that `s1` and `s2` are sorted according to `f`.", "Step 1: We want to prove that if the sequence `s` is sorted according to the total order `f`, then after splitting `s` at index `i`, the resulting sequences `s1` and `s2` are also sorted according to `f`.\n\nStep 2: We start by assuming that `s` is sorted according to `f`. Then we use the `sorted_sorted_pred_lemma` to prove that `s` satisfies the `sorted_pred` property.\n\nStep 3: Next, we use the `sorted_pred_slice_lemma` to prove that after splitting `s` at index `i`, the resulting slices `s1` and `s2` also satisfy the `sorted_pred` property.\n\nStep 4: Finally, we use the `sorted_pred_sorted_lemma` to conclude that `s1` and `s2` are indeed sorted according to `f`.", "Step 1: We will start by assuming that the sequence `s` is sorted according to the total order `f`. This assumption is represented as `sorted #a f s == true`.\n\nStep 2: We will use the `split` function to split the sequence `s` at index `i` into two subsequences `s1` and `s2`.\n\nStep 3: We need to prove that both `s1` and `s2` are also sorted according to the total order `f`. This means we need to show that `sorted #a f s1 == true` and `sorted #a f s2 == true`.", "Step 1: We will start by assuming that the sequence `s` is sorted according to the total order `f`. This assumption is captured by the `requires` clause of the lemma.\n\nStep 2: We will then split the sequence `s` at index `i` into two subsequences `s1` and `s2`. We will use the `split` function provided by the FStar.Seq module to achieve this.\n\nStep 3: Next, we need to show that both `s1` and `s2` are also sorted according to the total order `f`. This will be captured by the `ensures` clause of the lemma, where we assert that `sorted #a f s1 == true` and `sorted #a f s2 == true`." ], "generated_solution": [ "let sorted_split_lemma #a f s i =\n sorted_sorted_pred_lemma #a f s ;\n let _ = sorted_pred_slice_lemma #a f s i (length s) in\n ()", "let sorted_split_lemma #a f s i =\n assume (sorted #a f s == true);\n let s1, s2 = split s i in\n assert (sorted #a f s1 == true /\\ sorted #a f s2 == true)", "let sorted_split_lemma #a f s i =\n sorted_sorted_pred_lemma #a f s ;\n let s1, s2 = split s i in\n sorted_pred_slice_lemma #a f s i (length s) ;\n sorted_pred_sorted_lemma #a f s1 ;\n sorted_pred_sorted_lemma #a f s2", "let sorted_split_lemma #a f s i =\n sorted_sorted_pred_lemma #a f s ;\n let s1, s2 = split s i in\n sorted_pred_slice_lemma #a f s i (length s) ;\n sorted_pred_sorted_lemma #a f s1 ;\n sorted_pred_sorted_lemma #a f s2", "let sorted_split_lemma #a f s i =\n sorted_sorted_pred_lemma #a f s ;\n sorted_pred_slice_lemma #a f s 0 i ;\n sorted_pred_slice_lemma #a f s i (length s)", "let sorted_split_lemma #a f s i =\n sorted_sorted_pred_lemma #a f s ;\n sorted_pred_slice_lemma #a f s 0 i ;\n sorted_pred_slice_lemma #a f s i (length s)", "let sorted_split_lemma #a f s i =\n assume (sorted #a f s == true);\n let s1, s2 = split s i in\n let _ = sorted_sorted_pred_lemma #a f s in\n let _ = sorted_pred_slice_lemma #a f s i (length s) in\n sorted_pred_sorted_lemma #a f s1;\n sorted_pred_sorted_lemma #a f s2", "let sorted_split_lemma #a f s i =\n assume (sorted #a f s == true);\n let s1, s2 = split s i in\n let _ = sorted_sorted_pred_lemma #a f s in\n let _ = sorted_pred_slice_lemma #a f s i (length s) in\n sorted_pred_sorted_lemma #a f s1;\n sorted_pred_sorted_lemma #a f s2", "val sorted_split_lemma_proof :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n Lemma (requires (sorted #a f s == true))\n (ensures (let s1, s2 = split s i in sorted #a f s1 == true /\\ sorted #a f s2 == true))\nlet sorted_split_lemma_proof #a f s i =\n assert (sorted #a f s == true);\n let s1, s2 = split s i in\n assert (sorted #a f s1 == true /\\ sorted #a f s2 == true);\n ()", "val sorted_split_lemma_proof :\n #a:eqtype ->\n f:tot_ord a ->\n s:seq a ->\n i:nat{i < length s} ->\n Lemma (requires (sorted #a f s == true))\n (ensures (let s1, s2 = split s i in sorted #a f s1 == true /\\ sorted #a f s2 == true))\nlet sorted_split_lemma_proof #a f s i =\n assert (sorted #a f s == true);\n let s1, s2 = split s i in\n assert (sorted #a f s1 == true);\n assert (sorted #a f s2 == true)" ] }, { "file_name": "IST.fst", "name": "IST.st_wp'", "opens_and_abbrevs": [ { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let st_wp' (a:Type) (s:Type0) = st_post s a -> st_pre s", "source_range": { "start_line": 96, "start_col": 0, "end_line": 96, "end_col": 57 }, "interleaved": false, "definition": "fun a s -> _: IST.st_post s a -> IST.st_pre s", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "IST.st_post", "IST.st_pre" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "a: Type -> s: Type0 -> Type", "prompt": "let st_wp' (a: Type) (s: Type0) =\n ", "expected_response": "st_post s a -> st_pre s", "source": { "project_name": "FStar", "file_name": "examples/indexed_effects/IST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "IST.fst", "checked_file": "dataset/IST.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "let st_pre (s:Type0) = s -> GTot Type0", "let st_post' (s:Type0) (a:Type) (pre:Type) = a -> (_:s{pre}) -> GTot Type0", "let st_post (s:Type0) (a:Type) = st_post_h' s a True", "let st_wp (a:Type) = s:Type0 -> st_post_h s a -> Tot (st_pre_h s)", "let st_return (a:Type) (x:a) (s:Type0) (post:st_post s a) \n = post x", "let st_bind_wp (a:Type) (b:Type)\n (wp1:st_wp a) (wp2:(a -> GTot (st_wp b)))\n (s:Type0) (post:st_post s b) (s0:s) \n = wp1 s (fun a s1 -> wp2 a s post s1) s0", "let st_if_then_else (a:Type) (p:Type)\n (wp_then:st_wp a) (wp_else:st_wp a)\n (s:Type0) (post:st_post_h s a) (s0:s) \n = l_ITE p (wp_then s post s0) (wp_else s post s0)", "let st_ite_wp (a:Type) (wp:st_wp a)\n (s:Type0) (post:st_post s a) (s0:s) \n = forall (k:st_post s a).\n\t (forall (x:a) (s1:s).{:pattern (guard_free (k x s1))} post x s1 ==> k x s1)\n\t ==> wp s k s0", "let st_stronger (a:Type) (wp1:st_wp a)\n (wp2:st_wp a)\n = forall (s:Type0) (post:st_post s a) (s0:s). wp1 s post s0 ==> wp2 s post s0", "let st_close_wp (a:Type) (b:Type)\n (wp:(b -> GTot (st_wp a)))\n (s:Type0) (post:st_post s a) (s0:s) \n = (forall (x:b). wp x s post s0)", "let st_trivial (a:Type) (wp:st_wp a) \n = forall s s0. wp s (fun r s1 -> True) s0", "let lift_div_st (a:Type) (wp:pure_wp a) \n (s:Type0) (p:st_post s a) (s0:s) \n = wp (fun x -> p x s0)" ], "closest": [ "val IMST.st_wp' = a: Type -> s: Type0 -> Type\nlet st_wp' (a:Type) (s:Type0) \n = st_post s a -> Tot (st_pre s)", "val IMSTsub.st_wp' = a: Type -> s: Type0 -> Type\nlet st_wp' (a:Type) (s:Type0) \n = st_post s a -> Tot (st_pre s)", "val IMST.st_wp = a: Type -> Type\nlet st_wp (a:Type) = s:Type0 -> (preorder s) -> st_post_h s a -> Tot (st_pre_h s)", "val IMSTsub.st_wp = a: Type -> Type\nlet st_wp (a:Type) = s:Type0 -> (preorder s) -> st_post_h s a -> Tot (st_pre_h s)", "val ImmutableST.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_post a -> Tot st_pre", "val AllocST.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_post a -> Tot st_pre", "val ImmutableST.ist_wp = state: Type -> a: Type -> Type\nlet ist_wp (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)", "val IMST.st_post' = s: Type0 -> a: Type -> pre: Type -> Type\nlet st_post' (s:Type0) (a:Type) (pre:Type) = a -> (_:s{pre}) -> GTot Type0", "val IMSTsub.st_post' = s: Type0 -> a: Type -> pre: Type -> Type\nlet st_post' (s:Type0) (a:Type) (pre:Type) = a -> (_:s{pre}) -> GTot Type0", "val IMST.st_post = s: Type0 -> a: Type -> Type\nlet st_post (s:Type0) (a:Type) = st_post_h' s a True", "val MRefST.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_post a -> Tot st_pre", "val AlgWP.st_wp = a: Type -> Type\nlet st_wp (a:Type) = wp:st_wp0 a{st_monotonic wp}", "val FStar.DM4F.IntST.wp = a: Type -> Type\nlet wp = STINT?.wp", "val IMSTsub.st_post = s: Type0 -> a: Type -> Type\nlet st_post (s:Type0) (a:Type) = st_post_h' s a True", "val AllocST.ist_wp = state: Type -> a: Type -> Type\nlet ist_wp (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)", "val ImmutableSTwHeaps.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_post a -> Tot st_pre", "val AlgHeap.st_wp = a: Type -> Type\nlet st_wp (a:Type) = wp:st_wp0 a{st_monotonic wp}", "val FStar.ST.st_wp = a: Type -> Type\nlet st_wp = gst_wp", "val FStar.HyperStack.ST.st_wp = a: Type -> Type\nlet st_wp = gst_wp", "val SnapshotST.mst_wp = a: Type -> Type\nlet mst_wp (a:Type) = mst_post a -> Tot mst_pre", "val IMST.st_pre = s: Type0 -> Type\nlet st_pre (s:Type0) = s -> GTot Type0", "val GMST.gmst_ite = s: Type -> a: Type -> wp: GMST.gmst_wp s a -> s0: s -> post: GMST.gmst_post s a s0 -> Type0\nlet gmst_ite (s:Type) (a:Type) (wp:gmst_wp s a) (s0:s) (post:gmst_post s a s0) =\n wp s0 post", "val AllocSTwHeaps.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_post a -> Tot st_pre", "val IMSTsub.st_pre = s: Type0 -> Type\nlet st_pre (s:Type0) = s -> GTot Type0", "val GMST.gmst_wp = s: Type -> a: Type -> Type\nlet gmst_wp (s:Type) (a:Type) = s0:s -> gmst_post s a s0 -> GTot Type0", "val AlgForAll.st_wp = a: Type -> Type\nlet st_wp (a:Type) = wp:st_wp0 a{st_monotonic wp}", "val FStar.HyperStack.ST.gst_wp = a: Type -> Type\nlet gst_wp (a:Type) = st_wp_h mem a", "val lift_wp (a: Type) (s: Type0) (wp: pure_wp a) : wp_t s a\nlet lift_wp (a:Type)\n (s:Type0)\n (wp:pure_wp a)\n : wp_t s a\n = F.on _ (fun (s0:s) (k:post_t s a) -> wp (fun a -> k (a, s0)))", "val IMST.st_ite = \n a: Type ->\n wp: IMST.st_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMST.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_ite (a:Type) (wp:st_wp a) (s:Type0) (rel:preorder s) (post:st_post s a) (s0:s) \n = forall (k:st_post s a).\n\t (forall (x:a) (s1:s).{:pattern (guard_free (k x s1))} post x s1 ==> k x s1)\n\t ==> wp s rel k s0", "val IMST.st_bind = \n a: Type ->\n b: Type ->\n wp1: IMST.st_wp a ->\n wp2: (_: a -> IMST.st_wp b) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMST.st_post s b ->\n s0: s\n -> Type0\nlet st_bind (a:Type) (b:Type)\n (wp1:st_wp a) (wp2: (a -> Tot (st_wp b))) \n (s:Type0) (rel:preorder s) (post:st_post s b) (s0:s) \n = wp1 s rel (fun x s1 -> wp2 x s rel post s1) s0", "val ImmutableSTwHeaps.ist_wp = state: Type -> a: Type -> Type\nlet ist_wp (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)", "val FStar.ST.gst_wp = a: Type -> Type\nlet gst_wp (a:Type) = st_wp_h heap a", "val AllocSTwHeaps.ist_wp = state: Type -> a: Type -> Type\nlet ist_wp (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)", "val idx (#a: Type) (s: Type0) (rel: preorder s) (wp: st_wp' a s) : st_wp a\nlet idx (#a:Type) (s:Type0) (rel:preorder s) (wp:st_wp' a s) : st_wp a\n = fun s' rel' post s0 -> s == s' /\\ (forall x y . rel x y ==> rel' x y) /\\ wp post s0", "val IMSTsub.st_ite = \n a: Type ->\n wp: IMSTsub.st_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMSTsub.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_ite (a:Type) (wp:st_wp a) (s:Type0) (rel:preorder s) (post:st_post s a) (s0:s) \n = forall (k:st_post s a).\n\t (forall (x:a) (s1:s).{:pattern (guard_free (k x s1))} post x s1 ==> k x s1)\n\t ==> wp s rel k s0", "val DijkstraStateMonad.wp_t = s: Type0 -> a: Type -> Type\nlet wp_t (s:Type0) (a:Type) = s ^-> (post_t s a -> Type0)", "val lift_wp (#a: Type) (#st: Type0) (w: pure_wp a) : wp st a\nlet lift_wp (#a:Type) (#st:Type0) (w:pure_wp a) : wp st a =\n elim_pure_wp_monotonicity_forall ();\n fun s0 p -> w (fun x -> p (x, s0))", "val lift_wp (#a: Type) (#st: Type0) (w: pure_wp a) : wp st a\nlet lift_wp (#a:Type) (#st:Type0) (w:pure_wp a) : wp st a =\n elim_pure_wp_monotonicity_forall ();\n fun s0 p -> w (fun x -> p (x, s0))", "val bind_wp (#a #b: Type) (#st: Type0) (wp_c: wp st a) (wp_f: (a -> wp st b)) : wp st b\nlet bind_wp (#a #b:Type) (#st:Type0) (wp_c:wp st a) (wp_f:a -> wp st b) : wp st b =\n fun s0 p -> wp_c s0 (fun (y, s1) -> wp_f y s1 p)", "val bind_wp (#a #b: Type) (#st: Type0) (wp_c: wp st a) (wp_f: (a -> wp st b)) : wp st b\nlet bind_wp (#a #b:Type) (#st:Type0)\n (wp_c:wp st a)\n (wp_f:a -> wp st b)\n : wp st b\n = fun s0 p ->\n wp_c s0\n //push the postcondition of the continuation\n //through the WP transformer of c\n (fun (y, s1) ->\n //push the postcondition p\n //through the WP transformer of f applied to the\n //result value and state of c\n wp_f y s1 p)", "val GTWP.wp = a: Type -> Type\nlet wp (a:Type) = pure_wp a", "val ImmutableST.st_post = a: Type -> Type\nlet st_post (a:Type) = a -> heap -> Type0", "val FStar.TwoLevelHeap.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_wp_h t a", "val FStar.Relational.Comp.st2_WP = a: Type -> Type\nlet st2_WP (a:Type) = st_wp_h heap2 a", "val return_wp (#a: Type) (#st: Type0) (x: a) : wp st a\nlet return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =\n fun s0 p -> p x s0", "val return_wp (#a: Type) (#st: Type0) (x: a) : wp st a\nlet return_wp (#a:Type) (#st:Type0) (x:a) : wp st a =\n fun s0 p -> p x s0", "val return_wp (#a: Type) (#st: Type0) (x: a) : wp st a\nlet return_wp (#a:Type) (#st:Type0) (x:a)\n : wp st a\n = fun s0 p -> p (x, s0)", "val return_wp (#a: Type) (#st: Type0) (x: a) : wp st a\nlet return_wp (#a:Type) (#st:Type0) (x:a) : wp st a = fun s0 p -> p (x, s0)", "val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b\nlet bind_wp (#a:Type) (#b:Type) (#st:Type0)\n (w1 : wp st a) (w2 : a -> wp st b) : wp st b =\n fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)", "val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b\nlet bind_wp (#a:Type) (#b:Type) (#st:Type0)\n (w1 : wp st a) (w2 : a -> wp st b) : wp st b =\n fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)", "val IMSTsub.st_bind = \n a: Type ->\n b: Type ->\n wp1: IMSTsub.st_wp a ->\n wp2: (_: a -> IMSTsub.st_wp b) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMSTsub.st_post s b ->\n s0: s\n -> Type0\nlet st_bind (a:Type) (b:Type)\n (wp1:st_wp a) (wp2: (a -> Tot (st_wp b))) \n (s:Type0) (rel:preorder s) (post:st_post s b) (s0:s) \n = wp1 s rel (fun x s1 -> wp2 x s rel post s1) s0", "val IMST.st_trivial = a: Type -> wp: IMST.st_wp a -> Prims.logical\nlet st_trivial (a:Type) (wp:st_wp a) \n = forall s rel s0. wp s rel (fun _ _ -> True) s0", "val AllocST.st_post = a: Type -> Type\nlet st_post (a:Type) = a -> heap -> Type0", "val as_wp (a st: Type) (pre: (st -> prop)) (post: (st -> a -> st -> prop)) : wp st a\nlet as_wp (a:Type) (st:Type) (pre: st -> prop) (post: st -> a -> st -> prop)\n : wp st a\n = fun s0 k -> pre s0 /\\ (forall x s1. post s0 x s1 ==> k (x, s1))", "val null_wp (a: Type) : pure_wp a\nlet null_wp (a:Type) : pure_wp a = as_pure_wp (fun p -> forall x. p x)", "val ite_wp (#a: Type) (#st: Type0) (wpf wpg: wp st a) (b: bool) : wp st a\nlet ite_wp (#a:Type) (#st:Type0) (wpf wpg:wp st a) (b:bool) : wp st a =\n fun s0 p -> (b ==> wpf s0 p) /\\ ((~b) ==> wpg s0 p)", "val GMST.mst_wp = s: Type -> a: Type -> rel: FStar.Preorder.relation s -> Type\nlet mst_wp (s:Type) (a:Type) (rel:relation s) = s0:s -> (a -> s1:s{rel s0 s1} -> Type0) -> Type0", "val MRefST.ist_wp = state: Type -> a: Type -> Type\nlet ist_wp (state:Type) (a:Type) = ist_post state a -> Tot (ist_pre state)", "val OPLSS2021.DijkstraMonads.wp = st: Type0 -> a: Type -> Type\nlet wp st a = w:wp0 st a{st_monotonic w}", "val IMST.st_if_then_else = \n a: Type ->\n p: Type0 ->\n wp_then: IMST.st_wp a ->\n wp_else: IMST.st_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMST.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_if_then_else (a:Type) (p:Type) \n (wp_then:st_wp a) (wp_else:st_wp a) \n (s:Type0) (rel:preorder s) (post:st_post s a) (s0:s)\n = l_ITE p (wp_then s rel post s0) (wp_else s rel post s0)", "val FStar.DM4F.IntStoreFixed.wp = a: Type -> Type\nlet wp = INT_STORE?.wp", "val IMST.st_close = \n a: Type ->\n b: Type ->\n wp: (_: b -> Prims.GTot (IMST.st_wp a)) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n p: IMST.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_close (a:Type) (b:Type) (wp:(b -> GTot (st_wp a))) \n (s:Type0) (rel:preorder s) (p:st_post s a) (s0:s) \n = forall x. wp x s rel p s0", "val lift_id_st_wp (#a #st: _) (w: ID5.wp a) : wp st a\nlet lift_id_st_wp #a #st (w : ID5.wp a) : wp st a =\n elim_pure_wp_monotonicity_forall ();\n fun s0 p -> w (fun x -> p x s0)", "val null (#a: _) : st_wp a\nlet null #a : st_wp a = fun s0 p -> forall r. p r", "val IMST.lift_div_imst = \n a: Type ->\n wp: Prims.pure_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMST.st_post s a ->\n s0: s\n -> Prims.pure_pre\nlet lift_div_imst (a:Type) (wp:pure_wp a) (s:Type0) \n (rel:preorder s) (post:st_post s a) (s0:s) \n = wp (fun x -> post x s0)", "val OPLSS2021.DijkstraMonads.wp0 = st: Type0 -> a: Type -> Type\nlet wp0 (st:Type0) (a:Type) = st -> (a & st -> Type) -> Type", "val IMST.st_stronger = a: Type -> wp1: IMST.st_wp a -> wp2: IMST.st_wp a -> Prims.logical\nlet st_stronger (a:Type) (wp1:st_wp a) (wp2:st_wp a) \n = forall (s:Type0) (rel:preorder s) (p:st_post s a) (s0:s) . wp1 s rel p s0 ==> wp2 s rel p s0", "val cut_wp (#a: Type) (w: wp a) (p: Type0) : wp a\nlet cut_wp (#a:Type) (w:wp a) (p:Type0) : wp a =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun post -> p /\\ (p ==> w post))", "val ImmutableSTwHeaps.st_post = a: Type -> Type\nlet st_post (a:Type) = a -> heap -> Type0", "val stronger : (#a:Type) -> st_wp a -> st_wp a -> Type0\nlet stronger w1 w2 = forall p s. w1 p s ==> w2 p s", "val stronger : (#a:Type) -> st_wp a -> st_wp a -> Type0\nlet stronger w1 w2 = forall p s. w1 p s ==> w2 p s", "val stronger : (#a:Type) -> st_wp a -> st_wp a -> Type0\nlet stronger w1 w2 = forall p s. w1 p s ==> w2 p s", "val IMSTsub.st_trivial = a: Type -> wp: IMSTsub.st_wp a -> Prims.logical\nlet st_trivial (a:Type) (wp:st_wp a) \n = forall s rel s0. wp s rel (fun _ _ -> True) s0", "val IMSTsub.st_if_then_else = \n a: Type ->\n p: Type0 ->\n wp_then: IMSTsub.st_wp a ->\n wp_else: IMSTsub.st_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMSTsub.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_if_then_else (a:Type) (p:Type) \n (wp_then:st_wp a) (wp_else:st_wp a) \n (s:Type0) (rel:preorder s) (post:st_post s a) (s0:s)\n = l_ITE p (wp_then s rel post s0) (wp_else s rel post s0)", "val lift_pure_wp (#a: Type) (wp: pure_wp a) : st_wp a\nlet lift_pure_wp (#a:Type) (wp : pure_wp a) : st_wp a =\n FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;\n fun s0 p -> wp (fun x -> p (x, s0))", "val lift_pure_wp (#a: Type) (wp: pure_wp a) : st_wp a\nlet lift_pure_wp (#a:Type) (wp : pure_wp a) : st_wp a =\n elim_pure_wp_monotonicity wp;\n fun s0 p -> wp (fun x -> p (x, s0))", "val lift_pure_wp (#a: Type) (wp: pure_wp a) : st_wp a\nlet lift_pure_wp (#a:Type) (wp : pure_wp a) : st_wp a =\n elim_pure_wp_monotonicity wp;\n fun s0 p -> wp (fun x -> p (x, s0))", "val Prims.pure_wp' = a: Type -> Type\nlet pure_wp' (a: Type) = pure_post a -> GTot pure_pre", "val null (#st #a: _) : wp st a\nlet null #st #a : wp st a =\n fun s0 p -> forall x s1. p x s1", "val null (#st #a: _) : wp st a\nlet null #st #a : wp st a =\n fun s0 p -> forall r. p r", "val null (#st #a: _) : wp st a\nlet null #st #a : wp st a =\n fun s0 p -> forall x s1. p x s1", "val ND.irepr = a: Type -> wp: ND.w a -> Type\nlet irepr (a : Type) (wp: w a) = dm a wp", "val AlgWP.repr = a: Type -> l: AlgWP.rwops -> w: AlgWP.st_wp a -> Type\nlet repr (a : Type) (l : rwops) (w: st_wp a) = c:(rwtree a l){w `stronger` interp_as_wp c}", "val IMSTsub.lift_div_imst = \n a: Type ->\n wp: Prims.pure_wp a ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMSTsub.st_post s a ->\n s0: s\n -> Prims.pure_pre\nlet lift_div_imst (a:Type) (wp:pure_wp a) (s:Type0) \n (rel:preorder s) (post:st_post s a) (s0:s) \n = wp (fun x -> post x s0)", "val FStar.Pervasives.ex_wp = a: Type -> Type\nlet ex_wp (a: Type) = ex_post a -> GTot ex_pre", "val interp_as_wp (#a: _) (t: rwtree a) : st_wp a\nlet rec interp_as_wp #a (t : rwtree a) : st_wp a =\n match t with\n | Return x -> return_wp x\n | Op Read _ k ->\n bind_wp read_wp (fun s -> interp_as_wp (k s))\n | Op Write s k ->\n bind_wp (write_wp s) (fun (o:unit) -> interp_as_wp (k o))", "val interp_as_wp (#a: _) (t: rwtree a) : st_wp a\nlet rec interp_as_wp #a (t : rwtree a) : st_wp a =\n match t with\n | Return x -> return_wp x\n | Op Read _ k ->\n bind_wp read_wp (fun s -> interp_as_wp (k s))\n | Op Write s k ->\n bind_wp (write_wp s) (fun (o:unit) -> interp_as_wp (k o))", "val stronger (#a: Type) (#st: Type0) (w1 w2: wp st a) : Type0\nlet stronger\n (#a:Type) (#st:Type0)\n (w1 w2 : wp st a)\n : Type0\n = forall s0 p. w1 s0 p ==> w2 s0 p", "val stronger (#a: Type) (#st: Type0) (w1 w2: wp st a) : Type0\nlet stronger\n (#a:Type) (#st:Type0)\n (w1 w2 : wp st a)\n : Type0\n = forall s0 p. w1 s0 p ==> w2 s0 p", "val stronger (#a: Type) (#st: Type0) (w1 w2: wp st a) : Type0\nlet stronger\n (#a:Type) (#st:Type0)\n (w1 w2 : wp st a)\n : Type0\n = forall s0 p. w1 s0 p ==> w2 s0 p", "val stronger (#a: Type) (#st: Type0) (w1 w2: wp st a) : Type0\nlet stronger\n (#a:Type) (#st:Type0)\n (w1 w2 : wp st a)\n : Type0\n = forall s0 p. w1 s0 p ==> w2 s0 p", "val IEXN.iex_wp = a: Type -> Type\nlet iex_wp (a:Type) = es:exns -> iex_post a -> GTot ex_pre", "val strengthen_wp (#a: Type) (w: wp a) (p: Type0) : wp a\nlet strengthen_wp (#a:Type) (w:wp a) (p:Type0) : wp a =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun post -> p /\\ w post)", "val IMST.st_return = a: Type -> x: a -> s: Type0 -> rel: FStar.Preorder.preorder s -> post: IMST.st_post s a -> s0: s\n -> Prims.logical\nlet st_return (a:Type) (x:a) (s:Type0) (rel:preorder s) (post:st_post s a) (s0:s)\n = forall v. v == x ==> post v s0", "val IMSTsub.st_close = \n a: Type ->\n b: Type ->\n wp: (_: b -> Prims.GTot (IMSTsub.st_wp a)) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n p: IMSTsub.st_post s a ->\n s0: s\n -> Prims.logical\nlet st_close (a:Type) (b:Type) (wp:(b -> GTot (st_wp a))) \n (s:Type0) (rel:preorder s) (p:st_post s a) (s0:s) \n = forall x. wp x s rel p s0", "val GMST.gmst_post = s: Type -> a: Type -> s0: s -> Type\nlet gmst_post (s:Type) (a:Type) (s0:s) = rel:relation s -> a -> s1:s{rel s0 s1} -> GTot Type0", "val ImmutableST.ist_post = state: Type -> a: Type -> Type\nlet ist_post (state:Type) (a:Type) = a -> state -> Type0", "val lift_pure_st_wp (#a #st: _) (w: pure_wp a) : wp st a\nlet lift_pure_st_wp #a #st (w : pure_wp a) : wp st a =\n FStar.Monotonic.Pure.elim_pure_wp_monotonicity w;\n let r = fun s0 p -> w (fun x -> p x s0) in\n r", "val FStar.Pervasives.st_wp_h = heap: Type -> a: Type -> Type\nlet st_wp_h (heap a: Type) = st_post_h heap a -> Tot (st_pre_h heap)", "val comp : (a:Type) -> (b:Type) -> (wp0:st_wp a) -> (wp1:st_wp b) -> Tot (st2_WP (rel a b))\nlet comp a b wp0 wp1 p h2 =\n wp0 (fun y0 h0 ->\n wp1 (fun y1 h1 -> p (R y0 y1) (R h0 h1))\n (R?.r h2))\n (R?.l h2)" ], "closest_src": [ { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_wp'" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_wp'" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_wp" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.st_wp" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.st_wp" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.ist_wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_post'" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_post'" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_post" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.st_wp" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.st_wp" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_post" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.ist_wp" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.st_wp" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.st_wp" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_wp" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.st_wp" }, { "project_name": "FStar", "file_name": "SnapshotST.fst", "name": "SnapshotST.mst_wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_pre" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_ite" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.st_wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_pre" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_wp" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.st_wp" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.gst_wp" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.lift_wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_ite" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_bind" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.ist_wp" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.gst_wp" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.ist_wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.idx" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_ite" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.wp_t" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.lift_wp" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.lift_wp" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.bind_wp" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.bind_wp" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.wp" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.st_post" }, { "project_name": "FStar", "file_name": "FStar.TwoLevelHeap.fst", "name": "FStar.TwoLevelHeap.st_wp" }, { "project_name": "FStar", "file_name": "FStar.Relational.Comp.fst", "name": "FStar.Relational.Comp.st2_WP" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.return_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.return_wp" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.return_wp" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.return_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.bind_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.bind_wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_bind" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_trivial" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.st_post" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.as_wp" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.null_wp" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.ite_wp" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.mst_wp" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.ist_wp" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_if_then_else" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntStoreFixed.fst", "name": "FStar.DM4F.IntStoreFixed.wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_close" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.lift_id_st_wp" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.null" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.lift_div_imst" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.wp0" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_stronger" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.cut_wp" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.st_post" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.stronger" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.stronger" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.stronger" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_trivial" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_if_then_else" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.lift_pure_wp" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.lift_pure_wp" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.lift_pure_wp" }, { "project_name": "FStar", "file_name": "prims.fst", "name": "Prims.pure_wp'" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.null" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.null" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.null" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.irepr" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.repr" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.lift_div_imst" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.ex_wp" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.interp_as_wp" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.interp_as_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.stronger" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.stronger" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.stronger" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.stronger" }, { "project_name": "FStar", "file_name": "IEXN.fst", "name": "IEXN.iex_wp" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.strengthen_wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_return" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_close" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_post" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.ist_post" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.lift_pure_st_wp" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.st_wp_h" }, { "project_name": "FStar", "file_name": "FStar.Relational.Comp.fst", "name": "FStar.Relational.Comp.comp" } ], "selected_premises": [ "IST.st_post", "IST.st_post'", "IST.st_pre", "IST.st_trivial", "IST.st_wp", "IST.st_return", "IST.st_stronger", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.st_pre_h", "IST.st_ite_wp", "FStar.Pervasives.st_post_h", "FStar.Pervasives.st_trivial", "IST.lift_div_st", "IST.st_bind_wp", "IST.st_if_then_else", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.st_return", "IST.st_close_wp", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.Native.fst", "FStar.Pervasives.all_post_h", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.Native.snd", "Prims.pure_wp'", "FStar.Pervasives.ex_pre", "Prims.as_requires", "Prims.pure_wp", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.all_stronger", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.all_post_h'", "Prims.pure_trivial", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_close_wp", "Prims.pure_post'", "Prims.pure_wp_monotonic0", "FStar.Pervasives.all_trivial", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.ex_post'", "Prims.as_ensures", "FStar.Pervasives.all_ite_wp", "Prims.purewp_id", "Prims.pure_stronger", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.lift_div_exn", "Prims.pure_pre", "Prims.pure_wp_monotonic", "FStar.Pervasives.all_return", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.dfst", "FStar.Pervasives.pure_return", "FStar.Pervasives.dsnd", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.ex_post", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.ex_ite_wp", "Prims.pure_post", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.ex_trivial", "Prims.op_Hat", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.id", "FStar.Pervasives.ex_bind_wp", "Prims.returnM", "Prims.auto_squash", "Prims.pow2", "Prims.abs", "Prims.__cache_version_number__", "FStar.Pervasives.ex_return", "Prims.min", "FStar.Pervasives.coerce_eq", "Prims.subtype_of", "Prims.l_True", "Prims.l_False" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule IST\n\n(*\n A proof-of-concept example of indexed effects (the state-indexed STATE effect) encoded using standard F* WP calculi\n*)\n\n\n(* The state-indexed STATE effect; defined explicitly due to the pi-types used in it *)\n\n//s is at universe level 0 because otherwise sub_effect complains about being too universe polymorphic\n\n\nlet st_pre (s:Type0) = s -> GTot Type0\nlet st_post' (s:Type0) (a:Type) (pre:Type) = a -> (_:s{pre}) -> GTot Type0\nlet st_post (s:Type0) (a:Type) = st_post_h' s a True\nlet st_wp (a:Type) = s:Type0 -> st_post_h s a -> Tot (st_pre_h s)\n\nunfold\nlet st_return (a:Type) (x:a) (s:Type0) (post:st_post s a)\n = post x\n\nunfold\nlet st_bind_wp (a:Type) (b:Type)\n (wp1:st_wp a) (wp2:(a -> GTot (st_wp b)))\n (s:Type0) (post:st_post s b) (s0:s)\n = wp1 s (fun a s1 -> wp2 a s post s1) s0\n\nunfold\nlet st_if_then_else (a:Type) (p:Type)\n (wp_then:st_wp a) (wp_else:st_wp a)\n (s:Type0) (post:st_post_h s a) (s0:s)\n = l_ITE p (wp_then s post s0) (wp_else s post s0)\n\nunfold\nlet st_ite_wp (a:Type) (wp:st_wp a)\n (s:Type0) (post:st_post s a) (s0:s)\n = forall (k:st_post s a).\n\t (forall (x:a) (s1:s).{:pattern (guard_free (k x s1))} post x s1 ==> k x s1)\n\t ==> wp s k s0\n\nunfold\nlet st_stronger (a:Type) (wp1:st_wp a)\n (wp2:st_wp a)\n = forall (s:Type0) (post:st_post s a) (s0:s). wp1 s post s0 ==> wp2 s post s0\n\nunfold\nlet st_close_wp (a:Type) (b:Type)\n (wp:(b -> GTot (st_wp a)))\n (s:Type0) (post:st_post s a) (s0:s)\n = (forall (x:b). wp x s post s0)\n\nunfold\nlet st_trivial (a:Type) (wp:st_wp a)\n = forall s s0. wp s (fun r s1 -> True) s0\n\nnew_effect {\n STATE : result:Type -> wp:st_wp result -> Effect\n with\n //repr = s:Type0 -> s -> M (a * s) //pi-types currently not supported by DM4F\n return_wp = st_return\n ; bind_wp = st_bind_wp\n ; if_then_else = st_if_then_else\n ; ite_wp = st_ite_wp\n ; stronger = st_stronger\n ; close_wp = st_close_wp\n ; trivial = st_trivial\n}\n\n\n(* Standard lifting *)\n\nunfold\nlet lift_div_st (a:Type) (wp:pure_wp a)\n (s:Type0) (p:st_post s a) (s0:s)\n = wp (fun x -> p x s0)\nsub_effect DIV ~> STATE = lift_div_st\n\n\n(* Non-indexed ST WPs and syntactic sugar for writing effect indices *)\n", "sketch": [ "To implement the definition `st_wp'`, we define it as a function that takes a result type `a` and a state type `s` as arguments and returns a Type.", "The `st_wp'` type is implemented as a function that takes two arguments: `a` of type `Type` and `s` of type `Type0`, and returns a `Type`. This function represents the weakest precondition for a computation with a result of type `a` and a state of type `s`.\n\n```fstar\nval st_wp' : a: Type -> s: Type0 -> Type\n```" ], "generated_solution": [ "val st_wp' : a: Type -> s: Type0 -> Type" ] }, { "file_name": "LowParse.SLow.Sum.fst", "name": "LowParse.SLow.Sum.parse32_dsum_cases_t_if", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "abbrev": "B32", "full_module": "LowParse.Bytes32" }, { "open": "LowParse.SLow.Enum" }, { "open": "LowParse.Spec.Sum" }, { "open": "LowParse.SLow" }, { "open": "LowParse.SLow" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val parse32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n : Tot (if_combinator _ (parse32_dsum_cases_t_eq t f g k))", "source_definition": "let parse32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (if_combinator _ (parse32_dsum_cases_t_eq t f g k))\n= fun cond (sv_true: cond_true cond -> Tot (parse32_dsum_cases_t t f g k)) (sv_false: cond_false cond -> Tot (parse32_dsum_cases_t t f g k)) input ->\n if cond\n then (sv_true () input <: (res: _ { parser32_correct (parse_dsum_cases t f g (Known k)) input res}))\n else (sv_false () input <: (res: _ {parser32_correct (parse_dsum_cases t f g (Known k)) input res}))", "source_range": { "start_line": 610, "start_col": 0, "end_line": 620, "end_col": 102 }, "interleaved": false, "definition": "fun t f g k ->\n (fun cond sv_true sv_false input ->\n (match cond with\n | true ->\n sv_true () input\n <:\n res:\n FStar.Pervasives.Native.option (LowParse.Spec.Sum.dsum_cases t\n (LowParse.Spec.Enum.Known k) *\n FStar.UInt32.t)\n { LowParse.SLow.Base.parser32_correct (LowParse.Spec.Sum.parse_dsum_cases t\n f\n g\n (LowParse.Spec.Enum.Known k))\n input\n res }\n | _ ->\n sv_false () input\n <:\n res:\n FStar.Pervasives.Native.option (LowParse.Spec.Sum.dsum_cases t\n (LowParse.Spec.Enum.Known k) *\n FStar.UInt32.t)\n { LowParse.SLow.Base.parser32_correct (LowParse.Spec.Sum.parse_dsum_cases t\n f\n g\n (LowParse.Spec.Enum.Known k))\n input\n res })\n <:\n res:\n FStar.Pervasives.Native.option (LowParse.Spec.Sum.dsum_cases t (LowParse.Spec.Enum.Known k) *\n FStar.UInt32.t)\n { LowParse.SLow.Base.parser32_correct (LowParse.Spec.Sum.parse_dsum_cases t\n f\n g\n (LowParse.Spec.Enum.Known k))\n input\n res })\n <:\n LowParse.Spec.Enum.if_combinator (LowParse.SLow.Sum.parse32_dsum_cases_t t f g k)\n (LowParse.SLow.Sum.parse32_dsum_cases_t_eq t f g k)", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "LowParse.Spec.Sum.dsum", "LowParse.Spec.Sum.dsum_known_key", "Prims.dtuple2", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Base.parser", "LowParse.Spec.Sum.dsum_type_of_known_tag", "LowParse.Spec.Sum.dsum_type_of_unknown_tag", "Prims.bool", "LowParse.Spec.Combinators.cond_true", "LowParse.SLow.Sum.parse32_dsum_cases_t", "LowParse.Spec.Combinators.cond_false", "LowParse.SLow.Base.bytes32", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "LowParse.Spec.Sum.dsum_cases", "LowParse.Spec.Enum.Known", "LowParse.Spec.Sum.dsum_key_type", "LowParse.Spec.Sum.dsum_repr_type", "LowParse.Spec.Sum.dsum_enum", "FStar.UInt32.t", "LowParse.SLow.Base.parser32_correct", "LowParse.Spec.Sum.weaken_parse_dsum_cases_kind", "LowParse.Spec.Sum.parse_dsum_cases", "LowParse.Spec.Enum.if_combinator", "LowParse.SLow.Sum.parse32_dsum_cases_t_eq" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n t: LowParse.Spec.Sum.dsum ->\n f:\n (x: LowParse.Spec.Sum.dsum_known_key t\n -> Prims.dtuple2 LowParse.Spec.Base.parser_kind\n (fun k -> LowParse.Spec.Base.parser k (LowParse.Spec.Sum.dsum_type_of_known_tag t x))) ->\n g: LowParse.Spec.Base.parser k' (LowParse.Spec.Sum.dsum_type_of_unknown_tag t) ->\n k: LowParse.Spec.Sum.dsum_known_key t\n -> LowParse.Spec.Enum.if_combinator (LowParse.SLow.Sum.parse32_dsum_cases_t t f g k)\n (LowParse.SLow.Sum.parse32_dsum_cases_t_eq t f g k)", "prompt": "let parse32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n : Tot (if_combinator _ (parse32_dsum_cases_t_eq t f g k)) =\n ", "expected_response": "fun\n cond\n (sv_true: (cond_true cond -> Tot (parse32_dsum_cases_t t f g k)))\n (sv_false: (cond_false cond -> Tot (parse32_dsum_cases_t t f g k)))\n input\n ->\n if cond\n then (sv_true () input <: (res: _{parser32_correct (parse_dsum_cases t f g (Known k)) input res}))\n else\n (sv_false () input <: (res: _{parser32_correct (parse_dsum_cases t f g (Known k)) input res}))", "source": { "project_name": "everparse", "file_name": "src/lowparse/LowParse.SLow.Sum.fst", "git_rev": "00217c4a89f5ba56002ba9aa5b4a9d5903bfe9fa", "git_url": "https://github.com/project-everest/everparse.git" }, "dependencies": { "source_file": "LowParse.SLow.Sum.fst", "checked_file": "dataset/LowParse.SLow.Sum.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/LowParse.Spec.Sum.fst.checked", "dataset/LowParse.SLow.Enum.fst.checked", "dataset/LowParse.Bytes32.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "let serializer32_sum_gen_precond\n (kt: parser_kind)\n (k: parser_kind)\n: GTot Type0\n= kt.parser_kind_subkind == Some ParserStrong /\\\n Some? kt.parser_kind_high /\\\n Some? k.parser_kind_high /\\ (\n let (Some vt) = kt.parser_kind_high in\n let (Some v) = k.parser_kind_high in\n vt + v < 4294967296\n )", "let parse32_sum_t (t: sum) : Tot Type =\n bytes32 -> Tot (option (sum_type t * U32.t))", "let parse32_sum_eq (t: sum) : Tot (parse32_sum_t t -> parse32_sum_t t -> GTot Type0) =\n feq _ _ (eq2 #_)", "let parse32_sum_if (t: sum) : Tot (if_combinator _ (parse32_sum_eq t)) =\n fif _ _ _ (default_if _)", "let parse32_sum_eq_refl (t: sum) : Tot (r_reflexive_t _ (parse32_sum_eq t)) =\n fun _ -> ()", "let parse32_sum_eq_trans (t: sum) : Tot (r_transitive_t _ (parse32_sum_eq t)) = feq_trans _ _ (eq2 #_)", "let parse32_sum_cases'\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases' t pc k))\n= [@inline_let]\n let _ = synth_sum_case_injective t k in\n parse32_synth'\n (dsnd (pc k))\n (synth_sum_case t k)\n (pc32 k)\n ()", "let parse32_sum_aux\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n: GTot (parser32 (parse_sum t p pc))\n= fun input ->\n parse_sum_eq' t p pc (B32.reveal input);\n [@inline_let]\n let res : option (sum_type t * U32.t) =\n //NS: hoist nested match\n //we do not expect the case analysis to\n //on `p32 input` to reduce; hoist it for more efficient\n //normalization.\n //Note, in some simple cases, e.g., parsing raw enums\n //this r the pcases below maybe statically evaluated\n //to a `Some v`; this forgoes reduction in those simple\n //cases for more efficient extraction in more complex\n //common cases\n let pi = p32 input in\n match pi with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = B32.b32slice input consumed_k (B32.len input) in\n //NS: hoist nested match\n let pcases1 = parse32_sum_cases' t pc pc32 k input_k in\n match pcases1 with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((x <: sum_type t), consumed_k `U32.add` consumed_x)\n in\n (res <: (res: option (sum_type t * U32.t) { parser32_correct (parse_sum t p pc) input res } ))", "let parse32_sum_cases_t\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot Type\n= parser32 (parse_sum_cases t pc k)", "let parse32_sum_cases_t_eq\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n (x y : parse32_sum_cases_t t pc k)\n: GTot Type0\n= True", "let parse32_sum_cases_t_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot (if_combinator _ (parse32_sum_cases_t_eq t pc k))\n= fun cond (sv_true: cond_true cond -> Tot (parse32_sum_cases_t t pc k)) (sv_false: cond_false cond -> Tot (parse32_sum_cases_t t pc k)) input ->\n if cond\n then (sv_true () input <: (res: _ { parser32_correct (parse_sum_cases t pc k) input res}))\n else (sv_false () input <: (res: _ {parser32_correct (parse_sum_cases t pc k) input res}))", "let parse32_sum_cases_aux\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases t pc k))\n= fun (input: B32.bytes) ->\n [@inline_let] let _ = parse_sum_cases_eq' t pc k (B32.reveal input) in\n (parse32_sum_cases' t pc pc32 k input <: (res: _ { parser32_correct (parse_sum_cases t pc k) input res } ))", "let parse32_sum_cases \n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (parse32_sum_cases_t t pc))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases t pc k))\n= destr\n _\n (parse32_sum_cases_t_if t pc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (parse32_sum_cases_aux t pc pc32)\n k", "let parse32_sum'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n (input: B32.bytes)\n: Pure (option (sum_type t * U32.t))\n (requires True)\n (ensures (fun res -> res == parse32_sum_aux t p p32 pc pc32 input))\n= [@inline_let]\n let res : option (sum_type t * U32.t) =\n //NS: hoist nested match\n let pi = p32 input in\n match pi with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = B32.b32slice input consumed_k (B32.len input) in\n destr\n (eq2 #(option (sum_type t * U32.t))) (default_if _)\n (fun _ -> ()) (fun _ _ _ -> ())\n (fun k ->\n //NS: hoist nested match\n let pcases2 = parse32_sum_cases' t pc pc32 k input_k in\n match pcases2 with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((x <: sum_type t), consumed_k `U32.add` consumed_x)\n )\n k\n in\n res", "let parse32_sum\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n: Tot (parser32 (parse_sum t p pc))\n= fun input ->\n (parse32_sum' t p p32 pc pc32 destr input <: (res: option (sum_type t * U32.t) { parser32_correct (parse_sum t p pc) input res } ))", "let parse32_sum2\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 p)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n (f: maybe_enum_key_of_repr'_t (sum_enum t))\n: Tot (parser32 (parse_sum t p pc))\n= parse32_sum t p (parse32_enum_key p32 (sum_enum t) f) pc pc32 destr", "let serialize32_sum_cases_t\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot Type\n= serializer32 (serialize_sum_cases t pc sc k)", "let serialize32_sum_cases_t_eq\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: serialize32_sum_cases_t t sc k)\n: GTot Type0\n= True", "let serialize32_sum_cases_t_if\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (if_combinator _ (serialize32_sum_cases_t_eq t sc k))\n= fun cond (sv_true: (cond_true cond -> Tot (serialize32_sum_cases_t t sc k))) (sv_false: (cond_false cond -> Tot (serialize32_sum_cases_t t sc k))) input ->\n if cond\n then (sv_true () input <: (res: _ { serializer32_correct (serialize_sum_cases t pc sc k) input res } ))\n else (sv_false () input <: (res: _ { serializer32_correct (serialize_sum_cases t pc sc k) input res } ))", "let serialize32_sum_cases_aux\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= fun input ->\n [@inline_let] let _ =\n Classical.forall_intro (parse_sum_cases_eq' t pc k);\n synth_sum_case_injective t k;\n synth_sum_case_inverse t k\n in\n serialize32_synth\n _\n (synth_sum_case t k)\n _\n (sc32 k)\n (synth_sum_case_recip t k)\n (fun x -> synth_sum_case_recip t k x)\n ()\n input", "let serialize32_sum_cases\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= destr\n _\n (serialize32_sum_cases_t_if t sc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (serialize32_sum_cases_aux t sc sc32)\n k", "let serialize32_sum_aux\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: GTot (serializer32 (serialize_sum t s sc))\n= fun x ->\n serialize_sum_eq t s sc x;\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n let s2 = sc32 tg (synth_sum_case_recip t tg x) in\n let res = s1 `B32.b32append` s2 in\n (res <: (res: B32.bytes { serializer32_correct (serialize_sum t s sc) x res } ))", "let serialize32_sum_destr_codom\n (t: sum)\n (k: sum_key t)\n: Tot Type\n= refine_with_tag (sum_tag_of_data t) k -> Tot B32.bytes", "let serialize32_sum_destr_eq\n (t: sum)\n (k: sum_key t)\n: Tot (serialize32_sum_destr_codom t k -> serialize32_sum_destr_codom t k -> GTot Type0)\n= _ by (T.apply (`feq); T.apply (`eq2))", "let serialize32_sum_destr_trans\n (t: sum)\n (k: sum_key t)\n: Tot (r_transitive_t _ (serialize32_sum_destr_eq t k))\n= feq_trans _ _ (eq2 #_)", "let serialize32_sum_destr_if\n (t: sum)\n (k: sum_key t)\n: Tot (if_combinator _ (serialize32_sum_destr_eq t k))\n= // _ by (T.apply (`fif); T.fail \"abc\")\n fif _ _ _ (default_if _)", "let serialize32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_destr_codom t))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (serializer32 (serialize_sum t s sc))\n= fun x ->\n [@inline_let]\n let _ = serialize_sum_eq t s sc x in\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n [@inline_let]\n let phi tg x = sc32 tg (synth_sum_case_recip t tg x) in\n [@inline_let]\n let phi'tg = destr\n (serialize32_sum_destr_eq t)\n (serialize32_sum_destr_if t)\n (fun _ _ -> ())\n (serialize32_sum_destr_trans t)\n phi\n tg\n in\n let s2 = phi'tg x in\n [@inline_let]\n let _ =\n let phitg = phi tg in\n feq_elim _ _ (eq2 #_) phitg phi'tg x\n in\n let res = s1 `B32.b32append` s2 in\n (res <: (res: B32.bytes { serializer32_correct (serialize_sum t s sc) x res } ))", "let serialize32_sum2\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 s)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_destr_codom t))\n (f: enum_repr_of_key'_t (sum_enum t))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (serializer32 (serialize_sum t s sc))\n= serialize32_sum t s (serialize32_enum_key s32 (sum_enum t) f) sc sc32 destr u", "let size32_sum_cases_t\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot Type\n= size32 (serialize_sum_cases t pc sc k)", "let size32_sum_cases_t_eq\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: size32_sum_cases_t t sc k)\n: GTot Type0\n= True", "let size32_sum_cases_t_if\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (if_combinator _ (size32_sum_cases_t_eq t sc k))\n= fun cond (sv_true: (cond_true cond -> Tot (size32_sum_cases_t t sc k))) (sv_false: (cond_false cond -> Tot (size32_sum_cases_t t sc k))) input ->\n if cond\n then (sv_true () input <: (res: _ { size32_postcond (serialize_sum_cases t pc sc k) input res } ))\n else (sv_false () input <: (res: _ { size32_postcond (serialize_sum_cases t pc sc k) input res } ))", "let size32_sum_cases_aux\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (k: sum_key t)\n: Tot (size32 (serialize_sum_cases t pc sc k))\n= fun input ->\n [@inline_let] let _ =\n Classical.forall_intro (parse_sum_cases_eq' t pc k);\n synth_sum_case_injective t k;\n synth_sum_case_inverse t k\n in\n size32_synth\n _\n (synth_sum_case t k)\n _\n (sc32 k)\n (synth_sum_case_recip t k)\n (fun x -> synth_sum_case_recip t k x)\n ()\n input", "let size32_sum_cases\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_cases_t t sc))\n (k: sum_key t)\n: Tot (size32 (serialize_sum_cases t pc sc k))\n= destr\n _\n (size32_sum_cases_t_if t sc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (size32_sum_cases_aux t sc sc32)\n k", "let size32_sum_destr_codom\n (t: sum)\n (k: sum_key t)\n: Tot Type\n= refine_with_tag (sum_tag_of_data t) k -> Tot U32.t", "let size32_sum_destr_eq\n (t: sum)\n (k: sum_key t)\n: Tot (size32_sum_destr_codom t k -> size32_sum_destr_codom t k -> GTot Type0)\n= _ by (T.apply (`feq); T.apply (`eq2))", "let size32_sum_destr_trans\n (t: sum)\n (k: sum_key t)\n: Tot (r_transitive_t _ (size32_sum_destr_eq t k))\n= feq_trans _ _ (eq2 #_)", "let size32_sum_destr_if\n (t: sum)\n (k: sum_key t)\n: Tot (if_combinator _ (size32_sum_destr_eq t k))\n= // _ by (T.apply (`fif); T.fail \"abc\")\n fif _ _ _ (default_if _)", "let size32_sum_gen_precond\n (kt: parser_kind)\n (k: parser_kind)\n: GTot Type0\n= kt.parser_kind_subkind == Some ParserStrong /\\\n Some? kt.parser_kind_high /\\\n Some? k.parser_kind_high /\\ (\n let (Some vt) = kt.parser_kind_high in\n let (Some v) = k.parser_kind_high in\n vt + v < 4294967295\n )", "let size32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: size32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_destr_codom t))\n (u: squash (size32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (size32 (serialize_sum t s sc))\n= fun x ->\n serialize_sum_eq t s sc x;\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n [@inline_let]\n let phi tg x = sc32 tg (synth_sum_case_recip t tg x) in\n [@inline_let]\n let phi'tg = destr\n (size32_sum_destr_eq t)\n (size32_sum_destr_if t)\n (fun _ _ -> ())\n (size32_sum_destr_trans t)\n phi\n tg\n in\n let s2 = phi'tg x in\n [@inline_let]\n let _ =\n feq_elim _ _ (eq2 #_) (phi tg) phi'tg x;\n assert_norm (U32.v u32_max == 4294967295)\n in\n [@inline_let]\n let res = s1 `U32.add` s2 in\n (res <: (res: U32.t { size32_postcond (serialize_sum t s sc) x res } ))", "let size32_sum2\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: size32 s)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_destr_codom t))\n (f: enum_repr_of_key'_t (sum_enum t))\n (u: squash (size32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (size32 (serialize_sum t s sc))\n= size32_sum t s (size32_enum_key s32 (sum_enum t) f) sc sc32 destr u", "let parse32_dsum_cases'\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (parser32 (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: parser32 g)\n (x: dsum_key t)\n: Tot (parser32 (parse_dsum_cases' t f g x))\n= [@inline_let]\n let _ = synth_dsum_case_injective t x in\n match x with\n | Known x' ->\n parse32_synth'\n (dsnd (f x'))\n (synth_dsum_case t (Known x'))\n (f32 x')\n ()\n | Unknown x' ->\n parse32_synth'\n g\n (synth_dsum_case t (Unknown x'))\n g32\n ()", "let parse32_dsum_cases_aux\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (parser32 (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: parser32 g)\n (x: dsum_key t)\n: Tot (parser32 (parse_dsum_cases t f g x))\n= fun input ->\n [@inline_let] let _ = parse_dsum_cases_eq' t f g x (B32.reveal input) in\n (parse32_dsum_cases' t f f32 g g32 x input <: (res: _ { parser32_correct (parse_dsum_cases t f g x) input res } ))", "let parse32_dsum_cases_t\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot Type\n= parser32 (parse_dsum_cases t f g (Known k))", "let parse32_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n (x y : parse32_dsum_cases_t t f g k)\n: GTot Type0\n= True" ], "closest": [ "val serialize32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (sg: serializer g)\n (k: dsum_known_key t)\n : Tot (if_combinator _ (serialize32_dsum_cases_t_eq t f sf g sg k))\nlet serialize32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (sg: serializer g)\n (k: dsum_known_key t)\n: Tot (if_combinator _ (serialize32_dsum_cases_t_eq t f sf g sg k))\n= fun cond (sv_true: (cond_true cond -> Tot (serialize32_dsum_cases_t t f sf g sg k))) (sv_false: (cond_false cond -> Tot (serialize32_dsum_cases_t t f sf g sg k))) x #rrel #rel output pos ->\n if cond\n then (sv_true () x output pos)\n else (sv_false () x output pos)", "val read_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n : Tot (if_combinator _ (read_dsum_cases_t_eq t f g k))\nlet read_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (if_combinator _ (read_dsum_cases_t_eq t f g k))\n= fun cond (sv_true: cond_true cond -> Tot (read_dsum_cases_t t f g k)) (sv_false: cond_false cond -> Tot (read_dsum_cases_t t f g k)) #_ #_ input pos ->\n if cond\n then sv_true () input pos\n else sv_false () input pos", "val validate_dsum_cases_if\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (if_combinator _ (validate_dsum_cases_eq s f g x))\nlet validate_dsum_cases_if\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (if_combinator _ (validate_dsum_cases_eq s f g x))\n= validate_dsum_cases_if' s f g x", "val serialize32_sum_cases_t_if\n (t: sum)\n (#pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: (x: sum_key t -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n : Tot (if_combinator _ (serialize32_sum_cases_t_eq t sc k))\nlet serialize32_sum_cases_t_if\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (if_combinator _ (serialize32_sum_cases_t_eq t sc k))\n= fun cond (sv_true: (cond_true cond -> Tot (serialize32_sum_cases_t t sc k))) (sv_false: (cond_false cond -> Tot (serialize32_sum_cases_t t sc k))) x #rrel #rel b pos ->\n if cond\n then (sv_true () x b pos)\n else (sv_false () x b pos)", "val read_dsum_cases'\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (f32: (x: dsum_known_key t -> Tot (leaf_reader (dsnd (f x)))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (x: dsum_key t)\n : Tot (leaf_reader (parse_dsum_cases' t f g x))\nlet read_dsum_cases'\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (leaf_reader (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (x: dsum_key t)\n: Tot (leaf_reader (parse_dsum_cases' t f g x))\n= fun #rrel #rel input pos ->\n [@inline_let]\n let _ = synth_dsum_case_injective t x in\n match x with\n | Known x' ->\n read_synth'\n (dsnd (f x'))\n (synth_dsum_case t (Known x'))\n (f32 x')\n ()\n input\n pos\n | Unknown x' ->\n read_synth'\n g\n (synth_dsum_case t (Unknown x'))\n g32\n ()\n input\n pos", "val jump_dsum_cases_if\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (if_combinator _ (jump_dsum_cases_eq s f g x))\nlet jump_dsum_cases_if\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (if_combinator _ (jump_dsum_cases_eq s f g x))\n= jump_dsum_cases_if' s f g x", "val serialize32_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (sg: serializer g)\n (k: dsum_known_key t)\n (x y: serialize32_dsum_cases_t t f sf g sg k)\n : GTot Type0\nlet serialize32_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (sg: serializer g)\n (k: dsum_known_key t)\n (x y: serialize32_dsum_cases_t t f sf g sg k)\n: GTot Type0\n= True", "val validate_dsum_cases_if'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (cond: bool)\n (ift: (cond_true cond -> Tot (validate_dsum_cases_t s f g x)))\n (iff: (cond_false cond -> Tot (validate_dsum_cases_t s f g x)))\n : Tot (validate_dsum_cases_t s f g x)\nlet validate_dsum_cases_if'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (cond: bool)\n (ift: (cond_true cond -> Tot (validate_dsum_cases_t s f g x)))\n (iff: (cond_false cond -> Tot (validate_dsum_cases_t s f g x)))\n: Tot (validate_dsum_cases_t s f g x)\n= fun #rrel #rel input len ->\n if cond\n then (ift () <: validate_dsum_cases_t s f g x) input len\n else (iff () <: validate_dsum_cases_t s f g x) input len", "val serialize32_dsum_cases_aux\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (sf32: (x: dsum_known_key t -> Tot (serializer32 (sf x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (tg: dsum_key t)\n : Tot (serializer32 (serialize_dsum_cases t f sf g sg tg))\nlet serialize32_dsum_cases_aux\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (sf32: (x: dsum_known_key t) -> Tot (serializer32 (sf x)))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (tg: dsum_key t)\n: Tot (serializer32 (serialize_dsum_cases t f sf g sg tg))\n= [@inline_let]\n let _ = synth_dsum_case_injective t tg in\n [@inline_let]\n let _ = synth_dsum_case_inverse t tg in\n serialize32_synth\n (serialize32_dsum_type_of_tag t f sf sf32 sg32 tg)\n (synth_dsum_case t tg) \n (synth_dsum_case_recip t tg)\n (fun x -> synth_dsum_case_recip t tg x)\n ()", "val serialize32_dsum_cases\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (sf32: (x: dsum_known_key t -> Tot (serializer32 (sf x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (destr: dep_enum_destr _ (serialize32_dsum_cases_t t f sf g sg))\n (tg: dsum_key t)\n : Tot (serializer32 (serialize_dsum_cases t f sf g sg tg))\nlet serialize32_dsum_cases\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (sf32: (x: dsum_known_key t) -> Tot (serializer32 (sf x)))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (destr: dep_enum_destr _ (serialize32_dsum_cases_t t f sf g sg))\n (tg: dsum_key t)\n: Tot (serializer32 (serialize_dsum_cases t f sf g sg tg))\n= fun x #rrel #rel output pos ->\n match tg with\n | Known k ->\n destr\n _\n (serialize32_dsum_cases_t_if t f sf g sg)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (fun k -> serialize32_dsum_cases_aux t f sf sf32 sg32 (Known k))\n k\n x\n output\n pos\n | Unknown r ->\n serialize32_dsum_cases_aux t f sf sf32 sg32 (Unknown r) x output pos", "val parse_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (parser (parse_dsum_cases_kind s f g x) (dsum_cases s x))\nlet parse_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (parser (parse_dsum_cases_kind s f g x) (dsum_cases s x))\n= synth_dsum_case_injective s x;\n match x with\n | Known x' -> (dsnd (f x') `parse_synth` synth_dsum_case s (Known x')) <: parser (parse_dsum_cases_kind s f g x) (dsum_cases s x)\n | Unknown x' -> g `parse_synth` synth_dsum_case s (Unknown x') <: parser (parse_dsum_cases_kind s f g x) (dsum_cases s x)", "val read_dsum_cases\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (f32: (x: dsum_known_key t -> Tot (leaf_reader (dsnd (f x)))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (destr: dep_enum_destr _ (read_dsum_cases_t t f g))\n (x: dsum_key t)\n : Tot (leaf_reader (parse_dsum_cases' t f g x))\nlet read_dsum_cases \n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (leaf_reader (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (destr: dep_enum_destr _ (read_dsum_cases_t t f g))\n (x: dsum_key t)\n: Tot (leaf_reader (parse_dsum_cases' t f g x))\n= fun #_ #_ input pos ->\n match x with\n | Known k ->\n destr\n _\n (read_dsum_cases_t_if t f g)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (fun k -> read_dsum_cases' t f f32 g g32 (Known k))\n k\n input\n pos\n | Unknown r ->\n read_dsum_cases' t f f32 g g32 (Unknown r) input pos", "val parse_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (parser (weaken_parse_dsum_cases_kind s f k) (dsum_cases s x))\nlet parse_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (parser (weaken_parse_dsum_cases_kind s f k) (dsum_cases s x))\n= synth_dsum_case_injective s x;\n parse_dsum_type_of_tag s f g x `parse_synth` synth_dsum_case s x", "val validate_sum_cases_t_if\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n : Tot (if_combinator _ (validate_sum_cases_t_eq t pc k))\nlet validate_sum_cases_t_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot (if_combinator _ (validate_sum_cases_t_eq t pc k))\n= fun cond (sv_true: cond_true cond -> Tot (validate_sum_cases_t t pc k)) (sv_false: cond_false cond -> Tot (validate_sum_cases_t t pc k)) #rrel #rel input pos ->\n if cond\n then sv_true () input pos\n else sv_false () input pos", "val read_sum_cases_t_if\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n : Tot (if_combinator _ (read_sum_cases_t_eq t pc k))\nlet read_sum_cases_t_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot (if_combinator _ (read_sum_cases_t_eq t pc k))\n= fun cond (sv_true: cond_true cond -> Tot (read_sum_cases_t t pc k)) (sv_false: cond_false cond -> Tot (read_sum_cases_t t pc k)) #_ #_ input pos ->\n if cond\n then (sv_true () input pos)\n else (sv_false () input pos)", "val parse_dsum_cases_kind\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot parser_kind\nlet parse_dsum_cases_kind\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot parser_kind\n= match x with\n | Known k -> dfst (f k)\n | _ -> k", "val validate_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (validator (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': validator g)\n (x: dsum_key s)\n : Tot (validate_dsum_cases_t s f g x)\nlet validate_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (validator (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : validator g)\n (x: dsum_key s)\n: Tot (validate_dsum_cases_t s f g x)\n= [@inline_let]\n let _ = synth_dsum_case_injective s x in\n match x with\n | Known x' -> validate_synth (f' x') (synth_dsum_case s (Known x')) () <: validator (parse_dsum_cases' s f g x)\n | Unknown x' -> validate_synth g' (synth_dsum_case s (Unknown x')) () <: validator (parse_dsum_cases' s f g x)", "val read_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n (x y: read_dsum_cases_t t f g k)\n : GTot Type0\nlet read_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n (x y : read_dsum_cases_t t f g k)\n: GTot Type0\n= True", "val validate_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (validator (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': validator g)\n (destr: dep_enum_destr _ (fun k -> validate_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n : Tot (validator (parse_dsum_cases s f g x))\nlet validate_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (validator (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : validator g)\n (destr: dep_enum_destr _ (fun k -> validate_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n: Tot (validator (parse_dsum_cases s f g x))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ =\n valid_facts (parse_dsum_cases' s f g x) h input (uint64_to_uint32 pos);\n valid_facts (parse_dsum_cases s f g x) h input (uint64_to_uint32 pos);\n parse_dsum_cases_eq' s f g x (bytes_of_slice_from h input (uint64_to_uint32 pos))\n in\n validate_dsum_cases'_destr s f f' g' destr x input pos", "val jump_dsum_cases_if'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (cond: bool)\n (ift: (cond_true cond -> Tot (jump_dsum_cases_t s f g x)))\n (iff: (cond_false cond -> Tot (jump_dsum_cases_t s f g x)))\n : Tot (jump_dsum_cases_t s f g x)\nlet jump_dsum_cases_if'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (cond: bool)\n (ift: (cond_true cond -> Tot (jump_dsum_cases_t s f g x)))\n (iff: (cond_false cond -> Tot (jump_dsum_cases_t s f g x)))\n: Tot (jump_dsum_cases_t s f g x)\n= fun #rrel #rel input len ->\n if cond\n then (ift () <: jump_dsum_cases_t s f g x) input len\n else (iff () <: jump_dsum_cases_t s f g x) input len", "val parse_dsum\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag t))\n : Tot (parser (parse_dsum_kind kt t f k) (dsum_type t))\nlet parse_dsum\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag t))\n: Tot (parser (parse_dsum_kind kt t f k) (dsum_type t))\n= parse_dsum' t p (parse_dsum_cases t f g)", "val validate_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (v: validator p)\n (p32: leaf_reader p)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (f32: (x: dsum_known_key t -> Tot (validator (dsnd (f x)))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: validator g)\n (destr: dep_maybe_enum_destr_t (dsum_enum t) (validate_dsum_cases_t t f g))\n : Tot (validator (parse_dsum t p f g))\nlet validate_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (v: validator p)\n (p32: leaf_reader p)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (validator (dsnd (f x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: validator g)\n (destr: dep_maybe_enum_destr_t (dsum_enum t) (validate_dsum_cases_t t f g))\n: Tot (validator (parse_dsum t p f g))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ = parse_dsum_eq' t p f g (bytes_of_slice_from h input (uint64_to_uint32 pos)) in\n [@inline_let]\n let _ = valid_facts (parse_dsum t p f g) h input (uint64_to_uint32 pos) in\n [@inline_let]\n let _ = valid_facts p h input (uint64_to_uint32 pos) in\n let pos_after_tag = v input pos in\n if is_error pos_after_tag\n then pos_after_tag\n else\n let tg = p32 input (uint64_to_uint32 pos) in\n [@inline_let]\n let _ = valid_facts (parse_dsum_cases' t f g (maybe_enum_key_of_repr (dsum_enum t) tg)) h input (uint64_to_uint32 pos_after_tag) in\n destr (validate_dsum_cases_eq t f g) (validate_dsum_cases_if t f g) (fun _ _ -> ()) (fun _ _ _ _ -> ()) (validate_dsum_cases' t f f32 g32) tg input pos_after_tag", "val jump_sum_cases_t_if\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n : Tot (if_combinator _ (jump_sum_cases_t_eq t pc k))\nlet jump_sum_cases_t_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot (if_combinator _ (jump_sum_cases_t_eq t pc k))\n= fun cond (sv_true: cond_true cond -> Tot (jump_sum_cases_t t pc k)) (sv_false: cond_false cond -> Tot (jump_sum_cases_t t pc k)) #rrel #rel input pos ->\n if cond\n then sv_true () input pos\n else sv_false () input pos", "val validate_dsum_cases_eq\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (v1 v2: validate_dsum_cases_t s f g x)\n : GTot Type0\nlet validate_dsum_cases_eq\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (v1 v2 : validate_dsum_cases_t s f g x)\n: GTot Type0\n= True", "val serialize32_dsum_type_of_tag\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (sf32: (x: dsum_known_key t -> Tot (serializer32 (sf x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (tg: dsum_key t)\n : Tot (serializer32 (serialize_dsum_type_of_tag t f sf g sg tg))\nlet serialize32_dsum_type_of_tag\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (sf32: (x: dsum_known_key t) -> Tot (serializer32 (sf x)))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (tg: dsum_key t)\n: Tot (serializer32 (serialize_dsum_type_of_tag t f sf g sg tg))\n= match tg with\n | Known x' -> serialize32_ext (dsnd (f x')) (sf x') (sf32 x') (parse_dsum_type_of_tag t f g tg) ()\n | Unknown x' -> serialize32_ext g sg sg32 (parse_dsum_type_of_tag t f g tg) ()", "val serialize_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (sr: (x: dsum_known_key s -> Tot (serializer (dsnd (f x)))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_key s)\n : Tot (serializer (parse_dsum_cases s f g x))\nlet serialize_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (sr: (x: dsum_known_key s) -> Tot (serializer (dsnd (f x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_key s)\n: Tot (serializer (parse_dsum_cases s f g x))\n= synth_dsum_case_injective s x;\n synth_dsum_case_inverse s x;\n serialize_synth\n _\n (synth_dsum_case s x)\n (serialize_dsum_type_of_tag s f sr g sg x)\n (synth_dsum_case_recip s x)\n ()", "val serialize32_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p {kt.parser_kind_subkind == Some ParserStrong})\n (s32: serializer32 (serialize_maybe_enum_key _ s (dsum_enum t)))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (sf: (x: dsum_known_key t -> Tot (serializer (dsnd (f x)))))\n (sf32: (x: dsum_known_key t -> Tot (serializer32 (sf x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (destr: dep_enum_destr _ (serialize32_dsum_cases_t t f sf g sg))\n : Tot (serializer32 (serialize_dsum t s f sf g sg))\nlet serialize32_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p {kt.parser_kind_subkind == Some ParserStrong})\n (s32: serializer32 (serialize_maybe_enum_key _ s (dsum_enum t)))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (sf: (x: dsum_known_key t) -> Tot (serializer (dsnd (f x))))\n (sf32: (x: dsum_known_key t) -> Tot (serializer32 (sf x)))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (#sg: serializer g)\n (sg32: serializer32 sg)\n (destr: dep_enum_destr _ (serialize32_dsum_cases_t t f sf g sg))\n: Tot (serializer32 (serialize_dsum t s f sf g sg))\n= fun x #_ #_ output pos ->\n [@inline_let]\n let _ = serialize_dsum_eq' t s f sf g sg x in\n let tg = dsum_tag_of_data t x in\n serialize32_nondep_then_aux\n s32\n (serialize32_dsum_cases t f sf sf32 sg32 destr tg)\n tg\n x\n output\n pos", "val parse_dsum_type_of_tag'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (parser (parse_dsum_cases_kind s f g x) (dsum_type_of_tag s x))\nlet parse_dsum_type_of_tag'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (parser (parse_dsum_cases_kind s f g x) (dsum_type_of_tag s x))\n= match x with\n | Known x' -> coerce (parser (parse_dsum_cases_kind s f g x) (dsum_type_of_tag s x)) (dsnd (f x'))\n | Unknown x' -> g <: parser (parse_dsum_cases_kind s f g x) (dsum_type_of_tag s x)", "val parse_dsum_eq_\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n : Lemma\n (parse (parse_dsum t p f g) input ==\n (match parse (parse_maybe_enum_key p (dsum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (parse_dsum_cases' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)))\nlet parse_dsum_eq_\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n: Lemma\n (parse (parse_dsum t p f g) input == (match parse (parse_maybe_enum_key p (dsum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match parse (parse_dsum_cases' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_tagged_union_eq_gen (parse_maybe_enum_key p (dsum_enum t)) (dsum_tag_of_data t) (parse_dsum_cases t f g) (parse_maybe_enum_key p (dsum_enum t)) (fun input -> ()) (parse_dsum_cases_kind t f g) (parse_dsum_cases' t f g) (fun tg input -> parse_dsum_cases_eq' t f g tg input) input", "val serialize32_sum_cases_aux\n (t: sum)\n (#pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: (x: sum_key t -> Tot (serializer (dsnd (pc x)))))\n (sc32: (x: sum_key t -> Tot (serializer32 (sc x))))\n (k: sum_key t)\n : Tot (serializer32 (serialize_sum_cases t pc sc k))\nlet serialize32_sum_cases_aux\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= fun x #rrel #rel b pos ->\n [@inline_let] let _ =\n Classical.forall_intro (parse_sum_cases_eq' t pc k);\n synth_sum_case_injective t k;\n synth_sum_case_inverse t k\n in\n serialize32_synth\n (sc32 k)\n (synth_sum_case t k)\n (synth_sum_case_recip t k)\n (fun x -> synth_sum_case_recip t k x)\n ()\n x\n b\n pos", "val parse_dsum_cases_eq'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (input: bytes)\n : Lemma (parse (parse_dsum_cases s f g x) input == parse (parse_dsum_cases' s f g x) input)\nlet parse_dsum_cases_eq'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (input: bytes)\n: Lemma\n (parse (parse_dsum_cases s f g x) input == parse (parse_dsum_cases' s f g x) input)\n= synth_dsum_case_injective s x;\n match x with\n | Known x' ->\n parse_synth_eq (weaken (weaken_parse_dsum_cases_kind s f k) (dsnd (f x'))) (synth_dsum_case s x) input;\n parse_synth_eq (dsnd (f x')) (synth_dsum_case s (Known x')) input\n | Unknown x' ->\n parse_synth_eq (weaken (weaken_parse_dsum_cases_kind s f k) g) (synth_dsum_case s x) input;\n parse_synth_eq g (synth_dsum_case s (Unknown x')) input", "val parse_dsum_type_of_tag\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n : Tot (parser (weaken_parse_dsum_cases_kind s f k) (dsum_type_of_tag s x))\nlet parse_dsum_type_of_tag\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n: Tot (parser (weaken_parse_dsum_cases_kind s f k) (dsum_type_of_tag s x))\n= match x with\n | Known x' -> coerce (parser (weaken_parse_dsum_cases_kind s f k) (dsum_type_of_tag s x)) (weaken (weaken_parse_dsum_cases_kind s f k) (dsnd (f x')))\n | Unknown x' -> weaken (weaken_parse_dsum_cases_kind s f k) g <: parser (weaken_parse_dsum_cases_kind s f k) (dsum_type_of_tag s x)", "val parse_dsum_eq'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n : Lemma\n (parse (parse_dsum t p f g) input ==\n (match parse p input with\n | None -> None\n | Some (k', consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) k' in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (parse_dsum_cases' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)))\nlet parse_dsum_eq'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n: Lemma\n (parse (parse_dsum t p f g) input == (match parse p input with\n | None -> None\n | Some (k', consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) k' in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match parse (parse_dsum_cases' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_dsum_eq_ t p f g input;\n parse_maybe_enum_key_eq p (dsum_enum t) input", "val parse_dsum_eq''\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n : Lemma\n (parse (parse_dsum t p f g) input ==\n (match parse p input with\n | None -> None\n | Some (k', consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) k' in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (parse_dsum_cases t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)))\nlet parse_dsum_eq''\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n: Lemma\n (parse (parse_dsum t p f g) input == (match parse p input with\n | None -> None\n | Some (k', consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) k' in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match parse (parse_dsum_cases t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: dsum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_tagged_union_eq #(kt) #(dsum_key t) (parse_maybe_enum_key p (dsum_enum t)) #(dsum_type t) (dsum_tag_of_data t) (parse_dsum_cases t f g) input;\n parse_synth_eq p (maybe_enum_key_of_repr (dsum_enum t)) input", "val read_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (p32: leaf_reader (parse_maybe_enum_key p (dsum_enum t)))\n (j: jumper p)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (f32: (x: dsum_known_key t -> Tot (leaf_reader (dsnd (f x)))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (destr: dep_enum_destr _ (read_dsum_cases_t t f g))\n : Tot (leaf_reader (parse_dsum t p f g))\nlet read_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (p32: leaf_reader (parse_maybe_enum_key p (dsum_enum t)))\n (j: jumper p)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (leaf_reader (dsnd (f x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: leaf_reader g)\n (destr: dep_enum_destr _ (read_dsum_cases_t t f g))\n: Tot (leaf_reader (parse_dsum t p f g))\n= fun #_ #_ input pos ->\n let h = HST.get () in\n valid_facts (parse_dsum t p f g) h input pos;\n parse_dsum_eq_ t p f g (bytes_of_slice_from h input pos);\n valid_facts (parse_maybe_enum_key p (dsum_enum t)) h input pos;\n let k = p32 input pos in\n let pos' = jump_maybe_enum_key j (dsum_enum t) input pos in\n valid_facts (parse_dsum_cases' t f g k) h input pos' ;\n read_dsum_cases t f f32 g g32 destr k input pos'", "val parse32_bitsum\n (#kt: parser_kind)\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (#p: parser kt t)\n (p32: parser32 p)\n (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))\n (f32: (x: bitsum'_key_type b -> Tot (parser32 (dsnd (f x)))))\n : Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))\nlet parse32_bitsum\n (#kt: parser_kind)\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (#p: parser kt t)\n (p32: parser32 p)\n (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))\n (f32: (x: bitsum'_key_type b) -> Tot (parser32 (dsnd (f x))))\n: Tot (parser32 (parse_bitsum b tag_of_data type_of_tag synth_case p f))\n= fun x ->\n parse_bitsum_eq' b tag_of_data type_of_tag synth_case p f (B32.reveal x);\n match p32 x with\n | None -> None\n | Some (tg', consumed1) ->\n if filter_bitsum' b tg'\n then\n let tg = synth_bitsum' b tg' in\n let x' = B32.slice x consumed1 (B32.len x) in\n begin match f32 (bitsum'_key_of_t b tg) x' with\n | None -> None\n | Some (y, consumed2) ->\n Some ((synth_case.f tg y <: data), consumed1 `U32.add` consumed2)\n end\n else\n None", "val parse_dsum_eq\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n : Lemma\n (parse (parse_dsum t p f g) input ==\n (match parse (parse_maybe_enum_key p (dsum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match k with\n | Known k' ->\n (match parse (dsnd (f k')) input_k with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x))\n | Unknown k' ->\n match parse g input_k with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x)))\nlet parse_dsum_eq\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n: Lemma\n (parse (parse_dsum t p f g) input == (match parse (parse_maybe_enum_key p (dsum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match k with\n | Known k' ->\n begin match parse (dsnd (f k')) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x)\n end\n | Unknown k' ->\n begin match parse g input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x)\n end\n end\n ))\n= parse_dsum_eq_ t p f g input;\n let j = parse (parse_maybe_enum_key p (dsum_enum t)) input in\n match j with\n | None -> ()\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n synth_dsum_case_injective t k;\n begin match k with\n | Known k_ ->\n parse_synth_eq (dsnd (f k_)) (synth_dsum_case t k) input_k;\n parse_synth_eq (weaken (weaken_parse_dsum_cases_kind t f k') (dsnd (f k_))) (synth_dsum_case t k) input_k\n | Unknown k_ ->\n parse_synth_eq g (synth_dsum_case t k) input_k;\n parse_synth_eq (weaken (weaken_parse_dsum_cases_kind t f k') g) (synth_dsum_case t k) input_k\n end", "val jump_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (jumper (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': jumper g)\n (destr: dep_enum_destr _ (fun k -> jump_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n : Tot (jumper (parse_dsum_cases s f g x))\nlet jump_dsum_cases\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (jumper (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : jumper g)\n (destr: dep_enum_destr _ (fun k -> jump_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n: Tot (jumper (parse_dsum_cases s f g x))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ =\n valid_facts (parse_dsum_cases' s f g x) h input pos;\n valid_facts (parse_dsum_cases s f g x) h input pos;\n parse_dsum_cases_eq' s f g x (bytes_of_slice_from h input pos)\n in\n jump_dsum_cases'_destr s f f' g' destr x input pos", "val serialize32_sum_cases_t_eq\n (t: sum)\n (#pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: (x: sum_key t -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: serialize32_sum_cases_t t sc k)\n : GTot Type0\nlet serialize32_sum_cases_t_eq\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: serialize32_sum_cases_t t sc k)\n: GTot Type0\n= True", "val serialize32_sum_cases\n (t: sum)\n (#pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: (x: sum_key t -> Tot (serializer (dsnd (pc x)))))\n (sc32: (x: sum_key t -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n (k: sum_key t)\n : Tot (serializer32 (serialize_sum_cases t pc sc k))\nlet serialize32_sum_cases\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= destr\n _\n (serialize32_sum_cases_t_if t sc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (serialize32_sum_cases_aux t sc sc32)\n k", "val accessor_clens_dsum_cases_known_payload\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n : Tot (accessor (gaccessor_clens_dsum_cases_known_payload t f g k))\nlet accessor_clens_dsum_cases_known_payload\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (accessor (gaccessor_clens_dsum_cases_known_payload t f g k))\n= [@inline_let]\n let _ =\n synth_dsum_case_injective t (Known k);\n synth_dsum_case_inverse t (Known k);\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t (Known k)) (synth_dsum_case_recip t (Known k)) ()\n in\n accessor_ext\n (accessor_synth (dsnd (f k)) (synth_dsum_case t (Known k)) (synth_dsum_case_recip t (Known k)) ())\n (clens_dsum_cases_payload t (Known k))\n ()", "val parse_dsum'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (#k: parser_kind)\n (pc: (x: dsum_key t -> Tot (parser k (dsum_cases t x))))\n : Tot (parser (and_then_kind kt k) (dsum_type t))\nlet parse_dsum'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (#k: parser_kind)\n (pc: ((x: dsum_key t) -> Tot (parser k (dsum_cases t x))))\n: Tot (parser (and_then_kind kt k) (dsum_type t))\n= parse_tagged_union\n #kt\n #(dsum_key t)\n (parse_maybe_enum_key p (dsum_enum t))\n #(dsum_type t)\n (dsum_tag_of_data t)\n #k\n pc", "val parse_dsum_eq3\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n : Lemma\n (parse (parse_dsum t p f g) input ==\n (match parse p input with\n | None -> None\n | Some (r, consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) r in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (parse_dsum_type_of_tag' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x)))\nlet parse_dsum_eq3\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (input: bytes)\n: Lemma\n (parse (parse_dsum t p f g) input == (match parse p input with\n | None -> None\n | Some (r, consumed_k) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) r in\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match parse (parse_dsum_type_of_tag' t f g k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((synth_dsum_case t k x <: dsum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_dsum_eq t p f g input;\n parse_maybe_enum_key_eq p (dsum_enum t) input", "val jump_dsum_cases_eq\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (v1 v2: jump_dsum_cases_t s f g x)\n : GTot Type0\nlet jump_dsum_cases_eq\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (x: dsum_key s)\n (v1 v2 : jump_dsum_cases_t s f g x)\n: GTot Type0\n= True", "val gaccessor_clens_dsum_cases_known_payload\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n : Tot\n (gaccessor (parse_dsum_cases' t f g (Known k))\n (dsnd (f k))\n (clens_dsum_cases_payload t (Known k)))\nlet gaccessor_clens_dsum_cases_known_payload\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (gaccessor (parse_dsum_cases' t f g (Known k)) (dsnd (f k)) (clens_dsum_cases_payload t (Known k)))\n= synth_dsum_case_injective t (Known k);\n synth_dsum_case_inverse t (Known k);\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t (Known k)) (synth_dsum_case_recip t (Known k)) ();\n gaccessor_ext\n (gaccessor_synth (dsnd (f k)) (synth_dsum_case t (Known k)) (synth_dsum_case_recip t (Known k)) ())\n (clens_dsum_cases_payload t (Known k))\n ()", "val read_sum_cases'\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: (x: sum_key t -> Tot (leaf_reader (dsnd (pc x)))))\n (k: sum_key t)\n : Tot (leaf_reader (parse_sum_cases' t pc k))\nlet read_sum_cases'\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (leaf_reader (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (leaf_reader (parse_sum_cases' t pc k))\n= [@inline_let]\n let _ = synth_sum_case_injective t k in\n read_synth'\n (dsnd (pc k))\n (synth_sum_case t k)\n (pc32 k)\n ()", "val jump_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (jumper (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': jumper g)\n (x: dsum_key s)\n : Tot (jump_dsum_cases_t s f g x)\nlet jump_dsum_cases'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (jumper (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : jumper g)\n (x: dsum_key s)\n: Tot (jump_dsum_cases_t s f g x)\n= synth_dsum_case_injective s x;\n match x with\n | Known x' -> jump_synth (f' x') (synth_dsum_case s (Known x')) () <: jumper (parse_dsum_cases' s f g x)\n | Unknown x' -> jump_synth g' (synth_dsum_case s (Unknown x')) () <: jumper (parse_dsum_cases' s f g x)", "val validate_dsum_cases'_destr\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (validator (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': validator g)\n (destr: dep_enum_destr _ (fun k -> validate_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n : Tot (validate_dsum_cases_t s f g x)\nlet validate_dsum_cases'_destr\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (validator (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : validator g)\n (destr: dep_enum_destr _ (fun k -> validate_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n: Tot (validate_dsum_cases_t s f g x)\n= fun #rrel #rel input pos ->\n match x with\n | Known k ->\n destr\n _\n (fun k -> validate_dsum_cases_if s f g (Known k))\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (fun k -> validate_dsum_cases' s f f' g' (Known k))\n k\n input\n pos\n | Unknown r -> validate_dsum_cases' s f f' g' (Unknown r) input pos", "val gaccessor_clens_dsum_cases_unknown_payload\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_unknown_key t)\n : Tot\n (gaccessor (parse_dsum_cases' t f g (Unknown k)) g (clens_dsum_cases_payload t (Unknown k)))\nlet gaccessor_clens_dsum_cases_unknown_payload\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_unknown_key t)\n: Tot (gaccessor (parse_dsum_cases' t f g (Unknown k)) g (clens_dsum_cases_payload t (Unknown k)))\n= synth_dsum_case_injective t (Unknown k);\n synth_dsum_case_inverse t (Unknown k);\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t (Unknown k)) (synth_dsum_case_recip t (Unknown k)) ();\n gaccessor_ext\n (gaccessor_synth g (synth_dsum_case t (Unknown k)) (synth_dsum_case_recip t (Unknown k)) ())\n (clens_dsum_cases_payload t (Unknown k))\n ()", "val jump_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (v: jumper p)\n (p32: leaf_reader p)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (f32: (x: dsum_known_key t -> Tot (jumper (dsnd (f x)))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: jumper g)\n (destr: dep_maybe_enum_destr_t (dsum_enum t) (jump_dsum_cases_t t f g))\n : Tot (jumper (parse_dsum t p f g))\nlet jump_dsum\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (v: jumper p)\n (p32: leaf_reader p)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (jumper (dsnd (f x))))\n (#k': parser_kind)\n (#g: parser k' (dsum_type_of_unknown_tag t))\n (g32: jumper g)\n (destr: dep_maybe_enum_destr_t (dsum_enum t) (jump_dsum_cases_t t f g))\n: Tot (jumper (parse_dsum t p f g))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ = parse_dsum_eq' t p f g (bytes_of_slice_from h input pos) in\n [@inline_let]\n let _ = valid_facts (parse_dsum t p f g) h input pos in\n [@inline_let]\n let _ = valid_facts p h input pos in\n let pos_after_tag = v input pos in\n let tg = p32 input pos in\n [@inline_let]\n let _ = valid_facts (parse_dsum_cases' t f g (maybe_enum_key_of_repr (dsum_enum t) tg)) h input pos_after_tag in\n destr (jump_dsum_cases_eq t f g) (jump_dsum_cases_if t f g) (fun _ _ -> ()) (fun _ _ _ _ -> ()) (jump_dsum_cases' t f f32 g32) tg input pos_after_tag", "val accessor_clens_dsum_cases_unknown_payload\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_unknown_key t)\n : Tot (accessor (gaccessor_clens_dsum_cases_unknown_payload t f g k))\nlet accessor_clens_dsum_cases_unknown_payload\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_unknown_key t)\n: Tot (accessor (gaccessor_clens_dsum_cases_unknown_payload t f g k))\n= [@inline_let]\n let _ =\n synth_dsum_case_injective t (Unknown k);\n synth_dsum_case_inverse t (Unknown k);\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t (Unknown k)) (synth_dsum_case_recip t (Unknown k)) ()\n in\n accessor_ext\n (accessor_synth g (synth_dsum_case t (Unknown k)) (synth_dsum_case_recip t (Unknown k)) ())\n (clens_dsum_cases_payload t (Unknown k))\n ()", "val weaken_parse_dsum_cases_kind'\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (#k': parser_kind)\n (p: parser k' (dsum_type_of_unknown_tag s))\n : Tot parser_kind\nlet weaken_parse_dsum_cases_kind'\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (#k' : parser_kind)\n (p: parser k' (dsum_type_of_unknown_tag s))\n: Tot parser_kind\n= weaken_parse_dsum_cases_kind s f k'", "val parse_dsum_kind\n (kt: parser_kind)\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (k: parser_kind)\n : Tot parser_kind\nlet parse_dsum_kind\n (kt: parser_kind)\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (k: parser_kind)\n: Tot parser_kind\n= and_then_kind kt (weaken_parse_dsum_cases_kind s f k)", "val parse_sum_cases'\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (x: sum_key s)\n : Tot (parser (dfst (f x)) (sum_cases s x))\nlet parse_sum_cases'\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (x: sum_key s)\n: Tot (parser (dfst (f x)) (sum_cases s x))\n=\n synth_sum_case_injective s x;\n dsnd (f x) `parse_synth` synth_sum_case s x", "val read_sum_cases\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: (x: sum_key t -> Tot (leaf_reader (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (read_sum_cases_t t pc))\n (k: sum_key t)\n : Tot (leaf_reader (parse_sum_cases' t pc k))\nlet read_sum_cases \n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (leaf_reader (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (read_sum_cases_t t pc))\n (k: sum_key t)\n: Tot (leaf_reader (parse_sum_cases' t pc k))\n= destr\n _\n (read_sum_cases_t_if t pc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (read_sum_cases' t pc pc32)\n k", "val parse32_filter\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (p32: parser32 p)\n (f: (t -> GTot bool))\n (g: (x: t -> Tot (b: bool{b == f x})))\n : Tot (parser32 (parse_filter p f))\nlet parse32_filter\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (p32: parser32 p)\n (f: (t -> GTot bool))\n (g: ((x: t) -> Tot (b: bool { b == f x } )))\n: Tot (parser32 (parse_filter p f))\n= fun (input: bytes32) ->\n ((\n [@inline_let] let _ = parse_filter_eq p f (B32.reveal input) in\n match p32 input with\n | Some (v, consumed) ->\n if g v\n then\n [@inline_let]\n let (v' : t { f v' == true } ) = v in\n\tSome (v', consumed)\n else\n None\n | _ -> None\n ) <: (res: option ((v': t { f v' == true } ) * U32.t) { parser32_correct (parse_filter p f) input res } ))", "val parse32_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: (k: kt1 -> Tot (parser pk (t k))))\n (p32: (k: kt1 -> Tot (parser32 (p k))))\n (k: kt2)\n : Tot (parser32 (p (f k)))\nlet parse32_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: ((k: kt1) -> Tot (parser pk (t k))))\n (p32: ((k: kt1) -> Tot (parser32 (p k))))\n (k: kt2)\n: Tot (parser32 (p (f k)))\n= fun input -> p32 (f k) input", "val accessor_dsum_tag\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n : Tot (accessor (gaccessor_dsum_tag t p f g))\nlet accessor_dsum_tag\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n: Tot (accessor (gaccessor_dsum_tag t p f g))\n= accessor_tagged_union_tag\n (parse_maybe_enum_key p (dsum_enum t))\n (dsum_tag_of_data t)\n (parse_dsum_cases t f g)", "val weaken_parse_dsum_cases_kind\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (k': parser_kind)\n : Tot parser_kind\nlet weaken_parse_dsum_cases_kind\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (k' : parser_kind)\n: Tot parser_kind\n= let keys : list (dsum_key_type s) = List.Tot.map fst (dsum_enum s) in\n glb_list_of #(dsum_key_type s) (fun (x: dsum_key_type s) ->\n if List.Tot.mem x keys\n then let (| k, _ |) = f x in k\n else k'\n ) (List.Tot.map fst (dsum_enum s)) `glb` k'", "val gaccessor_dsum_tag\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n : Tot (gaccessor (parse_dsum t p f g) (parse_maybe_enum_key p (dsum_enum t)) (clens_dsum_tag t))\nlet gaccessor_dsum_tag\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n: Tot (gaccessor (parse_dsum t p f g) (parse_maybe_enum_key p (dsum_enum t)) (clens_dsum_tag t))\n= gaccessor_tagged_union_tag\n (parse_maybe_enum_key p (dsum_enum t))\n (dsum_tag_of_data t)\n (parse_dsum_cases t f g)", "val parse_sum_cases\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (x: sum_key s)\n : Tot (parser (weaken_parse_cases_kind s f) (sum_cases s x))\nlet parse_sum_cases\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (x: sum_key s)\n: Tot (parser (weaken_parse_cases_kind s f) (sum_cases s x))\n= synth_sum_case_injective s x;\n weaken (weaken_parse_cases_kind s f) (dsnd (f x)) `parse_synth` (synth_sum_case s x)", "val serialize32_bitsum\n (#kt: parser_kind)\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (#p: parser kt t)\n (#s: serializer p)\n (s32: serializer32 s {kt.parser_kind_subkind == Some ParserStrong})\n (#f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))\n (g: (x: bitsum'_key_type b -> Tot (serializer (dsnd (f x)))))\n (g32: (x: bitsum'_key_type b -> Tot (serializer32 (g x))))\n (sq: squash (serialize32_bitsum_cond b kt type_of_tag f))\n : Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))\nlet serialize32_bitsum\n (#kt: parser_kind)\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (#p: parser kt t)\n (#s: serializer p)\n (s32: serializer32 s { kt.parser_kind_subkind == Some ParserStrong } )\n (#f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))\n (g: (x: bitsum'_key_type b) -> Tot (serializer (dsnd (f x))))\n (g32: (x: bitsum'_key_type b) -> Tot (serializer32 (g x)))\n (sq: squash (\n serialize32_bitsum_cond b kt type_of_tag f\n ))\n: Tot (serializer32 (serialize_bitsum b tag_of_data type_of_tag synth_case s #f g))\n=\n fun x ->\n serialize_bitsum_eq b tag_of_data type_of_tag synth_case s g x;\n let tg = tag_of_data x in\n let k = bitsum'_key_of_t b tg in\n let payload = synth_case.g tg x in\n let s_tg = s32 (synth_bitsum'_recip b tg) in\n let s_pl = g32 k payload in\n s_tg `B32.append` s_pl", "val jump_dsum_cases'_destr\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (f': (x: dsum_known_key s -> Tot (jumper (dsnd (f x)))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g': jumper g)\n (destr: dep_enum_destr _ (fun k -> jump_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n : Tot (jump_dsum_cases_t s f g x)\nlet jump_dsum_cases'_destr\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (f' : (x: dsum_known_key s) -> Tot (jumper (dsnd (f x))))\n (#k: parser_kind)\n (#g: parser k (dsum_type_of_unknown_tag s))\n (g' : jumper g)\n (destr: dep_enum_destr _ (fun k -> jump_dsum_cases_t s f g (Known k)))\n (x: dsum_key s)\n: Tot (jump_dsum_cases_t s f g x)\n= fun #rrel #rel input pos ->\n match x with\n | Known k ->\n destr\n _\n (fun k -> jump_dsum_cases_if s f g (Known k))\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (fun k -> jump_dsum_cases' s f f' g' (Known k))\n k\n input\n pos\n | Unknown r -> jump_dsum_cases' s f f' g' (Unknown r) input pos", "val parse32_dtuple2\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (p1': parser32 p1)\n (#k2: parser_kind)\n (#t2: (t1 -> Tot Type))\n (#p2: (x: t1 -> Tot (parser k2 (t2 x))))\n (p2': (x: t1 -> Tot (parser32 (p2 x))))\n : Tot (parser32 (parse_dtuple2 p1 p2))\nlet parse32_dtuple2\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (p1' : parser32 p1)\n (#k2: parser_kind)\n (#t2: (t1 -> Tot Type))\n (#p2: (x: t1) -> Tot (parser k2 (t2 x)))\n (p2' : (x: t1) -> Tot (parser32 (p2 x)))\n: Tot (parser32 (parse_dtuple2 p1 p2))\n= fun (input: bytes32) ->\n ((\n [@inline_let] let _ = parse_dtuple2_eq p1 p2 (B32.reveal input) in\n match p1' input with\n | Some (v, l) ->\n let input' = B32.slice input l (B32.len input) in\n begin match p2' v input' with\n | Some (v', l') ->\n Some ((| v, v' |), U32.add l l')\n | _ -> None\n end\n | _ -> None\n ) <: (res: option (dtuple2 t1 t2 * U32.t) { parser32_correct (parse_dtuple2 p1 p2) input res } ))", "val parse32_ifthenelse\n (p: parse_ifthenelse_param)\n (pt32: parser32 p.parse_ifthenelse_tag_parser)\n (b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))\n (pp32: (b: bool -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b)))))\n (synt:\n (\n b: bool ->\n t: p.parse_ifthenelse_tag_t{b == p.parse_ifthenelse_tag_cond t} ->\n pl: p.parse_ifthenelse_payload_t b\n -> Tot (y: p.parse_ifthenelse_t{y == p.parse_ifthenelse_synth t pl})))\n : Tot (parser32 (parse_ifthenelse p))\nlet parse32_ifthenelse\n (p: parse_ifthenelse_param)\n (pt32: parser32 p.parse_ifthenelse_tag_parser)\n (b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))\n (pp32: (b: bool) -> Tot (parser32 (dsnd (p.parse_ifthenelse_payload_parser b))))\n (synt: (b: bool) -> (t: p.parse_ifthenelse_tag_t { b == p.parse_ifthenelse_tag_cond t } ) -> (pl: p.parse_ifthenelse_payload_t b) -> Tot (y: p.parse_ifthenelse_t { y == p.parse_ifthenelse_synth t pl } ))\n: Tot (parser32 (parse_ifthenelse p))\n= fun input ->\n ((\n [@inline_let]\n let _ = parse_ifthenelse_eq p (B32.reveal input) in\n match pt32 input with\n | None -> None\n | Some (t, consumed_t) ->\n let b = b32 t in\n let input' = B32.slice input consumed_t (B32.len input) in\n if b\n then\n match pp32 true input' with\n | None -> None\n | Some (pl, consumed_pl) ->\n Some (synt true t pl, consumed_t `U32.add` consumed_pl)\n else\n match pp32 false input' with\n | None -> None\n | Some (pl, consumed_pl) ->\n Some (synt false t pl, consumed_t `U32.add` consumed_pl)\n ) <: (res: _ { parser32_correct (parse_ifthenelse p) input res } )\n )", "val validate_sum_cases\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (vc: (x: sum_key t -> Tot (validator (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (validate_sum_cases_t t pc))\n (k: sum_key t)\n : Tot (validator (parse_sum_cases t pc k))\nlet validate_sum_cases \n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (vc: ((x: sum_key t) -> Tot (validator (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (validate_sum_cases_t t pc))\n (k: sum_key t)\n: Tot (validator (parse_sum_cases t pc k))\n= destr\n _\n (validate_sum_cases_t_if t pc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (validate_sum_cases_aux t pc vc)\n k", "val parse32_and_then\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (p32: parser32 p)\n (#k': parser_kind)\n (#t': Type)\n (p': (t -> Tot (parser k' t')))\n (u: unit{and_then_cases_injective p'})\n (p32': (x: t -> Tot (parser32 (p' x))))\n : Tot (parser32 (p `and_then` p'))\nlet parse32_and_then\n (#k: parser_kind)\n (#t:Type)\n (#p:parser k t)\n (p32: parser32 p)\n (#k': parser_kind)\n (#t':Type)\n (p': (t -> Tot (parser k' t')))\n (u: unit { and_then_cases_injective p' } )\n (p32' : ((x: t) -> Tot (parser32 (p' x))))\n: Tot (parser32 (p `and_then` p'))\n= fun (input: bytes32) ->\n ((\n [@inline_let] let _ = and_then_eq p p' (B32.reveal input) in\n match p32 input with\n | Some (v, l) ->\n let input' = B32.slice input l (B32.len input) in\n begin match p32' v input' with\n | Some (v', l') ->\n Some (v', U32.add l l')\n | _ -> None\n end\n | _ -> None\n ) <: (res: option (t' * U32.t) { parser32_correct (p `and_then` p') input res } ))", "val serialize32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p {kt.parser_kind_subkind == Some ParserStrong})\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: (x: sum_key t -> Tot (serializer (dsnd (pc x)))))\n (sc32: (x: sum_key t -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n : Tot (serializer32 (serialize_sum t s sc))\nlet serialize32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p {kt.parser_kind_subkind == Some ParserStrong})\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n: Tot (serializer32 (serialize_sum t s sc))\n= fun x #rrel #rel b pos ->\n serialize_sum_eq t s sc x;\n let tg = sum_tag_of_data t x in\n serialize32_nondep_then_aux s32 (serialize32_sum_cases t sc sc32 destr tg) tg x b pos", "val weaken_parse_bitsum_cases_kind\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))\n : Tot (k: parser_kind{forall (x: bitsum'_key_type b). k `is_weaker_than` (dfst (f x))})\nlet weaken_parse_bitsum_cases_kind\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))\n: Tot (k: parser_kind { forall (x: bitsum'_key_type b) . k `is_weaker_than` dfst (f x) })\n= let (| k, phi |) = weaken_parse_bitsum_cases_kind' b (fun k -> dfst (f k)) in\n Classical.forall_intro phi;\n k", "val validate_sum_cases_aux\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (vc: (x: sum_key t -> Tot (validator (dsnd (pc x)))))\n (k: sum_key t)\n : Tot (validator (parse_sum_cases t pc k))\nlet validate_sum_cases_aux\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (vc: ((x: sum_key t) -> Tot (validator (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (validator (parse_sum_cases t pc k))\n= [@inline_let]\n let _ = synth_sum_case_injective t k in\n validate_synth\n (validate_weaken\n (weaken_parse_cases_kind t pc)\n (vc k)\n ()\n )\n (synth_sum_case t k)\n ()", "val parse_bitsum_cases\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))\n (x: bitsum'_type b)\n : Tot\n (parser (weaken_parse_bitsum_cases_kind b type_of_tag f) (refine_with_tag (tag_of_data) x))\nlet parse_bitsum_cases\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (#data: Type)\n (tag_of_data: (data -> Tot (bitsum'_type b)))\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (synth_case: synth_case_t b data tag_of_data type_of_tag)\n (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))\n (x: bitsum'_type b)\n: Tot (parser (weaken_parse_bitsum_cases_kind b type_of_tag f) (refine_with_tag (tag_of_data) x))\n= let tg : bitsum'_key_type b = bitsum'_key_of_t b x in\n let (| k_, p |) = f tg in\n weaken (weaken_parse_bitsum_cases_kind b type_of_tag f) (p `parse_synth` synth_case.f x)", "val finalize_dsum_case_known\n (t: dsum)\n (#kt: parser_kind)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (w: leaf_writer_strong s)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (destr: enum_repr_of_key'_t (dsum_enum t))\n (k: dsum_known_key t)\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n let len_tag = serialized_length (serialize_enum_key _ s (dsum_enum t)) k in\n U32.v pos + len_tag < 4294967296 /\\\n (let pos_payload = pos `U32.add` (U32.uint_to_t len_tag) in\n valid (dsnd (f k)) h input pos_payload /\\\n writable input.base (U32.v pos) (U32.v pos_payload) h)))\n (ensures\n (fun h _ h' ->\n let len_tag = serialized_length (serialize_enum_key _ s (dsum_enum t)) k in\n let pos_payload = pos `U32.add` (U32.uint_to_t len_tag) in\n B.modifies (loc_slice_from_to input pos pos_payload) h h' /\\\n valid_content_pos (parse_dsum t p f g)\n h'\n input\n pos\n (synth_dsum_case t (Known k) (contents (dsnd (f k)) h input pos_payload))\n (get_valid_pos (dsnd (f k)) h input pos_payload)))\nlet finalize_dsum_case_known\n (t: dsum)\n (#kt: parser_kind)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (w: leaf_writer_strong s)\n (f: ((x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (destr: enum_repr_of_key'_t (dsum_enum t))\n (k: dsum_known_key t)\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n: HST.Stack unit\n (requires (fun h ->\n let len_tag = serialized_length (serialize_enum_key _ s (dsum_enum t)) k in\n U32.v pos + len_tag < 4294967296 /\\ (\n let pos_payload = pos `U32.add` U32.uint_to_t len_tag in\n valid (dsnd (f k)) h input pos_payload /\\\n writable input.base (U32.v pos) (U32.v pos_payload) h\n )))\n (ensures (fun h _ h' ->\n let len_tag = serialized_length (serialize_enum_key _ s (dsum_enum t)) k in\n let pos_payload = pos `U32.add` U32.uint_to_t len_tag in\n B.modifies (loc_slice_from_to input pos pos_payload) h h' /\\\n valid_content_pos (parse_dsum t p f g) h' input pos (synth_dsum_case t (Known k) (contents (dsnd (f k)) h input pos_payload)) (get_valid_pos (dsnd (f k)) h input pos_payload)\n ))\n= let pos1 = write_enum_key w (dsum_enum t) destr k input pos in\n let h = HST.get () in\n [@inline_let]\n let _ =\n valid_facts (parse_enum_key p (dsum_enum t)) h input pos;\n valid_facts (parse_maybe_enum_key p (dsum_enum t)) h input pos;\n let sq = bytes_of_slice_from h input pos in\n parse_enum_key_eq p (dsum_enum t) sq;\n parse_maybe_enum_key_eq p (dsum_enum t) sq;\n valid_dsum_intro_known h t p f g input pos\n in\n ()", "val validate_sum_aux_payload_if\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: maybe_enum_key (sum_enum t))\n : Tot (if_combinator _ (validate_sum_aux_payload_eq t pc k))\nlet validate_sum_aux_payload_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: maybe_enum_key (sum_enum t))\n: Tot (if_combinator _ (validate_sum_aux_payload_eq t pc k))\n= validate_sum_aux_payload_if' t pc k", "val jump_sum_aux_payload_if\n (t: sum)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: maybe_enum_key (sum_enum t))\n : Tot (if_combinator _ (jump_sum_aux_payload_eq t pc k))\nlet jump_sum_aux_payload_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: maybe_enum_key (sum_enum t))\n: Tot (if_combinator _ (jump_sum_aux_payload_eq t pc k))\n= jump_sum_aux_payload_if' t pc k", "val serialize_dsum_type_of_tag\n (s: dsum)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (sr: (x: dsum_known_key s -> Tot (serializer (dsnd (f x)))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_key s)\n : Tot (serializer (parse_dsum_type_of_tag s f g x))\nlet serialize_dsum_type_of_tag\n (s: dsum)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (sr: (x: dsum_known_key s) -> Tot (serializer (dsnd (f x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_key s)\n: Tot (serializer (parse_dsum_type_of_tag s f g x))\n= match x with\n | Known x' ->\n serialize_ext (dsnd (f x')) (sr x') (parse_dsum_type_of_tag s f g x)\n | Unknown x' ->\n serialize_ext g sg (parse_dsum_type_of_tag s f g x)", "val size32_ifthenelse\n (#p: parse_ifthenelse_param)\n (s:\n serialize_ifthenelse_param p\n { let tk = p.parse_ifthenelse_tag_kind in\n tk.parser_kind_subkind == Some ParserStrong /\\ Some? tk.parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\\\n Some?.v tk.parser_kind_high +\n Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <\n 4294967296 /\\\n Some?.v tk.parser_kind_high +\n Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <\n 4294967296 })\n (st32: size32 s.serialize_ifthenelse_tag_serializer)\n (syntt:\n (x: p.parse_ifthenelse_t\n -> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})\n ))\n (b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))\n (syntp:\n (\n b: bool ->\n x:\n p.parse_ifthenelse_t\n {b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}\n -> Tot\n (pl:\n p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}\n )))\n (sp32: (b: bool -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b))))\n : Tot (size32 (serialize_ifthenelse s))\nlet size32_ifthenelse\n (#p: parse_ifthenelse_param)\n (s: serialize_ifthenelse_param p {\n let tk = p.parse_ifthenelse_tag_kind in\n tk.parser_kind_subkind == Some ParserStrong /\\\n Some? tk.parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\\\n Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\\\n Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296\n })\n (st32: size32 s.serialize_ifthenelse_tag_serializer)\n (syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))\n (b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))\n (syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))\n (sp32: (b: bool) -> Tot (size32 (s.serialize_ifthenelse_payload_serializer b)))\n: Tot (size32 (serialize_ifthenelse s))\n= fun (input: p.parse_ifthenelse_t) -> ((\n let t = syntt input in\n let st = st32 t in\n let b = b32 t in\n if b\n then\n let y = syntp true input in\n U32.add st (sp32 true y)\n else\n let y = syntp false input in\n U32.add st (sp32 false y)\n ) <: (res: _ { size32_postcond (serialize_ifthenelse s) input res }))", "val read_sum\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: leaf_reader (parse_enum_key p (sum_enum t)))\n (j: jumper p)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: (x: sum_key t -> Tot (leaf_reader (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (read_sum_cases_t t pc))\n : Tot (leaf_reader (parse_sum t p pc))\nlet read_sum\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: leaf_reader (parse_enum_key p (sum_enum t)))\n (j: jumper p)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (leaf_reader (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (read_sum_cases_t t pc))\n: Tot (leaf_reader (parse_sum t p pc))\n=\n fun #_ #_ input pos ->\n let h = HST.get () in\n valid_facts (parse_sum t p pc) h input pos;\n parse_sum_eq' t p pc (bytes_of_slice_from h input pos);\n valid_facts (parse_enum_key p (sum_enum t)) h input pos;\n let k = p32 input pos in\n let pos' = jump_enum_key j (sum_enum t) input pos in\n valid_facts (parse_sum_cases' t pc k) h input pos' ;\n read_sum_cases t pc pc32 destr k input pos'", "val serialize_dsum_eq\n (#kt: parser_kind)\n (s: dsum)\n (#pt: parser kt (dsum_repr_type s))\n (st: serializer pt)\n (f: (x: dsum_known_key s -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x))))\n (sr: (x: dsum_known_key s -> Tot (serializer (dsnd (f x)))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_type s)\n : Lemma (requires (kt.parser_kind_subkind == Some ParserStrong))\n (ensures\n (serialize (serialize_dsum s st f sr g sg) x ==\n (let tg = dsum_tag_of_data s x in\n (serialize (serialize_maybe_enum_key _ st (dsum_enum s)) tg)\n `Seq.append`\n (match tg with\n | Known k -> serialize (sr k) (synth_dsum_case_recip s tg x)\n | Unknown k -> serialize sg (synth_dsum_case_recip s tg x)))))\nlet serialize_dsum_eq\n (#kt: parser_kind) \n (s: dsum)\n (#pt: parser kt (dsum_repr_type s))\n (st: serializer pt)\n (f: (x: dsum_known_key s) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag s x)))\n (sr: (x: dsum_known_key s) -> Tot (serializer (dsnd (f x))))\n (#k: parser_kind)\n (g: parser k (dsum_type_of_unknown_tag s))\n (sg: serializer g)\n (x: dsum_type s)\n: Lemma\n (requires (kt.parser_kind_subkind == Some ParserStrong))\n (ensures (\n serialize (serialize_dsum s st f sr g sg) x == (\n let tg = dsum_tag_of_data s x in\n serialize (serialize_maybe_enum_key _ st (dsum_enum s)) tg `Seq.append` (\n match tg with\n | Known k -> serialize (sr k) (synth_dsum_case_recip s tg x)\n | Unknown k -> serialize sg (synth_dsum_case_recip s tg x)\n ))))\n= serialize_dsum_eq' s st f sr g sg x;\n let tg = dsum_tag_of_data s x in\n synth_dsum_case_injective s tg;\n synth_dsum_case_inverse s tg;\n serialize_synth_eq\n _\n (synth_dsum_case s tg)\n (serialize_dsum_type_of_tag s f sr g sg tg)\n (synth_dsum_case_recip s tg)\n ()\n x", "val serialize32_ifthenelse\n (#p: parse_ifthenelse_param)\n (s:\n serialize_ifthenelse_param p\n { let tk = p.parse_ifthenelse_tag_kind in\n tk.parser_kind_subkind == Some ParserStrong /\\ Some? tk.parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\\\n Some?.v tk.parser_kind_high +\n Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high <\n 4294967296 /\\\n Some?.v tk.parser_kind_high +\n Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high <\n 4294967296 })\n (st32: serializer32 s.serialize_ifthenelse_tag_serializer)\n (syntt:\n (x: p.parse_ifthenelse_t\n -> Tot (t: p.parse_ifthenelse_tag_t{t == dfst (s.serialize_ifthenelse_synth_recip x)})\n ))\n (b32: (t: p.parse_ifthenelse_tag_t -> Tot (b: bool{b == p.parse_ifthenelse_tag_cond t})))\n (syntp:\n (\n b: bool ->\n x:\n p.parse_ifthenelse_t\n {b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x))}\n -> Tot\n (pl:\n p.parse_ifthenelse_payload_t b {pl == dsnd (s.serialize_ifthenelse_synth_recip x)}\n )))\n (sp32: (b: bool -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b))))\n : Tot (serializer32 (serialize_ifthenelse s))\nlet serialize32_ifthenelse\n (#p: parse_ifthenelse_param)\n (s: serialize_ifthenelse_param p {\n let tk = p.parse_ifthenelse_tag_kind in\n tk.parser_kind_subkind == Some ParserStrong /\\\n Some? tk.parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high /\\\n Some? (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high /\\\n Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser true)).parser_kind_high < 4294967296 /\\\n Some?.v tk.parser_kind_high + Some?.v (dfst (p.parse_ifthenelse_payload_parser false)).parser_kind_high < 4294967296\n })\n (st32: serializer32 s.serialize_ifthenelse_tag_serializer)\n (syntt: (x: p.parse_ifthenelse_t) -> Tot (t: p.parse_ifthenelse_tag_t { t == dfst (s.serialize_ifthenelse_synth_recip x) } ))\n (b32: (t: p.parse_ifthenelse_tag_t) -> Tot (b: bool { b == p.parse_ifthenelse_tag_cond t } ))\n (syntp: (b: bool) -> (x: p.parse_ifthenelse_t { b == p.parse_ifthenelse_tag_cond (dfst (s.serialize_ifthenelse_synth_recip x)) } ) -> Tot (pl: p.parse_ifthenelse_payload_t b { pl == dsnd (s.serialize_ifthenelse_synth_recip x) } ))\n (sp32: (b: bool) -> Tot (serializer32 (s.serialize_ifthenelse_payload_serializer b)))\n: Tot (serializer32 (serialize_ifthenelse s))\n= fun (input: p.parse_ifthenelse_t) -> ((\n let t = syntt input in\n let st = st32 t in\n let b = b32 t in\n if b\n then\n let y = syntp true input in\n B32.append st (sp32 true y)\n else\n let y = syntp false input in\n B32.append st (sp32 false y)\n ) <: (res: _ { serializer32_correct (serialize_ifthenelse s) input res }))", "val parse32_maybe_enum_key_gen\n (#k: parser_kind)\n (#key #repr: eqtype)\n (#p: parser k repr)\n (p32: parser32 p)\n (e: enum key repr)\n (k': parser_kind)\n (t': Type)\n (p': parser k' t')\n (u1: unit{k' == k})\n (u15: unit{t' == maybe_enum_key e})\n (u2: unit{p' == parse_maybe_enum_key p e})\n (f: maybe_enum_key_of_repr'_t e)\n : Tot (parser32 p')\nlet parse32_maybe_enum_key_gen\n (#k: parser_kind)\n (#key #repr: eqtype)\n (#p: parser k repr)\n (p32: parser32 p)\n (e: enum key repr)\n (k' : parser_kind)\n (t' : Type)\n (p' : parser k' t')\n (u1: unit { k' == k })\n (u15: unit { t' == maybe_enum_key e } )\n (u2: unit { p' == parse_maybe_enum_key p e } )\n (f: maybe_enum_key_of_repr'_t e)\n: Tot (parser32 p')\n= parse32_synth p (maybe_enum_key_of_repr e) f p32 ()", "val gaccessor_clens_dsum_payload\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_key t)\n : Tot\n (gaccessor (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k))\nlet gaccessor_clens_dsum_payload\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_key t)\n: Tot (gaccessor (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k))\n= Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_clens_dsum_payload_injective t p f g k x));\n Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_clens_dsum_payload_no_lookahead t p f g k x));\n gaccessor_prop_equiv (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k) (gaccessor_clens_dsum_payload' t p f g k);\n gaccessor_clens_dsum_payload' t p f g k", "val parse_sum'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (#k: parser_kind)\n (pc: (x: sum_key t -> Tot (parser k (sum_cases t x))))\n : Tot (parser (and_then_kind (parse_filter_kind kt) k) (sum_type t))\nlet parse_sum'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (#k: parser_kind)\n (pc: ((x: sum_key t) -> Tot (parser k (sum_cases t x))))\n: Tot (parser (and_then_kind (parse_filter_kind kt) k) (sum_type t))\n= parse_tagged_union\n #(parse_filter_kind kt)\n #(sum_key t)\n (parse_enum_key p (sum_enum t))\n #(sum_type t)\n (sum_tag_of_data t)\n #k\n pc", "val serialize_dsum'\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (#k: parser_kind)\n (#pc: (x: dsum_key t -> Tot (parser k (dsum_cases t x))))\n (sc: (x: dsum_key t -> Tot (serializer (pc x))))\n : Pure (serializer (parse_dsum' t p pc))\n (requires (kt.parser_kind_subkind == Some ParserStrong))\n (ensures (fun _ -> True))\nlet serialize_dsum'\n (#kt: parser_kind)\n (t: dsum)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (#k: parser_kind)\n (#pc: ((x: dsum_key t) -> Tot (parser k (dsum_cases t x))))\n (sc: ((x: dsum_key t) -> Tot (serializer (pc x))))\n: Pure (serializer (parse_dsum' t p pc))\n (requires (kt.parser_kind_subkind == Some ParserStrong))\n (ensures (fun _ -> True))\n= serialize_tagged_union\n #(kt)\n #(dsum_key t)\n #(parse_maybe_enum_key p (dsum_enum t))\n (serialize_maybe_enum_key p s (dsum_enum t))\n #(dsum_type t)\n (dsum_tag_of_data t)\n #k\n #pc\n sc", "val serialize_sum_cases\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (sr: (x: sum_key s -> Tot (serializer (dsnd (f x)))))\n (x: sum_key s)\n : Tot (serializer (parse_sum_cases s f x))\nlet serialize_sum_cases\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (sr: (x: sum_key s) -> Tot (serializer (dsnd (f x))))\n (x: sum_key s)\n: Tot (serializer (parse_sum_cases s f x))\n= Classical.forall_intro (parse_sum_cases_eq' s f x);\n serialize_ext\n (parse_sum_cases' s f x)\n (serialize_sum_cases' s f sr x)\n (parse_sum_cases s f x)", "val finalize_dsum_case_unknown\n (t: dsum)\n (#kt: parser_kind)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (w: leaf_writer_strong s)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (r: unknown_enum_repr (dsum_enum t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n : HST.Stack unit\n (requires\n (fun h ->\n let len_tag = serialized_length s r in\n U32.v pos + len_tag < 4294967296 /\\\n (let pos_payload = pos `U32.add` (U32.uint_to_t len_tag) in\n valid g h input pos_payload /\\ writable input.base (U32.v pos) (U32.v pos_payload) h))\n )\n (ensures\n (fun h _ h' ->\n let len_tag = serialized_length s r in\n let pos_payload = pos `U32.add` (U32.uint_to_t len_tag) in\n B.modifies (loc_slice_from_to input pos pos_payload) h h' /\\\n valid_content_pos (parse_dsum t p f g)\n h'\n input\n pos\n (synth_dsum_case t (Unknown r) (contents g h input pos_payload))\n (get_valid_pos g h input pos_payload)))\nlet finalize_dsum_case_unknown\n (t: dsum)\n (#kt: parser_kind)\n (#p: parser kt (dsum_repr_type t))\n (s: serializer p)\n (w: leaf_writer_strong s)\n (f: ((x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (r: unknown_enum_repr (dsum_enum t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n: HST.Stack unit\n (requires (fun h ->\n let len_tag = serialized_length s r in\n U32.v pos + len_tag < 4294967296 /\\ (\n let pos_payload = pos `U32.add` U32.uint_to_t len_tag in\n valid g h input pos_payload /\\\n writable input.base (U32.v pos) (U32.v pos_payload) h\n )))\n (ensures (fun h _ h' ->\n let len_tag = serialized_length s r in\n let pos_payload = pos `U32.add` U32.uint_to_t len_tag in\n B.modifies (loc_slice_from_to input pos pos_payload) h h' /\\\n valid_content_pos (parse_dsum t p f g) h' input pos (synth_dsum_case t (Unknown r) (contents g h input pos_payload)) (get_valid_pos g h input pos_payload)\n ))\n= let pos1 = w r input pos in\n let h = HST.get () in\n [@inline_let]\n let _ =\n valid_facts (parse_maybe_enum_key p (dsum_enum t)) h input pos;\n valid_facts p h input pos;\n let sq = bytes_of_slice_from h input pos in\n parse_maybe_enum_key_eq p (dsum_enum t) sq;\n valid_dsum_intro_unknown h t p f g input pos\n in\n ()", "val gaccessor_clens_dsum_unknown_payload\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n : Tot (gaccessor (parse_dsum t p f g) g (clens_dsum_unknown_payload t))\nlet gaccessor_clens_dsum_unknown_payload\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n: Tot (gaccessor (parse_dsum t p f g) g (clens_dsum_unknown_payload t))\n= Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_clens_dsum_unknown_payload_injective t p f g x));\n Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_clens_dsum_unknown_payload_no_lookahead t p f g x));\n gaccessor_prop_equiv (parse_dsum t p f g) g (clens_dsum_unknown_payload t) (gaccessor_clens_dsum_unknown_payload' t p f g); \n gaccessor_clens_dsum_unknown_payload' t p f g", "val validate_sum\n (t: sum)\n (#kt: parser_kind)\n (#p: parser kt (sum_repr_type t))\n (v: validator p)\n (p32: leaf_reader p)\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: (x: sum_key t -> Tot (validator (dsnd (pc x)))))\n (destr: dep_maybe_enum_destr_t (sum_enum t) (validate_sum_aux_payload_t t pc))\n : Tot (validator (parse_sum t p pc))\nlet validate_sum\n (t: sum)\n (#kt: parser_kind)\n (#p: parser kt (sum_repr_type t))\n (v: validator p)\n (p32: leaf_reader p)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (validator (dsnd (pc x)))))\n (destr: dep_maybe_enum_destr_t (sum_enum t) (validate_sum_aux_payload_t t pc))\n: Tot (validator (parse_sum t p pc))\n= validate_sum_aux t v p32 pc (validate_sum_aux_payload t pc pc32 destr)", "val valid_dsum_elim_known\n (h: HS.mem)\n (t: dsum)\n (#kt: parser_kind)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n : Lemma\n (requires\n (valid (parse_dsum t p f g) h input pos /\\\n Known? (dsum_tag_of_data t (contents (parse_dsum t p f g) h input pos))))\n (ensures\n (valid (parse_maybe_enum_key p (dsum_enum t)) h input pos /\\\n (let k' = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n Known? k' /\\\n (let Known k = k' in\n valid (dsnd (f k)) h input pos_payload /\\\n valid_content_pos (parse_dsum t p f g)\n h\n input\n pos\n (synth_dsum_case t (Known k) (contents (dsnd (f k)) h input pos_payload))\n (get_valid_pos (dsnd (f k)) h input pos_payload)))))\nlet valid_dsum_elim_known\n (h: HS.mem)\n (t: dsum)\n (#kt: parser_kind)\n (p: parser kt (dsum_repr_type t))\n (f: ((x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n: Lemma\n (requires (\n valid (parse_dsum t p f g) h input pos /\\\n Known? (dsum_tag_of_data t (contents (parse_dsum t p f g) h input pos))\n ))\n (ensures (\n valid (parse_maybe_enum_key p (dsum_enum t)) h input pos /\\ (\n let k' = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n Known? k' /\\ (\n let Known k = k' in\n valid (dsnd (f k)) h input pos_payload /\\\n valid_content_pos\n (parse_dsum t p f g) h input pos\n (synth_dsum_case t (Known k) (contents (dsnd (f k)) h input pos_payload))\n (get_valid_pos (dsnd (f k)) h input pos_payload)\n ))))\n= \n valid_facts (parse_dsum t p f g) h input pos;\n parse_dsum_eq t p f g (bytes_of_slice_from h input pos);\n valid_facts (parse_maybe_enum_key p (dsum_enum t)) h input pos;\n let Known k = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n valid_facts (dsnd (f k)) h input pos_payload", "val serialize32_bitsum_cond\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (k: parser_kind)\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (f: (x: bitsum'_key_type b -> Tot (k: parser_kind & parser k (type_of_tag x))))\n : Tot bool\nlet serialize32_bitsum_cond\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (b: bitsum' cl tot)\n (k: parser_kind)\n (type_of_tag: (bitsum'_key_type b -> Tot Type))\n (f: (x: bitsum'_key_type b) -> Tot (k: parser_kind & parser k (type_of_tag x)))\n: Tot bool\n= match k.parser_kind_high, (weaken_parse_bitsum_cases_kind b type_of_tag f).parser_kind_high with\n | Some max1, Some max2 -> max1 + max2 < 4294967296\n | _ -> false", "val serialize_sum_cases'\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (sr: (x: sum_key s -> Tot (serializer (dsnd (f x)))))\n (x: sum_key s)\n : Tot (serializer (parse_sum_cases' s f x))\nlet serialize_sum_cases'\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (sr: (x: sum_key s) -> Tot (serializer (dsnd (f x))))\n (x: sum_key s)\n: Tot (serializer (parse_sum_cases' s f x))\n= synth_sum_case_injective s x;\n synth_sum_case_inverse s x;\n (serialize_synth\n _\n (synth_sum_case s x)\n (sr x)\n (synth_sum_case_recip s x)\n ()\n )", "val valid_dsum_elim_unknown\n (h: HS.mem)\n (t: dsum)\n (#kt: parser_kind)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n : Lemma\n (requires\n (valid (parse_dsum t p f g) h input pos /\\\n Unknown? (dsum_tag_of_data t (contents (parse_dsum t p f g) h input pos))))\n (ensures\n (valid (parse_maybe_enum_key p (dsum_enum t)) h input pos /\\\n (let k' = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n Unknown? k' /\\\n (let Unknown r = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n valid g h input pos_payload /\\\n valid_content_pos (parse_dsum t p f g)\n h\n input\n pos\n (synth_dsum_case t (Unknown r) (contents g h input pos_payload))\n (get_valid_pos g h input pos_payload)))))\nlet valid_dsum_elim_unknown\n (h: HS.mem)\n (t: dsum)\n (#kt: parser_kind)\n (p: parser kt (dsum_repr_type t))\n (f: ((x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (#rrel #rel: _)\n (input: slice rrel rel)\n (pos: U32.t)\n: Lemma\n (requires (\n valid (parse_dsum t p f g) h input pos /\\\n Unknown? (dsum_tag_of_data t (contents (parse_dsum t p f g) h input pos))\n ))\n (ensures (\n valid (parse_maybe_enum_key p (dsum_enum t)) h input pos /\\ (\n let k' = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n Unknown? k' /\\ (\n let Unknown r = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n valid g h input pos_payload /\\\n valid_content_pos\n (parse_dsum t p f g) h input pos\n (synth_dsum_case t (Unknown r) (contents g h input pos_payload))\n (get_valid_pos g h input pos_payload)\n ))))\n= \n valid_facts (parse_dsum t p f g) h input pos;\n parse_dsum_eq t p f g (bytes_of_slice_from h input pos);\n valid_facts (parse_maybe_enum_key p (dsum_enum t)) h input pos;\n let Unknown r = contents (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n let pos_payload = get_valid_pos (parse_maybe_enum_key p (dsum_enum t)) h input pos in\n valid_facts g h input pos_payload", "val gaccessor_clens_dsum_payload'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_key t)\n : Tot\n (gaccessor' (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k))\nlet gaccessor_clens_dsum_payload'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n (k: dsum_key t)\n: Tot (gaccessor' (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k))\n= fun (input: bytes) ->\n parse_dsum_eq3 t p f g input;\n let res =\n match parse p input with\n | Some (_, consumed) ->\n synth_dsum_case_inverse t k;\n synth_dsum_case_injective t k;\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t k) (synth_dsum_case_recip t k) ();\n (consumed)\n | _ -> (0) // dummy\n in\n (res <: (res: _ { gaccessor_post' (parse_dsum t p f g) (parse_dsum_type_of_tag' t f g k) (clens_dsum_payload t k) input res } ))", "val parse_sum_cases_eq'\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (x: sum_key s)\n (input: bytes)\n : Lemma (parse (parse_sum_cases s f x) input == parse (parse_sum_cases' s f x) input)\nlet parse_sum_cases_eq'\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (x: sum_key s)\n (input: bytes)\n: Lemma\n (parse (parse_sum_cases s f x) input == parse (parse_sum_cases' s f x) input)\n= synth_sum_case_injective s x;\n parse_synth_eq (weaken (weaken_parse_cases_kind s f) (dsnd (f x))) (synth_sum_case s x) input;\n parse_synth_eq (dsnd (f x)) (synth_sum_case s x) input", "val gaccessor_clens_dsum_unknown_payload'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n : Tot (gaccessor' (parse_dsum t p f g) g (clens_dsum_unknown_payload t))\nlet gaccessor_clens_dsum_unknown_payload'\n (#kt: parser_kind)\n (t: dsum)\n (p: parser kt (dsum_repr_type t))\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#ku: parser_kind)\n (g: parser ku (dsum_type_of_unknown_tag t))\n: Tot (gaccessor' (parse_dsum t p f g) g (clens_dsum_unknown_payload t))\n= fun (input: bytes) ->\n parse_dsum_eq3 t p f g input;\n let res =\n match parse p input with\n | Some (tg, consumed) ->\n let k = maybe_enum_key_of_repr (dsum_enum t) tg in\n synth_dsum_case_inverse t k;\n synth_dsum_case_injective t k;\n synth_injective_synth_inverse_synth_inverse_recip (synth_dsum_case t k) (synth_dsum_case_recip t k) ();\n (consumed)\n | _ -> (0) // dummy\n in\n (res <: (res: _ { gaccessor_post' (parse_dsum t p f g) g (clens_dsum_unknown_payload t) input res } ))", "val parse_sum_cases_eq\n (s: sum)\n (f: (x: sum_key s -> Tot (k: parser_kind & parser k (sum_type_of_tag s x))))\n (x: sum_key s)\n (input: bytes)\n : Lemma\n (parse (parse_sum_cases s f x) input ==\n (match parse (dsnd (f x)) input with\n | None -> None\n | Some (y, consumed) -> Some (synth_sum_case s x y, consumed)))\nlet parse_sum_cases_eq\n (s: sum)\n (f: (x: sum_key s) -> Tot (k: parser_kind & parser k (sum_type_of_tag s x)))\n (x: sum_key s)\n (input: bytes)\n: Lemma\n (parse (parse_sum_cases s f x) input == (match parse (dsnd (f x)) input with\n | None -> None\n | Some (y, consumed) -> Some (synth_sum_case s x y, consumed)\n ))\n= synth_sum_case_injective s x;\n parse_synth_eq (weaken (weaken_parse_cases_kind s f) (dsnd (f x))) (synth_sum_case s x) input", "val parse_sum_eq'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (input: bytes)\n : Lemma\n (parse (parse_sum t p pc) input ==\n (match parse (parse_enum_key p (sum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (parse_sum_cases' t pc k) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: sum_type t), consumed_k + consumed_x)))\nlet parse_sum_eq'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (input: bytes)\n: Lemma\n (parse (parse_sum t p pc) input == (match parse (parse_enum_key p (sum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match\n// parse (synth_sum_case_injective t k; parse_synth (dsnd (pc k)) (synth_sum_case t k)) input_k\n parse (parse_sum_cases' t pc k) input_k\n with\n | None -> None\n | Some (x, consumed_x) -> Some ((x <: sum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_tagged_union_eq_gen\n #(parse_filter_kind kt)\n #(sum_key t)\n (parse_enum_key p (sum_enum t))\n #(sum_type t)\n (sum_tag_of_data t)\n (parse_sum_cases t pc)\n (parse_enum_key p (sum_enum t))\n (fun input -> ())\n (fun k -> dfst (pc k))\n (parse_sum_cases' t pc)\n (fun k input -> parse_sum_cases_eq' t pc k input)\n input", "val size32_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: (k: kt1 -> Tot (parser pk (t k))))\n (s: (k: kt1 -> Tot (serializer (p k))))\n (s32: (k: kt1 -> Tot (size32 (s k))))\n (k: kt2)\n : Tot (size32 (s (f k)))\nlet size32_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: ((k: kt1) -> Tot (parser pk (t k))))\n (s: ((k: kt1) -> Tot (serializer (p k))))\n (s32: ((k: kt1) -> Tot (size32 (s k))))\n (k: kt2)\n: Tot (size32 (s (f k)))\n= fun input -> s32 (f k) input", "val weaken_parse_bitsum_cases_kind'\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (#bitsum'_size: nat)\n (b: bitsum' cl bitsum'_size)\n (f: (x: bitsum'_key_type b -> Tot parser_kind))\n : Tot (k': parser_kind & (x: bitsum'_key_type b -> Lemma (k' `is_weaker_than` (f x))))\n (decreases (bitsum'_size))\nlet rec weaken_parse_bitsum_cases_kind'\n (#tot: pos)\n (#t: eqtype)\n (#cl: uint_t tot t)\n (#bitsum'_size: nat)\n (b: bitsum' cl bitsum'_size)\n (f: (x: bitsum'_key_type b) -> Tot parser_kind)\n: Tot (k' : parser_kind & ((x: bitsum'_key_type b) -> Lemma (k' `is_weaker_than` f x)))\n (decreases (bitsum'_size))\n= match b with\n | BitStop _ -> (| f (), (fun y -> ()) |)\n | BitField sz rest ->\n let (| g, phi |) = weaken_parse_bitsum_cases_kind' rest (fun x -> f (bitsum'_key_type_intro_BitField cl bitsum'_size sz rest x)) in\n (| g, (fun x -> phi (bitsum'_key_type_elim_BitField cl bitsum'_size sz rest x)) |)\n | BitSum' key key_size e payload ->\n let keys : list key = List.Tot.map fst e in\n let phi (x: key) : Tot (k: parser_kind & ((y: bitsum'_key_type b) -> Lemma\n (requires (dfst (bitsum'_key_type_elim_BitSum' cl bitsum'_size key key_size e payload y) == x))\n (ensures (k `is_weaker_than` f y)))) =\n if List.Tot.mem x keys\n then\n let (| k, g |) = weaken_parse_bitsum_cases_kind' (payload x) (fun z -> f (bitsum'_key_type_intro_BitSum' cl bitsum'_size key key_size e payload (| x, z |))) in\n (| k, (fun y ->\n let (| y1, y2 |) = bitsum'_key_type_elim_BitSum' cl bitsum'_size key key_size e payload y in\n assert (y1 == x);\n g y2\n ) |)\n else (| default_parser_kind, (fun y -> ()) |)\n in\n let k = glb_list_of #key (fun x -> dfst (phi x)) keys in\n (| k, (fun y ->\n let (| y1, y2 |) = bitsum'_key_type_elim_BitSum' cl bitsum'_size key key_size e payload y in\n dsnd (phi y1) y\n ) |)", "val parse32_maybe_enum_key\n (#k: parser_kind)\n (#key #repr: eqtype)\n (#p: parser k repr)\n (p32: parser32 p)\n (e: enum key repr)\n (f: maybe_enum_key_of_repr'_t e)\n : Tot (parser32 (parse_maybe_enum_key p e))\nlet parse32_maybe_enum_key\n (#k: parser_kind)\n (#key #repr: eqtype)\n (#p: parser k repr)\n (p32: parser32 p)\n (e: enum key repr)\n (f: maybe_enum_key_of_repr'_t e)\n: Tot (parser32 (parse_maybe_enum_key p e))\n= parse32_maybe_enum_key_gen p32 e _ _ (parse_maybe_enum_key p e) () () () f", "val parse_sum_eq\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (pc: (x: sum_key t -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (input: bytes)\n : Lemma\n (parse (parse_sum t p pc) input ==\n (match parse (parse_enum_key p (sum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n match parse (dsnd (pc k)) input_k with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((synth_sum_case t k x <: sum_type t), consumed_k + consumed_x)))\nlet parse_sum_eq\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (input: bytes)\n: Lemma\n (parse (parse_sum t p pc) input == (match parse (parse_enum_key p (sum_enum t)) input with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n begin match parse (dsnd (pc k)) input_k with\n | None -> None\n | Some (x, consumed_x) -> Some ((synth_sum_case t k x <: sum_type t), consumed_k + consumed_x)\n end\n ))\n= parse_sum_eq' t p pc input;\n match parse (parse_enum_key p (sum_enum t)) input with\n | None -> ()\n | Some (k, consumed_k) ->\n let input_k = Seq.slice input consumed_k (Seq.length input) in\n synth_sum_case_injective t k;\n parse_synth_eq (dsnd (pc k)) (synth_sum_case t k) input_k" ], "closest_src": [ { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_dsum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_sum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_dsum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum_cases_t_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases_if'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum_cases_aux" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_sum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_sum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_cases_kind" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_dsum_cases_t_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases_if'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_sum_cases_t_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum_type_of_tag" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_dsum" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_type_of_tag'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_eq_" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_sum_cases_aux" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_cases_eq'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_type_of_tag" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_eq'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_eq''" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_dsum" }, { "project_name": "everparse", "file_name": "LowParse.SLow.BitSum.fst", "name": "LowParse.SLow.BitSum.parse32_bitsum" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_sum_cases_t_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_sum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.accessor_clens_dsum_cases_known_payload" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_eq3" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases_eq" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_cases_known_payload" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_sum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_dsum_cases'_destr" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_cases_unknown_payload" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.accessor_clens_dsum_cases_unknown_payload" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.weaken_parse_dsum_cases_kind'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_dsum_kind" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_sum_cases" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Combinators.fst", "name": "LowParse.SLow.Combinators.parse32_filter" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Combinators.fst", "name": "LowParse.SLow.Combinators.parse32_compose_context" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.accessor_dsum_tag" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.weaken_parse_dsum_cases_kind" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_dsum_tag" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_cases" }, { "project_name": "everparse", "file_name": "LowParse.SLow.BitSum.fst", "name": "LowParse.SLow.BitSum.serialize32_bitsum" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_dsum_cases'_destr" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Combinators.fst", "name": "LowParse.SLow.Combinators.parse32_dtuple2" }, { "project_name": "everparse", "file_name": "LowParse.SLow.IfThenElse.fst", "name": "LowParse.SLow.IfThenElse.parse32_ifthenelse" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_sum_cases" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Combinators.fst", "name": "LowParse.SLow.Combinators.parse32_and_then" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.serialize32_sum" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BitSum.fst", "name": "LowParse.Spec.BitSum.weaken_parse_bitsum_cases_kind" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_sum_cases_aux" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BitSum.fst", "name": "LowParse.Spec.BitSum.parse_bitsum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.finalize_dsum_case_known" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_sum_aux_payload_if" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.jump_sum_aux_payload_if" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_dsum_type_of_tag" }, { "project_name": "everparse", "file_name": "LowParse.SLow.IfThenElse.fst", "name": "LowParse.SLow.IfThenElse.size32_ifthenelse" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.read_sum" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_dsum_eq" }, { "project_name": "everparse", "file_name": "LowParse.SLow.IfThenElse.fst", "name": "LowParse.SLow.IfThenElse.serialize32_ifthenelse" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Enum.fst", "name": "LowParse.SLow.Enum.parse32_maybe_enum_key_gen" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_payload" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_dsum'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_sum_cases" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.finalize_dsum_case_unknown" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_unknown_payload" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.validate_sum" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.valid_dsum_elim_known" }, { "project_name": "everparse", "file_name": "LowParse.SLow.BitSum.fst", "name": "LowParse.SLow.BitSum.serialize32_bitsum_cond" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.serialize_sum_cases'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.valid_dsum_elim_unknown" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_payload'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_cases_eq'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Sum.fst", "name": "LowParse.Low.Sum.gaccessor_clens_dsum_unknown_payload'" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_cases_eq" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_eq'" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Combinators.fst", "name": "LowParse.SLow.Combinators.size32_compose_context" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BitSum.fst", "name": "LowParse.Spec.BitSum.weaken_parse_bitsum_cases_kind'" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Enum.fst", "name": "LowParse.SLow.Enum.parse32_maybe_enum_key" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Sum.fst", "name": "LowParse.Spec.Sum.parse_sum_eq" } ], "selected_premises": [ "LowParse.Spec.Sum.parse_dsum_kind", "LowParse.Spec.Sum.weaken_parse_dsum_cases_kind", "LowParse.SLow.Sum.parse32_dsum_cases_t_eq", "LowParse.Spec.Sum.parse_dsum_cases_kind", "LowParse.Spec.Sum.weaken_parse_dsum_cases_kind'", "LowParse.Spec.Sum.parse_dsum_type_of_tag'", "LowParse.Spec.Sum.parse_dsum", "LowParse.Spec.Sum.dsum_tag_of_data", "LowParse.Spec.Sum.parse_dsum_type_of_tag", "LowParse.SLow.Sum.parse32_dsum_cases'", "LowParse.Spec.Sum.dsum_repr_type", "LowParse.Spec.Sum.dsum_type_of_tag", "LowParse.Spec.Sum.dsum_key_type", "LowParse.Spec.Sum.parse_dsum_eq3", "LowParse.Spec.Sum.dsum_enum", "LowParse.Spec.Sum.synth_dsum_case_recip", "LowParse.SLow.Sum.parse32_dsum_cases_aux", "LowParse.Spec.Sum.synth_dsum_case", "LowParse.Spec.Sum.parse_dsum_cases", "LowParse.Spec.Sum.parse_dsum_cases'", "LowParse.Spec.Sum.parse_dsum'", "LowParse.Spec.Sum.parse_dsum_eq''", "LowParse.Spec.Sum.synth_dsum_case_inverse", "LowParse.Spec.Sum.parse_dsum_eq'", "LowParse.Spec.Base.parser_kind", "LowParse.Spec.Combinators.parse_filter_kind", "LowParse.Spec.Sum.parse_dsum_eq_", "LowParse.Spec.Combinators.parse_filter_refine", "LowParse.Spec.Base.strong_parser_kind", "LowParse.Spec.Sum.parse_dsum_eq", "LowParse.Spec.Sum.synth_dsum_case_injective", "LowParse.Spec.Combinators.and_then_kind", "LowParse.SLow.Base.bytes32", "LowParse.Spec.Sum.parse_dsum_cases_eq'", "LowParse.SLow.Base.size32_constant_precond", "LowStar.Buffer.trivial_preorder", "LowParse.Spec.Sum.synth_dsum_case_recip'", "LowParse.Spec.Combinators.parse_filter_payload_kind", "LowParse.SLow.Base.parser32_correct", "LowStar.Monotonic.Buffer.length", "FStar.Bytes.length", "LowParse.Spec.Enum.enum_key", "LowStar.Buffer.gcmalloc_of_list", "LowParse.SLow.Base.size32_postcond", "LowParse.SLow.Base.size32_constant", "LowParse.Spec.Base.coerce", "LowParse.SLow.Base.serializer32_correct", "LowParse.SLow.Sum.size32_sum_gen_precond", "LowParse.SLow.Base.u32_max", "LowParse.Spec.Enum.list_mem", "LowParse.SLow.Combinators.parse32_synth", "LowParse.Spec.Combinators.constant_size_parser_kind", "LowParse.Spec.Base.total_constant_size_parser_kind", "LowParse.SLow.Combinators.parse32_filter", "LowParse.Spec.Enum.list_map", "LowParse.Spec.Enum.r_reflexive_t_elim", "LowParse.SLow.Base.parse_tot_seq_of_parser32", "LowParse.SLow.Combinators.parse32_synth'", "LowParse.Spec.Enum.r_transitive_t_elim", "LowParse.Spec.Sum.serialize_dsum", "LowParse.Spec.Sum.weaken_parse_cases_kind", "LowParse.Spec.Sum.serialize_dsum_cases", "LowParse.SLow.Sum.serializer32_sum_gen_precond", "LowParse.Spec.Sum.synth_dsum_case'", "LowParse.SLow.Combinators.serialize32_kind_precond", "LowParse.SLow.Combinators.parse32_nondep_then", "LowParse.Spec.Combinators.parse_false_kind", "FStar.UInt.size", "LowParse.Spec.Enum.parse_maybe_enum_key", "LowStar.Monotonic.Buffer.srel", "LowParse.Spec.Sum.synth_case_recip'", "LowParse.SLow.Base.bytes_of_seq'", "LowParse.Spec.Sum.parse_sum_cases'", "LowParse.Spec.Enum.parse_enum_key", "LowParse.SLow.Base.parse32_total", "LowParse.SLow.Enum.parse32_maybe_enum_key_gen", "LowParse.Spec.Combinators.make_total_constant_size_parser", "LowParse.SLow.Enum.parse32_enum_key", "LowParse.Spec.Sum.synth_dsum_case_recip_synth_case_unknown_post", "LowParse.Spec.Combinators.parse_ret_kind", "LowParse.Spec.Sum.parse_sum_kind", "LowParse.Spec.Enum.enum_repr", "LowParse.Spec.Sum.synth_dsum_case_recip_synth_case_known_post", "LowParse.SLow.Combinators.serialize32_ret", "LowParse.SLow.Enum.parse32_maybe_enum_key", "LowParse.SLow.Enum.size32_enum_key", "FStar.Tactics.Effect.raise", "LowParse.Spec.Sum.serialize_dsum_type_of_tag", "LowParse.Spec.Sum.serialize_dsum'", "LowParse.SLow.Sum.parse32_sum_eq", "LowParse.Spec.Sum.sum_repr_type", "LowParse.Spec.Sum.parse_sum_cases", "LowParse.SLow.Combinators.parse32_ret", "LowParse.Spec.Sum.sum_key_type", "LowParse.SLow.Sum.parse32_sum_eq_refl", "LowParse.Spec.Sum.serialize_dsum_eq", "LowParse.SLow.Combinators.size32_synth'", "LowParse.SLow.Base.add_overflow", "LowParse.SLow.Enum.parse32_enum_key_gen", "LowParse.Spec.Base.injective_postcond" ], "source_upto_this": "module LowParse.SLow.Sum\ninclude LowParse.Spec.Sum\ninclude LowParse.SLow.Enum\n\nmodule B32 = LowParse.Bytes32\nmodule U32 = FStar.UInt32\n\nlet serializer32_sum_gen_precond\n (kt: parser_kind)\n (k: parser_kind)\n: GTot Type0\n= kt.parser_kind_subkind == Some ParserStrong /\\\n Some? kt.parser_kind_high /\\\n Some? k.parser_kind_high /\\ (\n let (Some vt) = kt.parser_kind_high in\n let (Some v) = k.parser_kind_high in\n vt + v < 4294967296\n )\n\ninline_for_extraction\nlet parse32_sum_t (t: sum) : Tot Type =\n bytes32 -> Tot (option (sum_type t * U32.t))\n\nlet parse32_sum_eq (t: sum) : Tot (parse32_sum_t t -> parse32_sum_t t -> GTot Type0) =\n feq _ _ (eq2 #_)\n\ninline_for_extraction\nlet parse32_sum_if (t: sum) : Tot (if_combinator _ (parse32_sum_eq t)) =\n fif _ _ _ (default_if _)\n\nlet parse32_sum_eq_refl (t: sum) : Tot (r_reflexive_t _ (parse32_sum_eq t)) =\n fun _ -> ()\n\nlet parse32_sum_eq_trans (t: sum) : Tot (r_transitive_t _ (parse32_sum_eq t)) = feq_trans _ _ (eq2 #_)\n\ninline_for_extraction\nlet parse32_sum_cases'\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases' t pc k))\n= [@inline_let]\n let _ = synth_sum_case_injective t k in\n parse32_synth'\n (dsnd (pc k))\n (synth_sum_case t k)\n (pc32 k)\n ()\n\nlet parse32_sum_aux\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n: GTot (parser32 (parse_sum t p pc))\n= fun input ->\n parse_sum_eq' t p pc (B32.reveal input);\n [@inline_let]\n let res : option (sum_type t * U32.t) =\n //NS: hoist nested match\n //we do not expect the case analysis to\n //on `p32 input` to reduce; hoist it for more efficient\n //normalization.\n //Note, in some simple cases, e.g., parsing raw enums\n //this r the pcases below maybe statically evaluated\n //to a `Some v`; this forgoes reduction in those simple\n //cases for more efficient extraction in more complex\n //common cases\n let pi = p32 input in\n match pi with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = B32.b32slice input consumed_k (B32.len input) in\n //NS: hoist nested match\n let pcases1 = parse32_sum_cases' t pc pc32 k input_k in\n match pcases1 with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((x <: sum_type t), consumed_k `U32.add` consumed_x)\n in\n (res <: (res: option (sum_type t * U32.t) { parser32_correct (parse_sum t p pc) input res } ))\n\ninline_for_extraction\nlet parse32_sum_cases_t\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot Type\n= parser32 (parse_sum_cases t pc k)\n\nlet parse32_sum_cases_t_eq\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n (x y : parse32_sum_cases_t t pc k)\n: GTot Type0\n= True\n\ninline_for_extraction\nlet parse32_sum_cases_t_if\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (k: sum_key t)\n: Tot (if_combinator _ (parse32_sum_cases_t_eq t pc k))\n= fun cond (sv_true: cond_true cond -> Tot (parse32_sum_cases_t t pc k)) (sv_false: cond_false cond -> Tot (parse32_sum_cases_t t pc k)) input ->\n if cond\n then (sv_true () input <: (res: _ { parser32_correct (parse_sum_cases t pc k) input res}))\n else (sv_false () input <: (res: _ {parser32_correct (parse_sum_cases t pc k) input res}))\n\ninline_for_extraction\nlet parse32_sum_cases_aux\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases t pc k))\n= fun (input: B32.bytes) ->\n [@inline_let] let _ = parse_sum_cases_eq' t pc k (B32.reveal input) in\n (parse32_sum_cases' t pc pc32 k input <: (res: _ { parser32_correct (parse_sum_cases t pc k) input res } ))\n\ninline_for_extraction\nlet parse32_sum_cases\n (t: sum)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: dep_enum_destr (sum_enum t) (parse32_sum_cases_t t pc))\n (k: sum_key t)\n: Tot (parser32 (parse_sum_cases t pc k))\n= destr\n _\n (parse32_sum_cases_t_if t pc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (parse32_sum_cases_aux t pc pc32)\n k\n\ninline_for_extraction\nlet parse32_sum'\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n (input: B32.bytes)\n: Pure (option (sum_type t * U32.t))\n (requires True)\n (ensures (fun res -> res == parse32_sum_aux t p p32 pc pc32 input))\n= [@inline_let]\n let res : option (sum_type t * U32.t) =\n //NS: hoist nested match\n let pi = p32 input in\n match pi with\n | None -> None\n | Some (k, consumed_k) ->\n let input_k = B32.b32slice input consumed_k (B32.len input) in\n destr\n (eq2 #(option (sum_type t * U32.t))) (default_if _)\n (fun _ -> ()) (fun _ _ _ -> ())\n (fun k ->\n //NS: hoist nested match\n let pcases2 = parse32_sum_cases' t pc pc32 k input_k in\n match pcases2 with\n | None -> None\n | Some (x, consumed_x) ->\n Some ((x <: sum_type t), consumed_k `U32.add` consumed_x)\n )\n k\n in\n res\n\ninline_for_extraction\nlet parse32_sum\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 (parse_enum_key p (sum_enum t)))\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n: Tot (parser32 (parse_sum t p pc))\n= fun input ->\n (parse32_sum' t p p32 pc pc32 destr input <: (res: option (sum_type t * U32.t) { parser32_correct (parse_sum t p pc) input res } ))\n\ninline_for_extraction\nlet parse32_sum2\n (#kt: parser_kind)\n (t: sum)\n (p: parser kt (sum_repr_type t))\n (p32: parser32 p)\n (pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (pc32: ((x: sum_key t) -> Tot (parser32 (dsnd (pc x)))))\n (destr: enum_destr_t (option (sum_type t * U32.t)) (sum_enum t))\n (f: maybe_enum_key_of_repr'_t (sum_enum t))\n: Tot (parser32 (parse_sum t p pc))\n= parse32_sum t p (parse32_enum_key p32 (sum_enum t) f) pc pc32 destr\n\ninline_for_extraction\nlet serialize32_sum_cases_t\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot Type\n= serializer32 (serialize_sum_cases t pc sc k)\n\nlet serialize32_sum_cases_t_eq\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: serialize32_sum_cases_t t sc k)\n: GTot Type0\n= True\n\ninline_for_extraction\nlet serialize32_sum_cases_t_if\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (if_combinator _ (serialize32_sum_cases_t_eq t sc k))\n= fun cond (sv_true: (cond_true cond -> Tot (serialize32_sum_cases_t t sc k))) (sv_false: (cond_false cond -> Tot (serialize32_sum_cases_t t sc k))) input ->\n if cond\n then (sv_true () input <: (res: _ { serializer32_correct (serialize_sum_cases t pc sc k) input res } ))\n else (sv_false () input <: (res: _ { serializer32_correct (serialize_sum_cases t pc sc k) input res } ))\n\ninline_for_extraction\nlet serialize32_sum_cases_aux\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= fun input ->\n [@inline_let] let _ =\n Classical.forall_intro (parse_sum_cases_eq' t pc k);\n synth_sum_case_injective t k;\n synth_sum_case_inverse t k\n in\n serialize32_synth\n _\n (synth_sum_case t k)\n _\n (sc32 k)\n (synth_sum_case_recip t k)\n (fun x -> synth_sum_case_recip t k x)\n ()\n input\n\ninline_for_extraction\nlet serialize32_sum_cases\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_cases_t t sc))\n (k: sum_key t)\n: Tot (serializer32 (serialize_sum_cases t pc sc k))\n= destr\n _\n (serialize32_sum_cases_t_if t sc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (serialize32_sum_cases_aux t sc sc32)\n k\n\nlet serialize32_sum_aux\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: GTot (serializer32 (serialize_sum t s sc))\n= fun x ->\n serialize_sum_eq t s sc x;\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n let s2 = sc32 tg (synth_sum_case_recip t tg x) in\n let res = s1 `B32.b32append` s2 in\n (res <: (res: B32.bytes { serializer32_correct (serialize_sum t s sc) x res } ))\n\ninline_for_extraction\nlet serialize32_sum_destr_codom\n (t: sum)\n (k: sum_key t)\n: Tot Type\n= refine_with_tag (sum_tag_of_data t) k -> Tot B32.bytes\n\nmodule T = FStar.Tactics\n\nlet serialize32_sum_destr_eq\n (t: sum)\n (k: sum_key t)\n: Tot (serialize32_sum_destr_codom t k -> serialize32_sum_destr_codom t k -> GTot Type0)\n= _ by (T.apply (`feq); T.apply (`eq2))\n\nlet serialize32_sum_destr_trans\n (t: sum)\n (k: sum_key t)\n: Tot (r_transitive_t _ (serialize32_sum_destr_eq t k))\n= feq_trans _ _ (eq2 #_)\n\ninline_for_extraction\nlet serialize32_sum_destr_if\n (t: sum)\n (k: sum_key t)\n: Tot (if_combinator _ (serialize32_sum_destr_eq t k))\n= // _ by (T.apply (`fif); T.fail \"abc\")\n fif _ _ _ (default_if _)\n\n#set-options \"--z3rlimit 32\"\n\ninline_for_extraction\nlet serialize32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_destr_codom t))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (serializer32 (serialize_sum t s sc))\n= fun x ->\n [@inline_let]\n let _ = serialize_sum_eq t s sc x in\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n [@inline_let]\n let phi tg x = sc32 tg (synth_sum_case_recip t tg x) in\n [@inline_let]\n let phi'tg = destr\n (serialize32_sum_destr_eq t)\n (serialize32_sum_destr_if t)\n (fun _ _ -> ())\n (serialize32_sum_destr_trans t)\n phi\n tg\n in\n let s2 = phi'tg x in\n [@inline_let]\n let _ =\n let phitg = phi tg in\n feq_elim _ _ (eq2 #_) phitg phi'tg x\n in\n let res = s1 `B32.b32append` s2 in\n (res <: (res: B32.bytes { serializer32_correct (serialize_sum t s sc) x res } ))\n\n#reset-options\n\ninline_for_extraction\nlet serialize32_sum2\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: serializer32 s)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (serializer32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (serialize32_sum_destr_codom t))\n (f: enum_repr_of_key'_t (sum_enum t))\n (u: squash (serializer32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (serializer32 (serialize_sum t s sc))\n= serialize32_sum t s (serialize32_enum_key s32 (sum_enum t) f) sc sc32 destr u\n\ninline_for_extraction\nlet size32_sum_cases_t\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot Type\n= size32 (serialize_sum_cases t pc sc k)\n\nlet size32_sum_cases_t_eq\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n (x y: size32_sum_cases_t t sc k)\n: GTot Type0\n= True\n\ninline_for_extraction\nlet size32_sum_cases_t_if\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (k: sum_key t)\n: Tot (if_combinator _ (size32_sum_cases_t_eq t sc k))\n= fun cond (sv_true: (cond_true cond -> Tot (size32_sum_cases_t t sc k))) (sv_false: (cond_false cond -> Tot (size32_sum_cases_t t sc k))) input ->\n if cond\n then (sv_true () input <: (res: _ { size32_postcond (serialize_sum_cases t pc sc k) input res } ))\n else (sv_false () input <: (res: _ { size32_postcond (serialize_sum_cases t pc sc k) input res } ))\n\ninline_for_extraction\nlet size32_sum_cases_aux\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (k: sum_key t)\n: Tot (size32 (serialize_sum_cases t pc sc k))\n= fun input ->\n [@inline_let] let _ =\n Classical.forall_intro (parse_sum_cases_eq' t pc k);\n synth_sum_case_injective t k;\n synth_sum_case_inverse t k\n in\n size32_synth\n _\n (synth_sum_case t k)\n _\n (sc32 k)\n (synth_sum_case_recip t k)\n (fun x -> synth_sum_case_recip t k x)\n ()\n input\n\ninline_for_extraction\nlet size32_sum_cases\n (t: sum)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_cases_t t sc))\n (k: sum_key t)\n: Tot (size32 (serialize_sum_cases t pc sc k))\n= destr\n _\n (size32_sum_cases_t_if t sc)\n (fun _ _ -> ())\n (fun _ _ _ _ -> ())\n (size32_sum_cases_aux t sc sc32)\n k\n\ninline_for_extraction\nlet size32_sum_destr_codom\n (t: sum)\n (k: sum_key t)\n: Tot Type\n= refine_with_tag (sum_tag_of_data t) k -> Tot U32.t\n\nlet size32_sum_destr_eq\n (t: sum)\n (k: sum_key t)\n: Tot (size32_sum_destr_codom t k -> size32_sum_destr_codom t k -> GTot Type0)\n= _ by (T.apply (`feq); T.apply (`eq2))\n\nlet size32_sum_destr_trans\n (t: sum)\n (k: sum_key t)\n: Tot (r_transitive_t _ (size32_sum_destr_eq t k))\n= feq_trans _ _ (eq2 #_)\n\ninline_for_extraction\nlet size32_sum_destr_if\n (t: sum)\n (k: sum_key t)\n: Tot (if_combinator _ (size32_sum_destr_eq t k))\n= // _ by (T.apply (`fif); T.fail \"abc\")\n fif _ _ _ (default_if _)\n\nlet size32_sum_gen_precond\n (kt: parser_kind)\n (k: parser_kind)\n: GTot Type0\n= kt.parser_kind_subkind == Some ParserStrong /\\\n Some? kt.parser_kind_high /\\\n Some? k.parser_kind_high /\\ (\n let (Some vt) = kt.parser_kind_high in\n let (Some v) = k.parser_kind_high in\n vt + v < 4294967295\n )\n\n#set-options \"--z3rlimit 16\"\n\ninline_for_extraction\nlet size32_sum\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: size32 (serialize_enum_key _ s (sum_enum t)))\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_destr_codom t))\n (u: squash (size32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (size32 (serialize_sum t s sc))\n= fun x ->\n serialize_sum_eq t s sc x;\n let tg = sum_tag_of_data t x in\n let s1 = s32 tg in\n [@inline_let]\n let phi tg x = sc32 tg (synth_sum_case_recip t tg x) in\n [@inline_let]\n let phi'tg = destr\n (size32_sum_destr_eq t)\n (size32_sum_destr_if t)\n (fun _ _ -> ())\n (size32_sum_destr_trans t)\n phi\n tg\n in\n let s2 = phi'tg x in\n [@inline_let]\n let _ =\n feq_elim _ _ (eq2 #_) (phi tg) phi'tg x;\n assert_norm (U32.v u32_max == 4294967295)\n in\n [@inline_let]\n let res = s1 `U32.add` s2 in\n (res <: (res: U32.t { size32_postcond (serialize_sum t s sc) x res } ))\n\n#reset-options\n\ninline_for_extraction\nlet size32_sum2\n (#kt: parser_kind)\n (t: sum)\n (#p: parser kt (sum_repr_type t))\n (s: serializer p)\n (s32: size32 s)\n (#pc: ((x: sum_key t) -> Tot (k: parser_kind & parser k (sum_type_of_tag t x))))\n (sc: ((x: sum_key t) -> Tot (serializer (dsnd (pc x)))))\n (sc32: ((x: sum_key t) -> Tot (size32 (sc x))))\n (destr: dep_enum_destr (sum_enum t) (size32_sum_destr_codom t))\n (f: enum_repr_of_key'_t (sum_enum t))\n (u: squash (size32_sum_gen_precond kt (weaken_parse_cases_kind t pc)))\n: Tot (size32 (serialize_sum t s sc))\n= size32_sum t s (size32_enum_key s32 (sum_enum t) f) sc sc32 destr u\n\n(* Sum with default case *)\n\ninline_for_extraction\nlet parse32_dsum_cases'\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (parser32 (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: parser32 g)\n (x: dsum_key t)\n: Tot (parser32 (parse_dsum_cases' t f g x))\n= [@inline_let]\n let _ = synth_dsum_case_injective t x in\n match x with\n | Known x' ->\n parse32_synth'\n (dsnd (f x'))\n (synth_dsum_case t (Known x'))\n (f32 x')\n ()\n | Unknown x' ->\n parse32_synth'\n g\n (synth_dsum_case t (Unknown x'))\n g32\n ()\n\ninline_for_extraction\nlet parse32_dsum_cases_aux\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (f32: (x: dsum_known_key t) -> Tot (parser32 (dsnd (f x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (g32: parser32 g)\n (x: dsum_key t)\n: Tot (parser32 (parse_dsum_cases t f g x))\n= fun input ->\n [@inline_let] let _ = parse_dsum_cases_eq' t f g x (B32.reveal input) in\n (parse32_dsum_cases' t f f32 g g32 x input <: (res: _ { parser32_correct (parse_dsum_cases t f g x) input res } ))\n\ninline_for_extraction\nlet parse32_dsum_cases_t\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot Type\n= parser32 (parse_dsum_cases t f g (Known k))\n\nlet parse32_dsum_cases_t_eq\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n (x y : parse32_dsum_cases_t t f g k)\n: GTot Type0\n= True\n\ninline_for_extraction", "sketch": [ "The `parse32_dsum_cases_t_if` function takes in a dsum `t`, a function `f` that maps known keys to parsers, a parser kind `k'`, a parser `g` for unknown keys, and a key `k`. It constructs an if-combinator for the equality of two `parse32_dsum_cases_t` values for the given parameters.", "The `parse32_dsum_cases_t_if` function will take the condition, true and false branches, and input, and based on the condition, it will call the appropriate branch with the input and ensure that the result satisfies the equality condition for `parse32_dsum_cases_t`. If the condition is true, it will call the true branch with the input and ensure the equality condition. If the condition is false, it will call the false branch with the input and ensure the equality condition.\n\n```fstar\nlet parse32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t) -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x)))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (if_combinator _ (parse32_dsum_cases_t_eq t f g k))\n= fun cond (sv_true: (cond_true cond -> Tot (parse32_dsum_cases_t t f g k))) (sv_false: (cond_false cond -> Tot (parse32_dsum_cases_t t f g k))) input ->\n if cond\n then (sv_true () input <: (res: _ { parser32_correct (parse_dsum_cases t f g k) input res }))\n else (sv_false () input <: (res: _ { parser32_correct (parse_dsum_cases t f g k) input res }))\n```" ], "generated_solution": [ "let parse32_dsum_cases_t_if\n (t: dsum)\n (f: (x: dsum_known_key t -> Tot (k: parser_kind & parser k (dsum_type_of_known_tag t x))))\n (#k': parser_kind)\n (g: parser k' (dsum_type_of_unknown_tag t))\n (k: dsum_known_key t)\n: Tot (if_combinator _ (parse32_dsum_cases_t_eq t f g k))\n= fun cond (sv_true: (cond_true cond -> Tot (parse32_dsum_cases_t t f g k))) (sv_false: (cond_false cond -> Tot (parse32_dsum_cases_t t f g k))) input ->\n if cond\n then (sv_true () input <: (res: _ { parse32_dsum_cases_t_eq t f g k } ))\n else (sv_false () input <: (res: _ { parse32_dsum_cases_t_eq t f g k } ))" ] }, { "file_name": "LambdaOmega.fst", "name": "LambdaOmega.kinding_inversion_arrow", "opens_and_abbrevs": [ { "open": "FStar.StrongExcludedMiddle" }, { "open": "FStar.FunctionalExtensionality" }, { "open": "FStar.Classical" }, { "open": "FStar.Constructive" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val kinding_inversion_arrow: #g:env -> #t1:typ -> #t2:typ ->\n h:(kinding g (TArr t1 t2) KTyp) ->\n Tot (cand (kinding g t1 KTyp) (kinding g t2 KTyp))", "source_definition": "let rec kinding_inversion_arrow #g #t1 #t2 h = match h with\n | KiArr h1 h2 -> Conj h1 h2", "source_range": { "start_line": 561, "start_col": 0, "end_line": 562, "end_col": 29 }, "interleaved": false, "definition": "fun h ->\n (let LambdaOmega.KiArr h1 h2 = h in\n FStar.Constructive.Conj h1 h2)\n <:\n FStar.Constructive.cand (LambdaOmega.kinding g t1 LambdaOmega.KTyp)\n (LambdaOmega.kinding g t2 LambdaOmega.KTyp)", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "LambdaOmega.env", "LambdaOmega.typ", "LambdaOmega.kinding", "LambdaOmega.TArr", "LambdaOmega.KTyp", "FStar.Constructive.Conj", "FStar.Constructive.cand" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "h: LambdaOmega.kinding g (LambdaOmega.TArr t1 t2) LambdaOmega.KTyp\n -> FStar.Constructive.cand (LambdaOmega.kinding g t1 LambdaOmega.KTyp)\n (LambdaOmega.kinding g t2 LambdaOmega.KTyp)", "prompt": "let rec kinding_inversion_arrow #g #t1 #t2 h =\n ", "expected_response": "match h with | KiArr h1 h2 -> Conj h1 h2", "source": { "project_name": "FStar", "file_name": "examples/metatheory/LambdaOmega.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "LambdaOmega.fst", "checked_file": "dataset/LambdaOmega.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Constructive.fst.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "var", "knd", "KTyp", "KTyp", "KTyp", "KArr", "KArr", "KArr", "typ", "TVar", "TVar", "TVar", "TLam", "TLam", "TLam", "t", "t", "TApp", "TApp", "TApp", "TArr", "TArr", "TArr", "exp", "EVar", "EVar", "EVar", "EApp", "EApp", "EApp", "ELam", "ELam", "ELam", "esub", "erenaming", "val is_erenaming : s:esub -> GTot (n:int{( erenaming s ==> n=0) /\\\n (~(erenaming s) ==> n=1)})", "let is_erenaming s = (if strong_excluded_middle (erenaming s) then 0 else 1)", "val esub_inc : var -> Tot exp", "let esub_inc y = EVar (y+1)", "let is_evar (e:exp) : int = if EVar? e then 0 else 1", "val esubst : s:esub -> e:exp -> Pure exp (requires True)\n (ensures (fun e' -> erenaming s /\\ EVar? e ==> EVar? e'))\n (decreases %[is_evar e; is_erenaming s; 1; e])", "val esub_lam: s:esub -> x:var -> Tot (e:exp{ erenaming s ==> EVar? e})\n (decreases %[1;is_erenaming s; 0; EVar 0])", "let rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))", "let rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))", "val esub_lam_renaming: s:esub -> Lemma\n (ensures (forall (x:var). erenaming s ==> EVar? (esub_lam s x)))", "let esub_lam_renaming s = ()", "val esubst_extensional: s1:esub -> s2:esub{feq s1 s2} -> e:exp ->\n Lemma (requires True) (ensures (esubst s1 e == esubst s2 e))\n\t\t\t (decreases e)", "let rec esubst_extensional s1 s2 e =\n match e with\n | EVar _ -> ()\n | ELam t e1 ->\n let open FStar.Tactics in\n assert (esubst s1 (ELam t e1) == ELam t (esubst (esub_lam s1) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n assert (esubst s2 (ELam t e1) == ELam t (esubst (esub_lam s2) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n esubst_extensional (esub_lam s1) (esub_lam s2) e1\n | EApp e1 e2 -> esubst_extensional s1 s2 e1; esubst_extensional s1 s2 e2", "val esub_lam_hoist : t:typ -> e:exp -> s:esub -> Lemma (requires True)\n (ensures (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e)))", "let esub_lam_hoist t e s =\n let open FStar.Tactics in\n assert (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e))\n by (norm [zeta; iota; delta_only [`%esubst]])", "val esub_beta : exp -> Tot esub", "let esub_beta e = fun y -> if y = 0 then e\n else (EVar (y-1))", "val esubst_beta : exp -> exp -> Tot exp", "let esubst_beta e = esubst (esub_beta e)", "tsub", "trenaming", "val is_trenaming : s:tsub -> GTot (n:int{( trenaming s ==> n=0) /\\\n (~(trenaming s) ==> n=1)})", "let is_trenaming s = (if strong_excluded_middle (trenaming s) then 0 else 1)", "val tsub_inc_above : nat -> var -> Tot typ", "let tsub_inc_above x y = if y Tot typ", "let tsub_inc = tsub_inc_above 0", "val trenaming_sub_inc : unit -> Lemma (trenaming (tsub_inc))", "let trenaming_sub_inc _ = ()", "let is_tvar (t:typ) : int = if TVar? t then 0 else 1", "val tsubst : s:tsub -> t:typ -> Pure typ (requires True)\n (ensures (fun t' -> trenaming s /\\ TVar? t ==> TVar? t'))\n (decreases %[is_tvar t; is_trenaming s; 1; t])", "val tsub_lam: s:tsub -> x:var -> Tot (t:typ{trenaming s ==> TVar? t})\n (decreases %[1; is_trenaming s; 0; TVar 0])", "let rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))", "let rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))", "val tsubst_extensional: s1:tsub -> s2:tsub{feq s1 s2} -> t:typ ->\n Lemma (requires True) (ensures (tsubst s1 t = tsubst s2 t))\n\t\t\t (decreases t)", "let rec tsubst_extensional s1 s2 t =\n match t with\n | TVar _ -> ()\n | TLam k t1 -> \n let open FStar.Tactics in\n assert (tsubst s1 (TLam k t1) == TLam k (tsubst (tsub_lam s1) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n assert (tsubst s2 (TLam k t1) == TLam k (tsubst (tsub_lam s2) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n tsubst_extensional (tsub_lam s1) (tsub_lam s2) t1\n | TArr t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n | TApp t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2", "val tsub_lam_hoist : k:knd -> t:typ -> s:tsub -> Lemma\n (ensures (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t)))", "let tsub_lam_hoist k t s =\n let open FStar.Tactics in\n assert (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t))\n by norm [zeta; iota; delta_only [`%tsubst]]", "val tsub_comp : s1:tsub -> s2:tsub -> Tot tsub", "let tsub_comp s1 s2 x = tsubst s1 (s2 x)", "val tsub_comp_inc : s:tsub -> x:var ->\n Lemma (tsub_comp tsub_inc s x = tsub_comp (tsub_lam s) tsub_inc x)", "let tsub_comp_inc s x = ()", "val tsub_lam_renaming: s:tsub -> Lemma\n (ensures (forall (x:var). trenaming s ==> TVar? (tsub_lam s x)))", "let tsub_lam_renaming s = ()", "val tsubst_comp : s1:tsub -> s2:tsub -> t:typ -> Lemma\n (ensures (tsubst s1 (tsubst s2 t) = tsubst (tsub_comp s1 s2) t))\n (decreases %[is_tvar t;\n is_trenaming s1;\n is_trenaming s2;\n t])", "let rec tsubst_comp s1 s2 t =\n match t with\n | TVar z -> ()\n | TApp t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n | TLam k tbody ->\n let tsub_lam_comp : x:var ->\n Lemma(tsub_lam (tsub_comp s1 s2) x =\n tsub_comp (tsub_lam s1) (tsub_lam s2) x) =\n fun x -> match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n in\n let hoist1 = tsub_lam_hoist k tbody s2 in\n let hoist2 = tsub_lam_hoist k (tsubst (tsub_lam s2) tbody) s1 in\n let h1 =\n tsub_lam_renaming s1;\n tsub_lam_renaming s2;\n tsubst_comp (tsub_lam s1) (tsub_lam s2) tbody in\n\n let h2 =\n forall_intro tsub_lam_comp;\n cut (feq (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))) in\n\n let ext = tsubst_extensional\n (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))\n tbody in\n\n tsub_lam_hoist k tbody (tsub_comp s1 s2)\n\n | TArr t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2", "val tsub_lam_comp : s1:tsub -> s2:tsub -> x:var -> Lemma\n (tsub_lam (tsub_comp s1 s2) x = tsub_comp (tsub_lam s1) (tsub_lam s2) x)", "let tsub_lam_comp s1 s2 x =\n match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end", "val tsub_id : tsub", "let tsub_id x = TVar x", "val tsubst_id : t:typ -> Lemma (tsubst tsub_id t = t)", "let rec tsubst_id t =\n let open FStar.Tactics in\n match t with\n | TVar z -> ()\n | TLam k t1 ->\n tsub_lam_hoist k t1 tsub_id;\n assert (feq tsub_id (tsub_lam tsub_id))\n by (norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc]]);\n tsubst_extensional tsub_id (tsub_lam tsub_id) t1;\n tsubst_id t1\n | TArr t1 t2\n | TApp t1 t2 -> tsubst_id t1; tsubst_id t2", "val tsub_beta_gen : var -> typ -> Tot tsub", "let tsub_beta_gen x t = fun y -> if y < x then (TVar y)\n else if y = x then t\n else (TVar (y-1))", "val tsubst_beta_gen : var -> typ -> typ -> Tot typ", "let tsubst_beta_gen x t' t = tsubst (tsub_beta_gen x t') t", "let tsubst_beta t' t = tsubst_beta_gen 0 t' t", "val tshift_up_above : nat -> typ -> Tot typ", "let tshift_up_above x = tsubst (tsub_inc_above x)", "val tshift_up : typ -> Tot typ", "let tshift_up = tshift_up_above 0", "step", "SBeta", "SBeta", "SBeta", "t", "t", "e1", "e1", "e2", "e2", "SApp1", "SApp1", "SApp1", "e1", "e1", "e2", "e2", "e1'", "e1'", "hst", "hst", "SApp2", "SApp2", "SApp2", "e1", "e1", "e2", "e2", "e2'", "e2'", "hst", "hst", "a_env", "x_env", "val empty_a: a_env", "let empty_a = fun _ -> None", "val empty_x: x_env", "let empty_x = fun _ -> None", "env", "MkEnv", "MkEnv", "MkEnv", "a", "a", "x", "x", "val lookup_tvar: env -> nat -> Tot (option knd)", "let lookup_tvar g n = MkEnv?.a g n", "val lookup_evar: env -> nat -> Tot (option typ)", "let lookup_evar g n = MkEnv?.x g n", "val empty: env", "let empty = MkEnv empty_a empty_x", "val extend_tvar: g:env -> n:nat -> k:knd -> Tot env", "let extend_tvar g n k =\n let a_env = fun (a:nat) -> if a < n then lookup_tvar g a\n else if a = n then Some k\n else lookup_tvar g (a - 1) in\n let x_env = fun (x:nat) -> match lookup_evar g x with\n | None -> None\n | Some t -> Some (tshift_up_above n t)\n in\n MkEnv a_env x_env", "val extend_evar: g:env -> n:nat -> t:typ -> Tot env", "let extend_evar g n t =\n let a_env = fun (a:nat) -> lookup_tvar g a in\n let x_env = fun (x:nat) -> if x < n then lookup_evar g x\n else if x = n then Some t\n else lookup_evar g (x - 1) in\n MkEnv a_env x_env", "kinding", "KiVar", "KiVar", "KiVar", "g", "g", "a", "a", "KiLam", "KiLam", "KiLam", "g", "g", "k", "k", "t", "t", "k'", "k'", "hk", "hk", "KiApp", "KiApp", "KiApp", "g", "g", "t1", "t1", "t2", "t2", "k11", "k11", "k12", "k12", "hk1", "hk1", "hk2", "hk2", "KiArr", "KiArr", "KiArr", "g", "g", "t1", "t1", "t2", "t2", "hk1", "hk1", "hk2", "hk2", "tequiv", "EqRefl", "EqRefl", "EqRefl", "t", "t", "EqSymm", "EqSymm", "EqSymm", "t1", "t1", "t2", "t2", "he", "he", "EqTran", "EqTran", "EqTran", "t1", "t1", "t2", "t2", "t3", "t3", "he12", "he12", "he23", "he23", "EqLam", "EqLam", "EqLam", "t", "t", "t'", "t'", "k", "k", "he", "he", "EqApp", "EqApp", "EqApp", "t1", "t1", "t1'", "t1'", "t2", "t2", "t2'", "t2'", "he1", "he1", "he2", "he2", "EqBeta", "EqBeta", "EqBeta", "k", "k", "t1", "t1", "t2", "t2", "EqArr", "EqArr", "EqArr", "t1", "t1", "t1'", "t1'", "t2", "t2", "t2'", "t2'", "he1", "he1", "he2", "he2", "typing", "TyVar", "TyVar", "TyVar", "g", "g", "x", "x", "hk", "hk", "TyLam", "TyLam", "TyLam", "g", "g", "t", "t", "e1", "e1", "t'", "t'", "hk", "hk", "ht", "ht", "TyApp", "TyApp", "TyApp", "g", "g", "e1", "e1", "e2", "e2", "t1", "t1", "t2", "t2", "ht1", "ht1", "ht2", "ht2", "TyEqu", "TyEqu", "TyEqu", "g", "g", "e", "e", "t1", "t1", "t2", "t2", "ht", "ht", "he", "he", "hk", "hk", "val is_value : exp -> Tot bool", "let is_value = ELam?", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (b2t (not (is_value e))))\n (ensures (fun _ -> True)) (decreases h)", "let rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n (match e1 with\n | ELam t e1' -> ExIntro (esubst_beta e2 e1') (SBeta t e1' e2)\n | _ -> (match progress h1 with\n | ExIntro e1' h1' -> ExIntro (EApp e1' e2) (SApp1 e2 h1')))\n (* | TyEqu h1 _ _ -> progress h1 -- used to work *)\n (* | TyEqu #g #e #t1 #t2 h1 _ _ -> progress #e #t1 h1\n// -- explicit annotation doesn't help with Pure annotation *)\n | TyEqu h1 _ _ -> progress h1", "val tappears_free_in : x:var -> t:typ -> Tot bool (decreases t)", "let rec tappears_free_in x t =\n match t with\n | TVar y -> x = y\n | TArr t1 t2\n | TApp t1 t2 -> tappears_free_in x t1 || tappears_free_in x t2\n | TLam _ t1 -> tappears_free_in (x+1) t1", "envEqualT", "val tcontext_invariance : #t:typ -> #g:env -> #k:knd ->\n h:(kinding g t k) -> g':env{envEqualT t g g'} ->\n Tot (kinding g' t k) (decreases h)", "let rec tcontext_invariance #t #g #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (tcontext_invariance h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n | KiArr h1 h2 -> KiArr (tcontext_invariance h1 g') (tcontext_invariance h2 g')", "val kinding_extensional: #g:env -> #t:typ -> #k:knd -> h:(kinding g t k) ->\n g':env{feq (MkEnv?.a g) (MkEnv?.a g')} ->\n Tot (kinding g' t k) (decreases h)", "let rec kinding_extensional #g #t #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (kinding_extensional h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (kinding_extensional h1 g') (kinding_extensional h2 g')\n | KiArr h1 h2 -> KiArr (kinding_extensional h1 g') (kinding_extensional h2 g')", "val kinding_weakening_ebnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> t':typ ->\n Tot (kinding (extend_evar g x t') t k)", "let kinding_weakening_ebnd #g #t #k h x t' =\n kinding_extensional h (extend_evar g x t')", "val tshift_up_above_lam: n:nat -> k:knd -> t:typ -> Lemma\n (ensures (tshift_up_above n (TLam k t) = TLam k (tshift_up_above (n + 1) t)))", "let tshift_up_above_lam n k t =\n let open FStar.Tactics in\n assert(tshift_up_above n (TLam k t) = tsubst (tsub_inc_above n) (TLam k t));\n tsub_lam_hoist k t (tsub_inc_above n);\n assert(tshift_up_above n (TLam k t) =\n TLam k (tsubst (tsub_lam (tsub_inc_above n)) t));\n assert (feq (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)))\n by norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc_above]];\n tsubst_extensional (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)) t", "val kinding_weakening_tbnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> k':knd ->\n Tot (kinding (extend_tvar g x k') (tshift_up_above x t) k) (decreases h)", "let rec kinding_weakening_tbnd #g #t #k h x k' =\n match h with\n | KiVar a -> if a < x then KiVar a\n else KiVar (a + 1)\n | KiLam #g k'' #t1 #_ h1 ->\n tshift_up_above_lam x k'' t1;\n let h2 = kinding_weakening_tbnd h1 (x + 1) k' in\n KiLam k'' (kinding_extensional h2 (extend_tvar (extend_tvar g x k') 0 k''))\n | KiApp h1 h2 ->\n KiApp (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n | KiArr h1 h2 ->\n KiArr (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')", "val kinding_strengthening_ebnd :\n g:env -> x:var -> t_x:typ -> #t:typ -> #k:knd ->\n h:(kinding (extend_evar g x t_x) t k) ->\n Tot (kinding g t k) (decreases h)", "let kinding_strengthening_ebnd g x t_x #t #k h = kinding_extensional h g", "val kinding_inversion_arrow: #g:env -> #t1:typ -> #t2:typ ->\n h:(kinding g (TArr t1 t2) KTyp) ->\n Tot (cand (kinding g t1 KTyp) (kinding g t2 KTyp))" ], "closest": [ "val typing_extensional : #e:exp -> #g:env -> #t:ty ->\n h:(rtyping g e t) -> g':env{equal g g'} ->\n Tot (rtyping g' e t)\nlet typing_extensional #e #g #t h g' = context_invariance h g'", "val substitution :\n #g1:env -> #e:exp -> #t:typ -> s:sub -> #g2:env ->\n h1:typing g1 e t ->\n hs:subst_typing s g1 g2 ->\n Tot (typing g2 (subst s e) t)\n (decreases %[is_var e; is_renaming s; e])\nlet rec substitution #g1 #e #t s #g2 h1 hs =\n match h1 with\n | TyVar x -> hs x\n | TyApp hfun harg -> TyApp (substitution s hfun hs) (substitution s harg hs)\n | TyLam tlam hbody ->\n let hs'' : subst_typing (sub_inc) g2 (extend tlam g2) =\n fun x -> TyVar (x+1) in\n let hs' : subst_typing (sub_elam s) (extend tlam g1) (extend tlam g2) =\n fun y -> if y = 0 then TyVar y\n else let n:var = y - 1 in //Silly limitation of implicits and refinements\n substitution sub_inc (hs n) hs'' //NS: needed to instantiate the Some?.v \n in TyLam tlam (substitution (sub_elam s) hbody hs')\n | TyUnit -> TyUnit", "val synth_inverse (#t1 #t2: Type0) (f2: (t1 -> GTot t2)) (g1: (t2 -> GTot t1)) : GTot Type0\nlet synth_inverse\n (#t1: Type0)\n (#t2: Type0)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n: GTot Type0\n= (forall (x : t2) . f2 (g1 x) == x)", "val context_invariance : #e:exp -> #g:env -> #t:typ ->\n h:(typing g e t) -> g':env{envEqualE e g g'} ->\n Tot (typing g' e t) (decreases h)\nlet rec context_invariance #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyLam t_y h1 ->\n TyLam t_y (context_invariance h1 (extend t_y g'))\n | TyApp h1 h2 ->\n TyApp (context_invariance h1 g') (context_invariance h2 g')\n | TyUnit -> TyUnit", "val st_comp_typing_inversion (#g:env) (#st:_) (ct:st_comp_typing g st)\n : (universe_of g st.res st.u &\n tot_typing g st.pre tm_vprop &\n x:var{fresh_wrt x g (freevars st.post)} &\n tot_typing (push_binding g x ppname_default st.res) (open_term st.post x) tm_vprop)\nlet st_comp_typing_inversion (#g:env) (#st:_) (ct:st_comp_typing g st) = \n let STC g st x ty pre post = ct in\n (| ty, pre, x, post |)", "val extend_gen_typing_conversion\n (#t: typ)\n (#g: env)\n (#e0: exp)\n (#t0: typ)\n (h: typing (extend t g) e0 t0)\n : Tot (typing (extend_gen 0 t g) e0 t0)\nlet rec extend_gen_typing_conversion (#t:typ) (#g:env) (#e0:exp) (#t0:typ) (h:typing (extend t g) e0 t0)\n :Tot (typing (extend_gen 0 t g) e0 t0) = h", "val comp_typing_inversion (#g:env) (#c:comp_st) (ct:comp_typing_u g c)\n : st_comp_typing g (st_comp_of_comp c) & iname_typing g c\nlet comp_typing_inversion #g #c ct = \n match ct with\n | CT_ST _ _ st\n | CT_STGhost _ _ st -> st, emp_inames_typing g\n | CT_STAtomic _ _ _ _ it st -> st, it", "val context_invariance : #e:exp -> #g:env -> #t:ty ->\n h:(rtyping g e t) -> g':env{equalE e g g'} ->\n Tot (rtyping g' e t) (decreases h)\nlet rec context_invariance #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyAbs t_y h1 ->\n TyAbs t_y (context_invariance h1 (extend g' 0 t_y))\n | TyApp h1 h2 ->\n TyApp (context_invariance h1 g') (context_invariance h2 g')", "val synth_inverse (#t1 #t2: Type) (f2: (t1 -> GTot t2)) (g1: (t2 -> GTot t1)) : GTot Type0\nlet synth_inverse\n (#t1: Type)\n (#t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n: GTot Type0\n= (forall (x : t2) . {:pattern (f2 (g1 x))} f2 (g1 x) == x)", "val clens_synth_inv (#t1 #t2: Type) (f: (t1 -> GTot t2)) (g: (t2 -> GTot t1)) : Tot (clens t2 t1)\nlet clens_synth_inv\n (#t1: Type)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n: Tot (clens t2 t1)\n= {\n clens_cond = (fun (x: t2) -> True);\n clens_get = (fun (x: t2) -> g x);\n(* \n clens_put = (fun (x: t1) (y: t2) -> g y);\n clens_get_put = (fun (x: t1) (y: t2) -> ());\n clens_put_put = (fun (x: t1) (y y' : t2) -> ());\n clens_put_get = (fun (x: t1) -> ());\n*)\n}", "val typing_extensional : #e:exp -> #g:env -> #t:typ ->\n h:(typing g e t) -> g':env{feq g g'} -> Tot (typing g' e t) (decreases h)\nlet rec typing_extensional #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyLam t h -> TyLam t (typing_extensional h (extend t g'))\n | TyApp h1 h2 -> TyApp (typing_extensional h1 g') (typing_extensional h2 g')\n | TyUnit -> TyUnit", "val gaccessor_synth_inv\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: squash (synth_inverse f g /\\ synth_injective f))\n: Tot (gaccessor p1 (parse_synth p1 f) (clens_synth_inv g f))\nlet gaccessor_synth_inv\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: squash (synth_inverse f g /\\ synth_injective f))\n: Tot (gaccessor p1 (parse_synth p1 f) (clens_synth_inv g f))\n= gaccessor_prop_equiv p1 (parse_synth p1 f) (clens_synth_inv g f) (gaccessor_synth_inv' p1 f g u);\n gaccessor_synth_inv' p1 f g u", "val accessor_synth_inv\n (#k: parser_kind)\n (#t1 #t2: Type)\n (p1: parser k t1)\n (f: (t1 -> GTot t2))\n (g: (t2 -> GTot t1))\n (u: unit{synth_inverse f g /\\ synth_injective f})\n : Tot (accessor (gaccessor_synth_inv p1 f g u))\nlet accessor_synth_inv\n (#k: parser_kind)\n (#t1: Type)\n (#t2: Type)\n (p1: parser k t1)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: unit { synth_inverse f g /\\ synth_injective f } )\n: Tot (accessor (gaccessor_synth_inv p1 f g u))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let] let _ =\n Classical.forall_intro (gaccessor_synth_inv_eq p1 f g u);\n slice_access_eq h (gaccessor_synth_inv p1 f g u) input pos\n in\n pos", "val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)\n : GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &\n (tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))\nlet rec vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)\n : GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &\n (tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))\n (decreases v)\n = match v with\n | VE_Refl _ _ -> (fun x -> x), (fun x -> x)\n\n | VE_Sym _ _ _ v' -> \n let f, g = vprop_equiv_typing v' in\n g, f\n\n | VE_Trans g t0 t2 t1 v02 v21 ->\n let f02, f20 = vprop_equiv_typing v02 in\n let f21, f12 = vprop_equiv_typing v21 in\n (fun x -> f21 (f02 x)), \n (fun x -> f20 (f12 x))\n\n | VE_Ctxt g s0 s1 s0' s1' v0 v1 ->\n let f0, f0' = vprop_equiv_typing v0 in\n let f1, f1' = vprop_equiv_typing v1 in \n let ff (x:tot_typing g (tm_star s0 s1) tm_vprop)\n : tot_typing g (tm_star s0' s1') tm_vprop\n = let s0_typing = star_typing_inversion_l x in\n let s1_typing = star_typing_inversion_r x in\n let s0'_typing, s1'_typing = f0 s0_typing, f1 s1_typing in\n star_typing s0'_typing s1'_typing\n in\n let gg (x:tot_typing g (tm_star s0' s1') tm_vprop)\n : tot_typing g (tm_star s0 s1) tm_vprop\n = let s0'_typing = star_typing_inversion_l x in\n let s1'_typing = star_typing_inversion_r x in\n star_typing (f0' s0'_typing) (f1' s1'_typing) \n in\n ff, gg\n\n | VE_Unit g t ->\n let fwd (x:tot_typing g (tm_star tm_emp t) tm_vprop)\n : tot_typing g t tm_vprop\n = let r = star_typing_inversion_r x in\n r\n in\n let bk (x:tot_typing g t tm_vprop)\n : tot_typing g (tm_star tm_emp t) tm_vprop\n = star_typing emp_typing x\n in\n fwd, bk\n\n | VE_Comm g t0 t1 ->\n let f t0 t1 (x:tot_typing g (tm_star t0 t1) tm_vprop)\n : tot_typing g (tm_star t1 t0) tm_vprop\n = let tt0 = star_typing_inversion_l x in\n let tt1 = star_typing_inversion_r x in\n star_typing tt1 tt0\n in\n f t0 t1, f t1 t0\n\n | VE_Assoc g t0 t1 t2 ->\n let fwd (x:tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop)\n : tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop\n = let tt0 = star_typing_inversion_l x in\n let tt12 = star_typing_inversion_r x in\n let tt1 = star_typing_inversion_l tt12 in\n let tt2 = star_typing_inversion_r tt12 in\n star_typing (star_typing tt0 tt1) tt2\n in\n let bk (x : tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop)\n : tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop\n = let tt01 = star_typing_inversion_l x in\n let tt2 = star_typing_inversion_r x in\n let tt0 = star_typing_inversion_l tt01 in\n let tt1 = star_typing_inversion_r tt01 in\n star_typing tt0 (star_typing tt1 tt2)\n in\n fwd, bk\n \n | VE_Ext g t0 t1 token ->\n let d1, d2 = vprop_eq_typing_inversion g t0 t1 token in\n (fun _ -> d2),\n (fun _ -> d1)\n \n | VE_Fa g x u b t0 t1 d ->\n let d0, d1 = vprop_equiv_typing d in\n (fun fa0_typing ->\n let b_typing, t0_typing = invert_forall_typing fa0_typing x in\n let t1_typing = d0 t0_typing in\n construct_forall_typing #g #u x b_typing t1_typing),\n (fun fa1_typing ->\n let b_typing, t1_typing = invert_forall_typing fa1_typing x in\n let t0_typing = d1 t1_typing in\n construct_forall_typing #g #u #b #t0 x b_typing t0_typing)", "val weakening : n:nat -> #g:env -> #e:exp -> #t:typ -> t':typ ->\n h:typing g e t -> Tot (typing (extend_gen n t' g) (shift_up_above n e) t)\n (decreases h)\nlet rec weakening n #g #v #t t' h =\n let hs : subst_typing (sub_inc_above n) g (extend_gen n t' g) =\n fun y -> if y < n then TyVar y else TyVar (y+1)\n in substitution (sub_inc_above n) h hs", "val add_iname_typing:\n g: env ->\n #inv_p: term ->\n #inames: term ->\n #inv: term ->\n tot_typing g inv_p tm_vprop ->\n tot_typing g inames tm_inames ->\n tot_typing g inv (tm_inv inv_p)\n -> tot_typing g (add_iname inv_p inames inv) tm_inames\nlet add_iname_typing\n (g:env) (#inv_p #inames #inv:term)\n (_:tot_typing g inv_p tm_vprop)\n (_:tot_typing g inames tm_inames)\n (_:tot_typing g inv (tm_inv inv_p))\n: tot_typing g (add_iname inv_p inames inv) tm_inames\n= RU.magic()", "val norm_st_typing_inverse\n (#g:env) (#e:st_term) (#t0:term)\n (d:st_typing g e (C_Tot t0))\n (#u:_)\n (t1:term)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (st_typing g e (C_Tot t1)))\nlet norm_st_typing_inverse\n (#g:env) (#e:st_term) (#t0:term)\n (d:st_typing g e (C_Tot t0))\n (#u:_)\n (t1:term)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (st_typing g e (C_Tot t1)))\n = let d1 \n : Ghost.erased (RT.tot_typing (elab_env g) (elab_term t1) (RT.tm_type u))\n = Ghost.hide d1._0\n in\n let (| t1', t1'_typing, related_t1_t1' |) =\n Pulse.RuntimeUtils.norm_well_typed_term d1 steps\n in\n match Pulse.Readback.readback_ty t1' with\n | Some t1_p ->\n if TermEq.term_eq (elab_term t0) t1'\n then (\n let t0_typing \n : Ghost.erased (RT.tot_typing (elab_env g) (elab_term t0) (RT.tm_type u)) =\n rt_equiv_typing #_ #_ #(elab_term t0) related_t1_t1' d1\n in\n let eq\n : Ghost.erased (RT.equiv (elab_env g) (elab_term t0) (elab_term t1))\n = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1')\n in\n let steq : st_equiv g (C_Tot t0) (C_Tot t1) =\n ST_TotEquiv _ _ _ u (E (Ghost.reveal t0_typing)) eq\n in\n Some (T_Equiv _ _ _ _ d steq)\n )\n else None\n | _ -> None", "val substitution_preserves_typing :\n x:var -> #e:exp -> #v:exp -> #t_x:typ -> #t:typ -> #g:env ->\n $h1:typing empty v t_x ->\n $h2:typing (extend_gen x t_x g) e t ->\n Tot (typing g (subst (sub_beta_gen x v) e) t) (decreases e)\nlet rec substitution_preserves_typing x #e #v #t_x #t #g h1 h2 =\n match h2 with\n | TyVar y ->\n if x=y then (typable_empty_closed h1;\n closed_appears_free v;\n context_invariance h1 g)\n else if y\n let h21' = typing_extensional h21 (extend_gen (x+1) t_x (extend t_y g)) in\n typable_empty_closed h1;\n subst_gen_elam x v t_y e';\n let h21' : (r:typing (extend_gen (x+1) t_x (extend t_y g)) e' t'{e' << e}) =\n h21' in\n TyLam t_y (substitution_preserves_typing (x+1) h1 h21')\n | TyApp #_ #e1 #e2 #t11 #t12 h21 h22 ->\n let h21 : (r:typing (extend_gen x t_x g) e1 (TArr t11 t12){e1 << e}) = h21 in\n let h22 : (r:typing (extend_gen x t_x g) e2 t11{e2 << e}) = h22 in\n (TyApp (substitution_preserves_typing x h1 h21)\n (substitution_preserves_typing x h1 h22))\n | TyUnit -> TyUnit", "val invariant: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> Type0\nlet invariant #_ #_ h ll =\n LL2.invariant h ll", "val substitution_preserves_typing :\n x:var -> #e:exp -> #v:exp -> #t_x:ty -> #t:ty -> #g:env ->\n h1:rtyping empty v t_x ->\n h2:rtyping (extend g x t_x) e t ->\n Tot (rtyping g (subst_beta x v e) t) (decreases e)\nlet rec substitution_preserves_typing x #e #v #t_x #t #g h1 h2 =\n match h2 with\n | TyVar y ->\n if x=y then (typable_empty_closed' h1; context_invariance h1 g)\n else if y\n (let h21' = typing_extensional h21 (extend (extend g 0 t_y) (x+1) t_x) in\n TyAbs t_y (substitution_preserves_typing (x+1) h1 h21'))\n | TyApp #g' #e1 #e2 #t11 #t12 h21 h22 ->\n (* CH: implicits don't work here, why? *)\n (* NS: They do now *)\n (TyApp // #g #(subst_beta x v e1) #(subst_beta x v e2) #t11 #t12\n (substitution_preserves_typing x h1 h21)\n (substitution_preserves_typing x h1 h22))", "val norm_typing_inverse\n (g:env) (e:term) (eff:_) (t0:term)\n (d:typing g e eff t0)\n (t1:term)\n (#u:_)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (typing g e eff t1))\nlet norm_typing_inverse\n (g:env) (e:term) (eff:_) (t0:term)\n (d:typing g e eff t0)\n (t1:term)\n (#u:_)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (typing g e eff t1))\n = let (| t1', t1'_typing, related_t1_t1' |) =\n let d1 = Ghost.hide d1._0 in\n Pulse.RuntimeUtils.norm_well_typed_term d1 steps\n in\n match Pulse.Readback.readback_ty t1' with\n | Some t1_p ->\n if TermEq.term_eq (elab_term t0) t1'\n then (\n let related_t1'_t1 = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1') in\n Some (apply_conversion d related_t1'_t1)\n )\n else None\n | _ -> None", "val synth_inverse_synth_injective_pat (#t1 #t2: Type) (f: (t1 -> GTot t2)) (g: (t2 -> GTot t1))\n : Lemma (requires (synth_inverse g f))\n (ensures (synth_injective f))\n [SMTPat (synth_inverse g f)]\nlet synth_inverse_synth_injective_pat\n (#t1: Type)\n (#t2: Type)\n (f: (t1 -> GTot t2))\n (g: (t2 -> GTot t1))\n: Lemma\n (requires (synth_inverse g f))\n (ensures (synth_injective f))\n [SMTPat (synth_inverse g f)]\n= assert (forall x1 x2. f x1 == f x2 ==> g (f x1) == g (f x2))", "val elab_st_sub (#g: env) (#c1 #c2: comp) (d_sub: st_sub g c1 c2)\n : Tot (t: R.term & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\nlet elab_st_sub (#g:env) (#c1 #c2 : comp)\n (d_sub : st_sub g c1 c2)\n : Tot (t:R.term\n & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\n= RU.magic_s \"elab_st_sub\"", "val synth_injective_synth_inverse_synth_inverse_recip\n (#t1 #t2: Type)\n (g: (t2 -> GTot t1))\n (f: (t1 -> GTot t2))\n (u: squash (synth_inverse g f /\\ synth_injective g))\n : Tot (squash (synth_inverse f g))\nlet synth_injective_synth_inverse_synth_inverse_recip\n (#t1: Type)\n (#t2: Type)\n (g: (t2 -> GTot t1))\n (f: (t1 -> GTot t2))\n (u: squash (synth_inverse g f /\\ synth_injective g))\n: Tot (squash (synth_inverse f g))\n= assert (forall x . g (f (g x)) == g x)", "val app_typing\n (g: R.env)\n (ty1 ty2 f tm: R.term)\n (df: RT.tot_typing g f (simple_arr ty1 ty2))\n (dt: RT.tot_typing g tm ty1)\n : GTot (RT.tot_typing g (R.pack_ln (R.Tv_App f (tm, R.Q_Explicit))) ty2)\nlet app_typing (g:R.env) (ty1 ty2 f tm : R.term)\n (df : RT.tot_typing g f (simple_arr ty1 ty2))\n (dt : RT.tot_typing g tm ty1)\n : GTot (RT.tot_typing g (R.pack_ln (R.Tv_App f (tm, R.Q_Explicit))) ty2)\n = RU.magic()", "val synth_inverse_intro'\n (#t1 #t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (prf: (x: t2 -> Lemma (f2 (g1 x) == x)))\n : Lemma (ensures (synth_inverse f2 g1))\nlet synth_inverse_intro'\n (#t1: Type)\n (#t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (prf: (x: t2) -> Lemma (f2 (g1 x) == x))\n: Lemma\n (ensures (synth_inverse f2 g1))\n= Classical.forall_intro prf", "[@@ FStar.Tactics.Typeclasses.tcinstance]\nval ml_totarrow (t1: Type u#a) (t2: Type u#b) {| _: ml t1 |} {| _: ml t2 |} : ml (t1 -> Tot t2)\ninstance ml_totarrow (t1:Type u#a) (t2:Type u#b) {| ml t1 |} {| ml t2 |} : ml (t1 -> Tot t2) =\n { mldummy = () }", "val synth_injective (#t1 #t2: Type) (f: (t1 -> GTot t2)) : GTot Type0\nlet synth_injective\n (#t1: Type)\n (#t2: Type)\n (f: (t1 -> GTot t2))\n: GTot Type0\n= forall (x x' : t1) . {:pattern (f x); (f x')} f x == f x' ==> x == x'", "val rewrite_soundness\n \t\t(#g:stt_env)\n\t\t(#t:st_term)\n\t\t(#c:comp)\n\t\t(d:st_typing g t c{T_Rewrite? d})\n\t\t: GTot (RT.tot_typing (elab_env g)\n\t\t\t\t\t\t\t (elab_st_typing d)\n\t\t\t\t\t\t\t (elab_comp c))\nlet rewrite_soundness\n \t\t(#g:stt_env)\n\t\t(#t:st_term)\n\t\t(#c:comp)\n\t\t(d:st_typing g t c{T_Rewrite? d})\n\t\t: GTot (RT.tot_typing (elab_env g)\n\t\t\t\t\t\t\t (elab_st_typing d)\n\t\t\t\t\t\t\t (elab_comp c)) =\n\t\t\n\t\tlet T_Rewrite _ p q p_typing equiv_p_q = d in\n\t\tlet rp = elab_term p in\n\t\tlet rq = elab_term q in\n\t\tlet rp_typing : RT.tot_typing _ rp vprop_tm =\n\t\t tot_typing_soundness p_typing in\n\t\tlet rq_typing : RT.tot_typing _ rq vprop_tm =\n\t\t tot_typing_soundness (let f, _ = vprop_equiv_typing equiv_p_q in\n\t\t\t\t f p_typing) in\n\t\tlet d_stt_vprop_equiv =\n\t\t Pulse.Soundness.VPropEquiv.vprop_equiv_unit_soundness\n\t\t\t\t p_typing equiv_p_q in\n\t\t\n\t\tWT.rewrite_typing rp_typing rq_typing d_stt_vprop_equiv", "val tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)\n : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))\nlet tot_typing_soundness (#g:env)\n (#e:term)\n (#t:term)\n (d:tot_typing g e t)\n : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))\n = let E d = d in\n d", "val tm_inames_subset_typing:\n g: env ->\n #i: term ->\n #j: term ->\n tot_typing g i tm_inames ->\n tot_typing g j tm_inames\n -> tot_typing g (tm_inames_subset i j) tm_prop\nlet tm_inames_subset_typing\n (g:env) (#i #j:term)\n (_:tot_typing g i tm_inames)\n (_:tot_typing g j tm_inames)\n: tot_typing g (tm_inames_subset i j) tm_prop\n= RU.magic()", "val impl_to_arrow (#a #b: Type0) (_: (a ==> b)) (_: squash a) : Tot (squash b)\nlet impl_to_arrow #a #b impl sx =\n bind_squash #(a -> GTot b) impl (fun f -> bind_squash sx (fun x -> return_squash (f x)))", "val lift_comp_subst\n (g: env)\n (x: var)\n (t: typ)\n (g': env{pairwise_disjoint g (singleton_env (fstar_env g) x t) g'})\n (#e: term)\n (e_typing: tot_typing g e t)\n (#c1 #c2: comp)\n (d: lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e))\nlet lift_comp_subst\n (g:env) (x:var) (t:typ) (g':env { pairwise_disjoint g (singleton_env (fstar_env g) x t) g' })\n (#e:term)\n (e_typing:tot_typing g e t)\n (#c1 #c2:comp)\n (d:lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e)) =\n\n let ss = nt x e in\n \n match d with\n | Lift_STAtomic_ST _ c ->\n Lift_STAtomic_ST _ (subst_comp c ss)\n\n | Lift_Ghost_Neutral _ c d_non_informative ->\n Lift_Ghost_Neutral _ (subst_comp c ss)\n (non_informative_c_subst g x t g' e_typing _ d_non_informative)\n \n | Lift_Neutral_Ghost _ c ->\n Lift_Neutral_Ghost _ (subst_comp c ss)\n \n | Lift_Observability _ c o ->\n Lift_Observability _ (subst_comp c ss) o", "val tot_typing_weakening_standard (g:env)\n (#t #ty:term) (d:tot_typing g t ty)\n (g1:env { g1 `env_extends` g })\n : tot_typing g1 t ty\nlet tot_typing_weakening_standard g #t #ty d g2 =\n let g1 = diff g2 g in\n let g' = mk_env (fstar_env g) in\n assert (equal (push_env g g1) g2);\n assert (equal (push_env g g') g);\n assert (equal (push_env (push_env g g1) g') g2);\n tot_typing_weakening g g' t ty d g1", "val v: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> GTot (map t_k t_v)\nlet v #_ #_ h ll =\n let l = LL2.v h ll in\n v_ l", "val tot_typing_freevars (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\nlet tot_typing_freevars\n (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = tot_or_ghost_typing_freevars d", "val remove_iname_typing:\n g: env ->\n #inv_p: term ->\n #inames: term ->\n #inv: term ->\n tot_typing g inv_p tm_vprop ->\n tot_typing g inames tm_inames ->\n tot_typing g inv (tm_inv inv_p)\n -> tot_typing g (remove_iname inv_p inames inv) tm_inames\nlet remove_iname_typing\n (g:env) (#inv_p #inames #inv:term)\n (_:tot_typing g inv_p tm_vprop)\n (_:tot_typing g inames tm_inames)\n (_:tot_typing g inv (tm_inv inv_p))\n: tot_typing g (remove_iname inv_p inames inv) tm_inames\n= RU.magic()", "val preservation : #e:exp -> #e':exp -> #g:env -> #t:typ ->\n ht:(typing g e t) ->\n hs:step e e' ->\n Tot (typing g e' t) (decreases ht)\nlet rec preservation #e #e' #g #t (TyApp h1 h2) hs =\n match hs with\n | SBeta tx e1' e2' -> substitution_beta h2 (TyLam?.hbody h1)\n | SApp1 e2' hs1 -> TyApp (preservation h1 hs1) h2\n | SApp2 e1' hs2 -> TyApp h1 (preservation h2 hs2)", "val accessor_then_snd\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (#g: gaccessor p0 (p1 `nondep_then` p2) cl)\n (a: accessor g)\n (j1: jumper p1)\n : Tot (accessor (gaccessor_then_snd g))\nlet accessor_then_snd\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (#g: gaccessor p0 (p1 `nondep_then` p2) cl)\n (a: accessor g)\n (j1: jumper p1)\n: Tot (accessor (gaccessor_then_snd g))\n= accessor_compose a (accessor_snd j1 p2) ()", "val gaccessor_prop'\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (f: gaccessor' p1 p2 cl)\n : GTot Type0\nlet gaccessor_prop'\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (f: gaccessor' p1 p2 cl)\n: GTot Type0\n= gaccessor_no_lookahead f /\\ gaccessor_injective f", "val bind_st: a:Type -> b:Type -> f:st a -> g:(a -> Tot (st b)) -> Tot (st b)\nlet bind_st a b f g = fun s0 ->\n let tmp = f s0 in\n let x, s1 = tmp in\n g x s1", "val emp_inames_typing (g: env) : tot_typing g tm_emp_inames tm_inames\nlet emp_inames_typing (g:env) : tot_typing g tm_emp_inames tm_inames = RU.magic()", "val eval: g:Type -> a:Type -> tm g a -> g -> Tot a\nlet rec eval (g:Type) (a:Type) t env = match t with\n | Var _ _ v -> eval_var g a v env\n | Lam 'gg 'arg 'res body ->\n (fun (x:'arg) -> eval (g * 'arg) 'res body (env,x))\n | App 'gg 'arg 'res e1 e2 ->\n (eval g ('arg -> Tot 'res) e1 env <: 'arg -> Tot 'res (* still need this silly annotation; TODO, fix *))\n (eval g 'arg e2 env)", "val ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t)\n : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))\nlet ghost_typing_soundness (#g:env)\n (#e:term)\n (#t:term)\n (d:ghost_typing g e t)\n : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))\n = let E d = d in\n d", "val jump_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: (k: kt1 -> Tot (parser pk (t k))))\n (v: (k: kt1 -> Tot (jumper (p k))))\n (k: kt2)\n : Tot (jumper (p (f k)))\nlet jump_compose_context\n (#pk: parser_kind)\n (#kt1 #kt2: Type)\n (f: (kt2 -> Tot kt1))\n (t: (kt1 -> Tot Type))\n (p: ((k: kt1) -> Tot (parser pk (t k))))\n (v: ((k: kt1) -> Tot (jumper (p k))))\n (k: kt2)\n: Tot (jumper (p (f k)))\n= fun #rrel #rel input pos -> v (f k) input pos", "val apply_conversion\n (#g: env)\n (#e: term)\n (#eff: _)\n (#t0: term)\n (d: typing g e eff t0)\n (#t1: term)\n (eq: Ghost.erased (RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1)))\n : typing g e eff t1\nlet apply_conversion\n (#g:env) (#e:term) (#eff:_) (#t0:term)\n (d:typing g e eff t0)\n (#t1:term)\n (eq:Ghost.erased (RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1)))\n : typing g e eff t1\n = let d : RT.typing (elab_env g) (elab_term e) (eff, (elab_term t0)) = d._0 in\n let r : RT.related (elab_env g) (elab_term t0) RT.R_Eq (elab_term t1) = eq in\n let r = RT.Rel_equiv _ _ _ RT.R_Sub r in\n let s : RT.sub_comp (elab_env g) (eff, (elab_term t0)) (eff, elab_term t1) = \n RT.Relc_typ _ _ _ _ _ r\n in\n E (RT.T_Sub _ _ _ _ d s)", "val vprop_equiv_typing_bk\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop \n = let _, bk = vprop_equiv_typing d in\n bk ctxt_typing", "val vprop_equiv_typing_bk\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop \n = let _, bk = vprop_equiv_typing d in\n bk ctxt_typing", "val gaccessor_then_snd\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (g: gaccessor p0 (p1 `nondep_then` p2) cl)\n : Tot (gaccessor p0 p2 (cl `clens_compose` (clens_snd _ _)))\nlet gaccessor_then_snd\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (g: gaccessor p0 (p1 `nondep_then` p2) cl)\n: Tot (gaccessor p0 p2 (cl `clens_compose` clens_snd _ _))\n= g `gaccessor_compose` gaccessor_snd _ _", "val st_typing_correctness_ctot (#g:env) (#t:st_term) (#c:comp{C_Tot? c}) \n (_:st_typing g t c)\n : (u:Ghost.erased universe & universe_of g (comp_res c) u)\nlet st_typing_correctness_ctot (#g:env) (#t:st_term) (#c:comp{C_Tot? c}) \n (_:st_typing g t c)\n: (u:Ghost.erased universe & universe_of g (comp_res c) u)\n= let u : Ghost.erased universe = RU.magic () in\n let ty : universe_of g (comp_res c) u = RU.magic() in\n (| u, ty |)", "val serialize32_synth_backwards\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1': serializer32_backwards s1)\n (#t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (g1': (x2: t2 -> Tot (x1: t1{x1 == g1 x2})))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n : Tot (serializer32_backwards (serialize_synth p1 f2 s1 g1 u))\nlet serialize32_synth_backwards\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1' : serializer32_backwards s1)\n (#t2: Type)\n (f2: t1 -> GTot t2)\n (g1: t2 -> GTot t1)\n (g1' : (x2: t2) -> Tot (x1: t1 { x1 == g1 x2 } ))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n: Tot (serializer32_backwards (serialize_synth p1 f2 s1 g1 u))\n= fun x #rrel #rel input pos ->\n [@inline_let] let _ =\n serialize_synth_eq p1 f2 s1 g1 () x\n in\n s1' (g1' x) input pos", "val all_inames_typing (g: env) : tot_typing g all_inames tm_inames\nlet all_inames_typing (g:env)\n: tot_typing g all_inames tm_inames\n= RU.magic()", "val lift_typing_to_ghost_typing\n (#g: env)\n (#e: term)\n (#eff: T.tot_or_ghost)\n (#t: term)\n (d: typing g e eff t)\n : ghost_typing g e t\nlet lift_typing_to_ghost_typing (#g:env) (#e:term) (#eff:T.tot_or_ghost) (#t:term)\n (d:typing g e eff t)\n : ghost_typing g e t =\n if eff = T.E_Ghost\n then d\n else let E d = d in\n E (RT.T_Sub _ _ _ _ d (RT.Relc_total_ghost _ _))", "val accessor_snd\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (j1: jumper p1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n : Tot (accessor (gaccessor_snd p1 p2))\nlet accessor_snd\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (j1: jumper p1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n: Tot (accessor (gaccessor_snd p1 p2))\n= reveal_opaque (`%gaccessor_snd) (gaccessor_snd p1 p2);\n fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let] let _ = valid_nondep_then h p1 p2 input pos in\n let res = j1 input pos in\n [@inline_let] let _ =\n slice_access_eq h (gaccessor_snd p1 p2) input pos;\n valid_facts p1 h input pos\n in\n res", "val v_: #t_k:eqtype -> #t_v:Type0 -> l:list (t_k & t_v) -> Tot (map t_k t_v)\nlet v_ #_ #t_v l =\n List.Tot.fold_right (fun (k, v) m -> M.upd m k (Some v)) l (M.const (None #t_v))", "val bind_fn_typing\n (#g:stt_env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c{T_BindFn? d})\n (soundness:soundness_t d)\n : GTot (RT.tot_typing (elab_env g)\n (elab_st_typing d)\n (elab_comp c))\nlet bind_fn_typing #g #t #c d soundness =\n let T_BindFn _ e1 e2 c1 c2 b x e1_typing u t1_typing e2_typing c2_typing = d in\n let t1 = comp_res c1 in\n let g_x = push_binding g x ppname_default t1 in\n\n let re1 = elab_st_typing e1_typing in\n let rt1 = elab_term t1 in\n let re2 = elab_st_typing e2_typing in\n\n let re1_typing : RT.tot_typing (elab_env g) re1 rt1 =\n soundness g e1 c1 e1_typing in\n \n let re2_typing : RT.tot_typing (elab_env g_x) re2 (elab_comp c2) =\n soundness g_x (open_st_term_nv e2 (v_as_nv x)) c2 e2_typing in\n\n RT.well_typed_terms_are_ln _ _ _ re2_typing;\n calc (==) {\n RT.open_term (RT.close_term re2 x) x;\n (==) { RT.open_term_spec (RT.close_term re2 x) x }\n RT.subst_term (RT.close_term re2 x) (RT.open_with_var x 0);\n (==) { RT.close_term_spec re2 x }\n RT.subst_term (RT.subst_term re2 [ RT.ND x 0 ]) (RT.open_with_var x 0);\n (==) { RT.open_close_inverse' 0 re2 x }\n re2;\n };\n let elab_t = RT.mk_let RT.pp_name_default re1 rt1 (RT.close_term re2 x) in\n let res\n : RT.tot_typing (elab_env g) elab_t (RT.open_with (RT.close_term (elab_comp c2) x) re1)\n = RT.T_Let (elab_env g) x re1 rt1 (RT.close_term re2 x) (elab_comp c2) T.E_Total RT.pp_name_default re1_typing re2_typing in\n Pulse.Typing.LN.comp_typing_ln c2_typing;\n Pulse.Elaborate.elab_ln_comp c (-1);\n assert (RT.ln (elab_comp c2));\n open_close_inverse_t (elab_comp c2) x re1;\n assert (RT.open_with (RT.close_term (elab_comp c2) x) re1 == elab_comp c2); \n res", "val jump_list_up_to_inv\n (#k #t: _)\n (#p: parser k t)\n (cond: (t -> Tot bool))\n (prf: consumes_if_not_cond cond p {k.parser_kind_subkind <> Some ParserConsumesAll})\n (#rrel #rel: _)\n (sl: slice rrel rel)\n (pos0: U32.t)\n (h0: HS.mem)\n (bpos: B.pointer U32.t)\n (h: HS.mem)\n (stop: bool)\n : GTot Type0\nlet jump_list_up_to_inv\n (#k: _)\n (#t: _)\n (#p: parser k t)\n (cond: (t -> Tot bool))\n (prf: consumes_if_not_cond cond p { k.parser_kind_subkind <> Some ParserConsumesAll } )\n (#rrel #rel: _)\n (sl: slice rrel rel)\n (pos0: U32.t)\n (h0: HS.mem)\n (bpos: B.pointer U32.t)\n (h: HS.mem)\n (stop: bool)\n: GTot Type0\n= let pos = B.deref h bpos in\n let q = parse_list_up_to cond p prf in\n B.live h0 bpos /\\\n live_slice h0 sl /\\\n B.loc_disjoint (B.loc_buffer sl.base) (B.loc_buffer bpos) /\\\n B.modifies (B.loc_buffer bpos) h0 h /\\\n U32.v pos0 <= U32.v pos /\\\n valid q h0 sl pos0 /\\\n begin if stop\n then \n get_valid_pos q h0 sl pos0 == pos\n else\n valid q h0 sl pos /\\\n get_valid_pos q h0 sl pos0 == get_valid_pos q h0 sl pos\n end", "val mk_bind (g:env)\n (pre:term)\n (e1:st_term)\n (e2:st_term)\n (c1:comp_st)\n (c2:comp_st)\n (px:nvar { ~ (Set.mem (snd px) (dom g)) })\n (d_e1:st_typing g e1 c1)\n (d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))\n (d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)\n (res_typing:universe_of g (comp_res c2) (comp_u c2))\n (post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))\n (open_term_nv (comp_post c2) px)\n tm_vprop)\n (bias_towards_continuation:bool)\n : T.TacH (t:st_term &\n c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\\\n (bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &\n st_typing g t c)\n (requires fun _ ->\n let _, x = px in\n comp_pre c1 == pre /\\\n None? (lookup g x) /\\\n (~(x `Set.mem` freevars_st e2)) /\\\n open_term (comp_post c1) x == comp_pre c2 /\\\n (~ (x `Set.mem` freevars (comp_post c2))))\n (ensures fun _ _ -> True)\nlet rec mk_bind (g:env) \n (pre:term)\n (e1:st_term)\n (e2:st_term)\n (c1:comp_st)\n (c2:comp_st)\n (px:nvar { ~ (Set.mem (snd px) (dom g)) })\n (d_e1:st_typing g e1 c1)\n (d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))\n (d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)\n (res_typing:universe_of g (comp_res c2) (comp_u c2))\n (post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))\n (open_term_nv (comp_post c2) px)\n tm_vprop)\n (bias_towards_continuation:bool)\n : T.TacH (t:st_term &\n c:comp_st {\n st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\\\n (bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &\n st_typing g t c)\n (requires fun _ ->\n let _, x = px in\n comp_pre c1 == pre /\\\n None? (lookup g x) /\\\n (~(x `Set.mem` freevars_st e2)) /\\\n open_term (comp_post c1) x == comp_pre c2 /\\\n (~ (x `Set.mem` freevars (comp_post c2))))\n (ensures fun _ _ -> True) =\n let _, x = px in\n let b = nvar_as_binder px (comp_res c1) in\n let fail_bias (#a:Type) tag\n : T.TacH a (requires fun _ -> True) (ensures fun _ r -> FStar.Tactics.Result.Failed? r)\n = let open Pulse.PP in\n fail_doc g (Some e1.range)\n [text \"Cannot compose computations in this \" ^/^ text tag ^/^ text \" block:\";\n prefix 4 1 (text \"This computation has effect: \") (pp (effect_annot_of_comp c1));\n prefix 4 1 (text \"The continuation has effect: \") (pp (effect_annot_of_comp c2))]\n in\n match c1, c2 with\n | C_ST _, C_ST _ ->\n mk_bind_st_st g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_STGhost _, C_STGhost _ ->\n mk_bind_ghost_ghost g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_STAtomic inames1 obs1 sc1, C_STAtomic inames2 obs2 sc2 ->\n if at_most_one_observable obs1 obs2\n then (\n mk_bind_atomic_atomic g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n ) \n else if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n\n | C_STAtomic inames _ _, C_ST _ ->\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_ST _, C_STAtomic inames _ _ ->\n if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_STAtomic_ST _ c2) in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )\n\n | C_STGhost _, C_STAtomic _ Neutral _ -> (\n match try_lift_ghost_atomic d_e1 with\n | Some d_e1 ->\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n | None ->\n if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_Neutral_Ghost _ c2) in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )\n )\n\n | C_STAtomic _ Neutral _, C_STGhost _ -> (\n if bias_towards_continuation\n then (\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n else (\n match try_lift_ghost_atomic d_e2 with\n | Some d_e2 ->\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n | None ->\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n )\n\n | C_STGhost _, C_ST _\n | C_STGhost _, C_STAtomic _ _ _ ->\n let d_e1 = lift_ghost_atomic d_e1 in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_ST _, C_STGhost _\n | C_STAtomic _ _ _, C_STGhost _ ->\n if bias_towards_continuation\n then fail_bias \"ghost\"\n else (\n let d_e2 = lift_ghost_atomic d_e2 in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )", "val accessor_synth\n (#k: parser_kind)\n (#t1 #t2: Type)\n (p1: parser k t1)\n (f: (t1 -> GTot t2))\n (g: (t2 -> GTot t1))\n (u: unit{synth_inverse f g /\\ synth_injective f})\n : Tot (accessor (gaccessor_synth p1 f g u))\nlet accessor_synth\n (#k: parser_kind)\n (#t1: Type)\n (#t2: Type)\n (p1: parser k t1)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: unit { synth_inverse f g /\\ synth_injective f } )\n: Tot (accessor (gaccessor_synth p1 f g u))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let] let _ =\n Classical.forall_intro (gaccessor_synth_eq p1 f g u);\n slice_access_eq h (gaccessor_synth p1 f g u) input pos\n in\n pos", "val maybe_rewrite_body_typing\n (#g: _)\n (#e: st_term)\n (#c: comp)\n (d: st_typing g e c)\n (asc: comp_ascription)\n : T.Tac (c': comp & st_typing g e c')\nlet maybe_rewrite_body_typing\n (#g:_) (#e:st_term) (#c:comp)\n (d:st_typing g e c)\n (asc:comp_ascription)\n : T.Tac (c':comp & st_typing g e c')\n = match asc.annotated with\n | None -> (| c, d |)\n | Some (C_Tot t) -> (\n match c with\n | C_Tot t' -> (\n let t, _ = Pulse.Checker.Pure.instantiate_term_implicits g t in\n let (| u, t_typing |) = Pulse.Checker.Pure.check_universe g t in\n match Pulse.Checker.Base.norm_st_typing_inverse\n #_ #_ #t' d t t_typing [weak;hnf;delta]\n with\n | None -> \n Env.fail g (Some e.range) \"Inferred type is incompatible with annotation\"\n | Some d -> \n debug_abs g \n (fun _ -> Printf.sprintf \"maybe_rewrite_body_typing:{\\nfrom %s\\nto %s}\\n\" \n (P.comp_to_string c)\n (P.comp_to_string (C_Tot t)));\n (| C_Tot t, d |)\n )\n | _ -> \n Env.fail g (Some e.range) \"Inferred type is incompatible with annotation\"\n )\n | Some c -> \n let st = st_comp_of_comp c in\n Env.fail g (Some st.pre.range) \"Unexpected annotation on a function body\"", "val gaccessor_synth\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: squash (synth_inverse f g /\\ synth_injective f))\n: Tot (gaccessor (parse_synth p1 f) p1 (clens_synth g f))\nlet gaccessor_synth\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: squash (synth_inverse f g /\\ synth_injective f))\n: Tot (gaccessor (parse_synth p1 f) p1 (clens_synth g f))\n= synth_injective_synth_inverse_synth_inverse_recip f g ();\n gaccessor_prop_equiv (parse_synth p1 f) p1 (clens_synth g f) (gaccessor_synth' p1 f g u);\n gaccessor_synth' p1 f g u", "val vprop_equiv_typing_fwd\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop \n = let fwd, _ = vprop_equiv_typing d in\n fwd ctxt_typing", "val vprop_equiv_typing_fwd\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop \n = let fwd, _ = vprop_equiv_typing d in\n fwd ctxt_typing", "val squash_arrow : #a:Type -> #p:(a -> Type) ->\n $f:(x:a -> GTot (squash (p x))) -> GTot (squash (x:a -> GTot (p x)))\nlet squash_arrow #a #p f = squash_double_arrow (return_squash f)", "val check_subtyping (g:env) (t1 t2 : term)\n : T.Tac (subtyping_token g t1 t2)\nlet check_subtyping g t1 t2 =\n T.with_policy SMTSync (fun () ->\n let res, issues = rtb_check_subtyping g t1 t2 in\n T.log_issues issues;\n match res with\n | Some tok -> tok\n | None ->\n let open Pulse.PP in\n maybe_fail_doc issues g t1.range\n [ text \"Could not prove subtyping of \"\n ^/^ pp t1 ^/^ text \"and\" ^/^ pp t2]\n )", "val accessor_ext\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (#g: gaccessor p1 p2 cl)\n (a: accessor g)\n (cl': clens t1 t2)\n (sq: squash (clens_eq cl cl'))\n : Tot (accessor (gaccessor_ext g cl' sq))\nlet accessor_ext\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (#g: gaccessor p1 p2 cl)\n (a: accessor g)\n (cl': clens t1 t2)\n (sq: squash (clens_eq cl cl'))\n: Tot (accessor (gaccessor_ext g cl' sq))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ =\n slice_access_eq h (gaccessor_ext g cl' sq) input pos;\n slice_access_eq h g input pos;\n gaccessor_ext_eq g cl' sq (bytes_of_slice_from h input pos)\n in\n a input pos", "val comp_typing_as_effect_annot_typing (#g: env) (#c: comp_st) (ct: comp_typing_u g c)\n : effect_annot_typing g (effect_annot_of_comp c)\nlet comp_typing_as_effect_annot_typing (#g:env) (#c:comp_st) (ct:comp_typing_u g c)\n: effect_annot_typing g (effect_annot_of_comp c)\n= let _, iname_typing = Metatheory.comp_typing_inversion ct in\n match c with\n | C_ST _ -> ()\n | C_STGhost _ -> ()\n | C_STAtomic opens obs _ -> iname_typing", "val arrow_to_impl (#a #b: Type0) (_: (squash a -> GTot (squash b))) : GTot (a ==> b)\nlet arrow_to_impl #a #b f = squash_double_arrow (return_squash (fun x -> f (return_squash x)))", "val gaccessor_snd\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n : Tot (gaccessor (p1 `nondep_then` p2) p2 (clens_snd _ _))\nlet gaccessor_snd\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n: Tot (gaccessor (p1 `nondep_then` p2) p2 (clens_snd _ _))\n= Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_snd_injective p1 p2 x));\n Classical.forall_intro_2 (fun x -> Classical.move_requires (gaccessor_snd_no_lookahead p1 p2 x));\n gaccessor_prop_equiv (p1 `nondep_then` p2) p2 (clens_snd _ _) (gaccessor_snd' p1 p2);\n gaccessor_snd' p1 p2", "val gaccessor_prop\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (f: gaccessor' p1 p2 cl)\n: GTot Type0\nlet gaccessor_prop\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (f: gaccessor' p1 p2 cl)\n: GTot Type0\n= gaccessor_prop' f", "val eval_var : g:Type -> a:Type -> var g a -> g -> Tot a\nlet rec eval_var (g:Type) (a:Type) v env = match v with\n | O 'g0 '_ -> snd #'g0 #a env\n | S 'g0 'a0 'b0 u -> eval_var 'g0 'a0 u (fst #'g0 #'b0 env)", "val lift_comp_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c1 #c2: comp)\n (d: lift_comp (push_env g g') c1 c2)\n (g1: env{pairwise_disjoint g g1 g'})\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2) (decreases d)\nlet lift_comp_weakening (g:env) (g':env { disjoint g g'})\n (#c1 #c2:comp) (d:lift_comp (push_env g g') c1 c2)\n (g1:env { pairwise_disjoint g g1 g' })\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2)\n (decreases d) =\n \n match d with\n | Lift_STAtomic_ST _ c -> Lift_STAtomic_ST _ c\n | Lift_Ghost_Neutral _ c non_informative_c ->\n Lift_Ghost_Neutral _ c (non_informative_c_weakening g g' g1 _ non_informative_c)\n | Lift_Neutral_Ghost _ c -> Lift_Neutral_Ghost _ c\n | Lift_Observability _ obs c -> Lift_Observability _ obs c", "val bind\n (a b: Type)\n (r_in_f [@@@ refl_implicit]r_out_f: parser)\n ([@@@ refl_implicit]l_f: memory_invariant)\n ([@@@ refl_implicit]r_in_g r_out_g: parser)\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr1: squash (r_out_f == r_in_g))\n ([@@@ refl_implicit]pr2: squash (l_f == l_g))\n (f_bind: repr a r_in_f r_out_f l_f)\n (g: (x: a -> repr b (r_in_g) r_out_g l_g))\n : Tot (repr b r_in_f r_out_g l_g)\nlet bind (a:Type) (b:Type)\n (r_in_f:parser)\n ([@@@ refl_implicit] r_out_f: parser)\n ([@@@ refl_implicit] l_f: memory_invariant)\n ([@@@ refl_implicit] r_in_g:parser)\n (r_out_g: parser)\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g))\n ([@@@ refl_implicit] pr2:squash (l_f == l_g))\n (f_bind : repr a r_in_f r_out_f l_f)\n (g : (x: a -> repr b (r_in_g) r_out_g l_g))\n: Tot (repr b r_in_f r_out_g l_g)\n= 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)", "val weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind\nlet weak_kind_glb\r\n (k1 k2: weak_kind)\r\n: Tot weak_kind\r\n= if k1 = k2\r\n then k1\r\n else WeakKindWeak", "val fresh\n (#a: eqtype)\n (#b: (a -> Type))\n (#inv: (DM.t a (opt b) -> Type))\n (#r: HST.erid)\n (t: t r a b inv)\n (x: a)\n (h: HS.mem)\n : GTot Type0\nlet fresh\n (#a:eqtype)\n (#b:a -> Type)\n (#inv:DM.t a (opt b) -> Type)\n (#r:HST.erid)\n (t:t r a b inv)\n (x:a)\n (h:HS.mem)\n : GTot Type0\n = ~ (defined t x h)", "val serialize_synth_impl'\n (#t1 #t2: Type0)\n (g1': (x: t2 -> Tot t1))\n (#p1: parser_spec t1)\n (#s1: serializer_spec p1)\n (s1': serializer_impl s1)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (u: squash (synth_inverse f2 g1 /\\ synth_inverse g1 f2))\n (v: squash ((forall (x: t2). g1' x == g1 x)))\n : Tot (serializer_impl (serialize_synth s1 f2 g1 u))\nlet serialize_synth_impl'\n (#t1: Type0)\n (#t2: Type0)\n (g1': (x: t2) -> Tot t1)\n (#p1: parser_spec t1)\n (#s1: serializer_spec p1)\n (s1' : serializer_impl s1)\n (f2: t1 -> GTot t2)\n (g1: t2 -> GTot t1)\n (u: squash (\n synth_inverse f2 g1 /\\\n synth_inverse g1 f2\n ))\n (v: squash (\n (forall (x: t2) . g1' x == g1 x) \n ))\n: Tot (serializer_impl (serialize_synth s1 f2 g1 u))\n= serialize_synth_impl s1' f2 g1 (fun x -> g1' x) ()", "val gaccessor_ext\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (cl': clens t1 t2)\n (sq: squash (clens_eq cl cl'))\n: Tot (gaccessor p1 p2 cl')\nlet gaccessor_ext\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (cl': clens t1 t2)\n (sq: squash (clens_eq cl cl'))\n: Tot (gaccessor p1 p2 cl')\n= gaccessor_ext' g cl' sq", "val write_synth\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1': leaf_writer_strong s1)\n (#t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (g1': (x2: t2 -> Tot (x1: t1{x1 == g1 x2})))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n : Tot (leaf_writer_strong (serialize_synth p1 f2 s1 g1 ()))\nlet write_synth\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1' : leaf_writer_strong s1)\n (#t2: Type)\n (f2: t1 -> GTot t2)\n (g1: t2 -> GTot t1)\n (g1' : (x2: t2) -> Tot (x1: t1 { x1 == g1 x2 } ))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n: Tot (leaf_writer_strong (serialize_synth p1 f2 s1 g1 ()))\n= fun x #rrel #rel input pos ->\n [@inline_let] let _ = serialize_synth_eq p1 f2 s1 g1 () x in\n [@inline_let] let _ = serialized_length_eq (serialize_synth p1 f2 s1 g1 ()) x in\n [@inline_let] let _ = serialized_length_eq s1 (g1 x) in\n let pos' = s1' (g1' x) input pos in\n let h = HST.get () in\n [@inline_let] let _ = valid_synth h p1 f2 input pos in\n pos'", "val bind_tot_steelK_\n (a b: Type)\n (#framed: eqtype_as_type bool)\n (#[@@@ framing_implicit]pre: pre_t)\n (#[@@@ framing_implicit]post: post_t b)\n (f: (eqtype_as_type unit -> Tot a))\n (g: (x: a -> steelK b framed pre post))\n : steelK b framed pre post\nlet bind_tot_steelK_ (a:Type) (b:Type)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b)\n (f:eqtype_as_type unit -> Tot a) (g:(x:a -> steelK b framed pre post))\n: steelK b\n framed\n pre\n post\n = fun #frame #postf (k:(x:b -> SteelT unit (frame `star` post x) (fun _ -> postf))) ->\n let x = f () in\n g x #frame #postf k", "val gaccessor_snd_injective\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (sl sl': bytes)\n : Lemma\n (requires\n (gaccessor_pre (p1 `nondep_then` p2) p2 (clens_snd _ _) sl /\\\n gaccessor_pre (p1 `nondep_then` p2) p2 (clens_snd _ _) sl /\\\n injective_precond (p1 `nondep_then` p2) sl sl'))\n (ensures (gaccessor_snd' p1 p2 sl == gaccessor_snd' p1 p2 sl'))\nlet gaccessor_snd_injective\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (sl sl' : bytes)\n: Lemma\n (requires (gaccessor_pre (p1 `nondep_then` p2) p2 (clens_snd _ _) sl /\\ gaccessor_pre (p1 `nondep_then` p2) p2 (clens_snd _ _) sl /\\ injective_precond (p1 `nondep_then` p2) sl sl'))\n (ensures (gaccessor_snd' p1 p2 sl == gaccessor_snd' p1 p2 sl'))\n= nondep_then_eq p1 p2 sl;\n nondep_then_eq p1 p2 sl';\n parse_injective p1 sl sl'", "val synth_injective_intro'\n (#t1 #t2: Type)\n (f: (t1 -> GTot t2))\n (prf: (x: t1 -> x': t1 -> Lemma (requires (f x == f x')) (ensures (x == x'))))\n : Lemma (synth_injective f)\nlet synth_injective_intro'\n (#t1: Type)\n (#t2: Type)\n (f: (t1 -> GTot t2))\n (prf: (\n (x: t1) ->\n (x' : t1) ->\n Lemma\n (requires (f x == f x'))\n (ensures (x == x'))\n ))\n: Lemma\n (synth_injective f)\n= Classical.forall_intro_2 (fun x -> Classical.move_requires (prf x))", "val tot_or_ghost_typing_freevars (#g #t #ty #eff: _) (d: typing g t eff ty)\n : Lemma\n (ensures (freevars t) `Set.subset` (vars_of_env g) /\\ (freevars ty) `Set.subset` (vars_of_env g)\n )\nlet tot_or_ghost_typing_freevars\n (#g:_) (#t:_) (#ty:_) (#eff:_)\n (d:typing g t eff ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = elab_freevars t;\n elab_freevars ty; \n let E d = d in\n refl_typing_freevars d;\n assert (vars_of_env_r (elab_env g) `Set.equal` (vars_of_env g))", "val gaccessor_then_fst\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (g: gaccessor p0 (p1 `nondep_then` p2) cl)\n : Tot (gaccessor p0 p1 (cl `clens_compose` (clens_fst _ _)))\nlet gaccessor_then_fst\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (g: gaccessor p0 (p1 `nondep_then` p2) cl)\n: Tot (gaccessor p0 p1 (cl `clens_compose` clens_fst _ _))\n= g `gaccessor_compose` gaccessor_fst _ () _", "val bare_serialize_synth\n (#k: parser_kind)\n (#t1 #t2: Type)\n (p1: parser k t1)\n (f2: (t1 -> GTot t2))\n (s1: serializer p1)\n (g1: (t2 -> GTot t1))\n : Tot (bare_serializer t2)\nlet bare_serialize_synth\n (#k: parser_kind)\n (#t1: Type)\n (#t2: Type)\n (p1: parser k t1)\n (f2: t1 -> GTot t2)\n (s1: serializer p1)\n (g1: t2 -> GTot t1)\n: Tot (bare_serializer t2) =\n fun (x: t2) -> s1 (g1 x)", "val write_synth_weak\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1': leaf_writer_weak s1)\n (#t2: Type)\n (f2: (t1 -> GTot t2))\n (g1: (t2 -> GTot t1))\n (g1': (x2: t2 -> Tot (x1: t1{x1 == g1 x2})))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n : Tot (leaf_writer_weak (serialize_synth p1 f2 s1 g1 ()))\nlet write_synth_weak\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (#s1: serializer p1)\n (s1' : leaf_writer_weak s1)\n (#t2: Type)\n (f2: t1 -> GTot t2)\n (g1: t2 -> GTot t1)\n (g1' : (x2: t2) -> Tot (x1: t1 { x1 == g1 x2 } ))\n (u: squash (synth_injective f2 /\\ synth_inverse f2 g1))\n: Tot (leaf_writer_weak (serialize_synth p1 f2 s1 g1 ()))\n= fun x #rrel #rel input pos ->\n [@inline_let] let _ = serialize_synth_eq p1 f2 s1 g1 () x in\n [@inline_let] let _ = serialized_length_eq (serialize_synth p1 f2 s1 g1 ()) x in\n [@inline_let] let _ = serialized_length_eq s1 (g1 x) in\n let pos' = s1' (g1' x) input pos in\n let h = HST.get () in\n [@inline_let] let _ = valid_synth h p1 f2 input pos in\n pos'", "val as_map (g:env) : Map.t var typ\nlet as_map g = g.m", "val tot_typing_weakening_single (#g:env) (#t #ty:term)\n (d:tot_typing g t ty)\n (x:var { ~ (x `Set.mem` dom g)})\n (x_t:typ)\n\n : tot_typing (push_binding g x ppname_default x_t) t ty\nlet tot_typing_weakening_single #g #t #ty d x x_t =\n let g1 = singleton_env (fstar_env g) x x_t in\n let g' = mk_env (fstar_env g) in\n assert (equal (push_env g g') g);\n assert (equal (push_env (push_env g g1) g') (push_env g g1));\n assert (equal (push_env g g1) (push_binding g x ppname_default x_t));\n tot_typing_weakening g g' t ty d g1", "val gaccessor_synth_inv'\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: (t1 -> GTot t2))\n (g: (t2 -> GTot t1))\n (u: unit{synth_inverse f g /\\ synth_injective f})\n (input: bytes)\n : Ghost (nat)\n (requires (True))\n (ensures (fun pos' -> gaccessor_post' p1 (parse_synth p1 f) (clens_synth_inv g f) input pos'))\nlet gaccessor_synth_inv'\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (#t2: Type)\n (f: t1 -> GTot t2)\n (g: t2 -> GTot t1)\n (u: unit { synth_inverse f g /\\ synth_injective f } )\n (input: bytes)\n: Ghost (nat)\n (requires (True))\n (ensures (fun pos' -> gaccessor_post' p1 (parse_synth p1 f) (clens_synth_inv g f) input pos'))\n= parse_synth_eq p1 f input;\n 0", "val tot_typing_ln (#g:_) (#e:_) (#t:_)\n (d:tot_typing g e t)\n : Lemma (ln e /\\ ln t)\nlet tot_typing_ln\n (#g:_) (#e:_) (#t:_)\n (d:tot_typing g e t)\n : Lemma \n (ensures ln e /\\ ln t)\n = tot_or_ghost_typing_ln d", "val intro_dep_arrow_1 (a: td) (b: n_arrow [a] Type) (f: (x: td_as_type a -> elim_1 b x))\n : n_dep_arrow [a] b\nlet intro_dep_arrow_1 (a:td)\n (b:n_arrow [a] Type)\n (f:(x:td_as_type a -> elim_1 b x))\n : n_dep_arrow [a] b\n = f", "val map_val: #val1:Type -> #val2:Type -> f:(val1 -> val2) -> #key:eqtype -> t key val1 -> Tot (t key val2)\nlet map_val #_ #_ f #key m = {\n mappings = F.on key (fun x -> f (m.mappings x));\n domain = m.domain\n}", "val squash_double_arrow (#a: Type u#a) (#p: Type0) (f: (squash (a -> Tot (squash p))))\n : Tot (squash (a -> GTot p))\nlet squash_double_arrow (#a:Type u#a) (#p:Type0)\n (f:(squash (a -> Tot (squash p))))\n : Tot (squash (a -> GTot p)) =\n FStar.Squash.squash_double_arrow f", "val accessor_then_fst\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (#g: gaccessor p0 (p1 `nondep_then` p2) cl)\n (a: accessor g)\n : Tot (accessor (gaccessor_then_fst g))\nlet accessor_then_fst\n (#k0: parser_kind)\n (#t0: Type)\n (#p0: parser k0 t0)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t0 (t1 & t2))\n (#g: gaccessor p0 (p1 `nondep_then` p2) cl)\n (a: accessor g)\n: Tot (accessor (gaccessor_then_fst g))\n= accessor_compose a (accessor_fst p1 () p2) ()", "val serialize_synth\n (#k: parser_kind)\n (#t1: Type)\n (#t2: Type)\n (p1: tot_parser k t1)\n (f2: t1 -> Tot t2)\n (s1: serializer p1)\n (g1: t2 -> GTot t1)\n (u: unit {\n synth_inverse f2 g1 /\\\n synth_injective f2\n })\n: Tot (serializer (tot_parse_synth p1 f2))\nlet serialize_synth #k #t1 #t2 = serialize_tot_synth #k #t1 #t2", "val jump_nondep_then\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (p1': jumper p1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (p2': jumper p2)\n : Tot (jumper (nondep_then p1 p2))\nlet jump_nondep_then\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (p1' : jumper p1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (p2' : jumper p2)\n: Tot (jumper (nondep_then p1 p2))\n= fun (#rrel #rel: _)\n (input: slice rrel rel) (pos: U32.t) ->\n let h = HST.get () in\n [@inline_let] let _ = valid_nondep_then h p1 p2 input pos in\n p2' input (p1' input pos)", "val check_tot_term (g:env) (e:term) (t:term)\n : T.Tac (e:term &\n tot_typing g e t)\nlet check_tot_term g e t =\n check_term g e T.E_Total t", "val recheck: #g: env -> #e: term -> #ty: typ -> Prims.unit -> T.Tac (tot_typing g e ty)\nlet recheck (#g:env) (#e:term) (#ty: typ) () : T.Tac (tot_typing g e ty) =\n core_check_tot_term g e ty", "val implies_uncurry_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is1: inames)\n (#[T.exact (`(hide Set.empty))] is2: inames{is1 /! is2})\n (h1 h2 c: vprop)\n : STGhostT unit\n opened\n (( @==> ) #is1 h1 (( @==> ) #is2 h2 c))\n (fun _ -> ( @==> ) #(Set.union is1 is2) (h1 `star` h2) c)\nlet implies_uncurry_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is1 : inames)\n (#[T.exact (`(hide Set.empty))] is2 : inames {is1 /! is2})\n (h1 h2 c: vprop)\n: STGhostT unit opened\n ((@==>) #is1 h1 ((@==>) #is2 h2 c))\n (fun _ -> (@==>) #(Set.union is1 is2) (h1 `star` h2) c)\n= intro_implies_gen (h1 `star` h2) c (h1 @==> (h2 @==> c)) (fun _ ->\n elim_implies_gen h1 (h2 @==> c);\n elim_implies_gen h2 c\n )", "val bind (a: Type u#aa) (b: Type u#bb) (i1 i2: int) (f: repr a i1) (g: (x: a -> repr b i2))\n : Tot (repr b (i1 + i2))\nlet bind (a:Type u#aa) (b : Type u#bb) (i1 i2 : int)\n (f : repr a i1)\n (g : (x:a -> repr b i2))\n : Tot (repr b (i1+i2)) =\n raise_val (i1+i2)", "val implies_join_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is1: inames)\n (#[T.exact (`(hide Set.empty))] is2: inames)\n (h1 c1 h2 c2: vprop)\n : STGhostT unit\n opened\n ((( @==> ) #is1 h1 c1) `star` (( @==> ) #is2 h2 c2))\n (fun _ -> ( @==> ) #(Set.union is1 is2) (h1 `star` h2) (c1 `star` c2))\nlet implies_join_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is1 : inames)\n (#[T.exact (`(hide Set.empty))] is2 : inames)\n (h1 c1 h2 c2: vprop)\n: STGhostT unit opened\n (((@==>) #is1 h1 c1) `star` ((@==>) #is2 h2 c2))\n (fun _ -> (@==>) #(Set.union is1 is2) (h1 `star` h2) (c1 `star` c2))\n= intro_implies_gen (h1 `star` h2) (c1 `star` c2) ((h1 @==> c1) `star` (h2 @==> c2)) (fun _ ->\n elim_implies_gen h1 c1;\n elim_implies_gen h2 c2\n )" ], "closest_src": [ { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.typing_extensional" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.substitution" }, { "project_name": "FStar", "file_name": "MiniParse.Spec.Combinators.fst", "name": "MiniParse.Spec.Combinators.synth_inverse" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.context_invariance" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.st_comp_typing_inversion" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen_typing_conversion" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.comp_typing_inversion" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.context_invariance" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_inverse" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.clens_synth_inv" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.typing_extensional" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fst", "name": "LowParse.Low.Combinators.gaccessor_synth_inv" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.accessor_synth_inv" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.vprop_equiv_typing" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.weakening" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.add_iname_typing" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.norm_st_typing_inverse" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.substitution_preserves_typing" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.invariant" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.substitution_preserves_typing" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.norm_typing_inverse" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_inverse_synth_injective_pat" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_st_sub" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_injective_synth_inverse_synth_inverse_recip" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Sub.fst", "name": "Pulse.Soundness.Sub.app_typing" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_inverse_intro'" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.ml_totarrow" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_injective" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Rewrite.fst", "name": "Pulse.Soundness.Rewrite.rewrite_soundness" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Common.fst", "name": "Pulse.Soundness.Common.tot_typing_soundness" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.tm_inames_subset_typing" }, { "project_name": "FStar", "file_name": "FStar.Classical.fst", "name": "FStar.Classical.impl_to_arrow" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_subst" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.tot_typing_weakening_standard" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.v" }, { "project_name": "steel", "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.tot_typing_freevars" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.remove_iname_typing" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.preservation" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.accessor_then_snd" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.gaccessor_prop'" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.bind_st" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.emp_inames_typing" }, { "project_name": "FStar", "file_name": "Eval.DB.fst", "name": "Eval.DB.eval" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Common.fst", "name": "Pulse.Soundness.Common.ghost_typing_soundness" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.jump_compose_context" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.apply_conversion" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fsti", "name": "Pulse.Checker.VPropEquiv.vprop_equiv_typing_bk" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.vprop_equiv_typing_bk" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.gaccessor_then_snd" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.st_typing_correctness_ctot" }, { "project_name": "dice-star", "file_name": "ASN1.Low.Base.fst", "name": "ASN1.Low.Base.serialize32_synth_backwards" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.all_inames_typing" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.lift_typing_to_ghost_typing" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.accessor_snd" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.v_" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Bind.fst", "name": "Pulse.Soundness.Bind.bind_fn_typing" }, { "project_name": "everparse", "file_name": "LowParse.Low.ListUpTo.fst", "name": "LowParse.Low.ListUpTo.jump_list_up_to_inv" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.mk_bind" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.accessor_synth" }, { "project_name": "steel", "file_name": "Pulse.Checker.Abs.fst", "name": "Pulse.Checker.Abs.maybe_rewrite_body_typing" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fst", "name": "LowParse.Low.Combinators.gaccessor_synth" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fsti", "name": "Pulse.Checker.VPropEquiv.vprop_equiv_typing_fwd" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.vprop_equiv_typing_fwd" }, { "project_name": "FStar", "file_name": "FStar.SquashProperties.fst", "name": "FStar.SquashProperties.squash_arrow" }, { "project_name": "steel", "file_name": "Pulse.Checker.Pure.fst", "name": "Pulse.Checker.Pure.check_subtyping" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.fst", "name": "LowParse.Low.Base.accessor_ext" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.comp_typing_as_effect_annot_typing" }, { "project_name": "FStar", "file_name": "FStar.Classical.fst", "name": "FStar.Classical.arrow_to_impl" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.gaccessor_snd" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fst", "name": "LowParse.Low.Base.Spec.gaccessor_prop" }, { "project_name": "FStar", "file_name": "Eval.DB.fst", "name": "Eval.DB.eval_var" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_weakening" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.bind" }, { "project_name": "everparse", "file_name": "EverParse3d.Kinds.fsti", "name": "EverParse3d.Kinds.weak_kind_glb" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fsti", "name": "FStar.Monotonic.DependentMap.fresh" }, { "project_name": "FStar", "file_name": "MiniParse.Impl.Combinators.fst", "name": "MiniParse.Impl.Combinators.serialize_synth_impl'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fst", "name": "LowParse.Low.Base.Spec.gaccessor_ext" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.write_synth" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.Unix.fst", "name": "Steel.Primitive.ForkJoin.Unix.bind_tot_steelK_" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.gaccessor_snd_injective" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.synth_injective_intro'" }, { "project_name": "steel", "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.tot_or_ghost_typing_freevars" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.gaccessor_then_fst" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.bare_serialize_synth" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.write_synth_weak" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.as_map" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.tot_typing_weakening_single" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.gaccessor_synth_inv'" }, { "project_name": "steel", "file_name": "Pulse.Typing.LN.fst", "name": "Pulse.Typing.LN.tot_typing_ln" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.intro_dep_arrow_1" }, { "project_name": "FStar", "file_name": "FStar.Map.fst", "name": "FStar.Map.map_val" }, { "project_name": "FStar", "file_name": "FStar.ReflexiveTransitiveClosure.fst", "name": "FStar.ReflexiveTransitiveClosure.squash_double_arrow" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.accessor_then_fst" }, { "project_name": "everparse", "file_name": "LowParse.Tot.Combinators.fst", "name": "LowParse.Tot.Combinators.serialize_synth" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.jump_nondep_then" }, { "project_name": "steel", "file_name": "Pulse.Checker.Pure.fst", "name": "Pulse.Checker.Pure.check_tot_term" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.recheck" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_uncurry_gen" }, { "project_name": "FStar", "file_name": "Degenerate.fst", "name": "Degenerate.bind" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.implies_join_gen" } ], "selected_premises": [ "FStar.Constructive.ceq_trans", "FStar.Constructive.false_elim", "FStar.Constructive.ceq_symm", "LambdaOmega.progress", "FStar.FunctionalExtensionality.feq", "LambdaOmega.tshift_up", "FStar.Constructive.eq_ind", "LambdaOmega.tshift_up_above_lam", "LambdaOmega.esub_inc", "LambdaOmega.tappears_free_in", "LambdaOmega.esub_lam_hoist", "LambdaOmega.tsub_lam_hoist", "FStar.Pervasives.reveal_opaque", "LambdaOmega.tsub_beta_gen", "LambdaOmega.tcontext_invariance", "FStar.Constructive.ceq_congruence", "LambdaOmega.kinding_weakening_tbnd", "LambdaOmega.esub_lam", "FStar.Constructive.cfalse_elim", "LambdaOmega.tsub_inc", "FStar.Tactics.Effect.raise", "LambdaOmega.extend_tvar", "FStar.FunctionalExtensionality.on_dom", "LambdaOmega.tsubst_id", "LambdaOmega.kinding_extensional", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "LambdaOmega.tsub_lam", "LambdaOmega.esubst_extensional", "LambdaOmega.lookup_evar", "LambdaOmega.tsub_inc_above", "LambdaOmega.kinding_strengthening_ebnd", "LambdaOmega.tsubst_extensional", "LambdaOmega.is_tvar", "LambdaOmega.extend_evar", "LambdaOmega.kinding_weakening_ebnd", "LambdaOmega.lookup_tvar", "LambdaOmega.empty_x", "LambdaOmega.tsubst_beta_gen", "FStar.Tactics.Types.issues", "FStar.Constructive.false_elim2", "LambdaOmega.tsubst_comp", "LambdaOmega.is_trenaming", "FStar.FunctionalExtensionality.on", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "LambdaOmega.empty_a", "LambdaOmega.tshift_up_above", "FStar.Tactics.Effect.get", "LambdaOmega.is_erenaming", "FStar.Pervasives.dfst", "LambdaOmega.esub_beta", "FStar.Pervasives.dsnd", "LambdaOmega.empty", "LambdaOmega.is_value", "LambdaOmega.tsub_id", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "LambdaOmega.esubst_beta", "LambdaOmega.tsub_lam_comp", "FStar.FunctionalExtensionality.restricted_t", "LambdaOmega.is_evar", "LambdaOmega.tsub_comp", "FStar.Tactics.Effect.tactic", "FStar.FunctionalExtensionality.feq_g", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.FunctionalExtensionality.arrow", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.FunctionalExtensionality.on_dom_g", "LambdaOmega.tsubst_beta", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.FunctionalExtensionality.is_restricted", "FStar.FunctionalExtensionality.is_restricted_g", "FStar.Tactics.Effect.tac", "FStar.FunctionalExtensionality.efun", "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.efun_g", "FStar.FunctionalExtensionality.on_g", "FStar.Monotonic.Pure.is_monotonic", "Prims.min", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Issue.mk_issue", "FStar.Tactics.Effect.lift_div_tac", "FStar.Pervasives.pure_ite_wp", "FStar.Tactics.Effect.lift_div_tac_wp", "FStar.Tactics.Effect.tac_if_then_else_wp", "FStar.Tactics.Effect.tac_wp_monotonic", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.st_post_h", "FStar.Pervasives.id", "FStar.Pervasives.pure_close_wp", "Prims.op_Hat", "FStar.Pervasives.ex_pre", "FStar.Tactics.Effect.tac_bind_wp", "Prims.subtype_of", "FStar.Tactics.Effect.tac_close", "FStar.Pervasives.coerce_eq", "Prims.pure_wp_monotonic", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.all_post_h" ], "source_upto_this": "(*\n Copyright 2015\n Simon Forest - Inria and ENS Paris\n Catalin Hritcu - Inria\n Aseem Rastogi - UMD\n Nikhil Swamy - Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule LambdaOmega\n\n#set-options \"--max_fuel 1 --max_ifuel 1 --initial_fuel 1\"\n\nopen FStar.Constructive\nopen FStar.Classical\nopen FStar.FunctionalExtensionality\nopen FStar.StrongExcludedMiddle\n\n(* Chapter 29 of TAPL: \"Type Operators and Kinding\",\n proof follows Chapter 30, but we don't consider polymorphism\n (for extension to System F-omega see f-omega.fst) *)\n\ntype var = nat\n\ntype knd =\n | KTyp : knd\n | KArr : knd -> knd -> knd\n\ntype typ =\n | TVar : var -> typ\n | TLam : knd -> t:typ -> typ\n | TApp : typ -> typ -> typ\n | TArr : typ -> typ -> typ\n\ntype exp =\n | EVar : var -> exp\n | EApp : exp -> exp -> exp\n | ELam : typ -> exp -> exp\n\n(* Substitution on expressions\n (in this calculus doesn't interact with type substitution below) *)\n\ntype esub = var -> Tot exp\ntype erenaming (s:esub) = (forall (x:var). EVar? (s x))\n\nval is_erenaming : s:esub -> GTot (n:int{( erenaming s ==> n=0) /\\\n (~(erenaming s) ==> n=1)})\nlet is_erenaming s = (if strong_excluded_middle (erenaming s) then 0 else 1)\n\nval esub_inc : var -> Tot exp\nlet esub_inc y = EVar (y+1)\n\nlet is_evar (e:exp) : int = if EVar? e then 0 else 1\n\nval esubst : s:esub -> e:exp -> Pure exp (requires True)\n (ensures (fun e' -> erenaming s /\\ EVar? e ==> EVar? e'))\n (decreases %[is_evar e; is_erenaming s; 1; e])\n\nval esub_lam: s:esub -> x:var -> Tot (e:exp{ erenaming s ==> EVar? e})\n (decreases %[1;is_erenaming s; 0; EVar 0])\n\nlet rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))\n\nval esub_lam_renaming: s:esub -> Lemma\n (ensures (forall (x:var). erenaming s ==> EVar? (esub_lam s x)))\nlet esub_lam_renaming s = ()\n\n(* Substitution extensional; trivial with the extensionality axiom *)\nval esubst_extensional: s1:esub -> s2:esub{feq s1 s2} -> e:exp ->\n Lemma (requires True) (ensures (esubst s1 e == esubst s2 e))\n\t\t\t (decreases e)\n (*[SMTPat (esubst s1 e); SMTPat (esubst s2 e)]*)\nlet rec esubst_extensional s1 s2 e =\n match e with\n | EVar _ -> ()\n | ELam t e1 ->\n let open FStar.Tactics in\n assert (esubst s1 (ELam t e1) == ELam t (esubst (esub_lam s1) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n assert (esubst s2 (ELam t e1) == ELam t (esubst (esub_lam s2) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n esubst_extensional (esub_lam s1) (esub_lam s2) e1\n | EApp e1 e2 -> esubst_extensional s1 s2 e1; esubst_extensional s1 s2 e2\n\nval esub_lam_hoist : t:typ -> e:exp -> s:esub -> Lemma (requires True)\n (ensures (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e)))\nlet esub_lam_hoist t e s =\n let open FStar.Tactics in\n assert (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e))\n by (norm [zeta; iota; delta_only [`%esubst]])\n\nval esub_beta : exp -> Tot esub\nlet esub_beta e = fun y -> if y = 0 then e\n else (EVar (y-1))\n\nval esubst_beta : exp -> exp -> Tot exp\nlet esubst_beta e = esubst (esub_beta e)\n\n(* Substitution on types is kind of analogous *)\n(* CH: Now this is more complex: tsub_inc_above, tsubst_beta_gen are\n// still there unfortunately, although they were simplified away for\n// expressions. This seems to be more an artifact of the TAPL proof\n// (via confluence); so we can still hope we can do better for TinyF*.*)\n\ntype tsub = var -> Tot typ\ntype trenaming (s:tsub) = (forall (x:var). TVar? (s x))\n\nval is_trenaming : s:tsub -> GTot (n:int{( trenaming s ==> n=0) /\\\n (~(trenaming s) ==> n=1)})\nlet is_trenaming s = (if strong_excluded_middle (trenaming s) then 0 else 1)\n\nval tsub_inc_above : nat -> var -> Tot typ\nlet tsub_inc_above x y = if y Tot typ\nlet tsub_inc = tsub_inc_above 0\n\nval trenaming_sub_inc : unit -> Lemma (trenaming (tsub_inc))\nlet trenaming_sub_inc _ = ()\n\nlet is_tvar (t:typ) : int = if TVar? t then 0 else 1\n\nval tsubst : s:tsub -> t:typ -> Pure typ (requires True)\n (ensures (fun t' -> trenaming s /\\ TVar? t ==> TVar? t'))\n (decreases %[is_tvar t; is_trenaming s; 1; t])\nval tsub_lam: s:tsub -> x:var -> Tot (t:typ{trenaming s ==> TVar? t})\n (decreases %[1; is_trenaming s; 0; TVar 0])\nlet rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))\n\n(* Type substitution extensional; trivial with the extensionality axiom *)\nval tsubst_extensional: s1:tsub -> s2:tsub{feq s1 s2} -> t:typ ->\n Lemma (requires True) (ensures (tsubst s1 t = tsubst s2 t))\n\t\t\t (decreases t)\n(* [SMTPat (tsubst t s1); SMTPat (tsubst t s2)]*)\nlet rec tsubst_extensional s1 s2 t =\n match t with\n | TVar _ -> ()\n | TLam k t1 ->\n let open FStar.Tactics in\n assert (tsubst s1 (TLam k t1) == TLam k (tsubst (tsub_lam s1) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n assert (tsubst s2 (TLam k t1) == TLam k (tsubst (tsub_lam s2) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n tsubst_extensional (tsub_lam s1) (tsub_lam s2) t1\n | TArr t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n | TApp t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n\nval tsub_lam_hoist : k:knd -> t:typ -> s:tsub -> Lemma\n (ensures (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t)))\nlet tsub_lam_hoist k t s =\n let open FStar.Tactics in\n assert (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t))\n by norm [zeta; iota; delta_only [`%tsubst]]\n\n(* Type substitution composition *)\n(* CH: again, we managed to get rid of this for expressions only\n// (it was never used anyway) *)\n\nval tsub_comp : s1:tsub -> s2:tsub -> Tot tsub\nlet tsub_comp s1 s2 x = tsubst s1 (s2 x)\n\nval tsub_comp_inc : s:tsub -> x:var ->\n Lemma (tsub_comp tsub_inc s x = tsub_comp (tsub_lam s) tsub_inc x)\nlet tsub_comp_inc s x = ()\n\nval tsub_lam_renaming: s:tsub -> Lemma\n (ensures (forall (x:var). trenaming s ==> TVar? (tsub_lam s x)))\nlet tsub_lam_renaming s = ()\n\nval tsubst_comp : s1:tsub -> s2:tsub -> t:typ -> Lemma\n (ensures (tsubst s1 (tsubst s2 t) = tsubst (tsub_comp s1 s2) t))\n (decreases %[is_tvar t;\n is_trenaming s1;\n is_trenaming s2;\n t])\nlet rec tsubst_comp s1 s2 t =\n match t with\n | TVar z -> ()\n | TApp t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n | TLam k tbody ->\n let tsub_lam_comp : x:var ->\n Lemma(tsub_lam (tsub_comp s1 s2) x =\n tsub_comp (tsub_lam s1) (tsub_lam s2) x) =\n fun x -> match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n in\n let hoist1 = tsub_lam_hoist k tbody s2 in\n let hoist2 = tsub_lam_hoist k (tsubst (tsub_lam s2) tbody) s1 in\n let h1 =\n tsub_lam_renaming s1;\n tsub_lam_renaming s2;\n tsubst_comp (tsub_lam s1) (tsub_lam s2) tbody in\n\n let h2 =\n forall_intro tsub_lam_comp;\n cut (feq (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))) in\n\n let ext = tsubst_extensional\n (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))\n tbody in\n\n tsub_lam_hoist k tbody (tsub_comp s1 s2)\n\n | TArr t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n\nval tsub_lam_comp : s1:tsub -> s2:tsub -> x:var -> Lemma\n (tsub_lam (tsub_comp s1 s2) x = tsub_comp (tsub_lam s1) (tsub_lam s2) x)\n(* CH: TODO: Quite a bit of duplication here, mutual recursion would\n// have been better than nested one. Can we do that? *)\nlet tsub_lam_comp s1 s2 x =\n match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n\n(* Identity substitution *)\n\nval tsub_id : tsub\nlet tsub_id x = TVar x\n\nval tsubst_id : t:typ -> Lemma (tsubst tsub_id t = t)\nlet rec tsubst_id t =\n let open FStar.Tactics in\n match t with\n | TVar z -> ()\n | TLam k t1 ->\n tsub_lam_hoist k t1 tsub_id;\n assert (feq tsub_id (tsub_lam tsub_id))\n by (norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc]]);\n tsubst_extensional tsub_id (tsub_lam tsub_id) t1;\n tsubst_id t1\n | TArr t1 t2\n | TApp t1 t2 -> tsubst_id t1; tsubst_id t2\n\n(* Beta *)\n\nval tsub_beta_gen : var -> typ -> Tot tsub\nlet tsub_beta_gen x t = fun y -> if y < x then (TVar y)\n else if y = x then t\n else (TVar (y-1))\n\nval tsubst_beta_gen : var -> typ -> typ -> Tot typ\nlet tsubst_beta_gen x t' t = tsubst (tsub_beta_gen x t') t\n\nlet tsubst_beta t' t = tsubst_beta_gen 0 t' t\n\n(* Shifting *)\n\nval tshift_up_above : nat -> typ -> Tot typ\nlet tshift_up_above x = tsubst (tsub_inc_above x)\n\nval tshift_up : typ -> Tot typ\nlet tshift_up = tshift_up_above 0\n\n(* Step relation -- going for strong reduction, just because we can *)\n\ntype step : exp -> exp -> Type =\n | SBeta : t:typ ->\n e1:exp ->\n e2:exp ->\n step (EApp (ELam t e1) e2) (esubst_beta e2 e1)\n | SApp1 : #e1:exp ->\n e2:exp ->\n #e1':exp ->\n $hst:(step e1 e1') ->\n step (EApp e1 e2) (EApp e1' e2)\n | SApp2 : e1:exp ->\n #e2:exp ->\n #e2':exp ->\n $hst:(step e2 e2') ->\n step (EApp e1 e2) (EApp e1 e2')\n\n(* Typing environments *)\n\ntype a_env = nat -> Tot (option knd)\ntype x_env = nat -> Tot (option typ)\n\nval empty_a: a_env\nlet empty_a = fun _ -> None\n\nval empty_x: x_env\nlet empty_x = fun _ -> None\n\nnoeq type env =\n | MkEnv: a:a_env -> x:x_env -> env\n\nval lookup_tvar: env -> nat -> Tot (option knd)\nlet lookup_tvar g n = MkEnv?.a g n\n\nval lookup_evar: env -> nat -> Tot (option typ)\nlet lookup_evar g n = MkEnv?.x g n\n\nval empty: env\nlet empty = MkEnv empty_a empty_x\n\nval extend_tvar: g:env -> n:nat -> k:knd -> Tot env\nlet extend_tvar g n k =\n let a_env = fun (a:nat) -> if a < n then lookup_tvar g a\n else if a = n then Some k\n else lookup_tvar g (a - 1) in\n let x_env = fun (x:nat) -> match lookup_evar g x with\n | None -> None\n | Some t -> Some (tshift_up_above n t)\n in\n MkEnv a_env x_env\n\nval extend_evar: g:env -> n:nat -> t:typ -> Tot env\nlet extend_evar g n t =\n let a_env = fun (a:nat) -> lookup_tvar g a in\n let x_env = fun (x:nat) -> if x < n then lookup_evar g x\n else if x = n then Some t\n else lookup_evar g (x - 1) in\n MkEnv a_env x_env\n\n(* Kinding, type equivalence, and typing rules;\n// first 3 kinding and typing rules are analogous *)\n\nnoeq type kinding : env -> typ -> knd -> Type =\n | KiVar : #g:env ->\n a:var{Some? (lookup_tvar g a)} ->\n kinding g (TVar a) (Some?.v (lookup_tvar g a))\n | KiLam : #g:env ->\n k:knd ->\n #t:typ ->\n #k':knd ->\n $hk:kinding (extend_tvar g 0 k) t k' ->\n kinding g (TLam k t) (KArr k k')\n | KiApp : #g:env ->\n #t1:typ ->\n #t2:typ ->\n #k11:knd ->\n #k12:knd ->\n $hk1:kinding g t1 (KArr k11 k12) ->\n $hk2:kinding g t2 k11 ->\n kinding g (TApp t1 t2) k12\n | KiArr : #g:env ->\n #t1:typ ->\n #t2:typ ->\n $hk1:kinding g t1 KTyp ->\n $hk2:kinding g t2 KTyp ->\n kinding g (TArr t1 t2) KTyp\n\ntype tequiv : typ -> typ -> Type =\n | EqRefl : t:typ ->\n tequiv t t\n | EqSymm : #t1:typ ->\n #t2:typ ->\n $he:tequiv t1 t2 ->\n tequiv t2 t1\n | EqTran : #t1:typ ->\n #t2:typ ->\n #t3:typ ->\n $he12:tequiv t1 t2 ->\n $he23:tequiv t2 t3 ->\n tequiv t1 t3\n | EqLam : #t :typ ->\n #t':typ ->\n k :knd ->\n $he:tequiv t t' ->\n tequiv (TLam k t) (TLam k t')\n | EqApp : #t1 :typ ->\n #t1':typ ->\n #t2 :typ ->\n #t2':typ ->\n $he1:tequiv t1 t1' ->\n $he2:tequiv t2 t2' ->\n tequiv (TApp t1 t2) (TApp t1' t2')\n | EqBeta :k:knd ->\n t1:typ ->\n t2:typ ->\n tequiv (TApp (TLam k t1) t2) (tsubst_beta t2 t1)\n | EqArr : #t1 :typ ->\n #t1':typ ->\n #t2 :typ ->\n #t2':typ ->\n $he1:tequiv t1 t1' ->\n $he2:tequiv t2 t2' ->\n tequiv (TArr t1 t2) (TArr t1' t2')\n\nnoeq type typing : env -> exp -> typ -> Type =\n | TyVar : #g:env ->\n x:var{Some? (lookup_evar g x)} ->\n $hk:kinding g (Some?.v (lookup_evar g x)) KTyp ->\n typing g (EVar x) (Some?.v (lookup_evar g x))\n | TyLam : #g:env ->\n t:typ ->\n #e1:exp ->\n #t':typ ->\n $hk:kinding g t KTyp ->\n $ht:typing (extend_evar g 0 t) e1 t' ->\n typing g (ELam t e1) (TArr t t')\n | TyApp : #g:env ->\n #e1:exp ->\n #e2:exp ->\n #t1:typ ->\n #t2:typ ->\n $ht1:typing g e1 (TArr t1 t2) ->\n $ht2:typing g e2 t1 ->\n typing g (EApp e1 e2) t2\n | TyEqu : #g:env ->\n #e:exp ->\n #t1:typ ->\n #t2:typ ->\n $ht:typing g e t1 ->\n $he:tequiv t1 t2 ->\n $hk:kinding g t2 KTyp ->\n typing g e t2\n\n(* Progress proof *)\n\nval is_value : exp -> Tot bool\nlet is_value = ELam?\n\nirreducible val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (b2t (not (is_value e))))\n (ensures (fun _ -> True)) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n (match e1 with\n | ELam t e1' -> ExIntro (esubst_beta e2 e1') (SBeta t e1' e2)\n | _ -> (match progress h1 with\n | ExIntro e1' h1' -> ExIntro (EApp e1' e2) (SApp1 e2 h1')))\n (* | TyEqu h1 _ _ -> progress h1 -- used to work *)\n (* | TyEqu #g #e #t1 #t2 h1 _ _ -> progress #e #t1 h1\n// -- explicit annotation doesn't help with Pure annotation *)\n | TyEqu h1 _ _ -> progress h1\n\nval tappears_free_in : x:var -> t:typ -> Tot bool (decreases t)\nlet rec tappears_free_in x t =\n match t with\n | TVar y -> x = y\n | TArr t1 t2\n | TApp t1 t2 -> tappears_free_in x t1 || tappears_free_in x t2\n | TLam _ t1 -> tappears_free_in (x+1) t1\n\ntype envEqualT (t:typ) (g1:env) (g2:env) =\n (forall (x:var). tappears_free_in x t ==>\n lookup_tvar g1 x = lookup_tvar g2 x)\n\nirreducible val tcontext_invariance : #t:typ -> #g:env -> #k:knd ->\n h:(kinding g t k) -> g':env{envEqualT t g g'} ->\n Tot (kinding g' t k) (decreases h)\nlet rec tcontext_invariance #t #g #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (tcontext_invariance h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n | KiArr h1 h2 -> KiArr (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n(* CH: this doesn't directly follow from functional extensionality,\n// because (MkEnv?.x g) and (MkEnv?.x g') are completely unrelated;\n// this is just because we pass this useless argument to kinding. *)\nirreducible val kinding_extensional: #g:env -> #t:typ -> #k:knd -> h:(kinding g t k) ->\n g':env{feq (MkEnv?.a g) (MkEnv?.a g')} ->\n Tot (kinding g' t k) (decreases h)\nlet rec kinding_extensional #g #t #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (kinding_extensional h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (kinding_extensional h1 g') (kinding_extensional h2 g')\n | KiArr h1 h2 -> KiArr (kinding_extensional h1 g') (kinding_extensional h2 g')\n\n(* kinding weakening when a term variable binding is added to env *)\nirreducible val kinding_weakening_ebnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> t':typ ->\n Tot (kinding (extend_evar g x t') t k)\nlet kinding_weakening_ebnd #g #t #k h x t' =\n kinding_extensional h (extend_evar g x t')\n\nval tshift_up_above_lam: n:nat -> k:knd -> t:typ -> Lemma\n (ensures (tshift_up_above n (TLam k t) = TLam k (tshift_up_above (n + 1) t)))\nlet tshift_up_above_lam n k t =\n let open FStar.Tactics in\n assert(tshift_up_above n (TLam k t) = tsubst (tsub_inc_above n) (TLam k t));\n tsub_lam_hoist k t (tsub_inc_above n);\n assert(tshift_up_above n (TLam k t) =\n TLam k (tsubst (tsub_lam (tsub_inc_above n)) t));\n assert (feq (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)))\n by norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc_above]];\n tsubst_extensional (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)) t\n\n(* kinding weakening when a type variable binding is added to env *)\nirreducible val kinding_weakening_tbnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> k':knd ->\n Tot (kinding (extend_tvar g x k') (tshift_up_above x t) k) (decreases h)\nlet rec kinding_weakening_tbnd #g #t #k h x k' =\n match h with\n | KiVar a -> if a < x then KiVar a\n else KiVar (a + 1)\n | KiLam #g k'' #t1 #_ h1 ->\n tshift_up_above_lam x k'' t1;\n let h2 = kinding_weakening_tbnd h1 (x + 1) k' in\n KiLam k'' (kinding_extensional h2 (extend_tvar (extend_tvar g x k') 0 k''))\n | KiApp h1 h2 ->\n KiApp (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n | KiArr h1 h2 ->\n KiArr (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n\n(* kinding strengthening from TAPL (Lemma 30.3.1),\n// just an instance of kinding_extensional; used often *)\nirreducible val kinding_strengthening_ebnd :\n g:env -> x:var -> t_x:typ -> #t:typ -> #k:knd ->\n h:(kinding (extend_evar g x t_x) t k) ->\n Tot (kinding g t k) (decreases h)\nlet kinding_strengthening_ebnd g x t_x #t #k h = kinding_extensional h g\n\nirreducible val kinding_inversion_arrow: #g:env -> #t1:typ -> #t2:typ ->\n h:(kinding g (TArr t1 t2) KTyp) ->\n Tot (cand (kinding g t1 KTyp) (kinding g t2 KTyp))", "sketch": [ "The `kinding_inversion_arrow` definition is about extracting information from a kinding derivation for an arrow type `TArr t1 t2`. It aims to determine whether the kinding of `t1` and `t2` is derivable from the kinding of the arrow type.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the input kinding derivation `h` for the arrow type `TArr t1 t2`. It should then construct a proof that the kinding of `t1` and the kinding of `t2` are both derivable from the kinding of the arrow type.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the two types `t1` and `t2` when the kinding of the arrow type `TArr t1 t2` is known.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the input kinding `h` of the arrow type `TArr t1 t2` and then returning the kinding of `t1` and `t2`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the two types `t1` and `t2` when the kinding of the arrow type `TArr t1 t2` is known in the context `g`.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the kinding `h` of the arrow type `TArr t1 t2` in the context `g`. It should then return a proof that either `t1` has kind `KTyp` or `t2` has kind `KTyp`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type that is an arrow type (`TArr`). It aims to determine the kinding of the source type `t1` and the target type `t2` given the kinding of the arrow type `TArr t1 t2`.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the input kinding proof `h` for the arrow type. It should extract the kinding proofs for the source type `t1` and the target type `t2` from the input proof `h`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the two types involved in an arrow type `TArr t1 t2` from the kinding of the arrow type itself.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the kinding proof `h` for the arrow type `TArr t1 t2` and then returning a proof that either `t1` has kind `KTyp` or `t2` has kind `KTyp`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type that is a function type `TArr t1 t2` given the kinding of the function type itself.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the input kinding proof `h` for the function type `TArr t1 t2`. It then returns a proof that either `t1` has kind `KTyp` or `t2` has kind `KTyp`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type of the form `TArr t1 t2` given the kinding of the whole type.\n\nThe implementation will involve pattern matching on the input kinding `h` to extract the kinding of `t1` and `t2` from the kinding of `TArr t1 t2`.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type that is an arrow type (`TArr`). It aims to determine the kinding of the two components `t1` and `t2` given the kinding of the arrow type `TArr t1 t2`.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the input kinding proof `h` for the arrow type. It should then return a proof that the kinding of `t1` and `t2` holds.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type arrow.\n\nThe implementation will involve pattern matching on the input `h` to extract the components of the arrow type and then return the kinding of the individual components.", "The `kinding_inversion_arrow` definition is about inferring the kinding of the components of a type of the form `TArr t1 t2` given the kinding of the whole type.\n\nThe implementation of `kinding_inversion_arrow` involves pattern matching on the kinding `h` of the type `TArr t1 t2` and returning a pair of kindings for `t1` and `t2`." ], "generated_solution": [ "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Invalid kinding derivation for arrow type\"", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Invalid kinding for TArr\"", "val kinding_inversion_arrow: #g:env -> #t1:typ -> #t2:typ ->\n h:(kinding g (TArr t1 t2) KTyp) ->\n Tot (cand (kinding g t1 KTyp) (kinding g t2 KTyp)) =\n match h with\n | KiArr h1 h2 -> ExIntro h1 h2", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Invalid kinding proof for arrow type\"", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> Cand (h1, h2)\n | _ -> failwith \"Invalid kinding proof for arrow type\"", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> Cand h1 h2", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Invalid kinding for TArr type\"", "val kinding_inversion_arrow: #g:env -> #t1:typ -> #t2:typ ->\n h:(kinding g (TArr t1 t2) KTyp) ->\n Tot (cand (kinding g t1 KTyp) (kinding g t2 KTyp)) =\n match h with\n | KiArr h1 h2 -> ExIntro h1 h2", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Expected a kinding of an arrow type\"", "let kinding_inversion_arrow g t1 t2 h =\n match h with\n | KiArr h1 h2 -> (h1, h2)\n | _ -> failwith \"Invalid kinding for TArr\"" ] }, { "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.loc", "opens_and_abbrevs": [ { "open": "FStar.Map" }, { "open": "FStar.List.Tot" }, { "open": "Sec2" }, { "open": "Sec2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let loc = int", "source_range": { "start_line": 4, "start_col": 0, "end_line": 4, "end_col": 13 }, "interleaved": false, "definition": "Prims.int", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.int" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "Prims.eqtype", "prompt": "let loc =\n ", "expected_response": "int", "source": { "project_name": "FStar", "file_name": "examples/layeredeffects/Sec2.IFC.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "Sec2.IFC.fst", "checked_file": "dataset/Sec2.IFC.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Pure.fst.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [], "closest": [ "val Sec2.HIFC.loc = Prims.eqtype\nlet loc = int", "val OPLSS2021.IFC.loc = Prims.eqtype\nlet loc = int", "val Sec1.GST.state = Prims.eqtype\nlet state = int", "val Zeta.Steel.Rel.s_fid = Prims.eqtype\nlet s_fid = U8.t", "val Bug96.mini_t = Prims.eqtype\nlet mini_t = int", "val GMST.state = Prims.eqtype\nlet state = int", "val GEXN.exn = Prims.eqtype\nlet exn = string", "val Zeta.Steel.Rel.value_type = Prims.eqtype\nlet value_type = AT.value_type", "val Zeta.Steel.Rel.s_tid = Prims.eqtype\nlet s_tid = T.thread_id", "val Zeta.Steel.Rel.s_dir = Prims.eqtype\nlet s_dir = bool", "val Model.AEAD.id = Prims.eqtype\nlet id = I.ae_id", "val SelectorsLList2Example.a = Prims.eqtype\nlet a = U32.t", "val Zeta.Steel.Rel.s_epoch = Prims.eqtype\nlet s_epoch = TSM.epoch_id", "val Vale.X64.Lemmas.ocmp = Prims.eqtype\nlet ocmp = BS.ocmp", "val Zeta.Steel.Rel.i_log_entry = Prims.eqtype\nlet i_log_entry = IV.logS_entry i_vcfg", "val Zeta.Steel.Rel.s_slot_id = Prims.eqtype\nlet s_slot_id = T.slot_id", "val NormLHS.test = Prims.eqtype\nlet test = unit_t", "val Vale.PPC64LE.Machine_s.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val SelectorsLList3Example.a = Prims.eqtype\nlet a = U32.t", "val Vale.X64.Machine_s.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val EverParse3d.Interpreter.comments = Prims.eqtype\nlet comments = string", "val Vale.X64.Machine_Semantics_s.ocmp = Prims.eqtype\nlet ocmp = BC.ocmp", "val Hacl.Streaming.Blake2.Common.index = Prims.eqtype\nlet index = unit", "val Sec2.HIFC.unit_triple = (Sec2.HIFC.label * Sec2.HIFC.label) * Prims.list _\nlet unit_triple = bot, bot, []", "val Vale.X64.Decls.quad32 = Prims.eqtype\nlet quad32 = quad32", "val Vale.PPC64LE.Memory.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Zeta.App.app_value = adm: Zeta.App.app_data_model -> Prims.eqtype\nlet app_value (adm: app_data_model) = AppDataModel?.value adm", "val Vale.PPC64LE.Memory.tuint8 = Prims.eqtype\nlet tuint8 = UInt8.t", "val Zeta.App.app_key = adm: Zeta.App.app_data_model -> Prims.eqtype\nlet app_key (adm: app_data_model) = AppDataModel?.key adm", "val Vale.PPC64LE.Memory.tuint16 = Prims.eqtype\nlet tuint16 = UInt16.t", "val Sec2.HIFC.agree_on = reads: Sec2.HIFC.label -> s0: Sec2.HIFC.store -> s1: Sec2.HIFC.store -> Prims.logical\nlet agree_on (reads:label) (s0 s1: store) = forall l. Set.mem l reads ==> sel s0 l == sel s1 l", "val Sec2.HIFC.lref = Type0\nlet lref = ref low", "val Vale.Stdcalls.X64.Fsqr.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Zeta.Steel.LogEntry.Types.slot_id = Prims.eqtype\nlet slot_id = U16.t", "val Vale.Stdcalls.X64.GCM_IV.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint8 = Prims.eqtype\nlet tuint8 = UInt8.t", "val FStar.DM4F.IntST.state = Prims.eqtype\nlet state = int", "val Vale.X64.Memory.quad32 = Prims.eqtype\nlet quad32 = Vale.Def.Types_s.quad32", "val Vale.PPC64LE.Memory.tuint32 = Prims.eqtype\nlet tuint32 = UInt32.t", "val Vale.Inline.X64.Fsqr_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val EverParse3d.Prelude.___Bool = Prims.eqtype\nlet ___Bool = bool", "val Sec2.HIFC.pre = Type\nlet pre = store -> Type0", "val Vale.X64.Memory.tuint16 = Prims.eqtype\nlet tuint16 = UInt16.t", "val Sec2.HIFC.has_flow_1 = from: Sec2.HIFC.loc -> to: Sec2.HIFC.loc -> f: Sec2.HIFC.flow -> Prims.logical\nlet has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f", "val Sec2.HIFC.has_flow = from: Sec2.HIFC.loc -> to: Sec2.HIFC.loc -> fs: Sec2.HIFC.flows -> Prims.logical\nlet has_flow (from to:loc) (fs:flows) = (exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs)", "val Sec2.HIFC.modifies = w: Sec2.HIFC.label -> s0: Sec2.HIFC.store -> s1: Sec2.HIFC.store -> Prims.logical\nlet modifies (w:label) (s0 s1:store) = (forall l.{:pattern (sel s1 l)} ~(Set.mem l w) ==> sel s0 l == sel s1 l)", "val OPLSS2021.IFC.does_not_read_loc = f: OPLSS2021.IFC.comp a -> l: OPLSS2021.IFC.loc -> s0: OPLSS2021.IFC.store -> Prims.logical\nlet does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v", "val MerkleTree.index_t = Prims.eqtype\nlet index_t = MTNL.index_t", "val Vale.Wrapper.X64.GCM_IV.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val OPLSS2021.IFC.no_leakage = f: OPLSS2021.IFC.comp a -> from: OPLSS2021.IFC.loc -> to: OPLSS2021.IFC.loc -> Prims.logical\nlet no_leakage #a (f:comp a) (from to:loc) = forall k. no_leakage_k f from to k", "val Vale.Stdcalls.X64.Poly.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Sec2.HIFC.no_leakage = f: Sec2.HIFC.hst a p q -> from: Sec2.HIFC.loc -> to: Sec2.HIFC.loc -> Prims.logical\nlet no_leakage #a #p #q (f:hst a p q) (from to:loc) = forall k. no_leakage_k f from to k", "val Vale.Stdcalls.X64.GCTR.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint32 = Prims.eqtype\nlet tuint32 = UInt32.t", "val Zeta.Steel.ThreadStateModel.epoch_id = Prims.eqtype\nlet epoch_id = U32.t", "val Vale.X64.Decls.va_operand_opr64 = Prims.eqtype\nlet va_operand_opr64 = operand64", "val Vale.Stdcalls.X64.Fsub.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fswap.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.PPC64LE.Decls.va_value_vec_opr = Prims.eqtype\nlet va_value_vec_opr = quad32", "val Sec2.HIFC.triple = Type0\nlet triple = label & label & flows", "val Zeta.SeqMachine.state_type = sm: Zeta.SeqMachine.seq_machine -> Prims.eqtype\nlet state_type (sm: seq_machine) = \n match sm with \n | SeqMachine #_ #s _ _ _ -> s", "val Zeta.Steel.ApplicationTypes.app_result = fid: Zeta.App.appfn_id Zeta.Steel.ApplicationTypes.aprm -> Prims.eqtype\nlet app_result (fid:A.appfn_id aprm) =\r\n let fsig = Map.sel aprm.A.tbl fid in\r\n A.interp_code aprm.A.adm fsig.fres_t", "val Zeta.Steel.Parser.byte = Prims.eqtype\nlet byte = U8.t", "val Sec2.HIFC.label = Type0\nlet label = Set.set loc", "val MiTLS.Parsers.ECPointFormat.eCPointFormat_repr = Prims.eqtype\nlet eCPointFormat_repr = U8.t", "val OPLSS2021.IFC.unit_triple = (OPLSS2021.IFC.label * OPLSS2021.IFC.label) * Prims.list _\nlet unit_triple = bot, bot, []", "val Vale.X64.Decls.va_operand_dst_opr64 = Prims.eqtype\nlet va_operand_dst_opr64 = operand64", "val Sec2.HIFC.respects = f: Sec2.HIFC.hst a p q -> fs: Sec2.HIFC.flows -> Prims.logical\nlet respects #a #p #q (f:hst a p q) (fs:flows) =\n (forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to)", "val IfcMonitorTest.test2 = Prims.unit\nlet test2 = assert_norm (Some? (interpret_com h0 p2 env Low))", "val Hacl.Blake2b_32.size_t = Prims.eqtype\nlet size_t = U32.t", "val Vale.Wrapper.X64.GCTR.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Stdcalls.X64.Fmul.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Inline.X64.Fswap_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Decls.va_operand_opr128 = Prims.eqtype\nlet va_operand_opr128 = operand128", "val Vale.PPC64LE.Memory.tuint64 = Prims.eqtype\nlet tuint64 = UInt64.t", "val Zeta.Steel.ApplicationTypes.app_args = fid: Zeta.App.appfn_id Zeta.Steel.ApplicationTypes.aprm -> Prims.eqtype\nlet app_args (fid:A.appfn_id aprm) =\r\n let fsig = Map.sel aprm.A.tbl fid in\r\n A.interp_code aprm.A.adm fsig.farg_t", "val OPLSS2021.MemCpy.Deps.uint8 = Prims.eqtype\nlet uint8 = U8.t", "val OPLSS2021.IFC.has_flow = from: OPLSS2021.IFC.loc -> to: OPLSS2021.IFC.loc -> fs: OPLSS2021.IFC.flows -> Prims.logical\nlet has_flow (from to:loc) (fs:flows) = exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs", "val id : eqtype\nlet id = i:nat{i < store_size}", "val OPLSS2021.MemCpy.Deps.uint32 = Prims.eqtype\nlet uint32 = U32.t", "val Vale.Stdcalls.X64.Aes.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Inline.X64.Fadd_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Memory.tuint64 = Prims.eqtype\nlet tuint64 = UInt64.t", "val Vale.Wrapper.X64.Poly.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val IfcMonitorTest.test3 = Prims.unit\nlet test3 = assert_norm (None? (interpret_com h0 p3 env Low))", "val OPLSS2021.IFC.has_flow_1 = from: OPLSS2021.IFC.loc -> to: OPLSS2021.IFC.loc -> f: OPLSS2021.IFC.flow -> Prims.logical\nlet has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f", "val Model.AEAD.plain = u153: Model.AEAD.info i -> l: Model.AEAD.at_least u153 -> Prims.eqtype\nlet plain (#i:id) (u:info i) (l: at_least u) =\n u.plain_pkg.plain i l", "val IfcMonitorTest.test4 = Prims.unit\nlet test4 = assert_norm (Some? (interpret_com h0 p4 env Low))", "val MiTLS.FStar.Old.Endianness.u8 = Prims.eqtype\nlet u8 = UInt8.t", "val Sec2.HIFC.no_leakage_k = f: Sec2.HIFC.hst a p q -> from: Sec2.HIFC.loc -> to: Sec2.HIFC.loc -> k: Prims.int -> Prims.logical\nlet no_leakage_k #a #p #q (f:hst a p q) (from to:loc) (k:int) =\n forall (s0:store{p s0}).{:pattern (upd s0 from k)}\n p (upd s0 from k) ==>\n sel (snd (f s0)) to == (sel (snd (f (upd s0 from k))) to)", "val IfcMonitorTest.test1 = Prims.unit\nlet test1 = \n assert (None? (interpret_com h0 p1 env Low))", "val ASN1.Low.Base.size_t = Prims.eqtype\nlet size_t = U32.t", "val Vale.Inline.X64.Fmul_inline.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.Poly1305.Equiv.prime = Prims.pos\nlet prime = S.prime", "val IfcMonitorTest.test5 = Prims.unit\nlet test5 = assert_norm (None? (interpret_com h0 p5 env Low))", "val Sec2.HIFC.ref = l: Sec2.HIFC.label -> Type0\nlet ref (l:label) = r:loc {r `Set.mem` l}", "val Vale.Stdcalls.X64.Fadd.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Vale.X64.Decls.va_value_xmm = Prims.eqtype\nlet va_value_xmm = quad32", "val Vale.Stdcalls.X64.GCMencryptOpt.uint64 = Prims.eqtype\nlet uint64 = UInt64.t", "val Sec2.HIFC.label_inclusion = l0: Sec2.HIFC.label -> l1: Sec2.HIFC.label -> Prims.logical\nlet label_inclusion (l0 l1:label) = Set.subset l0 l1" ], "closest_src": [ { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.loc" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.loc" }, { "project_name": "FStar", "file_name": "Sec1.GST.fst", "name": "Sec1.GST.state" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_fid" }, { "project_name": "steel", "file_name": "Bug96.fst", "name": "Bug96.mini_t" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.state" }, { "project_name": "FStar", "file_name": "GEXN.fst", "name": "GEXN.exn" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.value_type" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_tid" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_dir" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.id" }, { "project_name": "steel", "file_name": "SelectorsLList2Example.fst", "name": "SelectorsLList2Example.a" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_epoch" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Lemmas.fsti", "name": "Vale.X64.Lemmas.ocmp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_log_entry" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_slot_id" }, { "project_name": "FStar", "file_name": "NormLHS.fst", "name": "NormLHS.test" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Machine_s.fst", "name": "Vale.PPC64LE.Machine_s.quad32" }, { "project_name": "steel", "file_name": "SelectorsLList3Example.fst", "name": "SelectorsLList3Example.a" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_s.fst", "name": "Vale.X64.Machine_s.quad32" }, { "project_name": "everparse", "file_name": "EverParse3d.Interpreter.fst", "name": "EverParse3d.Interpreter.comments" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.ocmp" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.index" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.unit_triple" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fsti", "name": "Vale.PPC64LE.Memory.quad32" }, { "project_name": "zeta", "file_name": "Zeta.App.fsti", "name": "Zeta.App.app_value" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint8" }, { "project_name": "zeta", "file_name": "Zeta.App.fsti", "name": "Zeta.App.app_key" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint16" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.agree_on" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.lref" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.uint64" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Types.fst", "name": "Zeta.Steel.LogEntry.Types.slot_id" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCM_IV.fst", "name": "Vale.Stdcalls.X64.GCM_IV.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint8" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.state" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fsti", "name": "Vale.X64.Memory.quad32" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint32" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.uint64" }, { "project_name": "everparse", "file_name": "EverParse3d.Prelude.fsti", "name": "EverParse3d.Prelude.___Bool" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.pre" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint16" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.has_flow_1" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.has_flow" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.modifies" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.does_not_read_loc" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.index_t" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCM_IV.fsti", "name": "Vale.Wrapper.X64.GCM_IV.uint64" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.no_leakage" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.uint64" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.no_leakage" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint32" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.epoch_id" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_opr64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fswap.fsti", "name": "Vale.Stdcalls.X64.Fswap.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_value_vec_opr" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.triple" }, { "project_name": "zeta", "file_name": "Zeta.SeqMachine.fsti", "name": "Zeta.SeqMachine.state_type" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ApplicationTypes.fsti", "name": "Zeta.Steel.ApplicationTypes.app_result" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Parser.fst", "name": "Zeta.Steel.Parser.byte" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.label" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Parsers.ECPointFormat.fsti", "name": "MiTLS.Parsers.ECPointFormat.eCPointFormat_repr" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.unit_triple" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_dst_opr64" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.respects" }, { "project_name": "FStar", "file_name": "IfcMonitorTest.fst", "name": "IfcMonitorTest.test2" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_32.fsti", "name": "Hacl.Blake2b_32.size_t" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.GCTR.fsti", "name": "Vale.Wrapper.X64.GCTR.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_operand_opr128" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.tuint64" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ApplicationTypes.fsti", "name": "Zeta.Steel.ApplicationTypes.app_args" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.uint8" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.has_flow" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.IntStoreFixed.fst", "name": "FStar.DM4F.Heap.IntStoreFixed.id" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.uint32" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Aes.fsti", "name": "Vale.Stdcalls.X64.Aes.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.tuint64" }, { "project_name": "hacl-star", "file_name": "Vale.Wrapper.X64.Poly.fsti", "name": "Vale.Wrapper.X64.Poly.uint64" }, { "project_name": "FStar", "file_name": "IfcMonitorTest.fst", "name": "IfcMonitorTest.test3" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.has_flow_1" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.plain" }, { "project_name": "FStar", "file_name": "IfcMonitorTest.fst", "name": "IfcMonitorTest.test4" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FStar.Old.Endianness.fst", "name": "MiTLS.FStar.Old.Endianness.u8" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.no_leakage_k" }, { "project_name": "FStar", "file_name": "IfcMonitorTest.fst", "name": "IfcMonitorTest.test1" }, { "project_name": "dice-star", "file_name": "ASN1.Low.Base.fst", "name": "ASN1.Low.Base.size_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.Equiv.fst", "name": "Vale.Poly1305.Equiv.prime" }, { "project_name": "FStar", "file_name": "IfcMonitorTest.fst", "name": "IfcMonitorTest.test5" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.ref" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.uint64" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_value_xmm" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMencryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMencryptOpt.uint64" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.label_inclusion" } ], "selected_premises": [ "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Monotonic.Pure.is_monotonic", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.all_post_h", "FStar.Preorder.preorder_rel", "FStar.Pervasives.id", "FStar.Pervasives.div_hoare_to_wp", "FStar.Monotonic.Pure.elim_pure", "FStar.Pervasives.ex_pre", "Prims.pure_wp'", "FStar.Pervasives.all_pre_h", "Prims.pure_trivial", "Prims.pure_post'", "Prims.pure_wp_monotonic0", "Prims.purewp_id", "Prims.pure_post", "FStar.Calc.calc_chain_related", "FStar.Pervasives.pure_ite_wp", "Prims.as_requires", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.all_wp_h", "FStar.Monotonic.Pure.as_pure_wp", "Prims.pure_stronger", "FStar.Pervasives.trivial_pure_post", "FStar.Set.as_set", "Prims.as_ensures", "FStar.Pervasives.all_trivial", "Prims.pure_wp_monotonic", "Prims.min", "FStar.Pervasives.all_close_wp", "FStar.Preorder.transitive", "FStar.Map.disjoint_dom", "FStar.Pervasives.pure_null_wp", "FStar.Set.subset", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.all_return", "FStar.Pervasives.ex_post'", "Prims.abs", "FStar.Set.as_set'", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.ex_post", "Prims.l_True", "FStar.Pervasives.lift_div_exn", "FStar.Preorder.reflexive", "FStar.Pervasives.ex_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.all_stronger", "FStar.Map.const_on", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.ex_stronger", "Prims.pure_pre", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.st_post_h", "FStar.Pervasives.ex_return", "Prims.pure_wp", "Prims.auto_squash", "FStar.Pervasives.ex_trivial", "Prims.l_False", "FStar.Map.has_dom", "FStar.Pervasives.ex_ite_wp", "FStar.Set.remove", "FStar.Preorder.stable", "FStar.Set.add", "FStar.Pervasives.ex_if_then_else", "FStar.Set.disjoint", "FStar.Pervasives.st_if_then_else", "Prims.subtype_of", "Prims.returnM", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.pure_return", "Prims.__cache_version_number__", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.st_post_h'", "FStar.Calc.calc_chain_compatible", "FStar.Pervasives.st_trivial", "Prims.pow2", "FStar.Pervasives.st_return", "FStar.Pervasives.st_wp_h", "Prims.op_Hat" ], "source_upto_this": "module Sec2.IFC\nopen FStar.List.Tot\nopen FStar.Map", "sketch": [ "The definition is about specifying a type for representing locations.\n\nStep 1: We will define a type `loc` to represent locations.\n\nStep 2: The `loc` type will be implemented as a primitive equality type in F*.", "The definition of `loc` is about specifying a type for representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition of `loc` is about specifying a type for representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition is about specifying a type for representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition of `loc` is about specifying a type for locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition is about declaring a type for representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition is about the type representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive type in F*.", "The definition is about the type representing locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\n\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition of `loc` is about specifying a type for locations in the program.\n\nStep 1: We define a type `loc` to represent locations in the program.\nStep 2: The `loc` type is implemented as a primitive equality type in F*.", "The definition of `loc` is a value of type `Prims.eqtype` representing a location in the program.\n\nStep 1: The `loc` value represents a location in the program.\nStep 2: The `loc` value is implemented as a value of type `Prims.eqtype`." ], "generated_solution": [ "val loc : Prims.eqtype", "val loc : Prims.eqtype", "val loc : Prims.eqtype", "val loc : Prims.eqtype", "val loc : Prims.eqtype", "type loc = Prims.eqtype", "val loc : Prims.eqtype", "type loc = Prims.eqtype", "val loc : Prims.eqtype", "val loc : Prims.eqtype" ] }, { "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.value_vprops_seq", "opens_and_abbrevs": [ { "abbrev": "SeqPerm", "full_module": "FStar.Seq.Permutation" }, { "abbrev": "CE", "full_module": "FStar.Algebra.CommMonoid.Equiv" }, { "abbrev": "A", "full_module": "Steel.ST.Array" }, { "abbrev": "R", "full_module": "Steel.ST.Reference" }, { "abbrev": "US", "full_module": "FStar.SizeT" }, { "abbrev": "Map", "full_module": "FStar.PartialMap" }, { "abbrev": "Seq", "full_module": "FStar.Seq" }, { "abbrev": "G", "full_module": "FStar.Ghost" }, { "open": "Steel.ST.Util" }, { "open": "Steel.ST.Effect" }, { "open": "Steel.ST.Effect.Atomic" }, { "open": "Steel.ST.Effect.Ghost" }, { "open": "Steel.Memory" }, { "open": "Steel.FractionalPermission" }, { "abbrev": "US", "full_module": "FStar.SizeT" }, { "abbrev": "Map", "full_module": "FStar.PartialMap" }, { "abbrev": "G", "full_module": "FStar.Ghost" }, { "open": "Steel.ST.Util" }, { "open": "Steel.ST.Effect" }, { "open": "Steel.ST.Effect.Atomic" }, { "open": "Steel.ST.Effect.Ghost" }, { "open": "Steel.Memory" }, { "open": "Steel.ST" }, { "open": "Steel.ST" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val value_vprops_seq\n (#k: eqtype)\n (#v: Type0)\n (#contents: Type)\n (vp: vp_t k v contents)\n (s: Seq.seq (option (k & v)))\n (m: repr k contents)\n (borrows: Map.t k v)\n : Seq.seq vprop", "source_definition": "let value_vprops_seq\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (s:Seq.seq (option (k & v)))\n (m:repr k contents)\n (borrows:Map.t k v)\n : Seq.seq vprop\n = Seq.map_seq (value_vprops_mapping_fn vp m borrows) s", "source_range": { "start_line": 135, "start_col": 0, "end_line": 144, "end_col": 56 }, "interleaved": false, "definition": "fun vp s m borrows ->\n FStar.Seq.Properties.map_seq (Steel.ST.EphemeralHashtbl.value_vprops_mapping_fn vp m borrows) s\n <:\n FStar.Seq.Base.seq Steel.Effect.Common.vprop", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.eqtype", "Steel.ST.EphemeralHashtbl.vp_t", "FStar.Seq.Base.seq", "FStar.Pervasives.Native.option", "FStar.Pervasives.Native.tuple2", "Steel.ST.EphemeralHashtbl.repr", "FStar.PartialMap.t", "FStar.Seq.Properties.map_seq", "Steel.Effect.Common.vprop", "Steel.ST.EphemeralHashtbl.value_vprops_mapping_fn" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n vp: Steel.ST.EphemeralHashtbl.vp_t k v contents ->\n s: FStar.Seq.Base.seq (FStar.Pervasives.Native.option (k * v)) ->\n m: Steel.ST.EphemeralHashtbl.repr k contents ->\n borrows: FStar.PartialMap.t k v\n -> FStar.Seq.Base.seq Steel.Effect.Common.vprop", "prompt": "let value_vprops_seq\n (#k: eqtype)\n (#v: Type0)\n (#contents: Type)\n (vp: vp_t k v contents)\n (s: Seq.seq (option (k & v)))\n (m: repr k contents)\n (borrows: Map.t k v)\n : Seq.seq vprop =\n ", "expected_response": "Seq.map_seq (value_vprops_mapping_fn vp m borrows) s", "source": { "project_name": "steel", "file_name": "lib/steel/Steel.ST.EphemeralHashtbl.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Steel.ST.EphemeralHashtbl.fst", "checked_file": "dataset/Steel.ST.EphemeralHashtbl.fst.checked", "interface_file": true, "dependencies": [ "dataset/Steel.ST.Util.fsti.checked", "dataset/Steel.ST.Reference.fsti.checked", "dataset/Steel.ST.Effect.Ghost.fsti.checked", "dataset/Steel.ST.Effect.Atomic.fsti.checked", "dataset/Steel.ST.Effect.fsti.checked", "dataset/Steel.ST.Array.fsti.checked", "dataset/Steel.Memory.fsti.checked", "dataset/Steel.FractionalPermission.fst.checked", "dataset/Steel.Effect.Common.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.SizeT.fsti.checked", "dataset/FStar.Seq.Permutation.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PartialMap.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked", "dataset/FStar.Algebra.CommMonoid.Equiv.fst.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "tbl", "tbl", "store_len", "store_len", "store", "store", "store_len_pf", "store_len_pf", "let seq_props (#k:eqtype) (#v:Type0) (h:hash_fn k) (s:Seq.seq (option (k & v))) : prop =\n 0 < Seq.length s /\\ US.fits (Seq.length s) /\\\n\n (forall (i:nat{i < Seq.length s}).\n Some? (Seq.index s i) ==> (let Some (x, _) = Seq.index s i in\n US.v (h x) `US.mod_spec` Seq.length s == i))", "us", "hash_fn", "let seq_keys_distinct (#k:eqtype) (#v:Type0) (s:Seq.seq (option (k & v))) : prop =\n forall (i j:(k:nat{k < Seq.length s})).{:pattern Seq.index s i; Seq.index s j}\n (i =!= j /\\ Some? (Seq.index s i) /\\ Some? (Seq.index s j)) ==>\n (fst (Some?.v (Seq.index s i)) =!= fst (Some?.v (Seq.index s j)))", "vp_t", "let seq_props_implies_keys_distinct (#k:eqtype) (#v:Type0) (h:hash_fn k) (s:Seq.seq (option (k & v)))\n : Lemma (requires seq_props h s) (ensures seq_keys_distinct s)\n = ()", "val tbl\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (h:hash_fn k)\n : Type0", "let store_and_repr_related\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (s:Seq.seq (option (k & v)))\n (m:repr k contents)\n : prop\n = forall (i:nat{i < Seq.length s}).\n match Seq.index s i with\n | None -> True\n | Some (k, _) -> Map.contains m k", "repr", "let store_and_borrows_related\n (#k:eqtype)\n (#v:Type0)\n (s:Seq.seq (option (k & v)))\n (borrows:Map.t k v)\n : prop\n = forall (i:nat{i < Seq.length s}).\n match Seq.index s i with\n | None -> True\n | Some (k, x) ->\n Map.sel borrows k == None \\/\n Map.sel borrows k == Some x", "val tperm\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (#vp:vp_t k v contents)\n (#h:hash_fn k)\n (t:tbl vp h)\n (m:repr k contents)\n (borrows:Map.t k v)\n : vprop", "val create\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (h:hash_fn k)\n (n:us{US.v n > 0})\n : STT (tbl vp h)\n emp\n (fun a -> tperm a (Map.empty k contents) (Map.empty k v))", "let vprop_monoid : CE.cm vprop Steel.Effect.Common.req = Steel.Effect.Common.rm", "let value_vprops_mapping_fn\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (m:repr k contents)\n (borrows:Map.t k v)\n : option (k & v) -> vprop\n = fun e ->\n match e with\n | None -> emp\n | Some (i, x) ->\n (match Map.sel m i, Map.sel borrows i with\n | None, _ -> pure False\n | _, Some _ -> emp\n | Some c, None -> vp i x c)" ], "closest": [ "val exploded_vp\n (#k: eqtype)\n (#v: Type0)\n (r: ref (ht_t k v))\n (ht: ht_t k v)\n (r_sz: ref pos_us)\n (r_hashf: ref (k -> SZ.t))\n (r_contents: ref (V.vec (cell k v)))\n : vprop\nlet exploded_vp (#k:eqtype) (#v:Type0)\n (r:ref (ht_t k v))\n (ht:ht_t k v)\n (r_sz:ref pos_us)\n (r_hashf:ref (k -> SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop = \n pts_to r_sz ht.sz **\n pts_to r_hashf ht.hashf **\n pts_to r_contents ht.contents **\n token r r_sz r_hashf r_contents", "val perm (#v:Type)\r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (t:tbl vp)\r\n (default_value: c)\r\n ([@@@smt_fallback] m:repr c)\r\n ([@@@smt_fallback] b:borrows v)\r\n : vprop\nlet perm #v #c #cp t default_value m b =\r\n ETbl.tperm t.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred default_value m b t.high)", "val token (#k:eqtype) (#v:Type0)\n (r:ref (ht_t k v))\n (r_sz:ref pos_us)\n (r_hashf:ref (k -> SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop\nlet token (#k:eqtype) (#v:Type0)\n (r:ref (ht_t k v))\n (r_sz:ref pos_us)\n (r_hashf:ref (k -> SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop =\n exists* ht. pts_to r ht", "val seq_seq_match_item\n (#t1 #t2: Type)\n (p: (t1 -> t2 -> vprop))\n (c: Seq.seq t1)\n (l: Seq.seq t2)\n (i: nat)\n : Tot vprop\nlet seq_seq_match_item\n (#t1 #t2: Type)\n (p: t1 -> t2 -> vprop)\n (c: Seq.seq t1)\n (l: Seq.seq t2)\n (i: nat)\n: Tot vprop\n= if i < Seq.length c && i < Seq.length l\n then\n p (Seq.index c i) (Seq.index l i)\n else\n pure (squash False)", "val seq_seq_match\n (#t1 #t2: Type)\n (p: (t1 -> t2 -> vprop))\n (c: Seq.seq t1)\n (l: Seq.seq t2)\n (i j: nat)\n : Tot vprop\nlet seq_seq_match\n (#t1 #t2: Type)\n (p: t1 -> t2 -> vprop)\n (c: Seq.seq t1)\n (l: Seq.seq t2)\n (i j: nat)\n: Tot vprop\n= on_range (seq_seq_match_item p c l) i j", "val seq_list_match_cons0\n (#t #t': Type)\n (c: Seq.seq t)\n (l: list t' {Cons? l})\n (item_match: (t -> v': t'{v' << l} -> vprop))\n (seq_list_match:\n (\n Seq.seq t ->\n v': list t' ->\n raw_data_item_match: (t -> v'': t'{v'' << v'} -> vprop){v' << l}\n -> vprop))\n : Tot vprop\nlet seq_list_match_cons0\n (#t #t': Type)\n (c: Seq.seq t)\n (l: list t' { Cons? l })\n (item_match: (t -> (v': t' { v' << l }) -> vprop))\n (seq_list_match: (Seq.seq t -> (v': list t') -> (raw_data_item_match: (t -> (v'': t' { v'' << v' }) -> vprop) { v' << l }) ->\nvprop))\n: Tot vprop\n= exists_ (fun (c1: t) -> exists_ (fun (c2: Seq.seq t) ->\n item_match c1 (List.Tot.hd l) `star`\n seq_list_match c2 (List.Tot.tl l) item_match `star`\n pure (c `Seq.equal` Seq.cons c1 c2)\n ))", "val get_post:\n #k: eqtype ->\n #v: Type0 ->\n #contents: Type ->\n #vp: vp_t k v contents ->\n #h: hash_fn k ->\n m: G.erased (repr k contents) ->\n borrows: G.erased (Map.t k v) ->\n a: tbl vp h ->\n i: k ->\n get_result k v\n -> vprop\nlet get_post\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (#vp:vp_t k v contents)\n (#h:hash_fn k)\n (m:G.erased (repr k contents))\n (borrows:G.erased (Map.t k v))\n (a:tbl vp h)\n (i:k)\n : get_result k v -> vprop\n = fun r ->\n match r, Map.sel m i with\n | Present x, Some c ->\n tperm a m (Map.upd borrows i x) //when `get` succeeds, the key is added to `borrows`\n `star`\n vp i x c //in addition, we return the vp permission for the key\n\n | Present x, None -> pure False //It can never be the case that the key is present in the table,\n //but is not mapped in the representation map\n | Missing j, _ ->\n tperm a m borrows\n `star`\n pure (map_contains_prop j m)\n\n | _ -> tperm a m borrows", "val ( exists* ) (#a:Type) (p:a -> vprop) : vprop\nlet op_exists_Star = op_exists_Star", "val put (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n (x:v)\r\n (content:Ghost.erased c)\r\n : STT unit\r\n (perm a init m b `star` vp i x content)\r\n (fun _ -> perm a init (Map.upd m i content) (PartialMap.remove b i))\nlet put #v #c #vp #init #m #b a i x content =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n ETbl.put a.etbl i x content;\r\n assert (PartialMap.equal (PartialMap.upd (repr_to_eht_repr m) i content)\r\n (repr_to_eht_repr (Map.upd m i content)));\r\n rewrite (ETbl.tperm _ _ _)\r\n (ETbl.tperm a.etbl\r\n (repr_to_eht_repr (Map.upd m i content))\r\n (PartialMap.remove b i));\r\n let high = R.read a.high in\r\n let r = above_high_water_mark high i in\r\n if r\r\n then begin\r\n R.write a.high (Some i);\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n (Some i));\r\n intro_exists (Some i) (high_epoch_id_pred (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n a.high)\r\n end\r\n else begin\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n w);\r\n intro_exists (G.reveal w) (high_epoch_id_pred (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n a.high)\r\n end", "val wvalid\n (#t: Type)\n (#k: parser_kind)\n (p: parser k t)\n (#rrel #rel: _)\n (s: slice rrel rel)\n (compl: compl_t t)\n (pos: U32.t)\n (gpos': Ghost.erased U32.t)\n (gv: Ghost.erased t)\n (x: Seq.seq byte)\n : GTot prop\nlet wvalid \n (#t: Type) (#k: parser_kind) (p: parser k t) (#rrel #rel: _) (s: slice rrel rel)\n (compl: compl_t t)\n (pos: U32.t)\n (gpos' : Ghost.erased U32.t)\n (gv: Ghost.erased t)\n (x: Seq.seq byte)\n: GTot prop\n= \n U32.v pos <= U32.v (Ghost.reveal gpos') /\\\n U32.v (Ghost.reveal gpos') <= U32.v s.len /\\\n U32.v s.len <= Seq.length x /\\\n parse p (Seq.slice x (U32.v pos) (U32.v s.len)) == Some (Ghost.reveal gv, U32.v (Ghost.reveal gpos') - U32.v pos) /\\\n compl pos (Ghost.reveal gv) (Ghost.reveal gpos') x", "val seq_list_match\n (#t #t': Type)\n (c: Seq.seq t)\n (v: list t')\n (item_match: (t -> v': t'{v' << v} -> vprop))\n : Tot vprop (decreases v)\nlet rec seq_list_match\n (#t #t': Type)\n (c: Seq.seq t)\n (v: list t')\n (item_match: (t -> (v': t' { v' << v }) -> vprop))\n: Tot vprop\n (decreases v)\n= if Nil? v\n then seq_list_match_nil0 c\n else seq_list_match_cons0 c v item_match seq_list_match", "val vprop : Type u#2\nlet vprop = slprop", "val equal (#k:eqtype) (#v:Type) (m1 m2:t k v) : prop\nlet equal m1 m2 = feq m1 m2 /\\ True", "val get (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : ST (get_result v)\r\n (perm a init m b)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\nlet get #v #c #vp #init #m #b a i =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n let high_value = R.read a.high in\r\n let r = above_high_water_mark high_value i in\r\n if r returns ST _\r\n _\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\r\n\r\n then begin\r\n let ret = Fresh in\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n end\r\n else begin\r\n let x = ETbl.get a.etbl i in\r\n match x returns ST _\r\n (ETbl.get_post (repr_to_eht_repr m) b a.etbl i x\r\n `star`\r\n R.pts_to a.high Steel.FractionalPermission.full_perm w)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init) with\r\n | ETbl.Missing j ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Missing j))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n pure (ETbl.map_contains_prop j (repr_to_eht_repr m)));\r\n elim_pure (ETbl.map_contains_prop j (repr_to_eht_repr m));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Absent ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i ETbl.Absent)\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b);\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Present x ->\r\n let ret = Found x in\r\n assert (Some? (PartialMap.sel (repr_to_eht_repr m) i));\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Present x))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m (PartialMap.upd b i x) w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m (PartialMap.upd b i x) a.high);\r\n rewrite (perm a init m (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i))\r\n (get_post init m b a i ret);\r\n return ret\r\n end", "val mk_selector_vprop_hp\n (#t: Type0) (p: t -> vprop)\n: Tot (slprop u#1)\nlet mk_selector_vprop_hp\n p\n= Steel.Memory.h_exists (hp_of_pointwise p)", "val pts_to_or_null\n (#t: Type)\n (#[@@@ equate_by_smt]td: typedef t)\n (p: ptr td)\n ([@@@ equate_by_smt]v: Ghost.erased t)\n : vprop\nlet pts_to_or_null\n (#t: Type) (#[@@@equate_by_smt]td: typedef t) (p: ptr td) ([@@@equate_by_smt] v: Ghost.erased t) : vprop\n= if FStar.StrongExcludedMiddle.strong_excluded_middle (p == null _)\n then emp\n else pts_to p v", "val seq_list_match_cons_eq\n (#t #t': Type)\n (c: Seq.seq t)\n (v: list t')\n (item_match: (t -> v': t'{v' << v} -> vprop))\n : Lemma (requires (Cons? v))\n (ensures (seq_list_match c v item_match == seq_list_match_cons0 c v item_match seq_list_match)\n )\nlet seq_list_match_cons_eq\n (#t #t': Type)\n (c: Seq.seq t)\n (v: list t')\n (item_match: (t -> (v': t' { v' << v }) -> vprop))\n: Lemma\n (requires (Cons? v))\n (ensures (\n seq_list_match c v item_match ==\n seq_list_match_cons0 c v item_match seq_list_match\n ))\n= let a :: q = v in\n assert_norm (seq_list_match c (a :: q) item_match ==\n seq_list_match_cons0 c (a :: q) item_match seq_list_match\n )", "val high_epoch_id_prop\n (#v #c: Type0)\n (default_value: c)\n (m: repr c)\n (b: borrows v)\n (e: high_water_mark)\n : prop\nlet high_epoch_id_prop\r\n (#v #c:Type0)\r\n (default_value:c)\r\n (m:repr c)\r\n (b:borrows v)\r\n (e:high_water_mark)\r\n : prop\r\n = (forall (e':M.epoch_id). above_high_water_mark e e' ==> Map.sel m e' == default_value) /\\\r\n (forall (e':M.epoch_id). PartialMap.contains b e' ==> not(above_high_water_mark e e'))", "val create (#v:Type)\r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (n:U32.t{U32.v n > 0})\r\n (init:G.erased c)\r\n : STT (tbl #v #c vp)\r\n emp\r\n (fun a -> perm a init (Map.const #M.epoch_id #c init) empty_borrows)\nlet create #v #c #vp n init =\r\n let etbl = ETbl.create_v vp hash (SizeT.uint32_to_sizet n) init in\r\n let high = R.alloc None in\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.const (G.reveal init))\r\n (empty_borrows #v)\r\n None);\r\n let r = { etbl = etbl; high = high } in\r\n assert (PartialMap.equal (PartialMap.const M.epoch_id (G.reveal init))\r\n (repr_to_eht_repr (Map.const #M.epoch_id #c init)));\r\n rewrite (ETbl.tperm _ _ _)\r\n (ETbl.tperm r.etbl\r\n (repr_to_eht_repr (Map.const (G.reveal init)))\r\n empty_borrows);\r\n rewrite (R.pts_to _ _ _ `star` pure _)\r\n (high_epoch_id_pred (G.reveal init)\r\n (Map.const (G.reveal init))\r\n empty_borrows\r\n r.high\r\n None);\r\n intro_exists None (high_epoch_id_pred _ _ _ _);\r\n return r", "val finalize (#v:Type)\r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (t:tbl vp)\r\n : STT unit\r\n (perm t init m b)\r\n (fun _ -> emp)\nlet finalize #v #c #vp #init #m #b t =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n ETbl.free t.etbl;\r\n R.free t.high", "val ( ** ) (p q:vprop) : vprop\nlet op_Star_Star = op_Star_Star", "val array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n : Tot vprop\nlet array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop\n= if g_array_is_null r\n then emp\n else array_pts_to r v", "val array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n : Tot vprop\nlet array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop\n= if g_array_is_null r\n then emp\n else array_pts_to r v", "val equal (#k:eqtype) (#v:Type) (#f:cmp k) (m1:ordmap k v f) (m2:ordmap k v f) : prop\nlet equal (#k:eqtype) (#v:Type) (#f:cmp k) (m1:ordmap k v f) (m2:ordmap k v f) =\n forall x. select #k #v #f x m1 == select #k #v #f x m2", "val map_contains_prop (#k: eqtype) (#v: Type0) (x: k) (m: Map.t k v) : prop\nlet map_contains_prop (#k:eqtype) (#v:Type0) (x:k) (m:Map.t k v) : prop =\n Map.contains m x == true", "val vprop_list_equiv (g:env) (vp:term)\n : GTot (vprop_equiv g vp (canon_vprop vp))\nlet rec vprop_list_equiv (g:env)\n (vp:term)\n : GTot (vprop_equiv g vp (canon_vprop vp))\n (decreases vp)\n = match vp.t with\n | Tm_Emp -> VE_Refl _ _\n | Tm_Star vp0 vp1 ->\n let eq0 = vprop_list_equiv g vp0 in\n let eq1 = vprop_list_equiv g vp1 in \n let app_eq\n : vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1))\n = list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)\n in\n let step\n : vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1))\n = VE_Ctxt _ _ _ _ _ eq0 eq1\n in\n VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)\n \n | _ -> \n VE_Refl _ _", "val pure (p:prop) : vprop\nlet pure = pure", "val full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop\nlet full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop =\n forall (i: nat { i < Seq.length v }) . {:pattern (Seq.index v i)} full td (Seq.index v i)", "val full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop\nlet full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop =\n forall (i: nat { i < Seq.length v }) . {:pattern (Seq.index v i)} full td (Seq.index v i)", "val in_state_slprop (p: prot) (vsend: chan_val) : vprop\nlet in_state_slprop (p:prot) (vsend:chan_val) : vprop = pure (in_state_prop p vsend)", "val equiv (p q:vprop) : prop\nlet equiv (p q:vprop) : prop = Mem.equiv (hp_of p) (hp_of q) /\\ True", "val inv (p:vprop) : Type0\nlet inv (p:vprop) = r:ghost_ref bool & inv (ex_conditional_inv r p)", "val reclaim (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : STT unit\r\n (perm a init m b)\r\n (fun _ -> perm a init m (PartialMap.remove b i))\nlet reclaim #v #c #vp #init #m #b a i =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n let _ = ETbl.remove a.etbl i in\r\n intro_pure (high_epoch_id_prop (G.reveal init) m (PartialMap.remove b i) w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m (PartialMap.remove b i) a.high)", "val pts_to (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n ([@@@smt_fallback]f:perm)\n ([@@@smt_fallback]v:a)\n : vprop\nlet pts_to (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n ([@@@smt_fallback]f:perm)\n ([@@@smt_fallback]v:a)\n : vprop\n = MR.pts_to #a #p r f v", "val pts_to (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n ([@@@smt_fallback]f:perm)\n ([@@@smt_fallback]v:a)\n : vprop\nlet pts_to (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n ([@@@smt_fallback]f:perm)\n ([@@@smt_fallback]v:a)\n : vprop\n = MR.pts_to #a #p r f v", "val seq_list_match_nil0 (#t: Type) (c: Seq.seq t) : Tot vprop\nlet seq_list_match_nil0\n (#t: Type)\n (c: Seq.seq t)\n: Tot vprop\n= pure (c `Seq.equal` Seq.empty)", "val ctx (v: vprop) : vprop\nlet ctx (v:vprop) : vprop = v", "val is_list (#a:Type0) (ll:llist a) (l:list a) : vprop\nlet rec is_list #a ll l : Tot vprop (decreases l) =\n match l with\n | [] -> pure (ll == null)\n | hd::tl ->\n exists_ (fun (node:llist_node a) ->\n pts_to ll full_perm node\n `star`\n pure (node.data == hd)\n `star`\n is_list node.next tl)", "val inv (p:vprop) : Type u#0\nlet inv = Act.inv", "val slprop : Type u#2\nlet slprop = slprop", "val pts_to (#a:Type)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\nlet pts_to r p v = RST.pts_to r.reveal p v", "val pts_to (#a:Type)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\nlet pts_to (#a:Type)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\n = R.pts_to r p v", "val read_enum_key_prop\n (#key #repr: eqtype)\n (e: enum key repr)\n (k: maybe_enum_key e)\n (k': enum_key e)\n : GTot Type0\nlet read_enum_key_prop\n (#key #repr: eqtype)\n (e: enum key repr)\n (k: maybe_enum_key e)\n (k' : enum_key e)\n: GTot Type0\n= match k with Known k_ -> (k_ <: key) == (k' <: key) | _ -> False", "val pts_to (#a:Type0)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\nlet pts_to (#a:Type0)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\n = R.pts_to r p v", "val invlist_v (is: invlist) : vprop\nlet rec invlist_v (is : invlist) : vprop =\n match is with\n | [] -> emp\n | i :: is -> dfst i ** invlist_v is", "val emp : vprop\nlet emp = emp", "val emp : vprop\nlet emp = VUnit emp'", "val pts_to\n (#elt: Type u#1) (a: array elt)\n (p: P.perm)\n ([@@@ smt_fallback ] s: Seq.seq elt)\n: Tot vprop\nlet pts_to (#elt: Type u#1) (a: array elt) ([@@@ smt_fallback ] p: P.perm) ([@@@ smt_fallback ] s: Seq.seq elt) : Tot vprop =\n pts_to0 a p s", "val in_state_prop (p: prot) (vsend: chan_val) : prop\nlet in_state_prop (p:prot) (vsend:chan_val) : prop =\n p == step vsend.chan_prot vsend.chan_msg", "val pts_to (#a:_)\n (r:ref a)\n ([@@@smt_fallback] p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\nlet pts_to (#a:_)\n (r:ref a)\n (p:perm)\n ([@@@smt_fallback] v:a)\n : vprop\n = R.ghost_pts_to r p v", "val pts_to\n (#elt: Type0) (a: array elt)\n (p: P.perm)\n ([@@@ smt_fallback ] s: Seq.seq elt)\n: Tot vprop\nlet pts_to a p s = H.pts_to a p (seq_map raise s)", "val vpure (p: prop) : Tot vprop\nlet vpure (p: prop) : Tot vprop = VUnit (vpure' p)", "val pure (p: prop) : vprop\nlet pure = pure", "val exists_ (#a:Type u#a) (p:a -> vprop) : vprop\nlet exists_ (#a:Type u#a) (p:a -> vprop)\n : vprop\n = SEA.h_exists p", "val sender (#p:prot) (c:chan p) (next_action:prot) : vprop\nlet sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p", "val vprop_equiv_sym (v0 v1:vprop) (_:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\nlet vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p", "val slprop : Type u#(a + 1)\nlet slprop = p:(heap ^-> prop) { heap_prop_is_affine p }", "val slprop : Type u#(a + 1)\nlet slprop = H.slprop", "val slprop : Type u#(a + 1)\nlet slprop = p:(heap ^-> prop) { heap_prop_is_affine p }", "val slprop : Type u#(a + 1)\nlet slprop = H.slprop", "val vprop_as_list (vp: term) : list term\nlet rec vprop_as_list (vp:term)\n : list term\n = match vp.t with\n | Tm_Emp -> []\n | Tm_Star vp0 vp1 -> vprop_as_list vp0 @ vprop_as_list vp1\n | _ -> [vp]", "val avalue_composable (#v: Type) (#p: preorder v) (#anchors: anchor_rel p) (av0 av1: avalue anchors)\n : prop\nlet avalue_composable (#v:Type) (#p:preorder v) (#anchors:anchor_rel p)\n (av0 av1: avalue anchors)\n : prop\n = let (p0, v0) = av0 in\n let (p1, v1) = av1 in\n permission_composable p0 p1 /\\\n (if not (has_some_ownership p0)\n && not (has_some_ownership p1)\n then p_composable _ v0 v1 //neither has ownership, one history is older than the other\n else if not (has_some_ownership p0)\n && has_some_ownership p1\n then (\n if has_nonzero p1\n then v1 `extends` v0 //the one with ownership is more recent\n else ( //this part is the most subtle\n assert (has_anchor p1);\n p_composable _ v0 v1 /\\ \n (v0 `extends` v1 ==> //if v0 is a more recent snapshot than v1\n //then v0 must still be anchored by v1's anchor\n anchor_of p1 `anchors` curval v0)\n )\n )\n else if has_some_ownership p0\n && not (has_some_ownership p1)\n then ( //symmetric\n if has_nonzero p0\n then v0 `extends` v1\n else ( \n assert (has_anchor p0); \n p_composable _ v0 v1 /\\\n (v1 `extends` v0 ==> anchor_of p0 `anchors` curval v1)\n )\n )\n else (\n assert (has_some_ownership p0 && has_some_ownership p1);\n if has_nonzero p0 && has_nonzero p1\n then v0 == v1 //if both have non-zero perm, then they must both only have read permission and must agree on the value\n else if has_nonzero p0 && has_anchor p1\n then ( assert (not (has_nonzero p1));\n //The key part of the anchor semantics:\n v0 `extends` v1 /\\ //v0 has advanceable ownership, so extends\n anchor_of p1 `anchors` curval v0 //but not beyond what is allowed by s\n )\n else if has_anchor p0 && has_nonzero p1 //symmetric\n then ( assert (not (has_nonzero p0));\n v1 `extends` v0 /\\\n anchor_of p0 `anchors` curval v1 //v1 extends, but not beyond what is allowed by s\n )\n else (assert false; False)\n )\n )", "val req:CE.equiv vprop\nlet req : CE.equiv vprop =\n CE.EQ equiv\n equiv_refl\n equiv_sym\n equiv_trans", "val inv (p: vprop) : Type0\nlet inv (p:vprop) : Type0 = Mem.inv (hp_of p)", "val guard_vprop (v: vprop) : Tot vprop\nlet guard_vprop (v: vprop) : Tot vprop = v", "val queue (#a:_) ([@@@smt_fallback] hd:t a)\n ([@@@smt_fallback] tl:t a) : vprop\nlet queue #a hd tl = h_exists #(list a) (queue_l hd tl)", "val k_add_seq\n (#vspec: verifier_spec)\n (#n: _)\n (ep: epoch)\n (gk: key vspec.app)\n (il: verifiable_log vspec n)\n : S.seq (ms_hashfn_dom vspec.app)\nlet k_add_seq (#vspec:verifier_spec) (#n:_) (ep: epoch) (gk: key vspec.app) (il: verifiable_log vspec n)\n : S.seq (ms_hashfn_dom vspec.app)\n = i_seq (k_add_il ep gk il)", "val puts\n (#app: _)\n (vs: vtls_t app {vs.valid})\n (ks: S.seq base_key)\n (ws: S.seq (app_value_nullable app.adm))\n : vs': vtls_t app {vs'.valid}\nlet puts (#app:_)\n (vs: vtls_t app{vs.valid})\n (ks: S.seq base_key)\n (ws: S.seq (app_value_nullable app.adm))\n : vs': vtls_t app{vs'.valid}\n = let st = puts_store vs.st ks ws in\n update_thread_store vs st", "val vprop_equiv_trans (v0 v1 v2:vprop) (_:vprop_equiv v0 v1) (_:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\nlet vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p", "val sel (#k:eqtype) (#v:Type) (m:t k v) (x:k) : option v\nlet sel m x = m x", "val pts_to (#p:dprot) (r:chan p) (v:t p) : vprop\nlet pts_to r v = PR.pts_to r v", "val lockinv_predicate: p: vprop -> r: ref U32.t -> U32.t -> vprop\nlet lockinv_predicate (p:vprop) (r:ref U32.t)\n : U32.t -> vprop\n = fun b ->\n pts_to r full_perm b\n `star`\n pure (b == locked \\/ b == unlocked)\n `star`\n (if is_locked b then emp else p)", "val as_seq (#t: buftype) (#a: Type0) (#len: size_t) (h: HS.mem) (b: lbuffer_t t a len)\n : GTot (Seq.lseq a (v len))\nlet as_seq (#t:buftype) (#a:Type0) (#len:size_t) (h:HS.mem) (b:lbuffer_t t a len) :\n GTot (Seq.lseq a (v len)) =\n match t with\n | MUT -> B.as_seq h (b <: buffer a)\n | IMMUT -> IB.as_seq h (b <: ibuffer a)\n | CONST -> CB.as_seq h (b <: cbuffer a)", "val make_seq9 (#a: Type0) (v0 v1 v2 v3 v4 v5 v6 v7 v8: a) : seq a\nlet make_seq9 (#a:Type0) (v0 v1 v2 v3 v4 v5 v6 v7 v8:a) : seq a =\n init 9 (fun i ->\n if i = 0 then v0 else\n if i = 1 then v1 else\n if i = 2 then v2 else\n if i = 3 then v3 else\n if i = 4 then v4 else\n if i = 5 then v5 else\n if i = 6 then v6 else\n if i = 7 then v7 else\n v8)", "val equal (#key: eqtype) (#value: (key -> Tot Type)) (m1 m2: t key value) : prop\nlet equal (#key: eqtype) (#value: (key -> Tot Type)) (m1 m2: t key value) =\n forall k. sel m1 k == sel m2 k", "val queue_head_dep1\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n : Tot vprop\nlet queue_head_dep1\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n: Tot vprop\n= vptr (cllist_tail x) `vrefine` queue_head_refine x l hd ptl", "val pts_to (#a:Type0) (v:vec a) (#[T.exact (`full_perm)] p:perm) (s:Seq.seq a) : vprop\nlet pts_to v #p s = A.pts_to v #p s", "val cbor_map_get_invariant\n (pmap: perm)\n (vkey vmap: Ghost.erased Cbor.raw_data_item)\n (map: cbor)\n (res: cbor_map_get_t)\n (i: cbor_map_iterator_t)\n (l: list (Cbor.raw_data_item & Cbor.raw_data_item))\n : Tot vprop\nlet cbor_map_get_invariant\n (pmap: perm)\n (vkey: Ghost.erased Cbor.raw_data_item)\n (vmap: Ghost.erased Cbor.raw_data_item)\n (map: cbor)\n (res: cbor_map_get_t)\n (i: cbor_map_iterator_t)\n (l: list (Cbor.raw_data_item & Cbor.raw_data_item))\n: Tot vprop\n= match res with\n | Found value -> cbor_map_get_post_found pmap vkey vmap map value ** pure (\n Cbor.Map? vmap /\\\n Some? (list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap))\n )\n | NotFound ->\n cbor_map_iterator_match pmap i l **\n (cbor_map_iterator_match pmap i l @==> raw_data_item_match pmap map vmap) **\n pure (\n Cbor.Map? vmap /\\\n list_ghost_assoc (Ghost.reveal vkey) (Cbor.Map?.v vmap) ==\n list_ghost_assoc (Ghost.reveal vkey) l\n )", "val list_as_vprop_ctx (g:env) (vp0 vp0' vp1 vp1':list term)\n (_:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))\n (_:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))\n : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))\nlet list_as_vprop_ctx g (vp0 vp0' vp1 vp1':list term)\n (d0:vprop_equiv g (list_as_vprop vp0) (list_as_vprop vp0'))\n (d1:vprop_equiv g (list_as_vprop vp1) (list_as_vprop vp1'))\n : GTot (vprop_equiv g (list_as_vprop (vp0 @ vp1)) (list_as_vprop (vp0' @ vp1')))\n\n = let split_app = list_as_vprop_append _ vp0 vp1 in\n let split_app' = list_as_vprop_append _ vp0' vp1' in\n let ctxt = VE_Ctxt _ _ _ _ _ d0 d1 in\n VE_Trans _ _ _ _ split_app (VE_Trans _ _ _ _ ctxt (VE_Sym _ _ _ split_app'))", "val llist (#a:Type) (ptr:t a) (l:list (cell a)) : vprop\nlet llist = llist'", "val vprop_equiv_typing_bk\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop \n = let _, bk = vprop_equiv_typing d in\n bk ctxt_typing", "val vprop_equiv_typing_bk\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_bk (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g p ctxt)\n : tot_typing g p tm_vprop \n = let _, bk = vprop_equiv_typing d in\n bk ctxt_typing", "val lockinv (p: vprop) (r: ref bool) : vprop\nlet lockinv (p:vprop) (r:ref bool) : vprop =\n h_exists (fun b -> pts_to r full_perm b `star` (if b then emp else p))", "val vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)\n : GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &\n (tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))\nlet rec vprop_equiv_typing (#g:_) (#t0 #t1:term) (v:vprop_equiv g t0 t1)\n : GTot ((tot_typing g t0 tm_vprop -> tot_typing g t1 tm_vprop) &\n (tot_typing g t1 tm_vprop -> tot_typing g t0 tm_vprop))\n (decreases v)\n = match v with\n | VE_Refl _ _ -> (fun x -> x), (fun x -> x)\n\n | VE_Sym _ _ _ v' -> \n let f, g = vprop_equiv_typing v' in\n g, f\n\n | VE_Trans g t0 t2 t1 v02 v21 ->\n let f02, f20 = vprop_equiv_typing v02 in\n let f21, f12 = vprop_equiv_typing v21 in\n (fun x -> f21 (f02 x)), \n (fun x -> f20 (f12 x))\n\n | VE_Ctxt g s0 s1 s0' s1' v0 v1 ->\n let f0, f0' = vprop_equiv_typing v0 in\n let f1, f1' = vprop_equiv_typing v1 in \n let ff (x:tot_typing g (tm_star s0 s1) tm_vprop)\n : tot_typing g (tm_star s0' s1') tm_vprop\n = let s0_typing = star_typing_inversion_l x in\n let s1_typing = star_typing_inversion_r x in\n let s0'_typing, s1'_typing = f0 s0_typing, f1 s1_typing in\n star_typing s0'_typing s1'_typing\n in\n let gg (x:tot_typing g (tm_star s0' s1') tm_vprop)\n : tot_typing g (tm_star s0 s1) tm_vprop\n = let s0'_typing = star_typing_inversion_l x in\n let s1'_typing = star_typing_inversion_r x in\n star_typing (f0' s0'_typing) (f1' s1'_typing) \n in\n ff, gg\n\n | VE_Unit g t ->\n let fwd (x:tot_typing g (tm_star tm_emp t) tm_vprop)\n : tot_typing g t tm_vprop\n = let r = star_typing_inversion_r x in\n r\n in\n let bk (x:tot_typing g t tm_vprop)\n : tot_typing g (tm_star tm_emp t) tm_vprop\n = star_typing emp_typing x\n in\n fwd, bk\n\n | VE_Comm g t0 t1 ->\n let f t0 t1 (x:tot_typing g (tm_star t0 t1) tm_vprop)\n : tot_typing g (tm_star t1 t0) tm_vprop\n = let tt0 = star_typing_inversion_l x in\n let tt1 = star_typing_inversion_r x in\n star_typing tt1 tt0\n in\n f t0 t1, f t1 t0\n\n | VE_Assoc g t0 t1 t2 ->\n let fwd (x:tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop)\n : tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop\n = let tt0 = star_typing_inversion_l x in\n let tt12 = star_typing_inversion_r x in\n let tt1 = star_typing_inversion_l tt12 in\n let tt2 = star_typing_inversion_r tt12 in\n star_typing (star_typing tt0 tt1) tt2\n in\n let bk (x : tot_typing g (tm_star (tm_star t0 t1) t2) tm_vprop)\n : tot_typing g (tm_star t0 (tm_star t1 t2)) tm_vprop\n = let tt01 = star_typing_inversion_l x in\n let tt2 = star_typing_inversion_r x in\n let tt0 = star_typing_inversion_l tt01 in\n let tt1 = star_typing_inversion_r tt01 in\n star_typing tt0 (star_typing tt1 tt2)\n in\n fwd, bk\n \n | VE_Ext g t0 t1 token ->\n let d1, d2 = vprop_eq_typing_inversion g t0 t1 token in\n (fun _ -> d2),\n (fun _ -> d1)\n \n | VE_Fa g x u b t0 t1 d ->\n let d0, d1 = vprop_equiv_typing d in\n (fun fa0_typing ->\n let b_typing, t0_typing = invert_forall_typing fa0_typing x in\n let t1_typing = d0 t0_typing in\n construct_forall_typing #g #u x b_typing t1_typing),\n (fun fa1_typing ->\n let b_typing, t1_typing = invert_forall_typing fa1_typing x in\n let t0_typing = d1 t1_typing in\n construct_forall_typing #g #u #b #t0 x b_typing t0_typing)", "val canon_vprop (vp: term) : term\nlet canon_vprop (vp:term)\n : term\n = list_as_vprop (vprop_as_list vp)", "val emp':vprop'\nlet emp':vprop' =\n { hp = emp;\n t = unit;\n sel = fun _ -> ()}", "val seq_seq_match_item_match_option_upd\n (#opened: _)\n (#t1 #t2: Type)\n (p: (t1 -> t2 -> vprop))\n (s1: Seq.seq t1)\n (s2: Seq.seq (option t2))\n (i j: nat)\n (k: nat{i <= j /\\ j < k})\n (x1: t1)\n (x2: t2)\n : STGhostT (squash (j < Seq.length s1 /\\ j < Seq.length s2))\n opened\n ((seq_seq_match (item_match_option p) s1 s2 i k) `star` (p x1 x2))\n (fun _ -> seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k)\nlet seq_seq_match_item_match_option_upd\n (#opened: _)\n (#t1 #t2: Type)\n (p: t1 -> t2 -> vprop)\n (s1: Seq.seq t1)\n (s2: Seq.seq (option t2))\n (i j: nat)\n (k: nat {\n i <= j /\\ j < k\n })\n (x1: t1)\n (x2: t2)\n: STGhostT (squash (j < Seq.length s1 /\\ j < Seq.length s2)) opened\n (seq_seq_match (item_match_option p) s1 s2 i k `star` p x1 x2)\n (fun _ -> \n seq_seq_match (item_match_option p) (Seq.upd s1 j x1) (Seq.upd s2 j (Some x2)) i k\n )\n= rewrite\n (p x1 x2)\n (item_match_option p x1 (Some x2));\n seq_seq_match_upd (item_match_option p) s1 s2 i j k x1 (Some x2)", "val wvalue\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (#s: serializer p {k.parser_kind_subkind == Some ParserStrong})\n (#h0: HS.mem)\n (#sout:\n slice (srel_of_buffer_srel (B.trivial_preorder _))\n (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (w: writer s h0 sout pout_from0)\n : GTot t\nlet wvalue\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (#s: serializer p { k.parser_kind_subkind == Some ParserStrong } )\n (#h0: HS.mem)\n (#sout: slice (srel_of_buffer_srel (B.trivial_preorder _)) (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (w: writer s h0 sout pout_from0)\n: GTot t\n= Ghost.reveal w.v", "val list_as_vprop_assoc (g:env) (vp0 vp1 vp2:list term)\n : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))\n (list_as_vprop ((vp0 @ vp1) @ vp2)))\nlet list_as_vprop_assoc g (vp0 vp1 vp2:list term)\n : GTot (vprop_equiv g (list_as_vprop (vp0 @ (vp1 @ vp2)))\n (list_as_vprop ((vp0 @ vp1) @ vp2)))\n = List.Tot.append_assoc vp0 vp1 vp2;\n VE_Refl _ _", "val asel\n (#elt: Type)\n (#vp: vprop)\n (a: array elt)\n (h: rmem vp {FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varray a) /\\ True)})\n : GTot (Seq.lseq elt (length a))\nlet asel (#elt: Type) (#vp: vprop) (a: array elt)\n (h: rmem vp { FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varray a) /\\ True) })\n: GTot (Seq.lseq elt (length a))\n= h (varray a)", "val equal (#a:Type) (s1:seq a) (s2:seq a) : Tot prop\nlet equal #a s1 s2 =\n (length s1 = length s2\n /\\ (forall (i:nat{i < length s1}).{:pattern (index s1 i); (index s2 i)} (index s1 i == index s2 i)))", "val cast\n (#p1 #p2: parser)\n (#inv: memory_invariant)\n (v: squash (valid_rewrite_prop p1 p2))\n (x1: ptr p1 inv)\n : Tot (ptr p2 inv)\nlet cast\n (#p1: parser)\n (#p2: parser)\n (#inv: memory_invariant)\n (v: squash (valid_rewrite_prop p1 p2))\n (x1: ptr p1 inv)\n: Tot (ptr p2 inv)\n= cast _ _ _ _ (evalid_rewrite_of_tvalid_rewrite v) _ x1", "val llist_vdep (#a: Type0) (r: t a) (c: normal (t_of (vptr r))) : Tot vprop\nlet llist_vdep\n (#a: Type0)\n (r: t a)\n (c: normal (t_of (vptr r)))\n: Tot vprop\n= nllist a c.tail_fuel c.next", "val llist_vdep (#a: Type0) (r: t a) (c: normal (t_of (vptr r))) : Tot vprop\nlet llist_vdep\n (#a: Type0)\n (r: t a)\n (c: normal (t_of (vptr r)))\n: Tot vprop\n= nllist a c.tail_fuel c.next", "val equal (#a: eqtype) (#f: cmp a) (s1 s2: ordset a f) : Tot prop\nlet equal (#a:eqtype) (#f:cmp a) (s1:ordset a f) (s2:ordset a f) : Tot prop =\n forall x. mem #_ #f x s1 = mem #_ #f x s2", "val vprop_equiv_typing_fwd\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop \n = let fwd, _ = vprop_equiv_typing d in\n fwd ctxt_typing", "val vprop_equiv_typing_fwd\n (#g: env)\n (#ctxt: _)\n (ctxt_typing: tot_typing g ctxt tm_vprop)\n (#p: _)\n (d: vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop\nlet vprop_equiv_typing_fwd (#g:env) (#ctxt:_) (ctxt_typing:tot_typing g ctxt tm_vprop)\n (#p:_) (d:vprop_equiv g ctxt p)\n : tot_typing g p tm_vprop \n = let fwd, _ = vprop_equiv_typing d in\n fwd ctxt_typing", "val check_vprop (g:env)\n (t:term)\n : T.Tac (t:term & tot_typing g t tm_vprop)\nlet check_vprop (g:env)\n (t:term)\n : T.Tac (t:term & tot_typing g t tm_vprop) =\n check_term (push_context_no_range g \"check_vprop\") t T.E_Total tm_vprop", "val receiver (#p:prot) (c:chan p) (next_action:prot) : vprop\nlet receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p", "val cllist (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop\nlet cllist (#a: Type0) (c: cllist_ptrvalue a) : Tot vprop =\n VUnit (cllist' c)" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Type.fsti", "name": "Pulse.Lib.HashTable.Type.exploded_vp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.perm" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Type.fst", "name": "Pulse.Lib.HashTable.Type.token" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_seq_match_item" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_seq_match" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_list_match_cons0" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fsti", "name": "Steel.ST.EphemeralHashtbl.get_post" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.op_exists_Star" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.put" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.fst", "name": "LowParse.Low.Base.wvalid" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_list_match" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.equal" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.get" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.mk_selector_vprop_hp" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Base.fsti", "name": "Pulse.C.Types.Base.pts_to_or_null" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_list_match_cons_eq" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.high_epoch_id_prop" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.create" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.finalize" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.op_Star_Star" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.array_pts_to_or_null" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_pts_to_or_null" }, { "project_name": "FStar", "file_name": "FStar.OrdMap.fst", "name": "FStar.OrdMap.equal" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fsti", "name": "Steel.ST.EphemeralHashtbl.map_contains_prop" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fst", "name": "Pulse.Checker.VPropEquiv.vprop_list_equiv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.pure" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.full_seq" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.full_seq" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.in_state_slprop" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.equiv" }, { "project_name": "steel", "file_name": "Steel.DisposableInvariant.fst", "name": "Steel.DisposableInvariant.inv" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.reclaim" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_list_match_nil0" }, { "project_name": "steel", "file_name": "Pulse.Lib.Priv.Trade0.fst", "name": "Pulse.Lib.Priv.Trade0.ctx" }, { "project_name": "steel", "file_name": "LList.ST.fst", "name": "LList.ST.is_list" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.inv" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.slprop" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.pts_to" }, { "project_name": "everparse", "file_name": "LowParse.Low.Enum.fst", "name": "LowParse.Low.Enum.read_enum_key_prop" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist_v" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.emp" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.emp" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.pts_to" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.in_state_prop" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vpure" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.pure" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.exists_" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.sender" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_equiv_sym" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.slprop" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.slprop" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.slprop" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.slprop" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fsti", "name": "Pulse.Typing.Combinators.vprop_as_list" }, { "project_name": "steel", "file_name": "Steel.FractionalAnchoredPreorder.fst", "name": "Steel.FractionalAnchoredPreorder.avalue_composable" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.req" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.inv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.guard_vprop" }, { "project_name": "steel", "file_name": "Queue.fst", "name": "Queue.queue" }, { "project_name": "zeta", "file_name": "Zeta.Generic.Blum.fsti", "name": "Zeta.Generic.Blum.k_add_seq" }, { "project_name": "zeta", "file_name": "Zeta.High.Verifier.fsti", "name": "Zeta.High.Verifier.puts" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_equiv_trans" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.sel" }, { "project_name": "steel", "file_name": "Duplex.PCM.fst", "name": "Duplex.PCM.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.SpinLock.fst", "name": "Steel.ST.SpinLock.lockinv_predicate" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.as_seq" }, { "project_name": "hacl-star", "file_name": "Vale.FDefMulx.X64.fst", "name": "Vale.FDefMulx.X64.make_seq9" }, { "project_name": "FStar", "file_name": "FStar.DependentMap.fst", "name": "FStar.DependentMap.equal" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.queue_head_dep1" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.pts_to" }, { "project_name": "steel", "file_name": "CBOR.Pulse.fst", "name": "CBOR.Pulse.cbor_map_get_invariant" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fst", "name": "Pulse.Checker.VPropEquiv.list_as_vprop_ctx" }, { "project_name": "steel", "file_name": "LList.Invariant.fst", "name": "LList.Invariant.llist" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.vprop_equiv_typing_bk" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fsti", "name": "Pulse.Checker.VPropEquiv.vprop_equiv_typing_bk" }, { "project_name": "steel", "file_name": "Steel.SpinLock.fst", "name": "Steel.SpinLock.lockinv" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.vprop_equiv_typing" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fsti", "name": "Pulse.Checker.VPropEquiv.canon_vprop" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.emp'" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_seq_match_item_match_option_upd" }, { "project_name": "everparse", "file_name": "LowParse.Low.Writers.fst", "name": "LowParse.Low.Writers.wvalue" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fst", "name": "Pulse.Checker.VPropEquiv.list_as_vprop_assoc" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.asel" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.equal" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.cast" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.llist_vdep" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.llist_vdep" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fsti", "name": "FStar.OrdSet.equal" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fsti", "name": "Pulse.Checker.VPropEquiv.vprop_equiv_typing_fwd" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.vprop_equiv_typing_fwd" }, { "project_name": "steel", "file_name": "Pulse.Checker.Pure.fst", "name": "Pulse.Checker.Pure.check_vprop" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.receiver" }, { "project_name": "steel", "file_name": "CQueue.LList.fsti", "name": "CQueue.LList.cllist" } ], "selected_premises": [ "Steel.ST.EphemeralHashtbl.value_vprops_mapping_fn", "FStar.List.Tot.Base.op_At", "FStar.List.Tot.Base.map", "Steel.ST.Array.length", "Steel.Memory.hmem", "FStar.Real.one", "FStar.FunctionalExtensionality.feq", "Steel.Preorder.pcm_history", "Steel.Memory.full_mem", "FStar.List.Tot.Base.length", "FStar.Reflection.V2.Data.var", "Steel.Effect.Common.to_vprop", "Steel.Effect.Common.hp_of", "FStar.PCM.compatible", "Steel.ST.Array.join", "FStar.Reflection.V2.Derived.mk_e_app", "Steel.ST.Array.adjacent", "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq", "FStar.PCM.op", "FStar.PtrdiffT.zero", "Steel.FractionalPermission.full_perm", "FStar.PCM.composable", "Steel.ST.Array.alloc", "Steel.Preorder.history_val", "Steel.ST.Array.null", "Steel.Effect.Common.req", "FStar.Reflection.V2.Derived.mk_app", "Steel.ST.Array.ptr_of", "FStar.Real.two", "FStar.Heap.trivial_preorder", "Steel.Effect.Common.star", "Steel.Effect.Common.sel_of", "Steel.Effect.Common.t_of", "Steel.ST.Array.array", "FStar.Reflection.V2.Derived.flatten_name", "FStar.List.Tot.Base.rev", "Steel.Effect.Common.to_vprop'", "Steel.ST.Util.emp_inames", "Steel.Effect.Common.rmem", "FStar.List.Tot.Base.mem", "Steel.ST.Array.write", "Steel.FractionalPermission.sum_perm", "Steel.Effect.Common.print_goals", "Steel.FractionalPermission.comp_perm", "Steel.Memory.inames", "Steel.Effect.Common.extract_contexts", "FStar.List.Tot.Base.tl", "FStar.ST.op_Bang", "Steel.Effect.Common.normal_steps", "FStar.List.Tot.Base.append", "Steel.ST.Util.op_At_Equals_Equals_Greater", "FStar.String.strlen", "Steel.Effect.Common.normal", "FStar.Reflection.V2.Derived.shift_subst", "Steel.Effect.Common.mk_rmem", "Steel.Effect.Common.guard_vprop", "FStar.UInt.size", "Steel.Preorder.vhist", "Steel.Effect.Common.rm", "FStar.Seq.Permutation.index_fun", "FStar.Reflection.V2.Derived.type_of_binder", "Steel.Effect.Common.vrefine'", "Steel.Effect.Common.pure", "Steel.Effect.Common.slterm_nbr_uvars_argv", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "Steel.Effect.Common.hmem", "Steel.ST.Array.merge", "FStar.FunctionalExtensionality.on_dom", "FStar.String.length", "Steel.Effect.Common.sel_depends_only_on", "FStar.Reflection.V2.Derived.Lemmas.op_Less_Less_Colon", "FStar.Reflection.V2.Derived.inspect_ln_unascribe", "Steel.Effect.Common.rmem'", "FStar.PartialMap.const", "Steel.ST.Array.read", "FStar.List.Tot.Base.memP", "Steel.Effect.Common.selector'", "FStar.List.Tot.Properties.assoc_mem", "Steel.ST.Array.merge_into", "Steel.Effect.Common.visit_br", "Steel.ST.EphemeralHashtbl.store_and_borrows_related", "Steel.Effect.Common.return_pre", "FStar.Sealed.Inhabited.seal", "Steel.ST.Array.is_full_array", "Steel.Effect.Common.mk_rmem'", "Steel.Effect.Common.vrefine", "FStar.List.Tot.Base.fold_left", "FStar.Pervasives.reveal_opaque", "Steel.Preorder.p_op", "Steel.Effect.Common.print_goal", "FStar.Reflection.V2.Derived.is_fvar", "Steel.Effect.Common.visit_tm", "Steel.Effect.Common.normal_tac_steps", "Steel.Effect.Common.atom", "FStar.Tactics.CanonCommMonoidSimple.Equiv.atom", "FStar.Reflection.V2.Data.ppname_t", "FStar.IntegerIntervals.interval_size", "Steel.Effect.Common.my_assoc", "Steel.Effect.Common.vprop_term_uvars" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n Authors: Aseem Rastogi\n*)\n\nmodule Steel.ST.EphemeralHashtbl\n\nopen Steel.FractionalPermission\nopen Steel.Memory\nopen Steel.ST.Effect.Ghost\nopen Steel.ST.Effect.Atomic\nopen Steel.ST.Effect\nopen Steel.ST.Util\n\nmodule G = FStar.Ghost\nmodule Seq = FStar.Seq\nmodule Map = FStar.PartialMap\nmodule US = FStar.SizeT\nmodule R = Steel.ST.Reference\nmodule A = Steel.ST.Array\n\n\n/// `store` is the concrete store implemented as an array\n///\n/// The hashing scheme we use is as follows:\n/// for key `k`, its slot in the array is `(h k) mod n`\n\nnoeq\ntype tbl #k #v #contents (vp:vp_t k v contents) (h:hash_fn k) = {\n store_len : n:us{US.v n > 0};\n store : A.array (option (k & v));\n store_len_pf : squash (A.length store == US.v store_len);\n}\n\n/// Property of the logical view of the store\n///\n/// For each (Some (k, v)) in the sequence, (h k) mod n == i\n\nlet seq_props (#k:eqtype) (#v:Type0) (h:hash_fn k) (s:Seq.seq (option (k & v))) : prop =\n 0 < Seq.length s /\\ US.fits (Seq.length s) /\\\n\n (forall (i:nat{i < Seq.length s}).\n Some? (Seq.index s i) ==> (let Some (x, _) = Seq.index s i in\n US.v (h x) `US.mod_spec` Seq.length s == i))\n\n/// Using seq_props, we can derive that all the keys in the sequence are distinct\n\nlet seq_keys_distinct (#k:eqtype) (#v:Type0) (s:Seq.seq (option (k & v))) : prop =\n forall (i j:(k:nat{k < Seq.length s})).{:pattern Seq.index s i; Seq.index s j}\n (i =!= j /\\ Some? (Seq.index s i) /\\ Some? (Seq.index s j)) ==>\n (fst (Some?.v (Seq.index s i)) =!= fst (Some?.v (Seq.index s j)))\n\nlet seq_props_implies_keys_distinct (#k:eqtype) (#v:Type0) (h:hash_fn k) (s:Seq.seq (option (k & v)))\n : Lemma (requires seq_props h s) (ensures seq_keys_distinct s)\n = ()\n\n/// For each (Some (k, v)) in the sequence, k must be in the repr map\n\nlet store_and_repr_related\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (s:Seq.seq (option (k & v)))\n (m:repr k contents)\n : prop\n = forall (i:nat{i < Seq.length s}).\n match Seq.index s i with\n | None -> True\n | Some (k, _) -> Map.contains m k\n\n/// For each (Some (k, v)) in the sequence,\n/// either borrows does not contain k, or it maps k to v\n\nlet store_and_borrows_related\n (#k:eqtype)\n (#v:Type0)\n (s:Seq.seq (option (k & v)))\n (borrows:Map.t k v)\n : prop\n = forall (i:nat{i < Seq.length s}).\n match Seq.index s i with\n | None -> True\n | Some (k, x) ->\n Map.sel borrows k == None \\/\n Map.sel borrows k == Some x\n\nmodule CE = FStar.Algebra.CommMonoid.Equiv\nmodule SeqPerm = FStar.Seq.Permutation\n\n/// Setup for maintaining the value vprops in the table invariant\n///\n/// High-level idea is that, we take the store sequence,\n/// map it to a sequence of vprops,\n/// and fold the vprop monoid (with `star` as the multiplication) on this sequence\n///\n/// Each value contributes a `vp i x c`, unless it is in the borrows map\n\nlet vprop_monoid : CE.cm vprop Steel.Effect.Common.req = Steel.Effect.Common.rm\n\n/// Function to map over the store sequence\n\nlet value_vprops_mapping_fn\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (m:repr k contents)\n (borrows:Map.t k v)\n : option (k & v) -> vprop\n = fun e ->\n match e with\n | None -> emp\n | Some (i, x) ->\n (match Map.sel m i, Map.sel borrows i with\n | None, _ -> pure False\n | _, Some _ -> emp\n | Some c, None -> vp i x c)\n\n/// The corresponding sequence of vprops for a store sequence\n\n[@@__reduce__]", "sketch": [ "To implement the `value_vprops_seq` definition, we will use the `Seq.map` function to map over the input sequence of key-value pairs. For each key-value pair, we will use the `value_vprops_mapping_fn` to derive the corresponding vprop based on the representation map and the borrows map. The resulting sequence of vprops will be returned as the output.\n\n```fstar\nlet value_vprops_seq\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (s:Seq.seq (option (k & v)))\n (m:repr k contents)\n (borrows:Map.t k v)\n : Seq.seq vprop\n = Seq.map (value_vprops_mapping_fn vp m borrows) s\n```" ], "generated_solution": [] }, { "file_name": "Steel.ST.GenElim.Base.fsti", "name": "Steel.ST.GenElim.Base.is_any_fvar", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Steel.ST.Util" }, { "open": "Steel.ST.GenElim" }, { "open": "Steel.ST.GenElim" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let is_any_fvar = Reflection.is_any_fvar", "source_range": { "start_line": 7, "start_col": 0, "end_line": 7, "end_col": 40 }, "interleaved": false, "definition": "FStar.Reflection.V1.Derived.is_any_fvar", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Reflection.V1.Derived.is_any_fvar" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool", "prompt": "let is_any_fvar =\n ", "expected_response": "Reflection.is_any_fvar", "source": { "project_name": "steel", "file_name": "lib/steel/Steel.ST.GenElim.Base.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Steel.ST.GenElim.Base.fsti", "checked_file": "dataset/Steel.ST.GenElim.Base.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Steel.ST.Util.fsti.checked", "dataset/Steel.Effect.Common.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Reflection.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Ghost.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "let is_fvar = Reflection.is_fvar" ], "closest": [ "val Steel.ST.GenElim1.Base.is_any_fvar = t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool\nlet is_any_fvar = Reflection.is_any_fvar", "val Steel.ST.GenElim1.Base.is_fvar = t: FStar.Stubs.Reflection.Types.term -> nm: Prims.string -> Prims.bool\nlet is_fvar = Reflection.is_fvar", "val is_any_fvar (t: term) (nms: list string) : bool\nlet rec is_any_fvar (t : term) (nms:list string) : bool =\n match nms with\n | [] -> false\n | v::vs -> is_fvar t v || is_any_fvar t vs", "val is_any_fvar (t: term) (nms: list string) : bool\nlet rec is_any_fvar (t : term) (nms:list string) : bool =\n match nms with\n | [] -> false\n | v::vs -> is_fvar t v || is_any_fvar t vs", "val is_fvar (t: term) (nm: string) : bool\nlet is_fvar (t : term) (nm:string) : bool =\n match inspect_ln_unascribe t with\n | Tv_FVar fv\n | Tv_UInst fv _ -> implode_qn (inspect_fv fv) = nm\n | _ -> false", "val is_fvar (t: term) (nm: string) : bool\nlet is_fvar (t : term) (nm:string) : bool =\n match inspect_ln_unascribe t with\n | Tv_FVar fv\n | Tv_UInst fv _ -> implode_qn (inspect_fv fv) = nm\n | _ -> false", "val FStar.Reflection.Typing.ln = t: FStar.Stubs.Reflection.Types.term -> Prims.bool\nlet ln (t:term) = ln' t (-1)", "val Test.Lowstarize.is_string = e: FStar.Stubs.Reflection.Types.term -> Prims.bool\nlet is_string e =\n is_some (destruct_string e)", "val Binding.is_enum = e: Binding.env -> t: Ast.typ -> FStar.All.ALL Prims.bool\nlet is_enum (e:env) (t:typ) =\r\n match t.v with\r\n | Type_app i KindSpec [] ->\r\n Some? (try_lookup_enum_cases e i)\r\n | _ -> false", "val is_fv (t: R.term) (n: R.name) : T.Tac bool\nlet is_fv (t:R.term) (n:R.name)\n : T.Tac bool\n = match T.inspect t with\n | T.Tv_FVar fv ->\n T.inspect_fv fv = n\n | _ -> false", "val Pulse.Typing.FV.contains_r = g: FStar.Stubs.Reflection.Types.env -> x: Pulse.Syntax.Base.var -> Prims.bool\nlet contains_r (g:R.env) (x:var) = Some? (RT.lookup_bvar g x)", "val Steel.ST.Array.larray = t: Type0 -> n: Prims.nat -> Type0\nlet larray (t:Type) (n:nat) = a:array t{ length a = n }", "val Steel.ST.GenElim1.Base.dfstp = t: Prims.dtuple2 a b -> a\nlet dfstp #a #b t = dfst #a #b t", "val Test.Lowstarize.is_list = e: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.bool\nlet is_list e =\n match inspect (fst (collect_app e)) with\n | Tv_UInst fv _\n | Tv_FVar fv ->\n inspect_fv fv = nil_qn || inspect_fv fv = cons_qn\n | _ ->\n false", "val Test.Lowstarize.is_some = _: FStar.Pervasives.Native.option _ -> Prims.bool\nlet is_some = function Some _ -> true | None -> false", "val Steel.ST.Loops.nat_at_most = f: FStar.SizeT.t -> Type0\nlet nat_at_most (f:US.t)\n = x:nat{ x <= US.v f }", "val Binding.eq_typs = env: Binding.env -> ts: Prims.list (Ast.typ * Ast.typ) -> FStar.All.ML Prims.bool\nlet eq_typs env ts =\r\n List.for_all (fun (t1, t2) -> eq_typ env t1 t2) ts", "val Pulse.Syntax.Naming.ln_st = t: Pulse.Syntax.Base.st_term -> Prims.bool\nlet ln_st (t:st_term) = ln_st' t (-1)", "val Zeta.Steel.Util.larray = t: Type0 -> n: FStar.UInt32.t -> Type0\nlet larray t (n:U32.t) = A.larray t (U32.v n)", "val Vale.Math.Bits.is_bv8 = a: FStar.BV.bv_t n -> Prims.logical\nlet is_bv8 (#n:nat{n >= 8}) (a:bv_t n) = lemma_pow2_le 8 n; a == b_and a (b_i2b 0xff)", "val Meta.Interface.has_inline_for_extraction = s: FStar.Stubs.Reflection.Types.sigelt -> Prims.bool\nlet has_inline_for_extraction (s: sigelt) =\n List.Tot.existsb (function Inline_for_extraction -> true | _ -> false) (sigelt_quals s)", "val is_fv (fv: string) (t: term) : Tac bool\nlet is_fv (fv:string) (t:term) : Tac bool =\n match inspect t with\n | Tv_FVar fv' ->\n String.concat \".\" (inspect_fv fv') = fv\n | _ -> false", "val FStar.Reflection.Typing.ln_comp = c: FStar.Stubs.Reflection.Types.comp -> Prims.bool\nlet ln_comp (c:comp) = ln'_comp c (-1)", "val Spec.Box.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let pk1 : lbytes 32 = Spec.Curve25519.secret_to_public sk1 in\n let pk2 : lbytes 32 = Spec.Curve25519.secret_to_public sk2 in\n let mac_cipher = box_detached sk1 pk2 nonce plain in\n let (mac, cipher) =\n match mac_cipher with | Some p -> p | None -> (create 16 (u8 0), create 72 (u8 0)) in\n\n let dec = box_open_detached pk1 sk2 nonce mac cipher in\n let dec_p = match dec with | Some p -> p | None -> create 72 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plain in\n\n if result_decryption\n then begin IO.print_string \"\\nCryptoBox: Success!\\n\"; true end\n else begin IO.print_string \"\\nCryptoBox: Failure :(\"; false end", "val Antiquote.f = t: FStar.Tactics.NamedView.term -> FStar.Stubs.Reflection.Types.term\nlet f (t : term) = `(1 + (`#t))", "val Meta.Interface.has_attr = s: FStar.Stubs.Reflection.Types.sigelt -> x: FStar.Stubs.Reflection.Types.term -> Prims.bool\nlet has_attr (s: sigelt) (x: term) =\n List.Tot.existsb (fun t -> term_eq t x) (sigelt_attrs s)", "val Spec.Agile.HPKE.maybe_lte = n1: Prims.int -> n2: FStar.Pervasives.Native.option Prims.int -> Prims.bool\nlet maybe_lte (n1: int) (n2: option int) =\n match n2 with\n | None -> true\n | Some n2 -> n1 <= n2", "val Steel.ST.GenElim1.Base.init_resolve_tac = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet init_resolve_tac () = init_resolve_tac'\n [(`gen_elim_prop_placeholder), solve_gen_elim_prop_placeholder]", "val Steel.Loops.nat_at_most = f: FStar.SizeT.t -> Type0\nlet nat_at_most (f:US.t)\n = x:nat{ x <= US.v f }", "val FStar.Reflection.Typing.bool_fv = FStar.Stubs.Reflection.Types.fv\nlet bool_fv = pack_fv bool_lid", "val FStar.Reflection.Const.exists_qn = Prims.list Prims.string\nlet exists_qn = [\"Prims\"; \"l_Exists\"]", "val Spec.Poly1305.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let mac = poly1305_mac msg key in\n let res = PS.print_compare true (length mac) expected mac in\n\n if res then begin IO.print_string \"\\nPoly1305: Success!\\n\"; true end\n else begin IO.print_string \"\\nPoly1305: Failure :(\\n\"; false end", "val Pulse.Reflection.Util.mk_szv = n: FStar.Stubs.Reflection.Types.term -> FStar.Stubs.Reflection.Types.term\nlet mk_szv (n:R.term) =\n let open R in\n let t = pack_ln (Tv_FVar (pack_fv szv_lid)) in\n pack_ln (Tv_App t (n, Q_Explicit))", "val Test.Lowstarize.is_tuple = e: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.bool\nlet is_tuple (e: term) =\n match inspect (fst (collect_app e)) with\n | Tv_UInst fv _\n | Tv_FVar fv ->\n List.Tot.contains (inspect_fv fv) mktuple_qns\n | _ ->\n false", "val FStar.Reflection.Const.gt_qn = Prims.list Prims.string\nlet gt_qn = [\"Prims\"; \"op_GreaterThan\"]", "val Steel.C.Typestring.norm_typestring = Prims.list FStar.Pervasives.norm_step\nlet norm_typestring =\n [\n delta_only [\n `%char_t_of_char;\n `%string_t_of_chars;\n `%mk_string_t;\n ];\n iota; zeta; primops;\n ]", "val is_fvar (t: term) : option (R.name & list universe)\nlet is_fvar (t:term) : option (R.name & list universe) =\n let open R in\n match t.t with\n | Tm_FStar host_term ->\n begin match inspect_ln host_term with\n | Tv_FVar fv -> Some (inspect_fv fv, [])\n | Tv_UInst fv us -> Some (inspect_fv fv, us)\n | _ -> None\n end\n | _ -> None", "val Steel.HigherReference.cas_provides = r: Steel.HigherReference.ref t -> v: FStar.Ghost.erased t -> v_new: t -> b: Prims.bool\n -> Steel.Memory.slprop\nlet cas_provides #t (r:ref t) (v:Ghost.erased t) (v_new:t) (b:bool) =\n if b then pts_to_sl r full_perm v_new else pts_to_sl r full_perm v", "val Pulse.Typing.FV.vars_of_env_r = g: FStar.Stubs.Reflection.Types.env -> Prims.GTot (FStar.Set.set Pulse.Syntax.Base.var)\nlet vars_of_env_r (g:R.env) = Set.intension (contains_r g)", "val FStar.Sequence.Base.is_prefix_def_fact = Prims.logical\nlet is_prefix_def_fact =\n forall (ty: Type u#a) (s0: seq ty) (s1: seq ty).{:pattern is_prefix s0 s1}\n is_prefix s0 s1 <==>\n length s0 <= length s1\n /\\ (forall (j: nat).{:pattern index s0 j \\/ index s1 j}\n j < length s0 ==> index s0 j == index s1 j)", "val FStar.Reflection.Typing.fstar_env_fvs = g: FStar.Stubs.Reflection.Types.env -> Prims.logical\nlet fstar_env_fvs (g:R.env) =\n lookup_fvar g unit_fv == Some (tm_type u_zero) /\\\n lookup_fvar g bool_fv == Some (tm_type u_zero) /\\\n lookup_fvar g b2t_fv == Some b2t_ty", "val Test.Lowstarize.is_hex = e: FStar.Stubs.Reflection.Types.term -> FStar.Tactics.Effect.Tac Prims.bool\nlet is_hex e =\n is_some (destruct_hex e)", "val FStar.Reflection.Const.gte_qn = Prims.list Prims.string\nlet gte_qn = [\"Prims\"; \"op_GreaterThanOrEqual\"]", "val is_and (t: term) : bool\nlet is_and (t:term) : bool =\n is_any_fvar t [`%(/\\); `%prop_and]", "val FStar.Reflection.Const.forall_qn = Prims.list Prims.string\nlet forall_qn = [\"Prims\"; \"l_Forall\"]", "val Spec.Hash.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHash: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHash: Failure :(\\n\"; false end", "val FStar.Reflection.Typing.var_as_bv = v: Prims.nat -> FStar.Stubs.Reflection.Types.bv\nlet var_as_bv (v:nat) = pack_bv (make_bv v)", "val FStar.Reflection.Typing.bool_ty = FStar.Stubs.Reflection.Types.term\nlet bool_ty = pack_ln (Tv_FVar bool_fv)", "val Meta.Interface.is_implicit = _: FStar.Stubs.Reflection.V1.Data.aqualv -> Prims.bool\nlet is_implicit = function\n | Q_Implicit -> true\n | _ -> false", "val Spec.SecretBox.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let (mac, cipher) = secretbox_detached key nonce plaintext in\n let result_encryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) cipher xcipher in\n let result_mac_compare =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) mac xmac in\n\n let dec = secretbox_open_detached key nonce xmac xcipher in\n let dec_p = match dec with | Some p -> p | None -> create 131 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plaintext in\n\n if result_encryption && result_mac_compare && result_decryption\n then begin IO.print_string \"\\nSuccess!\\n\"; true end\n else begin IO.print_string \"\\nFailure :(\"; false end", "val Binding.eq_typ = env: Binding.env -> t1: Ast.typ -> t2: Ast.typ -> FStar.All.ALL Prims.bool\nlet eq_typ env t1 t2 =\r\n if Ast.eq_typ t1 t2 then true\r\n else Ast.eq_typ (unfold_typ_abbrev_and_enum env t1) (unfold_typ_abbrev_and_enum env t2)", "val Steel.ST.GenArraySwap.Proof.int_semiring = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet int_semiring () =\n FStar.Tactics.CanonCommSemiring.int_semiring ();\n FStar.Tactics.trefl ();\n FStar.Tactics.qed ()", "val Vale.Math.Bits.is_bv32 = a: FStar.BV.bv_t n -> Prims.logical\nlet is_bv32 (#n:nat{n >= 32}) (a:bv_t n) = lemma_pow2_le 32 n; a == b_and a (b_i2b 0xffffffff)", "val Pulse.Reflection.Util.bool_tm = FStar.Stubs.Reflection.Types.term\nlet bool_tm = R.pack_ln (R.Tv_FVar bool_fv)", "val Vale.Math.Bits.is_bv16 = a: FStar.BV.bv_t n -> Prims.logical\nlet is_bv16 (#n:nat{n >= 16}) (a:bv_t n) = lemma_pow2_le 16 n; a == b_and a (b_i2b 0xffff)", "val Pulse.Checker.AssertWithBinders.is_host_term = t: FStar.Stubs.Reflection.Types.term -> Prims.bool\nlet is_host_term (t:R.term) = not (R.Tv_Unknown? (R.inspect_ln t))", "val Steel.Effect.Common.quote_atoms = l: Prims.list Steel.Effect.Common.atom -> FStar.Stubs.Reflection.Types.term\nlet rec quote_atoms (l:list atom) = match l with\n | [] -> `[]\n | hd::tl -> let nt = pack (Tv_Const (C_Int hd)) in\n (`Cons (`#nt) (`#(quote_atoms tl)))", "val FStar.Reflection.Const.iff_qn = Prims.list Prims.string\nlet iff_qn = [\"Prims\"; \"l_iff\"]", "val is_star (t: term) : bool\nlet is_star (t:term) : bool =\n is_any_fvar t [`%star; `%VStar]", "val is_uvar (t: term) : bool\nlet is_uvar (t : term) : bool =\n match inspect_ln (head t) with\n | Tv_Uvar _ _ -> true\n | _ -> false", "val is_uvar (t: term) : bool\nlet is_uvar (t : term) : bool =\n match inspect_ln (head t) with\n | Tv_Uvar _ _ -> true\n | _ -> false", "val Vale.Math.Poly2.Defs_s.one = FStar.Seq.Base.seq Prims.bool\nlet one = create 1 true", "val Steel.ST.GenElim1.Base.dsndp = t: Prims.dtuple2 a b -> b (Mkdtuple2?._1 t)\nlet dsndp #a #b t = dsnd #a #b t", "val FStar.Reflection.Const.nat_bv_qn = Prims.list Prims.string\nlet nat_bv_qn = [\"FStar\" ; \"BV\" ; \"int2bv\"]", "val Pulse.Reflection.Util.nat_tm = FStar.Stubs.Reflection.Types.term\nlet nat_tm = R.pack_ln (R.Tv_FVar nat_fv)", "val Steel.Memory.is_frame_preserving = f: Steel.Memory.tot_pre_action_nf_except e fp a fp' -> Prims.logical\nlet is_frame_preserving\n (#e:inames)\n (#a:Type u#b)\n (#fp:slprop u#a)\n (#fp':a -> slprop u#a)\n (f:tot_pre_action_nf_except e fp a fp') =\n forall (frame:slprop u#a) (m0:hmem_with_inv_except e (fp `star` frame)).\n (ac_reasoning_for_m_frame_preserving fp frame (locks_invariant e m0) m0;\n let (| x, m1 |) = f m0 in\n interp ((fp' x `star` frame) `star` locks_invariant e m1) m1 /\\\n mem_evolves m0 m1 /\\\n (forall (mp:mprop frame). mp (core_mem m0) == mp (core_mem m1)))", "val Spec.Hash.Test.test_one = v: Spec.Hash.Test.vec -> FStar.All.ALL Prims.bool\nlet test_one (v:vec) =\n let Vec a plain tag = v in\n assert_norm (List.Tot.length tag = hash_length a);\n assert_norm (List.Tot.length plain `less_than_max_input_length` a);\n\n let expected = seq_of_list (List.Tot.map Lib.RawIntTypes.u8_from_UInt8 tag) in\n let computed = hash a (seq_of_list (List.Tot.map Lib.RawIntTypes.u8_from_UInt8 plain)) in\n PS.print_compare true (hash_length a) expected computed", "val Binding.is_bound_locally = env: Binding.env -> i: Ast.ident -> FStar.All.ALL Prims.bool\nlet is_bound_locally (env:env) (i:ident) = \r\n match H.try_find env.locals i.v with\r\n | None -> false\r\n | Some _ -> true", "val Pulse.Reflection.Util.nat_fv = FStar.Stubs.Reflection.Types.fv\nlet nat_fv = R.pack_fv nat_lid", "val Steel.Preorder.qhistory = q: FStar.Preorder.preorder a -> l: Prims.list a -> Prims.logical\nlet rec qhistory #a (q:preorder a) (l:list a) =\n match l with\n | []\n | [_] -> True\n | x::y::tl -> y `q` x /\\ qhistory q (y::tl)", "val Vale.Math.Bits.is_bv64 = a: FStar.BV.bv_t n -> Prims.logical\nlet is_bv64 (#n:nat{n >= 64}) (a:bv_t n) = lemma_pow2_le 64 n; a == b_and a (b_i2b 0xffffffffffffffff)", "val Steel.ST.GenElim1.Base.compute_gen_elim_p' = x: Steel.ST.GenElim1.Base.gen_elim_i -> Steel.Effect.Common.vprop\nlet compute_gen_elim_p' = compute_gen_elim_p", "val is_var (t: term) : option nm\nlet is_var (t:term) : option nm =\n let open R in\n match t.t with\n | Tm_FStar host_term ->\n begin match R.inspect_ln host_term with\n | R.Tv_Var nv ->\n let nv_view = R.inspect_namedv nv in\n Some {nm_index=nv_view.uniq;\n nm_ppname=mk_ppname (nv_view.ppname) t.range}\n | _ -> None\n end\n | _ -> None", "val CalcImpl.any = p: _ -> q: _ -> Prims.logical\nlet any p q = True", "val Spec.Blake2.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nAll tests successful !\\n\"; true end\n else begin IO.print_string \"\\n\\nSome test failed !\\n\"; false end", "val Pulse.Syntax.Naming.ln = t: Pulse.Syntax.Base.term -> Prims.bool\nlet ln (t:term) = ln' t (-1)", "val Pulse.Reflection.Util.bool_fv = FStar.Stubs.Reflection.Types.fv\nlet bool_fv = R.pack_fv bool_lid", "val FStar.Reflection.Const.bool_true_qn = Prims.list Prims.string\nlet bool_true_qn = [\"Prims\"; \"true\"]", "val Steel.ST.C.Types.UserStruct.nonempty_set = t: Prims.eqtype -> Type0\nlet nonempty_set (t: eqtype) =\n (s: Set.set t { exists x . set_def s x == true })", "val FStar.Vector.Base.len_t = Prims.eqtype\nlet len_t = U32.t", "val Zeta.SeqAux.exists_sat_elems = f: (_: a -> Prims.bool) -> s: FStar.Seq.Base.seq a -> Prims.bool\nlet exists_sat_elems (#a:Type) (f:a -> bool) (s:seq a) =\n Some? (last_index_opt f s)", "val ns_f (#t: Type0) : nstype t\nlet ns_f (#t: Type0) : nstype t =\n let f (x y: t) = False in\n Classical.forall_intro_2 (holds_equiv f);\n f", "val MiTLS.TLSConstants.is_seqn = n: Prims.nat -> Prims.bool\nlet is_seqn (n:nat) = repr_bytes n <= 8", "val FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq = _: FStar.Stubs.Reflection.Types.term -> _: FStar.Stubs.Reflection.Types.term\n -> FStar.Tactics.Effect.Tac Prims.bool\nlet term_eq = FStar.Tactics.term_eq_old", "val FStar.BV.bv_zero = FStar.BV.bv_t n\nlet bv_zero #n = int2bv #n 0", "val Pulse.Syntax.Base.not_tv_unknown = t: FStar.Stubs.Reflection.Types.term -> Prims.logical\nlet not_tv_unknown (t:R.term) = R.inspect_ln t =!= R.Tv_Unknown", "val FStar.InteractiveHelpers.ExploreTerm.st_effect_qn = Prims.string\nlet st_effect_qn = \"FStar.HyperStack.ST.ST\"", "val test: unit -> FStar.All.ML bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nEd25519 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nEd25519: Failure :(\\n\"; false end", "val Pulse.Checker.Prover.IntroPure.is_host_var = x: FStar.Stubs.Reflection.Types.term -> FStar.Pervasives.Native.option Pulse.Syntax.Base.nm\nlet is_host_var (x:R.term) =\n match R.inspect_ln x with\n | R.Tv_Var nv ->\n let nv_view = R.inspect_namedv nv in\n Some {nm_index=nv_view.uniq;\n nm_ppname=mk_ppname (nv_view.ppname) (R.range_of_term x)}\n | _ -> None", "val array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n : STAtomicBase bool\n false\n opened\n Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\nlet array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\n= let a = array_ptr_of r in\n let len : array_len_t a = dsnd r in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null (| a, len |) v);\n let res = array_ptr_is_null a len in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null r v);\n return res", "val Vale.Math.Bits.bveq = a: FStar.BV.bv_t n -> b: FStar.BV.bv_t n -> Prims.logical\nlet bveq (#n:pos) (a b:bv_t n) = bvxor a b == bvxor a a", "val FStar.Reflection.Const.lte_qn = Prims.list Prims.string\nlet lte_qn = [\"Prims\"; \"op_LessThanOrEqual\"]", "val SteelTLArray.l = Prims.list FStar.UInt8.t\nlet l = [0uy; 1uy]", "val Steel.C.Typestring.solve_mk_string_t = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet solve_mk_string_t () =\n FStar.Tactics.norm norm_typestring;\n FStar.Tactics.trefl ()", "val FStar.Fin.vect = n: Prims.nat -> a: Type -> Type\nlet vect (n: nat) (a: Type) = l: list a {L.length l = n}", "val Steel.ST.C.Types.Base.norm_field_steps = Prims.list FStar.Pervasives.norm_step\nlet norm_field_steps = [\n delta_attr [`%norm_field_attr];\n iota; zeta; primops;\n]", "val Hacl.Spec.K256.Field52.is_felem_zero_vartime5 = _: Hacl.Spec.K256.Field52.Definitions.felem5 -> Prims.bool\nlet is_felem_zero_vartime5 ((f0,f1,f2,f3,f4): felem5) : bool =\n let open Lib.RawIntTypes in\n u64_to_UInt64 f0 =. 0uL &&\n u64_to_UInt64 f1 =. 0uL &&\n u64_to_UInt64 f2 =. 0uL &&\n u64_to_UInt64 f3 =. 0uL &&\n u64_to_UInt64 f4 =. 0uL", "val Util.ImmutableArray.for_all_array = f: (_: ty -> Prims.GTot Prims.bool) -> a: Util.ImmutableArray.array_t ty -> Prims.GTot Prims.bool\nlet for_all_array (#ty: Type) (f: ty -> GTot bool) (a: array_t ty) =\n for_all_range (array_len a) (fun i -> f (array_index a i))", "val MiTLS.Mem.is_tls_rgn = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_tls_rgn r = HS.color r = tls_color", "val Steel.Effect.Common.extract_cbs_forall_dep_contexts = t: FStar.Tactics.NamedView.term\n -> FStar.Tactics.Effect.Tac\n (FStar.Pervasives.Native.option (_: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit))\nlet extract_cbs_forall_dep_contexts\n=\n extract_contexts\n (`can_be_split_forall_dep_congr_l)\n (`can_be_split_forall_dep_congr_r)\n (`solve_can_be_split_forall_dep_lookup)\n (`solve_can_be_split_forall_dep_for)" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.is_any_fvar" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.is_fvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.fst", "name": "FStar.Reflection.V1.Derived.is_any_fvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Derived.fst", "name": "FStar.Reflection.V2.Derived.is_any_fvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Derived.fst", "name": "FStar.Reflection.V2.Derived.is_fvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.fst", "name": "FStar.Reflection.V1.Derived.is_fvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.ln" }, { "project_name": "hacl-star", "file_name": "Test.Lowstarize.fst", "name": "Test.Lowstarize.is_string" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.is_enum" }, { "project_name": "FStar", "file_name": "STLC.Infer.fst", "name": "STLC.Infer.is_fv" }, { "project_name": "steel", "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.contains_r" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fsti", "name": "Steel.ST.Array.larray" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.dfstp" }, { "project_name": "hacl-star", "file_name": "Test.Lowstarize.fst", "name": "Test.Lowstarize.is_list" }, { "project_name": "hacl-star", "file_name": "Test.Lowstarize.fst", "name": "Test.Lowstarize.is_some" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fsti", "name": "Steel.ST.Loops.nat_at_most" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.eq_typs" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.ln_st" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Util.fst", "name": "Zeta.Steel.Util.larray" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.is_bv8" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.has_inline_for_extraction" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.is_fv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.ln_comp" }, { "project_name": "hacl-star", "file_name": "Spec.Box.Test.fst", "name": "Spec.Box.Test.test" }, { "project_name": "FStar", "file_name": "Antiquote.fst", "name": "Antiquote.f" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.has_attr" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.HPKE.fsti", "name": "Spec.Agile.HPKE.maybe_lte" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.init_resolve_tac" }, { "project_name": "steel", "file_name": "Steel.Loops.fsti", "name": "Steel.Loops.nat_at_most" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.bool_fv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.exists_qn" }, { "project_name": "hacl-star", "file_name": "Spec.Poly1305.Test.fst", "name": "Spec.Poly1305.Test.test" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_szv" }, { "project_name": "hacl-star", "file_name": "Test.Lowstarize.fst", "name": "Test.Lowstarize.is_tuple" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.gt_qn" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fsti", "name": "Steel.C.Typestring.norm_typestring" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Pure.fst", "name": "Pulse.Syntax.Pure.is_fvar" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.cas_provides" }, { "project_name": "steel", "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.vars_of_env_r" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Base.fsti", "name": "FStar.Sequence.Base.is_prefix_def_fact" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.fstar_env_fvs" }, { "project_name": "hacl-star", "file_name": "Test.Lowstarize.fst", "name": "Test.Lowstarize.is_hex" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.gte_qn" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.is_and" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.forall_qn" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Test.fst", "name": "Spec.Hash.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.var_as_bv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.bool_ty" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.is_implicit" }, { "project_name": "hacl-star", "file_name": "Spec.SecretBox.Test.fst", "name": "Spec.SecretBox.Test.test" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.eq_typ" }, { "project_name": "steel", "file_name": "Steel.ST.GenArraySwap.Proof.fst", "name": "Steel.ST.GenArraySwap.Proof.int_semiring" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.is_bv32" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.bool_tm" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.is_bv16" }, { "project_name": "steel", "file_name": "Pulse.Checker.AssertWithBinders.fst", "name": "Pulse.Checker.AssertWithBinders.is_host_term" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.quote_atoms" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.iff_qn" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.is_star" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.fst", "name": "FStar.Reflection.V1.Derived.is_uvar" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Derived.fst", "name": "FStar.Reflection.V2.Derived.is_uvar" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs_s.fst", "name": "Vale.Math.Poly2.Defs_s.one" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.dsndp" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.nat_bv_qn" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.nat_tm" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.is_frame_preserving" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Test.fst", "name": "Spec.Hash.Test.test_one" }, { "project_name": "everparse", "file_name": "Binding.fst", "name": "Binding.is_bound_locally" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.nat_fv" }, { "project_name": "steel", "file_name": "Steel.Preorder.fst", "name": "Steel.Preorder.qhistory" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.is_bv64" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_p'" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Pure.fst", "name": "Pulse.Syntax.Pure.is_var" }, { "project_name": "FStar", "file_name": "CalcImpl.fst", "name": "CalcImpl.any" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Test.fst", "name": "Spec.Blake2.Test.test" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.ln" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.bool_fv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.bool_true_qn" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.nonempty_set" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.len_t" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fsti", "name": "Zeta.SeqAux.exists_sat_elems" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fsti", "name": "Benton2004.DDCC.ns_f" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.TLSConstants.fsti", "name": "MiTLS.TLSConstants.is_seqn" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq" }, { "project_name": "FStar", "file_name": "FStar.BV.fsti", "name": "FStar.BV.bv_zero" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.not_tv_unknown" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ExploreTerm.fst", "name": "FStar.InteractiveHelpers.ExploreTerm.st_effect_qn" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.Test.fst", "name": "Spec.Ed25519.Test.test" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.IntroPure.fst", "name": "Pulse.Checker.Prover.IntroPure.is_host_var" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_is_null" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fsti", "name": "Vale.Math.Bits.bveq" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Const.fst", "name": "FStar.Reflection.Const.lte_qn" }, { "project_name": "steel", "file_name": "SteelTLArray.fst", "name": "SteelTLArray.l" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fsti", "name": "Steel.C.Typestring.solve_mk_string_t" }, { "project_name": "FStar", "file_name": "FStar.Fin.fsti", "name": "FStar.Fin.vect" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Base.fsti", "name": "Steel.ST.C.Types.Base.norm_field_steps" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.fst", "name": "Hacl.Spec.K256.Field52.is_felem_zero_vartime5" }, { "project_name": "Armada", "file_name": "Util.ImmutableArray.fsti", "name": "Util.ImmutableArray.for_all_array" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.is_tls_rgn" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.extract_cbs_forall_dep_contexts" } ], "selected_premises": [ "Steel.ST.GenElim.Base.is_fvar", "FStar.FunctionalExtensionality.feq", "FStar.Real.one", "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq", "FStar.Reflection.V2.Data.var", "FStar.List.Tot.Base.mem", "FStar.List.Tot.Base.map", "FStar.List.Tot.Base.op_At", "FStar.Reflection.V2.Derived.mk_e_app", "FStar.List.Tot.Base.length", "FStar.Real.two", "FStar.Reflection.V2.Derived.mk_app", "FStar.Reflection.V2.Derived.flatten_name", "FStar.List.Tot.Base.rev", "Steel.Memory.full_mem", "Steel.Effect.Common.extract_contexts", "Steel.Effect.Common.req", "FStar.Reflection.V2.Derived.is_fvar", "Steel.Preorder.pcm_history", "FStar.PCM.compatible", "FStar.String.length", "Steel.Memory.hmem", "Steel.FractionalPermission.full_perm", "Steel.Effect.Common.print_goals", "Steel.Effect.Common.star", "FStar.Reflection.V2.Derived.Lemmas.op_Less_Less_Colon", "FStar.Tactics.CanonCommMonoidSimple.Equiv.atom", "Steel.Effect.Common.atom", "Steel.FractionalPermission.sum_perm", "Steel.ST.Util.emp_inames", "FStar.PCM.composable", "FStar.FunctionalExtensionality.on_dom", "Steel.Effect.Common.hp_of", "Steel.Effect.Common.normal_steps", "Steel.Effect.Common.to_vprop", "FStar.PCM.op", "FStar.Reflection.V2.Derived.inspect_ln_unascribe", "FStar.Heap.trivial_preorder", "FStar.List.Tot.Base.append", "Steel.Preorder.history_val", "Steel.Effect.Common.to_vprop'", "Steel.FractionalPermission.comp_perm", "FStar.ST.op_Bang", "FStar.String.strlen", "Steel.Effect.Common.rmem", "FStar.List.Tot.Base.tl", "Steel.Memory.inames", "Steel.Effect.Common.rm", "Steel.Effect.Common.where_aux", "Steel.Effect.Common.all_guards_solved", "FStar.UInt.size", "Steel.Effect.Common.slterm_nbr_uvars_argv", "FStar.Pervasives.Native.fst", "FStar.List.Tot.Base.memP", "Steel.Effect.Common.visit_br", "Steel.Effect.Common.t_of", "FStar.List.Tot.Base.fold_left", "Steel.Effect.Common.visit_tm", "FStar.Reflection.Const.cons_qn", "Steel.Effect.Common.normal", "Steel.Effect.Common.normal_tac_steps", "Steel.Effect.Common.print_goal", "FStar.Tactics.CanonCommMonoidSimple.Equiv.where_aux", "Steel.Effect.Common.guard_vprop", "Steel.Effect.Common.my_assoc", "Steel.Effect.Common.solve_or_delay", "Steel.Effect.Common.sel_of", "FStar.Pervasives.Native.snd", "FStar.Reflection.V2.Derived.type_of_binder", "Steel.Preorder.vhist", "Steel.Effect.Common.vrefine'", "FStar.Sealed.Inhabited.seal", "Steel.ST.Util.op_At_Equals_Equals_Greater", "FStar.Reflection.V2.Derived.unsquash_term", "Steel.Effect.Common.unfold_guard", "FStar.List.Tot.Properties.assoc_mem", "Steel.Effect.Common.term_mem", "FStar.Reflection.Const.squash_qn", "Steel.Effect.Common.visit_comp", "FStar.Reflection.V2.Derived.shift_subst", "Steel.Effect.Common.bor", "FStar.NMSTTotal.get", "Steel.Effect.Common.bring_last_goal_on_top", "Steel.Effect.Common.canon'", "FStar.Reflection.V2.Derived.u_unk", "FStar.Reflection.V2.Derived.mk_stringlit", "Steel.Preorder.p_op", "Steel.Effect.Common.vprop_term_uvars", "Steel.Effect.Common.mk_rmem", "FStar.Reflection.V2.Data.ppname_t", "FStar.Tactics.CanonCommMonoidSimple.Equiv.sort", "FStar.Algebra.CommMonoid.Equiv.elim_eq_laws", "Steel.Effect.Common.bring_last_goal_on_top'", "Steel.Effect.Common.goal_to_equiv", "FStar.Reflection.V2.Derived.head", "Steel.Effect.Common.hmem", "FStar.Reflection.V2.Derived.is_any_fvar", "FStar.Real.zero", "Steel.Effect.Common.solve_all_eqs", "Steel.Effect.Common.is_star" ], "source_upto_this": "module Steel.ST.GenElim.Base\ninclude Steel.ST.Util\n\nmodule T = FStar.Tactics\n\nlet is_fvar = Reflection.is_fvar", "sketch": [ "The function is_any_fvar takes a term and a list of strings as input and checks if the term is a free variable with a name that matches any of the strings in the list.\n\nStep 1: Check if the term is a free variable.\nStep 2: If it is a free variable, check if its name matches any of the strings in the list.", "The function is_any_fvar takes a term t and a list of strings nms, and checks if t is a free variable with a name that matches any of the strings in nms.\n\nStep 1: We need to iterate through the list of strings nms and check if any of them match the name of the free variable in the term t.\nStep 2: We can implement this by using pattern matching to extract the name of the free variable in t, and then comparing it with each string in the list nms.", "The definition is about checking if a given term is a free variable with a specific name.\n\nThe implementation will involve checking if the given term is a free variable and then comparing its name with the provided list of names.", "The definition `is_any_fvar` takes a term `t` and a list of strings `nms`, and checks if the term is a free variable with any of the names in the list.\n\nStep 1: We will iterate through the list of strings and check if the term `t` is a free variable with any of the names in the list.\n\nStep 2: We will use a recursive function to iterate through the list of strings and check if the term `t` is a free variable with the current name. If it is, we return true; otherwise, we continue checking with the next name in the list. If none of the names match, we return false.", "The function is_any_fvar takes a term and a list of strings as input and checks if the term is a free variable with a name that matches any of the strings in the list.\n\nStep 1: Check if the term is a free variable.\nStep 2: If it is a free variable, compare its name with each string in the list and return true if there is a match.", "The function `is_any_fvar` takes a term `t` and a list of strings `nms`, and checks if the term is a free variable with a name that matches any of the strings in the list.\n\nStep 1: We need to iterate through the list of strings and check if the term `t` is a free variable with a matching name.\n\nStep 2: We will use a recursive function to iterate through the list of strings and check if the term `t` is a free variable with a matching name. If the list is empty, we return false. Otherwise, we check if the term `t` is a free variable with the current string, and if not, we recursively check the rest of the list.", "The definition is about checking if a given term is a free variable with a specific name.\n\nStep 1: We need to check if the given term is a free variable with a name that matches any of the names in the provided list.\n\nStep 2: We will iterate through the list of names and check if the given term is a free variable with any of those names.", "The definition is about checking if a given term is a free variable with a specific name.\n\nStep 1: We need to check if the given term is a free variable.\nStep 2: Then we need to compare the name of the free variable with the list of names provided.", "The definition is about checking if a given term is a free variable with a specific name.\n\nStep 1: We need to check if the given term is a free variable with a name that matches any of the names in the provided list.\n\nStep 2: To implement this, we will iterate through the list of names and check if the given term is a free variable with any of these names.", "The function is_any_fvar takes a term and a list of strings as input and checks if the term is a free variable with a name that matches any of the strings in the list.\n\nStep 1: Check if the term is a free variable.\nStep 2: If it is a free variable, compare its name with each string in the list and return true if there is a match." ], "generated_solution": [ "let is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n is_fvar t && List.exists (fun nm -> t.name = nm) nms", "let is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n let rec check_names (names: Prims.list Prims.string) (t: FStar.Stubs.Reflection.Types.term) : Prims.bool =\n match names with\n | [] -> false\n | nm::nms' ->\n match t with\n | FStar.Stubs.Reflection.Types.FreeVar(name) when name = nm -> true\n | _ -> check_names nms' t\n check_names nms t", "val is_any_fvar : t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool\nlet is_any_fvar t nms =\n is_fvar t && List.exists (fun nm -> t.name = nm) nms", "let rec is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n match nms with\n | [] -> false\n | nm::nms' -> if Reflection.is_fvar t nm then true else is_any_fvar t nms'", "let is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n is_fvar t && List.exists (fun nm -> t.name = nm) nms", "let rec is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n match nms with\n | [] -> false\n | nm::nms' -> if Reflection.is_fvar t nm then true else is_any_fvar t nms'", "val is_any_fvar : t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool", "val is_any_fvar : t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool", "val is_any_fvar : t: FStar.Stubs.Reflection.Types.term -> nms: Prims.list Prims.string -> Prims.bool", "let is_any_fvar (t: FStar.Stubs.Reflection.Types.term) (nms: Prims.list Prims.string) : Prims.bool =\n is_fvar t && List.exists (fun nm -> t.name = nm) nms" ] }, { "file_name": "OPLSS2021.Factorial.fst", "name": "OPLSS2021.Factorial.factorial", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "open": "OPLSS2021" }, { "open": "OPLSS2021" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val factorial (n: nat) : nat", "source_definition": "let rec factorial (n:nat)\n : nat\n = if n = 0 then 1 else n * factorial (n - 1)", "source_range": { "start_line": 4, "start_col": 0, "end_line": 6, "end_col": 46 }, "interleaved": false, "definition": "fun n ->\n (match n = 0 with\n | true -> 1\n | _ -> n * OPLSS2021.Factorial.factorial (n - 1))\n <:\n Prims.nat", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.nat", "Prims.op_Equality", "Prims.int", "Prims.bool", "FStar.Mul.op_Star", "OPLSS2021.Factorial.factorial", "Prims.op_Subtraction" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "n: Prims.nat -> Prims.nat", "prompt": "let rec factorial (n: nat) : nat =\n ", "expected_response": "if n = 0 then 1 else n * factorial (n - 1)", "source": { "project_name": "FStar", "file_name": "examples/oplss2021/OPLSS2021.Factorial.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS2021.Factorial.fst", "checked_file": "dataset/OPLSS2021.Factorial.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [], "closest": [ "val factorial (n: nat) : nat\nlet rec factorial (n:nat)\n : nat\n = if n = 0 then 1 else n * factorial (n - 1)", "val factorial (x: nat) : nat\nlet rec factorial (x:nat) : nat =\n match x with\n | 0 -> 1\n | _ -> x + factorial (x - 1)", "val factorial: nat -> pos\nlet rec factorial = function\n | 0 -> 1\n | n -> n * factorial (n - 1)", "val factorial_increasing (n: nat) : _: unit{factorial n >= n}\nlet rec factorial_increasing (n:nat)\n : _:unit{factorial n >= n}\n = if n <= 2 then ()\n else factorial_increasing (n - 1)", "val fact (n: nat) : Tot nat\nlet fact (n : nat) : Tot nat = fact_aux n 1", "val fib (n: nat) : nat\nlet rec fib (n:nat) : nat =\n if n <= 1 then 1\n else fib (n - 1) + fib (n - 2)", "val fib (n: nat) : nat\nlet rec fib (n:nat) : nat =\r\n if n <= 1 then 1\r\n else fib (n - 1) + fib (n - 2)", "val fib (n: nat) : nat\nlet rec fib (n:nat) : nat =\r\n if n <= 1 then 1\r\n else fib (n - 1) + fib (n - 2)", "val factorial_increasing_lemma (n: nat) : Lemma (factorial n >= n)\nlet rec factorial_increasing_lemma (n:nat)\n : Lemma (factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma (n - 1)", "val factorial_increasing_lemma' (n: int) : Lemma (requires n >= 0) (ensures factorial n >= n)\nlet rec factorial_increasing_lemma' (n:int)\n : Lemma \n (requires n >= 0)\n (ensures factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma' (n - 1)", "val sum (n: nat) : nat\nlet rec sum (n:nat)\r\n: nat\r\n= if n = 0 then 0 else n + sum (n - 1)", "val binomial_n (n:nat) : Lemma (binomial n n == 1)\nlet rec binomial_n n =\n match n with\n | 0 -> ()\n | _ -> binomial_lt n (n + 1); binomial_n (n - 1)", "val binomial_factorial (m n:nat) : Lemma (binomial (n + m) n * (!n * !m) == !(n + m))\nlet rec binomial_factorial m n =\n match m, n with\n | 0, _ -> binomial_n n\n | _, 0 -> ()\n | _ ->\n let open FStar.Math.Lemmas in\n let reorder1 (a b c d:int) : Lemma (a * (b * (c * d)) == c * (a * (b * d))) =\n assert (a * (b * (c * d)) == c * (a * (b * d))) by (FStar.Tactics.CanonCommSemiring.int_semiring())\n in\n let reorder2 (a b c d:int) : Lemma (a * ((b * c) * d) == b * (a * (c * d))) =\n assert (a * ((b * c) * d) == b * (a * (c * d))) by (FStar.Tactics.CanonCommSemiring.int_semiring())\n in\n calc (==) {\n binomial (n + m) n * (!n * !m);\n == { pascal (n + m - 1) n }\n (binomial (n + m - 1) n + binomial (n + m - 1) (n - 1)) * (!n * !m);\n == { addition_is_associative n m (-1) }\n (binomial (n + (m - 1)) n + binomial (n + (m - 1)) (n - 1)) * (!n * !m);\n == { distributivity_add_left (binomial (n + (m - 1)) n)\n (binomial (n + (m - 1)) (n - 1))\n (!n * !m)\n }\n binomial (n + (m - 1)) n * (!n * !m) +\n binomial (n + (m - 1)) (n - 1) * (!n * !m);\n == { }\n binomial (n + (m - 1)) n * (!n * (m * !(m - 1))) +\n binomial ((n - 1) + m) (n - 1) * ((n * !(n - 1)) * !m);\n == { reorder1 (binomial (n + (m - 1)) n) (!n) m (!(m - 1));\n reorder2 (binomial ((n - 1) + m) (n - 1)) n (!(n - 1)) (!m)\n }\n m * (binomial (n + (m - 1)) n * (!n * !(m - 1))) +\n n * (binomial ((n - 1) + m) (n - 1) * (!(n - 1) * !m));\n == { binomial_factorial (m - 1) n; binomial_factorial m (n - 1) }\n m * !(n + (m - 1)) + n * !((n - 1) + m);\n == { }\n m * !(n + m - 1) + n * !(n + m - 1);\n == { }\n n * !(n + m - 1) + m * !(n + m - 1);\n == { distributivity_add_left m n (!(n + m - 1)) }\n (n + m) * !(n + m - 1);\n == { }\n !(n + m);\n }", "val binomial (n k:nat) : nat\nlet rec binomial n k =\n match n, k with\n | _, 0 -> 1\n | 0, _ -> 0\n | _, _ -> binomial (n - 1) k + binomial (n - 1) (k - 1)", "val pow (x: int) (n: nat) : Tot int\nlet rec pow (x:int) (n:nat) : Tot int =\n if n = 0 then 1\n else x * pow x (n - 1)", "val fib0 (n: nat) : nat\nlet rec fib0 (n:nat) : nat =\n if n < 2 then n\n else fib0 (n-1) + fib0 (n-2)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val fact' (n: nat) (tr: list nat) : Tot (list nat * int)\nlet rec fact' (n : nat) (tr : list nat) : Tot (list nat * int) =\n synth_by_tactic #(nat -> list nat -> (list nat * int)) (fun () -> instrument fact) n tr", "val fact_aux (n acc: nat) : Tot nat\nlet rec fact_aux (n acc : nat) : Tot nat =\n if n = 0\n then acc\n else let acc' = acc `op_Multiply` n in fact_aux (n - 1) acc'", "val fac : nat -> Tot nat\nlet rec fac i = if i = 0 then 1 else op_Multiply (fac (i-1)) i", "val mul_nat (n1 n2: nat) : Tot nat\nlet mul_nat (n1:nat) (n2:nat) : Tot nat = n1 `op_Multiply` n2", "val pow2 (n: nat) : I int\nlet rec pow2 (n:nat) : I int\n = if n = 0 then 1 else pow2 (n-1) + pow2 (n-1)", "val pow2 (n: nat) : I int\nlet rec pow2 (n:nat) : I int\n = if n = 0 then 1 else pow2 (n-1) + pow2 (n-1)", "val monomial (n:nat) : poly\nlet monomial n = D.monomial n", "val fib (i: nat) : I nat\nlet rec fib (i:nat) : I nat =\n if i < 2\n then 1\n else let x = fib (i-1) in\n let y = fib (i-2) in\n x+y", "val fib (i: nat) : I nat\nlet rec fib (i:nat) : I nat =\n if i = 0 || i = 1\n then 1\n else let x = fib (i-1) in\n let y = fib (i-2) in\n x+y", "val fib (i: nat) : I nat\nlet rec fib (i:nat) : I nat =\n if i < 2\n then 1\n else let x = fib (i-1) in\n let y = fib (i-2) in\n x+y", "val monomial (n: nat) : poly\nlet monomial (n:nat) : poly = append (create n false) one", "val max (n m: nat) : nat\nlet max (n m:nat) : nat =\n if n > m then n else m", "val max (n m: nat) : nat\nlet max (n m:nat) : nat = if n >= m then n else m", "val triang (n: nat) : Tot nat\nlet rec triang (n : nat) : Tot nat =\n if n = 0 then 0 else n + triang (n - 1)", "val triang (n: nat) : Tot nat\nlet rec triang (n : nat) : Tot nat =\n if n = 0 then 0 else n + triang (n - 1)", "val powx : x:int -> n:nat -> Tot int\nlet rec powx x n =\n match n with\n | 0 -> 1\n | n -> x * powx x (n - 1)", "val abs (n: int) : nat\nlet abs (n:int) : nat = if n >= 0 then n else -n", "val fibl (i: nat) : I nat\nlet rec fibl (i:nat) : I nat =\n if i = 0 || i = 1\n then 1\n else fibl (i-1)", "val fibl (i: nat) : I nat\nlet rec fibl (i:nat) : I nat =\n if i = 0 || i = 1\n then 1\n else fibl (i-1)", "val pow2_n (#n: pos) (p: nat{p < n - 1}) : Tot (int_t n)\nlet pow2_n (#n:pos) (p:nat{p < n-1}) : Tot (int_t n) =\n pow2_le_compat (n - 2) p; pow2 p", "val fac_sum : nat -> nat -> Tot nat\nlet fac_sum n m = fac n + fac m", "val binomial_theorem (a b:int) (n:nat) : Lemma\n (pow (a + b) n == sum 0 n (fun i -> binomial n i * pow a (n - i) * pow b i))\nlet rec binomial_theorem a b n =\n if n = 0 then ()\n else\n if n = 1 then\n (binomial_n 1; binomial_0 1)\n else\n let reorder (a b c d:int) : Lemma (a + b + (c + d) == a + d + (b + c)) =\n assert (a + b + (c + d) == a + d + (b + c)) by (FStar.Tactics.CanonCommSemiring.int_semiring())\n in\n calc (==) {\n pow (a + b) n;\n == { }\n (a + b) * pow (a + b) (n - 1);\n == { distributivity_add_left a b (pow (a + b) (n - 1)) }\n a * pow (a + b) (n - 1) + b * pow (a + b) (n - 1);\n == { binomial_theorem a b (n - 1) }\n a * sum 0 (n - 1) (fun i -> binomial (n - 1) i * pow a (n - 1 - i) * pow b i) +\n b * sum 0 (n - 1) (fun i -> binomial (n - 1) i * pow a (n - 1 - i) * pow b i);\n == { sum_scale 0 (n - 1) (fun i -> binomial (n - 1) i * pow a (n - 1 - i) * pow b i) a;\n sum_scale 0 (n - 1) (fun i -> binomial (n - 1) i * pow a (n - 1 - i) * pow b i) b\n }\n sum 0 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) +\n sum 0 (n - 1) (fun i -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i));\n == { sum_first 0 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i));\n sum_last 0 (n - 1) (fun i -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i));\n sum_extensionality 1 (n - 1)\n (fun (i:nat{1 <= i /\\ i <= n - 1}) -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i))\n (fun (i:nat{0 <= i /\\ i <= n - 1}) -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i));\n sum_extensionality 0 (n - 2)\n (fun (i:nat{0 <= i /\\ i <= n - 2}) -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i))\n (fun (i:nat{0 <= i /\\ i <= n - 1}) -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i))}\n (a * (binomial (n - 0) 0 * pow a (n - 1 - 0) * pow b 0)) + sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) +\n (sum 0 (n - 2) (fun i -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) + b * (binomial (n - 1) (n - 1) * pow a (n - 1 - (n - 1)) * pow b (n - 1)));\n == { binomial_0 n; binomial_n (n - 1) }\n pow a n + sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) +\n (sum 0 (n - 2) (fun i -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) + pow b n);\n == { sum_shift 0 (n - 2) (fun i -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i));\n sum_extensionality 1 (n - 1)\n (fun (i:nat{1 <= i /\\ i <= n - 1}) -> (fun (i:nat{0 <= i /\\ i <= n - 2}) -> b * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) (i - 1))\n (fun (i:nat{1 <= i /\\ i <= n - 2 + 1}) -> b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1)))\n }\n pow a n + sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) +\n (sum 1 (n - 1) (fun i -> b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1))) + pow b n);\n == { reorder (pow a n)\n (sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)))\n (sum 1 (n - 2 + 1) (fun i -> b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1))))\n (pow b n)\n }\n a * pow a (n - 1) + b * pow b (n - 1) +\n (sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i)) +\n sum 1 (n - 1) (fun i -> b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1))));\n == { sum_add 1 (n - 1)\n (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i))\n (fun i -> b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1)))\n }\n pow a n + pow b n +\n (sum 1 (n - 1) (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i) +\n b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1))));\n\n == { Classical.forall_intro (binomial_theorem_aux a b n);\n sum_extensionality 1 (n - 1)\n (fun i -> a * (binomial (n - 1) i * pow a (n - 1 - i) * pow b i) +\n b * (binomial (n - 1) (i - 1) * pow a (n - 1 - (i - 1)) * pow b (i - 1)))\n (fun i -> binomial n i * pow a (n - i) * pow b i)\n }\n pow a n + pow b n + sum 1 (n - 1) (fun i -> binomial n i * pow a (n - i) * pow b i);\n == { }\n pow a n + (sum 1 (n - 1) (fun i -> binomial n i * pow a (n - i) * pow b i) + pow b n);\n == { binomial_0 n; binomial_n n }\n binomial n 0 * pow a (n - 0) * pow b 0 +\n (sum 1 (n - 1) (fun i -> binomial n i * pow a (n - i) * pow b i) +\n binomial n n * pow a (n - n) * pow b n);\n == { sum_first 0 n (fun i -> binomial n i * pow a (n - i) * pow b i);\n sum_last 1 n (fun i -> binomial n i * pow a (n - i) * pow b i);\n sum_extensionality 1 n\n (fun (i:nat{0 <= i /\\ i <= n}) -> binomial n i * pow a (n - i) * pow b i)\n (fun (i:nat{1 <= i /\\ i <= n}) -> binomial n i * pow a (n - i) * pow b i);\n sum_extensionality 1 (n - 1)\n (fun (i:nat{1 <= i /\\ i <= n}) -> binomial n i * pow a (n - i) * pow b i)\n (fun (i:nat{1 <= i /\\ i <= n - 1}) -> binomial n i * pow a (n - i) * pow b i)\n }\n sum 0 n (fun i -> binomial n i * pow a (n - i) * pow b i);\n }", "val add_nat (n1 n2: nat) : Tot nat\nlet add_nat (n1:nat) (n2:nat) : Tot nat = n1 + n2", "val ones (n: nat) : Tot (uint_t n)\nlet ones (n:nat) : Tot (uint_t n) = max_int n", "val fits (x: int) (n: nat) : Tot bool\nlet fits (x:int) (n:nat) : Tot bool = min_int n <= x && x <= max_int n", "val zero (n: nat) : Tot (uint_t n)\nlet zero (n:nat) : Tot (uint_t n) = 0", "val testnat (n: nat) : Tac nat\nlet testnat (n:nat) : Tac nat = 42", "val get_n1_exn (n: nat)\n : Exn (nat * nat)\n (requires n > 0)\n (ensures\n fun r ->\n match r with\n | None -> True\n | Some (n1, n2) -> n1 == n /\\ n2 == n + 1)\nlet get_n1_exn (n:nat)\n: Exn (nat * nat)\n (requires n > 0)\n (ensures fun r ->\n match r with\n | None -> True\n | Some (n1, n2) -> n1 == n /\\ n2 == n + 1)\n= EXN?.reflect (fun _ -> get_n1 n)", "val sum (n: nat) : LV nat (fun _ -> True) (fun _ _ _ -> True)\nlet rec sum (n:nat) : LV nat (fun _ -> True) (fun _ _ _ -> True)\n= if n = 0 then 0\n else\n let s = sum (n - 1) in //let binding is important, can't write 1 + sum (n - 1), see #881\n 1 + s", "val pow2_n (#n: pos) (p: nat{p < n}) : Tot (uint_t n)\nlet pow2_n (#n:pos) (p:nat{p < n}) : Tot (uint_t n) =\n pow2_le_compat (n - 1) p; pow2 p", "val f1 (n: int) (m: nat) : Pure nat (requires (n > 3)) (ensures (fun _ -> True))\nlet f1 (n : int) (m : nat) : Pure nat (requires (n > 3)) (ensures (fun _ -> True)) =\n m % (n - 3)", "val prod_even (n: int) : Lemma ((n * (n + 1)) % 2 == 0)\nlet prod_even (n : int) : Lemma ((n * (n + 1)) % 2 == 0) =\n (* z3 needs some help *)\n FStar.Math.Lemmas.lemma_mod_mul_distr_l n (n+1) 2", "val prod_even (n: int) : Lemma ((n * (n + 1)) % 2 == 0)\nlet prod_even (n : int) : Lemma ((n * (n + 1)) % 2 == 0) =\n (* z3 needs some help *)\n FStar.Math.Lemmas.lemma_mod_mul_distr_l n (n+1) 2", "val nat2unary (n: nat) : Tot unat\nlet rec nat2unary (n: nat) : Tot unat = if n = 0 then Z else S (nat2unary (n - 1))", "val recursive_tac (n: nat) : Tac unit\nlet rec recursive_tac (n:nat) : Tac unit =\n if n = 0\n then ()\n else recursive_tac (n - 1)", "val power (a: poly) (n: nat) : poly\nlet rec power (a:poly) (n:nat) : poly =\n if n = 0 then one else a *. power a (n - 1)", "val size (x: int) (n: nat) : Tot Type0\nlet size (x:int) (n:nat) : Tot Type0 = b2t(fits x n)", "val mult : nat -> nat -> Tot nat\nlet rec mult n m =\n match n with\n | O -> O\n | S n' -> plus m (mult n' m)", "val max_int (n: nat) : Tot int\nlet max_int (n:nat) : Tot int = pow2 n - 1", "val point (n: nat) : range\nlet point (n:nat) : range = (n,n)", "val repeat_gen:\n n:nat\n -> a:(i:nat{i <= n} -> Type)\n -> f:(i:nat{i < n} -> a i -> a (i + 1))\n -> acc0:a 0\n -> a n\nlet repeat_gen n a f acc0 =\n repeat_right 0 n a f acc0", "val nat2unary (n: nat) : unary_nat\nlet rec nat2unary (n: nat) : unary_nat = \n if n = 0 then U0 else US (nat2unary (n - 1))", "val ones (n:nat) : poly\nlet ones n = of_fun n (fun (i:nat) -> true)", "val f3 (x: nat) : nat\nlet f3 (x : nat) : nat =\n 2 * x", "val log256' (n: nat)\n : Pure integer_size\n (requires (n > 0 /\\ n < 4294967296))\n (ensures\n (fun l -> pow2 (FStar.Mul.op_Star 8 (l - 1)) <= n /\\ n < pow2 (FStar.Mul.op_Star 8 l)))\nlet log256'\n (n: nat)\n: Pure integer_size\n (requires (n > 0 /\\ n < 4294967296))\n (ensures (fun l ->\n pow2 (FStar.Mul.op_Star 8 (l - 1)) <= n /\\\n n < pow2 (FStar.Mul.op_Star 8 l)\n ))\n= [@inline_let]\n let _ = assert_norm (pow2 32 == 4294967296) in\n [@inline_let]\n let _ = assert (n < pow2 32) in\n [@inline_let]\n let z0 = 1 in\n [@inline_let]\n let z1 = 256 in\n [@inline_let]\n let _ = assert_norm (z1 == Prims.op_Multiply 256 z0) in\n [@inline_let]\n let l = 1 in\n [@inline_let]\n let _ = assert_norm (pow2 (Prims.op_Multiply 8 l) == z1) in\n [@inline_let]\n let _ = assert_norm (pow2 (Prims.op_Multiply 8 (l - 1)) == z0) in\n if n < z1\n then begin\n [@inline_let]\n let _ = assert (pow2 (Prims.op_Multiply 8 (l - 1)) <= n) in\n [@inline_let]\n let _ = assert (n < pow2 (Prims.op_Multiply 8 l)) in\n l\n end else begin\n [@inline_let]\n let z2 = 65536 in\n [@inline_let]\n let _ = assert_norm (z2 == Prims.op_Multiply 256 z1) in\n [@inline_let]\n let l = 2 in\n [@inline_let]\n let _ = assert_norm (pow2 (Prims.op_Multiply 8 l) == z2) in\n if n < z2\n then begin\n [@inline_let]\n let _ = assert (pow2 (Prims.op_Multiply 8 (l - 1)) <= n) in\n [@inline_let]\n let _ = assert (n < pow2 (Prims.op_Multiply 8 l)) in\n l\n end else begin\n [@inline_let]\n let z3 = 16777216 in\n [@inline_let]\n let _ = assert_norm (z3 == Prims.op_Multiply 256 z2) in\n [@inline_let]\n let l = 3 in\n [@inline_let]\n let _ = assert_norm (pow2 (Prims.op_Multiply 8 l) == z3) in\n if n < z3\n then begin\n [@inline_let]\n\tlet _ = assert (pow2 (Prims.op_Multiply 8 (l - 1)) <= n) in\n [@inline_let]\n\tlet _ = assert (n < pow2 (Prims.op_Multiply 8 l)) in\n l \n end else begin\n [@inline_let]\n let l = 4 in\n [@inline_let]\n let _ = assert_norm (pow2 (Prims.op_Multiply 8 l) == Prims.op_Multiply 256 z3) in\n [@inline_let]\n\tlet _ = assert (pow2 (Prims.op_Multiply 8 (l - 1)) <= n) in\n [@inline_let]\n\tlet _ = assert (n < pow2 (Prims.op_Multiply 8 l)) in\n l\n end\n end\n end", "val FStar.Fin.vect = n: Prims.nat -> a: Type -> Type\nlet vect (n: nat) (a: Type) = l: list a {L.length l = n}", "val triang_aux (n: pos) : Lemma (n + ((n - 1) * n) / 2 == (n * (n + 1)) / 2)\nlet triang_aux (n : pos) : Lemma (n + ((n-1) * n) / 2 == (n*(n+1)) / 2) =\n calc (==) {\n n + ((n-1) * n) / 2;\n == { FStar.Math.Lemmas.lemma_div_plus ((n-1)*n) 2 n }\n ((n-1) * n + n * 2) / 2;\n == { FStar.Math.Lemmas.swap_mul n (n-1);\n FStar.Math.Lemmas.distributivity_add_right n (n-1) 2 }\n (n * (n+1)) / 2;\n }", "val f4 (n: int{n % 2 = 0}) : Tot (n': int{n' % 2 = 0})\nlet f4 (n : int{n % 2 = 0}) : Tot (n':int{n' % 2 = 0}) =\n n + 2", "val pow2_nine (c0 c1 c2 c3 c4 c5 c6 c7 c8: nat) : nat\nlet pow2_nine (c0 c1 c2 c3 c4 c5 c6 c7 c8:nat) : nat = pow2_eight c0 c1 c2 c3 c4 c5 c6 c7 + pow2_512 * c8", "val pow (#t: Type) (k: comm_monoid t) (x: t) (n: nat) : t\nlet rec pow (#t:Type) (k:comm_monoid t) (x:t) (n:nat) : t =\n if n = 0 then one\n else mul x (pow k x (n - 1))", "val funfold\n (p fp: (nat -> vprop))\n (ss: (i: nat -> stt_ghost unit (fp (i + 1)) (fun () -> p i ** fp i)))\n (n: nat)\n : stt unit (fp n) (fun _ -> fp 0 ** range p 0 n)\nlet funfold\n (p : (nat -> vprop))\n (fp : (nat -> vprop))\n (ss : (i:nat -> stt_ghost unit (fp (i+1)) (fun () -> p i ** fp i)))\n : (n:nat) -> stt unit (fp n) (fun _ -> fp 0 ** range p 0 n)\n = fix_stt_1 (__funfold p fp ss)", "val count (n: nat) : ID int (as_pure_wp (fun p -> forall r. p r))\nlet rec count (n:nat) : ID int (as_pure_wp (fun p -> forall r. p r)) =\n if n = 0 then 0 else count (n-1)", "val prime:nat\nlet prime:nat = 57896044618658097711785492504343953926634992332820282019728792003956564819949", "val puresum (#st: _) (n: nat) : EFF int st st []\nlet puresum #st (n:nat)\n : EFF int st st []\n = let (x, _) = catchST (fun () -> sumn 42) 0 in x", "val log2: n:nat{n > 0} -> GTot (c:nat{pow2 c <= n && n < pow2 (c+1)})\nlet rec log2 n =\n if n = 1 then 0\n else 1 + log2 (n / 2)", "val gauss (n: nat) : Lemma (triang n == (n * (n + 1)) / 2)\nlet rec gauss (n : nat) : Lemma (triang n == (n * (n + 1)) / 2) =\n if n <> 0 then (\n gauss (n-1);\n triang_aux n\n )", "val ones (n: pos) : Tot (int_t n)\nlet ones (n:pos) : Tot (int_t n) = -1", "val embed_nat_int (n: nat) : int\nlet embed_nat_int (n:nat) : int = n", "val labs (#i: _) (n: int) : Gtd nat i\nlet labs #i (n:int) : Gtd nat i =\n if n < 0\n then -n\n else n", "val reverse (p:poly) (n:nat) : poly\nlet reverse p n = D.reverse p n", "val sumn (#st: _) (n: nat) : EFF int st int [RD; WR]\nlet sumn #st (n:nat) : EFF int st int [RD;WR] =\n put 0;\n aux n;\n get ()", "val min_int (n: nat) : Tot int\nlet min_int (n:nat) : Tot int = 0", "val one (n: pos{1 < n}) : Tot (int_t n)\nlet one (n:pos{1 < n}) : Tot (int_t n) = 1", "val size (n: size_nat) : size_t\nlet size (n:size_nat) : size_t = uint #U32 #PUB n", "val create: n:nat -> init:'a -> Tot (seq 'a)\nlet create n init = Seq (Const init) 0 n", "val labs (#i: _) (n: int) : GTD nat i\nlet labs #i (n:int) : GTD nat i =\n if n < 0\n then -n\n else n", "val binomial_lt (n:nat) (k:nat{n < k}) : Lemma (binomial n k = 0)\nlet rec binomial_lt n k =\n match n, k with\n | _, 0 -> ()\n | 0, _ -> ()\n | _ -> binomial_lt (n - 1) k; binomial_lt (n - 1) (k - 1)", "val mul_nats (x y: nat) : nat\nlet mul_nats (x y:nat) : nat =\n let prod = x * y in\n Vale.Curve25519.Fast_lemmas_internal.lemma_mul_bounds_le 0 x 0 y;\n prod", "val nat_t_of_nat (n: nat) : Type0\nlet rec nat_t_of_nat (n: nat): Type0 =\n match n with\n | 0 -> z\n | n -> s (nat_t_of_nat (n - 1))", "val nat_t_of_nat (n: nat) : Type0\nlet rec nat_t_of_nat (n: nat): Type0 =\n match n with\n | 0 -> z\n | n -> s (nat_t_of_nat (n - 1))", "val g_power (a:poly) (n:nat) : poly\nlet rec g_power (a:poly) (n:nat) : poly =\n if n = 0 then zero else // arbitrary value for n = 0\n if n = 1 then a else\n a *~ g_power a (n - 1)", "val g_power (a:poly) (n:nat) : poly\nlet rec g_power (a:poly) (n:nat) : poly =\n if n = 0 then zero else // arbitrary value for n = 0\n if n = 1 then a else\n a *~ g_power a (n - 1)", "val min0 (i: int) : Tot (n : nat)\nlet min0 (i:int) : Tot (n:nat) = if i >= 0 then i else 0", "val sum_spec (n: nat) : GTot nat\nlet rec sum_spec (n:nat) : GTot nat =\r\n if n = 0 then 0 else n + sum_spec (n - 1)", "val v (x:t) : Tot (int_t n)\nlet v x = x.v", "val v (x:t) : Tot (int_t n)\nlet v x = x.v", "val v (x:t) : Tot (int_t n)\nlet v x = x.v", "val v (x:t) : Tot (int_t n)\nlet v x = x.v", "val v (x:t) : Tot (int_t n)\nlet v x = x.v", "val multiply (x y: nat) : z: nat{z == x * y}\nlet rec multiply (x y:nat) : z:nat { z == x * y} =\n if x = 0 then 0\n else multiply (x - 1) y + y", "val sum_pow_seq (#n: nat) (s: seq (natN n)) : int\nlet sum_pow_seq (#n:nat) (s:seq (natN n)) : int =\n sum_pow_seq_left s (length s)" ], "closest_src": [ { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.factorial" }, { "project_name": "FStar", "file_name": "ErrorMsg.fst", "name": "ErrorMsg.factorial" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.factorial" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.factorial_increasing" }, { "project_name": "FStar", "file_name": "Trace.fst", "name": "Trace.fact" }, { "project_name": "steel", "file_name": "Fibo32.fst", "name": "Fibo32.fib" }, { "project_name": "steel", "file_name": "PulseTutorial.Loops.fst", "name": "PulseTutorial.Loops.fib" }, { "project_name": "steel", "file_name": "Fibonacci.fst", "name": "Fibonacci.fib" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.factorial_increasing_lemma" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.factorial_increasing_lemma'" }, { "project_name": "steel", "file_name": "PulseTutorial.Loops.fst", "name": "PulseTutorial.Loops.sum" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.binomial_n" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.binomial_factorial" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.binomial" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fsti", "name": "Lib.NatMod.pow" }, { "project_name": "steel", "file_name": "Bug45.fst", "name": "Bug45.fib0" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.count" }, { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.count" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.count" }, { "project_name": "FStar", "file_name": "Trace.fst", "name": "Trace.fact'" }, { "project_name": "FStar", "file_name": "Trace.fst", "name": "Trace.fact_aux" }, { "project_name": "FStar", "file_name": "Recursive.fst", "name": "Recursive.fac" }, { "project_name": "FStar", "file_name": "StackMachine.fst", "name": "StackMachine.mul_nat" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.pow2" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.pow2" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2_s.fst", "name": "Vale.Math.Poly2_s.monomial" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.fib" }, { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.fib" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.fib" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs_s.fst", "name": "Vale.Math.Poly2.Defs_s.monomial" }, { "project_name": "FStar", "file_name": "NatHeap.fsti", "name": "NatHeap.max" }, { "project_name": "steel", "file_name": "Steel.Stepper.fst", "name": "Steel.Stepper.max" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.triang" }, { "project_name": "FStar", "file_name": "Hybrid.fst", "name": "Hybrid.triang" }, { "project_name": "FStar", "file_name": "FStar.Math.Lib.fst", "name": "FStar.Math.Lib.powx" }, { "project_name": "steel", "file_name": "Steel.Stepper.fst", "name": "Steel.Stepper.abs" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.fibl" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.fibl" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.pow2_n" }, { "project_name": "FStar", "file_name": "Recursive.fst", "name": "Recursive.fac_sum" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.binomial_theorem" }, { "project_name": "FStar", "file_name": "StackMachine.fst", "name": "StackMachine.add_nat" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.ones" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.fits" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.zero" }, { "project_name": "FStar", "file_name": "UnitTests.fst", "name": "UnitTests.testnat" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.get_n1_exn" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.sum" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.pow2_n" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Tutorial.Definitions.fst", "name": "FStar.InteractiveHelpers.Tutorial.Definitions.f1" }, { "project_name": "FStar", "file_name": "Hybrid.fst", "name": "Hybrid.prod_even" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.prod_even" }, { "project_name": "FStar", "file_name": "Even.fst", "name": "Even.nat2unary" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.recursive_tac" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fsti", "name": "Vale.Math.Poly2.power" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.size" }, { "project_name": "FStar", "file_name": "SfBasic.fst", "name": "SfBasic.mult" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.max_int" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Range.fst", "name": "MiTLS.Range.point" }, { "project_name": "hacl-star", "file_name": "Lib.LoopCombinators.fst", "name": "Lib.LoopCombinators.repeat_gen" }, { "project_name": "FStar", "file_name": "Evens.fst", "name": "Evens.nat2unary" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.ones" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Tutorial.Definitions.fst", "name": "FStar.InteractiveHelpers.Tutorial.Definitions.f3" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BoundedInt.fsti", "name": "LowParse.Spec.BoundedInt.log256'" }, { "project_name": "FStar", "file_name": "FStar.Fin.fsti", "name": "FStar.Fin.vect" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.triang_aux" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Tutorial.Definitions.fst", "name": "FStar.InteractiveHelpers.Tutorial.Definitions.f4" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.Fast_defs.fst", "name": "Vale.Curve25519.Fast_defs.pow2_nine" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.Definition.fsti", "name": "Lib.Exponentiation.Definition.pow" }, { "project_name": "steel", "file_name": "ParallelFor.fst", "name": "ParallelFor.funfold" }, { "project_name": "FStar", "file_name": "ID2.fst", "name": "ID2.count" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.Fast_defs.fst", "name": "Vale.Curve25519.Fast_defs.prime" }, { "project_name": "FStar", "file_name": "RunST.fst", "name": "RunST.puresum" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.log2" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.gauss" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.ones" }, { "project_name": "FStar", "file_name": "FStar.Algebra.Monoid.fst", "name": "FStar.Algebra.Monoid.embed_nat_int" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.labs" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2_s.fst", "name": "Vale.Math.Poly2_s.reverse" }, { "project_name": "FStar", "file_name": "RunST.fst", "name": "RunST.sumn" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.min_int" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.one" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.fsti", "name": "Lib.IntTypes.size" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.create" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.labs" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.binomial_lt" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.Fast_defs.fst", "name": "Vale.Curve25519.Fast_defs.mul_nats" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fsti", "name": "Pulse.C.Typenat.nat_t_of_nat" }, { "project_name": "steel", "file_name": "Steel.C.Typenat.fsti", "name": "Steel.C.Typenat.nat_t_of_nat" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash.fst", "name": "Vale.AES.GHash.g_power" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fst", "name": "Vale.AES.GHash_BE.g_power" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Range.fst", "name": "MiTLS.Range.min0" }, { "project_name": "steel", "file_name": "CustomSyntax.fst", "name": "CustomSyntax.sum_spec" }, { "project_name": "FStar", "file_name": "FStar.Int64.fst", "name": "FStar.Int64.v" }, { "project_name": "FStar", "file_name": "FStar.Int32.fst", "name": "FStar.Int32.v" }, { "project_name": "FStar", "file_name": "FStar.Int128.fst", "name": "FStar.Int128.v" }, { "project_name": "FStar", "file_name": "FStar.Int8.fst", "name": "FStar.Int8.v" }, { "project_name": "FStar", "file_name": "FStar.Int16.fst", "name": "FStar.Int16.v" }, { "project_name": "steel", "file_name": "Demo.MultiplyByRepeatedAddition.fst", "name": "Demo.MultiplyByRepeatedAddition.multiply" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fsti", "name": "Vale.Bignum.Defs.sum_pow_seq" } ], "selected_premises": [ "FStar.Mul.op_Star", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.ex_pre", "Prims.as_requires", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_if_then_else", "Prims.pure_trivial", "FStar.Pervasives.all_trivial", "FStar.Pervasives.all_ite_wp", "Prims.pure_wp'", "FStar.Pervasives.ex_return", "FStar.Pervasives.div_hoare_to_wp", "Prims.pure_wp_monotonic", "FStar.Pervasives.ex_trivial", "Prims.pure_wp_monotonic0", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.ex_post'", "Prims.purewp_id", "Prims.pure_post", "FStar.Pervasives.all_post_h'", "Prims.pure_post'", "Prims.pure_wp", "FStar.Pervasives.ex_ite_wp", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.ex_post", "FStar.Pervasives.lift_div_exn", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.all_post_h", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.all_stronger", "Prims.auto_squash", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.pure_return", "FStar.Pervasives.st_ite_wp", "Prims.as_ensures", "FStar.Pervasives.st_post_h", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.all_return", "Prims.pure_pre", "Prims.pure_stronger", "Prims.abs", "FStar.Pervasives.st_post_h'", "Prims.min", "Prims.returnM", "FStar.Pervasives.st_return", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.st_trivial", "FStar.Pervasives.st_pre_h", "Prims.__cache_version_number__", "Prims.pow2", "FStar.Pervasives.id", "FStar.Pervasives.st_stronger", "Prims.subtype_of", "FStar.Pervasives.st_wp_h", "Prims.l_True", "Prims.op_Hat", "Prims.l_False" ], "source_upto_this": "module OPLSS2021.Factorial\nopen FStar.Mul\n", "sketch": [ "Step 1: The definition calculates the factorial of a given natural number.\nStep 2: The factorial function is implemented using recursion to multiply the given number with the factorial of the previous number until the base case of 0 is reached.", "Step 1: The factorial function takes a natural number n as input and calculates the product of all positive integers up to n.\nStep 2: To implement the factorial function, we will use a recursive approach where the base case is when n is 0, in which case the result is 1. For n greater than 0, we will recursively call the factorial function with n-1 and multiply the result by n.", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number n.\nStep 2: The definition is implemented using a recursive approach, where the base case is when n is 0, and the recursive case multiplies n with the factorial of n-1.", "Step 1: The factorial function takes a natural number n as input and returns the factorial of n.\nStep 2: We will implement the factorial function using a recursive approach, where the base case is when n is 0, and the recursive case multiplies n with the factorial of (n-1).", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number n.\nStep 2: The definition is implemented using a recursive approach, where the base case is when n is 0, in which case the result is 1. Otherwise, the factorial of n is calculated by multiplying n with the factorial of (n-1).", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number n.\nStep 2: The definition is implemented using a recursive approach, where the base case is when n is 0, and the recursive case multiplies n with the factorial of (n-1).", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number.\nStep 2: The definition is implemented using a recursive approach, where the base case is when the input is 0, and the recursive case multiplies the current number with the factorial of the previous number.", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number.\nStep 2: The factorial function can be implemented using recursion, where the base case is when the input is 0, and the recursive case multiplies the current number with the factorial of the previous number.", "Step 1: The definition of `factorial` is a function that takes a natural number `n` as input and returns the factorial of `n`.\nStep 2: The `factorial` function can be implemented using a recursive approach, where the base case is when `n` is 0, and the recursive case multiplies `n` with the factorial of `n-1`.", "Step 1: The definition of the factorial function is about calculating the product of all positive integers up to a given number.\nStep 2: The definition is implemented using a recursive approach, where the base case is when the input is 0, and the recursive case multiplies the current number with the factorial of the previous number." ], "generated_solution": [ "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * (factorial (n - 1))", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * (factorial (n - 1))", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * (factorial (n - 1))", "let rec factorial (n: nat) : nat =\n if n = 0 then 1\n else n * factorial (n - 1)" ] }, { "file_name": "Vale.Def.Words_s.fsti", "name": "Vale.Def.Words_s.nat4", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "open": "Vale.Def" }, { "open": "Vale.Def" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "", "source_definition": "let nat4 = natN pow2_4", "source_range": { "start_line": 34, "start_col": 0, "end_line": 34, "end_col": 22 }, "interleaved": false, "definition": "Vale.Def.Words_s.natN Vale.Def.Words_s.pow2_4", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Vale.Def.Words_s.natN", "Vale.Def.Words_s.pow2_4" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "Type0", "prompt": "let nat4 =\n ", "expected_response": "natN pow2_4", "source": { "project_name": "hacl-star", "file_name": "vale/specs/defs/Vale.Def.Words_s.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.Def.Words_s.fsti", "checked_file": "dataset/Vale.Def.Words_s.fsti.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [ "", "", "", "two", "two", "lo", "lo", "hi", "hi", "four", "four", "lo0", "lo0", "lo1", "lo1", "hi2", "hi2", "hi3", "hi3", "eight", "eight", "lo_0", "lo_0", "lo_1", "lo_1", "lo_2", "lo_2", "lo_3", "lo_3", "hi_4", "hi_4", "hi_5", "hi_5", "hi_6", "hi_6", "hi_7", "hi_7", "let pow2_norm (n:nat) = normalize_term (pow2 n)", "let pow2_1 = 0x2", "let pow2_2 = 0x4", "let pow2_4 = 0x10", "let pow2_8 = 0x100", "let pow2_16 = 0x10000", "let pow2_32 = 0x100000000", "let pow2_64 = 0x10000000000000000", "let pow2_128 = 0x100000000000000000000000000000000", "let natN (n:nat) = x:nat{x < n}", "let nat1 = natN pow2_1", "let nat2 = natN pow2_2" ], "closest": [ "val Lib.NatMod.prime = Type0\nlet prime = m:pos{1 < m /\\ Euclid.is_prime m}", "val Hacl.Spec.BignumQ.Definitions.nat5 = Type0\nlet nat5 = (nat & nat & nat & nat & nat)", "val Vale.Def.Prop_s.prop0 = Type\nlet prop0 = Type0", "val Hacl.Spec.BignumQ.Definitions.nat10 = Type0\nlet nat10 = (nat & nat & nat & nat & nat & nat & nat & nat & nat & nat)", "val Hacl.Spec.K256.Field52.Definitions.nat5 = Type0\nlet nat5 = nat & nat & nat & nat & nat", "val Hacl.Spec.Poly1305.Field32xN.nat5 = Type0\nlet nat5 = (nat & nat & nat & nat & nat)", "val Vale.Math.Poly2.Defs_s.poly = Type0\nlet poly = s:(seq bool){valid s}", "val FStar.Integers.nat = Type0\nlet nat = i:int{ i >= 0 }", "val decl:Type0\nlet decl : Type0 = either not_type_decl type_decl", "val Pulse.Syntax.Base.nvar = Type0\nlet nvar = ppname & var", "val Hacl.Spec.Curve25519.Field51.Definition.nat5 = Type0\nlet nat5 = (nat * nat * nat * nat * nat)", "val t : Type0\nlet t = t", "val t : Type0\nlet t = bool & bool", "val t : Type0\nlet t = G.ref _ pcm", "val aref: Type0\nlet aref = aref'", "val cr: Type0\nlet cr: Type0 = unit", "val cr: Type0\nlet cr: Type0 = unit", "val co: Type0\nlet co: Type0 = unit", "val co: Type0\nlet co: Type0 = unit", "val Mem.rgn = Type0\nlet rgn = r:erid{r =!= root}", "val Interop.arity = Type0\nlet arity = n:nat { n <= max_arity }", "val env : Type0\nlet env = H.t A.ident' type_decl", "val Lib.NatMod.nat_mod = m: Prims.pos -> Type0\nlet nat_mod (m:pos) = n:nat{n < m}", "val ch: Type0\nlet ch: Type0 = unit", "val ch: Type0\nlet ch: Type0 = unit", "val c0: Type0\nlet c0: Type0 = unit", "val c0: Type0\nlet c0: Type0 = unit", "val zero:nat\nlet zero : nat = 0", "val cf: Type0\nlet cf: Type0 = unit", "val cf: Type0\nlet cf: Type0 = unit", "val Zeta.Steel.Rel.s_dval = Type0\nlet s_dval = option value_type", "val Zeta.Steel.Rel.s_mval = Type0\nlet s_mval = T.mval_value", "val Interop.ireg = Type0\nlet ireg = n:pos{ n <= 4 }", "val Hacl.Streaming.Blake2.Common.size_nat = Type0\nlet size_nat = Lib.IntTypes.size_nat", "val Hacl.Blake2b_32.size_nat = Type0\nlet size_nat = n:nat { n <= pow2 32 - 1 }", "val ca: Type0\nlet ca: Type0 = unit", "val ca: Type0\nlet ca: Type0 = unit", "val Hacl.Blake2b_256.size_nat = Type0\nlet size_nat = n:nat { n <= pow2 32 - 1 }", "val Lib.NTuple.flen = Type0\nlet flen = size_pos", "val Zeta.Steel.Rel.s_val = Type0\nlet s_val = T.value", "val OPLSS2021.Basic.nat = Type0\nlet nat = x:int{ x >= 0 }", "val ci: Type0\nlet ci: Type0 = unit", "val ci: Type0\nlet ci: Type0 = unit", "val cW: Type0\nlet cW: Type0 = unit", "val cW: Type0\nlet cW: Type0 = unit", "val s: Type0 -> Type0\nlet s _ = unit", "val s: Type0 -> Type0\nlet s _ = unit", "val c1: Type0\nlet c1: Type0 = unit", "val c1: Type0\nlet c1: Type0 = unit", "val cl: Type0\nlet cl: Type0 = unit", "val cl: Type0\nlet cl: Type0 = unit", "val AlgWP.rwops = Type0\nlet rwops = labs:ops{sublist labs [Read; Write]}", "val z: Type0\nlet z = unit", "val z: Type0\nlet z = unit", "val Zeta.Steel.Rel.i_mval = Type0\nlet i_mval = M.value", "val Hacl.K256.Scalar.qelem4 = Type0\nlet qelem4 = uint64 & uint64 & uint64 & uint64", "val Hacl.K256.Field.felem = Type0\nlet felem = lbuffer uint64 nlimb", "val Sec2.IFC.lref = Type0\nlet lref = ref low", "val for_you:Type0\nlet for_you : Type0 = synth_by_tactic (fun () -> big_phi 8)", "val loc : Type0\nlet loc = MG.loc cls", "val c4: Type0\nlet c4: Type0 = unit", "val c4: Type0\nlet c4: Type0 = unit", "val cV: Type0\nlet cV: Type0 = unit", "val cV: Type0\nlet cV: Type0 = unit", "val Sec2.HIFC.triple = Type0\nlet triple = label & label & flows", "val cu: Type0\nlet cu: Type0 = unit", "val cu: Type0\nlet cu: Type0 = unit", "val cS: Type0\nlet cS: Type0 = unit", "val cS: Type0\nlet cS: Type0 = unit", "val c_: Type0\nlet c_: Type0 = unit", "val c_: Type0\nlet c_: Type0 = unit", "val Hacl.Impl.P256.Bignum.widefelem = Type0\nlet widefelem = lbuffer uint64 (size 8)", "val t (a:Type0) : Type0\nlet t a = list a", "val Sec2.IFC.triple = Type0\nlet triple = label & label & flows", "val Lib.UpdateMulti.Lemmas.uint8 = Type0\nlet uint8 = Lib.IntTypes.uint8", "val pow_t0:nat\nlet pow_t0:nat =\n assert_norm (pow2 255 - pow2 5 > 0);\n pow2 255 - pow2 5", "val Ast.subst = Type0\nlet subst = H.t ident' expr", "val Pulse.Syntax.Naming.subst = Type0\nlet subst = list subst_elt", "val Sec2.HIFC.lref = Type0\nlet lref = ref low", "val HaclExample2.twenty = Type0\nlet twenty = normalize (nat_t_of_nat 20)", "val Hacl.Impl.P256.Bignum.felem = Type0\nlet felem = lbuffer uint64 (size 4)", "val Hacl.Spec.BignumQ.Definitions.qelem5 = Type0\nlet qelem5 = (uint64 & uint64 & uint64 & uint64 & uint64)", "val vstore:Type0\nlet vstore\r\n : Type0\r\n = a:A.array (option M.store_entry) {\r\n A.length a == U16.v store_size\r\n }", "val Zeta.Steel.Rel.i_dval = Type0\nlet i_dval = app_value_nullable app.adm", "val cC: Type0\nlet cC: Type0 = unit", "val cC: Type0\nlet cC: Type0 = unit", "val Lib.ByteSequence.bytes = Type0\nlet bytes = bytes_l SEC", "val Pulse.Syntax.Base.var = Type0\nlet var = nat", "val Hacl.Spec.Bignum.Definitions.limb_t = Type0\nlet limb_t = t:inttype{t = U32 \\/ t = U64}", "val Zeta.Steel.BitUtils.bv_t = n: Prims.nat -> Type0\nlet bv_t = FStar.BitVector.bv_t", "val Lib.IntVector.v_inttype = Type0\nlet v_inttype = t:inttype{unsigned t /\\ ~(U1? t)}", "val HaclExample.twenty = Type0\nlet twenty = normalize (nat_t_of_nat 20)", "val Hacl.Bignum.Definitions.limb_t = Type0\nlet limb_t = S.limb_t", "val ce: Type0\nlet ce: Type0 = unit", "val ce: Type0\nlet ce: Type0 = unit", "val Hacl.Spec.BignumQ.Definitions.qelem_wide5 = Type0\nlet qelem_wide5 = (uint64 & uint64 & uint64 & uint64 & uint64 & uint64 & uint64 & uint64 & uint64 & uint64)", "val fall (n: mynat) : Tot mynat\nlet rec fall (n : mynat) : Tot mynat =\n match n with\n | Z -> Z\n | S n -> fall n", "val Hacl.Spec.K256.Field52.Definitions.felem4 = Type0\nlet felem4 = uint64 & uint64 & uint64 & uint64", "val DependentBoolRefinement.var = Type0\nlet var = nat", "val string_nil: Type0\nlet string_nil: Type0 = unit" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Lib.NatMod.fsti", "name": "Lib.NatMod.prime" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Definitions.fst", "name": "Hacl.Spec.BignumQ.Definitions.nat5" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Prop_s.fst", "name": "Vale.Def.Prop_s.prop0" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Definitions.fst", "name": "Hacl.Spec.BignumQ.Definitions.nat10" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Definitions.fst", "name": "Hacl.Spec.K256.Field52.Definitions.nat5" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Poly1305.Field32xN.fst", "name": "Hacl.Spec.Poly1305.Field32xN.nat5" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs_s.fst", "name": "Vale.Math.Poly2.Defs_s.poly" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.nat" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fsti", "name": "InterpreterTarget.decl" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.nvar" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Field51.Definition.fst", "name": "Hacl.Spec.Curve25519.Field51.Definition.nat5" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.All.fst", "name": "EverParse3d.InputStream.All.t" }, { "project_name": "dice-star", "file_name": "HWState.fst", "name": "HWState.t" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadLogMap.fst", "name": "Zeta.Steel.ThreadLogMap.t" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.aref" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cr" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cr" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.co" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.co" }, { "project_name": "everquic-crypto", "file_name": "Mem.fst", "name": "Mem.rgn" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.arity" }, { "project_name": "everparse", "file_name": "InterpreterTarget.fst", "name": "InterpreterTarget.env" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fsti", "name": "Lib.NatMod.nat_mod" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ch" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ch" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c0" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c0" }, { "project_name": "steel", "file_name": "CustomSyntax.fst", "name": "CustomSyntax.zero" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cf" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cf" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_dval" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_mval" }, { "project_name": "FStar", "file_name": "Interop.fst", "name": "Interop.ireg" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.size_nat" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_32.fsti", "name": "Hacl.Blake2b_32.size_nat" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ca" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ca" }, { "project_name": "zeta", "file_name": "Hacl.Blake2b_256.fsti", "name": "Hacl.Blake2b_256.size_nat" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fsti", "name": "Lib.NTuple.flen" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_val" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.nat" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ci" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ci" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cW" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cW" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fst", "name": "Pulse.C.Typenat.s" }, { "project_name": "steel", "file_name": "Steel.C.Typenat.fst", "name": "Steel.C.Typenat.s" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c1" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c1" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cl" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cl" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.rwops" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fst", "name": "Pulse.C.Typenat.z" }, { "project_name": "steel", "file_name": "Steel.C.Typenat.fst", "name": "Steel.C.Typenat.z" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_mval" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fsti", "name": "Hacl.K256.Scalar.qelem4" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Field.fsti", "name": "Hacl.K256.Field.felem" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.lref" }, { "project_name": "FStar", "file_name": "Bane.Lib.fst", "name": "Bane.Lib.for_you" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c4" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c4" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cV" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cV" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.triple" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cu" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cu" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cS" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cS" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.c_" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.c_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fsti", "name": "Hacl.Impl.P256.Bignum.widefelem" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.t" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.triple" }, { "project_name": "hacl-star", "file_name": "Lib.UpdateMulti.Lemmas.fsti", "name": "Lib.UpdateMulti.Lemmas.uint8" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.pow_t0" }, { "project_name": "everparse", "file_name": "Ast.fst", "name": "Ast.subst" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.subst" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.lref" }, { "project_name": "steel", "file_name": "HaclExample2.fst", "name": "HaclExample2.twenty" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fsti", "name": "Hacl.Impl.P256.Bignum.felem" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Definitions.fst", "name": "Hacl.Spec.BignumQ.Definitions.qelem5" }, { "project_name": "zeta", "file_name": "Zeta.Steel.VerifierTypes.fst", "name": "Zeta.Steel.VerifierTypes.vstore" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_dval" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cC" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cC" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fsti", "name": "Lib.ByteSequence.bytes" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Base.fsti", "name": "Pulse.Syntax.Base.var" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Definitions.fst", "name": "Hacl.Spec.Bignum.Definitions.limb_t" }, { "project_name": "zeta", "file_name": "Zeta.Steel.BitUtils.fsti", "name": "Zeta.Steel.BitUtils.bv_t" }, { "project_name": "hacl-star", "file_name": "Lib.IntVector.fsti", "name": "Lib.IntVector.v_inttype" }, { "project_name": "steel", "file_name": "HaclExample.fst", "name": "HaclExample.twenty" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.Definitions.fst", "name": "Hacl.Bignum.Definitions.limb_t" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ce" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ce" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Definitions.fst", "name": "Hacl.Spec.BignumQ.Definitions.qelem_wide5" }, { "project_name": "FStar", "file_name": "Trace.fst", "name": "Trace.fall" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Definitions.fst", "name": "Hacl.Spec.K256.Field52.Definitions.felem4" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.var" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.string_nil" } ], "selected_premises": [ "Vale.Def.Words_s.pow2_32", "Vale.Def.Words_s.natN", "Vale.Def.Words_s.pow2_4", "FStar.Mul.op_Star", "Vale.Def.Words_s.nat1", "Vale.Def.Words_s.pow2_128", "FStar.Pervasives.reveal_opaque", "Vale.Def.Words_s.nat2", "Vale.Def.Words_s.pow2_16", "Vale.Def.Words_s.pow2_64", "Vale.Def.Words_s.pow2_norm", "Vale.Def.Words_s.pow2_8", "Vale.Def.Words_s.pow2_2", "Vale.Def.Words_s.pow2_1", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Pervasives.dsnd", "FStar.Pervasives.dfst", "Prims.auto_squash", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.pure_return", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.pure_ite_wp", "Prims.returnM", "Prims.pure_pre", "FStar.Pervasives.all_post_h", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.ex_pre", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.all_return", "Prims.l_True", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.ex_return", "FStar.Pervasives.all_ite_wp", "Prims.l_False", "FStar.Pervasives.all_stronger", "Prims.pure_wp_monotonic", "FStar.Pervasives.st_wp_h", "Prims.op_Hat", "Prims.pure_wp'", "Prims.pow2", "FStar.Pervasives.st_pre_h", "Prims.as_requires", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.ex_ite_wp", "Prims.min", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.ex_post", "FStar.Pervasives.lift_div_exn", "FStar.Pervasives.all_trivial", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.ex_bind_wp", "Prims.as_ensures", "Prims.purewp_id", "FStar.Pervasives.ex_post'", "Prims.pure_trivial", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.pure_close_wp", "Prims.pure_wp", "Prims.pure_stronger", "FStar.Pervasives.st_return", "Prims.__cache_version_number__", "Prims.pure_post'", "FStar.Pervasives.id", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.st_post_h'", "Prims.pure_wp_monotonic0", "FStar.Pervasives.all_close_wp", "Prims.pure_post", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.st_post_h", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.st_bind_wp", "Prims.abs", "FStar.Pervasives.st_ite_wp", "Prims.subtype_of", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.st_trivial", "FStar.Pervasives.st_stronger" ], "source_upto_this": "module Vale.Def.Words_s\nopen FStar.Mul\n\n(*\nVarious representations of words with 2^n bits.\n\nFor example, a byte might be represented as a record of 8 bools, a sequence of 8 bools,\nor a natural number 0 <= n < 256. Sequences might be little endian or big endian.\nA 32-bit word could be four bytes, 32 bools, or a natural number 0 <= n < 0x100000000.\n\nThis library defines various representations and conversions between them.\n*)\n\n// Records with up to eight fields, listed in order from least significant to most significant.\n// (More than eight fields can be built hierarchically, as in four (four nat8))\ntype two (a:Type) : Type = { lo:a; hi:a; }\ntype four (a:Type) : Type = { lo0:a; lo1:a; hi2:a; hi3:a; }\ntype eight (a:Type) : Type = { lo_0:a; lo_1:a; lo_2:a; lo_3:a; hi_4:a; hi_5:a; hi_6:a; hi_7:a }\n\nunfold let pow2_norm (n:nat) = normalize_term (pow2 n)\n\nunfold let pow2_1 = 0x2\nunfold let pow2_2 = 0x4\nunfold let pow2_4 = 0x10\nunfold let pow2_8 = 0x100\nunfold let pow2_16 = 0x10000\nunfold let pow2_32 = 0x100000000\nunfold let pow2_64 = 0x10000000000000000\nunfold let pow2_128 = 0x100000000000000000000000000000000\n\nlet natN (n:nat) = x:nat{x < n}\nlet nat1 = natN pow2_1\nlet nat2 = natN pow2_2", "sketch": [ "The definition is about representing a natural number that is less than 16.\n\nStep 1: We want to define a type that represents a natural number less than 16.\n\nStep 2: We can implement this by using the `natN` function to create a type representing a natural number less than 16.", "The implementation of `nat4` is a type alias for `natN pow2_4`, which represents natural numbers less than 16.", "The definition is implemented by defining `nat4` as a type that represents natural numbers less than 16.", "The definition `nat4` is about representing natural numbers within the range of 0 to 16.\n\nStep 1: We want to define a type that represents natural numbers within the range of 0 to 16.\n\nStep 2: We can implement this by creating a new type that represents natural numbers within the specified range.", "The definition `nat4` is about representing natural numbers up to 16 bits, i.e., 0 <= n < 65536.\n\nStep 1: We will define `nat4` as a type representing natural numbers up to 16 bits.\n\nStep 2: The implementation will involve using the `natN` function to constrain the range of natural numbers to 0 <= n < 65536.", "The definition `nat4` is a type representing natural numbers less than 16.\n\nStep 1: We define a new type `nat4` to represent natural numbers less than 16.\n\nStep 2: The implementation involves defining a new type with a constraint that the value should be less than 16.", "The definition `nat4` is a type representing natural numbers less than 16.\n\nStep 1: We define a new type `nat4` to represent natural numbers less than 16.\n\nStep 2: The implementation involves defining the type `nat4` as a subtype of `natN pow2_4`, which represents natural numbers less than 16.", "The definition `nat4` is a type representing natural numbers less than 16.\n\nStep 1: We define a type representing natural numbers less than 16.\nStep 2: The definition is implemented by creating a new type `nat4` with a constraint that the value should be less than 16.", "The definition is implemented by creating a new type `nat4` and constraining it to natural numbers less than 16.", "The definition is about creating a type representing a natural number less than 16.\n\nStep 1: We will define a type representing a natural number less than 16.\n\nStep 2: We will implement the definition by creating a type with a single field representing the natural number less than 16." ], "generated_solution": [ "let nat4 = natN pow2_4", "let nat4 = natN pow2_4", "let nat4 = natN pow2_4", "let nat4 = natN pow2_4", "let nat4 = natN pow2_16", "let nat4 = natN pow2_4", "val nat4 : Type0 = natN pow2_4", "let nat4 = natN pow2_4", "let nat4 = natN pow2_4", "let nat4 = natN pow2_4" ] }, { "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.read", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Pulse.Lib.PCM.Fraction" }, { "open": "FStar.PCM" }, { "open": "Pulse.Main" }, { "open": "Pulse.Lib.Core" }, { "open": "FStar.Ghost" }, { "open": "PulseCore.FractionalPermission" }, { "open": "Pulse.Lib.Core" }, { "open": "FStar.Tactics" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "source_definition": "let read = read'", "source_range": { "start_line": 76, "start_col": 0, "end_line": 76, "end_col": 16 }, "interleaved": false, "definition": "Pulse.Lib.HigherGhostReference.read'", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Lib.HigherGhostReference.read'" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "r: Pulse.Lib.HigherGhostReference.ref a\n -> Pulse.Lib.Core.stt_ghost (FStar.Ghost.erased a)\n (Pulse.Lib.HigherGhostReference.pts_to r (FStar.Ghost.reveal n))\n (fun x ->\n Pulse.Lib.HigherGhostReference.pts_to r (FStar.Ghost.reveal n) **\n Pulse.Lib.Core.pure (n == x))", "prompt": "let read =\n ", "expected_response": "read'", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.HigherGhostReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.HigherGhostReference.fst", "checked_file": "dataset/Pulse.Lib.HigherGhostReference.fst.checked", "interface_file": true, "dependencies": [ "dataset/Pulse.Main.fsti.checked", "dataset/Pulse.Lib.PCM.Fraction.fst.checked", "dataset/Pulse.Lib.Core.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked" ] }, "definitions_in_context": [ "let ref (a:Type u#1) = ghost_pcm_ref (pcm_frac #a)", "val ref ([@@@unused] a:Type u#1) : Type u#0", "let gref_non_informative (a:Type u#1) : non_informative_witness (ref a) = fun x -> reveal x", "val gref_non_informative (a:Type u#1) : non_informative_witness (ref a)", "let pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= ghost_pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)", "val pts_to (#a:Type)\n (r:ref a)\n (#[exact (`full_perm)] [@@@equate_by_smt] p:perm)\n ([@@@equate_by_smt] n:a)\n: vprop", "```pulse\nghost\nfn full_values_compatible (#a:Type u#1) (x:a)\nrequires emp\nensures pure (compatible pcm_frac (Some (x, full_perm)) (Some (x, full_perm)))\n{\n assert pure (FStar.PCM.composable pcm_frac (Some(x, full_perm)) None);\n}\n```", "val alloc (#a:Type) (x:a)\n : stt_ghost (ref a) emp (fun r -> pts_to r x)", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "```pulse\nghost\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.ghost_alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```", "val ( ! ) (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "val ( := ) (#a:Type) (r:ref a) (x:erased a) (#n:erased a)\n : stt_ghost unit\n (pts_to r n) \n (fun _ -> pts_to r x)", "let alloc = alloc'", "let write = ( := )", "let read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "```pulse\nghost\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:erased a\nensures pts_to r #p n ** pure (n == x)\n{\n unfold pts_to r #p n;\n with w. assert (ghost_pcm_pts_to r w);\n let x = Pulse.Lib.Core.ghost_read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (ghost_pcm_pts_to r w);\n fold (pts_to r #p n);\n hide (fst (Some?.v x))\n}\n```", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)" ], "closest": [ "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read_pt r) in\n return u", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read r) in\n return u", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val read (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n : Steel a (pts_to r p v) (fun x -> pts_to r p x)\n (requires fun h -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet read (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n = let v1 : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop (pts_to r p v) (RP.pts_to r v1 `star` pure (perm_ok p)) (fun _ -> ());\n elim_pure (perm_ok p);\n let v2 = RP.read r v1 in\n rewrite_slprop (RP.pts_to r v1) (pts_to r p v)\n (fun m ->\n emp_unit (hp_of (pts_to_raw r p v));\n pure_star_interp (hp_of (pts_to_raw r p v)) (perm_ok p) m);\n assert (compatible pcm_frac v1 v2);\n let Some (x, _) = v2 in\n rewrite_slprop (pts_to r p v) (pts_to r p x) (fun _ -> ());\n return x", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\nlet share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\n = coerce_ghost (fun _ -> R.ghost_share_pt r)", "val alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\nlet alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_alloc_pt x)", "val read_pt (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n : Steel a (pts_to r p v) (fun x -> pts_to r p x)\n (requires fun _ -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet read_pt #a #p #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n let x = H.read r in\n let v':a = U.downgrade_val x in\n rewrite_slprop (H.pts_to r p (hide x)) (pts_to r p v') (fun _ -> ());\n return v'", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share\n r\n= RST.share r.reveal", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share r)", "val share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share_pt r)", "val free (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit opened\n (pts_to r full_perm v) (fun _ -> emp)\nlet free\n #_ #a #v r\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_free gr)", "val ghost_read_pt (#a:Type) (#u:_) (#p:perm) (#v:erased a) (r:ghost_ref a)\n : SteelGhost (erased a) u (ghost_pts_to r p v) (fun x -> ghost_pts_to r p x)\n (requires fun _ -> True)\n (ensures fun _ x _ -> x == v)\nlet ghost_read_pt #a #u #p #v r =\n let x = H.ghost_read r in\n let x' = hide (U.downgrade_val (reveal x)) in\n rewrite_slprop (H.ghost_pts_to r p x) (ghost_pts_to r p x') (fun _ -> ());\n x'", "val share (#a:Type) (r:box a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share b = R.share b", "val read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t))\n : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1\n )\nlet read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t)) : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p . (* {:pattern (mk_fraction (scalar t) (mk_scalar v0) p)} *) Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1)\n= let v0 = FStar.IndefiniteDescription.indefinite_description_tot _ (fun v0 -> exists p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p) in\n let p = FStar.IndefiniteDescription.indefinite_description_tot _ (fun p -> Ghost.reveal v == mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p) in\n let prf v0' p' : Lemma\n (requires (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p'))\n (ensures (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = mk_scalar_inj (Ghost.reveal v0) v0' p p'\n in\n let prf' v0' p' : Lemma\n (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p' ==> (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = Classical.move_requires (prf v0') p'\n in\n Classical.forall_intro_2 prf';\n rewrite (pts_to _ _) (pts_to r (mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p));\n let v1 = read0 r in\n rewrite (pts_to _ _) (pts_to r v);\n return v1", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\nlet free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_ghost (fun _ -> R.ghost_free_pt r)", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write r x);\n return ()", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write_pt r x);\n return ()", "val read_atomic (r:box U32.t) (#n:erased U32.t) (#p:perm)\n : stt_atomic U32.t emp_inames\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (reveal n == x))\nlet read_atomic b = R.read_atomic b", "val share (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type) #uses (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n= share_gen r (half_perm p) (half_perm p)", "val share_pt (#a:Type0) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share_pt #a #uses #p #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share r;\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ());\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ())", "val gather (#a:Type) (r:box a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather b = R.gather b", "val free (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_steel(fun _ -> R.free r);\n return ()", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share = share'", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a)\n: stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\n= share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "val ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\n = H.ghost_write r (raise_erased x)", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n: stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share #a arr #s #p = H.share arr #(raise_seq s) #p", "val alloc (#opened: _) (#a:Type) (x:a)\n : STGhost (ref a) opened\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> True)\nlet alloc\n #_ #a x\n= let gr = STC.coerce_ghost (fun _ -> R.ghost_alloc x) in\n let r = Hide (Ghost.reveal (coerce_eq (R.reveal_ghost_ref a) gr)) in\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n );\n r", "val free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_steel(fun _ -> R.free_pt r);\n return ()", "val ghost_write (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write r x =\n ghost_write_aux (reveal r) (reveal x);\n rewrite_slprop\n (pts_to (reveal r) full_perm (hide (reveal x)))\n (ghost_pts_to r full_perm x)\n (fun _ -> ())", "val share_gen (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : STGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n r p1 p2\n= coerce_ghost (fun _ -> R.share_gen_pt r p1 p2)", "val share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (pts_to r p x)\n (fun _ -> pts_to r p1 x `star`\n pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop\n (pts_to r p v)\n (pts_to' r p v)\n (fun _ -> ());\n elim_pure (perm_ok p);\n share_atomic_raw_gen r v p1 p2;\n intro_pts_to p1 r;\n intro_pts_to p2 r", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val read_ref (#a:Type0) (r:R.ref (vec a))\n (i:SZ.t)\n (#v:erased (vec a))\n (#s:erased (Seq.seq a) { SZ.v i < Seq.length s})\n : stt a\n (requires R.pts_to r v ** pts_to v s)\n (ensures fun res -> R.pts_to r v ** pts_to v s ** pure (res == Seq.index s (SZ.v i)))\nlet read_ref = read_ref'", "val ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n = H.ghost_share #_ #_ #_ #(raise_erased x) r", "val ghost_alloc_pt (#a:Type) (#u:_) (x:erased a)\n : SteelGhostT (ghost_ref a) u\n emp\n (fun r -> ghost_pts_to r full_perm x)\nlet ghost_alloc_pt (#a:Type) (#u:_) (x:erased a)\n : SteelGhostT (ghost_ref a) u\n emp\n (fun r -> ghost_pts_to r full_perm x)\n = H.ghost_alloc (raise_erased x)", "val alloc (#a:Type) (x:a)\n : stt_ghost (ref a) emp (fun r -> pts_to r x)\nlet alloc = alloc'", "val write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, full_perm)) in\n let v_new : fractional a = Some (x, full_perm) in\n rewrite_slprop (pts_to r full_perm v) (RP.pts_to r v_old `star` pure (perm_ok full_perm)) (fun _ -> ());\n\n elim_pure (perm_ok full_perm);\n\n RP.write r v_old v_new;\n rewrite_slprop (RP.pts_to r v_new) (pts_to r full_perm x)\n (fun m -> emp_unit (hp_of (pts_to_raw r full_perm x));\n pure_star_interp (hp_of (pts_to_raw r full_perm x)) (perm_ok full_perm) m)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (hide (U.raise_val (reveal v)))", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.split r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val ghost_alloc (#a:Type) (#u:_) (x:erased a)\n : SteelGhostT (ghost_ref a) u\n emp\n (fun r -> ghost_pts_to r full_perm x)\nlet ghost_alloc x =\n let r = ghost_alloc_aux (reveal x) in\n hide r", "val ghost_share (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share r = share (reveal r)", "val ghost_readp (#a:Type0) (#opened:inames) (r:ghost_ref a)\n (p: perm)\n : SteelGhost (Ghost.erased a) opened\n (ghost_vptrp r p) (fun _ -> ghost_vptrp r p)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> h0 (ghost_vptrp r p) == h1 (ghost_vptrp r p) /\\ Ghost.reveal x == h1 (ghost_vptrp r p))\nlet ghost_readp r _ =\n let _ = elim_ghost_vptr r _ in\n let x = ghost_read_pt r in\n intro_ghost_vptr r _ x;\n x", "val pts_to_not_null (#a:Type)\n (#opened:inames)\n (#p:perm)\n (#v:a)\n (r:ref a)\n : STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun _ -> r =!= null)\nlet pts_to_not_null #a #opened #p #v r\n = extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);\n ()", "val pts_to_not_null (#a:Type)\n (#opened:inames)\n (#p:perm)\n (#v:a)\n (r:ref a)\n : STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun _ -> r =!= null)\nlet pts_to_not_null #a #opened #p #v r\n = extract_fact #opened (pts_to r p v) (r =!= null) (R.pts_to_not_null r p v);\n ()", "val gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\nlet gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\n = coerce_ghost (fun _ -> R.ghost_gather_pt #a #u #p0 #p1 #x0 #x1 r)", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather (#a:Type)\n (#uses:_)\n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost (fun _ -> R.gather #a #uses #p0 #p1 #v0 #v1 r)", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather\n p1 r\n= RST.gather p1 r.reveal", "val elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm)\n : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (vptrp r p))\nlet elim_vptr (#a:Type) (#opened:inames) (r:ref a) (p: perm)\n : SteelGhost (erased a) opened (vptrp r p) (fun v -> pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (vptrp r p))\n = let v = gget (vptrp r p) in\n change_slprop (vptrp r p) (pts_to r p v) v () (elim_vptr_lemma r p v);\n v", "val ghost_read\r\n (#a:Type)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (x:erased a)\r\n (f:(v:a{compatible p x v}\r\n -> GTot (y:a{compatible p y v /\\\r\n FStar.PCM.frame_compatible p x v y})))\r\n: stt_ghost (erased (v:a{compatible p x v /\\ p.refine v}))\r\n (ghost_pts_to r x)\r\n (fun v -> ghost_pts_to r (f v))\nlet ghost_read\r\n (#a:Type)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (x:erased a)\r\n (f:(v:a{compatible p x v}\r\n -> GTot (y:a{compatible p y v /\\\r\n FStar.PCM.frame_compatible p x v y})))\r\n: stt_ghost (erased (v:a{compatible p x v /\\ p.refine v}))\r\n (ghost_pts_to r x)\r\n (fun v -> ghost_pts_to r (f v))\r\n= hide_ghost <| Ghost.hide <|A.read r x f", "val pts_to\n (#a:Type) (r:ref a) \n (#[exact (`full_perm)] [@@@equate_by_smt] p:perm)\n ([@@@equate_by_smt] n:a)\n : vprop\nlet pts_to\n (#a:Type u#0)\n (r:ref a)\n (#[exact (`full_perm)] [@@@equate_by_smt] p:perm)\n ([@@@equate_by_smt] v:a)\n = H.pts_to r #p (U.raise_val v)", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> MR.write r x)", "val atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a)\n (r:ref a)\n : SteelAtomic a opened\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires fun h -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n = let v1 : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop (pts_to r p v) (RP.pts_to r v1 `star` pure (perm_ok p)) (fun _ -> ());\n elim_pure (perm_ok p);\n\n let v2 = RP.atomic_read r v1 in\n rewrite_slprop (RP.pts_to r v1) (pts_to r p v)\n (fun m ->\n emp_unit (hp_of (pts_to_raw r p v));\n pure_star_interp (hp_of (pts_to_raw r p v)) (perm_ok p) m);\n assert (compatible pcm_frac v1 v2);\n let Some (x, _) = v2 in\n rewrite_slprop (pts_to r p v) (pts_to r p x) (fun _ -> ());\n return x", "val ghost_share_gen_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen_pt\n #_ #_ #_ #x r p1 p2\n= H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2", "val share_gen_pt (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen_pt #a #uses #p #v r p1 p2 =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share_gen r p1 p2;\n rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ());\n rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ())", "val share_gen\n (#t: Type)\n (#opened: _)\n (#p: perm)\n (#v: t)\n (r: ref t)\n (p1 p2: perm)\n: STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n #_ #_ #_ #v r p1 p2\n= coerce_ghost (fun _ -> R.ghost_share_gen_pt #_ #_ #_ #v r p1 p2)", "val write_pt (#a:Type0) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write_pt #a #v r x =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ());\n let x' = U.raise_val x in\n H.write r x';\n rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ())", "val ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\n = H.ghost_gather r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n: stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun () -> pts_to r x0 ** pure (x0 == x1))\n= gather r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r #x0 #x1 #one_half #one_half", "val rewrite_perm (#a: Type) (#v: G.erased a) (r: ghost_ref a) (p1 p2: P.perm)\n : Steel unit\n (ghost_pts_to r p1 v)\n (fun _ -> ghost_pts_to r p2 v)\n (fun _ -> p1 == p2)\n (fun _ _ _ -> True)\nlet rewrite_perm(#a:Type) (#v:G.erased a) (r:ghost_ref a) (p1 p2:P.perm)\n : Steel unit\n (ghost_pts_to r p1 v)\n (fun _ -> ghost_pts_to r p2 v)\n (fun _ -> p1 == p2)\n (fun _ _ _ -> True)\n = rewrite_slprop (ghost_pts_to r p1 v)\n (ghost_pts_to r p2 v)\n (fun _ -> ())", "val read (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (#v0:a)\n (r:ref a pcm)\n : STGhost a o\n (pts_to r v0)\n (fun _ -> pts_to r v0)\n (requires True)\n (ensures fun v -> compatible pcm v0 v)\nlet read (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (#v0:a)\n (r:ref a pcm)\n : STGhost a o\n (pts_to r v0)\n (fun _ -> pts_to r v0)\n (requires True)\n (ensures fun v -> compatible pcm v0 v)\n = let v = coerce_ghost (fun _ -> G.read r) in\n downgrade_val v", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : STGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n True\n (fun _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm\n r\n= coerce_ghost (fun _ -> R.pts_to_perm r)", "val pts_to_perm (#a: _) (#u: _) (#p: _) (#v: _) (r: ref a)\n : STGhost unit u\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n True\n (fun _ -> p `lesser_equal_perm` full_perm)\nlet pts_to_perm r = coerce_ghost (fun _ -> R.ghost_pts_to_perm r)", "val share_atomic_raw_gen\n (#a #uses: _)\n (#p: perm)\n (r: ref a {perm_ok p})\n (v0: erased a)\n (p1 p2: perm)\n : SteelGhost unit\n uses\n (pts_to_raw r p v0)\n (fun _ -> (pts_to_raw r p1 v0) `star` (pts_to_raw r p2 v0))\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_atomic_raw_gen #a #uses (#p:perm) (r:ref a{perm_ok p}) (v0:erased a) (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to_raw r p v0)\n (fun _ -> pts_to_raw r p1 v0 `star` pts_to_raw r p2 v0)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = rewrite_slprop\n (pts_to_raw r p v0)\n (RP.pts_to r _)\n (fun _ -> ());\n RP.split r (Some (Ghost.reveal v0, p)) (Some (Ghost.reveal v0, p1)) (Some (Ghost.reveal v0, p2));\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p1 v0)\n (fun _ -> ());\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p2 v0)\n (fun _ -> ())", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (U.raise_val v)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.share r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val elim_ghost_vptr (#a: Type) (#opened: inames) (r: ghost_ref a) (p: perm)\n : SteelGhost (erased a)\n opened\n (ghost_vptrp r p)\n (fun v -> ghost_pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (ghost_vptrp r p))\nlet elim_ghost_vptr (#a:Type) (#opened:inames) (r:ghost_ref a)\n (p: perm)\n : SteelGhost (erased a) opened (ghost_vptrp r p) (fun v -> ghost_pts_to r p v)\n (requires fun _ -> True)\n (ensures fun h0 v _ -> reveal v == h0 (ghost_vptrp r p))\n = let v = gget (ghost_vptrp r p) in\n change_slprop (ghost_vptrp r p) (ghost_pts_to r p v) v () (elim_ghost_vptr_lemma r p v);\n v", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_steel (fun _ -> MR.write r x)", "val pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a) : vprop\nlet pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)", "val ghost_share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen r p1 p2 = share_gen (reveal r) p1 p2", "val share (#a:Type0) (#uses:_) (#p: perm) (r:ref a)\n : SteelGhost unit uses\n (vptrp r p)\n (fun _ -> vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r (half_perm p)) == h (vptrp r p)\n )\nlet share\n #_ #_ #p r\n= elim_vptrp r p;\n A.share r p (half_perm p) (half_perm p);\n intro_vptrp' r (half_perm p);\n intro_vptrp' r (half_perm p)", "val share (#a:Type0) (#uses:_) (#p: perm) (r:ref a)\n : SteelGhost unit uses\n (vptrp r p)\n (fun _ -> vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r (half_perm p)) == h (vptrp r p)\n )\nlet share #a #_ #p r =\n let x = elim_vptr r p in\n share_pt r;\n intro_vptr r _ x;\n intro_vptr r _ x", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc_pt x) in\n r", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc x) in\n r", "val free (#a:Type) (#v:erased a) (r:ref a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type) (#v:erased a) (r:ref a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> emp)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, full_perm)) in\n rewrite_slprop\n (pts_to r full_perm v)\n (RP.pts_to r v_old `star` pure (perm_ok full_perm))\n (fun _ -> ());\n elim_pure (perm_ok full_perm);\n RP.free r v_old;\n drop (RP.pts_to r (Mkpcm'?.one (Mkpcm?.p pcm_frac)))", "val gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\nlet gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\n = coerce_ghost (fun _ -> MR.gather #inames #a #p r f g v)", "val write_ref (#a:Type0) (r:R.ref (vec a))\n (i:SZ.t)\n (x:a)\n (#v:erased (vec a))\n (#s:erased (Seq.seq a) { SZ.v i < Seq.length s})\n : stt unit\n (requires R.pts_to r v ** pts_to v s)\n (ensures fun _ -> R.pts_to r v ** pts_to v (Seq.upd s (SZ.v i) x))\nlet write_ref = write_ref'", "val read_write (#a: Type) (r0: reference a) (v0: erased a)\n : SteelT unit ((pts_to r0 full_perm v0) `star` r) (fun _ -> r `star` (pts_to r0 full_perm v0))\nlet read_write (#a:Type) (r0:reference a) (v0:erased a)\n : SteelT unit (pts_to r0 full_perm v0 `star` r)\n (fun _ -> r `star` pts_to r0 full_perm v0)\n = let u0 = rread r0 in\n rwrite_alt r0 v0 u0", "val replace (#a:Type0) (r:ref a) (x:a) (#v:erased a)\n : stt a\n (pts_to r v)\n (fun res -> pts_to r x ** pure (res == reveal v))\nlet replace = replace'", "val share2 (#a:Type) (r:box a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 b = R.share2 b" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.read" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.read" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.alloc" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.read_pt" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.free" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_read_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.free" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.read_atomic" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.share" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share2" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_write_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.free" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_write" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share_gen" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.read_ref" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_alloc_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.alloc" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_alloc" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_readp" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.pts_to_not_null" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to_not_null" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.elim_vptr" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.atomic_read" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.write_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_gather_pt" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.gather2" }, { "project_name": "steel", "file_name": "OWGCounter.fst", "name": "OWGCounter.rewrite_perm" }, { "project_name": "steel", "file_name": "Steel.ST.GhostPCMReference.fst", "name": "Steel.ST.GhostPCMReference.read" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.pts_to_perm" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_atomic_raw_gen" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.elim_ghost_vptr" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.pts_to" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share_gen" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.alloc" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.write_ref" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.read_write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.replace" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share2" } ], "selected_premises": [ "FStar.Real.one", "FStar.PCM.compatible", "Pulse.Lib.Core.all_inames", "Pulse.Lib.Core.inames", "FStar.PCM.op", "FStar.Real.two", "FStar.PCM.composable", "Pulse.Lib.PCM.Fraction.compose", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.PCM.Fraction.composable", "PulseCore.FractionalPermission.sum_perm", "Pulse.Lib.Core.emp_inames", "Pulse.Lib.PCM.Fraction.fractional", "Pulse.Lib.Core.one_half", "Pulse.Lib.PCM.Fraction.pcm_frac", "PulseCore.FractionalPermission.comp_perm", "FStar.Pervasives.Native.fst", "Pulse.Lib.HigherGhostReference.ref", "FStar.UInt.size", "FStar.Pervasives.Native.snd", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd_none", "Pulse.Lib.HigherGhostReference.read_compat", "Pulse.Lib.HigherGhostReference.gref_non_informative", "PulseCore.FractionalPermission.writeable", "Pulse.Lib.PCM.Fraction.full_values_compatible", "Pulse.Lib.Core.prop_non_informative", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd", "Pulse.Lib.Core.squash_non_informative", "FStar.Pervasives.reveal_opaque", "PulseCore.FractionalPermission.lesser_perm", "FStar.Mul.op_Star", "Pulse.Lib.Core.join_inames", "Pulse.Lib.Core.unit_non_informative", "FStar.Pervasives.dfst", "Pulse.Lib.HigherGhostReference.alloc", "Pulse.Lib.Core.erased_non_informative", "Pulse.Lib.HigherGhostReference.pts_to", "Pulse.Lib.Core.mem_iname", "FStar.Real.zero", "PulseCore.FractionalPermission.half_perm", "Pulse.Lib.Core.add_iname", "Pulse.Lib.Core.inames_subset", "FStar.Pervasives.dsnd", "PulseCore.Observability.at_most_one_observable", "PulseCore.FractionalPermission.lesser_equal_perm", "FStar.Preorder.preorder_rel", "Pulse.Lib.Core.mem_inv", "PulseCore.Observability.join_obs", "FStar.PCM.lem_commutative", "FStar.Pervasives.id", "FStar.PCM.compatible_trans", "FStar.PCM.lem_assoc_l", "FStar.PCM.frame_compatible", "FStar.PCM.compatible_elim", "Pulse.Lib.Core.add_inv", "FStar.Pervasives.st_post_h", "FStar.PCM.frame_preserving_val_to_fp_upd", "FStar.Pervasives.ex_pre", "FStar.PCM.exclusive", "FStar.Ghost.return", "FStar.PCM.lem_assoc_r", "Pulse.Lib.Core.remove_inv", "FStar.Ghost.tot_to_gtot", "FStar.UInt32.lt", "FStar.BitVector.logor_vec", "FStar.UInt32.n", "FStar.Pervasives.all_post_h", "FStar.Math.Lib.slash_decr_axiom", "FStar.Math.Lib.div_non_eucl", "FStar.Math.Lib.max", "FStar.Pervasives.all_post_h'", "FStar.PCM.compose_frame_preserving_updates", "FStar.Preorder.reflexive", "FStar.UInt.xor", "FStar.Math.Lemmas.lemma_mod_spec", "FStar.Pervasives.ex_post'", "FStar.PCM.lem_is_unit", "FStar.Pervasives.st_pre_h", "FStar.UInt.max_int", "FStar.UInt32.gt", "FStar.Pervasives.all_pre_h", "FStar.UInt32.gte_mask", "FStar.Real.test", "FStar.Math.Lemmas.modulo_division_lemma", "FStar.Real.mul_nil_r", "FStar.Calc.calc_chain_related", "FStar.Math.Lib.div", "FStar.Pervasives.ex_post", "FStar.Math.Lemmas.division_definition", "FStar.Preorder.transitive", "FStar.Math.Lemmas.division_sub_lemma", "FStar.Pervasives.st_stronger", "FStar.UInt.udiv", "FStar.Pervasives.st_post_h'", "FStar.Math.Lemmas.modulo_division_lemma_0", "FStar.Set.subset", "FStar.BitVector.logxor_vec", "FStar.Preorder.stable", "FStar.UInt32.op_Subtraction_Hat", "FStar.Math.Lib.div_non_eucl_decr_lemma" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.HigherGhostReference\nopen Pulse.Lib.Core\nopen Pulse.Main\nopen FStar.PCM\nopen Pulse.Lib.PCM.Fraction\nmodule T = FStar.Tactics\nlet ref (a:Type u#1) = ghost_pcm_ref (pcm_frac #a)\nlet gref_non_informative (a:Type u#1) : non_informative_witness (ref a) = fun x -> reveal x\n\nlet pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= ghost_pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)\n\n```pulse\nghost\nfn full_values_compatible (#a:Type u#1) (x:a)\nrequires emp\nensures pure (compatible pcm_frac (Some (x, full_perm)) (Some (x, full_perm)))\n{\n assert pure (FStar.PCM.composable pcm_frac (Some(x, full_perm)) None);\n}\n```\n\n```pulse\nghost\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.ghost_alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```\nlet alloc = alloc'\n\nlet read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x\n\n```pulse\nghost\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:erased a\nensures pts_to r #p n ** pure (n == x)\n{\n unfold pts_to r #p n;\n with w. assert (ghost_pcm_pts_to r w);\n let x = Pulse.Lib.Core.ghost_read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (ghost_pcm_pts_to r w);\n fold (pts_to r #p n);\n hide (fst (Some?.v x))\n}\n```", "sketch": [ "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value of type `a`. The function ensures that the reference `r` points to the value `n` with permission `p`, and it also ensures that the returned value is equal to `n`.\n\nStep 1: The `read` function takes a reference `r`, an erased value `n`, and a permission `p` as input.\nStep 2: It ensures that the reference `r` points to the value `n` with permission `p`, and it also ensures that the returned value is equal to `n`.", "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value `x` and ensures that the reference `r` points to the value `n` with permission `p`, and also ensures that the returned value `x` is equal to `n`.\n\nStep 1: The `read` function takes a reference `r`, an erased value `n`, and a permission `p` as input.\nStep 2: It returns an erased value `x` and ensures that the reference `r` points to the value `n` with permission `p`, and also ensures that the returned value `x` is equal to `n`.", "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p`. It returns an erased value `x` and ensures that the reference `r` points to the value `n` with permission `p`, and that `x` is equal to `n`.\n\nStep 1: The `read` function takes a reference `r`, an erased value `n`, and a permission `p`.\nStep 2: It unfolds the `pts_to` predicate for reference `r`, value `n`, and permission `p`. Then it uses ghost operations to read the value from the reference and ensures compatibility with the permission. Finally, it hides the first component of the resulting pair.", "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value `x` and ensures that the reference `r` points to the value `n` with permission `p`, and that the returned value `x` is equal to `n`.\n\nStep 1: We need to unfold the `pts_to` predicate for reference `r`, value `n`, and permission `p`.\nStep 2: We assert the `ghost_pcm_pts_to` predicate for reference `r` and permission `p`, then use `ghost_read` to obtain the value `x`. We then assert the compatibility of the permission and value `x`, and fold the `pts_to` predicate for reference `r`, value `n`, and permission `p`. Finally, we hide the first component of the pair returned by `Some?.v x`.", "The `read` function takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value `x` such that it maintains the pointer relationship `pts_to r #p n` and also ensures the purity of the equality `n == x`.\n\nStep 1: We will unfold the pointer relationship `pts_to r #p n`.\nStep 2: We will use the `ghost_read` function to read the value from the reference `r` with permission `p`.\nStep 3: We will assert the compatibility of the permission and the read value.\nStep 4: We will fold the pointer relationship `pts_to r #p n`.\nStep 5: We will hide the first component of the pair obtained from the read operation.", "The definition is about a function called \"read\" that takes a reference \"r\", an erased value \"n\", and a permission \"p\" as input. It returns an erased value and has pre- and post-conditions related to the points-to predicate.\n\nStep 1: The \"read\" function takes a reference \"r\", an erased value \"n\", and a permission \"p\" as input. It ensures that the points-to predicate holds for the reference \"r\", value \"n\", and permission \"p\".\n\nStep 2: The \"read\" function unfolds the points-to predicate for the reference \"r\", value \"n\", and permission \"p\". It then uses ghost operations to read the value from the reference and asserts the compatibility of the permission and the read value. Finally, it updates the points-to predicate and hides the first component of the read value.", "The definition is about a function called read, which takes a reference, an erased value, and a permission as input, and returns an erased value. It ensures that the reference points to the given value with the specified permission.\n\nStep 1: The read function takes a reference, an erased value, and a permission as input, and ensures that the reference points to the given value with the specified permission.\nStep 2: The read function is implemented by unfolding the points-to predicate for the reference with the given permission and value, reading the value from the reference, and ensuring that the reference still points to the same value with the same permission after the read operation.", "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value of type `a`. The function ensures that the reference `r` points to the value `n` with permission `p`, and also ensures that the returned value is equal to `n`.\n\nStep 1: The `read` function takes a reference `r`, an erased value `n`, and a permission `p` as input.\nStep 2: It ensures that the reference `r` points to the value `n` with permission `p`, and also ensures that the returned value is equal to `n`.", "The definition is about a function called \"read\" that takes a reference \"r\", an erased value \"n\", and a permission \"p\" as input, and returns an erased value. The function ensures that the reference \"r\" points to the value \"n\" with permission \"p\" and that the returned value is equal to \"n\".\n\nStep 1: The function \"read\" takes a reference \"r\", an erased value \"n\", and a permission \"p\" as input.\nStep 2: It ensures that the reference \"r\" points to the value \"n\" with permission \"p\" and that the returned value is equal to \"n\".", "The definition `read` takes a reference `r`, an erased value `n`, and a permission `p` as input. It returns an erased value `x` and ensures that the reference `r` points to the value `n` with permission `p`, and also ensures that the returned value `x` is equal to `n`.\n\nStep 1: The `read` function takes a reference, an erased value, and a permission as input.\nStep 2: It unfolds the `pts_to` predicate for the reference with the given permission and value, then reads the value from the reference and ensures compatibility with the permission. Finally, it hides the proof of equality between the returned value and the input erased value." ], "generated_solution": [ "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\n = read' r n p", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x)) =\n unfold (pts_to r #p n);\n with w. assert (ghost_pcm_pts_to r w);\n let x = Pulse.Lib.Core.ghost_read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (ghost_pcm_pts_to r w);\n fold (pts_to r #p n);\n hide (fst (Some?.v x))", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x)) =\n read' r n p", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r p n)\n (fun x -> pts_to r p n ** pure (n == x))", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r p n)\n (fun x -> pts_to r p n ** pure (n == x))", "let read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r p n)\n (fun x -> pts_to r p n ** pure (n == x))" ] }, { "file_name": "Hacl.Impl.P256.DH.fst", "name": "Hacl.Impl.P256.DH.ecp256dh_r_", "opens_and_abbrevs": [ { "abbrev": "S", "full_module": "Spec.P256" }, { "open": "Hacl.Impl.P256.PointMul" }, { "open": "Hacl.Impl.P256.Point" }, { "open": "Hacl.Impl.P256.Scalar" }, { "open": "Hacl.Impl.P256.Bignum" }, { "open": "Lib.Buffer" }, { "open": "Lib.IntTypes" }, { "abbrev": "ST", "full_module": "FStar.HyperStack.ST" }, { "open": "FStar.HyperStack" }, { "open": "FStar.HyperStack.All" }, { "abbrev": "S", "full_module": "Spec.P256" }, { "open": "Lib.Buffer" }, { "open": "Lib.IntTypes" }, { "abbrev": "ST", "full_module": "FStar.HyperStack.ST" }, { "open": "FStar.HyperStack" }, { "open": "FStar.HyperStack.All" }, { "open": "Hacl.Impl.P256" }, { "open": "Hacl.Impl.P256" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "source_definition": "let ecp256dh_r_ is_pk_valid ss pk sk =\n push_frame ();\n let ss_proj = create_point () in\n if is_pk_valid then begin\n point_mul ss_proj sk pk;\n point_store ss ss_proj end;\n pop_frame ()", "source_range": { "start_line": 44, "start_col": 0, "end_line": 50, "end_col": 14 }, "interleaved": false, "definition": "fun is_pk_valid ss pk sk ->\n FStar.HyperStack.ST.push_frame ();\n let ss_proj = Hacl.Impl.P256.Point.create_point () in\n (match is_pk_valid with\n | true ->\n Hacl.Impl.P256.PointMul.point_mul ss_proj sk pk;\n Hacl.Impl.P256.Point.point_store ss ss_proj\n | _ -> ())\n <:\n Prims.unit;\n FStar.HyperStack.ST.pop_frame ()", "effect": "FStar.HyperStack.ST.Stack", "effect_flags": [], "mutual_with": [], "premises": [ "Prims.bool", "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Hacl.Impl.P256.Point.point", "Hacl.Impl.P256.Bignum.felem", "FStar.HyperStack.ST.pop_frame", "Prims.unit", "Hacl.Impl.P256.Point.point_store", "Hacl.Impl.P256.PointMul.point_mul", "Hacl.Impl.P256.Point.create_point", "FStar.HyperStack.ST.push_frame" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n is_pk_valid: Prims.bool ->\n ss: Lib.Buffer.lbuffer Lib.IntTypes.uint8 64ul ->\n pk: Hacl.Impl.P256.Point.point ->\n sk: Hacl.Impl.P256.Bignum.felem\n -> FStar.HyperStack.ST.Stack Prims.unit", "prompt": "let ecp256dh_r_ is_pk_valid ss pk sk =\n ", "expected_response": "push_frame ();\nlet ss_proj = create_point () in\nif is_pk_valid\nthen\n (point_mul ss_proj sk pk;\n point_store ss ss_proj);\npop_frame ()", "source": { "project_name": "hacl-star", "file_name": "code/ecdsap256/Hacl.Impl.P256.DH.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.Impl.P256.DH.fst", "checked_file": "dataset/Hacl.Impl.P256.DH.fst.checked", "interface_file": true, "dependencies": [ "dataset/Spec.P256.fst.checked", "dataset/prims.fst.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.Buffer.fsti.checked", "dataset/Hacl.Impl.P256.Scalar.fsti.checked", "dataset/Hacl.Impl.P256.PointMul.fsti.checked", "dataset/Hacl.Impl.P256.Point.fsti.checked", "dataset/Hacl.Impl.P256.Bignum.fsti.checked", "dataset/Hacl.Bignum.Base.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.All.fst.checked", "dataset/FStar.HyperStack.fst.checked" ] }, "definitions_in_context": [ "val ecp256dh_i:\n public_key:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 r h1 -> modifies (loc public_key) h0 h1 /\\\n (let pk = S.secret_to_public (as_seq h0 private_key) in\n (r <==> Some? pk) /\\ (r ==> (as_seq h1 public_key == Some?.v pk))))", "let ecp256dh_i public_key private_key =\n push_frame ();\n let tmp = create 16ul (u64 0) in\n let sk = sub tmp 0ul 4ul in\n let pk = sub tmp 4ul 12ul in\n\n let is_sk_valid = load_qelem_conditional sk private_key in\n point_mul_g pk sk;\n point_store public_key pk;\n pop_frame ();\n Hacl.Bignum.Base.unsafe_bool_of_limb is_sk_valid", "val ecp256dh_r:\n shared_secret:lbuffer uint8 64ul\n -> their_pubkey:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h shared_secret /\\ live h their_pubkey /\\ live h private_key /\\\n disjoint shared_secret their_pubkey /\\ disjoint shared_secret private_key)\n (ensures fun h0 r h1 -> modifies (loc shared_secret) h0 h1 /\\\n (let ss = S.ecdh (as_seq h0 their_pubkey) (as_seq h0 private_key) in\n (r <==> Some? ss) /\\ (r ==> (as_seq h1 shared_secret == Some?.v ss))))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))" ], "closest": [ "val ecdsa_sign_r (r k:felem) : Stack unit\n (requires fun h ->\n live h r /\\ live h k /\\ disjoint r k /\\\n as_nat h k < S.order)\n (ensures fun h0 _ h1 -> modifies (loc r) h0 h1 /\\\n (let x, _ = S.to_aff_point (S.point_mul_g (as_nat h0 k)) in\n as_nat h1 r == x % S.order))\nlet ecdsa_sign_r r k =\n push_frame ();\n let p = create_point () in\n point_mul_g p k; // p = [k]G\n to_aff_point_x r p;\n qmod_short r r;\n pop_frame ()", "val ecdsa_verification_cmpr: r:felem -> pk:point -> u1:felem -> u2:felem -> Stack bool\n (requires fun h ->\n live h r /\\ live h pk /\\ live h u1 /\\ live h u2 /\\\n disjoint r u1 /\\ disjoint r u2 /\\ disjoint r pk /\\\n disjoint pk u1 /\\ disjoint pk u2 /\\\n point_inv h pk /\\ as_nat h u1 < S.order /\\ as_nat h u2 < S.order /\\\n 0 < as_nat h r /\\ as_nat h r < S.order)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let _X, _Y, _Z = S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2)\n (from_mont_point (as_point_nat h0 pk)) in\n b <==> (if S.is_point_at_inf (_X, _Y, _Z) then false\n else S.fmul _X (S.finv _Z) % S.order = as_nat h0 r)))\nlet ecdsa_verification_cmpr r pk u1 u2 =\n push_frame ();\n let res = create_point () in\n let h0 = ST.get () in\n point_mul_double_g res u1 u2 pk;\n let h1 = ST.get () in\n assert (S.to_aff_point (from_mont_point (as_point_nat h1 res)) ==\n S.to_aff_point (S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2)\n (from_mont_point (as_point_nat h0 pk))));\n\n SL.lemma_aff_is_point_at_inf (from_mont_point (as_point_nat h1 res));\n SL.lemma_aff_is_point_at_inf\n (S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2) (from_mont_point (as_point_nat h0 pk)));\n\n let b =\n if is_point_at_inf_vartime res then false\n else ecdsa_verify_finv res r in\n pop_frame ();\n b", "val verify_valid_pk_rs:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul\n -> a':point\n -> r':point ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h msg /\\ live h signature /\\ live h a' /\\ live h r' /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\ point_inv_full_t h a' /\\\n (F51.point_eval h a' == Some?.v (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))) /\\ point_inv_full_t h r' /\\\n (F51.point_eval h r' == Some?.v (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))))\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n z == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify_valid_pk_rs public_key msg_len msg signature a' r' =\n push_frame ();\n let hb = create 32ul (u8 0) in\n let rs = sub signature 0ul 32ul in\n let sb = sub signature 32ul 32ul in\n\n let b = verify_sb sb in\n let res =\n if b then false\n else begin\n Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre_pre2 hb rs public_key msg_len msg;\n verify_all_valid_hb sb hb a' r' end in\n pop_frame ();\n res", "val verify_valid_pk:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul\n -> a':point ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h msg /\\ live h signature /\\ live h a' /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\ point_inv_full_t h a' /\\\n (F51.point_eval h a' == Some?.v (Spec.Ed25519.point_decompress (as_seq h public_key))))\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n z == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify_valid_pk public_key msg_len msg signature a' =\n push_frame ();\n let r' = create 20ul (u64 0) in\n let rs = sub signature 0ul 32ul in\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.point_decompress_lemma (as_seq h0 rs);\n let b' = Hacl.Impl.Ed25519.PointDecompress.point_decompress r' rs in\n let res = if b' then verify_valid_pk_rs public_key msg_len msg signature a' r' else false in\n pop_frame ();\n res", "val ecdsa_sign_r (r k:qelem) : Stack unit\n (requires fun h ->\n live h r /\\ live h k /\\ disjoint r k /\\\n qas_nat h k < S.q)\n (ensures fun h0 _ h1 -> modifies (loc r) h0 h1 /\\\n (let _X, _Y, _Z = S.point_mul_g (qas_nat h0 k) in\n let x = S.fmul _X (S.finv _Z) in\n let r_s = x % S.q in\n qas_nat h1 r == r_s))\nlet ecdsa_sign_r r k =\n push_frame ();\n let tmp = create_felem () in\n let x_bytes = create 32ul (u8 0) in\n\n let p = create_point () in\n point_mul_g p k; // p = [k]G\n let x, y, z = getx p, gety p, getz p in\n to_aff_point_x tmp p;\n\n store_felem x_bytes tmp;\n load_qelem_modq r x_bytes; // r = aff_x % S.q\n pop_frame ()", "val ecdsa_verify_finv: p:point -> r:felem -> Stack bool\n (requires fun h ->\n live h p /\\ live h r /\\ disjoint p r /\\\n point_inv h p /\\ 0 < as_nat h r /\\ as_nat h r < S.order)\n //not (S.is_point_at_inf (from_mont_point (as_point_nat h p))))\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let (_X, _Y, _Z) = from_mont_point (as_point_nat h0 p) in\n b <==> (S.fmul _X (S.finv _Z) % S.order = as_nat h0 r)))\nlet ecdsa_verify_finv p r_q =\n push_frame ();\n let x = create_felem () in\n to_aff_point_x x p;\n qmod_short x x;\n let res = bn_is_eq_vartime4 x r_q in\n pop_frame ();\n res", "val point_store: res:lbuffer uint8 64ul -> p:point -> Stack unit\n (requires fun h ->\n live h res /\\ live h p /\\ disjoint res p /\\\n point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_seq h1 res == S.point_store (from_mont_point (as_point_nat h0 p)))\nlet point_store res p =\n push_frame ();\n let aff_p = create_aff_point () in\n to_aff_point aff_p p;\n aff_point_store res aff_p;\n pop_frame ()", "val ecdsa_sign_s (s k r d_a m:felem) : Stack unit\n (requires fun h ->\n live h s /\\ live h m /\\ live h d_a /\\ live h k /\\ live h r /\\\n disjoint s r /\\ disjoint s k /\\ disjoint r k /\\\n disjoint s d_a /\\ disjoint r d_a /\\ disjoint m s /\\\n\n 0 < as_nat h k /\\ as_nat h k < S.order /\\\n as_nat h r < S.order /\\ as_nat h m < S.order /\\\n 0 < as_nat h d_a /\\ as_nat h d_a < S.order)\n (ensures fun h0 _ h1 -> modifies (loc s |+| loc m) h0 h1 /\\\n (let kinv = S.qinv (as_nat h0 k) in\n as_nat h1 s == S.qmul kinv (S.qadd (as_nat h0 m) (S.qmul (as_nat h0 r) (as_nat h0 d_a)))))\nlet ecdsa_sign_s s k r d_a m =\n push_frame ();\n let h0 = ST.get () in\n let kinv = create_felem () in\n QI.qinv kinv k;\n let h1 = ST.get () in\n assert (qmont_as_nat h1 kinv == S.qinv (qmont_as_nat h0 k));\n SM.qmont_inv_lemma (as_nat h0 k);\n assert (qmont_as_nat h1 kinv == S.qinv (as_nat h0 k) * SM.qmont_R % S.order);\n\n qmul s r d_a; // s = r * d_a\n let h2 = ST.get () in\n assert (as_nat h2 s == (as_nat h0 r * as_nat h0 d_a * SM.qmont_R_inv) % S.order);\n from_qmont m m;\n let h3 = ST.get () in\n assert (as_nat h3 m == as_nat h2 m * SM.qmont_R_inv % S.order);\n qadd s m s; // s = z + s\n let h4 = ST.get () in\n assert (as_nat h4 s == (as_nat h3 m + as_nat h2 s) % S.order);\n qmul s kinv s; // s = kinv * s\n let h5 = ST.get () in\n assert (as_nat h5 s == (as_nat h1 kinv * as_nat h4 s * SM.qmont_R_inv) % S.order);\n SM.lemma_ecdsa_sign_s\n (as_nat h0 k) (as_nat h1 kinv) (as_nat h0 r) (as_nat h0 d_a) (as_nat h0 m);\n pop_frame ()", "val public_key_uncompressed_from_raw: pk:lbytes 65ul -> pk_raw:lbytes 64ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_uncompressed_from_raw (as_seq h0 pk_raw))\nlet public_key_uncompressed_from_raw pk pk_raw =\n let h0 = ST.get () in\n pk.(0ul) <- u8 0x04;\n update_sub pk 1ul 64ul pk_raw;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_uncompressed_from_raw (as_seq h0 pk_raw))", "val ecdsa_sign_load (d_a k_q:felem) (private_key nonce:lbytes 32ul) : Stack uint64\n (requires fun h ->\n live h private_key /\\ live h nonce /\\ live h d_a /\\ live h k_q /\\\n disjoint d_a k_q /\\ disjoint d_a private_key /\\ disjoint d_a nonce /\\\n disjoint k_q private_key /\\ disjoint k_q nonce)\n (ensures fun h0 m h1 -> modifies (loc d_a |+| loc k_q) h0 h1 /\\\n (let d_a_nat = BSeq.nat_from_bytes_be (as_seq h0 private_key) in\n let k_nat = BSeq.nat_from_bytes_be (as_seq h0 nonce) in\n let is_sk_valid = 0 < d_a_nat && d_a_nat < S.order in\n let is_nonce_valid = 0 < k_nat && k_nat < S.order in\n (v m = ones_v U64 \\/ v m = 0) /\\\n (v m = ones_v U64) = (is_sk_valid && is_nonce_valid) /\\\n as_nat h1 d_a == (if is_sk_valid then d_a_nat else 1) /\\\n as_nat h1 k_q == (if is_nonce_valid then k_nat else 1)))\nlet ecdsa_sign_load d_a k_q private_key nonce =\n let is_sk_valid = load_qelem_conditional d_a private_key in\n let is_nonce_valid = load_qelem_conditional k_q nonce in\n let m = is_sk_valid &. is_nonce_valid in\n logand_lemma is_sk_valid is_nonce_valid;\n m", "val point_mul: scalar:lbuffer uint8 32ul -> p:P.point -> out:P.point -> Stack unit\n (requires fun h ->\n live h scalar /\\ live h p /\\ live h out /\\\n disjoint out p /\\ disjoint out scalar /\\ disjoint p scalar /\\\n P.point_inv h p /\\\n BSeq.nat_from_bytes_be (as_seq h scalar) < S.q) // it's still safe to invoke this function with scalar >= S.q\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n P.point_inv h1 out /\\\n S.to_aff_point (P.point_eval h1 out) ==\n S.to_aff_point (S.point_mul (BSeq.nat_from_bytes_be (as_seq h0 scalar)) (P.point_eval h0 p)))\nlet point_mul scalar p out =\n push_frame ();\n let scalar_q = Q.create_qelem () in\n Q.load_qelem scalar_q scalar;\n PM.point_mul out scalar_q p;\n pop_frame ()", "val public_key_compressed_from_raw: pk:lbytes 33ul -> pk_raw:lbytes 64ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_compressed_from_raw (as_seq h0 pk_raw))\nlet public_key_compressed_from_raw pk pk_raw =\n let h0 = ST.get () in\n let pk_x = sub pk_raw 0ul 32ul in\n let pk_y = sub pk_raw 32ul 32ul in\n let is_pk_y_odd = is_nat_from_bytes_be_odd_vartime pk_y in\n pk.(0ul) <- if is_pk_y_odd then u8 0x03 else u8 0x02;\n update_sub pk 1ul 32ul pk_x;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_compressed_from_raw (as_seq h0 pk_raw))", "val point_store: res:lbuffer uint8 64ul -> p:point -> Stack unit\n (requires fun h ->\n live h res /\\ live h p /\\ disjoint res p /\\\n point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_seq h1 res == S.point_store (point_eval h0 p))\nlet point_store out p =\n push_frame ();\n let p_aff = create_aff_point () in\n to_aff_point p_aff p;\n aff_point_store out p_aff;\n pop_frame ()", "val point_mul_g_mk_q1234: out:point -> bscalar:lbuffer uint64 4ul -> q1:point ->\n Stack unit\n (requires fun h ->\n live h bscalar /\\ live h out /\\ live h q1 /\\\n disjoint out bscalar /\\ disjoint out q1 /\\\n BD.bn_v h bscalar < pow2 256 /\\\n F51.linv (as_seq h q1) /\\ refl (as_seq h q1) == g_aff)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.linv (as_seq h1 out) /\\\n (let (b0, b1, b2, b3) = SPT256.decompose_nat256_as_four_u64 (BD.bn_v h0 bscalar) in\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_four_fw S.mk_ed25519_comm_monoid\n g_aff 64 b0 g_pow2_64 b1 g_pow2_128 b2 g_pow2_192 b3 4))\nlet point_mul_g_mk_q1234 out bscalar q1 =\n push_frame ();\n let q2 = mk_ext_g_pow2_64 () in\n let q3 = mk_ext_g_pow2_128 () in\n let q4 = mk_ext_g_pow2_192 () in\n ext_g_pow2_64_lseq_lemma ();\n ext_g_pow2_128_lseq_lemma ();\n ext_g_pow2_192_lseq_lemma ();\n point_mul_g_noalloc out bscalar q1 q2 q3 q4;\n pop_frame ()", "val raw_to_uncompressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 65ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_uncompressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_uncompressed pk_raw pk =\n Hacl.Impl.P256.Compression.raw_to_uncompressed pk_raw pk", "val raw_to_uncompressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 65ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_uncompressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_uncompressed pk_raw pk =\n let h0 = ST.get () in\n pk.(0ul) <- u8 0x04;\n update_sub pk 1ul 64ul pk_raw;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_uncompressed_from_raw (as_seq h0 pk_raw))", "val ecdsa_verify_cmpr: r:QA.qelem -> pk:point -> u1:QA.qelem -> u2:QA.qelem -> Stack bool\n (requires fun h ->\n live h r /\\ live h pk /\\ live h u1 /\\ live h u2 /\\\n disjoint r u1 /\\ disjoint r u2 /\\ disjoint r pk /\\\n disjoint pk u1 /\\ disjoint pk u2 /\\\n point_inv h pk /\\ QA.qas_nat h u1 < S.q /\\ QA.qas_nat h u2 < S.q /\\\n 0 < QA.qas_nat h r /\\ QA.qas_nat h r < S.q)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let _X, _Y, _Z = S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk) in\n b <==> (if S.is_proj_point_at_inf (_X, _Y, _Z) then false\n else S.fmul _X (S.finv _Z) % S.q = QA.qas_nat h0 r)))\nlet ecdsa_verify_cmpr r pk u1 u2 =\n push_frame ();\n let res = create_point () in\n let h0 = ST.get () in\n point_mul_g_double_split_lambda_vartime res u1 u2 pk;\n let h1 = ST.get () in\n assert (S.to_aff_point (point_eval h1 res) ==\n S.to_aff_point (S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk)));\n\n KL.lemma_aff_is_point_at_inf (point_eval h1 res);\n KL.lemma_aff_is_point_at_inf (S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk));\n\n let b =\n if is_proj_point_at_inf_vartime res then false\n else ecdsa_verify_avoid_finv res r in\n pop_frame ();\n b", "val point_store: p:P.point -> out:lbuffer uint8 64ul -> Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ disjoint p out /\\\n P.point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == S.point_store (P.point_eval h0 p))\nlet point_store p out =\n P.point_store out p", "val ecdsa_sign_load (d_a k_q:qelem) (private_key nonce:lbytes 32ul) : Stack uint64\n (requires fun h ->\n live h private_key /\\ live h nonce /\\ live h d_a /\\ live h k_q /\\\n disjoint d_a k_q /\\ disjoint d_a private_key /\\ disjoint d_a nonce /\\\n disjoint k_q private_key /\\ disjoint k_q nonce)\n (ensures fun h0 m h1 -> modifies (loc d_a |+| loc k_q) h0 h1 /\\\n (let d_a_nat = BSeq.nat_from_bytes_be (as_seq h0 private_key) in\n let k_nat = BSeq.nat_from_bytes_be (as_seq h0 nonce) in\n let is_sk_valid = 0 < d_a_nat && d_a_nat < S.q in\n let is_nonce_valid = 0 < k_nat && k_nat < S.q in\n (v m = ones_v U64 \\/ v m = 0) /\\\n (v m = ones_v U64) = (is_sk_valid && is_nonce_valid) /\\\n qas_nat h1 d_a == (if is_sk_valid then d_a_nat else 1) /\\\n qas_nat h1 k_q == (if is_nonce_valid then k_nat else 1)))\nlet ecdsa_sign_load d_a k_q private_key nonce =\n let is_sk_valid = load_qelem_conditional d_a private_key in\n let is_nonce_valid = load_qelem_conditional k_q nonce in\n let m = is_sk_valid &. is_nonce_valid in\n logand_lemma is_sk_valid is_nonce_valid;\n m", "val ecdsa_sign_store (signature:lbytes 64ul) (r_q s_q:qelem) : Stack unit\n (requires fun h ->\n live h signature /\\ live h r_q /\\ live h s_q /\\\n disjoint signature r_q /\\ disjoint signature s_q /\\\n qas_nat h r_q < S.q /\\ qas_nat h s_q < S.q)\n (ensures fun h0 _ h1 -> modifies (loc signature) h0 h1 /\\\n (let r = BSeq.nat_to_bytes_be 32 (qas_nat h0 r_q) in\n let s = BSeq.nat_to_bytes_be 32 (qas_nat h0 s_q) in\n as_seq h1 signature == LSeq.concat #_ #32 #32 r s))\nlet ecdsa_sign_store signature r_q s_q =\n let h0 = ST.get () in\n update_sub_f h0 signature 0ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (qas_nat h0 r_q))\n (fun _ -> store_qelem (sub signature 0ul 32ul) r_q);\n\n let h1 = ST.get () in\n update_sub_f h1 signature 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (qas_nat h1 s_q))\n (fun _ -> store_qelem (sub signature 32ul 32ul) s_q);\n\n let h2 = ST.get () in\n let r = Ghost.hide (BSeq.nat_to_bytes_be 32 (qas_nat h0 r_q)) in\n let s = Ghost.hide (BSeq.nat_to_bytes_be 32 (qas_nat h0 s_q)) in\n LSeq.eq_intro (as_seq h2 signature) (LSeq.concat #_ #32 #32 r s)", "val public_key_uncompressed_to_raw: pk_raw:lbytes 64ul -> pk:lbytes 65ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_uncompressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_uncompressed_to_raw (as_seq h0 pk)))))\nlet public_key_uncompressed_to_raw pk_raw pk =\n let pk0 = pk.(0ul) in\n if Lib.RawIntTypes.u8_to_UInt8 pk0 <> 0x04uy then false\n else begin\n copy pk_raw (sub pk 1ul 64ul);\n true end", "val raw_to_compressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 33ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_compressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_compressed pk_raw pk =\n Hacl.Impl.P256.Compression.raw_to_compressed pk_raw pk", "val raw_to_compressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 33ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_compressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_compressed pk_raw pk =\n let h0 = ST.get () in\n let pk_x = sub pk_raw 0ul 32ul in\n let pk_y = sub pk_raw 32ul 32ul in\n pk.(0ul) <- raw_to_compressed_get_pk0 pk_y;\n update_sub pk 1ul 32ul pk_x;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_compressed_from_raw (as_seq h0 pk_raw))", "val point_mul: scalar:lbuffer uint8 32ul -> p:F51.point -> out:F51.point ->\n Stack unit\n (requires fun h ->\n live h scalar /\\ live h p /\\ live h out /\\\n disjoint out p /\\ disjoint out scalar /\\\n disjoint p scalar /\\\n F51.point_inv_t h p /\\ F51.inv_ext_point (as_seq h p))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out) /\\\n SE.to_aff_point (F51.point_eval h1 out) ==\n SE.to_aff_point (SE.point_mul (as_seq h0 scalar) (F51.point_eval h0 p)))\nlet point_mul scalar p out =\n Hacl.Impl.Ed25519.Ladder.point_mul out scalar p", "val point_mul_g_noalloc: out:point -> bscalar:lbuffer uint64 4ul\n -> q1:point -> q2:point\n -> q3:point -> q4:point ->\n Stack unit\n (requires fun h ->\n live h bscalar /\\ live h out /\\ live h q1 /\\\n live h q2 /\\ live h q3 /\\ live h q4 /\\\n disjoint out bscalar /\\ disjoint out q1 /\\ disjoint out q2 /\\\n disjoint out q3 /\\ disjoint out q4 /\\\n disjoint q1 q2 /\\ disjoint q1 q3 /\\ disjoint q1 q4 /\\\n disjoint q2 q3 /\\ disjoint q2 q4 /\\ disjoint q3 q4 /\\\n BD.bn_v h bscalar < pow2 256 /\\\n F51.linv (as_seq h q1) /\\ refl (as_seq h q1) == g_aff /\\\n F51.linv (as_seq h q2) /\\ refl (as_seq h q2) == g_pow2_64 /\\\n F51.linv (as_seq h q3) /\\ refl (as_seq h q3) == g_pow2_128 /\\\n F51.linv (as_seq h q4) /\\ refl (as_seq h q4) == g_pow2_192)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.linv (as_seq h1 out) /\\\n (let (b0, b1, b2, b3) = SPT256.decompose_nat256_as_four_u64 (BD.bn_v h0 bscalar) in\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_four_fw S.mk_ed25519_comm_monoid\n g_aff 64 b0 g_pow2_64 b1 g_pow2_128 b2 g_pow2_192 b3 4))\nlet point_mul_g_noalloc out bscalar q1 q2 q3 q4 =\n [@inline_let] let len = 20ul in\n [@inline_let] let ctx_len = 0ul in\n [@inline_let] let k = mk_ed25519_concrete_ops in\n [@inline_let] let l = 4ul in\n [@inline_let] let table_len = 16ul in\n [@inline_let] let bLen = 1ul in\n [@inline_let] let bBits = 64ul in\n\n let h0 = ST.get () in\n recall_contents precomp_basepoint_table_w4 precomp_basepoint_table_lseq_w4;\n let h1 = ST.get () in\n precomp_basepoint_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q1) (as_seq h1 precomp_basepoint_table_w4));\n\n recall_contents precomp_g_pow2_64_table_w4 precomp_g_pow2_64_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_64_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q2) (as_seq h1 precomp_g_pow2_64_table_w4));\n\n recall_contents precomp_g_pow2_128_table_w4 precomp_g_pow2_128_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_128_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q3) (as_seq h1 precomp_g_pow2_128_table_w4));\n\n recall_contents precomp_g_pow2_192_table_w4 precomp_g_pow2_192_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_192_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q4) (as_seq h1 precomp_g_pow2_192_table_w4));\n\n let r1 = sub bscalar 0ul 1ul in\n let r2 = sub bscalar 1ul 1ul in\n let r3 = sub bscalar 2ul 1ul in\n let r4 = sub bscalar 3ul 1ul in\n SPT256.lemma_decompose_nat256_as_four_u64_lbignum (as_seq h0 bscalar);\n\n ME.mk_lexp_four_fw_tables len ctx_len k l table_len\n table_inv_w4 table_inv_w4 table_inv_w4 table_inv_w4\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n (null uint64) q1 bLen bBits r1 q2 r2 q3 r3 q4 r4\n (to_const precomp_basepoint_table_w4)\n (to_const precomp_g_pow2_64_table_w4)\n (to_const precomp_g_pow2_128_table_w4)\n (to_const precomp_g_pow2_192_table_w4)\n out;\n\n LowStar.Ignore.ignore q2; // q2, q3, q4 are unused variables\n LowStar.Ignore.ignore q3;\n LowStar.Ignore.ignore q4", "val aff_point_store: res:lbuffer uint8 64ul -> p:aff_point -> Stack unit\n (requires fun h ->\n live h res /\\ live h p /\\ disjoint res p /\\\n aff_point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_seq h1 res == S.aff_point_store (aff_point_eval h0 p))\nlet aff_point_store out p =\n let px = aff_getx p in\n let py = aff_gety p in\n\n let h0 = ST.get () in\n update_sub_f h0 out 0ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (as_nat h0 px))\n (fun _ -> store_felem (sub out 0ul 32ul) px);\n\n let h1 = ST.get () in\n update_sub_f h1 out 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (as_nat h1 py))\n (fun _ -> store_felem (sub out 32ul 32ul) py);\n\n let h2 = ST.get () in\n let px = Ghost.hide (BSeq.nat_to_bytes_be 32 (as_nat h0 px)) in\n let py = Ghost.hide (BSeq.nat_to_bytes_be 32 (as_nat h0 py)) in\n LSeq.eq_intro (as_seq h2 out) (LSeq.concat #_ #32 #32 px py)", "val public_key_compressed_to_raw: pk_raw:lbytes 64ul -> pk:lbytes 33ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))\nlet public_key_compressed_to_raw pk_raw pk =\n push_frame ();\n let xa = create_felem () in\n let ya = create_felem () in\n let pk_xb = sub pk 1ul 32ul in\n let b = P.aff_point_decompress_vartime xa ya pk in\n\n if b then begin\n let h0 = ST.get () in\n update_sub pk_raw 0ul 32ul pk_xb;\n let h1 = ST.get () in\n update_sub_f h1 pk_raw 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (feval h1 ya))\n (fun _ -> store_felem (sub pk_raw 32ul 32ul) ya);\n let h2 = ST.get () in\n LSeq.eq_intro (as_seq h2 pk_raw)\n (LSeq.concat #_ #32 #32(as_seq h0 pk_xb) (BSeq.nat_to_bytes_be 32 (feval h0 ya))) end;\n pop_frame ();\n b", "val uncompressed_to_raw: pk:lbuffer uint8 65ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_uncompressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_uncompressed_to_raw (as_seq h0 pk)))))\nlet uncompressed_to_raw pk pk_raw =\n Hacl.Impl.P256.Compression.uncompressed_to_raw pk pk_raw", "val uncompressed_to_raw: pk:lbuffer uint8 65ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_uncompressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_uncompressed_to_raw (as_seq h0 pk)))))\nlet uncompressed_to_raw pk pk_raw =\n let pk0 = pk.(0ul) in\n if Lib.RawIntTypes.u8_to_UInt8 pk0 <> 0x04uy then false\n else begin\n copy pk_raw (sub pk 1ul 64ul);\n true end", "val aff_point_store: res:lbuffer uint8 64ul -> p:aff_point -> Stack unit\n (requires fun h ->\n live h res /\\ live h p /\\ disjoint res p /\\\n aff_point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_seq h1 res == S.aff_point_store (as_aff_point_nat h0 p))\nlet aff_point_store res p =\n let px = aff_getx p in\n let py = aff_gety p in\n bn2_to_bytes_be4 res px py", "val ecdsa_sign_s (s k r d_a:qelem) (m:lbytes 32ul) : Stack unit\n (requires fun h ->\n live h s /\\ live h m /\\ live h d_a /\\ live h k /\\ live h r /\\\n disjoint s r /\\ disjoint s k /\\ disjoint r k /\\\n disjoint s d_a /\\ disjoint r d_a /\\\n\n 0 < qas_nat h k /\\ qas_nat h k < S.q /\\\n qas_nat h r < S.q /\\\n 0 < qas_nat h d_a /\\ qas_nat h d_a < S.q)\n (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\\\n (let z = BSeq.nat_from_bytes_be (as_seq h0 m) % S.q in\n let kinv = S.qinv (qas_nat h0 k) in\n let s_s = S.qmul kinv (S.qadd z (S.qmul (qas_nat h0 r) (qas_nat h0 d_a))) in\n qas_nat h1 s == s_s))\nlet ecdsa_sign_s s k r d_a m =\n push_frame ();\n let z = create_qelem () in\n let kinv = create_qelem () in\n\n load_qelem_modq z m; // z = m % S.q\n QI.qinv kinv k;\n\n qmul s r d_a; // s = r * d_a\n qadd s z s; // s = z + s\n qmul s kinv s; // s = kinv * s\n pop_frame ()", "val compressed_to_raw: pk:lbuffer uint8 33ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))\nlet compressed_to_raw pk pk_raw =\n Hacl.Impl.P256.Compression.compressed_to_raw pk pk_raw", "val compressed_to_raw: pk:lbuffer uint8 33ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))\nlet compressed_to_raw pk pk_raw =\n push_frame ();\n let xa = create_felem () in\n let ya = create_felem () in\n let pk_xb = sub pk 1ul 32ul in\n let b = P.aff_point_decompress_vartime xa ya pk in\n\n if b then begin\n let h0 = ST.get () in\n update_sub pk_raw 0ul 32ul pk_xb;\n let h1 = ST.get () in\n update_sub_f h1 pk_raw 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (as_nat h1 ya))\n (fun _ -> bn_to_bytes_be4 (sub pk_raw 32ul 32ul) ya);\n let h2 = ST.get () in\n LSeq.eq_intro (as_seq h2 pk_raw)\n (LSeq.concat #_ #32 #32 (as_seq h0 pk_xb) (BSeq.nat_to_bytes_be 32 (as_nat h0 ya))) end;\n pop_frame ();\n b", "val point_mul_noalloc:\n out:point\n -> bscalar:lbuffer uint64 4ul\n -> q:point ->\n Stack unit\n (requires fun h ->\n live h bscalar /\\ live h q /\\ live h out /\\\n disjoint q out /\\ disjoint q bscalar /\\ disjoint out bscalar /\\\n F51.point_inv_t h q /\\ F51.inv_ext_point (as_seq h q) /\\\n BD.bn_v h bscalar < pow2 256)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_fw S.mk_ed25519_comm_monoid\n (S.to_aff_point (F51.point_eval h0 q)) 256 (BD.bn_v h0 bscalar) 4)\nlet point_mul_noalloc out bscalar q =\n BE.lexp_fw_consttime 20ul 0ul mk_ed25519_concrete_ops\n 4ul (null uint64) q 4ul 256ul bscalar out", "val point_mul_g_noalloc: out:point -> scalar:felem\n -> q1:point -> q2:point\n -> q3:point -> q4:point ->\n Stack unit\n (requires fun h ->\n live h scalar /\\ live h out /\\ live h q1 /\\\n live h q2 /\\ live h q3 /\\ live h q4 /\\\n disjoint out scalar /\\ disjoint out q1 /\\ disjoint out q2 /\\\n disjoint out q3 /\\ disjoint out q4 /\\\n disjoint q1 q2 /\\ disjoint q1 q3 /\\ disjoint q1 q4 /\\\n disjoint q2 q3 /\\ disjoint q2 q4 /\\ disjoint q3 q4 /\\\n as_nat h scalar < S.order /\\\n point_inv h q1 /\\ refl (as_seq h q1) == g_aff /\\\n point_inv h q2 /\\ refl (as_seq h q2) == g_pow2_64 /\\\n point_inv h q3 /\\ refl (as_seq h q3) == g_pow2_128 /\\\n point_inv h q4 /\\ refl (as_seq h q4) == g_pow2_192)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n point_inv h1 out /\\\n (let (b0, b1, b2, b3) = SPT256.decompose_nat256_as_four_u64 (as_nat h0 scalar) in\n S.to_aff_point (from_mont_point (as_point_nat h1 out)) ==\n LE.exp_four_fw S.mk_p256_comm_monoid g_aff 64 b0 g_pow2_64 b1 g_pow2_128 b2 g_pow2_192 b3 4))\nlet point_mul_g_noalloc out scalar q1 q2 q3 q4 =\n [@inline_let] let len = 12ul in\n [@inline_let] let ctx_len = 0ul in\n [@inline_let] let k = mk_p256_concrete_ops in\n [@inline_let] let l = 4ul in\n [@inline_let] let table_len = 16ul in\n [@inline_let] let bLen = 1ul in\n [@inline_let] let bBits = 64ul in\n\n let h0 = ST.get () in\n recall_contents precomp_basepoint_table_w4 precomp_basepoint_table_lseq_w4;\n let h1 = ST.get () in\n precomp_basepoint_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q1) (as_seq h1 precomp_basepoint_table_w4));\n\n recall_contents precomp_g_pow2_64_table_w4 precomp_g_pow2_64_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_64_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q2) (as_seq h1 precomp_g_pow2_64_table_w4));\n\n recall_contents precomp_g_pow2_128_table_w4 precomp_g_pow2_128_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_128_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q3) (as_seq h1 precomp_g_pow2_128_table_w4));\n\n recall_contents precomp_g_pow2_192_table_w4 precomp_g_pow2_192_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_192_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q4) (as_seq h1 precomp_g_pow2_192_table_w4));\n\n let r1 = sub scalar 0ul 1ul in\n let r2 = sub scalar 1ul 1ul in\n let r3 = sub scalar 2ul 1ul in\n let r4 = sub scalar 3ul 1ul in\n SPT256.lemma_decompose_nat256_as_four_u64_lbignum (as_seq h0 scalar);\n\n ME.mk_lexp_four_fw_tables len ctx_len k l table_len\n table_inv_w4 table_inv_w4 table_inv_w4 table_inv_w4\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n (null uint64) q1 bLen bBits r1 q2 r2 q3 r3 q4 r4\n (to_const precomp_basepoint_table_w4)\n (to_const precomp_g_pow2_64_table_w4)\n (to_const precomp_g_pow2_128_table_w4)\n (to_const precomp_g_pow2_192_table_w4)\n out", "val ecdsa_verify_msg_as_qelem:\n m_q:felem\n -> public_key:lbuffer uint8 64ul\n -> signature_r:lbuffer uint8 32ul\n -> signature_s:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h signature_r /\\ live h signature_s /\\ live h m_q /\\\n as_nat h m_q < S.order)\n (ensures fun h0 result h1 -> modifies0 h0 h1 /\\\n result == S.ecdsa_verify_msg_as_qelem (as_nat h0 m_q)\n (as_seq h0 public_key) (as_seq h0 signature_r) (as_seq h0 signature_s))\nlet ecdsa_verify_msg_as_qelem m_q public_key signature_r signature_s =\n push_frame ();\n let tmp = create 28ul (u64 0) in\n let pk = sub tmp 0ul 12ul in\n let r_q = sub tmp 12ul 4ul in\n let s_q = sub tmp 16ul 4ul in\n let u1 = sub tmp 20ul 4ul in\n let u2 = sub tmp 24ul 4ul in\n\n let is_pk_valid = load_point_vartime pk public_key in\n let is_rs_valid = load_signature r_q s_q signature_r signature_s in\n\n let res =\n if not (is_pk_valid && is_rs_valid) then false\n else begin\n ecdsa_verification_get_u12 u1 u2 r_q s_q m_q;\n ecdsa_verification_cmpr r_q pk u1 u2 end in\n pop_frame ();\n res", "val point_mul_g_noalloc: out:point -> scalar:qelem\n -> q1:point -> q2:point\n -> q3:point -> q4:point ->\n Stack unit\n (requires fun h ->\n live h scalar /\\ live h out /\\ live h q1 /\\\n live h q2 /\\ live h q3 /\\ live h q4 /\\\n disjoint out scalar /\\ disjoint out q1 /\\ disjoint out q2 /\\\n disjoint out q3 /\\ disjoint out q4 /\\\n disjoint q1 q2 /\\ disjoint q1 q3 /\\ disjoint q1 q4 /\\\n disjoint q2 q3 /\\ disjoint q2 q4 /\\ disjoint q3 q4 /\\\n qas_nat h scalar < S.q /\\\n point_inv h q1 /\\ refl (as_seq h q1) == g_aff /\\\n point_inv h q2 /\\ refl (as_seq h q2) == g_pow2_64 /\\\n point_inv h q3 /\\ refl (as_seq h q3) == g_pow2_128 /\\\n point_inv h q4 /\\ refl (as_seq h q4) == g_pow2_192)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n point_inv h1 out /\\\n (let (b0, b1, b2, b3) = SPT256.decompose_nat256_as_four_u64 (qas_nat h0 scalar) in\n S.to_aff_point (point_eval h1 out) ==\n LE.exp_four_fw S.mk_k256_comm_monoid g_aff 64 b0 g_pow2_64 b1 g_pow2_128 b2 g_pow2_192 b3 4))\nlet point_mul_g_noalloc out scalar q1 q2 q3 q4 =\n [@inline_let] let len = 15ul in\n [@inline_let] let ctx_len = 0ul in\n [@inline_let] let k = mk_k256_concrete_ops in\n [@inline_let] let l = 4ul in\n [@inline_let] let table_len = 16ul in\n [@inline_let] let bLen = 1ul in\n [@inline_let] let bBits = 64ul in\n\n let h0 = ST.get () in\n recall_contents precomp_basepoint_table_w4 precomp_basepoint_table_lseq_w4;\n let h1 = ST.get () in\n precomp_basepoint_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q1) (as_seq h1 precomp_basepoint_table_w4));\n\n recall_contents precomp_g_pow2_64_table_w4 precomp_g_pow2_64_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_64_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q2) (as_seq h1 precomp_g_pow2_64_table_w4));\n\n recall_contents precomp_g_pow2_128_table_w4 precomp_g_pow2_128_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_128_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q3) (as_seq h1 precomp_g_pow2_128_table_w4));\n\n recall_contents precomp_g_pow2_192_table_w4 precomp_g_pow2_192_table_lseq_w4;\n let h1 = ST.get () in\n precomp_g_pow2_192_table_lemma_w4 ();\n assert (table_inv_w4 (as_seq h1 q4) (as_seq h1 precomp_g_pow2_192_table_w4));\n\n let r1 = sub scalar 0ul 1ul in\n let r2 = sub scalar 1ul 1ul in\n let r3 = sub scalar 2ul 1ul in\n let r4 = sub scalar 3ul 1ul in\n SPT256.lemma_decompose_nat256_as_four_u64_lbignum (as_seq h0 scalar);\n\n ME.mk_lexp_four_fw_tables len ctx_len k l table_len\n table_inv_w4 table_inv_w4 table_inv_w4 table_inv_w4\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n precomp_get_consttime\n (null uint64) q1 bLen bBits r1 q2 r2 q3 r3 q4 r4\n (to_const precomp_basepoint_table_w4)\n (to_const precomp_g_pow2_64_table_w4)\n (to_const precomp_g_pow2_128_table_w4)\n (to_const precomp_g_pow2_192_table_w4)\n out", "val check_signature: are_sk_nonce_valid:uint64 -> r_q:felem -> s_q:felem -> Stack bool\n (requires fun h ->\n live h r_q /\\ live h s_q /\\ disjoint r_q s_q /\\\n (v are_sk_nonce_valid = ones_v U64 \\/ v are_sk_nonce_valid = 0))\n (ensures fun h0 res h1 -> modifies0 h0 h1 /\\\n res == ((v are_sk_nonce_valid = ones_v U64) && (0 < as_nat h0 r_q) && (0 < as_nat h0 s_q)))\nlet check_signature are_sk_nonce_valid r_q s_q =\n let h0 = ST.get () in\n let is_r_zero = bn_is_zero_mask4 r_q in\n let is_s_zero = bn_is_zero_mask4 s_q in\n [@inline_let] let m0 = lognot is_r_zero in\n [@inline_let] let m1 = lognot is_s_zero in\n [@inline_let] let m2 = m0 &. m1 in\n lognot_lemma is_r_zero;\n lognot_lemma is_s_zero;\n logand_lemma m0 m1;\n let m = are_sk_nonce_valid &. m2 in\n logand_lemma are_sk_nonce_valid m2;\n assert ((v m = ones_v U64) <==>\n ((v are_sk_nonce_valid = ones_v U64) && (0 < as_nat h0 r_q) && (0 < as_nat h0 s_q)));\n BB.unsafe_bool_of_limb m", "val ecdh:\n shared_secret:lbuffer uint8 64ul\n -> their_pubkey:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h shared_secret /\\ live h their_pubkey /\\ live h private_key /\\\n disjoint shared_secret their_pubkey /\\ disjoint shared_secret private_key)\n (ensures fun h0 r h1 -> modifies (loc shared_secret) h0 h1 /\\\n (let ss = S.ecdh (as_seq h0 their_pubkey) (as_seq h0 private_key) in\n (r <==> Some? ss) /\\ (r ==> (as_seq h1 shared_secret == Some?.v ss))))\nlet ecdh shared_secret their_pubkey private_key =\n push_frame ();\n let tmp = create 34ul (u64 0) in\n let pk = sub tmp 0ul 15ul in\n let ss = sub tmp 15ul 15ul in\n let sk = sub tmp 30ul 4ul in\n\n let is_pk_valid = P.load_point_vartime pk their_pubkey in\n let is_sk_valid = load_qelem_conditional sk private_key in\n\n if is_pk_valid then begin\n PM.point_mul ss sk pk;\n P.point_store shared_secret ss end;\n pop_frame ();\n BB.unsafe_bool_of_limb is_sk_valid && is_pk_valid", "val point_add_noalloc: tmp:lbuffer uint64 24ul -> res:point -> p:point -> q:point -> Stack unit\n (requires fun h ->\n live h p /\\ live h q /\\ live h res /\\ live h tmp /\\\n eq_or_disjoint p q /\\ disjoint q res /\\ disjoint p res /\\\n disjoint tmp p /\\ disjoint tmp q /\\ disjoint tmp res /\\\n point_inv h p /\\ point_inv h q)\n (ensures fun h0 _ h1 -> modifies (loc res |+| loc tmp) h0 h1 /\\\n point_inv h1 res /\\\n from_mont_point (as_point_nat h1 res) ==\n S.point_add (from_mont_point (as_point_nat h0 p)) (from_mont_point (as_point_nat h0 q)))\nlet point_add_noalloc tmp res p q =\n let x3, y3, z3 = getx res, gety res, getz res in\n let t0 = sub tmp 0ul 4ul in\n let t1 = sub tmp 4ul 4ul in\n let t2 = sub tmp 8ul 4ul in\n let t3 = sub tmp 12ul 4ul in\n let t4 = sub tmp 16ul 4ul in\n let t5 = sub tmp 20ul 4ul in\n point_add_1 t0 t1 t2 t3 t4 p q;\n point_add_2 t1 t2 t3 t4 t5 p q;\n point_add_3 x3 y3 t0 t2 p q;\n point_add_4 x3 y3 z3 t1 t2;\n point_add_5 x3 y3 z3 t0 t1 t2;\n point_add_6 x3 y3 z3 t0 t1 t2 t4;\n point_add_7 x3 y3 z3 t0 t1 t2 t3 t4", "val check_signature: are_sk_nonce_valid:uint64 -> r_q:qelem -> s_q:qelem -> Stack bool\n (requires fun h ->\n live h r_q /\\ live h s_q /\\ disjoint r_q s_q /\\\n (v are_sk_nonce_valid = ones_v U64 \\/ v are_sk_nonce_valid = 0))\n (ensures fun h0 res h1 -> modifies0 h0 h1 /\\\n res == ((v are_sk_nonce_valid = ones_v U64) && (0 < qas_nat h0 r_q) && (0 < qas_nat h0 s_q)))\nlet check_signature are_sk_nonce_valid r_q s_q =\n let h0 = ST.get () in\n let is_r_zero = is_qelem_zero r_q in\n let is_s_zero = is_qelem_zero s_q in\n assert (v is_r_zero == (if qas_nat h0 r_q = 0 then ones_v U64 else 0));\n assert (v is_s_zero == (if qas_nat h0 s_q = 0 then ones_v U64 else 0));\n [@inline_let] let m0 = lognot is_r_zero in\n [@inline_let] let m1 = lognot is_s_zero in\n [@inline_let] let m2 = m0 &. m1 in\n lognot_lemma is_r_zero;\n lognot_lemma is_s_zero;\n assert (v m0 == (if qas_nat h0 r_q = 0 then 0 else ones_v U64));\n assert (v m1 == (if qas_nat h0 s_q = 0 then 0 else ones_v U64));\n logand_lemma m0 m1;\n assert (v m2 = (if v m0 = 0 then 0 else v m1));\n assert ((v m2 = 0) <==> (qas_nat h0 r_q = 0 || qas_nat h0 s_q = 0));\n let m = are_sk_nonce_valid &. m2 in\n logand_lemma are_sk_nonce_valid m2;\n assert ((v m = ones_v U64) <==>\n ((v are_sk_nonce_valid = ones_v U64) && (0 < qas_nat h0 r_q) && (0 < qas_nat h0 s_q)));\n BB.unsafe_bool_of_limb m", "val ecdsa_verification_get_u12: u1:felem -> u2:felem -> r:felem -> s:felem -> z:felem -> Stack unit\n (requires fun h ->\n live h r /\\ live h s /\\ live h z /\\ live h u1 /\\ live h u2 /\\\n disjoint u1 u2 /\\ disjoint u1 z /\\ disjoint u1 r /\\ disjoint u1 s /\\\n disjoint u2 z /\\ disjoint u2 r /\\ disjoint u2 s /\\\n as_nat h s < S.order /\\ as_nat h z < S.order /\\ as_nat h r < S.order)\n (ensures fun h0 _ h1 -> modifies (loc u1 |+| loc u2) h0 h1 /\\\n (let sinv = S.qinv (as_nat h0 s) in\n as_nat h1 u1 == sinv * as_nat h0 z % S.order /\\\n as_nat h1 u2 == sinv * as_nat h0 r % S.order))\nlet ecdsa_verification_get_u12 u1 u2 r s z =\n push_frame ();\n let h0 = ST.get () in\n let sinv = create_felem () in\n QI.qinv sinv s;\n let h1 = ST.get () in\n assert (qmont_as_nat h1 sinv == S.qinv (qmont_as_nat h0 s));\n //assert (as_nat h2 sinv * SM.qmont_R_inv % S.order ==\n //S.qinv (as_nat h1 sinv * SM.qmont_R_inv % S.order));\n\n SM.qmont_inv_mul_lemma (as_nat h0 s) (as_nat h1 sinv) (as_nat h0 z);\n SM.qmont_inv_mul_lemma (as_nat h0 s) (as_nat h1 sinv) (as_nat h0 r);\n qmul_mont sinv z u1;\n qmul_mont sinv r u2;\n pop_frame ()", "val test_secret_to_public:\n sk:lbuffer uint8 32ul\n -> pk:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h -> live h sk /\\ live h pk)\n (ensures fun h0 _ h1 -> modifies0 h0 h1)\nlet test_secret_to_public sk pk =\n push_frame ();\n let pk_comp = create 64ul (u8 0) in\n let b = K256.secret_to_public pk_comp sk in\n\n C.String.print (C.String.of_literal \"\\n Test K256 secret_to_public: \");\n let is_eq = result_compare_display 64ul (to_const pk) (to_const pk_comp) in\n if (is_eq && b) then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l);\n pop_frame ()", "val dh_initiator:\n public_key:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 r h1 -> modifies (loc public_key) h0 h1 /\\\n (let pk = S.secret_to_public (as_seq h0 private_key) in\n (r <==> Some? pk) /\\ (r ==> (as_seq h1 public_key == Some?.v pk))))\nlet dh_initiator public_key private_key =\n Hacl.Impl.P256.DH.ecp256dh_i public_key private_key", "val crypto_box_beforenm:\n k:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul ->\n Stack size_t\n (requires fun h -> live h k /\\ live h pk /\\ live h sk /\\\n disjoint k pk /\\ disjoint k sk)\n (ensures fun h0 r h1 -> modifies1 k h0 h1 /\\\n (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in\n match r with\n | 0ul -> Some? key /\\ as_seq h1 k == Some?.v key\n | _ -> None? key))\nlet crypto_box_beforenm k pk sk =\n Hacl.Impl.Box.box_beforenm k pk sk", "val point_double_noalloc: tmp:lbuffer uint64 20ul -> res:point -> p:point -> Stack unit\n (requires fun h ->\n live h p /\\ live h res /\\ live h tmp /\\\n eq_or_disjoint p res /\\ disjoint tmp res /\\ disjoint tmp p /\\\n point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc res |+| loc tmp) h0 h1 /\\\n point_inv h1 res /\\\n from_mont_point (as_point_nat h1 res) ==\n S.point_double (from_mont_point (as_point_nat h0 p)))\nlet point_double_noalloc tmp res p =\n let x, z = getx p, getz p in\n let x3, y3, z3 = getx res, gety res, getz res in\n let t0 = sub tmp 0ul 4ul in\n let t1 = sub tmp 4ul 4ul in\n let t2 = sub tmp 8ul 4ul in\n let t3 = sub tmp 12ul 4ul in\n let t4 = sub tmp 16ul 4ul in\n point_double_1 t0 t1 t2 t3 t4 p;\n fmul z3 x z;\n point_double_2 x3 y3 z3 t2;\n point_double_3 x3 y3 t1 t2 t3;\n point_double_4 z3 t0 t2 t3;\n point_double_5 y3 z3 t0 t2 t3;\n point_double_6 x3 z3 t0 t1 t4", "val ecdsa_verify_avoid_finv: p:point -> r:QA.qelem -> Stack bool\n (requires fun h ->\n live h p /\\ live h r /\\ disjoint p r /\\\n point_inv h p /\\ QA.qe_lt_q h r /\\ 0 < QA.qas_nat h r /\\\n not (S.is_proj_point_at_inf (point_eval h p)))\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let (_X, _Y, _Z) = point_eval h0 p in\n b <==> (S.fmul _X (S.finv _Z) % S.q = QA.qas_nat h0 r)))\nlet ecdsa_verify_avoid_finv p r =\n let h0 = ST.get () in\n let x, y, z = getx p, gety p, getz p in\n\n push_frame ();\n let r_bytes = create 32ul (u8 0) in\n let r_fe = create_felem () in\n let tmp_q = create_felem () in\n let tmp_x = create_felem () in\n\n QA.store_qelem r_bytes r;\n load_felem r_fe r_bytes;\n let h1 = ST.get () in\n assert (modifies (loc r_fe) h0 h1);\n //assert (inv_fully_reduced h1 r_fe);\n //assert (as_nat h1 r_fe == qas_nat h1 r);\n\n let h2 = ST.get () in\n fnormalize tmp_x x;\n let h3 = ST.get () in\n assert (modifies (loc tmp_x) h2 h3);\n BL.normalize5_lemma (1,1,1,1,2) (as_felem5 h2 x);\n //assert (inv_fully_reduced h3 tmp_x);\n //assert (inv_lazy_reduced2 h3 z);\n\n let is_rz_x = fmul_eq_vartime r_fe z tmp_x in\n //assert (is_rz_x == (S.fmul (as_nat h3 r_fe) (feval h3 z) = as_nat h3 tmp_x));\n\n let res : bool =\n if not is_rz_x then begin\n let is_r_lt_p_m_q = is_felem_lt_prime_minus_order_vartime r_fe in\n if is_r_lt_p_m_q then begin\n assert (as_nat h1 r_fe < S.prime - S.q);\n make_u52_5 tmp_q (make_order_k256 ());\n let h4 = ST.get () in\n BL.add5_lemma (1,1,1,1,1) (1,1,1,1,1) (as_felem5 h4 r_fe) (as_felem5 h4 tmp_q);\n fadd tmp_q r_fe tmp_q;\n fmul_eq_vartime tmp_q z tmp_x end\n //assert (is_rqz_x == (S.fmul (feval h5 tmp) (feval h5 z) = as_nat h5 tmp_x));\n else false end\n else true in\n\n let h4 = ST.get () in\n assert (modifies (loc tmp_q) h3 h4);\n\n pop_frame ();\n KL.ecdsa_verify_avoid_finv (point_eval h0 p) (QA.qas_nat h0 r);\n assert (res <==> (S.fmul (feval h0 x) (S.finv (feval h0 z)) % S.q = QA.qas_nat h0 r));\n let h5 = ST.get () in\n assert (modifies0 h0 h5);\n res", "val point_mul:\n out:point\n -> scalar:lbuffer uint8 32ul\n -> q:point ->\n Stack unit\n (requires fun h ->\n live h scalar /\\ live h q /\\ live h out /\\\n disjoint q out /\\ disjoint q scalar /\\\n F51.point_inv_t h q /\\ F51.inv_ext_point (as_seq h q))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n S.to_aff_point (S.point_mul (as_seq h0 scalar) (F51.point_eval h0 q)))\nlet point_mul out scalar q =\n let h0 = ST.get () in\n SE.exp_fw_lemma S.mk_ed25519_concrete_ops\n (F51.point_eval h0 q) 256 (BSeq.nat_from_bytes_le (as_seq h0 scalar)) 4;\n push_frame ();\n let bscalar = create 4ul (u64 0) in\n convert_scalar scalar bscalar;\n point_mul_noalloc out bscalar q;\n pop_frame ()", "val test_secret_to_public:\n sk:lbuffer uint8 32ul\n -> expected_pk:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h -> live h sk /\\ live h expected_pk)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_secret_to_public sk expected_pk =\n push_frame ();\n let pk = create 32ul (u8 0) in\n Ed25519.secret_to_public pk sk;\n\n C.String.print (C.String.of_literal \"Test Ed25519 Secret_to_public:\\n\");\n if not (result_compare_display 32ul (to_const pk) (to_const expected_pk)) then C.exit 255l;\n pop_frame ()", "val verify_all_valid_hb (sb hb:lbuffer uint8 32ul) (a' r':point) : Stack bool\n (requires fun h ->\n live h sb /\\ live h hb /\\ live h a' /\\ live h r' /\\\n point_inv_full_t h a' /\\ point_inv_full_t h r')\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n (z == Spec.Ed25519.(\n let exp_d = point_negate_mul_double_g (as_seq h0 sb) (as_seq h0 hb) (F51.point_eval h0 a') in\n point_equal exp_d (F51.point_eval h0 r'))))\nlet verify_all_valid_hb sb hb a' r' =\n push_frame ();\n let exp_d = create 20ul (u64 0) in\n PM.point_negate_mul_double_g_vartime exp_d sb hb a';\n let b = Hacl.Impl.Ed25519.PointEqual.point_equal exp_d r' in\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.point_equal_lemma\n (F51.point_eval h0 exp_d)\n (Spec.Ed25519.point_negate_mul_double_g (as_seq h0 sb) (as_seq h0 hb) (F51.point_eval h0 a'))\n (F51.point_eval h0 r');\n pop_frame ();\n b", "val point_mul_g:\n out:point\n -> scalar:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h scalar /\\ live h out /\\ disjoint out scalar)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n S.to_aff_point (S.point_mul_g (as_seq h0 scalar)))\nlet point_mul_g out scalar =\n push_frame ();\n let h0 = ST.get () in\n let bscalar = create 4ul (u64 0) in\n convert_scalar scalar bscalar;\n let q1 = create 20ul (u64 0) in\n make_g q1;\n point_mul_g_mk_q1234 out bscalar q1;\n lemma_exp_four_fw_local (as_seq h0 scalar);\n pop_frame ()", "val point_mul: res:point -> scalar:felem -> p:point -> Stack unit\n (requires fun h ->\n live h p /\\ live h res /\\ live h scalar /\\\n disjoint p res /\\ disjoint scalar res /\\ disjoint p scalar /\\\n point_inv h p /\\ as_nat h scalar < S.order)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n point_inv h1 res /\\\n S.to_aff_point (from_mont_point (as_point_nat h1 res)) ==\n S.to_aff_point (S.point_mul (as_nat h0 scalar) (from_mont_point (as_point_nat h0 p))))\nlet point_mul res scalar p =\n let h0 = ST.get () in\n SE.exp_fw_lemma S.mk_p256_concrete_ops\n (from_mont_point (as_point_nat h0 p)) 256 (as_nat h0 scalar) 4;\n BE.lexp_fw_consttime 12ul 0ul mk_p256_concrete_ops 4ul (null uint64) p 4ul 256ul scalar res", "val load_point_vartime: res:point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.load_point (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (point_inv h1 res /\\\n from_mont_point (as_point_nat h1 res) == Some?.v ps))))\nlet load_point_vartime p b =\n push_frame ();\n let p_aff = create_aff_point () in\n let res = aff_point_load_vartime p_aff b in\n if res then to_proj_point p p_aff;\n pop_frame ();\n res", "val point_compress_:\n tmp:lbuffer uint64 15ul\n -> p:point ->\n Stack unit\n (requires fun h -> live h tmp /\\ live h p /\\ disjoint tmp p /\\ F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\\ (\n let zinv = Spec.Curve25519.finv (F51.fevalh h0 (gsub p 10ul 5ul)) in\n let x = Spec.Curve25519.fmul (F51.fevalh h0 (gsub p 0ul 5ul)) zinv in\n let y = Spec.Curve25519.fmul (F51.fevalh h0 (gsub p 5ul 5ul)) zinv in\n F51.mul_inv_t h1 (gsub tmp 10ul 5ul) /\\\n F51.fevalh h1 (gsub tmp 10ul 5ul) == y /\\\n F51.as_nat h1 (gsub tmp 5ul 5ul) == x)\n )\nlet point_compress_ tmp p =\n let zinv = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let out = sub tmp 10ul 5ul in\n let px = getx p in\n let py = gety p in\n let pz = getz p in\n\n inverse zinv pz;\n fmul x px zinv;\n reduce x;\n fmul out py zinv;\n reduce_513 out", "val point_decompress_:\n out:point\n -> s:lbuffer uint8 32ul\n -> tmp:lbuffer uint64 10ul ->\n Stack bool\n (requires fun h ->\n live h out /\\ live h s /\\ live h tmp /\\\n disjoint s tmp /\\ disjoint out tmp /\\\n F51.mul_inv_t h (gsub tmp 5ul 5ul)\n )\n (ensures fun h0 b h1 -> modifies (loc out |+| loc tmp) h0 h1 /\\\n (b <==> Some? (SE.point_decompress (as_seq h0 s))) /\\\n (b ==> F51.point_inv_t h1 out) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (SE.point_decompress (as_seq h0 s))))\n )\nlet point_decompress_ out s tmp =\n let y = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let sign = most_significant_bit s in\n load_51 y s;\n let z = Hacl.Impl.Ed25519.RecoverX.recover_x x y sign in\n\n let res =\n if z = false then false\n else (\n let outx = getx out in\n let outy = gety out in\n let outz = getz out in\n let outt = gett out in\n copy outx x;\n copy outy y;\n make_one outz;\n fmul outt x y;\n true\n ) in\n res", "val point_decompress: s:lbuffer uint8 32ul -> out:F51.point ->\n Stack bool\n (requires fun h ->\n live h out /\\ live h s /\\ disjoint s out)\n (ensures fun h0 b h1 -> modifies (loc out) h0 h1 /\\\n (b ==> F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out)) /\\\n (b <==> Some? (SE.point_decompress (as_seq h0 s))) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (SE.point_decompress (as_seq h0 s)))))\nlet point_decompress s out =\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.point_decompress_lemma (as_seq h0 s);\n Hacl.Impl.Ed25519.PointDecompress.point_decompress out s", "val sign_compute_s (r hs:lbuffer uint64 5ul) (a s:lbuffer uint8 32ul) : Stack unit\n (requires fun h ->\n live h r /\\ live h hs /\\ live h a /\\ live h s /\\\n disjoint s r /\\ disjoint s hs /\\ disjoint s a /\\\n F56.scalar_inv_full_t h r /\\ F56.scalar_inv_full_t h hs)\n (ensures fun h0 _ h1 -> modifies (loc s) h0 h1 /\\\n as_seq h1 s == BSeq.nat_to_bytes_le 32 ((F56.as_nat h0 r +\n (F56.as_nat h0 hs * BSeq.nat_from_bytes_le (as_seq h0 a)) % Spec.Ed25519.q) % Spec.Ed25519.q))\nlet sign_compute_s r hs a s =\n push_frame ();\n let aq = create 5ul (u64 0) in\n Hacl.Impl.Load56.load_32_bytes aq a;\n Hacl.Impl.BignumQ.Mul.mul_modq aq hs aq;\n Hacl.Impl.BignumQ.Mul.add_modq aq r aq;\n assert_norm (0x100000000000000 == pow2 56);\n Hacl.Impl.Store56.store_56 s aq;\n pop_frame ()", "val test:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul\n -> expected_sig:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h ->\n live h msg /\\ live h expected_sig /\\ live h pk /\\ live h sk)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test msg_len msg pk sk expected_sig =\n test_verify msg_len msg pk expected_sig;\n test_sign msg_len msg sk expected_sig;\n test_secret_to_public sk pk", "val load_point_vartime: res:point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.load_point (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (point_inv h1 res /\\ point_eval h1 res == Some?.v ps))))\nlet load_point_vartime p b =\n push_frame ();\n let p_aff = create_aff_point () in\n let res = aff_point_load_vartime p_aff b in\n if res then to_proj_point p p_aff;\n pop_frame ();\n res", "val load_point_nocheck: out:point -> b:lbuffer uint8 64ul -> Stack unit\n (requires fun h ->\n live h out /\\ live h b /\\ disjoint out b /\\\n S.point_inv_bytes (as_seq h b))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n point_inv h1 out /\\\n point_eval h1 out == S.load_point_nocheck (as_seq h0 b))\nlet load_point_nocheck out b =\n push_frame ();\n let p_aff = create_aff_point () in\n let px, py = aff_getx p_aff, aff_gety p_aff in\n let pxb = sub b 0ul 32ul in\n let pyb = sub b 32ul 32ul in\n load_felem px pxb;\n load_felem py pyb;\n to_proj_point out p_aff;\n pop_frame ()", "val ecdh:\n shared:lbuffer uint8 32ul\n -> my_priv:lbuffer uint8 32ul\n -> their_pub:lbuffer uint8 32ul\n -> Stack bool\n (requires fun h0 ->\n live h0 shared /\\ live h0 my_priv /\\ live h0 their_pub /\\\n disjoint shared my_priv /\\ disjoint shared their_pub)\n (ensures fun h0 r h1 -> modifies (loc shared) h0 h1 /\\\n as_seq h1 shared == Spec.Curve25519.scalarmult (as_seq h0 my_priv) (as_seq h0 their_pub)\n /\\ (not r == Lib.ByteSequence.lbytes_eq #32 (as_seq h1 shared) (Lib.Sequence.create 32 (u8 0))))\nlet ecdh shared my_priv their_pub =\n if EverCrypt.TargetConfig.hacl_can_compile_vale then\n let has_bmi2 = EverCrypt.AutoConfig2.has_bmi2 () in\n let has_adx = EverCrypt.AutoConfig2.has_adx () in\n if (has_bmi2 && has_adx) then\n Hacl.Curve25519_64.ecdh shared my_priv their_pub\n else\n Hacl.Curve25519_51.ecdh shared my_priv their_pub\n else\n Hacl.Curve25519_51.ecdh shared my_priv their_pub", "val point_mul_g: out:point -> scalar:qelem -> Stack unit\n (requires fun h ->\n live h scalar /\\ live h out /\\ disjoint out scalar /\\\n qas_nat h scalar < S.q)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n point_inv h1 out /\\\n S.to_aff_point (point_eval h1 out) ==\n S.to_aff_point (S.point_mul_g (qas_nat h0 scalar)))\nlet point_mul_g out scalar =\n push_frame ();\n let h0 = ST.get () in\n let q1 = create 15ul (u64 0) in\n make_g q1;\n let q2 = mk_proj_g_pow2_64 () in\n let q3 = mk_proj_g_pow2_128 () in\n let q4 = mk_proj_g_pow2_192 () in\n proj_g_pow2_64_lseq_lemma ();\n proj_g_pow2_128_lseq_lemma ();\n proj_g_pow2_192_lseq_lemma ();\n point_mul_g_noalloc out scalar q1 q2 q3 q4;\n lemma_exp_four_fw_local (as_seq h0 scalar);\n pop_frame ()", "val point_mul: out:point -> scalar:qelem -> q:point -> Stack unit\n (requires fun h ->\n live h out /\\ live h scalar /\\ live h q /\\\n disjoint out q /\\ disjoint out scalar /\\ disjoint q scalar /\\\n point_inv h q /\\ qas_nat h scalar < S.q)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n point_inv h1 out /\\\n S.to_aff_point (point_eval h1 out) ==\n S.to_aff_point (S.point_mul (qas_nat h0 scalar) (point_eval h0 q)))\nlet point_mul out scalar q =\n let h0 = ST.get () in\n SE.exp_fw_lemma S.mk_k256_concrete_ops (point_eval h0 q) 256 (qas_nat h0 scalar) 4;\n BE.lexp_fw_consttime 15ul 0ul mk_k256_concrete_ops 4ul (null uint64) q 4ul 256ul scalar out", "val point_mul_g: res:point -> scalar:felem -> Stack unit\n (requires fun h ->\n live h res /\\ live h scalar /\\ disjoint res scalar /\\\n as_nat h scalar < S.order)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n point_inv h1 res /\\\n S.to_aff_point (from_mont_point (as_point_nat h1 res)) ==\n S.to_aff_point (S.point_mul_g (as_nat h0 scalar)))\nlet point_mul_g res scalar =\n push_frame ();\n let h0 = ST.get () in\n let q1 = create_point () in\n make_base_point q1;\n let q2 = mk_proj_g_pow2_64 () in\n let q3 = mk_proj_g_pow2_128 () in\n let q4 = mk_proj_g_pow2_192 () in\n proj_g_pow2_64_lseq_lemma ();\n proj_g_pow2_128_lseq_lemma ();\n proj_g_pow2_192_lseq_lemma ();\n point_mul_g_noalloc res scalar q1 q2 q3 q4;\n LowStar.Ignore.ignore q1;\n LowStar.Ignore.ignore q2;\n LowStar.Ignore.ignore q3;\n LowStar.Ignore.ignore q4;\n lemma_exp_four_fw_local (as_seq h0 scalar);\n pop_frame ()", "val point_decompress:\n out:point\n -> s:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h -> live h out /\\ live h s)\n (ensures fun h0 b h1 -> modifies (loc out) h0 h1 /\\\n (b ==> F51.point_inv_t h1 out) /\\\n (b <==> Some? (Spec.Ed25519.point_decompress (as_seq h0 s))) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (Spec.Ed25519.point_decompress (as_seq h0 s))))\n )\nlet point_decompress out s =\n push_frame();\n let tmp = create 10ul (u64 0) in\n let res = point_decompress_ out s tmp in\n pop_frame();\n res", "val point_double_: out:point -> p:point -> tmp:lbuffer uint64 20ul -> Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ live h tmp /\\\n eq_or_disjoint out p /\\ disjoint tmp p /\\ disjoint tmp out /\\\n F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out |+| loc tmp) h0 h1 /\\\n F51.point_inv_t h1 out /\\\n F51.point_eval h1 out == Spec.Ed25519.point_double (F51.point_eval h0 p))\nlet point_double_ out p tmp =\n point_double_step_1 p tmp;\n point_double_step_2 p tmp;\n let tmp_f = sub tmp 0ul 5ul in\n let tmp_e = sub tmp 5ul 5ul in\n let tmp_h = sub tmp 10ul 5ul in\n let tmp_g = sub tmp 15ul 5ul in\n let x3 = getx out in\n let y3 = gety out in\n let z3 = getz out in\n let t3 = gett out in\n fmul x3 tmp_e tmp_f;\n fmul y3 tmp_g tmp_h;\n fmul t3 tmp_e tmp_h;\n fmul z3 tmp_f tmp_g", "val point_add_: out:point -> p:point -> q:point -> tmp:lbuffer uint64 30ul -> Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ live h q /\\ live h tmp /\\\n disjoint tmp p /\\ disjoint tmp q /\\ disjoint tmp out /\\\n eq_or_disjoint p out /\\ eq_or_disjoint q out /\\\n F51.point_inv_t h p /\\ F51.point_inv_t h q)\n (ensures fun h0 _ h1 -> modifies (loc out |+| loc tmp) h0 h1 /\\\n F51.point_inv_t h1 out /\\\n F51.point_eval h1 out == Spec.Ed25519.point_add (F51.point_eval h0 p) (F51.point_eval h0 q))\nlet point_add_ out p q tmp =\n point_add_step_1 p q tmp;\n point_add_step_2 p q tmp;\n let tmp_g = sub tmp 0ul 5ul in\n let tmp_h = sub tmp 5ul 5ul in\n let tmp_e = sub tmp 20ul 5ul in\n let tmp_f = sub tmp 25ul 5ul in\n let x3 = getx out in\n let y3 = gety out in\n let z3 = getz out in\n let t3 = gett out in\n fmul x3 tmp_e tmp_f;\n fmul y3 tmp_g tmp_h;\n fmul t3 tmp_e tmp_h;\n fmul z3 tmp_f tmp_g", "val point_mul_g_double_vartime:\n out:point\n -> scalar1:lbuffer uint8 32ul\n -> scalar2:lbuffer uint8 32ul\n -> q2:point ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h scalar1 /\\\n live h scalar2 /\\ live h q2 /\\\n disjoint q2 out /\\ disjoint scalar1 out /\\ disjoint scalar2 out /\\\n F51.linv (as_seq h q2))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.linv (as_seq h1 out) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_double_fw #S.aff_point_c S.mk_ed25519_comm_monoid\n (S.to_aff_point g_c) 256 (BSeq.nat_from_bytes_le (as_seq h0 scalar1))\n (S.to_aff_point (F51.point_eval h0 q2)) (BSeq.nat_from_bytes_le (as_seq h0 scalar2)) 5)\nlet point_mul_g_double_vartime out scalar1 scalar2 q2 =\n push_frame ();\n let tmp = create 28ul (u64 0) in\n let g = sub tmp 0ul 20ul in\n let bscalar1 = sub tmp 20ul 4ul in\n let bscalar2 = sub tmp 24ul 4ul in\n make_g g;\n point_mul_g_double_vartime_aux out scalar1 g scalar2 q2 bscalar1 bscalar2;\n pop_frame ()", "val qinv_x8_x128 (x128 x6 x_11:felem) : Stack unit\n (requires fun h ->\n live h x128 /\\ live h x6 /\\ live h x_11 /\\\n disjoint x128 x6 /\\ disjoint x128 x_11 /\\ disjoint x6 x_11 /\\\n as_nat h x6 < S.order /\\ as_nat h x_11 < S.order)\n (ensures fun h0 _ h1 -> modifies (loc x128 |+| loc x6) h0 h1 /\\\n as_nat h1 x128 < S.order /\\\n qmont_as_nat h1 x128 = SI.qinv_x8_x128 (qmont_as_nat h0 x6) (qmont_as_nat h0 x_11))\nlet qinv_x8_x128 x128 x6 x_11 =\n let h0 = ST.get () in\n qsquare_times_in_place x6 2ul;\n qmul x6 x6 x_11;\n let h1 = ST.get () in\n assert (qmont_as_nat h1 x6 == // x8\n S.qmul (SI.qsquare_times (qmont_as_nat h0 x6) 2) (qmont_as_nat h0 x_11));\n\n qsquare_times x128 x6 8ul;\n qmul x128 x128 x6;\n let h2 = ST.get () in\n assert (qmont_as_nat h2 x128 == // x16\n S.qmul (SI.qsquare_times (qmont_as_nat h1 x6) 8) (qmont_as_nat h1 x6));\n\n qsquare_times x6 x128 16ul;\n qmul x6 x6 x128;\n let h3 = ST.get () in\n assert (qmont_as_nat h3 x6 == // x32\n S.qmul (SI.qsquare_times (qmont_as_nat h2 x128) 16) (qmont_as_nat h2 x128));\n\n qsquare_times x128 x6 64ul;\n qmul x128 x128 x6;\n let h4 = ST.get () in\n assert (qmont_as_nat h4 x128 == // x96\n S.qmul (SI.qsquare_times (qmont_as_nat h3 x6) 64) (qmont_as_nat h3 x6));\n\n qsquare_times_in_place x128 32ul;\n qmul x128 x128 x6;\n let h5 = ST.get () in\n assert (qmont_as_nat h5 x128 == // x128\n S.qmul (SI.qsquare_times (qmont_as_nat h4 x128) 32) (qmont_as_nat h3 x6))", "val box_beforenm:\n k:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul ->\n Stack size_t\n (requires fun h -> live h k /\\ live h pk /\\ live h sk /\\\n disjoint k pk /\\ disjoint k sk)\n (ensures fun h0 r h1 -> modifies (loc k) h0 h1 /\\\n (let key = Spec.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in\n match r with\n | 0ul -> Some? key /\\ as_seq h1 k == Some?.v key\n | _ -> None? key))\nlet box_beforenm k pk sk =\n push_frame();\n let n0 = create 16ul (u8 0) in\n let r = Hacl.Curve25519_51.ecdh k sk pk in\n let res =\n if r then (\n Hacl.Salsa20.hsalsa20 k k n0;\n 0ul)\n else\n 0xfffffffful in\n pop_frame();\n res", "val secret_to_public:\n public_key:lbuffer uint8 32ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\\\n as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key))\nlet secret_to_public public_key private_key =\n Hacl.Ed25519.secret_to_public public_key private_key", "val secret_to_public:\n public_key:lbuffer uint8 32ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\\\n as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key))\nlet secret_to_public public_key private_key =\n push_frame ();\n let expanded_secret = create 64ul (u8 0) in\n secret_expand expanded_secret private_key;\n let a = sub expanded_secret 0ul 32ul in\n Hacl.Impl.Ed25519.Sign.point_mul_g_compress public_key a;\n pop_frame ()", "val finv_256 (x256 x2 x30 a:felem) : Stack unit\n (requires fun h ->\n live h a /\\ live h x30 /\\ live h x2 /\\ live h x256 /\\\n disjoint a x30 /\\ disjoint a x2 /\\ disjoint a x256 /\\\n disjoint x30 x2 /\\ disjoint x30 x256 /\\ disjoint x2 x256 /\\\n as_nat h a < S.prime /\\ as_nat h x30 < S.prime /\\ as_nat h x2 < S.prime)\n (ensures fun h0 _ h1 -> modifies (loc x256 |+| loc x2) h0 h1 /\\\n as_nat h1 x256 < S.prime /\\\n (let f = fmont_as_nat h0 a in\n let x30 = fmont_as_nat h0 x30 in\n let x2 = fmont_as_nat h0 x2 in\n let x32_s = S.fmul (SI.fsquare_times x30 2) x2 in\n let x64_s = S.fmul (SI.fsquare_times x32_s 32) f in\n let x192_s = S.fmul (SI.fsquare_times x64_s 128) x32_s in\n let x224_s = S.fmul (SI.fsquare_times x192_s 32) x32_s in\n let x254_s = S.fmul (SI.fsquare_times x224_s 30) x30 in\n let x256_s = S.fmul (SI.fsquare_times x254_s 2) f in\n fmont_as_nat h1 x256 = x256_s))\nlet finv_256 x256 x2 x30 a =\n let h0 = ST.get () in\n fsquare_times x256 x30 2ul;\n fmul x256 x256 x2;\n let h1 = ST.get () in\n assert (fmont_as_nat h1 x256 == // x32\n S.fmul (SI.fsquare_times (fmont_as_nat h0 x30) 2) (fmont_as_nat h0 x2));\n\n fsquare_times x2 x256 32ul;\n fmul x2 x2 a;\n let h2 = ST.get () in\n assert (fmont_as_nat h2 x2 == // x64\n S.fmul (SI.fsquare_times (fmont_as_nat h1 x256) 32) (fmont_as_nat h0 a));\n\n fsquare_times_in_place x2 128ul;\n fmul x2 x2 x256;\n let h3 = ST.get () in\n assert (fmont_as_nat h3 x2 == // x192\n S.fmul (SI.fsquare_times (fmont_as_nat h2 x2) 128) (fmont_as_nat h1 x256));\n\n fsquare_times_in_place x2 32ul;\n fmul x2 x2 x256;\n let h4 = ST.get () in\n assert (fmont_as_nat h4 x2 == // x224\n S.fmul (SI.fsquare_times (fmont_as_nat h3 x2) 32) (fmont_as_nat h1 x256));\n\n fsquare_times_in_place x2 30ul;\n fmul x2 x2 x30;\n let h5 = ST.get () in\n assert (fmont_as_nat h5 x2 == // x254\n S.fmul (SI.fsquare_times (fmont_as_nat h4 x2) 30) (fmont_as_nat h0 x30));\n\n fsquare_times_in_place x2 2ul;\n fmul x256 x2 a;\n let h6 = ST.get () in\n assert (fmont_as_nat h6 x256 == // x256\n S.fmul (SI.fsquare_times (fmont_as_nat h5 x2) 2) (fmont_as_nat h0 a))", "val point_add_step_2: p:point -> q:point -> tmp:lbuffer uint64 30ul -> Stack unit\n (requires fun h ->\n live h p /\\ live h q /\\ live h tmp /\\\n disjoint tmp p /\\ disjoint tmp q /\\\n F51.point_inv_t h p /\\ F51.point_inv_t h q /\\\n F51.mul_inv_t h (gsub tmp 10ul 5ul) /\\\n F51.mul_inv_t h (gsub tmp 15ul 5ul))\n (ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\\\n (let z1 = F51.fevalh h0 (gsub p 10ul 5ul) in\n let t1 = F51.fevalh h0 (gsub p 15ul 5ul) in\n let z2 = F51.fevalh h0 (gsub q 10ul 5ul) in\n let t2 = F51.fevalh h0 (gsub q 15ul 5ul) in\n let a = F51.fevalh h0 (gsub tmp 10ul 5ul) in\n let b = F51.fevalh h0 (gsub tmp 15ul 5ul) in\n let c = (2 `SC.fmul` Spec.Ed25519.d `SC.fmul` t1) `SC.fmul` t2 in\n let d = (2 `SC.fmul` z1) `SC.fmul` z2 in\n let e = b `SC.fsub` a in\n let f = d `SC.fsub` c in\n let g = d `SC.fadd` c in\n let h = b `SC.fadd` a in\n F51.felem_fits h1 (gsub tmp 20ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 25ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 0ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 5ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.fevalh h1 (gsub tmp 20ul 5ul) == e /\\\n F51.fevalh h1 (gsub tmp 25ul 5ul) == f /\\\n F51.fevalh h1 (gsub tmp 0ul 5ul) == g /\\\n F51.fevalh h1 (gsub tmp 5ul 5ul) == h))\nlet point_add_step_2 p q tmp =\n let tmp1 = sub tmp 0ul 5ul in // g\n let tmp2 = sub tmp 5ul 5ul in // h\n let tmp3 = sub tmp 10ul 5ul in // a\n let tmp4 = sub tmp 15ul 5ul in // b\n let tmp5 = sub tmp 20ul 5ul in // e\n let tmp6 = sub tmp 25ul 5ul in // f\n let z1 = getz p in\n let t1 = gett p in\n let z2 = getz q in\n let t2 = gett q in\n times_2d tmp1 t1; // tmp1 = 2 * d * t1\n fmul tmp1 tmp1 t2; // tmp1 = tmp1 * t2 = c\n\n times_2 tmp2 z1; // tmp2 = 2 * z1\n fmul tmp2 tmp2 z2; // tmp2 = tmp2 * z2 = d\n\n fdifference tmp5 tmp4 tmp3; // tmp5 = e = b - a = tmp4 - tmp3\n fdifference tmp6 tmp2 tmp1; // tmp6 = f = d - c = tmp2 - tmp1\n fsum tmp1 tmp2 tmp1; // tmp1 = g = d + c = tmp2 + tmp1\n fsum tmp2 tmp4 tmp3", "val point_compress:\n out:lbuffer uint8 32ul\n -> p:point ->\n Stack unit\n (requires fun h -> live h out /\\ live h p /\\ F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == Spec.Ed25519.point_compress (F51.point_eval h0 p)\n )\nlet point_compress z p =\n push_frame();\n let tmp = create 15ul (u64 0) in\n let zinv = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let out = sub tmp 10ul 5ul in\n\n point_compress_ tmp p;\n let b = x_mod_2 x in\n store_51 z out;\n add_sign z b;\n\n (**) let h3 = ST.get() in\n (**) lemma_nat_from_to_bytes_le_preserves_value (as_seq h3 z) 32;\n (**) lemma_nat_to_from_bytes_le_preserves_value (as_seq h3 z) 32 (F51.fevalh h3 out);\n\n pop_frame()", "val point_mul_g_double_vartime_noalloc:\n out:point\n -> scalar1:lbuffer uint64 4ul -> q1:point\n -> scalar2:lbuffer uint64 4ul -> q2:point\n -> table2: lbuffer uint64 640ul ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h scalar1 /\\ live h q1 /\\\n live h scalar2 /\\ live h q2 /\\ live h table2 /\\\n\n eq_or_disjoint q1 q2 /\\ disjoint out q1 /\\ disjoint out q2 /\\\n disjoint out scalar1 /\\ disjoint out scalar2 /\\ disjoint out table2 /\\\n\n BD.bn_v h scalar1 < pow2 256 /\\ BD.bn_v h scalar2 < pow2 256 /\\\n F51.linv (as_seq h q1) /\\ F51.linv (as_seq h q2) /\\\n F51.point_eval h q1 == g_c /\\\n table_inv_w5 (as_seq h q2) (as_seq h table2))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.linv (as_seq h1 out) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_double_fw #S.aff_point_c S.mk_ed25519_comm_monoid\n (S.to_aff_point (F51.point_eval h0 q1)) 256 (BD.bn_v h0 scalar1)\n (S.to_aff_point (F51.point_eval h0 q2)) (BD.bn_v h0 scalar2) 5)\nlet point_mul_g_double_vartime_noalloc out scalar1 q1 scalar2 q2 table2 =\n [@inline_let] let len = 20ul in\n [@inline_let] let ctx_len = 0ul in\n [@inline_let] let k = mk_ed25519_concrete_ops in\n [@inline_let] let l = 5ul in\n [@inline_let] let table_len = 32ul in\n [@inline_let] let bLen = 4ul in\n [@inline_let] let bBits = 256ul in\n assert_norm (pow2 (v l) == v table_len);\n let h0 = ST.get () in\n recall_contents precomp_basepoint_table_w5 precomp_basepoint_table_lseq_w5;\n let h1 = ST.get () in\n precomp_basepoint_table_lemma_w5 ();\n assert (table_inv_w5 (as_seq h1 q1) (as_seq h1 precomp_basepoint_table_w5));\n assert (table_inv_w5 (as_seq h1 q2) (as_seq h1 table2));\n\n ME.mk_lexp_double_fw_tables len ctx_len k l table_len\n table_inv_w5 table_inv_w5\n (BE.lprecomp_get_vartime len ctx_len k l table_len)\n (BE.lprecomp_get_vartime len ctx_len k l table_len)\n (null uint64) q1 bLen bBits scalar1 q2 scalar2\n (to_const precomp_basepoint_table_w5) (to_const table2) out", "val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit\n (requires fun h ->\n live h out /\\ live h s /\\ disjoint s out)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))\nlet point_mul_g_compress out s =\n push_frame ();\n let tmp = create 20ul (u64 0) in\n Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;\n Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;\n pop_frame ()", "val crypto_kem_sk:\n a:FP.frodo_alg\n -> s:lbytes (crypto_bytes a)\n -> pk:lbytes (crypto_publickeybytes a)\n -> sk:lbytes (crypto_secretkeybytes a)\n -> Stack unit\n (requires fun h ->\n live h pk /\\ live h sk /\\ live h s /\\\n disjoint pk sk /\\ disjoint sk s)\n (ensures fun h0 _ h1 -> modifies (loc sk) h0 h1 /\\\n (let s_bytes = LSeq.sub (as_seq h0 sk) (v (crypto_bytes a) + v (crypto_publickeybytes a)) (v (secretmatrixbytes_len a)) in\n as_seq h1 sk == S.crypto_kem_sk a (as_seq h0 s) (as_seq h0 pk) s_bytes))\nlet crypto_kem_sk a s pk sk =\n FP.expand_crypto_secretkeybytes a;\n let slen1 = crypto_secretkeybytes a -! bytes_pkhash a in\n let sk_p = sub sk 0ul slen1 in\n crypto_kem_sk1 a s pk sk_p;\n\n let h0 = ST.get () in\n update_sub_f h0 sk slen1 (bytes_pkhash a)\n (fun h -> FP.frodo_shake a (v (crypto_publickeybytes a)) (as_seq h0 pk) (v (bytes_pkhash a)))\n (fun _ -> frodo_shake a (crypto_publickeybytes a) pk (bytes_pkhash a) (sub sk slen1 (bytes_pkhash a)));\n let h1 = ST.get () in\n LSeq.eq_intro (LSeq.sub (as_seq h0 sk) 0 (v slen1)) (LSeq.sub (as_seq h1 sk) 0 (v slen1));\n LSeq.lemma_concat2\n (v slen1) (LSeq.sub (as_seq h0 sk) 0 (v slen1))\n (v (bytes_pkhash a)) (LSeq.sub (as_seq h1 sk) (v slen1) (v (bytes_pkhash a))) (as_seq h1 sk)", "val expand_keys:\n expanded_keys:lbuffer uint8 96ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h expanded_keys /\\ live h private_key /\\ disjoint expanded_keys private_key)\n (ensures fun h0 _ h1 -> modifies (loc expanded_keys) h0 h1 /\\\n (let public_key, s, prefix = Spec.Ed25519.expand_keys (as_seq h0 private_key) in\n as_seq h1 (gsub expanded_keys 0ul 32ul) == public_key /\\\n as_seq h1 (gsub expanded_keys 32ul 32ul) == s /\\\n as_seq h1 (gsub expanded_keys 64ul 32ul) == prefix))\nlet expand_keys expanded_keys private_key =\n Hacl.Ed25519.expand_keys expanded_keys private_key", "val expand_keys:\n expanded_keys:lbuffer uint8 96ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h expanded_keys /\\ live h private_key /\\ disjoint expanded_keys private_key)\n (ensures fun h0 _ h1 -> modifies (loc expanded_keys) h0 h1 /\\\n (let public_key, s, prefix = Spec.Ed25519.expand_keys (as_seq h0 private_key) in\n as_seq h1 (gsub expanded_keys 0ul 32ul) == public_key /\\\n as_seq h1 (gsub expanded_keys 32ul 32ul) == s /\\\n as_seq h1 (gsub expanded_keys 64ul 32ul) == prefix))\nlet expand_keys expanded_keys private_key =\n let public_key = sub expanded_keys 0ul 32ul in\n let s_prefix = sub expanded_keys 32ul 64ul in\n let s = sub expanded_keys 32ul 32ul in\n secret_expand s_prefix private_key;\n Hacl.Impl.Ed25519.Sign.point_mul_g_compress public_key s", "val is_point_valid: b:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h b)\n (ensures fun h0 res h1 -> modifies0 h0 h1 /\\\n res <==> (S.point_inv_bytes (as_seq h0 b)))\nlet is_point_valid b =\n push_frame ();\n let p = P.create_aff_point () in\n let res = P.aff_point_load_vartime p b in\n pop_frame ();\n res", "val crypto_kem_sk1:\n a:FP.frodo_alg\n -> s:lbytes (crypto_bytes a)\n -> pk:lbytes (crypto_publickeybytes a)\n -> sk:lbytes (crypto_secretkeybytes a -! bytes_pkhash a)\n -> Stack unit\n (requires fun h ->\n live h pk /\\ live h sk /\\ live h s /\\\n disjoint pk sk /\\ disjoint sk s)\n (ensures fun h0 _ h1 -> modifies (loc sk) h0 h1 /\\\n (let s_bytes = LSeq.sub (as_seq h0 sk) (v (crypto_bytes a) + v (crypto_publickeybytes a)) (v (secretmatrixbytes_len a)) in\n as_seq h1 sk == LSeq.concat (LSeq.concat (as_seq h0 s) (as_seq h0 pk)) s_bytes))\nlet crypto_kem_sk1 a s pk sk =\n let h1 = ST.get () in\n FP.expand_crypto_secretkeybytes a;\n let s_pk_len = crypto_bytes a +! crypto_publickeybytes a in\n [@inline_let] let sm_len = secretmatrixbytes_len a in\n let slen1 = crypto_secretkeybytes a -! bytes_pkhash a in\n let s_bytes = sub sk s_pk_len sm_len in\n\n update_sub sk 0ul (crypto_bytes a) s;\n let h2 = ST.get () in\n LSeq.eq_intro (LSeq.sub (as_seq h2 sk) (v s_pk_len) (v sm_len)) (as_seq h1 s_bytes);\n\n update_sub sk (crypto_bytes a) (crypto_publickeybytes a) pk;\n let h3 = ST.get () in\n LSeq.eq_intro (LSeq.sub (as_seq h3 sk) 0 (v (crypto_bytes a))) (as_seq h1 s);\n LSeq.eq_intro (LSeq.sub (as_seq h3 sk) (v (crypto_bytes a)) (v (crypto_publickeybytes a))) (as_seq h1 pk);\n LSeq.eq_intro (LSeq.sub (as_seq h3 sk) (v s_pk_len) (v sm_len)) (as_seq h1 s_bytes);\n LSeq.lemma_concat3\n (v (crypto_bytes a)) (as_seq h1 s)\n (v (crypto_publickeybytes a)) (as_seq h1 pk)\n (v sm_len) (as_seq h1 s_bytes)\n (as_seq h3 sk)", "val secret_to_public:\n pub:lbuffer uint8 32ul\n -> priv:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h0 ->\n live h0 pub /\\ live h0 priv /\\ disjoint pub priv)\n (ensures fun h0 _ h1 -> modifies (loc pub) h0 h1 /\\\n as_seq h1 pub == Spec.Curve25519.secret_to_public (as_seq h0 priv))\nlet secret_to_public pub priv =\n if EverCrypt.TargetConfig.hacl_can_compile_vale then\n let has_bmi2 = EverCrypt.AutoConfig2.has_bmi2 () in\n let has_adx = EverCrypt.AutoConfig2.has_adx () in\n if (has_bmi2 && has_adx) then\n Hacl.Curve25519_64.secret_to_public pub priv\n else\n Hacl.Curve25519_51.secret_to_public pub priv\n else\n Hacl.Curve25519_51.secret_to_public pub priv", "val point_load: b:lbuffer uint8 64ul -> out:P.point -> Stack unit\n (requires fun h ->\n live h out /\\ live h b /\\ disjoint b out /\\\n S.point_inv_bytes (as_seq h b))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n P.point_inv h1 out /\\\n P.point_eval h1 out == S.load_point_nocheck (as_seq h0 b))\nlet point_load b out =\n P.load_point_nocheck out b", "val test_verify:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 32ul\n -> sig:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h ->\n live h msg /\\ live h pk /\\ live h sig)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_verify msg_len msg pk sig =\n let res = Ed25519.verify pk msg_len msg sig in\n\n C.String.print (C.String.of_literal \"Test Ed25519 Verify:\\n\");\n if res then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l)", "val dh_responder:\n shared_secret:lbuffer uint8 64ul\n -> their_pubkey:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h shared_secret /\\ live h their_pubkey /\\ live h private_key /\\\n disjoint shared_secret their_pubkey /\\ disjoint shared_secret private_key)\n (ensures fun h0 r h1 -> modifies (loc shared_secret) h0 h1 /\\\n (let ss = S.ecdh (as_seq h0 their_pubkey) (as_seq h0 private_key) in\n (r <==> Some? ss) /\\ (r ==> (as_seq h1 shared_secret == Some?.v ss))))\nlet dh_responder shared_secret their_pubkey private_key =\n Hacl.Impl.P256.DH.ecp256dh_r shared_secret their_pubkey private_key", "val point_double_step_2: p:point -> tmp:lbuffer uint64 20ul -> Stack unit\n (requires fun h ->\n live h p /\\ live h tmp /\\ disjoint p tmp /\\\n F51.point_inv_t h p /\\\n F51.felem_fits h (gsub tmp 10ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h (gsub tmp 15ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h (gsub tmp 0ul 5ul) (2, 4, 2, 2, 2))\n (ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\\\n (let x1, y1, z1, t1 = F51.point_eval h0 p in\n let c = F51.fevalh h0 (gsub tmp 0ul 5ul) in\n let h = F51.fevalh h0 (gsub tmp 10ul 5ul) in\n let g = F51.fevalh h0 (gsub tmp 15ul 5ul) in\n let e = h `SC.fsub` ((x1 `SC.fadd` y1) `SC.fmul` (x1 `SC.fadd` y1)) in\n let f = c `SC.fadd` g in\n F51.felem_fits h1 (gsub tmp 0ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 5ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 10ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.felem_fits h1 (gsub tmp 15ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.fevalh h1 (gsub tmp 0ul 5ul) == f /\\\n F51.fevalh h1 (gsub tmp 5ul 5ul) == e /\\\n F51.fevalh h1 (gsub tmp 10ul 5ul) == h /\\\n F51.fevalh h1 (gsub tmp 15ul 5ul) == g))\nlet point_double_step_2 p tmp =\n let tmp1 = sub tmp 0ul 5ul in // c, f\n let tmp2 = sub tmp 5ul 5ul in // e\n let tmp3 = sub tmp 10ul 5ul in // h\n let tmp4 = sub tmp 15ul 5ul in // g\n let x1 = getx p in\n let y1 = gety p in\n\n fsum tmp2 x1 y1; // tmp2 = x1 + y1\n fsquare tmp2 tmp2; // tmp2 = (x1 + y1) ** 2\n reduce_513 tmp3;\n fdifference tmp2 tmp3 tmp2; // tmp2 = tmp3 - tmp2 = h - (x1 + y1) ** 2 = e\n\n reduce_513 tmp1;\n reduce_513 tmp4;\n fsum tmp1 tmp1 tmp4", "val point_compress: p:F51.point -> out:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ disjoint p out /\\\n F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == SE.point_compress (F51.point_eval h0 p))\nlet point_compress p out =\n Hacl.Impl.Ed25519.PointCompress.point_compress out p", "val ecdsa_sign_msg_as_qelem:\n signature:lbuffer uint8 64ul\n -> m_q:felem\n -> private_key:lbuffer uint8 32ul\n -> nonce:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h signature /\\ live h m_q /\\ live h private_key /\\ live h nonce /\\\n disjoint signature m_q /\\ disjoint signature private_key /\\ disjoint signature nonce /\\\n disjoint m_q private_key /\\ disjoint m_q nonce /\\\n as_nat h m_q < S.order)\n (ensures fun h0 flag h1 -> modifies (loc signature |+| loc m_q) h0 h1 /\\\n (let sgnt = S.ecdsa_sign_msg_as_qelem\n (as_nat h0 m_q) (as_seq h0 private_key) (as_seq h0 nonce) in\n (flag <==> Some? sgnt) /\\ (flag ==> (as_seq h1 signature == Some?.v sgnt))))\nlet ecdsa_sign_msg_as_qelem signature m_q private_key nonce =\n push_frame ();\n let rsdk_q = create 16ul (u64 0) in\n let r_q = sub rsdk_q 0ul 4ul in\n let s_q = sub rsdk_q 4ul 4ul in\n let d_a = sub rsdk_q 8ul 4ul in\n let k_q = sub rsdk_q 12ul 4ul in\n let are_sk_nonce_valid = ecdsa_sign_load d_a k_q private_key nonce in\n ecdsa_sign_r r_q k_q;\n ecdsa_sign_s s_q k_q r_q d_a m_q;\n bn2_to_bytes_be4 signature r_q s_q;\n let res = check_signature are_sk_nonce_valid r_q s_q in\n pop_frame ();\n res", "val aff_point_load_vartime: res:aff_point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.aff_point_load (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (aff_point_inv h1 res /\\ aff_point_eval h1 res == Some?.v ps))))\nlet aff_point_load_vartime p b =\n let px = sub b 0ul 32ul in\n let py = sub b 32ul 32ul in\n let bn_px = aff_getx p in\n let bn_py = aff_gety p in\n\n let h0 = ST.get () in\n let is_x_valid = load_felem_lt_prime_vartime bn_px px in\n let is_y_valid = load_felem_lt_prime_vartime bn_py py in\n let h1 = ST.get () in\n assert (as_nat h1 bn_px == BSeq.nat_from_bytes_be (as_seq h0 (gsub b 0ul 32ul)));\n assert (as_nat h1 bn_py == BSeq.nat_from_bytes_be (as_seq h0 (gsub b 32ul 32ul)));\n assert (inv_lazy_reduced1 h1 bn_px);\n assert (inv_lazy_reduced1 h1 bn_py);\n\n if is_x_valid && is_y_valid then begin\n assert (inv_fully_reduced h1 bn_px);\n assert (inv_fully_reduced h1 bn_py);\n is_on_curve_vartime p end\n else false", "val point_mul_g_double_split_lambda_vartime_noalloc_aux:\n out:point\n -> r1234:lbuffer uint64 16ul\n -> q1234:lbuffer uint64 60ul\n -> scalar1:qelem -> scalar2:qelem\n -> p1:point -> p2:point ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h r1234 /\\ live h q1234 /\\\n live h p1 /\\ live h p2 /\\ live h scalar1 /\\ live h scalar2 /\\\n\n disjoint out r1234 /\\ disjoint out q1234 /\\\n disjoint out scalar1 /\\ disjoint out scalar2 /\\ disjoint out p1 /\\ disjoint out p2 /\\\n\n disjoint r1234 q1234 /\\ disjoint r1234 scalar1 /\\ disjoint r1234 scalar2 /\\\n disjoint r1234 p1 /\\ disjoint r1234 p2 /\\\n\n disjoint q1234 scalar1 /\\ disjoint q1234 scalar2 /\\ disjoint q1234 p1 /\\ disjoint q1234 p2 /\\\n\n point_inv h p1 /\\ point_inv h p2 /\\ point_eval h p1 == S.g /\\\n qas_nat h scalar1 < S.q /\\ qas_nat h scalar2 < S.q)\n (ensures fun h0 _ h1 -> modifies (loc r1234 |+| loc q1234 |+| loc out) h0 h1 /\\\n point_inv h1 out /\\\n S.to_aff_point (point_eval h1 out) ==\n S.aff_point_add\n (S.aff_point_mul (qas_nat h0 scalar1) (S.to_aff_point (point_eval h0 p1)))\n (S.aff_point_mul (qas_nat h0 scalar2) (S.to_aff_point (point_eval h0 p2))))\nlet point_mul_g_double_split_lambda_vartime_noalloc_aux out r1234 q1234 scalar1 scalar2 p1 p2 =\n let r1 = sub r1234 0ul 4ul in\n let r2 = sub r1234 4ul 4ul in\n let r3 = sub r1234 8ul 4ul in\n let r4 = sub r1234 12ul 4ul in\n\n let q1 = sub q1234 0ul 15ul in\n let q2 = sub q1234 15ul 15ul in\n let q3 = sub q1234 30ul 15ul in\n let q4 = sub q1234 45ul 15ul in\n point_mul_g_double_split_lambda_vartime_noalloc\n out r1 q1 r2 q2 r3 q3 r4 q4 scalar1 scalar2 p1 p2", "val test_public_key_uncompressed: pk:lbuffer uint8 64ul -> Stack unit\n (requires fun h -> live h pk)\n (ensures fun h0 _ h1 -> modifies0 h0 h1)\nlet test_public_key_uncompressed pk =\n push_frame ();\n let pk_u = create 65ul (u8 0) in\n let pk_raw_u = create 64ul (u8 0) in\n\n K256.public_key_uncompressed_from_raw pk_u pk;\n let b = K256.public_key_uncompressed_to_raw pk_raw_u pk_u in\n\n C.String.print (C.String.of_literal \"\\n Test K256 pk_uncompressed:\\n\");\n if b\n then (if not (result_compare_display 64ul (to_const pk) (to_const pk_raw_u)) then C.exit 255l)\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l);\n pop_frame ()", "val point_mul_g_double_vartime_aux:\n out:point\n -> scalar1:lbuffer uint8 32ul -> q1:point\n -> scalar2:lbuffer uint8 32ul -> q2:point\n -> bscalar1:lbuffer uint64 4ul\n -> bscalar2:lbuffer uint64 4ul ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h scalar1 /\\ live h q1 /\\\n live h scalar2 /\\ live h q2 /\\ live h bscalar1 /\\ live h bscalar2 /\\\n\n disjoint scalar1 bscalar1 /\\ disjoint scalar2 bscalar2 /\\ disjoint scalar2 bscalar1 /\\\n disjoint scalar1 bscalar2 /\\ disjoint bscalar1 bscalar2 /\\ disjoint bscalar1 out /\\\n disjoint bscalar1 q1 /\\ disjoint bscalar1 q2 /\\ disjoint bscalar2 out /\\\n disjoint bscalar2 q1 /\\ disjoint bscalar2 q2 /\\ eq_or_disjoint q1 q2 /\\\n disjoint q1 out /\\ disjoint q2 out /\\ disjoint scalar1 out /\\ disjoint scalar2 out /\\\n\n F51.linv (as_seq h q1) /\\ F51.linv (as_seq h q2) /\\\n F51.point_eval h q1 == g_c)\n (ensures fun h0 _ h1 -> modifies (loc out |+| loc bscalar1 |+| loc bscalar2) h0 h1 /\\\n F51.linv (as_seq h1 out) /\\\n BD.bn_v h1 bscalar1 == BSeq.nat_from_bytes_le (as_seq h0 scalar1) /\\\n BD.bn_v h1 bscalar2 == BSeq.nat_from_bytes_le (as_seq h0 scalar2) /\\\n S.to_aff_point (F51.point_eval h1 out) ==\n LE.exp_double_fw #S.aff_point_c S.mk_ed25519_comm_monoid\n (S.to_aff_point (F51.point_eval h0 q1)) 256 (BD.bn_v h1 bscalar1)\n (S.to_aff_point (F51.point_eval h0 q2)) (BD.bn_v h1 bscalar2) 5)\nlet point_mul_g_double_vartime_aux out scalar1 q1 scalar2 q2 bscalar1 bscalar2 =\n let h0 = ST.get () in\n convert_scalar scalar1 bscalar1;\n convert_scalar scalar2 bscalar2;\n let h1 = ST.get () in\n assert (BD.bn_v h1 bscalar1 == BSeq.nat_from_bytes_le (as_seq h0 scalar1));\n assert (BD.bn_v h1 bscalar2 == BSeq.nat_from_bytes_le (as_seq h0 scalar2));\n point_mul_g_double_vartime_table out bscalar1 q1 bscalar2 q2", "val aff_point_load_vartime: res:aff_point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.aff_point_load (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (aff_point_inv h1 res /\\ as_aff_point_nat h1 res == Some?.v ps))))\nlet aff_point_load_vartime p b =\n let p_x = sub b 0ul 32ul in\n let p_y = sub b 32ul 32ul in\n\n let bn_p_x = aff_getx p in\n let bn_p_y = aff_gety p in\n bn_from_bytes_be4 bn_p_x p_x;\n bn_from_bytes_be4 bn_p_y p_y;\n let is_xy_valid = is_xy_valid_vartime p in\n if not is_xy_valid then false\n else is_on_curve_vartime p", "val point_double_1 (t0 t1 t2 t3 t4:felem) (p:point) : Stack unit\n (requires fun h ->\n live h t0 /\\ live h t1 /\\ live h t2 /\\\n live h t3 /\\ live h t4 /\\ live h p /\\\n LowStar.Monotonic.Buffer.all_disjoint\n [loc t0; loc t1; loc t2; loc t3; loc t4; loc p ] /\\\n point_inv h p)\n (ensures fun h0 _ h1 -> modifies (loc t0 |+| loc t1 |+| loc t2 |+| loc t3 |+| loc t4) h0 h1 /\\\n as_nat h1 t0 < S.prime /\\ as_nat h1 t1 < S.prime /\\\n as_nat h1 t2 < S.prime /\\ as_nat h1 t3 < S.prime /\\\n as_nat h1 t4 < S.prime /\\\n (let x, y, z = from_mont_point (as_point_nat h0 p) in\n let t0_s = S.fmul x x in\n let t1_s = S.fmul y y in\n let t2_s = S.fmul z z in\n let t3_s = S.fmul x y in\n let t3_s = S.fadd t3_s t3_s in\n let t4_s = S.fmul y z in\n fmont_as_nat h1 t0 == t0_s /\\ fmont_as_nat h1 t1 == t1_s /\\\n fmont_as_nat h1 t2 == t2_s /\\ fmont_as_nat h1 t3 == t3_s /\\\n fmont_as_nat h1 t4 == t4_s))\nlet point_double_1 t0 t1 t2 t3 t4 p =\n let x, y, z = getx p, gety p, getz p in\n fsqr t0 x;\n fsqr t1 y;\n fsqr t2 z;\n fmul t3 x y;\n fdouble t3 t3;\n fmul t4 y z", "val is_private_key_valid: private_key:lbuffer uint8 32ul -> Stack bool\n (requires fun h -> live h private_key)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n (let s = BSeq.nat_from_bytes_be (as_seq h0 private_key) in\n r <==> (0 < s && s < S.q)))\nlet is_private_key_valid private_key =\n push_frame ();\n let s_q = create_qelem () in\n let res = load_qelem_check s_q private_key in\n pop_frame ();\n BB.unsafe_bool_of_limb res", "val negate_point_and_scalar_cond_vartime: k:qelem -> p:point -> Stack bool\n (requires fun h ->\n live h k /\\ live h p /\\ disjoint k p /\\\n qas_nat h k < S.q /\\ point_inv h p)\n (ensures fun h0 b h1 -> modifies (loc k |+| loc p) h0 h1 /\\\n b == S.scalar_is_high (qas_nat h0 k) /\\ point_inv h1 p /\\\n (let k_s, p_s = SG.negate_point_and_scalar_cond (qas_nat h0 k) (point_eval h0 p) in\n qas_nat h1 k == k_s /\\ point_eval h1 p == p_s))\nlet negate_point_and_scalar_cond_vartime k p =\n let b = is_qelem_le_q_halved_vartime k in\n [@inline_let] let if_high = not b in\n qnegate_conditional_vartime k if_high;\n point_negate_conditional_vartime p if_high;\n if_high", "val point_double_step_1: p:point -> tmp:lbuffer uint64 20ul -> Stack unit\n (requires fun h ->\n live h p /\\ live h tmp /\\ disjoint p tmp /\\\n F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\\\n (let x1, y1, z1, t1 = F51.point_eval h0 p in\n let a = x1 `SC.fmul` x1 in\n let b = y1 `SC.fmul` y1 in\n let c = 2 `SC.fmul` (z1 `SC.fmul` z1) in\n let h = a `SC.fadd` b in\n let g = a `SC.fsub` b in\n F51.felem_fits h1 (gsub tmp 0ul 5ul) (2, 4, 2, 2, 2) /\\\n F51.felem_fits h1 (gsub tmp 10ul 5ul) (2, 4, 2, 2, 2) /\\\n F51.felem_fits h1 (gsub tmp 15ul 5ul) (9, 10, 9, 9, 9) /\\\n F51.fevalh h1 (gsub tmp 15ul 5ul) == g /\\\n F51.fevalh h1 (gsub tmp 10ul 5ul) == h /\\\n F51.fevalh h1 (gsub tmp 0ul 5ul) == c))\nlet point_double_step_1 p tmp =\n let tmp1 = sub tmp 0ul 5ul in // c\n let tmp2 = sub tmp 5ul 5ul in\n let tmp3 = sub tmp 10ul 5ul in // h\n let tmp4 = sub tmp 15ul 5ul in // g\n let x1 = getx p in\n let y1 = gety p in\n let z1 = getz p in\n\n fsquare tmp1 x1; // tmp1 = a\n fsquare tmp2 y1; // tmp2 = b\n fsum tmp3 tmp1 tmp2; // tmp3 = tmp1 + tmp2 = h\n fdifference tmp4 tmp1 tmp2; // tmp4 = tmp1 - tmp2 = g\n\n fsquare tmp1 z1; // tmp1 = z1 * z1\n times_2 tmp1 tmp1", "val test_verify_sha256:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 64ul\n -> sgnt:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h -> live h msg /\\ live h pk /\\ live h sgnt)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_verify_sha256 msg_len msg pk sgnt =\n let b = K256.ecdsa_verify_sha256 msg_len msg pk sgnt in\n\n C.String.print (C.String.of_literal \"\\n Test K256 ecdsa verification: \");\n if b then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l)", "val ecdsa_verify_sha256 (msg_len:size_t) (msg:lbytes msg_len) (public_key signature:lbytes 64ul) : Stack bool\n (requires fun h ->\n live h msg /\\ live h public_key /\\ live h signature)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n b == S.ecdsa_verify_sha256 (v msg_len) (as_seq h0 msg) (as_seq h0 public_key) (as_seq h0 signature))\nlet ecdsa_verify_sha256 msg_len msg public_key signature =\n push_frame ();\n let mHash = create 32ul (u8 0) in\n Hacl.Streaming.SHA2.hash_256 mHash msg msg_len;\n let b = ecdsa_verify_hashed_msg mHash public_key signature in\n pop_frame ();\n b" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Sign.fst", "name": "Hacl.Impl.P256.Sign.ecdsa_sign_r" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Verify.fst", "name": "Hacl.Impl.P256.Verify.ecdsa_verification_cmpr" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_valid_pk_rs" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_valid_pk" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Sign.fst", "name": "Hacl.Impl.K256.Sign.ecdsa_sign_r" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Verify.fst", "name": "Hacl.Impl.P256.Verify.ecdsa_verify_finv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.point_store" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Sign.fst", "name": "Hacl.Impl.P256.Sign.ecdsa_sign_s" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_uncompressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Sign.fst", "name": "Hacl.Impl.P256.Sign.ecdsa_sign_load" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_compressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.point_store" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g_mk_q1234" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.raw_to_uncompressed" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.raw_to_uncompressed" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Verify.fst", "name": "Hacl.Impl.K256.Verify.ecdsa_verify_cmpr" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.point_store" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Sign.fst", "name": "Hacl.Impl.K256.Sign.ecdsa_sign_load" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Sign.fst", "name": "Hacl.Impl.K256.Sign.ecdsa_sign_store" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.raw_to_compressed" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.raw_to_compressed" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.aff_point_store" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.aff_point_store" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Sign.fst", "name": "Hacl.Impl.K256.Sign.ecdsa_sign_s" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointMul.fst", "name": "Hacl.Impl.P256.PointMul.point_mul_g_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Verify.fst", "name": "Hacl.Impl.P256.Verify.ecdsa_verify_msg_as_qelem" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.PointMul.fst", "name": "Hacl.Impl.K256.PointMul.point_mul_g_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Sign.fst", "name": "Hacl.Impl.P256.Sign.check_signature" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.ecdh" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointAdd.fst", "name": "Hacl.Impl.P256.PointAdd.point_add_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Sign.fst", "name": "Hacl.Impl.K256.Sign.check_signature" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Verify.fst", "name": "Hacl.Impl.P256.Verify.ecdsa_verification_get_u12" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.dh_initiator" }, { "project_name": "hacl-star", "file_name": "Hacl.NaCl.fst", "name": "Hacl.NaCl.crypto_box_beforenm" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointDouble.fst", "name": "Hacl.Impl.P256.PointDouble.point_double_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Verify.fst", "name": "Hacl.Impl.K256.Verify.ecdsa_verify_avoid_finv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test_secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_all_valid_hb" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointMul.fst", "name": "Hacl.Impl.P256.PointMul.point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.load_point_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointCompress.fst", "name": "Hacl.Impl.Ed25519.PointCompress.point_compress_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDecompress.fst", "name": "Hacl.Impl.Ed25519.PointDecompress.point_decompress_" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_decompress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Sign.fst", "name": "Hacl.Impl.Ed25519.Sign.sign_compute_s" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.load_point_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.load_point_nocheck" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Curve25519.fst", "name": "EverCrypt.Curve25519.ecdh" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.PointMul.fst", "name": "Hacl.Impl.K256.PointMul.point_mul_g" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.PointMul.fst", "name": "Hacl.Impl.K256.PointMul.point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointMul.fst", "name": "Hacl.Impl.P256.PointMul.point_mul_g" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDecompress.fst", "name": "Hacl.Impl.Ed25519.PointDecompress.point_decompress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDouble.fst", "name": "Hacl.Impl.Ed25519.PointDouble.point_double_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointAdd.fst", "name": "Hacl.Impl.Ed25519.PointAdd.point_add_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g_double_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Qinv.fst", "name": "Hacl.Impl.P256.Qinv.qinv_x8_x128" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Box.fst", "name": "Hacl.Impl.Box.box_beforenm" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Ed25519.fst", "name": "EverCrypt.Ed25519.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Finv.fst", "name": "Hacl.Impl.P256.Finv.finv_256" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointAdd.fst", "name": "Hacl.Impl.Ed25519.PointAdd.point_add_step_2" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointCompress.fst", "name": "Hacl.Impl.Ed25519.PointCompress.point_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g_double_vartime_noalloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Sign.fst", "name": "Hacl.Impl.Ed25519.Sign.point_mul_g_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Frodo.KEM.KeyGen.fst", "name": "Hacl.Impl.Frodo.KEM.KeyGen.crypto_kem_sk" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Ed25519.fst", "name": "EverCrypt.Ed25519.expand_keys" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.expand_keys" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.is_point_valid" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Frodo.KEM.KeyGen.fst", "name": "Hacl.Impl.Frodo.KEM.KeyGen.crypto_kem_sk1" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Curve25519.fst", "name": "EverCrypt.Curve25519.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.point_load" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.fst", "name": "Hacl.P256.dh_responder" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDouble.fst", "name": "Hacl.Impl.Ed25519.PointDouble.point_double_step_2" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Sign.fst", "name": "Hacl.Impl.P256.Sign.ecdsa_sign_msg_as_qelem" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.aff_point_load_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.GLV.fst", "name": "Hacl.Impl.K256.GLV.point_mul_g_double_split_lambda_vartime_noalloc_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_public_key_uncompressed" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.point_mul_g_double_vartime_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.aff_point_load_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.PointDouble.fst", "name": "Hacl.Impl.P256.PointDouble.point_double_1" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.is_private_key_valid" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.GLV.Constants.fst", "name": "Hacl.Impl.K256.GLV.Constants.negate_point_and_scalar_cond_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDouble.fst", "name": "Hacl.Impl.Ed25519.PointDouble.point_double_step_1" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_verify_sha256" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.ecdsa_verify_sha256" } ], "selected_premises": [ "Hacl.Impl.P256.Point.point_seq", "Hacl.Impl.P256.Point.getx", "Hacl.Impl.P256.Point.gety", "Hacl.Bignum.Definitions.lbignum", "Hacl.Spec.Bignum.Definitions.blocks", "Hacl.Impl.P256.Point.as_point_nat", "Spec.P256.PointOps.base_point", "Hacl.Impl.P256.Point.getz", "Lib.Buffer.lbuffer_t", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Impl.P256.Point.point_inv", "Hacl.Impl.P256.Point.point_inv_seq", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.Buffer.lbuffer", "Spec.P256.PointOps.prime", "Hacl.Bignum.Definitions.blocks", "Spec.P256.PointOps.felem", "Hacl.Bignum.Definitions.blocks0", "Hacl.Impl.P256.Point.from_mont_point", "Hacl.Impl.P256.Bignum.felem", "Lib.IntTypes.int_t", "Spec.P256.PointOps.proj_point", "Hacl.Impl.P256.Point.point", "Lib.Sequence.lseq", "Hacl.Impl.P256.Bignum.as_nat", "Hacl.Impl.P256.Point.point_z_as_nat", "Hacl.Impl.P256.Point.as_point_nat_seq", "Lib.Buffer.as_seq", "Hacl.Bignum.Definitions.bn_v", "Lib.IntTypes.uint_t", "LowStar.Buffer.trivial_preorder", "Hacl.Impl.P256.Point.point_y_as_nat", "Lib.Buffer.gsub", "Hacl.Impl.P256.Point.aff_point_seq", "Lib.IntTypes.u64", "Spec.P256.PointOps.order", "Hacl.Impl.P256.Scalar.qmont_as_nat", "Spec.P256.mk_p256_comm_monoid", "Spec.P256.PointOps.b_coeff", "Lib.Sequence.op_String_Access", "Hacl.Spec.Bignum.Base.carry", "Lib.IntTypes.range", "Hacl.Bignum.Definitions.limb", "Hacl.Spec.P256.Montgomery.from_qmont", "Spec.P256.PointOps.a_coeff", "Hacl.Impl.P256.Point.aff_point", "Hacl.Impl.P256.Point.point_x_as_nat", "Lib.Sequence.to_seq", "Spec.P256.PointOps.to_aff_point", "Spec.P256.PointOps.qmul", "LowStar.Buffer.gcmalloc_of_list", "LowStar.Monotonic.Buffer.length", "Lib.Buffer.op_Array_Access", "Hacl.Impl.P256.Bignum.widefelem", "Lib.Buffer.op_Array_Assignment", "Hacl.Spec.P256.Montgomery.from_mont", "Lib.IntTypes.size", "Hacl.Impl.P256.Point.as_aff_point_nat", "Spec.P256.PointOps.aff_point", "Hacl.Impl.P256.DH.ecp256dh_i", "Hacl.Impl.P256.Point.as_aff_point_nat_seq", "Hacl.Spec.P256.Montgomery.to_qmont", "Spec.P256.PointOps.one", "Spec.P256.PointOps.qelem", "Spec.P256.PointOps.op_Slash_Percent", "Spec.P256.PointOps.finv", "Lib.IntTypes.op_Plus_Bang", "FStar.UInt.size", "Hacl.Spec.Bignum.Definitions.bn_v", "FStar.Mul.op_Star", "Spec.P256.PointOps.zero", "Hacl.Spec.Bignum.Definitions.limb", "Spec.P256.PointOps.load_point", "Lib.Sequence.length", "Lib.IntTypes.u8", "Hacl.Impl.P256.Point.aff_gety", "Lib.NatMod.mk_nat_mod_comm_monoid", "Hacl.Impl.P256.Point.aff_getx", "Hacl.Spec.P256.Montgomery.to_mont", "Spec.P256.PointOps.fmul", "Spec.P256.PointOps.point_at_inf", "Spec.Hash.Definitions.hash_length", "Lib.IntTypes.op_Star_Bang", "Lib.Buffer.disjoint", "Hacl.Spec.Bignum.Base.unsafe_bool_of_limb", "Hacl.Spec.P256.Montgomery.qmont_R", "Lib.NatMod.nat_mod", "Spec.P256.PointOps.to_proj_point", "Spec.Exponentiation.exp_pow2", "Lib.Sequence.op_String_Assignment", "Spec.Hash.Definitions.words_state", "Lib.IntTypes.op_Plus_Dot", "Lib.Buffer.loc", "Lib.UpdateMulti.uint8", "Spec.P256.PointOps.point_store", "Spec.P256.PointOps.g_x", "Lib.IntTypes.bits", "Lib.IntTypes.v", "Hacl.Bignum.Definitions.limb_t", "Hacl.Spec.Bignum.Montgomery.bn_mont_pre" ], "source_upto_this": "module Hacl.Impl.P256.DH\n\nopen FStar.HyperStack.All\nopen FStar.HyperStack\nmodule ST = FStar.HyperStack.ST\n\nopen Lib.IntTypes\nopen Lib.Buffer\n\nopen Hacl.Impl.P256.Bignum\nopen Hacl.Impl.P256.Scalar\nopen Hacl.Impl.P256.Point\nopen Hacl.Impl.P256.PointMul\n\nmodule S = Spec.P256\n\n#set-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\n[@CInline]\nlet ecp256dh_i public_key private_key =\n push_frame ();\n let tmp = create 16ul (u64 0) in\n let sk = sub tmp 0ul 4ul in\n let pk = sub tmp 4ul 12ul in\n\n let is_sk_valid = load_qelem_conditional sk private_key in\n point_mul_g pk sk;\n point_store public_key pk;\n pop_frame ();\n Hacl.Bignum.Base.unsafe_bool_of_limb is_sk_valid\n\n\ninline_for_extraction noextract\nval ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))\n", "sketch": [ "The definition specifies a function `ecp256dh_r_` that takes in a boolean flag `is_pk_valid`, a buffer `ss` of length 64 bytes, a point `pk`, and a field element `sk`. It has preconditions and postconditions that ensure memory safety and correctness of the function.\n\nStep 1: The `ecp256dh_r_` function takes in a boolean flag, a buffer, a point, and a field element, and has preconditions and postconditions to ensure memory safety and correctness.\n\nStep 2: The function implementation involves modifying the buffer `ss` based on the value of `is_pk_valid`, using the `S.point_mul` and `S.point_store` functions from the P256 module.", "The definition first checks the preconditions for memory liveness and disjointness, and the properties of the point and field element. It then modifies the memory location ss based on the value of is_pk_valid, and the resulting sequence of ss based on the conditions.", "The definition first checks the preconditions to ensure that the memory regions are live, disjoint, and that the point and field element satisfy certain properties. It then modifies the memory location ss based on the value of is_pk_valid, and the resulting sequence of ss based on the conditions.", "The definition ecp256dh_r_ takes in a boolean flag is_pk_valid, a buffer ss of length 64 bytes, a point pk, and a field element sk. It specifies the preconditions and postconditions for the function, ensuring that the memory locations are live, disjoint, and that the point and field element satisfy certain conditions.\n\nStep 1: The definition specifies the requirements and guarantees for the ecp256dh_r_ function, ensuring the validity of the public key, the memory locations, and the range of the field element.\n\nStep 2: The implementation involves specifying the preconditions and postconditions using the Stack monad, ensuring that the memory locations are modified appropriately and the sequence ss is updated based on the validity of the public key.", "The definition ecp256dh_r_ takes in a boolean flag is_pk_valid, a buffer ss of length 64 bytes, a point pk, and a field element sk. It specifies the preconditions and postconditions for the function, ensuring that certain memory regions are live and disjoint, and that the point and field element satisfy certain conditions.\n\nStep 1: The definition specifies the requirements and guarantees for the ecp256dh_r_ function, ensuring that the memory regions are live and disjoint, and that the point and field element satisfy certain conditions.\n\nStep 2: The implementation involves specifying the preconditions and postconditions using the requires and ensures clauses, ensuring that the function modifies the memory region ss appropriately based on the value of is_pk_valid.", "The definition `ecp256dh_r_` takes in a boolean `is_pk_valid`, a secret key `sk`, a public key `pk`, and a shared secret `ss`. It specifies the preconditions and postconditions for the function, ensuring that the shared secret is modified according to the validity of the public key.\n\nStep 1: The `ecp256dh_r_` function specifies the conditions for modifying the shared secret based on the validity of the public key.\n\nStep 2: The function modifies the shared secret based on the validity of the public key and the secret key.", "The definition specifies a function `ecp256dh_r_` that takes in a boolean flag `is_pk_valid`, a buffer `ss` of length 64 bytes, a point `pk`, and a field element `sk`. It has preconditions and postconditions that ensure memory safety and correctness of the function.\n\nStep 1: The `ecp256dh_r_` function takes in a boolean flag, a buffer, a point, and a field element, and ensures certain preconditions and postconditions.\n\nStep 2: The function implementation involves modifying the buffer `ss` based on the validity of the public key, and performing point multiplication and storage operations using the provided point and field element.", "The definition `ecp256dh_r_` takes in a boolean `is_pk_valid`, a buffer `ss` of length 64 bytes, a point `pk`, and a field element `sk`. It specifies the preconditions and postconditions for the function.\n\nStep 1: The definition ensures that the input buffers and points are live and disjoint, and that the field element `sk` is within a certain range. If `is_pk_valid` is true, it also requires that the point `pk` is valid.\n\nStep 2: The definition modifies the buffer `ss` and updates its content based on the value of `is_pk_valid`, using the `S.point_mul` and `S.point_store` functions from the P256 module.", "The definition ecp256dh_r_ takes in a boolean flag is_pk_valid, a buffer ss of length 64 bytes, a point pk, and a field element sk. It specifies the preconditions and postconditions for the function, ensuring that certain memory regions are live, disjoint, and within bounds. The postcondition specifies the modification of the memory location ss based on the value of is_pk_valid.\n\nStep 2: The definition is implemented by specifying the preconditions and postconditions using the requires and ensures clauses, ensuring memory safety and correctness of the function.", "The definition ecp256dh_r_ takes in a boolean flag is_pk_valid, a buffer ss of length 64 bytes, a point pk, and a field element sk. It specifies the preconditions and postconditions for the function, ensuring that the memory locations are live, disjoint, and within certain bounds. The postcondition specifies the modification of the memory location ss based on the value of is_pk_valid.\n\nStep 1: The definition specifies the requirements and guarantees for the ecp256dh_r_ function.\nStep 2: The implementation involves specifying the preconditions, postconditions, and memory modifications based on the value of is_pk_valid." ], "generated_solution": [ "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires (fun h -> \n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures (fun h0 _ h1 -> \n modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires (fun h -> \n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures (fun h0 _ h1 -> \n modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss)))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))" ] }, { "file_name": "Duplex.PCM.fst", "name": "Duplex.PCM.empty_trace", "opens_and_abbrevs": [ { "abbrev": "R", "full_module": "FStar.ReflexiveTransitiveClosure" }, { "abbrev": "P", "full_module": "FStar.Preorder" }, { "open": "Steel.Channel.Protocol" }, { "open": "FStar.PCM" }, { "abbrev": "R", "full_module": "FStar.ReflexiveTransitiveClosure" }, { "abbrev": "P", "full_module": "FStar.Preorder" }, { "open": "Steel.Channel.Protocol" }, { "open": "Steel.Effect" }, { "open": "Steel.Effect.Atomic" }, { "open": "Steel.Memory" }, { "open": "FStar.PCM" }, { "open": "Duplex" }, { "open": "Duplex" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val empty_trace (p: dprot) : trace p p", "source_definition": "let empty_trace (p:dprot) : trace p p = Waiting p", "source_range": { "start_line": 13, "start_col": 0, "end_line": 13, "end_col": 49 }, "interleaved": false, "definition": "fun p -> Steel.Channel.Protocol.Waiting p <: Steel.Channel.Protocol.trace p p", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Duplex.PCM.dprot", "Steel.Channel.Protocol.Waiting", "Steel.Channel.Protocol.trace" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "p: Duplex.PCM.dprot -> Steel.Channel.Protocol.trace p p", "prompt": "let empty_trace (p: dprot) : trace p p =\n ", "expected_response": "Waiting p", "source": { "project_name": "steel", "file_name": "share/steel/examples/steel/Duplex.PCM.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Duplex.PCM.fst", "checked_file": "dataset/Duplex.PCM.fst.checked", "interface_file": true, "dependencies": [ "dataset/Steel.PCMReference.fsti.checked", "dataset/Steel.Memory.fsti.checked", "dataset/Steel.HigherReference.fsti.checked", "dataset/Steel.FractionalPermission.fst.checked", "dataset/Steel.Effect.Atomic.fsti.checked", "dataset/Steel.Effect.fsti.checked", "dataset/Steel.Channel.Protocol.fst.checked", "dataset/prims.fst.checked", "dataset/FStar.ReflexiveTransitiveClosure.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "let is_send (p:dprot) = Msg? p && (Send? (Msg?._0 p))", "let is_recv (p:dprot) = Msg? p && (Recv? (Msg?._0 p))", "let dprot' = protocol unit", "let is_fin (p:dprot) = Return? p" ], "closest": [ "val initial_trace (p: prot) : (q: partial_trace_of p {until q == p})\nlet initial_trace (p:prot) : (q:partial_trace_of p {until q == p})\n = { to = p; tr=Waiting p}", "val history_p' (#p: prot) (t s: partial_trace_of p) : prop\nlet history_p' (#p:prot) (t:partial_trace_of p) (s:partial_trace_of p) : prop =\n t `extended_to` s /\\ True", "val history (#p:prot) (c:chan p) (t:partial_trace_of p) : Type0\nlet history (#p:prot) (c:chan p) (t:partial_trace_of p) : Type0 =\n MRef.witnessed c.chan_chan.trace (history_p t)", "val trace (#q:prot) (cc:chan q)\n : SteelT (tr:partial_trace_of q & history cc tr) emp (fun _ -> emp)\nlet trace #q (cc:chan q)\n : SteelT (tr:partial_trace_of q & history cc tr)\n emp (fun _ -> emp)\n = let _ = send_receive_prelude cc in\n let tr = witness_trace_until cc.chan_chan.trace in\n intro_chan_inv_auxT cc.chan_chan;\n Steel.SpinLock.release cc.chan_lock;\n tr", "val next (#p: protocol unit) : P.relation (partial_trace_of p)\nlet next (#p:protocol unit) : P.relation (partial_trace_of p) =\n fun (t0 t1: partial_trace_of p) ->\n more_msgs t0.to /\\\n (exists (msg:next_msg_t t0.to).\n t1.to == step t0.to msg /\\\n t1.tr == extend t0.tr msg)", "val Steel.Channel.Simplex.trace_ref = p: Steel.Channel.Simplex.prot -> Type0\nlet trace_ref (p:prot) = mref (partial_trace_of p) extended_to", "val extended_to (#p: protocol unit) : P.preorder (partial_trace_of p)\nlet extended_to (#p:protocol unit) : P.preorder (partial_trace_of p) =\n R.closure (next #p)", "val empty (a: _) (n: nat) : sseq a\nlet empty (a:_) (n:nat)\n : sseq a\n = create n (empty #a)", "val empty (k:eqtype) (v:Type) : t k v\nlet empty _ _ = on_dom _ (fun _ -> None)", "val extend_trace (#p:prot) (#next:prot) (c:chan p) \n (previous:partial_trace_of p)\n (hprevious:history c previous)\n : Steel (t:extension_of previous & history c t)\n (receiver c next)\n (fun t -> receiver c next)\n (requires fun _ -> True)\n (ensures fun _ t _ -> until (dfst t) == next)\nlet extend_trace (#q:prot) (#p:prot) \n (cc:chan q)\n (tr:partial_trace_of q)\n (htr:history cc tr)\n : Steel (tr':extension_of tr & history cc tr')\n (receiver cc p)\n (fun t -> receiver cc p)\n (requires fun _ -> True)\n (ensures fun _ t _ -> until (dfst t) == p)\n = let _ = send_receive_prelude cc in\n let tr' = extend_history cc htr in\n let _ = prot_equals cc in\n intro_chan_inv_auxT cc.chan_chan;\n Steel.SpinLock.release cc.chan_lock;\n tr'", "val Steel.Channel.Simplex.extensible = x: Steel.Channel.Protocol.partial_trace_of p -> Prims.GTot Prims.bool\nlet extensible (#p:prot) (x:partial_trace_of p) = P.more x.to", "val next_trace_st (#p: _) (vr vs: chan_val) (tr: partial_trace_of p)\n : Steel (extension_of tr)\n (chan_inv_step vr vs)\n (fun _ -> emp)\n (requires fun _ -> until tr == step vr.chan_prot vr.chan_msg)\n (ensures fun _ ts _ -> until ts == step vs.chan_prot vs.chan_msg)\nlet next_trace_st #p (vr:chan_val) (vs:chan_val) (tr:partial_trace_of p)\n : Steel (extension_of tr)\n (chan_inv_step vr vs)\n (fun _ -> emp)\n (requires fun _ -> until tr == step vr.chan_prot vr.chan_msg)\n (ensures fun _ ts _ -> until ts == step vs.chan_prot vs.chan_msg)\n = elim_pure (chan_inv_step_p vr vs);\n let ts : extension_of tr = next_trace vr vs tr () () in\n return ts", "val Steel.Channel.Protocol.until = tr: Steel.Channel.Protocol.partial_trace_of p -> Steel.Channel.Protocol.protocol Prims.unit\nlet until #p (tr:partial_trace_of p) = tr.to", "val empty (#a:Type) : Tot (s:(seq a){length s=0})\nlet empty #_ = MkSeq []", "val trace (s: string) : ST unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1)) =\n if DebugFlags.debug_Epochs then print else (fun _ -> ())", "val trace (s: string) : ST unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1)) =\n if DebugFlags.debug_Record then print else (fun _ -> ())", "val trace_until_prop (#p: _) (r: trace_ref p) (vr: chan_val) (tr: partial_trace_of p) : vprop\nlet trace_until_prop #p (r:trace_ref p) (vr:chan_val) (tr: partial_trace_of p) : vprop =\n MRef.pts_to r full_perm tr `star`\n pure (until tr == step vr.chan_prot vr.chan_msg)", "val update_trace (#p: _) (r: trace_ref p) (vr vs: chan_val)\n : Steel unit\n (trace_until r vr)\n (fun _ -> trace_until r vs)\n (requires fun _ -> chan_inv_step_p vr vs)\n (ensures fun _ _ _ -> True)\nlet update_trace #p (r:trace_ref p) (vr:chan_val) (vs:chan_val)\n : Steel unit\n (trace_until r vr)\n (fun _ -> trace_until r vs)\n (requires fun _ -> chan_inv_step_p vr vs)\n (ensures fun _ _ _ -> True)\n = intro_pure (chan_inv_step_p vr vs);\n let tr = MRef.read_refine r in\n elim_pure (until tr == step vr.chan_prot vr.chan_msg);\n let ts : extension_of tr = next_trace_st vr vs tr in\n MRef.write r ts;\n intro_pure (until ts == step vs.chan_prot vs.chan_msg);\n intro_exists ts\n (fun (ts:partial_trace_of p) ->\n MRef.pts_to r full_perm ts `star`\n pure (until ts == step vs.chan_prot vs.chan_msg))", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_NGO then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_HS then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_NGO then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_KS then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_QUIC then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_FFI then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_HSL then print else (fun _ -> ())", "val trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace = if DebugFlags.debug_TLS then print else (fun _ -> ())", "val extend_partial_trace\n (#p: protocol unit)\n (x: partial_trace_of p)\n (msg: next_msg_t x.to {more_msgs x.to})\n : Tot (y: partial_trace_of p {x `extended_to` y})\nlet extend_partial_trace (#p:protocol unit)\n (x:partial_trace_of p)\n (msg:next_msg_t x.to{more_msgs x.to})\n : Tot (y:partial_trace_of p{x `extended_to` y})\n = { to=_; tr=extend x.tr msg}", "val pure_trivial: p: prop -> squash p -> squash (pure p == emp)\nlet pure_trivial (p:prop) (_:squash p)\r\n : squash (pure p == emp)\r\n = calc (==) {\r\n pure p;\r\n (==) { equiv (pure_equiv p True ()) }\r\n pure True;\r\n (==) { equiv (A.pure_true ()) }\r\n emp;\r\n }", "val empty : #a:Type -> Tot (set a)\nlet empty #a = F.on_dom a #(fun _ -> prop) (fun x -> False)", "val empty : #a:Type -> Tot (set a)\nlet empty #a = F.on_dom_g a (fun x -> false)", "val dual (#a: _) (p: protocol a) : q: protocol a {Msg? p ==> Msg? q}\nlet rec dual #a (p:protocol a) : q:protocol a{Msg? p ==> Msg? q} =\n match p with\n | Return _ -> p\n | Msg tag b #a k ->\n let k : b -> protocol a =\n fun (x:b) -> dual #a (k x)\n in\n Msg (flip_tag tag) b #a k\n | DoWhile p #a k -> DoWhile (dual p) #a (dual k)", "val empty (a:Type0) : llist a\nlet empty a = null", "val pure (p:prop) : vprop\nlet pure = pure", "val recall_trace_ref\n (#q: _)\n (r: trace_ref q)\n (tr tr': partial_trace_of q)\n (tok: MRef.witnessed r (history_p tr))\n : Steel unit\n (MRef.pts_to r full_perm tr')\n (fun _ -> MRef.pts_to r full_perm tr')\n (requires fun _ -> True)\n (ensures fun _ _ _ -> history_p tr tr')\nlet recall_trace_ref #q (r:trace_ref q) (tr tr':partial_trace_of q)\n (tok:MRef.witnessed r (history_p tr))\n : Steel unit\n (MRef.pts_to r full_perm tr')\n (fun _ -> MRef.pts_to r full_perm tr')\n (requires fun _ -> True)\n (ensures fun _ _ _ -> history_p tr tr')\n = MRef.recall (history_p tr) r tr' tok", "val next_trace:\n #p: _ ->\n vr: chan_val ->\n vs: chan_val ->\n tr: partial_trace_of p ->\n s: squash (until tr == step vr.chan_prot vr.chan_msg) ->\n squash (chan_inv_step_p vr vs)\n -> (ts: partial_trace_of p {until ts == step vs.chan_prot vs.chan_msg})\nlet next_trace #p (vr:chan_val) (vs:chan_val)\n (tr:partial_trace_of p)\n (s:squash (until tr == step vr.chan_prot vr.chan_msg))\n (_:squash (chan_inv_step_p vr vs))\n : (ts:partial_trace_of p { until ts == step vs.chan_prot vs.chan_msg })\n = let msg : next_msg_t tr = vs.chan_msg in\n assert (extensible tr);\n extend_partial_trace tr msg", "val length: p:t -> Tot nat\nlet length p = length p", "val is_empty (d:dll 'a) :\n HST.StackInline (bool)\n (requires (fun h0 -> dll_valid h0 d))\n (ensures (fun h0 y h1 ->\n (h0 == h1) /\\\n (y <==> as_list h0 d == [])))\nlet is_empty d =\n B.is_null (!*d).DLL.lhead", "val pure (p: prop) : vprop\nlet pure = pure", "val exists_ (#a:Type u#a) (p:a -> vprop) : vprop\nlet exists_ (#a:Type u#a) (p:a -> vprop)\n : vprop\n = SEA.h_exists p", "val intro_trace_until_init (#p: _) (c: chan_t p) (v: init_chan_val p)\n : SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p)) (fun _ -> trace_until c.trace v)\nlet intro_trace_until_init #p (c:chan_t p) (v:init_chan_val p)\n : SteelT unit (MRef.pts_to c.trace full_perm (initial_trace p))\n (fun _ -> trace_until c.trace v)\n = intro_pure (until (initial_trace p) == step v.chan_prot v.chan_msg);\n //TODO: Not sure why I need this rewrite\n rewrite_slprop (MRef.pts_to c.trace full_perm (initial_trace p) `star`\n pure (until (initial_trace p) == step v.chan_prot v.chan_msg))\n (MRef.pts_to c.trace full_perm (initial_trace p) `star`\n pure (until (initial_trace p) == step v.chan_prot v.chan_msg))\n (fun _ -> ());\n intro_exists (initial_trace p) (trace_until_prop c.trace v)", "val empty_list (#a: _) : l: list a {List.length l = 0}\nlet empty_list #a : l:list a {List.length l = 0} = []", "val assert_ (p:vprop)\n: stt_ghost unit p (fun _ -> p)\nlet assert_ (p:vprop) = A.noop p", "val empty_map (a b: _) : Tot (map' a b)\nlet empty_map a b\n : Tot (map' a b)\n = fun x -> None", "val empty : #ty: Type -> seq ty\nlet empty (#ty: Type) : seq ty = []", "val llist_nil (p: ptr cell) : Tot vprop\nlet llist_nil (p: ptr cell) : Tot vprop =\n pure (p == null _)", "val Steel.Channel.Protocol.extension_of = tr: Steel.Channel.Protocol.partial_trace_of p -> Type\nlet extension_of #p (tr:partial_trace_of p) = ts:partial_trace_of p{tr `extended_to` ts}", "val count_empty (#a: eqtype) (s: seq a {length s = 0}) : Lemma (forall x. count x s = 0)\nlet count_empty (#a:eqtype) (s:seq a{length s = 0})\n : Lemma (forall x. count x s = 0)\n = reveal_opaque (`%count) (count #a)", "val pure (p:prop) : slprop\nlet pure p = pure p", "val inv (p: vprop) : Type0\nlet inv (p:vprop) : Type0 = Mem.inv (hp_of p)", "val vdep' (v: vprop) (p: ((t_of v) -> Tot vprop)) : Tot vprop'\nlet vdep' (v: vprop) (p: ( (t_of v) -> Tot vprop)) : Tot vprop' = {\n hp = vdep_hp v p;\n t = vdep_t v p;\n sel = vdep_sel v p;\n}", "val empty_vale_heaplets (h: vale_heap) : vale_heaplets\nlet empty_vale_heaplets (h:vale_heap) : vale_heaplets =\n Map16.init vale_heap (empty_heaplet h)", "val lemma_empty_seq_valid_all (psm: pseq_machine):\n Lemma (valid_all psm (empty #(elem_type_p psm)))\nlet lemma_empty_seq_valid_all (psm: pseq_machine):\n Lemma (valid_all psm (empty #(elem_type_p psm))) =\n let s = empty #(elem_type_p psm) in\n let key = key_type psm in\n let sm = seq_machine_of psm in\n let pf = partn_fn psm in\n let aux(k: key):\n Lemma (requires True)\n (ensures (valid sm (partn psm k s)))\n [SMTPat (valid sm (partn psm k s))]\n =\n lemma_filter_empty (iskey pf k);\n lemma_empty_seq_valid sm\n in\n ()", "val empty_a: a_env\nlet empty_a = fun _ -> None", "val slprop_equiv_refl (p:slprop)\r\n: slprop_equiv p p\nlet slprop_equiv_refl p = unsquash ()", "val empty : env\nlet empty _ = None", "val empty : env\nlet empty _ = None", "val drop_ (p:vprop)\n: stt_ghost unit p (fun _ -> emp)\nlet drop_ (p:vprop) = A.drop p", "val intro_maybe_p_false (p: vprop) : SteelT unit emp (fun _ -> maybe_p p false)\nlet intro_maybe_p_false (p:vprop)\n : SteelT unit emp (fun _ -> maybe_p p false)\n = rewrite_slprop emp (maybe_p p false) (fun _ -> ())", "val empty (#a: eqtype) {| _: ordered a |}:\n (t:leftist a{ to_list t = [] })\nlet empty (#a: eqtype) {| _ : ordered a |}: (t:leftist a{ to_list t = [] }) = Leaf", "val empty_x: x_env\nlet empty_x = fun _ -> None", "val true_p:prop\nlet true_p : prop = True", "val empty: env\nlet empty = MkEnv empty_a empty_x", "val llist_nil (p: ref llist_cell) : Tot vprop\nlet llist_nil\n (p: ref llist_cell)\n: Tot vprop\n= pure (p == null)", "val inv (p:vprop) : Type u#0\nlet inv = Act.inv", "val empty_vale_heaplets (h:vale_heap) : vale_heaplets\nlet empty_vale_heaplets h = empty_vale_heaplets h", "val typable_empty_closed : x:var -> #e:exp -> #t:ty -> rtyping empty e t ->\n Lemma (ensures (not(appears_free_in x e)))\nlet typable_empty_closed x #e #t h = free_in_context x h", "val noop (p:slprop)\r\n: stt_ghost unit p (fun _ -> p)\nlet noop (p:slprop)\r\n: stt_ghost unit p (fun _ -> p)\r\n= Ghost.hide (A.return #_ #(fun _ -> p) ())", "val alloc_empty:\n a:Type -> Tot (vec:vector a{size_of vec = 0ul})\nlet alloc_empty a =\n Vec 0ul 0ul B.null", "val elim_pure (p:prop)\r\n: stt_ghost (squash p) (pure p) (fun _ -> emp)\nlet elim_pure (p:prop)\r\n: stt_ghost (squash p) (pure p) (fun _ -> emp)\r\n= Ghost.hide (A.elim_pure p)", "val progress : #e:exp -> #t:ty -> h:rtyping empty e t ->\n Lemma (requires True) (ensures (is_value e \\/ (Some? (step e)))) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyVar _ -> ()\n | TyAbs _ _ -> ()\n | TyApp h1 h2 -> progress h1; progress h2", "val elim_false (a:Type) (p:a -> vprop)\n: stt_ghost a (pure False) p\nlet elim_false (a:Type) (p:a -> vprop) =\n A.bind_ghost\n (A.noop (pure False))\n (fun _ -> A.bind_ghost (A.elim_pure False) unreachable )", "val intro_trace_until (#q: _) (r: trace_ref q) (tr: partial_trace_of q) (v: chan_val)\n : Steel unit\n (MRef.pts_to r full_perm tr)\n (fun _ -> trace_until r v)\n (requires fun _ -> until tr == step v.chan_prot v.chan_msg)\n (ensures fun _ _ _ -> True)\nlet intro_trace_until #q (r:trace_ref q) (tr:partial_trace_of q) (v:chan_val)\n : Steel unit (MRef.pts_to r full_perm tr)\n (fun _ -> trace_until r v)\n (requires fun _ -> until tr == step v.chan_prot v.chan_msg)\n (ensures fun _ _ _ -> True)\n = intro_pure (until tr == step v.chan_prot v.chan_msg);\n intro_exists tr\n (fun (tr:partial_trace_of q) ->\n MRef.pts_to r full_perm tr `star`\n pure (until tr == (step v.chan_prot v.chan_msg)));\n ()", "val valid (#t:Type) (p:repr_ptr t) (h:HS.mem) : prop\nlet valid (#t:Type) (p:repr_ptr t) (h:HS.mem)\n = valid' p h", "val assert_null (#t: Type) (#opened: _) (#td: typedef t) (#v: Ghost.erased t) (p: ptr td)\n : STGhost unit opened (pts_to_or_null p v) (fun _ -> emp) (p == null _) (fun _ -> True)\nlet assert_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (p: ptr td)\n: STGhost unit opened\n (pts_to_or_null p v)\n (fun _ -> emp)\n (p == null _)\n (fun _ -> True)\n= rewrite (pts_to_or_null p v) emp", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Lemma (ensures (is_value e \\/ (Some? (step e)))) (decreases h)\nlet rec progress #e #t h =\n if TyApp? h then let TyApp h1 h2 = h in progress h1; progress h2", "val bind (#a #b: _) (p: protocol a) (q: (a -> protocol b)) : protocol b\nlet rec bind #a #b (p:protocol a) (q:(a -> protocol b))\n : protocol b\n = match p with\n | Return v -> q v\n | Msg tag c #a' k ->\n let k : c -> protocol b =\n fun x -> bind (k x) q\n in\n Msg tag c k\n | DoWhile w k -> DoWhile w (bind k q)", "val pure (p:prop) : slprop u#a\nlet pure = H.pure", "val pure (p:prop) : slprop u#a\nlet pure = H.pure", "val extend_history (#q: _) (#tr: partial_trace_of q) (#v: chan_val) (c: chan q) (tok: history c tr)\n : Steel (tr': extension_of tr & history c tr')\n ((pts_to c.chan_chan.recv half v) `star` (trace_until c.chan_chan.trace v))\n (fun _ -> (pts_to c.chan_chan.recv half v) `star` (trace_until c.chan_chan.trace v))\n (requires fun _ -> True)\n (ensures fun _ tr' _ -> until (dfst tr') == step v.chan_prot v.chan_msg)\nlet extend_history #q (#tr:partial_trace_of q)\n (#v:chan_val)\n (c:chan q)\n (tok:history c tr)\n : Steel (tr':extension_of tr & history c tr')\n (pts_to c.chan_chan.recv half v `star`\n trace_until c.chan_chan.trace v)\n (fun _ -> pts_to c.chan_chan.recv half v `star`\n trace_until c.chan_chan.trace v)\n (requires fun _ -> True)\n (ensures fun _ tr' _ -> until (dfst tr') == step v.chan_prot v.chan_msg)\n = let tr' = MRef.read_refine c.chan_chan.trace in\n let _ = recall_trace_ref c.chan_chan.trace tr tr' tok in\n let tok' = MRef.witness c.chan_chan.trace (history_p tr') tr' () in\n elim_pure (until tr' == step v.chan_prot v.chan_msg);\n intro_trace_until c.chan_chan.trace tr' v;\n let tr'' : extension_of tr = tr' in\n (| tr'', tok' |)", "val intro_pure (#uses:_) (p:prop)\n : STGhost unit uses emp (fun _ -> pure p) p (fun _ -> True)\nlet intro_pure #o p = coerce_ghost (fun _ -> SEA.intro_pure p)", "val createEmpty (#a: Type) : Tot (s: (seq a){length s = 0})\nlet createEmpty (#a:Type)\n : Tot (s:(seq a){length s=0})\n = empty #a", "val prop_and (p1 p2: prop) : Tot prop\nlet prop_and (p1 p2: prop) : Tot prop = p1 /\\ p2", "val clear_path:\n mtr:HH.rid -> p:path_p ->\n HST.ST unit\n (requires (fun h0 -> path_safe h0 mtr p))\n (ensures (fun h0 _ h1 ->\n // memory safety\n path_safe h1 mtr p /\\\n // correctness\n V.size_of (phashes h1 p) = 0ul /\\\n S.equal (lift_path #(Path?.hash_size (B.get h1 p 0)) h1 mtr p) S.empty))\nlet clear_path mtr p =\n let pv = !*p in\n p *= Path (Path?.hash_size pv) (V.clear (Path?.hashes pv))", "val empty_heaplet (h: vale_heap) (n: nat{n < 16}) : vale_heap\nlet empty_heaplet (h:vale_heap) (n:nat{n < 16}) : vale_heap =\n let ValeHeap mh ih _ = h in ValeHeap mh ih (Some n)", "val mk_pure (p: R.term) : R.term\nlet mk_pure (p:R.term) : R.term =\n let open R in\n let t = pack_ln (Tv_FVar (pack_fv pure_lid)) in\n pack_ln (Tv_App t (p, Q_Explicit))", "val receiver (#p:prot) (c:chan p) (next_action:prot) : vprop\nlet receiver #q (c:chan q) (p:prot) = in_state c.chan_chan.recv p", "val new_chan (p:prot)\n : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)\nlet new_chan (p:prot) : SteelT (chan p) emp (fun c -> sender c p `star` receiver c p)\n = let q = msg unit p in\n let v : chan_val = { chan_prot = q; chan_msg = (); chan_ctr = 0 } in\n let vp : init_chan_val p = v in\n let send = H.alloc v in\n let recv = H.alloc v in\n H.share recv;\n H.share send;\n (* TODO: use smt_fallback *)\n rewrite_slprop (pts_to send (half_perm full_perm) v `star`\n pts_to send (half_perm full_perm) v `star`\n pts_to recv (half_perm full_perm) v `star`\n pts_to recv (half_perm full_perm) v)\n (pts_to send half vp `star`\n pts_to send half vp `star`\n pts_to recv half vp `star`\n pts_to recv half vp)\n (fun _ -> ());\n let c = mk_chan send recv vp in\n intro_in_state send p vp;\n intro_in_state recv p vp;\n let l = Steel.SpinLock.new_lock (chan_inv c) in\n let ch = { chan_chan = c; chan_lock = l } in\n rewrite_slprop (in_state send p) (sender ch p) (fun _ -> ());\n rewrite_slprop (in_state recv p) (receiver ch p) (fun _ -> ());\n return ch", "val sender (#p:prot) (c:chan p) (next_action:prot) : vprop\nlet sender #q (c:chan q) (p:prot) = in_state c.chan_chan.send p", "val empty : priq\nlet empty = []", "val erase_ghost_subterms (g: env) (p: st_term) : T.Tac st_term\nlet rec erase_ghost_subterms (g:env) (p:st_term) : T.Tac st_term =\n let open Pulse.Syntax.Naming in\n\n let fresh (g:env) = Pulse.Typing.fresh g.coreenv in\n let push_binding g x b =\n { g with coreenv = E.push_binding g.coreenv x b.binder_ppname b.binder_ty } in\n\n let open_erase_close (g:env) (b:binder) (e:st_term) : T.Tac st_term =\n let x = fresh g in\n let e = open_st_term' e (tm_var { nm_index = x; nm_ppname = b.binder_ppname }) 0 in\n let e = erase_ghost_subterms (push_binding g x b) e in\n close_st_term' e x 0 in\n\n let unit_tm =\n { p with term = Tm_Return { expected_type=tm_unknown; insert_eq = false; term = unit_val } }\n in\n let ret (t:st_term') = { p with term = t } in\n if is_erasable p\n then unit_tm\n else begin\n match p.term with\n | Tm_IntroPure _\n | Tm_ElimExists _\n | Tm_IntroExists _ \n | Tm_Rewrite _ -> unit_tm\n\n | Tm_Abs { b; q; body; ascription } ->\n let body = open_erase_close g b body in\n ret (Tm_Abs { b; q; body; ascription })\n \n | Tm_Return _ -> p\n\n | Tm_STApp _ -> p\n\n | Tm_Bind { binder; head; body } ->\n if is_erasable head\n then let body = LN.subst_st_term body [LN.DT 0 unit_val] in\n erase_ghost_subterms g body\n else let head = erase_ghost_subterms g head in\n let body = open_erase_close g binder body in\n ret (Tm_Bind { binder; head; body })\n\n | Tm_TotBind { binder; head; body } ->\n if erase_type_for_extraction g binder.binder_ty\n then let body = LN.subst_st_term body [LN.DT 0 unit_val] in\n erase_ghost_subterms g body\n else let body = open_erase_close g binder body in\n ret (Tm_TotBind { binder; head; body })\n\n | Tm_If { b; then_; else_; post } ->\n let then_ = erase_ghost_subterms g then_ in\n let else_ = erase_ghost_subterms g else_ in\n ret (Tm_If { b; then_; else_; post })\n\n | Tm_Match { sc; brs; returns_ } ->\n let brs = T.map (erase_ghost_subterms_branch g) brs in\n ret (Tm_Match { sc; brs; returns_ })\n\n | Tm_While { invariant; condition; condition_var; body } ->\n let condition = erase_ghost_subterms g condition in\n let body = erase_ghost_subterms g body in\n ret (Tm_While { invariant; condition; condition_var; body })\n\n | Tm_Par { pre1; body1; post1; pre2; body2; post2 } ->\n let body1 = erase_ghost_subterms g body1 in\n let body2 = erase_ghost_subterms g body2 in\n ret (Tm_Par { pre1; body1; post1; pre2; body2; post2 })\n\n | Tm_WithLocal { binder; initializer; body } ->\n let body = open_erase_close g binder body in\n ret (Tm_WithLocal { binder; initializer; body })\n\n | Tm_WithLocalArray { binder; initializer; length; body } ->\n let body = open_erase_close g binder body in\n ret (Tm_WithLocalArray { binder; initializer; length; body })\n\n | Tm_Unreachable -> p\n\n | Tm_Admit _ -> p\n\n | _ -> T.fail \"Unexpected st term when erasing ghost subterms\"\n end\n\nand erase_ghost_subterms_branch (g:env) (b:branch) : T.Tac branch =\n let pat, body = b in\n let g, _, bs = extend_env_pat g pat in\n let body = Pulse.Checker.Match.open_st_term_bs body bs in\n let body = erase_ghost_subterms g body in\n pat, Pulse.Syntax.Naming.close_st_term_n body (L.map fst bs)", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (b2t (not (is_value e))))\n (ensures (fun _ -> True)) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n (match e1 with\n | ELam t e1' -> ExIntro (esubst_beta e2 e1') (SBeta t e1' e2)\n | _ -> (match progress h1 with\n | ExIntro e1' h1' -> ExIntro (EApp e1' e2) (SApp1 e2 h1')))\n (* | TyEqu h1 _ _ -> progress h1 -- used to work *)\n (* | TyEqu #g #e #t1 #t2 h1 _ _ -> progress #e #t1 h1\n// -- explicit annotation doesn't help with Pure annotation *)\n | TyEqu h1 _ _ -> progress h1", "val rel_sig_empty:erel (module_t sig_empty)\nlet rel_sig_empty : erel (module_t sig_empty) = sig_rel sig_empty", "val Steel.Channel.Simplex.next_msg_t = x: Steel.Channel.Protocol.partial_trace_of p -> Type0\nlet next_msg_t (#p:prot) (x:partial_trace_of p) = P.next_msg_t x.to", "val Steel.Channel.Simplex.trace_until = r: Steel.Channel.Simplex.trace_ref p -> vr: Steel.Channel.Simplex.chan_val\n -> Steel.Effect.Common.vprop\nlet trace_until #p (r:trace_ref p) (vr:chan_val) =\n h_exists (trace_until_prop r vr)", "val intro_pure (p:prop) (_:squash p)\n: stt_ghost unit emp (fun _ -> pure p)\nlet intro_pure p _ = A.intro_pure p ()", "val ( exists* ) (#a:Type) (p:a -> vprop) : vprop\nlet op_exists_Star = op_exists_Star", "val rewrite (p:vprop) (q:vprop) (_:vprop_equiv p q)\n: stt_ghost unit p (fun _ -> q)\nlet rewrite p q (pf:vprop_equiv p q)\n : stt_ghost unit p (fun _ -> q)\n = slprop_equiv_elim p q;\n A.noop q", "val depth (#p: Type0) (x: tree' p) : nat\nlet rec depth (#p:Type0) (x:tree' p) : nat =\n match x with\n | Leaf _ -> 0\n | Node _ lxs -> 1 + children_depth lxs\nand children_depth (#p:Type0) (lxs:children' p) : nat =\n match lxs with\n | (_,x) :: lxs -> max (depth x) (children_depth lxs)\n | [] -> 0", "val typable_empty_closed (e: exp)\n : Lemma (requires Some? (typing empty e)) (ensures forall x. not (appears_free_in x e))\nlet typable_empty_closed (e:exp)\n : Lemma (requires Some? (typing empty e))\n (ensures forall x. not (appears_free_in x e))\n = free_in_context e empty", "val inv (p:vprop) : Type0\nlet inv (p:vprop) = r:ghost_ref bool & inv (ex_conditional_inv r p)" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.initial_trace" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.history_p'" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.history" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.trace" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.next" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.trace_ref" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.extended_to" }, { "project_name": "zeta", "file_name": "Zeta.SSeq.fsti", "name": "Zeta.SSeq.empty" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.empty" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.extend_trace" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.extensible" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.next_trace_st" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.until" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.empty" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fsti", "name": "MiTLS.Old.Epochs.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Record.fsti", "name": "MiTLS.Record.trace" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.trace_until_prop" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.update_trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Negotiation.fst", "name": "MiTLS.Negotiation.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Handshake.fst", "name": "MiTLS.Old.Handshake.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Ticket.fst", "name": "MiTLS.Ticket.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Random.fst", "name": "MiTLS.Random.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.QUIC.fst", "name": "MiTLS.QUIC.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FFI.fst", "name": "MiTLS.FFI.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.HandshakeLog.fst", "name": "MiTLS.HandshakeLog.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.TLS.fst", "name": "MiTLS.TLS.trace" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.extend_partial_trace" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.pure_trivial" }, { "project_name": "FStar", "file_name": "FStar.TSet.fst", "name": "FStar.TSet.empty" }, { "project_name": "FStar", "file_name": "FStar.GSet.fst", "name": "FStar.GSet.empty" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.dual" }, { "project_name": "steel", "file_name": "LList.ST.fst", "name": "LList.ST.empty" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.pure" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.recall_trace_ref" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.next_trace" }, { "project_name": "FStar", "file_name": "HyE.Plain.fst", "name": "HyE.Plain.length" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fst", "name": "DoublyLinkedListIface.is_empty" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.pure" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.exists_" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.intro_trace_until_init" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.empty_list" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.assert_" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Map.fst", "name": "FStar.Monotonic.Map.empty_map" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Base.fst", "name": "FStar.Sequence.Base.empty" }, { "project_name": "steel", "file_name": "LList2.fst", "name": "LList2.llist_nil" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.extension_of" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Util.fst", "name": "FStar.Sequence.Util.count_empty" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.pure" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.inv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.vdep'" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.HeapImpl.fst", "name": "Vale.Arch.HeapImpl.empty_vale_heaplets" }, { "project_name": "zeta", "file_name": "Zeta.SeqMachine.fst", "name": "Zeta.SeqMachine.lemma_empty_seq_valid_all" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.empty_a" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.slprop_equiv_refl" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.empty" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.empty" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.drop_" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.fst", "name": "Steel.Primitive.ForkJoin.intro_maybe_p_false" }, { "project_name": "FStar", "file_name": "LeftistHeap.fst", "name": "LeftistHeap.empty" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.empty_x" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.true_p" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.empty" }, { "project_name": "steel", "file_name": "LListReverse.fst", "name": "LListReverse.llist_nil" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.inv" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.HeapLemmas.fst", "name": "Vale.Arch.HeapLemmas.empty_vale_heaplets" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.typable_empty_closed" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.noop" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.alloc_empty" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.elim_pure" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.progress" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.elim_false" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.intro_trace_until" }, { "project_name": "everparse", "file_name": "LowParse.Repr.fst", "name": "LowParse.Repr.valid" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Base.fsti", "name": "Steel.ST.C.Types.Base.assert_null" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.progress" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.bind" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.pure" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.pure" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.extend_history" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.intro_pure" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fsti", "name": "FStar.Seq.Base.createEmpty" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.prop_and" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.clear_path" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.HeapImpl.fst", "name": "Vale.Arch.HeapImpl.empty_heaplet" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_pure" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.receiver" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.new_chan" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.sender" }, { "project_name": "FStar", "file_name": "BinomialQueue.fst", "name": "BinomialQueue.empty" }, { "project_name": "steel", "file_name": "Pulse.Extract.Main.fst", "name": "Pulse.Extract.Main.erase_ghost_subterms" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.progress" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.rel_sig_empty" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.next_msg_t" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.trace_until" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.intro_pure" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.op_exists_Star" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.rewrite" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Pkg.Tree.fst", "name": "MiTLS.Pkg.Tree.depth" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.typable_empty_closed" }, { "project_name": "steel", "file_name": "Steel.DisposableInvariant.fst", "name": "Steel.DisposableInvariant.inv" } ], "selected_premises": [ "Steel.Effect.Common.to_vprop", "Steel.Memory.full_mem", "FStar.List.Tot.Base.map", "Steel.Preorder.pcm_history", "Steel.Effect.Common.to_vprop'", "FStar.List.Tot.Base.length", "Steel.FractionalPermission.full_perm", "Steel.Channel.Protocol.recv", "Steel.Effect.Common.star", "Steel.Effect.Common.rmem", "Steel.Channel.Protocol.extended_to", "Steel.Memory.inames", "Steel.Channel.Protocol.protocol", "Steel.Memory.hmem", "Steel.Effect.Common.hp_of", "Steel.Effect.Common.rm", "Steel.Channel.Protocol.ok", "Steel.Channel.Protocol.more", "Steel.Effect.Common.req", "Steel.Effect.Common.guard_vprop", "Duplex.PCM.is_fin", "Steel.Effect.Atomic.h_exists", "Steel.Channel.Protocol.msg_t", "Steel.Effect.Common.t_of", "Steel.Channel.Protocol.send", "FStar.Reflection.V2.Derived.mk_app", "Steel.Effect.Common.normal", "Steel.Effect.Common.normal_steps", "Steel.HigherReference.pts_to", "FStar.PCM.composable", "Steel.Preorder.history_val", "Steel.Effect.Common.mk_rmem", "FStar.Reflection.V2.Data.var", "Steel.Effect.Common.vrefine'", "Duplex.PCM.is_send", "Steel.Channel.Protocol.return", "Steel.Effect.Common.hmem", "FStar.Reflection.V2.Derived.mk_e_app", "Steel.Channel.Protocol.finished", "FStar.Real.one", "Steel.Effect.Common.pure", "Steel.HigherReference.ghost_pts_to", "FStar.List.Tot.Base.op_At", "Steel.Channel.Protocol.extend", "Steel.Channel.Protocol.dual", "FStar.PCM.op", "FStar.PCM.compatible", "Steel.Channel.Protocol.extension_of", "FStar.Real.two", "Steel.Effect.Common.inv", "Steel.Effect.Common.rmem'", "Steel.PCMReference.pts_to", "FStar.UInt.size", "Steel.Effect.Common.vrefine", "Steel.Channel.Protocol.step", "Steel.FractionalPermission.comp_perm", "Steel.FractionalPermission.sum_perm", "FStar.FunctionalExtensionality.feq", "Steel.Channel.Protocol.done", "Steel.Effect.Atomic.gget", "Steel.Effect.Common.extract_contexts", "Steel.Effect.Common.sel_of", "Steel.Channel.Protocol.bind", "Steel.Channel.Protocol.hnf", "Steel.Effect.Common.return_pre", "Steel.Channel.Protocol.more_msgs", "Steel.Effect.Common.focus_rmem_refl", "Steel.Channel.Protocol.tag_of", "Duplex.PCM.is_recv", "FStar.Reflection.V2.Derived.u_unk", "FStar.List.Tot.Base.rev", "FStar.List.Tot.Base.mem", "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq", "Steel.Effect.Atomic.mk_selector_vprop", "Steel.Effect.Common.vc_norm", "FStar.Reflection.V2.Derived.flatten_name", "Steel.Channel.Protocol.last_step_of", "FStar.Mul.op_Star", "Steel.Effect.Common.mk_rmem'", "Steel.Channel.Protocol.next", "FStar.Heap.trivial_preorder", "FStar.List.Tot.Base.tl", "Steel.Effect.Atomic.return_req", "Steel.Effect.return_req", "Steel.Effect.Common.unfold_guard", "Steel.Channel.Protocol.flip_tag", "Steel.Effect.Common.selector'", "Steel.Effect.Common.print_goals", "Steel.Effect.Common.focus_rmem", "Steel.Effect.Common.sel_depends_only_on", "Steel.Effect.Common.visit_br", "FStar.List.Tot.Base.append", "FStar.ST.op_Bang", "Steel.Effect.Common.norm_return_pre", "Steel.Effect.Common.try_open_existentials", "FStar.NMSTTotal.get", "Steel.Effect.Common.sel_depends_only_on_core", "FStar.Sealed.Inhabited.seal", "Steel.Effect.Common.visit_tm", "Steel.Effect.Common.slterm_nbr_uvars_argv" ], "source_upto_this": "module Duplex.PCM\n\nopen FStar.PCM\n\nopen Steel.Channel.Protocol\nmodule P = FStar.Preorder\nmodule R = FStar.ReflexiveTransitiveClosure\n\nlet is_send (p:dprot) = Msg? p && (Send? (Msg?._0 p))\nlet is_recv (p:dprot) = Msg? p && (Recv? (Msg?._0 p))\nlet is_fin (p:dprot) = Return? p\n", "sketch": [ "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`. This means that it constructs a trace that starts and ends at the same protocol.\n\nStep 1: We want to create a trace that starts and ends at the same protocol.\nStep 2: We can achieve this by using the `P.Trace` module to construct a trace from `p` to `p`.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`. This trace represents an empty sequence of protocol steps.\n\nStep 1: The `empty_trace` function creates an empty trace from the given protocol `p` to itself.\n\nStep 2: To implement `empty_trace`, we simply return a trace that contains no steps, indicating an empty sequence of protocol actions.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`. This means it constructs a trace that starts and ends at the same protocol.\n\nStep 1: We want to create a trace that starts and ends at the same protocol `p`.\n\nStep 2: We can achieve this by using the `R.refl` function from the `FStar.ReflexiveTransitiveClosure` module, which constructs a reflexive trace from a given protocol.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`. This trace represents an empty sequence of protocol steps.\n\nStep 1: The `empty_trace` function creates an empty trace from the given protocol `p` to itself.\n\nStep 2: To implement the `empty_trace` function, we simply return a trace that consists of a single step from `p` to `p`.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`, representing an empty trace.\n\nStep 1: The `empty_trace` function creates an empty trace for a given protocol.\n\nStep 2: To implement the `empty_trace` function, we simply return a trace that starts and ends at the same protocol `p`.", "The definition `empty_trace` takes a protocol `p` and constructs a trace from `p` to `p`, representing an empty trace.\n\nStep 1: The `empty_trace` function creates an empty trace for a given protocol.\n\nStep 2: To implement the `empty_trace` function, we can use the `Trace` constructor from the `FStar.PCM` module to create a trace from `p` to `p`.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`, representing an empty trace.\n\nStep 1: The `empty_trace` function takes a protocol `p` and returns a trace from `p` to `p`, indicating an empty trace.\n\nStep 2: To implement the `empty_trace` function, we can create a trace that consists of a single step from `p` to `p`, representing an empty trace.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`, representing an empty trace.\n\nStep 1: The `empty_trace` function creates an empty trace for a given protocol.\n\nStep 2: To implement `empty_trace`, we simply return a trace from the given protocol `p` to itself, indicating an empty trace.", "The definition `empty_trace` takes a protocol `p` and returns a trace from `p` to `p`. This means that it constructs a trace that starts and ends at the same protocol.\n\nStep 1: We want to define a function that constructs a trace from a given protocol to itself.\n\nStep 2: To implement this, we will create a trace that consists of a single step from the input protocol `p` to itself.", "The definition `empty_trace` is about creating an empty trace for a given protocol `p`.\n\nStep 1: We need to define a function that creates an empty trace for a given protocol.\n\nStep 2: To implement this, we will create a function `empty_trace` that takes a protocol `p` as input and returns a trace from `p` to `p` representing an empty trace." ], "generated_solution": [ "let empty_trace (p: dprot) : trace p p =\n P.Trace (p, p, [])", "let empty_trace (p: dprot) : trace p p =\n Trace []", "let empty_trace (p: dprot) : trace p p =\n R.refl p", "let empty_trace (p: dprot) : trace p p =\n Tr [Step (p, p, Empty)]", "let empty_trace (p: dprot) : trace p p =\n Trace (p, [])", "let empty_trace (p: dprot) : trace p p = Trace(p, p, [])", "let empty_trace (p: dprot) : trace p p =\n [Step (p, p, EmptyStep)]", "let empty_trace (p: dprot) : trace p p =\n Trace (p, [])", "let empty_trace (p: dprot) : trace p p =\n Trace [Step (p, p, StepId 0)]", "val empty_trace (p: dprot) : trace p p = Trace []" ] }, { "file_name": "Vale.Math.Poly2.Lemmas.fst", "name": "Vale.Math.Poly2.Lemmas.lemma_and_define", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "abbrev": "List", "full_module": "FStar.List.Tot" }, { "open": "FStar.Seq" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2_s" }, { "open": "FStar.Mul" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val lemma_and_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]} (poly_and a b).[i] == (a.[i] && b.[i]))", "source_definition": "let lemma_and_define a b =\n FStar.Classical.forall_intro (lemma_and_define_i a b)", "source_range": { "start_line": 41, "start_col": 0, "end_line": 42, "end_col": 55 }, "interleaved": false, "definition": "fun a b -> FStar.Classical.forall_intro (Vale.Math.Poly2.lemma_and_define_i a b)", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Vale.Math.Poly2_s.poly", "FStar.Classical.forall_intro", "Prims.int", "Prims.eq2", "Prims.bool", "Vale.Math.Poly2_s.op_String_Access", "Vale.Math.Poly2.poly_and", "Prims.op_AmpAmp", "Vale.Math.Poly2.lemma_and_define_i", "Prims.unit" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly\n -> FStar.Pervasives.Lemma\n (ensures\n forall (i: Prims.int). {:pattern (Vale.Math.Poly2.poly_and a b).[ i ]\\/a.[ i ]\\/b.[ i ]}\n (Vale.Math.Poly2.poly_and a b).[ i ] == (a.[ i ] && b.[ i ]))", "prompt": "let lemma_and_define a b =\n ", "expected_response": "FStar.Classical.forall_intro (lemma_and_define_i a b)", "source": { "project_name": "hacl-star", "file_name": "vale/code/lib/math/Vale.Math.Poly2.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.Math.Poly2.Lemmas.fst", "checked_file": "dataset/Vale.Math.Poly2.Lemmas.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Math.Lib.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let lemma_pointwise_equal a b pf =\n FStar.Classical.forall_intro pf;\n lemma_equal a b", "let lemma_index a =\n FStar.Classical.forall_intro (lemma_index_i a)", "val lemma_pointwise_equal (a b:poly) (pf:(i:int -> Lemma (a.[i] == b.[i]))) : Lemma\n (a == b)", "let lemma_index_all () =\n FStar.Classical.forall_intro_2 lemma_index_i", "val lemma_index (a:poly) : Lemma (forall (i:int).{:pattern a.[i]} a.[i] ==> 0 <= i /\\ i <= degree a)", "val lemma_index_all (_:unit) : Lemma\n (forall (a:poly) (i:int).{:pattern a.[i]} a.[i] ==> 0 <= i /\\ i <= degree a)", "let lemma_zero_define () =\n FStar.Classical.forall_intro lemma_zero_define_i", "val lemma_zero_define (_:unit) : Lemma (forall (i:int).{:pattern zero.[i]} not zero.[i])", "let lemma_one_define () =\n FStar.Classical.forall_intro lemma_one_define_i", "val lemma_one_define (_:unit) : Lemma (forall (i:int).{:pattern one.[i]} one.[i] == (i = 0))", "val lemma_monomial_define (n:nat) : Lemma\n (forall (i:int).{:pattern (monomial n).[i]} (monomial n).[i] == (i = n))", "let lemma_monomial_define n =\n FStar.Classical.forall_intro (lemma_monomial_define_i n)", "val lemma_monomial_define_all (_:unit) : Lemma\n (forall (n:nat) (i:int).{:pattern (monomial n).[i]} (monomial n).[i] == (i = n))", "let lemma_monomial_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> monomial n) lemma_monomial_define", "val lemma_ones_define (n:nat) : Lemma\n (forall (i:int).{:pattern (ones n).[i]} (ones n).[i] == (0 <= i && i < n))", "val lemma_ones_define_all (_:unit) : Lemma\n (forall (n:nat) (i:int).{:pattern (ones n).[i]} (ones n).[i] == (0 <= i && i < n))", "let lemma_ones_define n =\n FStar.Classical.forall_intro (lemma_ones_define_i n)", "val lemma_shift_define (p:poly) (n:int) : Lemma\n (forall (i:int).{:pattern (shift p n).[i]} (shift p n).[i] == (p.[i - n] && i >= 0))", "let lemma_ones_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> ones n) lemma_ones_define", "val lemma_shift_define_forward (p:poly) (n:int) : Lemma\n (forall (i:int).{:pattern p.[i]} (shift p n).[i + n] == (p.[i] && i + n >= 0))", "val lemma_shift_define_all (_:unit) : Lemma\n (forall (p:poly) (n:int) (i:int).{:pattern (shift p n).[i]} (shift p n).[i] == (p.[i - n] && i >= 0))", "let lemma_shift_define p n =\n FStar.Classical.forall_intro (lemma_shift_define_i p n)", "val lemma_and_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]} (poly_and a b).[i] == (a.[i] && b.[i]))", "let lemma_shift_define_forward p n =\n lemma_shift_define p n", "val lemma_and_define_all (_:unit) : Lemma\n (forall (a b:poly).{:pattern (poly_and a b)}\n forall (i:int).{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]} (poly_and a b).[i] == (a.[i] && b.[i]))", "let lemma_shift_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> shift p n) lemma_shift_define", "val lemma_or_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (poly_or a b).[i] \\/ a.[i] \\/ b.[i]} (poly_or a b).[i] == (a.[i] || b.[i]))" ], "closest": [ "val lemma_equal (a b:poly) : Lemma (requires (forall (i:int). a.[i] == b.[i])) (ensures a == b)\nlet lemma_equal a b = I.lemma_poly_equal_elim (to_poly a) (to_poly b)", "val lemma_and128 (a b:poly) : Lemma\n (requires degree a <= 127 /\\ degree b <= 127)\n (ensures to_quad32 (poly_and a b) == (four_map2 (fun di si -> iand di si) (to_quad32 a) (to_quad32 b)))\nlet lemma_and128 a b =\n let Mkfour a0 a1 a2 a3 = to_quad32 a in\n let Mkfour b0 b1 b2 b3 = to_quad32 b in\n let pand m n = poly_and (of_nat32 m) (of_nat32 n) in\n calc (==) {\n to_quad32 (poly_and a b);\n == {\n lemma_quad32_to_nat32s a;\n lemma_quad32_to_nat32s b;\n lemma_bitwise_all ();\n lemma_equal (poly_and a b) (poly128_of_poly32s (pand a0 b0) (pand a1 b1) (pand a2 b2) (pand a3 b3))\n }\n to_quad32 (poly128_of_poly32s (pand a0 b0) (pand a1 b1) (pand a2 b2) (pand a3 b3));\n == {of_nat32_and a0 b0; of_nat32_and a1 b1; of_nat32_and a2 b2; of_nat32_and a3 b3}\n to_quad32 (poly128_of_nat32s (iand a0 b0) (iand a1 b1) (iand a2 b2) (iand a3 b3));\n == {lemma_quad32_of_nat32s (iand a0 b0) (iand a1 b1) (iand a2 b2) (iand a3 b3)}\n Mkfour (iand a0 b0) (iand a1 b1) (iand a2 b2) (iand a3 b3);\n }", "val lemma_mul_def (a b: poly) : Lemma (mul_def a b == mul a b)\nlet lemma_mul_def (a b:poly) : Lemma\n (mul_def a b == mul a b)\n =\n reveal_defs ();\n PL.lemma_pointwise_equal (mul_def a b) (mul a b) (lemma_mul_element a b)", "val lemma_and_quad32 (a b:quad32) : Lemma\n (ensures poly_and (of_quad32 a) (of_quad32 b) == of_quad32 (four_map2 (fun di si -> iand di si) a b))\nlet lemma_and_quad32 a b =\n calc (==) {\n poly_and (of_quad32 a) (of_quad32 b);\n == {lemma_of_to_quad32 (poly_and (of_quad32 a) (of_quad32 b))}\n of_quad32 (to_quad32 (poly_and (of_quad32 a) (of_quad32 b)));\n == {lemma_and128 (of_quad32 a) (of_quad32 b)}\n of_quad32 (four_map2 (fun di si -> iand di si) a b);\n }", "val lemma_poly_equal_elim (a b: poly)\n : Lemma (requires a =. b)\n (ensures a == b)\n (decreases (length a + length b))\n [SMTPat (poly_equal a b)]\nlet lemma_poly_equal_elim (a b:poly) : Lemma\n (requires a =. b)\n (ensures a == b)\n (decreases (length a + length b))\n [SMTPat (poly_equal a b)]\n =\n let len = max (length a) (length b) in\n assert (len > 0 ==> a.[len - 1] == b.[len - 1]);\n assert (length a == length b);\n assert (forall (i:nat).{:pattern (index a i) \\/ (index b i)} a.[i] == b.[i]);\n assert (equal a b)", "val lemma_mul_pmul (a b: poly) : Lemma (mul_def a b == pmul b a)\nlet lemma_mul_pmul (a b:poly) : Lemma\n (mul_def a b == pmul b a)\n =\n PL.lemma_pointwise_equal (mul_def a b) (pmul b a) (lemma_mul_pmul_k a b)", "val lemma_mul_commute (a b:poly) : Lemma ((a *. b) == (b *. a))\nlet lemma_mul_commute a b = I.lemma_mul_commute (to_poly a) (to_poly b)", "val lemma_mul_commute (a b: poly) : Lemma ((a *. b) =. (b *. a))\nlet lemma_mul_commute (a b:poly) : Lemma ((a *. b) =. (b *. a)) =\n let f (k:nat) : Lemma (mul_element a b k == mul_element b a k) =\n lemma_sum_reverse 0 (k + 1) (mul_element_fun a b k) (mul_element_fun b a k)\n in\n FStar.Classical.forall_intro f", "val mul_def (a b: poly)\n : Pure poly\n (requires True)\n (ensures\n fun p ->\n let len = poly_length a + poly_length b in\n poly_length p <= len /\\\n (forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i))\nlet mul_def (a b:poly) : Pure poly\n (requires True)\n (ensures fun p ->\n let len = poly_length a + poly_length b in\n poly_length p <= len /\\\n (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)\n )\n =\n let len = poly_length a + poly_length b in\n of_fun len (fun (i:nat) -> mul_element a b i)", "val lemma_add_commute (a b:poly) : Lemma ((a +. b) == (b +. a))\nlet lemma_add_commute a b = I.lemma_add_commute (to_poly a) (to_poly b)", "val lemma_div_mod (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures a == (a /. b) *. b +. (a %. b))\nlet lemma_div_mod a b = I.lemma_div_mod (to_poly a) (to_poly b)", "val lemma_eq_to_poly (#f:G.field) (a b:G.felem f) : Lemma\n (requires to_poly a == to_poly b)\n (ensures a == b)\nlet lemma_eq_to_poly #f a b =\n lemma_felem_poly a;\n lemma_felem_poly b;\n ()", "val lemma_add_mul_zero_low (a0 a1 b0 b1: poly)\n : Lemma (requires a1 == zero \\/ b1 == zero) (ensures add (mul a0 b0) (mul a1 b1) == mul a0 b0)\nlet lemma_add_mul_zero_low (a0 a1 b0 b1:poly) : Lemma\n (requires a1 == zero \\/ b1 == zero)\n (ensures add (mul a0 b0) (mul a1 b1) == mul a0 b0)\n =\n lemma_mul_commute a1 b1;\n lemma_mul_zero a1;\n lemma_mul_zero b1;\n lemma_add_zero (mul a0 b0)", "val lemma_div_mod (a b: poly)\n : Lemma (requires length b > 0) (ensures a =. (a /. b) *. b +. (a %. b)) (decreases (length a))\nlet rec lemma_div_mod (a b:poly) : Lemma\n (requires length b > 0)\n (ensures a =. (a /. b) *. b +. (a %. b))\n (decreases (length a))\n =\n if length a < length b then\n (\n lemma_mul_zero b;\n lemma_mul_commute b zero;\n ()\n )\n else\n (\n let _ = assert (a.[length a - 1]) in\n let n = length a - length b in\n let a' = a +. (shift b n) in\n let xn = monomial n in\n lemma_shift_is_mul b n;\n lemma_mul_commute b xn;\n // a' == a +. xn *. b\n // (a /. b == a' /. b +. xn);\n lemma_add_move (a' /. b) xn;\n // (a' /. b == a /. b +. xn);\n lemma_div_mod a' b;\n // a' == (a' /. b) *. b +. (a' %. b)\n // a +. xn * b == (a /. b + xn) *. b +. (a %. b))\n lemma_mul_distribute_left (a /. b) xn b;\n // a +. xn *. b == (a /. b) *. b +. xn *. b +. (a %. b)\n // a == (a /. b) *. b +. (a %. b)\n ()\n )", "val lemma_add_cancel_eq (a b:poly) : Lemma (requires (a +. b) == zero) (ensures a == b)\nlet lemma_add_cancel_eq a b = I.lemma_add_cancel_eq (to_poly a) (to_poly b)", "val lemma_mul_degree (a b: poly)\n : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else - 1))\nlet lemma_mul_degree (a b:poly) : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else -1))\n =\n if degree a >= 0 && degree b >= 0 then\n (\n let len = length a + length b in\n lemma_sum_of_zero 0 len (mul_element_fun a b (len - 1));\n lemma_sum_extend 0 (length a - 1) (length a) (len - 1) (mul_element_fun a b (len - 2));\n assert (not (a *. b).[len - 1]);\n assert ((a *. b).[len - 2]);\n ()\n )\n else if degree a < 0 then\n (\n assert (a =. zero);\n lemma_mul_zero b;\n lemma_mul_commute b zero;\n ()\n )\n else\n (\n assert (b =. zero);\n lemma_mul_zero a;\n ()\n )", "val of_nat32_and (a b:nat32) : Lemma\n (poly_and (of_nat32 a) (of_nat32 b) == of_nat32 (iand a b))\nlet of_nat32_and a b =\n lemma_bitwise_all ();\n lemma_iand_nth_all 32;\n lemma_equal (poly_and (of_nat32 a) (of_nat32 b)) (of_nat32 (iand a b))", "val lemma_add_mul_zero_high (a0 a1 b0 b1: poly)\n : Lemma (requires a0 == zero \\/ b0 == zero) (ensures add (mul a0 b0) (mul a1 b1) == mul a1 b1)\nlet lemma_add_mul_zero_high (a0 a1 b0 b1:poly) : Lemma\n (requires a0 == zero \\/ b0 == zero)\n (ensures add (mul a0 b0) (mul a1 b1) == mul a1 b1)\n =\n lemma_mul_commute a0 b0;\n lemma_mul_zero a0;\n lemma_mul_zero b0;\n lemma_add_commute (mul a0 b0) (mul a1 b1);\n lemma_add_zero (mul a1 b1)", "val lemma_add_associate (a b c:poly) : Lemma ((a +. (b +. c)) == ((a +. b) +. c))\nlet lemma_add_associate a b c = I.lemma_add_associate (to_poly a) (to_poly b) (to_poly c)", "val lemma_mul_distribute (a b c:poly) : Lemma (a *. (b +. c) == (a *. b) +. (a *. c))\nlet lemma_mul_distribute a b c = I.lemma_mul_distribute (to_poly a) (to_poly b) (to_poly c)", "val lemma_mul_element (a b: poly) (k: int)\n : Lemma (mul_element a b k == D.mul_element (d a) (d b) k)\nlet lemma_mul_element (a b:poly) (k:int) : Lemma\n (mul_element a b k == D.mul_element (d a) (d b) k)\n =\n reveal_defs ();\n lemma_mul_element_rec a b k (k + 1);\n ()", "val lemma_i2b_and (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_and #n a b =\n int2bv_logand #n #a #b #(bvand #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b))", "val lemma_mul_distribute (a b c: poly) : Lemma (a *. (b +. c) =. (a *. b) +. (a *. c))\nlet lemma_mul_distribute (a b c:poly) : Lemma (a *. (b +. c) =. (a *. b) +. (a *. c)) =\n let f (k:nat) : Lemma\n (ensures mul_element a (b +. c) k == (mul_element a b k <> mul_element a c k))\n =\n lemma_sum_of_pairs 0 (k + 1)\n (mul_element_fun a (b +. c) k)\n (mul_element_fun a b k)\n (mul_element_fun a c k)\n in\n FStar.Classical.forall_intro f", "val lemma_mul_one (a: poly) : Lemma ((a *. one) =. a)\nlet lemma_mul_one (a:poly) : Lemma ((a *. one) =. a) =\n let f (k:nat) : Lemma (mul_element a one k == a.[k]) =\n lemma_sum_of_zero 0 k (mul_element_fun a one k)\n in\n FStar.Classical.forall_intro f", "val add (a b: poly)\n : Pure poly\n (requires True)\n (ensures\n fun p ->\n let len = max (length a) (length b) in\n length p <= len /\\\n (forall (i: int). {:pattern p.[ i ]\\/a.[ i ]\\/b.[ i ]} p.[ i ] == (a.[ i ] <> b.[ i ])))\nlet add (a b:poly) : Pure poly\n (requires True)\n (ensures fun p ->\n let len = max (length a) (length b) in\n length p <= len /\\\n (forall (i:int).{:pattern p.[i] \\/ a.[i] \\/ b.[i]} p.[i] == (a.[i] <> b.[i]))\n )\n =\n let len = max (length a) (length b) in\n of_fun len (fun (i:nat) -> a.[i] <> b.[i])", "val lemma_mul_associate (a b c:poly) : Lemma (a *. (b *. c) == (a *. b) *. c)\nlet lemma_mul_associate a b c = I.lemma_mul_associate (to_poly a) (to_poly b) (to_poly c)", "val lemma_add128 (a b:poly) : Lemma\n (requires degree a <= 127 /\\ degree b <= 127)\n (ensures to_quad32 (a +. b) == quad32_xor (to_quad32 a) (to_quad32 b))\nlet lemma_add128 a b =\n let Mkfour a0 a1 a2 a3 = to_quad32 a in\n let Mkfour b0 b1 b2 b3 = to_quad32 b in\n let pxor m n = of_nat32 m +. of_nat32 n in\n calc (==) {\n to_quad32 (a +. b);\n == {\n lemma_quad32_to_nat32s a;\n lemma_quad32_to_nat32s b;\n lemma_bitwise_all ();\n lemma_equal (a +. b) (poly128_of_poly32s (pxor a0 b0) (pxor a1 b1) (pxor a2 b2) (pxor a3 b3))\n }\n to_quad32 (poly128_of_poly32s (pxor a0 b0) (pxor a1 b1) (pxor a2 b2) (pxor a3 b3));\n == {of_nat32_xor a0 b0; of_nat32_xor a1 b1; of_nat32_xor a2 b2; of_nat32_xor a3 b3}\n to_quad32 (poly128_of_nat32s (ixor a0 b0) (ixor a1 b1) (ixor a2 b2) (ixor a3 b3));\n == {lemma_quad32_of_nat32s (ixor a0 b0) (ixor a1 b1) (ixor a2 b2) (ixor a3 b3)}\n Mkfour (ixor a0 b0) (ixor a1 b1) (ixor a2 b2) (ixor a3 b3);\n == {quad32_xor_reveal ()}\n quad32_xor (to_quad32 a) (to_quad32 b);\n }", "val lemma_mul_element (a b: poly) (k: int)\n : Lemma (requires True) (ensures (a *. b).[ k ] == mul_element a b k) [SMTPat (a *. b).[ k ]]\nlet lemma_mul_element (a b:poly) (k:int) : Lemma\n (requires True)\n (ensures (a *. b).[k] == mul_element a b k)\n [SMTPat (a *. b).[k]]\n =\n if k >= length a + length b then lemma_sum_of_zero 0 (k + 1) (mul_element_fun a b k)", "val lemma_mul_nat_bound (a a' b b':nat) : Lemma\n (requires a <= a' /\\ b <= b')\n (ensures 0 <= a * b /\\ a * b <= a' * b')\nlet lemma_mul_nat_bound a a' b b' =\n let open FStar.Math.Lemmas in\n nat_times_nat_is_nat a b;\n lemma_mult_le_left a b b'; // a * b <= a * b'\n lemma_mult_le_right b' a a'; // a * b' <= a' * b'\n ()", "val poly_and (a:poly) (b:poly) : poly\nlet poly_and a b = of_fun (1 + FStar.Math.Lib.max (size a) (size b)) (fun (i:nat) -> a.[i] && b.[i])", "val lemma_mul_associate (a b c: poly) : Lemma (a *. (b *. c) =. (a *. b) *. c)\nlet lemma_mul_associate (a b c:poly) : Lemma (a *. (b *. c) =. (a *. b) *. c) =\n let f (k:nat) : Lemma (mul_element a (b *. c) k == mul_element (a *. b) c k) =\n let abc1 (i:int) (j:int) = a.[j] && b.[i - j] && c.[k - i] in\n let abc2 (j:int) (i:int) = a.[j] && b.[i - j] && c.[k - i] in\n let abc3 (j:int) (i:int) = a.[j] && b.[i] && c.[k - j - i] in\n let sum_abc1 (i:int) = sum_of_bools 0 (i + 1) (abc1 i) in\n let sum_abc2 (j:int) = sum_of_bools j (k + 1) (abc2 j) in\n let sum_abc3 (j:int) = sum_of_bools 0 (k + 1 - j) (abc3 j) in\n let l1 (i:int) : Lemma (mul_element_fun (a *. b) c k i == sum_abc1 i) =\n lemma_sum_mul 0 (i + 1) c.[k - i] (abc1 i) (mul_element_fun a b i)\n in\n let l2 (j:int) : Lemma (sum_abc2 j == sum_abc3 j) =\n lemma_sum_shift 0 (k + 1 - j) j (abc3 j) (abc2 j)\n in\n let l3 (j:int) : Lemma (mul_element_fun a (b *. c) k j == sum_abc3 j) =\n lemma_sum_mul 0 (k + 1 - j) a.[j] (abc3 j) (mul_element_fun b c (k - j))\n in\n // mul_element (a *. b) c k\n // sum[0 <= i <= k] (a *. b)[i] * c[k - i]\n // sum[0 <= i <= k] (sum[0 <= j <= i] a[j] * b[i - j]) * c[k - i])\n lemma_sum_pointwise_equal 0 (k + 1) (mul_element_fun (a *. b) c k) sum_abc1 l1;\n // sum[0 <= i <= k] sum[0 <= j <= i] a[j] * b[i - j] * c[k - i]\n lemma_sum_swap_mul_associate (k + 1) abc1 abc2 sum_abc1 sum_abc2;\n // sum[0 <= j <= k] sum[j <= i <= k] a[j] * b[i - j] * c[k - i]\n lemma_sum_pointwise_equal 0 (k + 1) sum_abc2 sum_abc3 l2;\n // sum[0 <= j <= k] sum[0 <= i <= k - j] a[j] * b[i] * c[k - j - i]\n lemma_sum_pointwise_equal 0 (k + 1) (mul_element_fun a (b *. c) k) sum_abc3 l3;\n // sum[0 <= j <= k] a[j] * (sum[0 <= i <= k - j] b[i] * c[k - j - i])\n // sum[0 <= j <= k] (a[j] * (b *. c)[k - j])\n // mul_element a (b *. c) k\n ()\n in\n FStar.Classical.forall_intro f", "val lemma_mul_one (a:poly) : Lemma ((a *. one) == a)\nlet lemma_mul_one a = I.lemma_mul_one (to_poly a)", "val lemma_pointwise_equal (a b: poly) (pf: (i: int -> Lemma (a.[ i ] == b.[ i ]))) : Lemma (a == b)\nlet lemma_pointwise_equal (a b:poly) (pf:(i:int -> Lemma (a.[i] == b.[i]))) : Lemma (a == b) =\n FStar.Classical.forall_intro pf;\n lemma_poly_equal_elim a b", "val lemma_mul_degree (a b:poly) : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else -1))\n [SMTPat (degree (a *. b))]\nlet lemma_mul_degree a b = I.lemma_mul_degree (to_poly a) (to_poly b)", "val lemma_mul_element_rec (a b: poly) (k n: int)\n : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\nlet rec lemma_mul_element_rec (a b:poly) (k:int) (n:int) : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\n =\n reveal_defs ();\n if n > 0 then lemma_mul_element_rec a b k (n - 1)", "val lemma_mul_reverse (a b:poly) (n:nat) : Lemma\n (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) == reverse a n *. reverse b n)\nlet lemma_mul_reverse a b n = I.lemma_mul_reverse (to_poly a) (to_poly b) n", "val lemma_add_move (a b: poly) : Lemma (ensures a == (a +. b) +. b)\nlet lemma_add_move (a b:poly) : Lemma (ensures a == (a +. b) +. b) =\n lemma_add_associate a b b;\n lemma_add_cancel b;\n lemma_add_zero a", "val lemma_mul_pmul_k (a b: poly) (k: int) : Lemma ((mul_def a b).[ k ] == (pmul b a).[ k ])\nlet lemma_mul_pmul_k (a b:poly) (k:int) : Lemma\n ((mul_def a b).[k] == (pmul b a).[k])\n =\n PL.lemma_index_all ();\n let n = poly_length a in\n lemma_pmul_degree b a n;\n if n = k + 1 then lemma_mul_pmul_k_base a b k n\n else if n > k + 1 then lemma_mul_pmul_k_left a b k n (k + 1)\n else lemma_mul_pmul_k_right a b k n (k + 1)", "val lemma_mul_reverse (a b: poly) (n: nat)\n : Lemma (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) =. reverse a n *. reverse b n)\nlet lemma_mul_reverse (a b:poly) (n:nat) : Lemma\n (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) =. reverse a n *. reverse b n)\n =\n let ab = a *. b in\n let rab = reverse ab (n + n) in\n let ra = reverse a n in\n let rb = reverse b n in\n lemma_mul_degree a b;\n lemma_mul_degree ra rb;\n let f (k:int) : Lemma (rab.[k] == (ra *. rb).[k]) =\n if 0 <= k && k <= n + n then\n (\n let f0 = mul_element_fun ra rb k in\n let f1 (i:int) : bool = a.[n + i] && b.[n - k - i] in\n let f2 = mul_element_fun a b (n + n - k) in\n // mul_element a b (n + n - k) == sum_of_bools 0 (n + n + 1 - k) f2\n\n // mul_element ra rb k == sum_of_bools 0 (k + 1) f0\n lemma_sum_invert 0 (k + 1) f0 f1;\n // mul_element ra rb k == sum_of_bools (-k) 1 f1\n lemma_sum_shift (-k) 1 n f1 f2;\n // mul_element ra rb k == sum_of_bools (n - k) (n + 1) f2\n\n let lo = min (n - k) 0 in\n let hi = max (n + 1) (n + n + 1 - k) in\n lemma_sum_extend lo 0 (n + n + 1 - k) hi f2;\n lemma_sum_extend lo (n - k) (n + 1) hi f2;\n ()\n )\n in\n lemma_pointwise_equal rab (ra *. rb) f", "val mul (a b: poly)\n : Pure poly\n (requires True)\n (ensures\n fun p ->\n let len = length a + length b in\n length p <= len /\\\n (forall (i: nat). {:pattern p.[ i ]} i < len ==> p.[ i ] == mul_element a b i))\nlet mul (a b:poly) : Pure poly\n (requires True)\n (ensures fun p ->\n let len = length a + length b in\n length p <= len /\\\n (forall (i:nat).{:pattern p.[i]} i < len ==> p.[i] == mul_element a b i)\n )\n =\n let len = length a + length b in\n of_fun len (fun (i:nat) -> mul_element a b i)", "val lemma_mmul_pmul (a b m: poly) (n: nat)\n : Lemma (requires poly_length m > 0 /\\ n >= poly_length b)\n (ensures mod (mmul a b m n) m == mod (pmul a b) m)\nlet rec lemma_mmul_pmul (a b m:poly) (n:nat) : Lemma\n (requires poly_length m > 0 /\\ n >= poly_length b)\n (ensures mod (mmul a b m n) m == mod (pmul a b) m)\n =\n PL.lemma_index_all ();\n if n = poly_length b then lemma_mmul_pmul_rec a b m n\n else lemma_mmul_pmul a b m (n - 1)", "val lemma_div_distribute (a b c:poly) : Lemma\n (requires degree c >= 0)\n (ensures (a +. b) /. c == (a /. c) +. (b /. c))\nlet lemma_div_distribute a b c =\n let ab = a +. b in\n let a' = a /. c in\n let b' = b /. c in\n let ab' = ab /. c in\n let a'' = a %. c in\n let b'' = b %. c in\n let ab'' = ab %. c in\n lemma_div_mod a c;\n lemma_div_mod b c;\n lemma_div_mod ab c;\n // (a +. b) == (a) +. (b)\n assert ((ab' *. c +. ab'') == (a' *. c +. a'') +. (b' *. c +. b''));\n lemma_add_define_all ();\n lemma_equal (ab' *. c +. a' *. c +. b' *. c) (ab'' +. a'' +. b'');\n lemma_mul_distribute_left ab' a' c;\n lemma_mul_distribute_left (ab' +. a') b' c;\n assert ((ab' +. a' +. b') *. c == ab'' +. a'' +. b'');\n lemma_mul_smaller_is_zero (ab' +. a' +. b') c;\n assert (ab' +. a' +. b' == zero);\n lemma_zero_define ();\n lemma_equal ab' (a' +. b');\n ()", "val lemma_mul_distribute_left (a b c: poly) : Lemma ((a +. b) *. c =. (a *. c) +. (b *. c))\nlet lemma_mul_distribute_left (a b c:poly) : Lemma ((a +. b) *. c =. (a *. c) +. (b *. c)) =\n lemma_mul_commute (a +. b) c;\n lemma_mul_commute a c;\n lemma_mul_commute b c;\n lemma_mul_distribute c a b", "val lemma_mul (f:G.field) (a b:G.felem f) : Lemma\n (requires True)\n (ensures to_poly (G.fmul a b) == (to_poly a *. to_poly b) %. (irred_poly f))\n [SMTPat (to_poly (G.fmul a b))]\nlet lemma_mul f a b =\n let G.GF t irred = f in\n let n = I.bits t in\n let pa = to_poly a in\n let pb = to_poly b in\n let m = irred_poly f in\n lemma_mul_commute pa pb;\n lemma_mul_def pb pa;\n lemma_mul_pmul pb pa;\n lemma_mmul_pmul pa pb m n;\n lemma_mmul_smul pa pb m n;\n lemma_smul_fmul f a b;\n lemma_fmul_gmul f a b;\n lemma_fmul_fmul f a b;\n PL.lemma_mod_small (to_poly (G.fmul a b)) m;\n ()", "val lemma_div_degree (a b: poly)\n : Lemma (requires length b > 0)\n (ensures degree (a /. b) == (if degree a < degree b then - 1 else degree a - degree b))\n (decreases (length a))\nlet rec lemma_div_degree (a b:poly) : Lemma\n (requires length b > 0)\n (ensures degree (a /. b) == (if degree a < degree b then -1 else degree a - degree b))\n (decreases (length a))\n =\n if length a >= length b then\n (\n let _ = assert (a.[length a - 1]) in\n let n = length a - length b in\n let a' = add a (shift b n) in\n lemma_div_degree a' b;\n assert ((a /. b).[degree a - degree b]);\n ()\n )", "val lemma_pmul_degree (a b: poly) (n: nat)\n : Lemma (requires True) (ensures poly_length (pmul_rec a b n) <= poly_length a + n)\nlet rec lemma_pmul_degree (a b:poly) (n:nat) : Lemma\n (requires True)\n (ensures poly_length (pmul_rec a b n) <= poly_length a + n)\n =\n if n > 0 then lemma_pmul_degree a b (n - 1)", "val lemma_mul_zero (a:poly) : Lemma ((a *. zero) == zero)\nlet lemma_mul_zero a = I.lemma_mul_zero (to_poly a)", "val lemma_vsel32 (a b c:nat32) : Lemma\n (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b)))\nlet lemma_vsel32 (a b c:nat32) : Lemma\n (ensures (isel32 a b c = (iand32 c a) *^ (iand32 (inot32 c) b)))\n =\n reveal_iand_all 32;\n reveal_inot_all 32;\n reveal_ixor_all 32;\n lemma_equal_nth 32 (isel32 a b c) ((iand32 c a) *^ (iand32 (inot32 c) b))", "val lemma_mul_zero (a: poly) : Lemma ((a *. zero) =. zero)\nlet lemma_mul_zero (a:poly) : Lemma ((a *. zero) =. zero) =\n let f (k:nat) : Lemma (not (mul_element a zero k)) =\n lemma_sum_of_zero 0 (k + 1) (mul_element_fun a zero k)\n in\n FStar.Classical.forall_intro f", "val lemma_i2b_or (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (logor #n a b) == b_or #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_or #n a b =\n int2bv_logor #n #a #b #(bvor #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (logor #n a b) == b_or #n (b_i2b a) (b_i2b b))", "val constr (a b: prop) : Lemma (a ==> b ==> b /\\ a)\nlet constr (a b : prop) : Lemma (a ==> b ==> b /\\ a) =\n assert (a ==> b ==> b /\\ a)\n by (let ha = implies_intro () in\n let hb = implies_intro () in\n split ();\n hyp (binding_to_namedv hb);\n hyp (binding_to_namedv ha);\n qed ())", "val lemma_Mul128 (a b:poly) : Lemma\n (requires degree a < 128 /\\ degree b < 128)\n (ensures (\n let aL = mask a 64 in\n let bL = mask b 64 in\n let aH = shift a (-64) in\n let bH = shift b (-64) in\n a *. b == aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128\n ))\nlet lemma_Mul128 a b =\n let aL = mask a 64 in\n let bL = mask b 64 in\n let aH = shift a (-64) in\n let bH = shift b (-64) in\n calc (==) {\n a *. b;\n == {\n lemma_bitwise_all ();\n lemma_equal a (aL +. shift aH 64);\n lemma_equal b (bL +. shift bH 64)\n }\n (aL +. shift aH 64) *. (bL +. shift bH 64);\n == {lemma_mul_distribute_left aL (shift aH 64) (bL +. shift bH 64)}\n aL *. (bL +. shift bH 64) +. shift aH 64 *. (bL +. shift bH 64);\n == {lemma_mul_distribute_right aL bL (shift bH 64)}\n aL *. bL +. aL *. shift bH 64 +. shift aH 64 *. (bL +. shift bH 64);\n == {lemma_mul_distribute_right (shift aH 64) bL (shift bH 64)}\n aL *. bL +. aL *. shift bH 64 +. (shift aH 64 *. bL +. shift aH 64 *. shift bH 64);\n == {lemma_add_all ()}\n aL *. bL +. (aL *. shift bH 64 +. shift aH 64 *. bL) +. shift aH 64 *. shift bH 64;\n == {lemma_shift_is_mul aH 64; lemma_shift_is_mul bH 64}\n aL *. bL +. (aL *. (bH *. monomial 64) +. aH *. monomial 64 *. bL) +. aH *. monomial 64 *. (bH *. monomial 64);\n == {lemma_mul_all ()}\n aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. (monomial 64 *. monomial 64);\n == {lemma_mul_monomials 64 64}\n aL *. bL +. (aL *. bH *. monomial 64 +. aH *. bL *. monomial 64) +. aH *. bH *. monomial 128;\n == {lemma_mul_distribute_left (aL *. bH) (aH *. bL) (monomial 64)}\n aL *. bL +. (aL *. bH +. aH *. bL) *. monomial 64 +. aH *. bH *. monomial 128;\n == {lemma_shift_is_mul (aL *. bH +. aH *. bL) 64; lemma_shift_is_mul (aH *. bH) 128}\n aL *. bL +. shift (aL *. bH +. aH *. bL) 64 +. shift (aH *. bH) 128;\n }", "val logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n})\n : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i))\n [SMTPat (index (logand_vec #n a b) i)]\nlet rec logand_vec_definition (#n: pos) (a b: bv_t n) (i: nat{i < n})\n : Lemma (ensures index (logand_vec #n a b) i = (index a i && index b i))\n [SMTPat (index (logand_vec #n a b) i)] =\n if i = 0 then () else logand_vec_definition #(n - 1) (slice a 1 n) (slice b 1 n) (i - 1)", "val lemma_i2b_mul (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (mul_mod #n a b) == b_mul #n (b_i2b a) b)\nlet lemma_i2b_mul #n a b =\n int2bv_mul #n #a #b #(bvmul #n (int2bv #n a) b) ();\n assert_norm (b_i2b #n (mul_mod #n a b) == b_mul #n (b_i2b a) b)", "val lemma_mul_mod_prime_zero: #m:prime -> a:nat_mod m -> b:nat_mod m ->\n Lemma (a * b % m == 0 <==> (a % m == 0 \\/ b % m == 0))\nlet lemma_mul_mod_prime_zero #m a b =\n Classical.move_requires_3 Euclid.euclid_prime m a b;\n Classical.move_requires_3 lemma_mul_mod_zero2 m a b", "val lemma_add_zero (a:poly) : Lemma ((a +. zero) == a)\nlet lemma_add_zero a = I.lemma_add_zero (to_poly a)", "val lemma_iand_nth_all (n:pos) : Lemma\n (forall (m:_{m==pow2_norm n}) (x y:natN (pow2 n)).{:pattern (iand #m x y)}\n (forall (i:nat{i < n}).{:pattern (nth #n (iand #m x y) i)}\n nth #n (iand #m x y) i == (nth #n x i && nth #n y i)))\nlet lemma_iand_nth_all n =\n FStar.Classical.forall_intro_2 (lemma_iand_nth n)", "val lemma_aux_0 (a b n: nat)\n : Lemma\n (pow2 n * a + pow2 (n + 56) * b = pow2 n * (a % pow2 56) + pow2 (n + 56) * (b + a / pow2 56))\nlet lemma_aux_0 (a:nat) (b:nat) (n:nat) : Lemma\n (pow2 n * a + pow2 (n+56) * b = pow2 n * (a % pow2 56) + pow2 (n+56) * (b + a / pow2 56))\n = Math.Lemmas.lemma_div_mod a (pow2 56);\n Math.Lemmas.pow2_plus n 56;\n assert(a = pow2 56 * (a / pow2 56) + (a % pow2 56));\n Math.Lemmas.distributivity_add_right (pow2 n) (pow2 56 * (a / pow2 56)) (a % pow2 56);\n Math.Lemmas.paren_mul_right (pow2 n) (pow2 56) (a / pow2 56);\n Math.Lemmas.distributivity_add_right (pow2 (n+56)) b (a / pow2 56)", "val lemma_gf128_mul_rev_commute (a b:poly) : Lemma (a *~ b == b *~ a)\nlet lemma_gf128_mul_rev_commute a b =\n lemma_mul_all ()", "val lemma_mod_degree (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures degree (a %. b) < degree b)\n [SMTPat (degree (a %. b))]\nlet lemma_mod_degree a b = I.lemma_mod_degree (to_poly a) (to_poly b)", "val lemma_div_degree (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures degree (a /. b) == (if degree a < degree b then -1 else degree a - degree b))\n [SMTPat (degree (a /. b))]\nlet lemma_div_degree a b = I.lemma_div_degree (to_poly a) (to_poly b)", "val lemma_part_bound1 (a: nat) (b c: pos)\n : Lemma (0 < b * c /\\ b * (a / b) % (b * c) <= b * (c - 1))\nlet lemma_part_bound1(a:nat) (b:pos) (c:pos):\n Lemma(0 0) (ensures degree (a %. b) < degree b) (decreases (length a))\nlet rec lemma_mod_degree (a b:poly) : Lemma\n (requires length b > 0)\n (ensures degree (a %. b) < degree b)\n (decreases (length a))\n =\n if length a >= length b then\n (\n let _ = assert (a.[length a - 1]) in\n let n = length a - length b in\n let a' = add a (shift b n) in\n lemma_mod_degree a' b\n )", "val lemma_mmul_pmul_rec (a b m: poly) (n: nat)\n : Lemma (requires poly_length m > 0) (ensures mod (mmul a b m n) m == mod (pmul_rec a b n) m)\nlet rec lemma_mmul_pmul_rec (a b m:poly) (n:nat) : Lemma\n (requires poly_length m > 0)\n (ensures mod (mmul a b m n) m == mod (pmul_rec a b n) m)\n =\n if n > 0 then\n (\n let n' = n - 1 in\n let mp = mmul a b m n' in\n let pp = pmul_rec a b n' in\n lemma_mmul_pmul_rec a b m (n - 1);\n assert (mod mp m == mod pp m);\n let s = shift a n' in\n PL.lemma_mod_distribute pp s m;\n PL.lemma_mod_distribute mp s m;\n PL.lemma_mod_distribute mp (s %. m) m;\n PL.lemma_mod_mod s m;\n //assert ((mp +. (s %. m)) %. m == (mp +. s) %. m);\n //assert ((mp +. s) %. m == (pp +. s) %. m);\n //assert (mod (add mp (mod s m)) m == mod (add pp s) m);\n //assert (mod (add mp (mod (shift a n') m)) m == mod (add pp (shift a n')) m);\n ()\n )", "val lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma\n (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))))\nlet lemma_eq_maj_xvsel32 (a b c:nat32) : Lemma\n (ensures (isel32 c b (a *^ b) = (iand32 a b) *^ ((iand32 a c) *^ (iand32 b c))))\n =\n reveal_iand_all 32;\n reveal_ixor_all 32;\n lemma_equal_nth 32 (isel32 c b (a *^ b)) ((iand32 a b) *^ ((iand32 a c) *^ (iand32 b c)))", "val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma\n ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)\nlet lemma_distr5 a0 a1 a2 a3 a4 b =\n calc (==) {\n (a0 + a1 + a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b }\n a0 * b + (a1 + a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b }\n a0 * b + a1 * b + (a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b }\n a0 * b + a1 * b + a2 * b + (a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a3 a4 b }\n a0 * b + a1 * b + a2 * b + a3 * b + a4 * b;\n }", "val lemma_i2b_eq (#n:pos) (a b:uint_t n) : Lemma\n (requires b_i2b a == b_i2b b)\n (ensures a == b)\nlet lemma_i2b_eq #n a b =\n assert_norm (b_i2b a == b_i2b b ==> int2bv a == int2bv b);\n int2bv_lemma_2 #n a b", "val lemma_gf128_mul_rev_distribute_left (a b c:poly) : Lemma\n ((a +. b) *~ c == a *~ c +. b *~ c)\nlet lemma_gf128_mul_rev_distribute_left a b c =\n let rev x = reverse x 127 in\n let ra = rev a in\n let rb = rev b in\n let rc = rev c in\n let g = gf128_modulus in\n lemma_gf128_degree ();\n calc (==) {\n (a +. b) *~ c;\n == {}\n rev (rev (a +. b) *. rc %. g);\n == {lemma_add_reverse a b 127}\n rev ((ra +. rb) *. rc %. g);\n == {lemma_mul_distribute_left ra rb rc}\n rev ((ra *. rc +. rb *. rc) %. g);\n == {lemma_mod_distribute (ra *. rc) (rb *. rc) g}\n rev (ra *. rc %. g +. rb *. rc %. g);\n == {lemma_add_reverse (ra *. rc %. g) (rb *. rc %. g) 127}\n rev (ra *. rc %. g) +. rev (rb *. rc %. g);\n == {}\n (a *~ c) +. (b *~ c);\n }", "val lemma_all_but_last_append (#t:Type) (a:seq t) (b:seq t{length b > 0}) :\n Lemma (all_but_last (append a b) == append a (all_but_last b))\nlet lemma_all_but_last_append (#t:Type) (a:seq t) (b:seq t{length b > 0}) :\n Lemma (all_but_last (append a b) == append a (all_but_last b)) =\n let ab = all_but_last (append a b) in\n let app_a_b = append a (all_but_last b) in\n assert (equal ab app_a_b)", "val lemma_add_mod_rev (n:pos) (a1 a2 b:poly) : Lemma\n (requires degree b >= 0)\n (ensures mod_rev n (a1 +. a2) b == mod_rev n a1 b +. mod_rev n a2 b)\nlet lemma_add_mod_rev n a1 a2 b =\n let rev x = reverse x (n - 1) in\n let rev' x = reverse x (n + n - 1) in\n calc (==) {\n // mod_rev n (a1 +. a2) b;\n rev (rev' (a1 +. a2) %. b);\n == {lemma_add_reverse a1 a2 (n + n - 1)}\n rev ((rev' a1 +. rev' a2) %. b);\n == {lemma_mod_distribute (rev' a1) (rev' a2) b}\n rev (rev' a1 %. b +. rev' a2 %. b);\n == {lemma_add_reverse (rev' a1 %. b) (rev' a2 %. b) (n - 1)}\n rev (rev' a1 %. b) +. rev (rev' a2 %. b);\n // mod_rev n a1 b +. mod_rev n a2 b\n }", "val lemma_mmul_smul (a b m: poly) (n: nat)\n : Lemma (requires degree m >= 0 /\\ degree a < degree m) (ensures smul a b m n == mmul a b m n)\nlet lemma_mmul_smul (a b m:poly) (n:nat) : Lemma\n (requires degree m >= 0 /\\ degree a < degree m)\n (ensures smul a b m n == mmul a b m n)\n =\n lemma_mmul_smul_rec a b m n", "val lemma_i2b_mod (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}) : Lemma\n (b_i2b #n (mod #n a b) == b_mod #n (b_i2b a) b)\nlet lemma_i2b_mod #n a b =\n int2bv_mod #n #a #b #(bvmod #n (int2bv #n a) b) ();\n assert_norm (bvmod #n (int2bv a) b == b_mod #n (b_i2b a) b);\n assert_norm (int2bv #n (mod #n a b) == b_i2b #n (mod #n a b));\n ()", "val lemma_add_cancel (a:poly) : Lemma ((a +. a) == zero)\nlet lemma_add_cancel a = I.lemma_add_cancel (to_poly a)", "val lemma_and (f:G.field) (e1 e2:G.felem f) : Lemma\n (requires True)\n (ensures to_poly (I.logand e1 e2) == (to_poly e1 &. to_poly e2))\n [SMTPat (to_poly (I.logand e1 e2))]\nlet lemma_and f e1 e2 =\n let G.GF t irred = f in\n GI.define_logand t e1 e2;\n PL.lemma_index_all ();\n PL.lemma_reverse_define_all ();\n PL.lemma_and_define_all ();\n lemma_equal (to_poly (I.logand e1 e2)) (to_poly e1 &. to_poly e2)", "val lemma_div_mod_eq_mul_mod: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma ((div_mod a b = c) == (a = mul_mod c b))\nlet lemma_div_mod_eq_mul_mod #m a b c =\n lemma_div_mod_eq_mul_mod1 a b c;\n lemma_div_mod_eq_mul_mod2 a b c", "val lemma_mmul_smul_rec (a b m: poly) (n: nat)\n : Lemma (requires degree m >= 0 /\\ degree a < degree m)\n (ensures\n smul_rec a b m n == (mmul a b m n, shift a n %. m, shift b (- n)) /\\\n mmul a b m n == mmul a b m n %. m)\nlet rec lemma_mmul_smul_rec (a b m:poly) (n:nat) : Lemma\n (requires degree m >= 0 /\\ degree a < degree m)\n (ensures\n smul_rec a b m n == (mmul a b m n, shift a n %. m, shift b (-n)) /\\\n mmul a b m n == mmul a b m n %. m\n )\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n PL.lemma_mod_small a m;\n PL.lemma_mod_small zero m;\n lemma_equal (shift a 0) a;\n let (p0, a0, b0) = smul_rec a b m n in\n if n > 0 then\n (\n let n1 = n - 1 in\n let (p1, a1, b1) = smul_rec a b m n1 in\n lemma_mmul_smul_rec a b m n1;\n PL.lemma_shift_shift b (-n1) (-1);\n PL.lemma_shift_shift a n1 1;\n PL.lemma_shift_mod (shift a n1) m 1;\n PL.lemma_mod_distribute p1 a1 m;\n PL.lemma_mod_mod (shift a n1) m;\n lemma_mod_bit1 (shift a1 1) m;\n //assert ((p1 +. a1) %. m == p1 %. m +. a1 %. m);\n //assert ((p1 +. a1) %. m == p1 %. m +. (shift a n1 %. m));\n //assert ((p1 +. a1) %. m == p1 +. (shift a n1 %. m));\n lemma_add_zero p1;\n ()\n );\n lemma_equal b0 (shift b (-n));\n ()", "val lemma_propagate_mul_mod (a b: nat)\n : Lemma (requires b > 0) (ensures (let open FStar.Mul in (2 * a) % (2 * b) = 2 * (a % b)))\nlet lemma_propagate_mul_mod (a b:nat) : Lemma\n (requires b > 0)\n (ensures (\n let open FStar.Mul in\n (2*a) % (2*b) = 2 * (a % b))) =\n let open FStar.Math.Lemmas in\n let open FStar.Mul in\n lemma_div_mod a b;\n lemma_div_mod (2*a) b;\n let (p,r) = ((a/b)*(2*b), 2*(a%b)) in\n assert (2*a = p + r);\n modulo_distributivity p r (2*b);\n multiple_modulo_lemma (a/b) (2*b);\n modulo_range_lemma a b;\n small_mod r (2*b)", "val lemma_i2b_add (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_add #n a b =\n int2bv_add #n #a #b #(bvadd #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b))", "val lemma_mul_pmul_k_left (a b: poly) (k: int) (n: nat) (n': int)\n : Lemma (requires k + 1 <= n' /\\ n' <= n)\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases (n - n'))\nlet rec lemma_mul_pmul_k_left (a b:poly) (k:int) (n:nat) (n':int) : Lemma\n (requires k + 1 <= n' /\\ n' <= n)\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases (n - n'))\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n if n > n' then lemma_mul_pmul_k_left a b k n (n' + 1)\n else lemma_mul_pmul_k_base a b k n", "val lemma_mul_div_n (#n:pos) (a b:natN n) : Lemma (0 <= (a * b) / n /\\ (a * b) / n < n)\nlet lemma_mul_div_n #n a b =\n let open FStar.Math.Lemmas in\n nat_times_nat_is_nat a b;\n nat_over_pos_is_nat (a * b) n;\n lemma_mul_div_n_lt a b", "val lemma_i2b_sub (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (sub_mod #n a b) == b_sub #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_sub #n a b =\n int2bv_sub #n #a #b #(bvsub #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (sub_mod #n a b) == b_sub #n (b_i2b a) (b_i2b b))", "val lemma_mul_pmul_k_right (a b: poly) (k: int) (n n': nat)\n : Lemma (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases n')\nlet rec lemma_mul_pmul_k_right (a b:poly) (k:int) (n n':nat) : Lemma\n (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases n')\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n if n' > n then lemma_mul_pmul_k_right a b k n (n' - 1)\n else lemma_mul_pmul_k_base a b k n", "val lemma_pow2_div2 (a b c: nat) : Lemma ((a / pow2 b) / pow2 c == a / (pow2 (c + b)))\nlet lemma_pow2_div2 (a:nat) (b:nat) (c:nat)\n : Lemma ((a / pow2 b) / pow2 c == a / (pow2 (c + b)))\n =\n let open FStar.Math.Lemmas in\n pow2_plus b c;\n division_multiplication_lemma a (pow2 b) (pow2 c)", "val lemma_bveq (#n:pos) (a b:bv_t n) : Lemma\n (requires bveq #n a b)\n (ensures a == b)\nlet lemma_bveq #n a b =\n let ia = bv2int a in\n let ib = bv2int b in\n int2bv_logxor #n #ia #ib #(bvxor a b) ();\n int2bv_logxor #n #ia #ia #(bvxor a a) ();\n assert (int2bv #n (logxor #n ia ib) == int2bv #n (logxor #n ia ia));\n assert (bv2int (int2bv #n (logxor #n ia ib)) == logxor #n ia ib);\n assert (bv2int (int2bv #n (logxor #n ia ia)) == logxor #n ia ia);\n assert (logxor #n ia ib == logxor #n ia ia);\n logxor_self ia;\n logxor_neq_nonzero ia ib;\n ()", "val lemma_i2b_div (#n:pos) (a:uint_t n) (b:uint_t n{b <> 0}) : Lemma\n (b_i2b #n (udiv #n a b) == b_div #n (b_i2b a) b)\nlet lemma_i2b_div #n a b =\n int2bv_div #n #a #b #(bvdiv #n (int2bv #n a) b) ();\n assert_norm (b_i2b #n (udiv #n a b) == b_div #n (b_i2b a) b)", "val lemma_gf128_mul_rev_associate (a b c:poly) : Lemma\n (a *~ (b *~ c) == (a *~ b) *~ c)\nlet lemma_gf128_mul_rev_associate a b c =\n let rev x = reverse x 127 in\n let ra = rev a in\n let rb = rev b in\n let rc = rev c in\n let g = gf128_modulus in\n lemma_gf128_degree ();\n calc (==) {\n a *~ (b *~ c);\n == {}\n rev (ra *. (rb *. rc %. g) %. g);\n == {lemma_mod_mul_mod_right ra (rb *. rc) g}\n rev (ra *. (rb *. rc) %. g);\n == {lemma_mul_associate ra rb rc}\n rev ((ra *. rb) *. rc %. g);\n == {lemma_mod_mul_mod (ra *. rb) g rc}\n rev ((ra *. rb %. g) *. rc %. g);\n == {}\n (a *~ b) *~ c;\n }", "val lemma_fmul_fmul (f: G.field) (a b: G.felem f) : Lemma (G.fmul a b == fmul f a b)\nlet lemma_fmul_fmul (f:G.field) (a b:G.felem f) : Lemma\n (G.fmul a b == fmul f a b)\n =\n let repeati = Lib.LoopCombinators.repeati in\n let acc0 = (G.zero #f, a, b) in\n let rec lem (n:nat{n < I.bits f.G.t}) (f1:(i:nat{i < n} -> fmul_t f -> fmul_t f)) : Lemma\n (requires (forall (i:nat{i < n}) (pab:fmul_t f). f1 i pab == fmul_iter f i pab))\n (ensures repeati n (fmul_iter f) acc0 == repeati n f1 acc0)\n [SMTPat (repeati n f1 acc0)]\n =\n if n = 0 then\n (\n let pred (n:nat) (pab:(fmul_t f)) : Type0 = n == 0 ==> pab == acc0 in\n let _ = Lib.LoopCombinators.repeati_inductive' 0 pred (fmul_iter f) acc0 in\n let _ = Lib.LoopCombinators.repeati_inductive' 0 pred f1 acc0 in\n ()\n )\n else\n (\n lem (n - 1) f1;\n Lib.LoopCombinators.unfold_repeati n (fmul_iter f) acc0 (n - 1);\n Lib.LoopCombinators.unfold_repeati n f1 acc0 (n - 1);\n assert (repeati n (fmul_iter f) acc0 == repeati n f1 acc0);\n ()\n )\n in\n ()", "val lemma_div_mod_eq_mul_mod1: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma (div_mod a b = c ==> a = mul_mod c b)\nlet lemma_div_mod_eq_mul_mod1 #m a b c =\n if div_mod a b = c then begin\n assert (mul_mod (div_mod a b) b = mul_mod c b);\n calc (==) {\n mul_mod (div_mod a b) b;\n (==) { lemma_div_mod_prime_one b }\n mul_mod (div_mod a b) (div_mod b 1);\n (==) { lemma_div_mod_prime_to_one_denominator a b b 1 }\n div_mod (mul_mod a b) (mul_mod b 1);\n (==) { lemma_div_mod_prime_cancel a 1 b }\n div_mod a 1;\n (==) { lemma_div_mod_prime_one a }\n a;\n } end\n else ()", "val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :\n Lemma\n (let sum0 = a0 * b0 in\n let sum1 = a0 * b1 + a1 * b0 in\n let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in\n let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in\n let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in\n let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in\n let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in\n let sum7 = a3 * b4 + a4 * b3 in\n let sum8 = a4 * b4 in\n (a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *\n (b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +\n pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156))\nlet lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =\n let sum0 = a0 * b0 in\n let sum1 = a0 * b1 + a1 * b0 in\n let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in\n let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in\n let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in\n let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in\n let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in\n let sum7 = a3 * b4 + a4 * b3 in\n let sum8 = a4 * b4 in\n\n let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in\n calc (==) {\n (a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;\n (==) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }\n a0 * b_sum + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }\n sum0 + sum1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + a1 * b4 * pow2 260\n + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260\n + a2 * b4 * pow2 312\n + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260 + sum6 * pow2 312 + a3 * b4 * pow2 364 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260 + sum6 * pow2 312 + sum7 * pow2 364 + sum8 * pow2 416;\n (==) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);\n }", "val lemma_part_bound2 (a: nat) (b c: pos) : Lemma (0 < b * c /\\ (a % b) % (b * c) < b)\nlet lemma_part_bound2 (a : nat) (b c: pos) :\n Lemma(0 < b*c /\\ (a%b)%(b*c) < b) =\n pos_times_pos_is_pos b c;\n lemma_mod_lt a b; // a%b < b\n assert (0 <= a%b);\n lemma_mul_increases c b; // b <= b * c\n assert (a%b < b);\n lemma_lt_le_trans (a%b) b (b*c);\n assert (a%b < b * c);\n modulo_lemma (a%b) (b*c)", "val lemma_iand_nth (n:pos) (x y:natN (pow2 n)) : Lemma\n (forall (m:_{m==pow2_norm n}) (i:nat{i < n}).{:pattern (nth #n (iand #m x y) i)}\n nth #n (iand #m x y) i == (nth #n x i && nth #n y i))\nlet lemma_iand_nth n x y =\n FStar.Classical.forall_intro (lemma_iand_nth_i n x y)", "val lemma_mul_commute (#f:G.field) (a b:G.felem f) : Lemma\n (fmul a b == fmul b a)\nlet lemma_mul_commute #f a b =\n let pa = to_poly a in\n let pb = to_poly b in\n let m = irred_poly f in\n lemma_mul_commute pa pb;\n lemma_eq_to_poly (fmul a b) (fmul b a)", "val lemma_a_mod_52_mul_b (a b:nat) :\n Lemma ((a % pow2 52) * pow2 b = a * pow2 b - a / pow2 52 * pow2 (b + 52))\nlet lemma_a_mod_52_mul_b a b =\n calc (==) {\n (a % pow2 52) * pow2 b;\n (==) { Math.Lemmas.euclidean_division_definition a (pow2 52) }\n (a - a / pow2 52 * pow2 52) * pow2 b;\n (==) { Math.Lemmas.distributivity_sub_left a (a / pow2 52 * pow2 52) (pow2 b) }\n a * pow2 b - a / pow2 52 * pow2 52 * pow2 b;\n (==) { Math.Lemmas.paren_mul_right (a / pow2 52) (pow2 52) (pow2 b); Math.Lemmas.pow2_plus 52 b }\n a * pow2 b - a / pow2 52 * pow2 (52 + b);\n }", "val lemma_mul_distribute_left (#f:G.field) (a b c:G.felem f) : Lemma\n (fmul (fadd a b) c == fadd (fmul a c) (fmul b c))\nlet lemma_mul_distribute_left #f a b c =\n let pa = to_poly a in\n let pb = to_poly b in\n let pc = to_poly c in\n let m = irred_poly f in\n PL.lemma_mul_distribute_left pa pb pc;\n PL.lemma_mod_distribute (pa *. pc) (pb *. pc) m;\n lemma_eq_to_poly (fmul (fadd a b) c) (fadd (fmul a c) (fmul b c))", "val lemma_div_mod_eq_mul_mod2: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma (a = mul_mod c b ==> div_mod a b = c)\nlet lemma_div_mod_eq_mul_mod2 #m a b c =\n if a = mul_mod c b then begin\n assert (div_mod a b == div_mod (mul_mod c b) b);\n calc (==) {\n div_mod (mul_mod c b) b;\n (==) { Math.Lemmas.small_mod b m }\n div_mod (mul_mod c b) (mul_mod b 1);\n (==) { lemma_div_mod_prime_cancel c 1 b }\n div_mod c 1;\n (==) { lemma_div_mod_prime_one c }\n c;\n } end\n else ()", "val lemma_sum_a1b\n (a0 a1:nat64)\n (a0b:nat) (a0b_0 a0b_1 a0b_2 a0b_3 a0b_4:nat64)\n (a1b:nat) (a1b_0 a1b_1 a1b_2 a1b_3 a1b_4:nat64)\n (b:nat) (b0 b1 b2 b3:nat64)\n (s1 s2 s3 s4 s5\n c:nat64) : Lemma\n (requires a0b = pow2_five a0b_0 a0b_1 a0b_2 a0b_3 a0b_4 /\\\n a1b = pow2_five a1b_0 a1b_1 a1b_2 a1b_3 a1b_4 /\\\n b = pow2_four b0 b1 b2 b3 /\\\n a0b = mul_nats a0 b /\\\n a1b = mul_nats a1 b /\\\n (let s1', c1 = add_carry a0b_1 a1b_0 0 in\n let s2', c2 = add_carry a0b_2 a1b_1 c1 in\n let s3', c3 = add_carry a0b_3 a1b_2 c2 in\n let s4', c4 = add_carry a0b_4 a1b_3 c3 in\n let s5', c5 = add_carry 0 a1b_4 c4 in\n s1 == s1' /\\\n s2 == s2' /\\\n s3 == s3' /\\\n s4 == s4' /\\\n s5 == s5' /\\\n c5 == c))\n (ensures (pow2_two a0 a1) * b ==\n pow2_seven a0b_0 s1 s2 s3 s4 s5 c)\nlet lemma_sum_a1b\n (a0 a1:nat64)\n (a0b:nat) (a0b_0 a0b_1 a0b_2 a0b_3 a0b_4:nat64)\n (a1b:nat) (a1b_0 a1b_1 a1b_2 a1b_3 a1b_4:nat64)\n (b:nat) (b0 b1 b2 b3:nat64)\n (s1 s2 s3 s4 s5\n c:nat64) : Lemma\n (requires a0b = pow2_five a0b_0 a0b_1 a0b_2 a0b_3 a0b_4 /\\\n a1b = pow2_five a1b_0 a1b_1 a1b_2 a1b_3 a1b_4 /\\\n b = pow2_four b0 b1 b2 b3 /\\\n a0b = mul_nats a0 b /\\\n a1b = mul_nats a1 b /\\\n (let s1', c1 = add_carry a0b_1 a1b_0 0 in\n let s2', c2 = add_carry a0b_2 a1b_1 c1 in\n let s3', c3 = add_carry a0b_3 a1b_2 c2 in\n let s4', c4 = add_carry a0b_4 a1b_3 c3 in\n let s5', c5 = add_carry 0 a1b_4 c4 in\n s1 == s1' /\\\n s2 == s2' /\\\n s3 == s3' /\\\n s4 == s4' /\\\n s5 == s5' /\\\n c5 == c))\n (ensures (pow2_two a0 a1) * b ==\n pow2_seven a0b_0 s1 s2 s3 s4 s5 c)\n =\n assert_by_tactic (\n (pow2_two a0 a1) * b ==\n pow2_two (mul_nats a0 b) (mul_nats a1 b)) int_canon;\n assert (\n pow2_two (mul_nats a0 b) (mul_nats a1 b) ==\n pow2_two a0b a1b);\n lemma_offset_sum a0b a0b_0 a0b_1 a0b_2 a0b_3 a0b_4\n a1b a1b_0 a1b_1 a1b_2 a1b_3 a1b_4;\n assert (\n pow2_two a0b a1b ==\n pow2_six a0b_0 (a0b_1 + a1b_0) (a0b_2 + a1b_1) (a0b_3 + a1b_2) (a0b_4 + a1b_3) a1b_4);\n lemma_partial_sum a0b_0 a0b_1 a0b_2 a0b_3 a0b_4\n a1b_0 a1b_1 a1b_2 a1b_3 a1b_4\n s1 s2 s3 s4 s5 c;\n ()", "val lemma_div_mod_prime_is_zero: #m:prime{2 < m} -> a:nat_mod m -> b:nat_mod m ->\n Lemma ((div_mod a b = 0) <==> (a = 0 || b = 0))\nlet lemma_div_mod_prime_is_zero #m a b =\n Classical.move_requires_2 lemma_div_mod_is_zero1 a b;\n Classical.move_requires_2 lemma_div_mod_prime_is_zero2 a b", "val logand_pos_le: #n:pos{1 < n} -> a:int_t n{0 <= a} -> b:int_t n{0 <= b} ->\n Lemma (0 <= logand a b /\\ logand a b <= a /\\ logand a b <= b)\nlet logand_pos_le #n a b =\n UInt.logand_le (to_uint a) (to_uint b)", "val lemma_mul_n_bound (#n:nat) (a b:natN n) : Lemma (0 <= a * b /\\ a * b <= (n - 1) * (n - 1))\nlet lemma_mul_n_bound #n a b =\n lemma_mul_nat_bound a (n - 1) b (n - 1)", "val lemma_mul_pmul_k_base (a b: poly) (k: int) (n: nat)\n : Lemma (requires True)\n (ensures sum_of_bools 0 n (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases n)\nlet rec lemma_mul_pmul_k_base (a b:poly) (k:int) (n:nat) : Lemma\n (requires True)\n (ensures sum_of_bools 0 n (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases n)\n =\n PL.lemma_index_all ();\n PL.lemma_add_define_all ();\n PL.lemma_shift_define_all ();\n if n > 0 then lemma_mul_pmul_k_base a b k (n - 1)" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_equal" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Words.fst", "name": "Vale.Math.Poly2.Words.lemma_and128" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_def" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Words.fst", "name": "Vale.Math.Poly2.Words.lemma_and_quad32" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_poly_equal_elim" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.mul_def" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_div_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_eq_to_poly" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fsti", "name": "Vale.AES.GHash_BE.lemma_add_mul_zero_low" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_div_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_cancel_eq" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Bits.fst", "name": "Vale.Math.Poly2.Bits.of_nat32_and" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fsti", "name": "Vale.AES.GHash_BE.lemma_add_mul_zero_high" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_element" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_and" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_one" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs_s.fst", "name": "Vale.Math.Poly2.Defs_s.add" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Words.fst", "name": "Vale.Math.Poly2.Words.lemma_add128" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_element" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fst", "name": "Vale.Bignum.Defs.lemma_mul_nat_bound" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.poly_and" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_one" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_pointwise_equal" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_element_rec" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_reverse" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_add_move" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_reverse" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs_s.fst", "name": "Vale.Math.Poly2.Defs_s.mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_pmul" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fst", "name": "Vale.AES.GHash_BE.lemma_div_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_distribute_left" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_div_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_pmul_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_zero" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.lemma_vsel32" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_zero" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_or" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.constr" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_Mul128" }, { "project_name": "FStar", "file_name": "FStar.BitVector.fst", "name": "FStar.BitVector.logand_vec_definition" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_mul" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mul_mod_prime_zero" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_zero" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_nth_all" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Lemmas.fst", "name": "Hacl.Spec.BignumQ.Lemmas.lemma_aux_0" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mod_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_div_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.Math.fst", "name": "Vale.Poly1305.Math.lemma_part_bound1" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mod_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_pmul_rec" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.lemma_eq_maj_xvsel32" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr5" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_eq" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_distribute_left" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Seqs.fst", "name": "Vale.Lib.Seqs.lemma_all_but_last_append" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_add_mod_rev" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_smul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_cancel" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_and" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_smul_rec" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_propagate_mul_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_add" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_left" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fst", "name": "Vale.Bignum.Defs.lemma_mul_div_n" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_sub" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_right" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_pow2_div2" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_bveq" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_div" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_fmul_fmul" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod1" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Lemmas4.fst", "name": "Hacl.Spec.K256.Field52.Lemmas4.lemma_mul_ab" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.Math.fst", "name": "Vale.Poly1305.Math.lemma_part_bound2" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_nth" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_a_mod_52_mul_b" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_distribute_left" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod2" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.FastMul_helpers.fst", "name": "Vale.Curve25519.FastMul_helpers.lemma_sum_a1b" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_prime_is_zero" }, { "project_name": "FStar", "file_name": "FStar.Int.fst", "name": "FStar.Int.logand_pos_le" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fst", "name": "Vale.Bignum.Defs.lemma_mul_n_bound" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_base" } ], "selected_premises": [ "Vale.Math.Poly2.Lemmas.lemma_index", "Vale.Math.Poly2.Lemmas.lemma_index_all", "Vale.Math.Poly2.Lemmas.lemma_shift_define_forward", "Vale.Math.Poly2.Lemmas.lemma_pointwise_equal", "Vale.Math.Poly2.Lemmas.lemma_shift_define", "Vale.Math.Poly2.Lemmas.lemma_shift_define_all", "Vale.Math.Poly2.Lemmas.lemma_one_define", "Vale.Math.Poly2.Lemmas.lemma_ones_define", "Vale.Math.Poly2.Lemmas.lemma_monomial_define", "Vale.Math.Poly2.Lemmas.lemma_zero_define", "Vale.Math.Poly2.Lemmas.lemma_monomial_define_all", "Vale.Math.Poly2.Lemmas.lemma_ones_define_all", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Pervasives.reveal_opaque", "FStar.Mul.op_Star", "FStar.Heap.trivial_preorder", "FStar.ST.op_Bang", "FStar.Pervasives.dfst", "FStar.ST.alloc", "FStar.Pervasives.dsnd", "FStar.List.map", "FStar.List.for_all", "FStar.All.op_Bar_Greater", "FStar.Set.subset", "FStar.List.mapT", "FStar.Monotonic.Heap.set", "Prims.auto_squash", "FStar.Calc.calc_chain_related", "FStar.List.fold_left", "FStar.All.op_Less_Bar", "FStar.List.iter", "FStar.Heap.trivial_rel", "FStar.Preorder.preorder_rel", "FStar.Set.add", "FStar.Pervasives.id", "FStar.Pervasives.coerce_eq", "FStar.TSet.subset", "FStar.Monotonic.Heap.mref", "FStar.Set.remove", "FStar.Monotonic.Heap.tset", "FStar.List.zip", "FStar.Math.Lib.div_non_eucl_decr_lemma", "FStar.Set.disjoint", "FStar.Pervasives.all_post_h'", "Prims.l_False", "Prims.subtype_of", "FStar.Pervasives.all_post_h", "FStar.All.all_pre", "FStar.Set.as_set'", "Prims.min", "Prims.l_True", "Prims.as_requires", "FStar.Preorder.reflexive", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.pure_bind_wp", "FStar.List.fold_right", "FStar.ST.lemma_functoriality", "FStar.List.forall2", "FStar.Pervasives.pure_close_wp", "FStar.Preorder.transitive", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.pure_null_wp", "FStar.All.all_wp", "Prims.pure_trivial", "FStar.Math.Lib.slash_decr_axiom", "FStar.Pervasives.ex_pre", "FStar.Set.as_set", "FStar.Pervasives.all_trivial", "FStar.Pervasives.all_stronger", "FStar.List.tl", "FStar.Pervasives.all_close_wp", "FStar.Math.Lib.signed_modulo", "FStar.Pervasives.div_hoare_to_wp", "FStar.All.all_post'", "FStar.All.all_post", "Prims.purewp_id", "FStar.ST.lift_gst_state", "Prims.pure_stronger", "FStar.List.filter", "FStar.ST.contains_pred", "FStar.List.filter_map", "FStar.List.tryFind", "FStar.List.partition", "FStar.Pervasives.st_post_h", "FStar.Preorder.stable", "FStar.List.concatMap", "Prims.as_ensures", "Prims.pure_wp_monotonic0", "FStar.List.choose", "FStar.Calc.calc_chain_compatible", "FStar.Pervasives.all_if_then_else", "FStar.Math.Lib.powx", "FStar.All.pipe_left", "Prims.pure_post'", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.ex_trivial" ], "source_upto_this": "module Vale.Math.Poly2.Lemmas\nopen FStar.Mul\n\nlet lemma_pointwise_equal a b pf =\n FStar.Classical.forall_intro pf;\n lemma_equal a b\n\nlet lemma_index a =\n FStar.Classical.forall_intro (lemma_index_i a)\n\nlet lemma_index_all () =\n FStar.Classical.forall_intro_2 lemma_index_i\n\nlet lemma_zero_define () =\n FStar.Classical.forall_intro lemma_zero_define_i\n\nlet lemma_one_define () =\n FStar.Classical.forall_intro lemma_one_define_i\n\nlet lemma_monomial_define n =\n FStar.Classical.forall_intro (lemma_monomial_define_i n)\n\nlet lemma_monomial_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> monomial n) lemma_monomial_define\n\nlet lemma_ones_define n =\n FStar.Classical.forall_intro (lemma_ones_define_i n)\n\nlet lemma_ones_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> ones n) lemma_ones_define\n\nlet lemma_shift_define p n =\n FStar.Classical.forall_intro (lemma_shift_define_i p n)\n\nlet lemma_shift_define_forward p n =\n lemma_shift_define p n\n\nlet lemma_shift_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> shift p n) lemma_shift_define\n", "sketch": [ "To prove the lemma `lemma_and_define`, we will first introduce the universal quantifier over the index `i` using `FStar.Classical.forall_intro`. Then, we will apply the lemma `lemma_pointwise_equal` to show that for all indices `i`, the pointwise equality holds between `(poly_and a b).[i]` and `(a.[i] && b.[i])`.", "To prove the lemma `lemma_and_define`, we will first introduce the universal quantifier over the index `i` using `FStar.Classical.forall_intro`. Then, we will use the pattern `{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]}` to specify the pattern for the lemma. Finally, we will show that `(poly_and a b).[i]` is equal to `(a.[i] && b.[i])` using the equality assertion.\n\n```fstar\nFStar.Classical.forall_intro (fun i ->\n FStar.Assert.let_pattern (poly_and a b).[i] (a.[i] && b.[i])\n)\n```" ], "generated_solution": [ "let lemma_and_define (a b:poly) : Lemma\n FStar.Classical.forall_intro (fun i -> lemma_pointwise_equal (poly_and a b).[i] (a.[i] && b.[i]))" ] }, { "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_union", "opens_and_abbrevs": [ { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c)", "source_definition": "let loc_union #al #c s1 s2 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let regions = Set.union regions1 regions2 in\n let region_liveness_tags : Ghost.erased (Set.set HS.rid) = (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1)) (Ghost.reveal (Loc?.region_liveness_tags s2)))) in\n let gregions = Ghost.hide regions in\n let non_live_addrs =\n F.on_dom_g (addrs_dom gregions) #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\n in\n let live_addrs =\n F.on_dom_g (addrs_dom gregions) #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\n in\n let aux = Ghost.hide\n (Ghost.reveal (Loc?.aux s1) `GSet.union` Ghost.reveal (Loc?.aux s2))\n in\n Loc\n (Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux", "source_range": { "start_line": 163, "start_col": 0, "end_line": 191, "end_col": 7 }, "interleaved": false, "definition": "fun s1 s2 ->\n let regions1 = FStar.Ghost.reveal (Loc?.regions s1) in\n let regions2 = FStar.Ghost.reveal (Loc?.regions s2) in\n let regions = FStar.Set.union regions1 regions2 in\n let region_liveness_tags =\n FStar.Ghost.hide (FStar.Set.union (FStar.Ghost.reveal (Loc?.region_liveness_tags s1))\n (FStar.Ghost.reveal (Loc?.region_liveness_tags s2)))\n in\n let gregions = FStar.Ghost.hide regions in\n let non_live_addrs =\n FStar.FunctionalExtensionality.on_dom_g (FStar.ModifiesGen.addrs_dom gregions)\n (fun r ->\n FStar.GSet.union ((match FStar.Set.mem r regions1 with\n | true -> Loc?.non_live_addrs s1 r\n | _ -> FStar.GSet.empty)\n <:\n FStar.GSet.set Prims.nat)\n ((match FStar.Set.mem r regions2 with\n | true -> Loc?.non_live_addrs s2 r\n | _ -> FStar.GSet.empty)\n <:\n FStar.GSet.set Prims.nat))\n in\n let live_addrs =\n FStar.FunctionalExtensionality.on_dom_g (FStar.ModifiesGen.addrs_dom gregions)\n (fun r ->\n FStar.GSet.union ((match FStar.Set.mem r regions1 with\n | true -> FStar.ModifiesGen.addrs_of_loc_weak s1 r\n | _ -> FStar.GSet.empty)\n <:\n FStar.GSet.set Prims.nat)\n ((match FStar.Set.mem r regions2 with\n | true -> FStar.ModifiesGen.addrs_of_loc_weak s2 r\n | _ -> FStar.GSet.empty)\n <:\n FStar.GSet.set Prims.nat))\n in\n let aux =\n FStar.Ghost.hide (FStar.GSet.union (FStar.Ghost.reveal (Loc?.aux s1))\n (FStar.Ghost.reveal (Loc?.aux s2)))\n in\n FStar.ModifiesGen.Loc (FStar.Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "FStar.ModifiesGen.aloc_t", "FStar.ModifiesGen.cls", "FStar.ModifiesGen.loc", "FStar.ModifiesGen.Loc", "FStar.Ghost.hide", "FStar.Set.set", "FStar.Monotonic.HyperHeap.rid", "FStar.Ghost.erased", "FStar.GSet.set", "FStar.ModifiesGen.aloc", "FStar.GSet.union", "FStar.Ghost.reveal", "FStar.ModifiesGen.__proj__Loc__item__aux", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.ModifiesGen.addrs_dom", "FStar.ModifiesGen.live_addrs_codom", "FStar.FunctionalExtensionality.on_dom_g", "Prims.nat", "FStar.Set.mem", "FStar.ModifiesGen.addrs_of_loc_weak", "Prims.bool", "FStar.GSet.empty", "FStar.ModifiesGen.non_live_addrs_codom", "FStar.ModifiesGen.__proj__Loc__item__non_live_addrs", "FStar.Set.union", "FStar.ModifiesGen.__proj__Loc__item__region_liveness_tags", "FStar.ModifiesGen.__proj__Loc__item__regions" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "s1: FStar.ModifiesGen.loc c -> s2: FStar.ModifiesGen.loc c -> Prims.GTot (FStar.ModifiesGen.loc c)", "prompt": "let loc_union #al #c s1 s2 =\n ", "expected_response": "let regions1 = Ghost.reveal (Loc?.regions s1) in\nlet regions2 = Ghost.reveal (Loc?.regions s2) in\nlet regions = Set.union regions1 regions2 in\nlet region_liveness_tags:Ghost.erased (Set.set HS.rid) =\n (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1))\n (Ghost.reveal (Loc?.region_liveness_tags s2))))\nin\nlet gregions = Ghost.hide regions in\nlet non_live_addrs =\n F.on_dom_g (addrs_dom gregions)\n #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\nin\nlet live_addrs =\n F.on_dom_g (addrs_dom gregions)\n #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\nin\nlet aux = Ghost.hide ((Ghost.reveal (Loc?.aux s1)) `GSet.union` (Ghost.reveal (Loc?.aux s2))) in\nLoc (Ghost.hide regions) region_liveness_tags non_live_addrs live_addrs aux", "source": { "project_name": "FStar", "file_name": "ulib/FStar.ModifiesGen.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.ModifiesGen.fst", "checked_file": "dataset/FStar.ModifiesGen.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Tactics.SMT.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.GSet.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "aloc", "ALoc", "ALoc", "ALoc", "aloc_t", "region", "region", "addr", "addr", "loc", "loc", "cls", "Cls", "Cls", "Cls", "aloc_includes", "aloc_includes", "let aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))", "aloc_includes_refl", "aloc_includes_refl", "let i_restricted_g_t = F.restricted_g_t", "let addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )", "let non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })", "aloc_includes_trans", "aloc_includes_trans", "let live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )", "aloc_disjoint", "aloc_disjoint", "loc'", "Loc", "Loc", "Loc", "regions", "regions", "aloc_disjoint_sym", "aloc_disjoint_sym", "region_liveness_tags", "region_liveness_tags", "non_live_addrs", "non_live_addrs", "live_addrs", "live_addrs", "aloc_disjoint_includes", "aloc_disjoint_includes", "aux", "aux", "let loc = loc'", "let mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f", "aloc_preserved", "aloc_preserved", "let mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f", "aloc_preserved_refl", "aloc_preserved_refl", "let loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)", "aloc_preserved_trans", "aloc_preserved_trans", "let regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)", "let addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty", "same_mreference_aloc_preserved", "same_mreference_aloc_preserved", "let addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty", "let addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)", "val loc (#aloc: aloc_t u#x) (c: cls aloc) : Tot (Type u#x)", "val loc_none (#aloc: aloc_t) (#c: cls aloc): Tot (loc c)", "val loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c)", "let addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))", "val loc_union_idem\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union s s == s)", "let addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)", "val loc_union_comm\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: Lemma\n (loc_union s1 s2 == loc_union s2 s1)", "let addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()", "val loc_union_assoc\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s3: loc c)\n: Lemma\n (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)", "val loc_union_loc_none_l\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union loc_none s == s)" ], "closest": [ "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_union (s1 s2:loc) : GTot loc\nlet loc_union = M.loc_union", "val loc_union (s1 s2:loc) : GTot loc\nlet loc_union = M.loc_union", "val loc_mreference\n (#aloc: aloc_t)\n (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n : GTot (loc c)\nlet loc_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses true (HS.frameOf b) (Set.singleton (HS.as_addr b))", "val loc_region_only (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_region_only\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (Set.singleton r)", "val loc_freed_mreference\n (#aloc: aloc_t)\n (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n : GTot (loc c)\nlet loc_freed_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses false (HS.frameOf b) (Set.singleton (HS.as_addr b))", "val loc_all_regions_from (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_all_regions_from\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (HS.mod_set (Set.singleton r))", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_union_assoc\n (s1 s2 s3: loc)\n: Lemma\n (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)\nlet loc_union_assoc = MG.loc_union_assoc", "val loc_union_assoc\n (s1 s2 s3: loc)\n: Lemma\n (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)\nlet loc_union_assoc = MG.loc_union_assoc", "val old_to_union_loc (l: OldM.loc) : GTot (M.loc old_and_new_cl_union)\nlet old_to_union_loc (l: OldM.loc) : GTot (M.loc old_and_new_cl_union) =\n M.union_loc_of_loc old_and_new_cl false (OldM.cloc_of_loc l)", "val union (l1 l2: B.loc) : GTot B.loc\nlet union (l1:B.loc) (l2:B.loc) : GTot B.loc = B.loc_union l1 l2", "val loc_regions\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions false", "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_pointer\n (#t: typ)\n (p: pointer t)\n: GTot loc\nlet loc_pointer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p)", "val loc_union_comm\n (s1 s2: loc)\n: Lemma\n (loc_union s1 s2 == loc_union s2 s1)\n [SMTPat (loc_union s1 s2)]\nlet loc_union_comm = MG.loc_union_comm", "val loc_union_comm\n (s1 s2: loc)\n: Lemma\n (loc_union s1 s2 == loc_union s2 s1)\n [SMTPat (loc_union s1 s2)]\nlet loc_union_comm = MG.loc_union_comm", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l = MG.loc_includes_union_l", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val new_to_union_loc (l: NewM.loc) : GTot (M.loc old_and_new_cl_union)\nlet new_to_union_loc (l: NewM.loc) : GTot (M.loc old_and_new_cl_union) =\n M.union_loc_of_loc old_and_new_cl true (M.raise_loc (NewM.cloc_of_loc l))", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\nlet loc_includes_union_r = MG.loc_includes_union_r", "val Vale.PPC64LE.Decls.loc_union = s1: Vale.PPC64LE.Memory.loc -> s2: Vale.PPC64LE.Memory.loc -> Prims.GTot Vale.PPC64LE.Memory.loc\nlet loc_union = M.loc_union", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val loc_disjoint_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\nlet loc_disjoint_union_r = MG.loc_disjoint_union_r", "val loc_disjoint_union_l\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s1 s /\\ loc_disjoint s2 s))\n (ensures (loc_disjoint (loc_union s1 s2) s))\n [SMTPat (loc_disjoint (loc_union s1 s2) s)]\nlet loc_disjoint_union_l s s1 s2 =\n loc_disjoint_sym s1 s;\n loc_disjoint_sym s2 s;\n loc_disjoint_union_r s s1 s2;\n loc_disjoint_sym s (loc_union s1 s2)", "val loc_union_idem_2 (s1 s2: loc)\n : Lemma (loc_union (loc_union s1 s2) s2 == loc_union s1 s2)\n [SMTPat (loc_union (loc_union s1 s2) s2)]\nlet loc_union_idem_2\n (s1 s2: loc)\n: Lemma\n (loc_union (loc_union s1 s2) s2 == loc_union s1 s2)\n [SMTPat (loc_union (loc_union s1 s2) s2)]\n= loc_union_assoc s1 s2 s2", "val loc_disjoint_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\nlet loc_disjoint_union_r = MG.loc_disjoint_union_r", "val loc_disjoint_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\nlet loc_disjoint_union_r = MG.loc_disjoint_union_r", "val loc_includes_union_assoc_r2l\n (s1 s2 s3 s: loc)\n: Lemma\n (requires (loc_includes (loc_union s1 (loc_union s2 s3)) s))\n (ensures (loc_includes (loc_union (loc_union s1 s2) s3) s))\n [SMTPat (loc_includes (loc_union (loc_union s1 s2) s3) s)]\nlet loc_includes_union_assoc_r2l s1 s2 s3 s =\n loc_includes_trans (loc_union (loc_union s1 s2) s3) (loc_union s1 (loc_union s2 s3)) s", "val rset_union (s1 s2: rset) : GTot rset\nlet rset_union (s1:rset) (s2:rset): GTot rset = let r = (Set.union s1 s2) in r", "val loc_includes_union_assoc_l2r\n (s1 s2 s3 s: loc)\n: Lemma\n (requires (loc_includes (loc_union (loc_union s1 s2) s3) s))\n (ensures (loc_includes (loc_union s1 (loc_union s2 s3)) s))\n [SMTPat (loc_includes (loc_union s1 (loc_union s2 s3)) s)]\nlet loc_includes_union_assoc_l2r s1 s2 s3 s =\n loc_includes_trans (loc_union s1 (loc_union s2 s3)) (loc_union (loc_union s1 s2) s3) s", "val loc_union_idem\n (s: loc)\n: Lemma\n (loc_union s s == s)\n [SMTPat (loc_union s s)]\nlet loc_union_idem = MG.loc_union_idem", "val loc_union_idem\n (s: loc)\n: Lemma\n (loc_union s s == s)\n [SMTPat (loc_union s s)]\nlet loc_union_idem = MG.loc_union_idem", "val loc_union_idem\n (s: loc)\n: Lemma\n (loc_union s s == s)\n [SMTPat (loc_union s s)]\nlet loc_union_idem = MG.loc_union_idem", "val as_loc (x: eloc) : GTot B.loc\nlet as_loc (x:eloc) : GTot B.loc = Ghost.reveal x", "val loc_includes_union_l (s1 s2 s:loc) : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s", "val loc_includes_union_l (s1 s2 s:loc) : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s", "val union_assoc (#a:eqtype) (#f:cmp a) (s1 s2 s3: mset a f)\n : Lemma (union (union s1 s2) s3 == union s1 (union s2 s3))\nlet union_assoc #a #_ s1 s2 s3 =\n let aux (x:a)\n : Lemma (mem x (union (union s1 s2) s3) == mem x (union s1 (union s2 s3)))\n = union_mem_aux (union s1 s2) s3 x;\n union_mem_aux s1 s2 x;\n union_mem_aux s1 (union s2 s3) x;\n union_mem_aux s2 s3 x\n in\n Classical.forall_intro aux;\n eq_intro_aux (union (union s1 s2) s3) (union s1 (union s2 s3))", "val Vale.X64.Decls.loc_union = s1: Vale.X64.Memory.loc -> s2: Vale.X64.Memory.loc -> Prims.GTot Vale.X64.Memory.loc\nlet loc_union = M.loc_union", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l = MG.loc_includes_union_l", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l = MG.loc_includes_union_l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l =\n assert_norm (MG.cls abuffer == MG.cls ubuffer);\n coerce (MG.loc cloc_cls) l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r = MG.loc_includes_union_r", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r = MG.loc_includes_union_r", "val loc_union_idem_1 (s1 s2: loc)\n : Lemma (loc_union s1 (loc_union s1 s2) == loc_union s1 s2)\n [SMTPat (loc_union s1 (loc_union s1 s2))]\nlet loc_union_idem_1\n (s1 s2: loc)\n: Lemma\n (loc_union s1 (loc_union s1 s2) == loc_union s1 s2)\n [SMTPat (loc_union s1 (loc_union s1 s2))]\n= loc_union_assoc s1 s1 s2", "val loc_buffer\n (#t: typ)\n (b: buffer t)\n: GTot loc\nlet loc_buffer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf_buffer p) #(buffer_as_addr p) (LocBuffer p)", "val loc_includes_union_r' (s s1 s2: loc)\n : Lemma (loc_includes s (loc_union s1 s2) <==> (loc_includes s s1 /\\ loc_includes s s2))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r'\n (s s1 s2: loc)\n: Lemma\n (loc_includes s (loc_union s1 s2) <==> (loc_includes s s1 /\\ loc_includes s s2))\n [SMTPat (loc_includes s (loc_union s1 s2))]\n= Classical.move_requires (loc_includes_union_r s s1) s2;\n Classical.move_requires (loc_includes_union_l s1 s2) s1;\n Classical.move_requires (loc_includes_union_l s1 s2) s2;\n Classical.move_requires (loc_includes_trans s (loc_union s1 s2)) s1;\n Classical.move_requires (loc_includes_trans s (loc_union s1 s2)) s2", "val union_mem (#a:eqtype) (#f:cmp a) (s1 s2:mset a f) (x:a)\n : Lemma (mem x (union s1 s2) == mem x s1 + mem x s2)\nlet union_mem = union_mem_aux", "val union_comm (#a:eqtype) (#f:cmp a) (s1 s2:mset a f)\n : Lemma (union s1 s2 == union s2 s1)\nlet union_comm #_ #_ s1 s2 =\n Classical.forall_intro (union_mem_aux s1 s2);\n Classical.forall_intro (union_mem_aux s2 s1);\n eq_intro_aux (union s1 s2) (union s2 s1)", "val upd\n (#a: Type)\n (#rel: preorder a)\n (m: mem)\n (s: mreference a rel {live_region m (frameOf s)})\n (v: a)\n : GTot mem\nlet upd (#a:Type) (#rel:preorder a) (m:mem) (s:mreference a rel{live_region m (frameOf s)}) (v:a)\n :GTot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf s in\n let h = Map.upd h i (Heap.upd (Map.sel h i) (as_ref s) v) in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val s_v (#a: alg) (#m: m_spec) (h: HS.mem) (s: s a m) : GTot (t a)\nlet s_v (#a : alg) (#m : m_spec) (h : HS.mem) (s : s a m) : GTot (t a) =\n state_v h s", "val loc_disjoint_union_r' (s s1 s2: loc)\n : Lemma\n (ensures (loc_disjoint s (loc_union s1 s2) <==> (loc_disjoint s s1 /\\ loc_disjoint s s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\nlet loc_disjoint_union_r'\n (s s1 s2: loc)\n: Lemma\n (ensures (loc_disjoint s (loc_union s1 s2) <==> (loc_disjoint s s1 /\\ loc_disjoint s s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\n= Classical.move_requires (loc_disjoint_union_r s s1) s2;\n loc_includes_union_l s1 s2 s1;\n loc_includes_union_l s1 s2 s2;\n Classical.move_requires (loc_disjoint_includes s (loc_union s1 s2) s) s1;\n Classical.move_requires (loc_disjoint_includes s (loc_union s1 s2) s) s2", "val loc (#t: buftype) (#a: Type0) (b: buffer_t t a) : GTot B.loc\nlet loc (#t:buftype) (#a:Type0) (b:buffer_t t a) : GTot B.loc =\n match t with\n | MUT -> B.loc_buffer (b <: buffer a)\n | IMMUT -> B.loc_buffer (b <: ibuffer a)\n | CONST -> CB.loc_buffer (b <: cbuffer a)", "val includes\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n : GTot Type0\nlet includes (#a1 #a2:Type0) (#rrel1 #rel1:srel a1) (#rrel2 #rel2:srel a2)\n (b1:mbuffer a1 rrel1 rel1) (b2:mbuffer a2 rrel2 rel2) :GTot Type0 =\n loc_includes (loc_buffer b1) (loc_buffer b2) /\\\n (g_is_null b1 <==> g_is_null b2)", "val union (#a: eqtype) (s1: set a) (s2: set a)\n : (set a)\nlet union (#a: eqtype) (s1: set a) (s2: set a) : (set a) =\n intro_set (on_dom a (fun x -> s1 x || s2 x)) (union_lists (set_as_list s1) (set_as_list s2))", "val loc_includes_union_r (s s1 s2:loc) : Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2", "val loc_includes_union_r (s s1 s2:loc) : Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2", "val loc_disjoint (s1 s2:loc) : GTot prop0\nlet loc_disjoint = M.loc_disjoint", "val loc_disjoint (s1 s2:loc) : GTot prop0\nlet loc_disjoint = M.loc_disjoint", "val disjoint\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n : GTot Type0\nlet disjoint (#a1 #a2:Type0) (#rrel1 #rel1:srel a1) (#rrel2 #rel2:srel a2)\n (b1:mbuffer a1 rrel1 rel1) (b2:mbuffer a2 rrel2 rel2) :GTot Type0 =\n loc_disjoint (loc_buffer b1) (loc_buffer b2)", "val ( ^+^ )\n (#a #b: Type0)\n (#rel1: preorder a)\n (#rel2: preorder b)\n (r1: mref a rel1)\n (r2: mref b rel2)\n : GTot (set nat)\nlet op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2)\n :GTot (set nat) = S.union (only r1) (only r2)", "val loc_includes_union_l' (s1 s2 s: loc)\n : Lemma (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l'\n (s1 s2 s: loc)\n : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\n = loc_includes_union_l s1 s2 s", "val loc_disjoint_union_r (s s1 s2:loc) : Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\nlet loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2", "val loc_disjoint_union_r (s s1 s2:loc) : Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]\nlet loc_disjoint_union_r s s1 s2 = M.loc_disjoint_union_r s s1 s2", "val loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2)\nlet loc_aux_includes\n (s1 s2: loc_aux)\n: GTot Type0\n (decreases s2)\n= match s2 with\n | LocBuffer b -> loc_aux_includes_buffer s1 b", "val union_loc_to_new (l: M.loc old_and_new_cl_union) : GTot NewM.loc\nlet union_loc_to_new (l: M.loc old_and_new_cl_union) : GTot NewM.loc =\n NewM.loc_of_cloc (M.lower_loc (M.loc_of_union_loc true l))", "val loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)\n : Lemma (requires (M.loc_includes l1 (footprint_s s) \\/ M.loc_includes l2 (footprint_s s)))\n (ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))\n [SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]\nlet loc_includes_union_l_footprint_s\n (l1 l2: M.loc) (#a: alg) (s: state_s a)\n: Lemma\n (requires (\n M.loc_includes l1 (footprint_s s) \\/ M.loc_includes l2 (footprint_s s)\n ))\n (ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))\n [SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]\n= M.loc_includes_union_l l1 l2 (footprint_s s)", "val union (#a:eqtype) (#f:cmp a) (s1 s2:mset a f) : mset a f\nlet union = union_aux", "val loc_addresses\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc\nlet loc_addresses = MG.loc_addresses #_ #cls false", "val loc_union_loc_none_l\n (s: loc)\n: Lemma\n (loc_union loc_none s == s)\n [SMTPat (loc_union loc_none s)]\nlet loc_union_loc_none_l = MG.loc_union_loc_none_l", "val loc_union_loc_none_l\n (s: loc)\n: Lemma\n (loc_union loc_none s == s)\n [SMTPat (loc_union loc_none s)]\nlet loc_union_loc_none_l = MG.loc_union_loc_none_l", "val loc_includes (s1 s2:loc) : GTot prop0\nlet loc_includes = M.loc_includes", "val loc_includes (s1 s2:loc) : GTot prop0\nlet loc_includes = M.loc_includes", "val loc_buffer\n (#t: Type)\n (b: B.buffer t)\n: GTot loc\nlet loc_buffer #t b =\n MG.loc_of_aloc #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)", "val cloc_aloc : HS.rid -> nat -> Tot (Type u#1)\nlet cloc_aloc = aloc", "val union_mem_aux (#a: eqtype) (#f: cmp a) (s1 s2: mset a f) (x: a)\n : Lemma (mem x (union s1 s2) == mem x s1 + mem x s2)\nlet rec union_mem_aux (#a:eqtype) (#f:cmp a) (s1 s2:mset a f) (x:a)\n : Lemma (mem x (union s1 s2) == mem x s1 + mem x s2)\n = match s1, s2 with\n | [], _ -> ()\n | _, [] -> ()\n | (x1, n1)::_, (x2, n2)::_ ->\n if x1 = x2\n then union_mem_aux (tl s1) (tl s2) x\n else if f x1 x2\n then begin\n union_mem_aux (tl s1) s2 x;\n if x = x1\n then mem_elt_lt_hd x s2\n else if f x x1\n then (mem_elt_lt_hd x s1; mem_elt_lt_hd x s2)\n end\n else begin\n union_mem_aux s1 (tl s2) x;\n if x = x2\n then mem_elt_lt_hd x s1\n else if f x x2\n then (mem_elt_lt_hd x s2; mem_elt_lt_hd x s1)\n end", "val valid\n (#l: P.union_typ)\n (h: HS.mem)\n (tgs: tags l)\n (p: P.pointer (typ l))\n: GTot Type0\nlet valid\n (#l: P.union_typ)\n (h: HS.mem)\n (tgs: tags l)\n (p: P.pointer (typ l))\n: GTot Type0\n=\n let tag_ptr = P.gfield p (tag_field l) in\n let u_ptr = P.gfield p (union_field l) in\n let t = P.gread h tag_ptr in\n P.readable h tag_ptr /\\\n List.Tot.mem t tgs /\\\n (let f = field_of_tag #l tgs t in\n P.is_active_union_field h u_ptr f)", "val loc_union_loc_none_r\n (s: loc)\n: Lemma\n (loc_union s loc_none == s)\n [SMTPat (loc_union s loc_none)]\nlet loc_union_loc_none_r = MG.loc_union_loc_none_r", "val loc_union_loc_none_r\n (s: loc)\n: Lemma\n (loc_union s loc_none == s)\n [SMTPat (loc_union s loc_none)]\nlet loc_union_loc_none_r = MG.loc_union_loc_none_r", "val loc_disjoint_sym\n (s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\nlet loc_disjoint_sym = MG.loc_disjoint_sym", "val loc_disjoint_sym\n (s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\nlet loc_disjoint_sym = MG.loc_disjoint_sym", "val g_upd\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (i: nat{i < length b})\n (v: a)\n (h: HS.mem{live h b})\n : GTot HS.mem\nlet g_upd (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (i:nat{i < length b})\n (v:a)\n (h:HS.mem{live h b})\n : GTot HS.mem\n = g_upd_seq b (Seq.upd (as_seq h b) i v) h", "val loc_includes_union_l_footprint_s (l1 l2: B.loc) (#a: alg) (s: state_s a)\n : Lemma (requires (B.loc_includes l1 (footprint_s s) \\/ B.loc_includes l2 (footprint_s s)))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s s))]\nlet loc_includes_union_l_footprint_s\n (l1 l2: B.loc) (#a: alg) (s: state_s a)\n: Lemma\n (requires (\n B.loc_includes l1 (footprint_s s) \\/ B.loc_includes l2 (footprint_s s)\n ))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s s))]\n= B.loc_includes_union_l l1 l2 (footprint_s s)", "val includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\nlet includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_includes (Pointer?.p p1) (Pointer?.p p2)", "val loc_includes_union_assoc_focalize_1\n (l1 l2 x r s: loc)\n: Lemma\n (requires (loc_includes (loc_union (loc_union l1 l2) (loc_union x r)) s))\n (ensures (loc_includes (loc_union l1 (loc_union (loc_union l2 x) r)) s))\n [SMTPat (loc_includes (loc_union l1 (loc_union (loc_union l2 x) r)) s)]\nlet loc_includes_union_assoc_focalize_1 l1 l2 x r s =\n loc_includes_trans (loc_union l1 (loc_union (loc_union l2 x) r)) (loc_union (loc_union l1 l2) (loc_union x r)) s", "val ccell_sel\n (#a: Type0)\n (c: ccell_ptrvalue a)\n: GTot (selector (vcell a) (ccell_hp c))\nlet ccell_sel\n #a c\n= sel_of (ccell1 c)", "val union_aux (#a: eqtype) (#f: cmp a) (s1 s2: mset a f)\n : s:\n mset a f\n { ((Cons? s1 /\\ Cons? s2) ==>\n (Cons? s /\\\n (let x1 = fst (hd s1) in\n let x2 = fst (hd s2) in\n if f x1 x2 then fst (hd s) == x1 else fst (hd s) == x2))) /\\ (Nil? s1 ==> s == s2) /\\\n (Nil? s2 ==> s == s1) }\nlet rec union_aux (#a:eqtype) (#f:cmp a) (s1 s2:mset a f) :\n s:mset a f{\n ((Cons? s1 /\\ Cons? s2) ==>\n (Cons? s /\\ (let x1 = fst (hd s1) in\n let x2 = fst (hd s2) in\n if f x1 x2 then fst (hd s) == x1\n else fst (hd s) == x2))) /\\\n (Nil? s1 ==> s == s2) /\\\n (Nil? s2 ==> s == s1)} =\n match s1, s2 with\n | [], _ -> s2\n | _, [] -> s1\n | (x1, n1)::_, (x2, n2)::_ ->\n if x1 = x2\n then (x1, n1 + n2)::(union_aux (tl s1) (tl s2))\n else if f x1 x2\n then (x1, n1)::(union_aux (tl s1) s2)\n else (x2, n2)::(union_aux s1 (tl s2))", "val size_of_union (#a:eqtype) (#f:cmp a) (s1 s2: ordset a f)\n : Lemma (size (union s1 s2) = (size s1 + size s2 - size (intersect s1 s2)))\nlet rec size_of_union #a #f s1 s2 = \n let size = size #a #f in\n match s1,s2 with\n | [], _ -> same_members_means_eq s2 (union s1 s2)\n | _, [] -> same_members_means_eq s1 (union s1 s2)\n | h1::(t1:ordset a f), h2::(t2:ordset a f) \n -> size_of_union t1 s2;\n size_of_union s1 t2;\n if h1 = h2 then union_with_prefix h1 t1 t2\n else if f h1 h2 then size_of_union_aux_1 s1 s2 \n else size_of_union_aux_2 s1 s2", "val loc_addresses\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc\nlet loc_addresses = MG.loc_addresses" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_union" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_union" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_mreference" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_region_only" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_freed_mreference" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_all_regions_from" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union_assoc" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union_assoc" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.union" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_pointer" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union_comm" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union_comm" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.new_to_union_loc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_union_r" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.loc_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_disjoint_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_union_l" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_union_idem_2" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_disjoint_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_disjoint_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_r2l" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.rset_union" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_l2r" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union_idem" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_union_idem" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union_idem" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.as_loc" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_union_l" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_union_l" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_assoc" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.loc_union" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_union_idem_1" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_r'" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_mem" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_comm" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.upd" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.s_v" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_disjoint_union_r'" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.loc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.includes" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fst", "name": "FStar.FiniteSet.Base.union" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_union_r" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_union_r" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_disjoint" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.disjoint" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Hat_Plus_Hat" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l'" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_disjoint_union_r" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_disjoint_union_r" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.union_loc_to_new" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.fsti", "name": "EverCrypt.Hash.loc_includes_union_l_footprint_s" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union_loc_none_l" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union_loc_none_l" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_buffer" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.cloc_aloc" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_mem_aux" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.valid" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union_loc_none_r" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union_loc_none_r" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_disjoint_sym" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_disjoint_sym" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.g_upd" }, { "project_name": "hacl-star", "file_name": "EverCrypt.AEAD.fsti", "name": "EverCrypt.AEAD.loc_includes_union_l_footprint_s" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_focalize_1" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.ccell_sel" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_aux" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.size_of_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_addresses" } ], "selected_premises": [ "FStar.ModifiesGen.loc", "FStar.ModifiesGen.addrs_of_loc_weak", "FStar.ModifiesGen.addrs_of_loc", "FStar.ModifiesGen.addrs_of_loc_aux_pred", "FStar.ModifiesGen.addrs_of_loc_aux", "FStar.ModifiesGen.addrs_of_loc_liveness_not_preserved", "FStar.ModifiesGen.regions_of_loc", "FStar.ModifiesGen.loc_none", "FStar.ModifiesGen.aloc_domain", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Reflection.Const.cons_qn", "FStar.FunctionalExtensionality.feq", "FStar.FunctionalExtensionality.on_dom", "FStar.Reflection.Const.nil_qn", "FStar.Reflection.V2.Data.var", "FStar.Reflection.Const.squash_qn", "FStar.Heap.trivial_preorder", "FStar.Monotonic.HyperStack.sel", "FStar.Set.as_set'", "FStar.Monotonic.HyperStack.remove_elt", "FStar.ModifiesGen.i_restricted_g_t", "FStar.FunctionalExtensionality.on", "FStar.GSet.as_set'", "FStar.Pervasives.dfst", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.Tactics.Effect.raise", "FStar.Reflection.Const.eq1_qn", "FStar.Monotonic.HyperStack.mreference", "FStar.Pervasives.dsnd", "FStar.Reflection.Const.imp_qn", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Reflection.Const.mult_qn", "FStar.Reflection.V2.Data.ppname_t", "FStar.Set.as_set", "FStar.Monotonic.HyperStack.is_above", "FStar.Set.subset", "FStar.Set.add", "FStar.ModifiesGen.addrs_dom", "FStar.Sealed.Inhabited.sealed", "FStar.TSet.as_set'", "FStar.Monotonic.HyperStack.as_addr", "FStar.Reflection.Const.or_qn", "FStar.Reflection.Const.and_qn", "FStar.HyperStack.ST.is_eternal_region", "FStar.Tactics.Types.issues", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.HyperStack.frameOf", "FStar.Monotonic.HyperStack.live_region", "FStar.Reflection.Const.eq2_qn", "FStar.Monotonic.Heap.set", "FStar.Tactics.SMT.get_initial_fuel", "FStar.Tactics.SMT.get_max_fuel", "FStar.Monotonic.HyperHeap.modifies", "FStar.ModifiesGen.mk_non_live_addrs", "FStar.GSet.disjoint", "FStar.Sealed.Inhabited.seal", "FStar.Monotonic.HyperHeap.disjoint_regions", "FStar.Monotonic.Heap.tset", "FStar.Reflection.Const.mktuple3_qn", "FStar.FunctionalExtensionality.restricted_t", "FStar.Tactics.SMT.get_rlimit", "FStar.Tactics.V2.Builtins.ret_t", "FStar.FunctionalExtensionality.arrow", "FStar.Reflection.Const.mktuple2_qn", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Reflection.Const.mktuple8_qn", "FStar.Reflection.Const.mult'_qn", "FStar.Reflection.Const.prop_qn", "FStar.Tactics.Effect.tac", "FStar.Tactics.SMT.get_initial_ifuel", "FStar.Monotonic.HyperHeap.disjoint", "FStar.FunctionalExtensionality.feq_g", "FStar.ModifiesGen.mk_live_addrs", "FStar.Reflection.V2.Data.notAscription", "FStar.Set.remove", "FStar.Reflection.Const.mktuple4_qn", "FStar.Reflection.Const.mktuple7_qn", "FStar.Reflection.Const.lsub_qn", "FStar.Reflection.Const.mktuple6_qn", "FStar.Preorder.preorder_rel", "FStar.Map.const_on", "FStar.TSet.subset", "FStar.Reflection.Const.mktuple5_qn", "FStar.Tactics.SMT.get_max_ifuel", "FStar.Set.disjoint", "FStar.Heap.trivial_rel", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperStack.is_in", "FStar.Issue.mk_issue", "FStar.Reflection.Const.b2t_qn", "FStar.FunctionalExtensionality.is_restricted", "FStar.Reflection.Const.forall_qn", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Sealed.Inhabited.sealed_", "FStar.Ghost.tot_to_gtot", "FStar.Sealed.Inhabited.is_sealed", "FStar.Reflection.Const.iff_qn", "FStar.FunctionalExtensionality.restricted_g_t" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.ModifiesGen\n\n#set-options \"--split_queries no\"\n#set-options \"--using_facts_from '*,-FStar.Tactics,-FStar.Reflection,-FStar.List'\"\n\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\nnoeq\ntype aloc (#al: aloc_t) (c: cls al) = | ALoc:\n (region: HS.rid) ->\n (addr: nat) ->\n (loc: option (al region addr)) ->\n aloc c\n\nlet aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))\n\nmodule F = FStar.FunctionalExtensionality\n\n[@@(unifier_hint_injective)]\nlet i_restricted_g_t = F.restricted_g_t\n\nlet addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )\n\nlet non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })\n\nlet live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )\n\nnoeq\ntype loc' (#al: aloc_t u#x) (c: cls al) : Type u#x =\n | Loc:\n (regions: Ghost.erased (Set.set HS.rid)) ->\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } ) ->\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags)) ->\n (live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs)) ->\n (aux: Ghost.erased (GSet.set (aloc c)) {\n aloc_domain c regions live_addrs `GSet.subset` Ghost.reveal aux /\\\n Ghost.reveal aux `GSet.subset` (aloc_domain c regions (fun _ -> GSet.complement GSet.empty))\n } ) ->\n loc' c\n\nlet loc = loc'\n\nlet mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f\n\nlet mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f\n\nlet loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)\n\nlet regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)\n\nlet addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)\n\nlet addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))\n\nlet addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)\n\nlet addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()\n", "sketch": [ "To implement `loc_union`, we will first extract the regions and addresses from `s1` and `s2`. Then, we will combine the regions and addresses from both locations to create a new location that represents their union.", "To implement `loc_union`, we first obtain the union of the regions and liveness tags from `s1` and `s2`. Then, we compute the union of the non-live addresses and live addresses for each region. Finally, we construct a new location using the combined information.", "The definition of `loc_union` is about combining two locations into a single location.\n\nStep 1: We want to define a function `loc_union` that takes two locations `s1` and `s2` of type `loc c` and returns a new location of type `loc c`.\n\nStep 2: To implement `loc_union`, we will combine the region, liveness tags, non-live addresses, live addresses, and auxiliary set of the two input locations `s1` and `s2` to create a new location.", "To implement `loc_union`, we will first extract the regions and addresses from both input locations. Then we will combine the regions and addresses from both locations to create the union. We will ensure that the resulting location satisfies the constraints imposed by the `loc'` type.", "The definition of `loc_union` is about combining two locations into a single location.\n\nStep 1: We need to define a function `loc_union` that takes two locations `s1` and `s2` and returns a new location.\n\nStep 2: To implement `loc_union`, we will combine the region, liveness tags, non-live addresses, live addresses, and auxiliary set of the two input locations to create the new location.", "The definition of `loc_union` is about combining two locations into a single location.\n\nStep 1: We want to define a function `loc_union` that takes two locations `s1` and `s2` and returns a new location.\n\nStep 2: To implement `loc_union`, we will combine the regions, region liveness tags, non-live addresses, live addresses, and auxiliary set of the two input locations `s1` and `s2` to create a new location.", "To implement `loc_union`, we will create a new location that combines the regions, liveness tags, non-live addresses, live addresses, and auxiliary set from both input locations `s1` and `s2`.", "To implement `loc_union`, we will create a new location that combines the regions, liveness tags, non-live addresses, live addresses, and auxiliary set from both input locations `s1` and `s2`.", "The definition of `loc_union` is about combining two locations into a single location.\n\nStep 1: We want to define a function `loc_union` that takes two locations `s1` and `s2` of type `loc c` and returns a new location of type `loc c`.\n\nStep 2: To implement `loc_union`, we will combine the regions, region liveness tags, non-live addresses, live addresses, and auxiliary set of the two input locations `s1` and `s2` to create a new combined location.", "To implement `loc_union`, we will first calculate the union of the regions and address sets of `s1` and `s2`. Then we will use this union to construct a new `loc` value that represents the combined regions and address sets." ], "generated_solution": [ "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n let regions_union = GSet.union (Loc?.regions s1) (Loc?.regions s2) in\n let non_live_addrs_union = mk_non_live_addrs (fun r -> GSet.union (Loc?.non_live_addrs s1 r) (Loc?.non_live_addrs s2 r)) in\n let live_addrs_union = mk_live_addrs (fun r -> GSet.union (Loc?.live_addrs s1 r) (Loc?.live_addrs s2 r) (Loc?.non_live_addrs_union r)) in\n let aux_union = GSet.union (Loc?.aux s1) (Loc?.aux s2) in\n Loc regions_union (Ghost.hide regions_union) non_live_addrs_union live_addrs_union aux_union", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n let combined_regions = GSet.union (Loc?.regions s1) (Loc?.regions s2) in\n let combined_liveness_tags = GSet.union (Loc?.region_liveness_tags s1) (Loc?.region_liveness_tags s2) in\n let combined_non_live_addrs = mk_non_live_addrs combined_regions combined_liveness_tags (fun r -> GSet.union (Loc?.non_live_addrs s1 r) (Loc?.non_live_addrs s2 r)) in\n let combined_live_addrs = mk_live_addrs combined_regions combined_liveness_tags combined_non_live_addrs (fun r -> GSet.union (Loc?.live_addrs s1 r) (Loc?.live_addrs s2 r)) in\n let combined_aux = GSet.union (Loc?.aux s1) (Loc?.aux s2) in\n Loc combined_regions combined_liveness_tags combined_non_live_addrs combined_live_addrs combined_aux", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n let regions = GSet.union (Loc?.regions s1) (Loc?.regions s2) in\n let region_liveness_tags = GSet.union (Loc?.region_liveness_tags s1) (Loc?.region_liveness_tags s2) in\n let non_live_addrs = F.union_g (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2) in\n let live_addrs = F.union_g (Loc?.live_addrs s1) (Loc?.live_addrs s2) in\n let aux = GSet.union (Loc?.aux s1) (Loc?.aux s2) in\n Loc regions region_liveness_tags non_live_addrs live_addrs aux", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n let regions_union = GSet.union (Loc?.regions s1) (Loc?.regions s2) in\n let non_live_addrs_union = mk_non_live_addrs (fun r -> GSet.union (Loc?.non_live_addrs s1 r) (Loc?.non_live_addrs s2 r)) in\n let live_addrs_union = mk_live_addrs (fun r -> GSet.union (Loc?.live_addrs s1 r) (Loc?.live_addrs s2 r) (fun _ -> GSet.empty)) in\n let aux_union = GSet.union (Loc?.aux s1) (Loc?.aux s2) in\n Loc regions_union (Ghost.hide regions_union) non_live_addrs_union live_addrs_union aux_union", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n (* Implementation of loc_union goes here *)", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n (* Implementation of loc_union goes here *)", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n Loc\n (Ghost.reveal (Set.union (Ghost.hide (Loc?.regions s1)) (Ghost.hide (Loc?.regions s2))))\n (Ghost.reveal (Set.union (Ghost.hide (Loc?.region_liveness_tags s1)) (Ghost.hide (Loc?.region_liveness_tags s2))))\n (F.restricted_g_t_union (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2))\n (F.restricted_g_t_union (Loc?.live_addrs s1) (Loc?.live_addrs s2))\n (Ghost.reveal (GSet.union (Ghost.hide (Loc?.aux s1)) (Ghost.hide (Loc?.aux s2)))", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n Loc\n (Ghost.reveal (Set.union (Ghost.hide (Loc?.regions s1)) (Ghost.hide (Loc?.regions s2))))\n (Ghost.reveal (Set.union (Ghost.hide (Loc?.region_liveness_tags s1)) (Ghost.hide (Loc?.region_liveness_tags s2))))\n (F.union_g _ (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2))\n (F.union_g _ (Loc?.live_addrs s1) (Loc?.live_addrs s2))\n (Ghost.reveal (GSet.union (Ghost.hide (Loc?.aux s1)) (Ghost.hide (Loc?.aux s2))))", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n (* Implementation of loc_union goes here *)", "let loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c) =\n let combined_regions = GSet.union (Loc?.regions s1) (Loc?.regions s2) in\n let combined_non_live_addrs = mk_non_live_addrs (fun r -> GSet.union (Loc?.non_live_addrs s1 r) (Loc?.non_live_addrs s2 r)) in\n let combined_live_addrs = mk_live_addrs (fun r -> GSet.union (Loc?.live_addrs s1 r) (Loc?.live_addrs s2 r) (fun _ -> GSet.empty)) in\n let combined_aux = GSet.union (Loc?.aux s1) (Loc?.aux s2) in\n Loc combined_regions (Ghost.hide combined_regions) combined_non_live_addrs combined_live_addrs combined_aux" ] }, { "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_region_liveness_aloc", "opens_and_abbrevs": [ { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "source_definition": "let modifies_preserves_region_liveness_aloc #al #c l1 l2 h h' #r #n x =\n if Set.mem r (Ghost.reveal (Loc?.region_liveness_tags l1))\n then begin\n assert (GSet.subset (GSet.complement GSet.empty) (Loc?.non_live_addrs l1 r));\n assert (GSet.subset (Loc?.non_live_addrs l1 r) (Loc?.live_addrs l1 r))\n end else ()", "source_range": { "start_line": 1065, "start_col": 0, "end_line": 1070, "end_col": 13 }, "interleaved": false, "definition": "fun l1 _ _ _ _ ->\n (match FStar.Set.mem r (FStar.Ghost.reveal (Loc?.region_liveness_tags l1)) with\n | true ->\n assert (FStar.GSet.subset (FStar.GSet.complement FStar.GSet.empty) (Loc?.non_live_addrs l1 r));\n assert (FStar.GSet.subset (Loc?.non_live_addrs l1 r) (Loc?.live_addrs l1 r))\n | _ -> ())\n <:\n Prims.unit", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "FStar.ModifiesGen.aloc_t", "FStar.ModifiesGen.cls", "FStar.ModifiesGen.loc", "FStar.Monotonic.HyperStack.mem", "FStar.Monotonic.HyperHeap.rid", "Prims.nat", "FStar.Set.mem", "FStar.Ghost.reveal", "FStar.Set.set", "FStar.ModifiesGen.__proj__Loc__item__region_liveness_tags", "Prims._assert", "FStar.GSet.subset", "FStar.ModifiesGen.__proj__Loc__item__non_live_addrs", "FStar.ModifiesGen.__proj__Loc__item__live_addrs", "Prims.unit", "FStar.GSet.complement", "FStar.GSet.empty", "Prims.bool" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n l1: FStar.ModifiesGen.loc c ->\n l2: FStar.ModifiesGen.loc c ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem ->\n x: al r n\n -> FStar.Pervasives.Lemma\n (requires\n FStar.ModifiesGen.modifies (FStar.ModifiesGen.loc_union l1 l2) h h' /\\\n FStar.ModifiesGen.loc_includes (FStar.ModifiesGen.region_liveness_insensitive_locs c) l2 /\\\n FStar.ModifiesGen.loc_disjoint (FStar.ModifiesGen.loc_of_aloc x) l1 /\\\n FStar.Monotonic.HyperStack.live_region h r)\n (ensures FStar.Monotonic.HyperStack.live_region h' r)", "prompt": "let modifies_preserves_region_liveness_aloc #al #c l1 l2 h h' #r #n x =\n ", "expected_response": "if Set.mem r (Ghost.reveal (Loc?.region_liveness_tags l1))\nthen\n (assert (GSet.subset (GSet.complement GSet.empty) (Loc?.non_live_addrs l1 r));\n assert (GSet.subset (Loc?.non_live_addrs l1 r) (Loc?.live_addrs l1 r)))", "source": { "project_name": "FStar", "file_name": "ulib/FStar.ModifiesGen.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.ModifiesGen.fst", "checked_file": "dataset/FStar.ModifiesGen.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Tactics.SMT.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.GSet.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "aloc", "ALoc", "ALoc", "ALoc", "aloc_t", "region", "region", "addr", "addr", "loc", "loc", "cls", "Cls", "Cls", "Cls", "aloc_includes", "aloc_includes", "let aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))", "aloc_includes_refl", "aloc_includes_refl", "let i_restricted_g_t = F.restricted_g_t", "let addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )", "let non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })", "aloc_includes_trans", "aloc_includes_trans", "let live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )", "aloc_disjoint", "aloc_disjoint", "loc'", "Loc", "Loc", "Loc", "regions", "regions", "aloc_disjoint_sym", "aloc_disjoint_sym", "region_liveness_tags", "region_liveness_tags", "non_live_addrs", "non_live_addrs", "live_addrs", "live_addrs", "aloc_disjoint_includes", "aloc_disjoint_includes", "aux", "aux", "let loc = loc'", "let mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f", "aloc_preserved", "aloc_preserved", "let mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f", "aloc_preserved_refl", "aloc_preserved_refl", "let loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)", "aloc_preserved_trans", "aloc_preserved_trans", "let regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)", "let addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty", "same_mreference_aloc_preserved", "same_mreference_aloc_preserved", "let addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty", "let addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)", "val loc (#aloc: aloc_t u#x) (c: cls aloc) : Tot (Type u#x)", "val loc_none (#aloc: aloc_t) (#c: cls aloc): Tot (loc c)", "val loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c)", "let addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))", "val loc_union_idem\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union s s == s)", "let addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)", "val loc_union_comm\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: Lemma\n (loc_union s1 s2 == loc_union s2 s1)", "let addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()", "val loc_union_assoc\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s3: loc c)\n: Lemma\n (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)", "val loc_union_loc_none_l\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union loc_none s == s)", "val loc_union_loc_none_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union s loc_none == s)", "let loc_union #al #c s1 s2 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let regions = Set.union regions1 regions2 in\n let region_liveness_tags : Ghost.erased (Set.set HS.rid) = (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1)) (Ghost.reveal (Loc?.region_liveness_tags s2)))) in\n let gregions = Ghost.hide regions in\n let non_live_addrs =\n F.on_dom_g (addrs_dom gregions) #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\n in\n let live_addrs =\n F.on_dom_g (addrs_dom gregions) #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\n in\n let aux = Ghost.hide\n (Ghost.reveal (Loc?.aux s1) `GSet.union` Ghost.reveal (Loc?.aux s2))\n in\n Loc\n (Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux", "val loc_of_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b: aloc r n)\n: GTot (loc c)", "val loc_of_aloc_not_none\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b: aloc r n)\n: Lemma (loc_of_aloc #_ #c b == loc_none ==> False)", "val loc_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot (loc c)", "val loc_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot (loc c)", "let fun_set_equal (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) :Tot Type0 =\n forall (x: t) . {:pattern (f1 x) \\/ (f2 x) } f1 x `GSet.equal` f2 x", "let loc_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses true (HS.frameOf b) (Set.singleton (HS.as_addr b))", "let fun_set_equal_elim (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) : Lemma\n (requires (fun_set_equal f1 f2))\n (ensures (f1 == f2))\n// [SMTPat (fun_set_equal f1 f2)]\n= assert (f1 `FunctionalExtensionality.feq_g` f2)", "let loc_freed_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses false (HS.frameOf b) (Set.singleton (HS.as_addr b))", "let loc_equal (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : GTot Type0 =\n let Loc regions1 region_liveness_tags1 _ _ aux1 = s1 in\n let Loc regions2 region_liveness_tags2 _ _ aux2 = s2 in\n Ghost.reveal regions1 `Set.equal` Ghost.reveal regions2 /\\\n Ghost.reveal region_liveness_tags1 `Set.equal` Ghost.reveal region_liveness_tags2 /\\\n fun_set_equal (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2) /\\\n fun_set_equal (Loc?.live_addrs s1) (Loc?.live_addrs s2) /\\\n Ghost.reveal (Loc?.aux s1) `GSet.equal` Ghost.reveal (Loc?.aux s2)", "let loc_region_only\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (Set.singleton r)", "let loc_equal_elim (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : Lemma\n (requires (loc_equal s1 s2))\n (ensures (s1 == s2))\n [SMTPat (s1 `loc_equal` s2)]\n= fun_set_equal_elim (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2);\n fun_set_equal_elim (Loc?.live_addrs s1) (Loc?.live_addrs s2)", "let loc_all_regions_from\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (HS.mod_set (Set.singleton r))", "let loc_union_idem #al #c s =\n assert (loc_union s s `loc_equal` s)", "let loc_union_comm #al #c s1 s2 =\n assert (loc_union s1 s2 `loc_equal` loc_union s2 s1)", "let loc_union_assoc #al #c s1 s2 s3 =\n assert (loc_union s1 (loc_union s2 s3) `loc_equal` loc_union (loc_union s1 s2) s3)", "val loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0", "let loc_union_loc_none_l #al #c s =\n assert (loc_union loc_none s `loc_equal` s)", "val loc_includes_refl\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_includes s s)", "let loc_union_loc_none_r #al #c s =\n assert (loc_union s loc_none `loc_equal` s)", "let loc_of_aloc #al #c #r #n b =\n let regions = (Ghost.hide (Set.singleton r)) in\n let region_liveness_tags = (Ghost.hide (Set.empty)) in\n Loc\n regions\n region_liveness_tags\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide (GSet.singleton (ALoc r n (Some b))))", "val loc_includes_trans\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s3: loc c)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))", "val loc_includes_union_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s s1 s2: loc c)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))", "let loc_of_aloc_not_none #al #c #r #n b = ()", "let loc_addresses #al #c preserve_liveness r n =\n let regions = (Ghost.hide (Set.singleton r)) in\n Loc\n regions\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> if preserve_liveness then GSet.empty else GSet.of_set n))\n (mk_live_addrs (fun _ -> GSet.of_set n))\n (Ghost.hide (aloc_domain c regions (fun _ -> GSet.of_set n)))", "val loc_includes_union_l\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s: loc c)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))", "let loc_regions_region_liveness_tags (preserve_liveness: bool) (r: Set.set HS.rid) : Tot (Ghost.erased (Set.set HS.rid)) =\n if preserve_liveness then Ghost.hide Set.empty else Ghost.hide r", "val loc_includes_none\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_includes s loc_none)", "let loc_regions #al #c preserve_liveness r =\n let region_liveness_tags = loc_regions_region_liveness_tags preserve_liveness r in\n let addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { r' `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y } ) =\n GSet.complement GSet.empty\n in\n let live_addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { addrs r' `GSet.subset` y } ) =\n addrs r'\n in\n Loc\n (Ghost.hide r)\n region_liveness_tags\n (mk_non_live_addrs addrs)\n (mk_live_addrs live_addrs)\n (Ghost.hide (aloc_domain c (Ghost.hide r) addrs))", "val loc_includes_none_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (requires (loc_includes loc_none s))\n (ensures (s == loc_none))", "val loc_includes_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b1 b2: aloc r n)\n: Lemma\n (requires (c.aloc_includes b1 b2))\n (ensures (loc_includes (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))", "let aloc_includes (#al: aloc_t) (#c: cls al) (b0 b: aloc c) : GTot Type0 =\n b0.region == b.region /\\ b0.addr == b.addr /\\ Some? b0.loc == Some? b.loc /\\ (if Some? b0.loc && Some? b.loc then c.aloc_includes (Some?.v b0.loc) (Some?.v b.loc) else True)", "let loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b: aloc c)\n: GTot Type0\n (decreases s)\n= exists (b0 : aloc c) . b0 `GSet.mem` s /\\ b0 `aloc_includes` b", "val loc_includes_aloc_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1 #r2: HS.rid)\n (#n1 #n2: nat)\n (b1: aloc r1 n1)\n (b2: aloc r2 n2)\n: Lemma\n (requires (loc_includes (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))\n (ensures (r1 == r2 /\\ n1 == n2 /\\ c.aloc_includes b1 b2))", "let loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: GTot Type0\n (decreases s2)\n= forall (b2: aloc c) . GSet.mem b2 s2 ==> loc_aux_includes_buffer s1 b2", "val loc_includes_addresses_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n (s: Set.set nat)\n (#a: nat)\n (p: aloc r a)\n: Lemma\n (requires (Set.mem a s))\n (ensures (loc_includes (loc_addresses preserve_liveness r s) (loc_of_aloc #_ #c p)))", "let loc_aux_includes_union_l\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s \\/ loc_aux_includes s2 s))\n (ensures (loc_aux_includes (GSet.union s1 s2) s))\n (decreases s)\n= ()", "let loc_aux_includes_refl\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n: Lemma\n (loc_aux_includes s s)\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)", "val loc_includes_region_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (s: Set.set HS.rid)\n (#r: HS.rid)\n (#a: nat)\n (b: aloc r a)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness s) (loc_of_aloc #_ #c b)))", "let loc_aux_includes_subset\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)", "val loc_includes_region_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions #_ #c preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))", "let loc_aux_includes_subset'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n [SMTPatOr [\n [SMTPat (s1 `GSet.subset` s2)];\n [SMTPat (loc_aux_includes s2 s1)];\n ]]\n= loc_aux_includes_subset s1 s2", "val loc_includes_region_region\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions #_ #c preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))", "let loc_aux_includes_union_l_r\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s s') s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s s' s", "val loc_includes_region_union_l\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (l: loc c)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))", "let loc_aux_includes_union_l_l\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s' s) s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s' s s", "val loc_includes_addresses_addresses\n (#aloc: aloc_t) (c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (a1 a2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset a2 a1))\n (ensures (loc_includes #_ #c (loc_addresses preserve_liveness1 r a1) (loc_addresses preserve_liveness2 r a2)))", "let loc_aux_includes_buffer_includes\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b1 b2: aloc c)\n: Lemma\n (requires (loc_aux_includes_buffer s b1 /\\ b1 `aloc_includes` b2))\n (ensures (loc_aux_includes_buffer s b2))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))", "val loc_disjoint\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0", "let loc_aux_includes_loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n (b: aloc c)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\n= Classical.forall_intro_3 (fun s b1 b2 -> Classical.move_requires (loc_aux_includes_buffer_includes #al #c s b1) b2)", "val loc_disjoint_sym\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))", "let loc_aux_includes_trans\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))", "val loc_disjoint_none_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (ensures (loc_disjoint s loc_none))", "let addrs_of_loc_weak_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc_weak (loc_union l1 l2) r == GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r))\n [SMTPat (addrs_of_loc_weak (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc_weak (loc_union l1 l2) r) (GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r)))", "val loc_disjoint_union_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))", "val loc_disjoint_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (p1 p2 p1' p2' : loc c)\n: Lemma\n (requires (loc_includes p1 p1' /\\ loc_includes p2 p2' /\\ loc_disjoint p1 p2))\n (ensures (loc_disjoint p1' p2'))", "let addrs_of_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc (loc_union l1 l2) r == GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r))\n [SMTPat (addrs_of_loc (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc (loc_union l1 l2) r) (GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r)))", "val loc_disjoint_aloc_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1: HS.rid)\n (#a1: nat)\n (#r2: HS.rid)\n (#a2: nat)\n (b1: aloc r1 a1)\n (b2: aloc r2 a2)\n: Lemma\n (requires ((r1 == r2 /\\ a1 == a2) ==> c.aloc_disjoint b1 b2))\n (ensures (loc_disjoint (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))", "let loc_includes' #al (#c: cls al) (s1 s2: loc c) =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in (\n Set.subset regions2 regions1 /\\\n Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) /\\\n (\n forall (r: HS.rid { Set.mem r regions2 } ) .\n GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r)\n ) /\\\n (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r)\n ) /\\ (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r)\n ) /\\ (\n (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2))\n )\n )", "val loc_disjoint_aloc_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1: HS.rid)\n (#a1: nat)\n (#r2: HS.rid)\n (#a2: nat)\n (b1: aloc r1 a1)\n (b2: aloc r2 a2)\n: Lemma\n (requires (loc_disjoint (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))\n (ensures ((r1 == r2 /\\ a1 == a2) ==> c.aloc_disjoint b1 b2))", "val loc_disjoint_addresses_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (r1 r2: HS.rid)\n (n1 n2: Set.set nat)\n: Lemma\n (requires (r1 <> r2 \\/ Set.subset (Set.intersect n1 n2) Set.empty))\n (ensures (loc_disjoint (loc_addresses #_ #c preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2)))", "let loc_includes #al #c s1 s2 =\n loc_includes' s1 s2", "let loc_includes_refl #al #c s =\n loc_aux_includes_refl (Ghost.reveal (Loc?.aux s))", "let loc_includes_refl'\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]\n= loc_includes_refl s", "let loc_disjoint_addresses #aloc #c = loc_disjoint_addresses_intro #aloc #c", "val loc_disjoint_addresses_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (r1 r2: HS.rid)\n (n1 n2: Set.set nat)\n: Lemma\n (requires (loc_disjoint (loc_addresses #_ #c preserve_liveness1 r1 n1) (loc_addresses preserve_liveness2 r2 n2)))\n (ensures (r1 <> r2 \\/ Set.subset (Set.intersect n1 n2) Set.empty))", "let loc_includes_trans #al #c s1 s2 s3 =\n loc_aux_includes_trans (Ghost.reveal (Loc?.aux s1)) (Ghost.reveal (Loc?.aux s2)) (Ghost.reveal (Loc?.aux s3))", "let loc_includes_union_r #al #c s s1 s2 = ()", "let loc_includes_union_l #al #c s1 s2 s =\n let u12 = loc_union s1 s2 in\n Classical.or_elim\n #(loc_includes s1 s)\n #(loc_includes s2 s)\n #(fun _ -> loc_includes (loc_union s1 s2) s)\n (fun _ ->\n loc_aux_includes_union_l_r (Ghost.reveal (Loc?.aux s1)) (Ghost.reveal (Loc?.aux s2));\n assert (loc_includes (loc_union s1 s2) s1);\n loc_includes_trans u12 s1 s)\n (fun _ ->\n loc_aux_includes_union_l_l (Ghost.reveal (Loc?.aux s2)) (Ghost.reveal (Loc?.aux s1));\n assert (loc_includes (loc_union s1 s2) s2);\n loc_includes_trans u12 s2 s)", "val loc_disjoint_aloc_addresses_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (#r' : HS.rid)\n (#a' : nat)\n (p: aloc r' a')\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r == r' ==> (~ (Set.mem a' n))))\n (ensures (loc_disjoint (loc_of_aloc p) (loc_addresses #_ #c preserve_liveness r n)))", "val loc_disjoint_aloc_addresses_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r' : HS.rid)\n (#a' : nat)\n (p: aloc r' a')\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: Lemma\n (requires (loc_disjoint (loc_of_aloc p) (loc_addresses #_ #c preserve_liveness r n)))\n (ensures (r == r' ==> (~ (Set.mem a' n))))", "let loc_includes_none #al #c s = ()", "let loc_includes_none_elim #al #c s =\n assert (s `loc_equal` loc_none)", "let loc_includes_aloc #al #c #r #n b1 b2 = ()", "let loc_includes_aloc_elim #aloc #c #r1 #r2 #n1 #n2 b1 b2 = ()", "let addrs_of_loc_loc_of_aloc\n (#al: aloc_t)\n (#c: cls al)\n (#r: HS.rid)\n (#a: nat)\n (p: al r a)\n (r': HS.rid)\n: Lemma\n (addrs_of_loc (loc_of_aloc #_ #c p) r' `GSet.equal` (if r = r' then GSet.singleton a else GSet.empty))\n [SMTPat (addrs_of_loc (loc_of_aloc #_ #c p) r')]\n= ()", "val loc_disjoint_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (rs1 rs2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset (Set.intersect rs1 rs2) Set.empty))\n (ensures (loc_disjoint (loc_regions #_ #c preserve_liveness1 rs1) (loc_regions preserve_liveness2 rs2)))", "val address_liveness_insensitive_locs (#aloc: aloc_t) (c: cls aloc) : Tot (loc c)", "let loc_includes_addresses_aloc #al #c preserve_liveness r s #a p = ()", "val loc_includes_address_liveness_insensitive_locs_aloc (#aloc: aloc_t) (#c: cls aloc) (#r: HS.rid) (#n: nat) (a: aloc r n) : Lemma\n (loc_includes (address_liveness_insensitive_locs c) (loc_of_aloc a))", "let loc_includes_region_aloc #al #c preserve_liveness s #r #a b = ()", "let loc_includes_region_addresses #al #c s preserve_liveness1 preserve_liveness2 r a = ()", "val loc_includes_address_liveness_insensitive_locs_addresses (#aloc: aloc_t) (c: cls aloc) (r: HS.rid) (a: Set.set nat) : Lemma\n (loc_includes (address_liveness_insensitive_locs c) (loc_addresses true r a))", "let loc_includes_region_region #al #c preserve_liveness1 preserve_liveness2 s1 s2 = ()", "val region_liveness_insensitive_locs (#al: aloc_t) (c: cls al) : Tot (loc c)", "let loc_includes_region_union_l #al #c preserve_liveness l s1 s2 =\n assert ((loc_regions #_ #c preserve_liveness (Set.intersect s2 (Set.complement s1)) `loc_union` loc_regions #_ #c preserve_liveness (Set.intersect s2 s1)) `loc_equal` loc_regions preserve_liveness s2);\n loc_includes_region_region #_ #c preserve_liveness preserve_liveness s1 (Set.intersect s2 s1);\n loc_includes_union_l (loc_regions preserve_liveness s1) l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)));\n loc_includes_union_l (loc_regions preserve_liveness s1) l (loc_regions preserve_liveness (Set.intersect s2 s1));\n loc_includes_union_r (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1))) (loc_regions preserve_liveness (Set.intersect s2 s1))", "val loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs (#al: aloc_t) (c: cls al) : Lemma\n (loc_includes (region_liveness_insensitive_locs c) (address_liveness_insensitive_locs c))", "val loc_includes_region_liveness_insensitive_locs_loc_regions\n (#al: aloc_t) (c: cls al) (r: Set.set HS.rid)\n: Lemma\n (region_liveness_insensitive_locs c `loc_includes` loc_regions #_ #c true r)", "let loc_includes_addresses_addresses #al c preserve_liveness1 preserve_liveness2 r s1 s2 = ()", "val loc_includes_region_liveness_insensitive_locs_loc_addresses\n (#al: aloc_t) (c: cls al) (preserve_liveness: bool) (r: HS.rid) (a: Set.set nat)\n: Lemma\n (region_liveness_insensitive_locs c `loc_includes` loc_addresses #_ #c preserve_liveness r a)", "let aloc_disjoint (#al: aloc_t) (#c: cls al) (b1 b2: aloc c) : GTot Type0 =\n if b1.region = b2.region && b1.addr = b2.addr\n then Some? b1.loc /\\ Some? b2.loc /\\ c.aloc_disjoint (Some?.v b1.loc) (Some?.v b2.loc)\n else True", "val loc_includes_region_liveness_insensitive_locs_loc_of_aloc\n (#al: aloc_t) (c: cls al) (#r: HS.rid) (#a: nat) (x: al r a)\n: Lemma\n (region_liveness_insensitive_locs c `loc_includes` loc_of_aloc #_ #c x)", "let aloc_disjoint_sym (#al: aloc_t) (#c: cls al) (b1 b2: aloc c) : Lemma\n (aloc_disjoint b1 b2 <==> aloc_disjoint b2 b1)\n= Classical.forall_intro_2 (fun r a -> Classical.forall_intro_2 (fun b1 b2 -> c.aloc_disjoint_sym #r #a b1 b2))", "let loc_aux_disjoint\n (#al: aloc_t) (#c: cls al)\n (l1 l2: GSet.set (aloc c))\n: GTot Type0\n= forall (b1 b2: aloc c) . (GSet.mem b1 l1 /\\ GSet.mem b2 l2) ==> aloc_disjoint b1 b2", "val modifies\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0", "let loc_aux_disjoint_union_l\n (#al: aloc_t) (#c: cls al)\n (ll1 lr1 l2: GSet.set (aloc c))\n: Lemma\n (ensures (loc_aux_disjoint (GSet.union ll1 lr1) l2 <==> (loc_aux_disjoint ll1 l2 /\\ loc_aux_disjoint lr1 l2)))\n= ()", "val modifies_intro\n (#al: aloc_t) (#c: cls al) (l: loc c) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((loc_disjoint (loc_mreference b) l) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (\n HS.live_region h r /\\\n HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)\n ))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (r: HS.rid) ->\n (a: nat) ->\n (x: al r a) ->\n Lemma\n (requires (loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies l h h')", "let loc_aux_disjoint_union_r\n (#al: aloc_t) (#c: cls al)\n (l1 ll2 lr2: GSet.set (aloc c))\n: Lemma\n (loc_aux_disjoint l1 (GSet.union ll2 lr2) <==> (loc_aux_disjoint l1 ll2 /\\ loc_aux_disjoint l1 lr2))\n= ()", "let loc_aux_disjoint_sym\n (#al: aloc_t) (#c: cls al)\n (l1 l2: GSet.set (aloc c))\n: Lemma\n (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1))\n= Classical.forall_intro_2 (aloc_disjoint_sym #al #c)", "let regions_of_loc_loc_union\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (regions_of_loc (loc_union s1 s2) == regions_of_loc s1 `Set.union` regions_of_loc s2)\n [SMTPat (regions_of_loc (loc_union s1 s2))]\n= assert (regions_of_loc (loc_union s1 s2) `Set.equal` (regions_of_loc s1 `Set.union` regions_of_loc s2))", "let regions_of_loc_monotonic\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_includes s1 s2))\n (ensures (Set.subset (regions_of_loc s2) (regions_of_loc s1)))\n= ()", "let loc_disjoint_region_liveness_tags (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n Set.subset (Set.intersect (Ghost.reveal (Loc?.region_liveness_tags l1)) (Ghost.reveal (Loc?.region_liveness_tags l2))) Set.empty", "let loc_disjoint_addrs (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n (forall (r: HS.rid) .\n GSet.subset (GSet.intersect (addrs_of_loc_weak l1 r) (addrs_of_loc l2 r)) GSet.empty /\\\n GSet.subset (GSet.intersect (addrs_of_loc l1 r) (addrs_of_loc_weak l2 r)) GSet.empty\n )", "let loc_disjoint_aux (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n loc_aux_disjoint (Ghost.reveal (Loc?.aux l1)) (Ghost.reveal (Loc?.aux l2))", "val modifies_none_intro\n (#al: aloc_t) (#c: cls al) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (HS.live_region h r /\\ HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n: Lemma\n (modifies (loc_none #_ #c) h h')", "let loc_disjoint'\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n: GTot Type0\n= loc_disjoint_region_liveness_tags l1 l2 /\\\n loc_disjoint_addrs l1 l2 /\\\n loc_disjoint_aux l1 l2", "let loc_disjoint = loc_disjoint'", "let loc_disjoint_sym #al #c l1 l2 =\n Classical.forall_intro_2 (loc_aux_disjoint_sym #al #c)", "let loc_disjoint_sym'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\n [SMTPat (loc_disjoint s1 s2)]\n= loc_disjoint_sym s1 s2", "let loc_disjoint_none_r #al #c s = ()", "let loc_disjoint_union_r #al #c s s1 s2 = ()", "val modifies_address_intro\n (#al: aloc_t) (#c: cls al) (r: HS.rid) (n: nat) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (addr_unused_in: (\n (r': HS.rid) ->\n (n' : nat) ->\n Lemma\n (requires ((r' <> r \\/ n' <> n) /\\ HS.live_region h r' /\\ HS.live_region h' r' /\\ n' `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r')))\n (ensures (n' `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r')))\n ))\n: Lemma\n (modifies (loc_addresses #_ #c false r (Set.singleton n)) h h')", "let aloc_disjoint_includes (#al: aloc_t) (#c: cls al) (b1 b2 b3 : aloc c) : Lemma\n (requires (aloc_disjoint b1 b2 /\\ aloc_includes b2 b3))\n (ensures (aloc_disjoint b1 b3))\n= if b1.region = b2.region && b1.addr = b2.addr\n then begin\n c.aloc_includes_refl (Some?.v b1.loc);\n c.aloc_disjoint_includes (Some?.v b1.loc) (Some?.v b2.loc) (Some?.v b1.loc) (Some?.v b3.loc)\n end\n else ()", "let loc_aux_disjoint_loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (l1 l2 l3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes l2 l3))\n (ensures (loc_aux_disjoint l1 l3))\n= // FIXME: WHY WHY WHY do I need this assert?\n assert (forall (b1 b3: aloc c) . (GSet.mem b1 l1 /\\ GSet.mem b3 l3) ==> (exists (b2: aloc c) . GSet.mem b2 l2 /\\ aloc_disjoint b1 b2 /\\ aloc_includes b2 b3));\n Classical.forall_intro_3 (fun b1 b2 b3 -> Classical.move_requires (aloc_disjoint_includes #al #c b1 b2) b3)", "let loc_disjoint_includes #al #c p1 p2 p1' p2' =\n regions_of_loc_monotonic p1 p1';\n regions_of_loc_monotonic p2 p2';\n let l1 = Ghost.reveal (Loc?.aux p1) in\n let l2 = Ghost.reveal (Loc?.aux p2) in\n let l1' = Ghost.reveal (Loc?.aux p1') in\n let l2' = Ghost.reveal (Loc?.aux p2') in\n loc_aux_disjoint_loc_aux_includes l1 l2 l2';\n loc_aux_disjoint_sym l1 l2';\n loc_aux_disjoint_loc_aux_includes l2' l1 l1';\n loc_aux_disjoint_sym l2' l1'", "val modifies_aloc_intro\n (#al: aloc_t) (#c: cls al) (#r: HS.rid) (#n: nat) (z: al r n) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (HS.live_region h r /\\ HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (x: al r n) ->\n Lemma\n (requires (c.aloc_disjoint x z))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies (loc_of_aloc #_ #c z) h h')", "let loc_disjoint_aloc_intro #al #c #r1 #a1 #r2 #a2 b1 b2 = ()", "let loc_disjoint_aloc_elim #al #c #r1 #a1 #r2 #a2 b1 b2 =\n // FIXME: WHY WHY WHY this assert?\n assert (aloc_disjoint (ALoc #_ #c r1 a1 (Some b1)) (ALoc #_ #c r2 a2 (Some b2)))", "let loc_disjoint_addresses_intro #al #c preserve_liveness1 preserve_liveness2 r1 r2 n1 n2 =\n // FIXME: WHY WHY WHY this assert?\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_addresses #_ #c preserve_liveness1 r1 n1))) (Ghost.reveal (Loc?.aux (loc_addresses #_ #c preserve_liveness2 r2 n2))))", "let loc_disjoint_addresses_elim #al #c preserve_liveness1 preserve_liveness2 r1 r2 n1 n2 = ()", "let loc_disjoint_aloc_addresses_intro #al #c #r' #a' p preserve_liveness r n = ()", "let loc_disjoint_aloc_addresses_elim #al #c #r' #a' p preserve_liveness r n = ()", "let loc_disjoint_regions #al #c preserve_liveness1 preserve_liveness2 rs1 rs2 =\n // FIXME: WHY WHY WHY this assert?\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_regions #_ #c preserve_liveness1 rs1))) (Ghost.reveal (Loc?.aux (loc_regions #_ #c preserve_liveness2 rs2))))", "let loc_none_in_some_region #a (c: cls a) (r: HS.rid) : GTot (loc c) =\n Loc\n (Ghost.hide (Set.singleton r))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)", "let address_liveness_insensitive_locs #al c =\n Loc\n (Ghost.hide (Set.complement Set.empty))\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.complement GSet.empty))\n (Ghost.hide (aloc_domain c (Ghost.hide (Set.complement Set.empty)) (fun _ -> GSet.complement GSet.empty)))", "val modifies_live_region\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n (h1 h2: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (modifies s h1 h2 /\\ loc_disjoint s (loc_region_only false r) /\\ HS.live_region h1 r))\n (ensures (HS.live_region h2 r))", "let loc_includes_address_liveness_insensitive_locs_aloc #al #c #r #n a = ()", "val modifies_mreference_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (b: HS.mreference t pre)\n (p: loc c)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_mreference b) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))", "let loc_includes_address_liveness_insensitive_locs_addresses #al c r a = ()", "let region_liveness_insensitive_locs #al c =\n Loc\n (Ghost.hide (Set.complement Set.empty))\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> GSet.complement GSet.empty))\n (mk_live_addrs (fun _ -> GSet.complement GSet.empty))\n (Ghost.hide (aloc_domain c (Ghost.hide (Set.complement Set.empty)) (fun _ -> GSet.complement GSet.empty)))", "let loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs #al c = ()", "let loc_includes_region_liveness_insensitive_locs_loc_regions #al c r = ()", "let loc_includes_region_liveness_insensitive_locs_loc_addresses #al c preserve_liveness r a = ()", "let loc_includes_region_liveness_insensitive_locs_loc_of_aloc #al c #r #a x = ()", "val modifies_aloc_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#a: nat)\n (b: aloc r a)\n (p: loc c)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_of_aloc b) p /\\\n modifies p h h'\n ))\n (ensures (\n c.aloc_preserved b h h'\n ))", "let modifies_preserves_livenesses\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (t: Type) (pre: Preorder.preorder t) (p: HS.mreference t pre) .\n let r = HS.frameOf p in (\n HS.contains h1 p /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s r)))\n ) ==> (\n HS.contains h2 p\n ))", "let modifies_preserves_livenesses_elim\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (p: HS.mreference t pre)\n: Lemma\n (requires (modifies_preserves_livenesses s h1 h2 /\\ HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))))\n (ensures (HS.contains h2 p))\n= ()", "val modifies_refl\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n (h: HS.mem)\n: Lemma\n (modifies s h h)", "val modifies_loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1: loc c)\n (h h': HS.mem)\n (s2: loc c)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))", "let modifies_preserves_livenesses_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p))\n ))\n: Lemma\n (modifies_preserves_livenesses s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'", "val modifies_preserves_liveness\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union s1 s2) h h' /\\ loc_disjoint s1 (loc_mreference r) /\\ loc_includes (address_liveness_insensitive_locs c) s2 /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))", "val modifies_preserves_liveness_strong\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (x: aloc (HS.frameOf r) (HS.as_addr r))\n: Lemma\n (requires (modifies (loc_union s1 s2) h h' /\\ loc_disjoint s1 (loc_of_aloc #_ #c #(HS.frameOf r) #(HS.as_addr r) x) /\\ loc_includes (address_liveness_insensitive_locs c) s2 /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))", "val modifies_preserves_region_liveness\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_region_only false r) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "let modifies_preserves_mreferences\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (t: Type) (pre: Preorder.preorder t) (p: HS.mreference t pre) .\n let r = HS.frameOf p in (\n HS.contains h1 p /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s r)))\n ) ==> (\n HS.contains h2 p /\\\n HS.sel h2 p == HS.sel h1 p\n ))", "val modifies_preserves_region_liveness_reference\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_mreference r) l1 /\\ HS.live_region h (HS.frameOf r)))\n (ensures (HS.live_region h' (HS.frameOf r)))", "let modifies_preserves_mreferences_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p /\\ HS.sel h2 p == HS.sel h1 p))\n ))\n: Lemma\n (modifies_preserves_mreferences s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p /\\ h2 `HS.sel` p == h1 `HS.sel` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_trans\n (#aloc: aloc_t) (#c: cls aloc)\n (s12: loc c)\n (h1 h2: HS.mem)\n (s23: loc c)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))", "val modifies_only_live_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (rs: Set.set HS.rid)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))", "let modifies_preserves_alocs\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (r: HS.rid) (a: nat) (b: al r a) .\n loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b)))\n ==>\n c.aloc_preserved b h1 h2\n )", "val no_upd_fresh_region\n (#aloc: aloc_t) (#c: cls aloc)\n (r:HS.rid)\n (l:loc c)\n (h0:HS.mem)\n (h1:HS.mem)\n: Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))", "let modifies_preserves_alocs_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (u: unit { modifies_preserves_mreferences s h1 h2 } )\n (f: (\n (r: HS.rid) ->\n (a: nat) ->\n (b: al r a) ->\n Lemma\n (requires (\n Set.mem r (regions_of_loc s) /\\\n (~ (GSet.mem a (addrs_of_loc_weak s r))) /\\\n (GSet.mem a (addrs_of_loc_aux s r) /\\ loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b))))\n ))\n (ensures (c.aloc_preserved b h1 h2))\n ))\n: Lemma\n (modifies_preserves_alocs s h1 h2)\n= let f'\n (r: HS.rid)\n (a: nat)\n (b: al r a)\n : Lemma\n (requires (loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b)))))\n (ensures (c.aloc_preserved b h1 h2))\n = if Set.mem r (regions_of_loc s) && (not (GSet.mem a (addrs_of_loc_weak s r)))\n then begin\n if GSet.mem a (addrs_of_loc_aux s r)\n then\n Classical.move_requires (f r a) b\n else\n c.same_mreference_aloc_preserved b h1 h2 (fun a' pre' r' -> ())\n end else if Set.mem r (regions_of_loc s)\n then begin\n assert (GSet.mem a (addrs_of_loc_weak s r));\n assert (GSet.mem (ALoc r a None) (Ghost.reveal (Loc?.aux s)));\n assert (aloc_disjoint #_ #c (ALoc r a None) (ALoc r a (Some b)));\n assert False\n end\n else\n c.same_mreference_aloc_preserved b h1 h2 (fun a' pre' r' -> ())\n in\n Classical.forall_intro_3 (fun r a b -> Classical.move_requires (f' r a) b)", "val fresh_frame_modifies\n (#aloc: aloc_t) (c: cls aloc)\n (h0 h1: HS.mem)\n: Lemma\n (requires (HS.fresh_frame h0 h1))\n (ensures (modifies #_ #c loc_none h0 h1))", "val new_region_modifies\n (#al: aloc_t)\n (c: cls al)\n (m0: HS.mem)\n (r0: HS.rid)\n (col: option int)\n: Lemma\n (requires (HST.is_eternal_region r0 /\\ HS.live_region m0 r0 /\\ (None? col \\/ HS.is_heap_color (Some?.v col))))\n (ensures (\n let (_, m1) = HS.new_eternal_region m0 r0 col in\n modifies (loc_none #_ #c) m0 m1\n ))", "val popped_modifies\n (#aloc: aloc_t) (c: cls aloc)\n (h0 h1: HS.mem) : Lemma\n (requires (HS.popped h0 h1))\n (ensures (modifies #_ #c (loc_region_only false (HS.get_tip h0)) h0 h1))", "val modifies_fresh_frame_popped\n (#aloc: aloc_t) (#c: cls aloc)\n (h0 h1: HS.mem)\n (s: loc c)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n HS.get_tip h2 == HS.get_tip h1 /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n HS.get_tip h3 == HS.get_tip h0\n ))", "let modifies_preserves_regions\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= forall (r: HS.rid) . (HS.live_region h1 r /\\ ~ (Set.mem r (Ghost.reveal (Loc?.region_liveness_tags s)))) ==> HS.live_region h2 r", "val modifies_loc_regions_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions #_ #c true rs) h1 h2))", "let modifies_preserves_not_unused_in\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (r: HS.rid) (n: nat) . (\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ) ==> (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))", "val modifies_loc_addresses_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))", "let modifies_preserves_not_unused_in_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ))\n (ensures (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))\n ))\n: Lemma\n (modifies_preserves_not_unused_in s h1 h2)\n= let f'\n (r: HS.rid)\n (n: nat)\n : Lemma\n ((\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ) ==> (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))\n = Classical.move_requires (f r) n\n in\n Classical.forall_intro_2 f'", "val modifies_ralloc_post\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (i: HS.rid)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel)\n (h' : HS.mem)\n: Lemma\n (requires (HST.ralloc_post i init h x h'))\n (ensures (modifies (loc_none #_ #c) h h'))", "val modifies_salloc_post\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies (loc_none #_ #c) h h'))", "val modifies_free\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel { HS.is_mm r } )\n (m: HS.mem { m `HS.contains` r } )\n: Lemma\n (modifies (loc_freed_mreference #_ #c r) m (HS.free r m))", "let modifies'\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= modifies_preserves_regions s h1 h2 /\\\n modifies_preserves_not_unused_in s h1 h2 /\\\n modifies_preserves_mreferences s h1 h2 /\\\n modifies_preserves_livenesses s h1 h2 /\\\n modifies_preserves_alocs s h1 h2", "val modifies_none_modifies\n (#aloc: aloc_t) (#c: cls aloc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HST.modifies_none h1 h2))\n (ensures (modifies (loc_none #_ #c) h1 h2))", "let modifies = modifies'", "val modifies_intro_strong\n (#al: aloc_t) (#c: cls al) (l: loc c) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((loc_disjoint (loc_mreference b) l) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (\n (Set.mem r (regions_of_loc l) ==> ~ (GSet.mem n (Loc?.non_live_addrs l r))) /\\\n HS.live_region h r /\\\n HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)\n ))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (r: HS.rid) ->\n (a: nat) ->\n (x: al r a) ->\n Lemma\n (requires (loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies l h h')", "val modifies_upd\n (#aloc: aloc_t) (#c: cls aloc)\n (#t: Type) (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (v: t)\n (h: HS.mem)\n: Lemma\n (requires (HS.contains h r))\n (ensures (modifies #_ #c (loc_mreference r) h (HS.upd h r v)))", "val modifies_strengthen\n (#al: aloc_t) (#c: cls al) (l: loc c) (#r0: HS.rid) (#a0: nat) (al0: al r0 a0) (h h' : HS.mem)\n (alocs: (\n (f: ((t: Type) -> (pre: Preorder.preorder t) -> (m: HS.mreference t pre) -> Lemma\n (requires (HS.frameOf m == r0 /\\ HS.as_addr m == a0 /\\ HS.contains h m))\n (ensures (HS.contains h' m))\n )) ->\n (x: al r0 a0) ->\n Lemma\n (requires (c.aloc_disjoint x al0 /\\ loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (requires (modifies (loc_union l (loc_addresses true r0 (Set.singleton a0))) h h'))\n (ensures (modifies (loc_union l (loc_of_aloc al0)) h h'))", "val does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: GTot Type0", "val not_live_region_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (~ (HS.live_region h (fst ra))))\n (ensures (h `does_not_contain_addr` ra))", "val unused_in_does_not_contain_addr\n (h: HS.mem)\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n: Lemma\n (requires (r `HS.unused_in` h))\n (ensures (h `does_not_contain_addr` (HS.frameOf r, HS.as_addr r)))", "let modifies_intro_strong #al #c l h h' regions mrefs lives unused_ins alocs =\n Classical.forall_intro (Classical.move_requires regions);\n assert (modifies_preserves_regions l h h');\n\n let aux (t:Type) (pre:Preorder.preorder t) (p:HS.mreference t pre)\n :Lemma (requires (HS.contains h p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc l) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc l (HS.frameOf p))))))\n (ensures (HS.contains h' p /\\ HS.sel h' p == HS.sel h p))\n =\n assert_norm (Loc?.region_liveness_tags (loc_mreference #_ #c p) == Ghost.hide Set.empty);\n assert (loc_disjoint_region_liveness_tags (loc_mreference p) l);\n // FIXME: WHY WHY WHY is this assert necessary?\n assert_spinoff (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_mreference p))) (Ghost.reveal (Loc?.aux l)));\n // FIXME: Now this one is too :)\n assert (loc_disjoint_addrs (loc_mreference p) l);\n assert ((loc_disjoint (loc_mreference p) l));\n mrefs t pre p\n in\n\n modifies_preserves_mreferences_intro l h h' aux;\n Classical.forall_intro_3 (fun t pre p -> Classical.move_requires (lives t pre) p);\n modifies_preserves_not_unused_in_intro l h h' (fun r n ->\n unused_ins r n\n );\n modifies_preserves_alocs_intro l h h' () (fun r a b ->\n loc_aux_disjoint_sym (Ghost.reveal (Loc?.aux l)) (Ghost.reveal (Loc?.aux (loc_of_aloc b)));\n alocs r a b\n )", "val addr_unused_in_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (HS.live_region h (fst ra) ==> snd ra `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` (fst ra))))\n (ensures (h `does_not_contain_addr` ra))", "val does_not_contain_addr_addr_unused_in\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (h `does_not_contain_addr` ra))\n (ensures (HS.live_region h (fst ra) ==> snd ra `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` (fst ra))))", "val free_does_not_contain_addr\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n HS.is_mm r /\\\n m `HS.contains` r /\\\n fst x == HS.frameOf r /\\\n snd x == HS.as_addr r\n ))\n (ensures (\n HS.free r m `does_not_contain_addr` x\n ))", "let modifies_intro #al #c l h h' regions mrefs lives unused_ins alocs =\n modifies_intro_strong l h h'\n regions\n mrefs\n lives\n (fun r n -> unused_ins r n)\n alocs", "val does_not_contain_addr_elim\n (#a: Type0)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel)\n (m: HS.mem)\n (x: HS.rid * nat)\n: Lemma\n (requires (\n m `does_not_contain_addr` x /\\\n HS.frameOf r == fst x /\\\n HS.as_addr r == snd x\n ))\n (ensures (~ (m `HS.contains` r)))", "let modifies_none_intro #al #c h h' regions mrefs unused_ins =\n modifies_intro_strong #_ #c loc_none h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> mrefs t pre b)\n (fun r n -> unused_ins r n)\n (fun r a x ->\n c.same_mreference_aloc_preserved x h h' (fun t pre b -> mrefs t pre b)\n )", "let modifies_address_intro #al #c r n h h' regions mrefs unused_ins =\n Classical.forall_intro (Classical.move_requires regions);\n let l : loc c = loc_addresses #_ #c false r (Set.singleton n) in\n modifies_preserves_mreferences_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_livenesses_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_not_unused_in_intro l h h'\n (fun r n -> unused_ins r n)\n ;\n modifies_preserves_alocs_intro l h h' ()\n (fun r a b ->\n c.same_mreference_aloc_preserved b h h' (fun t pre p -> mrefs t pre p)\n )", "val loc_not_unused_in (#al: aloc_t) (c: cls al) (h: HS.mem) : GTot (loc c)", "val loc_unused_in (#al: aloc_t) (c: cls al) (h: HS.mem) : GTot (loc c)", "val loc_regions_unused_in (#al: aloc_t) (c: cls al) (h: HS.mem) (rs: Set.set HS.rid) : Lemma\n (requires (forall r . Set.mem r rs ==> (~ (HS.live_region h r))))\n (ensures (loc_unused_in c h `loc_includes` loc_regions false rs))", "val loc_addresses_unused_in (#al: aloc_t) (c: cls al) (r: HS.rid) (a: Set.set nat) (h: HS.mem) : Lemma\n (requires (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x)))\n (ensures (loc_unused_in c h `loc_includes` loc_addresses false r a))", "val loc_addresses_not_unused_in (#al: aloc_t) (c: cls al) (r: HS.rid) (a: Set.set nat) (h: HS.mem) : Lemma\n (requires (forall x . Set.mem x a ==> ~ (h `does_not_contain_addr` (r, x))))\n (ensures (loc_not_unused_in c h `loc_includes` loc_addresses false r a))", "let modifies_aloc_intro #al #c #r #n x h h' regions mrefs livenesses unused_ins alocs =\n modifies_intro_strong #_ #c (loc_of_aloc x) h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> livenesses t pre b)\n (fun r n -> unused_ins r n)\n (fun r' n' z ->\n if r' = r && n' = n\n then begin\n loc_disjoint_aloc_elim #_ #c z x;\n alocs z\n end else\n c.same_mreference_aloc_preserved z h h' (fun t pre p ->\n mrefs t pre p\n )\n )", "val loc_unused_in_not_unused_in_disjoint (#al: aloc_t) (c: cls al) (h: HS.mem) : Lemma\n (loc_unused_in c h `loc_disjoint` loc_not_unused_in c h)", "val not_live_region_loc_not_unused_in_disjoint\n (#al: aloc_t)\n (c: cls al)\n (h0: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (~ (HS.live_region h0 r)))\n (ensures (loc_disjoint (loc_region_only false r) (loc_not_unused_in c h0)))", "val modifies_address_liveness_insensitive_unused_in\n (#al: aloc_t)\n (c: cls al)\n (h h' : HS.mem)\n: Lemma\n (requires (modifies (address_liveness_insensitive_locs c) h h'))\n (ensures (loc_not_unused_in c h' `loc_includes` loc_not_unused_in c h /\\ loc_unused_in c h `loc_includes` loc_unused_in c h'))", "let modifies_live_region #al #c s h1 h2 r = ()", "let modifies_mreference_elim #al #c #t #pre b p h h' = ()", "let modifies_aloc_elim #al #c #r #a b p h h' = ()", "val modifies_only_not_unused_in\n (#al: aloc_t)\n (#c: cls al)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (modifies (loc_unused_in c h `loc_union` l) h h'))\n (ensures (modifies l h h'))", "let modifies_refl #al #c s h =\n Classical.forall_intro_3 (fun r a b -> c.aloc_preserved_refl #r #a b h)", "let modifies_loc_includes #al #c s1 h h' s2 =\n assert (modifies_preserves_mreferences s1 h h');\n Classical.forall_intro_2 (loc_aux_disjoint_sym #al #c);\n Classical.forall_intro_3 (fun l1 l2 l3 -> Classical.move_requires (loc_aux_disjoint_loc_aux_includes #al #c l1 l2) l3);\n assert (modifies_preserves_alocs s1 h h')", "let modifies_only_live_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\n= loc_addresses_unused_in c r a h;\n loc_includes_refl l;\n loc_includes_union_l (loc_unused_in c h) l l;\n loc_includes_union_l (loc_unused_in c h) l (loc_addresses false r a);\n loc_includes_union_r (loc_union (loc_unused_in c h) l) (loc_addresses false r a) l;\n modifies_loc_includes (loc_union (loc_unused_in c h) l) h h' (loc_union (loc_addresses false r a) l);\n modifies_only_not_unused_in l h h'", "let modifies_preserves_liveness #al #c s1 s2 h h' #t #pre r = ()", "let modifies_preserves_liveness_strong #al #c s1 s2 h h' #t #pre r x =\n let rg = HS.frameOf r in\n let ad = HS.as_addr r in\n let la = loc_of_aloc #_ #c #rg #ad x in\n if Set.mem rg (regions_of_loc s2)\n then begin\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` Loc?.non_live_addrs (address_liveness_insensitive_locs c) rg);\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` GSet.empty);\n assert (~ (GSet.mem ad (Loc?.non_live_addrs s2 rg)));\n if Set.mem rg (regions_of_loc s1)\n then begin\n if GSet.mem ad (Loc?.non_live_addrs s1 rg)\n then begin\n assert (loc_disjoint_aux s1 la);\n assert (GSet.subset (Loc?.non_live_addrs s1 rg) (Loc?.live_addrs s1 rg));\n assert (aloc_domain c (Loc?.regions s1) (Loc?.live_addrs s1) `GSet.subset` (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad None) (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad (Some x)) (Ghost.reveal (Loc?.aux la)));\n assert (aloc_disjoint (ALoc rg ad None) (ALoc #_ #c rg ad (Some x)));\n ()\n end else ()\n end else ()\n end else ()", "val mreference_live_loc_not_unused_in\n (#al: aloc_t)\n (c: cls al)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (h: HS.mem)\n (r: HS.mreference t pre)\n: Lemma\n (requires (h `HS.contains` r))\n (ensures (loc_not_unused_in c h `loc_includes` loc_freed_mreference r /\\ loc_not_unused_in c h `loc_includes` loc_mreference r))", "let modifies_preserves_region_liveness #al #c l1 l2 h h' r = ()", "let modifies_preserves_region_liveness_reference #al #c l1 l2 h h' #t #pre r = ()" ], "closest": [ "val modifies_liveness_insensitive_region\n (l1 l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_region_only false x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\nlet modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val modifies_liveness_insensitive_region\n (l1 l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_region_only false x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' x)];\n ]]\nlet modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val modifies_liveness_insensitive_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\nlet modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions = MG.modifies_only_live_regions", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions = MG.modifies_only_live_regions", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions = MG.modifies_only_live_regions", "val modifies_liveness_insensitive_region_buffer\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_buffer x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\nlet modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x =\n MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x)", "val modifies_only_live_addresses\n (#aloc: aloc_t)\n (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h h': HS.mem)\n : Lemma\n (requires\n (modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x. Set.mem x a ==> h `does_not_contain_addr` (r, x)))) (ensures (modifies l h h'))\nlet modifies_only_live_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\n= loc_addresses_unused_in c r a h;\n loc_includes_refl l;\n loc_includes_union_l (loc_unused_in c h) l l;\n loc_includes_union_l (loc_unused_in c h) l (loc_addresses false r a);\n loc_includes_union_r (loc_union (loc_unused_in c h) l) (loc_addresses false r a) l;\n modifies_loc_includes (loc_union (loc_unused_in c h) l) h h' (loc_union (loc_addresses false r a) l);\n modifies_only_not_unused_in l h h'", "val modifies_live_region\n (s: loc)\n (h1 h2: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (modifies s h1 h2 /\\ loc_disjoint s (loc_region_only false r) /\\ HS.live_region h1 r))\n (ensures (HS.live_region h2 r))\n [SMTPatOr [\n [SMTPat (modifies s h1 h2); SMTPat (HS.live_region h1 r)];\n [SMTPat (modifies s h1 h2); SMTPat (HS.live_region h2 r)];\n ]]\nlet modifies_live_region = MG.modifies_live_region", "val modifies_liveness_insensitive_region_mreference_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_mreference_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma (requires (modifies l2 h h' /\\\n region_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\n = modifies_liveness_insensitive_region_mreference loc_none l2 h h' x", "val modifies_liveness_insensitive_region_mreference_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_mreference_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\n= modifies_liveness_insensitive_region_mreference loc_none l2 h h' x", "val modifies_liveness_insensitive_region_weak (l2: loc) (h h': HS.mem) (x: HS.rid)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h x))\n (ensures (HS.live_region h' x))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)]\n ]\n ]\nlet modifies_liveness_insensitive_region_weak\n (l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)];\n ]]\n= modifies_liveness_insensitive_region loc_none l2 h h' x", "val modifies_liveness_insensitive_region_weak (l2: loc) (h h': HS.mem) (x: HS.rid)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h x))\n (ensures (HS.live_region h' x))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)]\n ]\n ]\nlet modifies_liveness_insensitive_region_weak\n (l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)];\n ]]\n= modifies_liveness_insensitive_region loc_none l2 h h' x", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_regions (Set.singleton r)) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses r a) l) h1 h2))\nlet modifies_loc_addresses_intro r a l h1 h2 =\n MG.modifies_loc_addresses_intro r a l h1 h2;\n MG.loc_includes_addresses_addresses #_ cls false true r a a;\n MG.loc_includes_refl l;\n MG.loc_includes_union_l (loc_addresses r a) l l;\n MG.loc_includes_union_l (loc_addresses r a) l (MG.loc_addresses true r a);\n MG.loc_includes_union_r (loc_union (loc_addresses r a) l) (MG.loc_addresses true r a) l;\n MG.modifies_loc_includes (loc_union (loc_addresses r a) l) h1 h2 (loc_union (MG.loc_addresses true r a) l)", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro #_ #cls", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro", "val modifies_liveness_insensitive_region_buffer_weak\n (l2: loc)\n (h h': HS.mem)\n (#a: Type0)\n (#rrel #rel: srel a)\n (x: mbuffer a rrel rel)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_buffer_weak\n (l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies l2 h h' /\\\n region_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (frameOf x))];\n ]]\n = modifies_liveness_insensitive_region_buffer loc_none l2 h h' x", "val modifies_liveness_insensitive_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n ]]\nlet modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness", "val modifies_liveness_insensitive_region_buffer\n (l1 l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_buffer x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' (frameOf x))];\n ]]\nlet modifies_liveness_insensitive_region_buffer l1 l2 h h' #_ #_ #_ x =\n if g_is_null x then ()\n else MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(frameOf x) #(as_addr x) (ubuffer_of_buffer x)", "val modifies_liveness_insensitive_region_buffer_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (x: B.buffer t)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (B.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (B.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_buffer_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (B.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (B.frameOf x))];\n ]]\n= modifies_liveness_insensitive_region_buffer loc_none l2 h h' x", "val modifies_liveness_insensitive_buffer\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_buffer x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ B.live h x))\n (ensures (B.live h' x))\nlet modifies_liveness_insensitive_buffer l1 l2 h h' #t x =\n MG.modifies_preserves_liveness_strong l1 l2 h h' (B.content x) (LocBuffer x)", "val modifies_loc_regions_intro\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions rs) h1 h2))\nlet modifies_loc_regions_intro rs h1 h2 =\n MG.modifies_loc_regions_intro #_ #cls rs h1 h2;\n MG.loc_includes_region_region #_ #cls false true rs rs;\n MG.modifies_loc_includes (loc_regions rs) h1 h2 (MG.loc_regions true rs)", "val modifies_only_live_addresses\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_addresses = MG.modifies_only_live_addresses", "val modifies_only_live_addresses\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_addresses false r a) l) h h' /\\\n (forall x . Set.mem x a ==> h `does_not_contain_addr` (r, x))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_addresses = MG.modifies_only_live_addresses", "val modifies_loc_regions_intro\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions true rs) h1 h2))\nlet modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls", "val modifies_loc_regions_intro\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions true rs) h1 h2))\nlet modifies_loc_regions_intro = MG.modifies_loc_regions_intro #_ #cls", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n= modifies_liveness_insensitive_mreference loc_none l h h' x", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma (requires (modifies l h h' /\\\n address_liveness_insensitive_locs `loc_includes` l /\\\n\t\t h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n = modifies_liveness_insensitive_mreference loc_none l h h' x", "val loc_all_regions_from (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_all_regions_from\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (HS.mod_set (Set.singleton r))", "val loc_region_only (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_region_only\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (Set.singleton r)", "val modifies_address_liveness_insensitive_unused_in\n (h h' : HS.mem)\n: Lemma\n (requires (modifies (address_liveness_insensitive_locs) h h'))\n (ensures (loc_not_unused_in h' `loc_includes` loc_not_unused_in h /\\ loc_unused_in h `loc_includes` loc_unused_in h'))\nlet modifies_address_liveness_insensitive_unused_in =\n MG.modifies_address_liveness_insensitive_unused_in cls", "val modifies_only_not_unused_in\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (modifies (loc_union (loc_unused_in h) l) h h'))\n (ensures (modifies l h h'))\nlet modifies_only_not_unused_in = MG.modifies_only_not_unused_in", "val preserved (x: t) (l: B.loc) (h h': HS.mem)\n : Lemma (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures\n (live x h' /\\ get_remaining x h' == get_remaining x h /\\ get_read x h' == get_read x h))\nlet preserved\n (x: t)\n (l: B.loc)\n (h: HS.mem)\n (h' : HS.mem)\n: Lemma\n (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures (\n live x h' /\\\n get_remaining x h' == get_remaining x h /\\\n get_read x h' == get_read x h\n ))\n=\n Aux.preserved x.Aux.base l h h'", "val modifies_liveness_insensitive_buffer\n (l1 l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies (loc_union l1 l2) h h' /\\\n loc_disjoint l1 (loc_buffer x) /\\\n\t\t address_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t live h x))\n (ensures (live h' x))\n [SMTPatOr [\n [SMTPat (live h x); SMTPat (modifies (loc_union l1 l2) h h');];\n [SMTPat (live h' x); SMTPat (modifies (loc_union l1 l2) h h');];\n ]]\nlet modifies_liveness_insensitive_buffer l1 l2 h h' #_ #_ #_ x =\n if g_is_null x then ()\n else\n liveness_preservation_intro h h' x (fun t' pre r ->\n MG.modifies_preserves_liveness_strong l1 l2 h h' r (ubuffer_of_buffer x))", "val modifies_trans\n (s12: loc)\n (h1 h2: HS.mem)\n (s23: loc)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\nlet modifies_trans = MG.modifies_trans", "val modifies_liveness_insensitive_buffer_weak\n (l: loc)\n (h h': HS.mem)\n (#a: Type0)\n (#rrel #rel: srel a)\n (x: mbuffer a rrel rel)\n : Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ live h x))\n (ensures (live h' x))\n [\n SMTPatOr\n [\n [SMTPat (live h x); SMTPat (modifies l h h')];\n [SMTPat (live h' x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_buffer_weak\n (l:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ live h x))\n (ensures (live h' x))\n [SMTPatOr [\n [SMTPat (live h x); SMTPat (modifies l h h');];\n [SMTPat (live h' x); SMTPat (modifies l h h');];\n ]]\n = modifies_liveness_insensitive_buffer loc_none l h h' x", "val not_live_region_loc_not_unused_in_disjoint\n (h0: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (~ (HS.live_region h0 r)))\n (ensures (loc_disjoint (loc_region_only false r) (loc_not_unused_in h0)))\nlet not_live_region_loc_not_unused_in_disjoint = MG.not_live_region_loc_not_unused_in_disjoint cls", "val modifies_ralloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (i: HS.rid)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HST.is_eternal_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.ralloc_post i init h x h'))\n (ensures (modifies loc_none h h'))\nlet modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls", "val modifies_loc_unused_in\n (l: loc)\n (h1 h2: HS.mem)\n (l' : loc)\n: Lemma\n (requires (\n modifies l h1 h2 /\\\n address_liveness_insensitive_locs `loc_includes` l /\\\n loc_unused_in h2 `loc_includes` l'\n ))\n (ensures (loc_unused_in h1 `loc_includes` l'))\n [SMTPatOr [\n [SMTPat (modifies l h1 h2); SMTPat (loc_unused_in h2 `loc_includes` l')];\n [SMTPat (modifies l h1 h2); SMTPat (loc_unused_in h1 `loc_includes` l')];\n ]]\nlet modifies_loc_unused_in l h1 h2 l' =\n modifies_loc_includes address_liveness_insensitive_locs h1 h2 l;\n modifies_address_liveness_insensitive_unused_in h1 h2;\n loc_includes_trans (loc_unused_in h1) (loc_unused_in h2) l'", "val modifies_salloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies loc_none h h'))\nlet modifies_salloc_post = MG.modifies_salloc_post #_ #cls", "val modifies_0_modifies\n (h1 h2: HS.mem)\n: Lemma\n (requires (modifies_0 h1 h2))\n (ensures (modifies loc_none h1 h2))\nlet modifies_0_modifies h1 h2 =\n MG.modifies_none_intro #_ #cls h1 h2\n (fun r -> modifies_0_live_region h1 h2 r)\n (fun t pre b -> modifies_0_mreference #t #pre h1 h2 b)\n (fun r n -> modifies_0_unused_in h1 h2 r n)", "val insert_modifies_union_loc_weakening:\n l1:loc -> l2:loc -> l3:loc -> h0:HS.mem -> h1:HS.mem ->\n Lemma (requires (modifies l1 h0 h1))\n (ensures (modifies (loc_union (loc_union l1 l2) l3) h0 h1))\nlet insert_modifies_union_loc_weakening l1 l2 l3 h0 h1 =\n B.loc_includes_union_l l1 l2 l1;\n B.loc_includes_union_l (loc_union l1 l2) l3 (loc_union l1 l2)", "val loc_regions_unused_in (h: HS.mem) (rs: Set.set HS.rid) : Lemma\n (requires (forall r . Set.mem r rs ==> (~ (HS.live_region h r))))\n (ensures (loc_unused_in h `loc_includes` loc_regions false rs))\nlet loc_regions_unused_in = MG.loc_regions_unused_in cls", "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\nlet modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped", "val modifies_liveness_insensitive_buffer_weak (l: loc) (h h': HS.mem) (#t: Type) (x: B.buffer t)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ B.live h x))\n (ensures (B.live h' x))\n [\n SMTPatOr\n [\n [SMTPat (B.live h x); SMTPat (modifies l h h')];\n [SMTPat (B.live h' x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_buffer_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ B.live h x))\n (ensures (B.live h' x))\n [SMTPatOr [\n [SMTPat (B.live h x); SMTPat (modifies l h h');];\n [SMTPat (B.live h' x); SMTPat (modifies l h h');];\n ]]\n= modifies_liveness_insensitive_buffer loc_none l h h' x", "val liveness_preservation_intro (#a:Type0) (#rrel:srel a) (#rel:srel a)\n (h h':HS.mem) (b:mbuffer a rrel rel)\n (f: (\n (t':Type0) ->\n (pre: Preorder.preorder t') ->\n (r: HS.mreference t' pre) ->\n Lemma\n (requires (HS.frameOf r == frameOf b /\\ HS.as_addr r == as_addr b /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\n ))\n :Lemma (requires (live h b)) (ensures (live h' b))\nlet liveness_preservation_intro #_ #_ #_ _ _ b f =\n if Null? b\n then ()\n else f _ _ (Buffer?.content b)", "val old_to_new_modifies (old_l: OldM.loc) (new_l: NewM.loc) (h h': HS.mem)\n : Lemma\n (requires (OldM.modifies old_l h h' /\\ old_to_union_loc old_l == new_to_union_loc new_l))\n (ensures (NewM.modifies new_l h h'))\nlet old_to_new_modifies (old_l: OldM.loc) (new_l: NewM.loc) (h h' : HS.mem) : Lemma\n (requires (OldM.modifies old_l h h' /\\ old_to_union_loc old_l == new_to_union_loc new_l))\n (ensures (NewM.modifies new_l h h'))\n= OldM.modifies_to_cloc old_l h h';\n M.modifies_union_loc_of_loc old_and_new_cl false (OldM.cloc_of_loc old_l) h h';\n M.modifies_union_loc_of_loc old_and_new_cl true (M.raise_loc (NewM.cloc_of_loc new_l)) h h';\n M.modifies_raise_loc (NewM.cloc_of_loc new_l) h h';\n NewM.modifies_to_cloc new_l h h'", "val union_loc_to_new_regions (preserve_liveness: bool) (r: Set.set HS.rid)\n : Lemma\n (union_loc_to_new (M.loc_regions preserve_liveness r) == NewM.loc_regions preserve_liveness r)\n [SMTPat (union_loc_to_new (M.loc_regions preserve_liveness r))]\nlet union_loc_to_new_regions (preserve_liveness: bool) (r: Set.set HS.rid) : Lemma\n (union_loc_to_new (M.loc_regions preserve_liveness r) == NewM.loc_regions preserve_liveness r)\n [SMTPat (union_loc_to_new (M.loc_regions preserve_liveness r))]\n= M.loc_of_union_loc_regions old_and_new_cl true preserve_liveness r;\n M.lower_loc_regions u#0 u#0 #_ #NewM.cloc_cls preserve_liveness r;\n NewM.cloc_of_loc_regions preserve_liveness r;\n NewM.cloc_of_loc_of_cloc (M.loc_regions preserve_liveness r)", "val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\n [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]\nlet no_upd_fresh_region = MG.no_upd_fresh_region", "val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\n [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]\nlet no_upd_fresh_region = MG.no_upd_fresh_region", "val modifies_fresh_frame_popped'\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_regions (Set.singleton (HS.get_tip h1))) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\nlet modifies_fresh_frame_popped' h0 h1 s h2 h3 =\n modifies_fresh_frame_popped h0 h1 s h2 h3", "val old_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid)\n : Lemma\n (old_to_union_loc (OldM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (old_to_union_loc (OldM.loc_regions preserve_liveness r))]\nlet old_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid) : Lemma\n (old_to_union_loc (OldM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (old_to_union_loc (OldM.loc_regions preserve_liveness r))]\n= OldM.cloc_of_loc_regions preserve_liveness r;\n M.union_loc_of_loc_regions old_and_new_cl false preserve_liveness r", "val modifies_1_preserves_livenesses\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_livenesses (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n : GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre). h1 `HS.contains` r' ==> h2 `HS.contains` r'", "val loc_includes_region_union_l\n (preserve_liveness: bool)\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))\n [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l", "val loc_includes_region_union_l\n (preserve_liveness: bool)\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))\n [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l", "val modifies_none_modifies\n (h1 h2: HS.mem)\n: Lemma\n (requires (HST.modifies_none h1 h2))\n (ensures (modifies loc_none h1 h2))\nlet modifies_none_modifies = MG.modifies_none_modifies #_ #cls", "val modifies_salloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies loc_none h h'))\n [SMTPat (HST.salloc_post init h x h')]\nlet modifies_salloc_post = MG.modifies_salloc_post #_ #cls", "val modifies_trans\n (s12: loc)\n (h1 h2: HS.mem)\n (s23: loc)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\n [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]\nlet modifies_trans = MG.modifies_trans", "val modifies_trans\n (s12: loc)\n (h1 h2: HS.mem)\n (s23: loc)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\n [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]\nlet modifies_trans = MG.modifies_trans", "val modifies_remove_new_locs (l_fresh l_aux l_goal:loc) (h1 h2 h3:HS.mem)\n : Lemma (requires (fresh_loc l_fresh h1 h2 /\\\n modifies l_aux h1 h2 /\\\n\t\t l_goal `loc_includes` l_aux /\\\n modifies (loc_union l_fresh l_goal) h2 h3))\n (ensures (modifies l_goal h1 h3))\n\t [SMTPat (fresh_loc l_fresh h1 h2);\n\t SMTPat (modifies l_aux h1 h2);\n\t SMTPat (modifies l_goal h1 h3)]\nlet modifies_remove_new_locs l_fresh l_aux l_goal h1 h2 h3 =\n modifies_only_not_unused_in l_goal h1 h3", "val lemma_upd (#a: Type) (h: mem) (x: reference a {live_region h (HS.frameOf x)}) (v: a)\n : Lemma (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\nlet lemma_upd (#a:Type) (h:mem) (x:reference a{live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\n = let m = HS.get_hmap h in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')", "val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\nlet modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs", "val modifies_trans (s12:loc) (h1 h2:vale_heap) (s23:loc) (h3:vale_heap) : Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\nlet modifies_trans s12 h1 h2 s23 h3 = M.modifies_trans s12 (_ih h1).hs (_ih h2).hs s23 (_ih h3).hs", "val not_live_region_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (~ (HS.live_region h (fst ra))))\n (ensures (h `does_not_contain_addr` ra))\nlet not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr", "val not_live_region_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (~ (HS.live_region h (fst ra))))\n (ensures (h `does_not_contain_addr` ra))\nlet not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr", "val modifies_remove_fresh_frame (h1 h2 h3: HS.mem) (l: loc)\n : Lemma\n (requires\n (HS.fresh_frame h1 h2 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h2)) l) h2 h3))\n (ensures (modifies l h1 h3))\n [SMTPat (modifies l h1 h3); SMTPat (HS.fresh_frame h1 h2)]\nlet modifies_remove_fresh_frame (h1 h2 h3:HS.mem) (l:loc)\n : Lemma (requires (HS.fresh_frame h1 h2 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h2)) l) h2 h3))\n (ensures (modifies l h1 h3))\n\t [SMTPat (modifies l h1 h3); SMTPat (HS.fresh_frame h1 h2)]\n = loc_regions_unused_in h1 (HS.mod_set (Set.singleton (HS.get_tip h2)));\n modifies_only_not_unused_in l h1 h3", "val loc_includes_region_addresses\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]\nlet loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls", "val loc_includes_region_addresses\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]\nlet loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls", "val modifies_ralloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (i: HS.rid)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel)\n (h' : HS.mem)\n: Lemma\n (requires (HST.ralloc_post i init h x h'))\n (ensures (modifies loc_none h h'))\n [SMTPat (HST.ralloc_post i init h x h')]\nlet modifies_ralloc_post = MG.modifies_ralloc_post #_ #cls", "val modifies_loc_buffer_from_to_intro\n (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel)\n (from to: U32.t)\n (l: loc) (h h' : HS.mem)\n: Lemma\n (requires (\n let s = as_seq h b in\n let s' = as_seq h' b in\n live h b /\\\n modifies (loc_union l (loc_buffer b)) h h' /\\\n U32.v from <= U32.v to /\\\n U32.v to <= length b /\\\n Seq.slice s 0 (U32.v from) `Seq.equal` Seq.slice s' 0 (U32.v from) /\\\n Seq.slice s (U32.v to) (length b) `Seq.equal` Seq.slice s' (U32.v to) (length b)\n ))\n (ensures (modifies (loc_union l (loc_buffer_from_to b from to)) h h'))\nlet modifies_loc_buffer_from_to_intro #a #rrel #rel b from to l h h' =\n if g_is_null b\n then ()\n else modifies_loc_buffer_from_to_intro' b from to l h h'", "val modifies_loc_buffer_from_to_intro'\n (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel)\n (from to: U32.t)\n (l: loc) (h h' : HS.mem)\n: Lemma\n (requires (\n let s = as_seq h b in\n let s' = as_seq h' b in\n not (g_is_null b) /\\\n live h b /\\\n modifies (loc_union l (loc_buffer b)) h h' /\\\n U32.v from <= U32.v to /\\\n U32.v to <= length b /\\\n Seq.slice s 0 (U32.v from) `Seq.equal` Seq.slice s' 0 (U32.v from) /\\\n Seq.slice s (U32.v to) (length b) `Seq.equal` Seq.slice s' (U32.v to) (length b)\n ))\n (ensures (modifies (loc_union l (loc_buffer_from_to b from to)) h h'))\nlet modifies_loc_buffer_from_to_intro' #a #rrel #rel b from to l h h' =\n let r0 = frameOf b in\n let a0 = as_addr b in\n let bb : ubuffer r0 a0 = ubuffer_of_buffer b in\n modifies_loc_includes (loc_union l (loc_addresses true r0 (Set.singleton a0))) h h' (loc_union l (loc_buffer b));\n MG.modifies_strengthen l #r0 #a0 (ubuffer_of_buffer_from_to b from to) h h' (fun f (x: ubuffer r0 a0) ->\n ubuffer_preserved_intro x h h'\n (fun t' rrel' rel' b' -> f _ _ (Buffer?.content b'))\n (fun t' rrel' rel' b' ->\n // prove that the types, rrels, rels are equal\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n assert (Seq.seq t' == Seq.seq a);\n let _s0 : Seq.seq a = as_seq h b in\n let _s1 : Seq.seq t' = coerce_eq _ _s0 in\n lemma_equal_instances_implies_equal_types a t' _s0 _s1;\n let boff = U32.v (Buffer?.idx b) in\n let from_ = boff + U32.v from in\n let to_ = boff + U32.v to in\n let ({ b_max_length = ml; b_offset = xoff; b_length = xlen; b_is_mm = is_mm }) = Ghost.reveal x in\n let ({ b_max_length = _; b_offset = b'off; b_length = b'len }) = Ghost.reveal (ubuffer_of_buffer b') in\n let bh = as_seq h b in\n let bh' = as_seq h' b in\n let xh = Seq.slice (as_seq h b') (xoff - b'off) (xoff - b'off + xlen) in\n let xh' = Seq.slice (as_seq h' b') (xoff - b'off) (xoff - b'off + xlen) in\n let prf (i: nat) : Lemma\n (requires (i < xlen))\n (ensures (i < xlen /\\ Seq.index xh i == Seq.index xh' i))\n = let xi = xoff + i in\n let bi : ubuffer r0 a0 =\n Ghost.hide ({ b_max_length = ml; b_offset = xi; b_length = 1; b_is_mm = is_mm; })\n in\n assert (Seq.index xh i == Seq.index (Seq.slice (as_seq h b') (xi - b'off) (xi - b'off + 1)) 0);\n assert (Seq.index xh' i == Seq.index (Seq.slice (as_seq h' b') (xi - b'off) (xi - b'off + 1)) 0);\n let li = MG.loc_of_aloc bi in\n MG.loc_includes_aloc #_ #cls x bi;\n loc_disjoint_includes l (MG.loc_of_aloc x) l li;\n if xi < boff || boff + length b <= xi\n then begin\n MG.loc_disjoint_aloc_intro #_ #cls bb bi;\n assert (loc_disjoint (loc_union l (loc_buffer b)) li);\n MG.modifies_aloc_elim bi (loc_union l (loc_buffer b)) h h'\n end else\n if xi < from_\n then begin\n assert (Seq.index xh i == Seq.index (Seq.slice bh 0 (U32.v from)) (xi - boff));\n assert (Seq.index xh' i == Seq.index (Seq.slice bh' 0 (U32.v from)) (xi - boff))\n end else begin\n assert (to_ <= xi);\n assert (Seq.index xh i == Seq.index (Seq.slice bh (U32.v to) (length b)) (xi - to_));\n assert (Seq.index xh' i == Seq.index (Seq.slice bh' (U32.v to) (length b)) (xi - to_))\n end\n in\n Classical.forall_intro (Classical.move_requires prf);\n assert (xh `Seq.equal` xh')\n )\n )", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val modifies_only_not_unused_in (l: loc) (h h': HS.mem)\n : Lemma (requires (let open B in modifies (loc_union (loc_unused_in h) l) h h'))\n (ensures (let open B in modifies l h h'))\n [SMTPat B.((modifies l h h'))]\nlet modifies_only_not_unused_in\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (B.(modifies (loc_union (loc_unused_in h) l) h h')))\n (ensures (B.(modifies l h h')))\n [SMTPat B.((modifies l h h'))]\n= B.modifies_only_not_unused_in l h h'", "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_regions (HS.mod_set (Set.singleton (HS.get_tip h1)))) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\n [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]\nlet modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped", "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\n [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]\nlet modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped", "val modifies_reference_elim\n (#t: Type0)\n (b: HS.reference t)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_addresses (HS.frameOf b) (Set.singleton (HS.as_addr b))) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_reference_elim #t b p h h' =\n MG.loc_includes_addresses_addresses #_ cls false true (HS.frameOf b) (Set.singleton (HS.as_addr b)) (Set.singleton (HS.as_addr b));\n MG.loc_includes_refl p;\n MG.loc_disjoint_includes (MG.loc_freed_mreference b) p (MG.loc_mreference b) p;\n MG.modifies_mreference_elim b p h h'", "val loc_includes_addresses_addresses\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (s1 s2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))\nlet loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses cls", "val loc_includes_addresses_addresses\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (s1 s2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))\nlet loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls", "val new_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid)\n : Lemma\n (new_to_union_loc (NewM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (new_to_union_loc (NewM.loc_regions preserve_liveness r))]\nlet new_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid) : Lemma\n (new_to_union_loc (NewM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (new_to_union_loc (NewM.loc_regions preserve_liveness r))]\n= NewM.cloc_of_loc_regions preserve_liveness r;\n M.raise_loc_regions u#0 u#0 #_ #NewM.cloc_cls preserve_liveness r;\n M.union_loc_of_loc_regions old_and_new_cl true preserve_liveness r", "val popped_modifies (h0 h1: HS.mem) : Lemma\n (requires (HS.popped h0 h1))\n (ensures (modifies (loc_region_only false (HS.get_tip h0)) h0 h1))\n [SMTPat (HS.popped h0 h1)]\nlet popped_modifies = MG.popped_modifies #_ cls", "val lemma_heap_equality_commute_distinct_upds\n (#a:Type) (#b:Type) (#rel_a:preorder a) (#rel_b:preorder b)\n (h:mem) (r1:mreference a rel_a) (r2:mreference b rel_b) (x:a) (y:b)\n :Lemma (requires (as_addr r1 =!= as_addr r2 /\\ live_region h (frameOf r1) /\\ live_region h (frameOf r2)))\n (ensures (upd (upd h r1 x) r2 y == upd (upd h r2 y) r1 x))\nlet lemma_heap_equality_commute_distinct_upds #_ #_ #_ #_ h r1 r2 x y =\n let h0 = upd (upd h r1 x) r2 y in\n let h1 = upd (upd h r2 y) r1 x in\n if frameOf r1 = frameOf r2 then Heap.lemma_heap_equality_commute_distinct_upds (Map.sel h.h (frameOf r1)) (as_ref r1) (as_ref r2) x y;\n assert (Map.equal h0.h h1.h)", "val push: (#a: Type) -> (r: HS.rid) -> (n: G.erased (list a)) -> (pl: B.pointer (t a)) -> (x: a) ->\n ST unit\n (requires (fun h ->\n let l = B.deref h pl in\n B.live h pl /\\\n well_formed h l n /\\\n invariant h l n /\\\n ST.is_eternal_region r /\\\n B.(loc_includes (loc_region_only true r) (footprint h l n)) /\\\n B.(loc_disjoint (loc_buffer pl) (loc_region_only true r))\n ))\n (ensures (fun h0 _ h1 ->\n let n' = G.hide (x :: G.reveal n) in\n let l = B.deref h1 pl in\n // Style note: I don't repeat ``B.live pl`` in the post-condition since\n // ``B.modifies (loc_buffer pl) h0 h1`` implies that ``B.live h1 pl``.\n B.modifies (B.loc_buffer pl) h0 h1 /\\\n well_formed h1 l n' /\\\n invariant h1 l n' /\\\n B.(loc_includes (loc_region_only true r) (footprint h1 l n') /\\\n Cons? (cells h1 l n') /\\ List.Tot.tail (cells h1 l n') == cells h0 (B.deref h0 pl) n /\\\n B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 l n'))) h0 h1)\n ))\nlet push #a r n pl x =\n (**) let h0 = ST.get () in\n let l = !* pl in\n let c = { data = x; next = l } in\n\n let pc: B.pointer (cell a) = B.malloc r c 1ul in\n (**) let h1 = ST.get () in\n (**) B.(modifies_only_not_unused_in loc_none h0 h1);\n (**) assert B.(loc_disjoint (loc_buffer pc) (footprint h0 l n));\n\n pl *= pc;\n (**) let h2 = ST.get () in\n (**) let n' = G.hide (x :: G.reveal n) in\n (**) B.(modifies_trans loc_none h0 h1 (loc_buffer pl) h2);\n (**) assert (well_formed h2 (B.deref h2 pl) n');\n (**) assert (invariant h2 (B.deref h2 pl) n');\n (**) assert ((B.deref h2 (B.deref h2 pl)).next == l);\n\n ()", "val old_to_union_loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat)\n : Lemma\n (old_to_union_loc (OldM.loc_addresses preserve_liveness r n) ==\n M.loc_addresses preserve_liveness r n)\n [SMTPat (old_to_union_loc (OldM.loc_addresses preserve_liveness r n))]\nlet old_to_union_loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : Lemma\n (old_to_union_loc (OldM.loc_addresses preserve_liveness r n) == M.loc_addresses preserve_liveness r n)\n [SMTPat (old_to_union_loc (OldM.loc_addresses preserve_liveness r n))]\n= OldM.cloc_of_loc_addresses preserve_liveness r n;\n M.union_loc_of_loc_addresses old_and_new_cl false preserve_liveness r n", "val modifies_mreference_elim\n (#t: Type)\n (#pre: Preorder.preorder t)\n (b: HS.mreference t pre)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_mreference b) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_mreference_elim = MG.modifies_mreference_elim", "val modifies_mreference_elim\n (#t: Type)\n (#pre: Preorder.preorder t)\n (b: HS.mreference t pre)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_mreference b) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]\nlet modifies_mreference_elim = MG.modifies_mreference_elim", "val modifies_free\n (#a: Type)\n (#rel: Preorder.preorder a)\n (r: HS.mreference a rel { HS.is_mm r } )\n (m: HS.mem { m `HS.contains` r } )\n: Lemma\n (modifies (loc_freed_mreference r) m (HS.free r m))\nlet modifies_free = MG.modifies_free #_ #cls", "val modifies_1_modifies\n (#a:Type0)(#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :Lemma (requires (modifies_1 b h1 h2))\n (ensures (modifies (loc_buffer b) h1 h2))\nlet modifies_1_modifies #t #_ #_ b h1 h2 =\n if g_is_null b\n then begin\n modifies_1_null b h1 h2;\n modifies_0_modifies h1 h2\n end else\n MG.modifies_intro (loc_buffer b) h1 h2\n (fun r -> modifies_1_live_region b h1 h2 r)\n (fun t pre p ->\n loc_disjoint_sym (loc_mreference p) (loc_buffer b);\n MG.loc_disjoint_aloc_addresses_elim #_ #cls #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) true (HS.frameOf p) (Set.singleton (HS.as_addr p));\n modifies_1_mreference b h1 h2 p\n )\n (fun t pre p ->\n modifies_1_liveness b h1 h2 p\n )\n (fun r n ->\n modifies_1_unused_in b h1 h2 r n\n )\n (fun r' a' b' ->\n loc_disjoint_sym (MG.loc_of_aloc b') (loc_buffer b);\n MG.loc_disjoint_aloc_elim #_ #cls #(frameOf b) #(as_addr b) #r' #a' (ubuffer_of_buffer b) b';\n if frameOf b = r' && as_addr b = a'\n then\n modifies_1_ubuffer #t b h1 h2 b'\n else\n same_mreference_ubuffer_preserved #r' #a' b' h1 h2\n (fun a_ pre_ r_ -> modifies_1_mreference b h1 h2 r_)\n )", "val modifies_trans_linear (l l_goal: loc) (h1 h2 h3: HS.mem)\n : Lemma (requires (modifies l h1 h2 /\\ modifies l_goal h2 h3 /\\ l_goal `loc_includes` l))\n (ensures (modifies l_goal h1 h3))\n [SMTPat (modifies l h1 h2); SMTPat (modifies l_goal h1 h3)]\nlet modifies_trans_linear (l l_goal:loc) (h1 h2 h3:HS.mem)\n : Lemma (requires (modifies l h1 h2 /\\ modifies l_goal h2 h3 /\\ l_goal `loc_includes` l))\n (ensures (modifies l_goal h1 h3))\n\t [SMTPat (modifies l h1 h2); SMTPat (modifies l_goal h1 h3)]\n = modifies_trans l h1 h2 l_goal h3", "val create_in: a:supported_alg -> r:HS.rid -> ST (state a)\n (requires fun _ -> is_eternal_region r)\n (ensures fun h0 st h1 ->\n B.modifies B.loc_none h0 h1 /\\\n B.fresh_loc (footprint st h1) h0 h1 /\\\n B.(loc_includes (loc_region_only true r) (footprint st h1)) /\\\n invariant st h1 /\\\n freeable st h1)\nlet create_in a r =\n let st =\n match a with\n | SHA1 -> SHA1_s (create_in SHA1 r)\n | SHA2_256 -> SHA2_256_s (create_in SHA2_256 r)\n | SHA2_384 -> SHA2_384_s (create_in SHA2_384 r)\n | SHA2_512 -> SHA2_512_s (create_in SHA2_512 r)\n in\n B.malloc r st 1ul", "val old_to_new_modifies' (old_l: OldM.loc) (h h': HS.mem)\n : Lemma\n (requires\n (OldM.modifies old_l h h' /\\\n new_to_union_loc (union_loc_to_new (old_to_union_loc old_l)) == old_to_union_loc old_l))\n (ensures (NewM.modifies (union_loc_to_new (old_to_union_loc old_l)) h h'))\n [SMTPat (OldM.modifies old_l h h')]\nlet old_to_new_modifies' (old_l: OldM.loc) (h h' : HS.mem) : Lemma\n (requires (OldM.modifies old_l h h' /\\ new_to_union_loc (union_loc_to_new (old_to_union_loc old_l)) == old_to_union_loc old_l))\n (ensures (NewM.modifies (union_loc_to_new (old_to_union_loc old_l)) h h'))\n [SMTPat (OldM.modifies old_l h h')]\n= old_to_new_modifies old_l (union_loc_to_new (old_to_union_loc old_l)) h h'", "val create_in: a:supported_alg -> r:HS.rid -> ST (state a)\n (requires fun _ -> is_eternal_region r)\n (ensures fun h0 st h1 ->\n B.modifies B.loc_none h0 h1 /\\\n B.fresh_loc (footprint st) h0 h1 /\\\n B.(loc_includes (loc_region_only true r)) (footprint st) /\\\n invariant st h1 /\\\n freeable st)\nlet create_in a r =\n let k:B.buffer uint8 =\n match a with\n | SHA1 -> B.malloc r (u8 0) (hash_len SHA1)\n | SHA2_256 -> B.malloc r (u8 0) (hash_len SHA2_256)\n | SHA2_384 -> B.malloc r (u8 0) (hash_len SHA2_384)\n | SHA2_512 -> B.malloc r (u8 0) (hash_len SHA2_512)\n in\n let v:B.buffer uint8 =\n match a with\n | SHA1 -> B.malloc r (u8 0) (hash_len SHA1)\n | SHA2_256 -> B.malloc r (u8 0) (hash_len SHA2_256)\n | SHA2_384 -> B.malloc r (u8 0) (hash_len SHA2_384)\n | SHA2_512 -> B.malloc r (u8 0) (hash_len SHA2_512)\n in\n let ctr:B.buffer size_t = B.malloc r 1ul 1ul in\n State k v ctr", "val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\nlet modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2", "val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\nlet modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2", "val modifies_1_from_to_modifies\n (#a:Type0)(#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (from to: U32.t) (h1 h2:HS.mem)\n :Lemma (requires (modifies_1_from_to b from to h1 h2))\n (ensures (modifies (loc_buffer_from_to b from to) h1 h2))\nlet modifies_1_from_to_modifies #t #_ #_ b from to h1 h2 =\n if ubuffer_of_buffer_from_to_none_cond b from to\n then begin\n modifies_0_modifies h1 h2\n end else\n MG.modifies_intro (loc_buffer_from_to b from to) h1 h2\n (fun r -> modifies_1_from_to_live_region b from to h1 h2 r)\n (fun t pre p ->\n loc_disjoint_sym (loc_mreference p) (loc_buffer_from_to b from to);\n MG.loc_disjoint_aloc_addresses_elim #_ #cls #(frameOf b) #(as_addr b) (ubuffer_of_buffer_from_to b from to) true (HS.frameOf p) (Set.singleton (HS.as_addr p));\n modifies_1_from_to_mreference b from to h1 h2 p\n )\n (fun t pre p ->\n modifies_1_from_to_liveness b from to h1 h2 p\n )\n (fun r n ->\n modifies_1_from_to_unused_in b from to h1 h2 r n\n )\n (fun r' a' b' ->\n loc_disjoint_sym (MG.loc_of_aloc b') (loc_buffer_from_to b from to);\n MG.loc_disjoint_aloc_elim #_ #cls #(frameOf b) #(as_addr b) #r' #a' (ubuffer_of_buffer_from_to b from to) b';\n if frameOf b = r' && as_addr b = a'\n then\n modifies_1_from_to_ubuffer #t b from to h1 h2 b'\n else\n same_mreference_ubuffer_preserved #r' #a' b' h1 h2\n (fun a_ pre_ r_ -> modifies_1_from_to_mreference b from to h1 h2 r_)\n )", "val includes_live (#a: typ) (h: HS.mem) (x y: buffer a)\n : Lemma (requires (x `includes` y /\\ live h x)) (ensures (live h y))\nlet includes_live\n (#a: typ)\n (h: HS.mem)\n (x y : buffer a)\n: Lemma\n (requires (x `includes` y /\\ live h x))\n (ensures (live h y))\n= P.buffer_includes_elim x y" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_mreference" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region_buffer" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_live_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_mreference_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_weak" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_buffer_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_buffer" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_buffer_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_buffer" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_loc_regions_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_only_live_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_loc_regions_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_regions_intro" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_all_regions_from" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_region_only" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_address_liveness_insensitive_unused_in" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_only_not_unused_in" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.Extern.fst", "name": "EverParse3d.InputStream.Extern.preserved" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_trans" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_buffer_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.not_live_region_loc_not_unused_in_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_ralloc_post" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_unused_in" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_salloc_post" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_0_modifies" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.insert_modifies_union_loc_weakening" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_regions_unused_in" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_buffer_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.liveness_preservation_intro" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_new_modifies" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.union_loc_to_new_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.no_upd_fresh_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.no_upd_fresh_region" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.modifies_fresh_frame_popped'" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_livenesses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_union_l" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_none_modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_salloc_post" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_trans" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_trans" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_remove_new_locs" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.lemma_upd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.modifies_trans" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.modifies_trans" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.not_live_region_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.not_live_region_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_remove_fresh_frame" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_ralloc_post" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_buffer_from_to_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_buffer_from_to_intro'" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_regions" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.modifies_only_not_unused_in" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_reference_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_addresses_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_addresses_addresses" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.new_to_union_loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.popped_modifies" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fst", "name": "FStar.Monotonic.HyperStack.lemma_heap_equality_commute_distinct_upds" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.push" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_mreference_elim" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_mreference_elim" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_free" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_trans_linear" }, { "project_name": "hacl-star", "file_name": "EverCrypt.DRBG.fst", "name": "EverCrypt.DRBG.create_in" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_new_modifies'" }, { "project_name": "hacl-star", "file_name": "Hacl.HMAC_DRBG.fst", "name": "Hacl.HMAC_DRBG.create_in" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.modifies_loc_includes" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.modifies_loc_includes" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_from_to_modifies" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.includes_live" } ], "selected_premises": [ "FStar.ModifiesGen.loc_aux_includes_buffer_includes", "FStar.ModifiesGen.region_liveness_insensitive_locs", "FStar.FunctionalExtensionality.feq", "FStar.ModifiesGen.loc_disjoint_includes", "FStar.Reflection.V2.Data.var", "FStar.ModifiesGen.loc_aux_includes_trans", "FStar.Heap.trivial_preorder", "FStar.ModifiesGen.loc_aux_includes_loc_aux_includes_buffer", "FStar.ModifiesGen.modifies_preserves_livenesses_intro", "FStar.ModifiesGen.address_liveness_insensitive_locs", "FStar.ModifiesGen.loc_union", "FStar.ModifiesGen.aloc_disjoint_sym", "FStar.Monotonic.HyperStack.sel", "FStar.Tactics.SMT.get_initial_fuel", "FStar.Tactics.Effect.raise", "FStar.ModifiesGen.loc_aux_disjoint_sym", "FStar.ModifiesGen.modifies_preserves_liveness_strong", "FStar.ModifiesGen.loc_aux_includes_buffer", "FStar.Tactics.SMT.get_rlimit", "FStar.ModifiesGen.modifies_loc_includes", "FStar.ModifiesGen.loc_equal", "FStar.ModifiesGen.mk_live_addrs", "FStar.ModifiesGen.addrs_of_loc_aux", "FStar.ModifiesGen.loc_none", "FStar.ModifiesGen.mk_non_live_addrs", "FStar.Tactics.V2.Builtins.ret_t", "FStar.Tactics.SMT.get_max_fuel", "FStar.ModifiesGen.modifies_preserves_alocs_intro", "FStar.ModifiesGen.loc", "FStar.ModifiesGen.loc_regions", "FStar.ModifiesGen.modifies'", "FStar.ModifiesGen.modifies_intro_strong", "FStar.ModifiesGen.loc_disjoint_aloc_elim", "FStar.Pervasives.Native.snd", "FStar.ModifiesGen.loc_disjoint_region_liveness_tags", "FStar.Pervasives.Native.fst", "FStar.ModifiesGen.aloc_domain", "FStar.ModifiesGen.aloc_includes", "FStar.Monotonic.HyperStack.live_region", "FStar.ModifiesGen.addrs_of_loc_weak", "FStar.ModifiesGen.loc_disjoint_regions", "FStar.ModifiesGen.addrs_of_loc_liveness_not_preserved", "FStar.ModifiesGen.addrs_of_loc_aux_pred", "FStar.ModifiesGen.modifies_aloc_intro", "FStar.ModifiesGen.modifies_refl", "FStar.FunctionalExtensionality.on_dom", "FStar.ModifiesGen.loc_aux_includes", "FStar.Tactics.SMT.get_initial_ifuel", "FStar.ModifiesGen.loc_disjoint'", "FStar.ModifiesGen.loc_disjoint_sym", "FStar.ModifiesGen.loc_disjoint_aux", "FStar.ModifiesGen.modifies_intro", "FStar.ModifiesGen.modifies_preserves_regions", "FStar.ModifiesGen.modifies_preserves_not_unused_in_intro", "FStar.ModifiesGen.loc_includes'", "FStar.ModifiesGen.modifies", "FStar.ModifiesGen.modifies_preserves_not_unused_in", "FStar.Tactics.SMT.get_max_ifuel", "FStar.Reflection.V2.Data.ppname_t", "FStar.ModifiesGen.loc_aux_disjoint_loc_aux_includes", "FStar.Tactics.Types.issues", "FStar.ModifiesGen.loc_aux_disjoint", "FStar.ModifiesGen.i_restricted_g_t", "FStar.Sealed.Inhabited.seal", "FStar.HyperStack.ST.is_eternal_region", "FStar.ModifiesGen.modifies_none_intro", "FStar.Reflection.Const.cons_qn", "FStar.ModifiesGen.loc_aux_includes_refl", "FStar.ModifiesGen.loc_of_aloc", "FStar.ModifiesGen.aloc_disjoint_includes", "FStar.ModifiesGen.modifies_preserves_mreferences_intro", "FStar.ModifiesGen.aloc_disjoint", "FStar.Monotonic.HyperStack.mreference", "FStar.ModifiesGen.modifies_preserves_livenesses", "FStar.Tactics.SMT.smt_sync", "FStar.ModifiesGen.loc_disjoint_addrs", "FStar.ModifiesGen.loc_disjoint", "FStar.ModifiesGen.modifies_address_intro", "FStar.ModifiesGen.loc_includes_region_union_l", "FStar.ModifiesGen.loc_includes", "FStar.ModifiesGen.modifies_preserves_alocs", "FStar.ModifiesGen.modifies_preserves_mreferences", "FStar.ModifiesGen.addrs_dom", "FStar.Monotonic.HyperStack.as_addr", "FStar.ModifiesGen.addrs_of_loc", "FStar.ModifiesGen.loc_regions_region_liveness_tags", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Pervasives.reveal_opaque", "FStar.ModifiesGen.regions_of_loc", "FStar.Reflection.Const.nil_qn", "FStar.ModifiesGen.loc_includes_trans", "FStar.Monotonic.HyperStack.frameOf", "FStar.Reflection.Const.squash_qn", "FStar.ModifiesGen.loc_includes_none_elim", "FStar.ModifiesGen.loc_aux_includes_subset", "FStar.Pervasives.dfst", "FStar.Tactics.Effect.get", "FStar.Tactics.SMT.smt_sync'", "FStar.ModifiesGen.loc_disjoint_addresses_intro", "FStar.ModifiesGen.loc_none_in_some_region" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.ModifiesGen\n\n#set-options \"--split_queries no\"\n#set-options \"--using_facts_from '*,-FStar.Tactics,-FStar.Reflection,-FStar.List'\"\n\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\nnoeq\ntype aloc (#al: aloc_t) (c: cls al) = | ALoc:\n (region: HS.rid) ->\n (addr: nat) ->\n (loc: option (al region addr)) ->\n aloc c\n\nlet aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))\n\nmodule F = FStar.FunctionalExtensionality\n\n[@@(unifier_hint_injective)]\nlet i_restricted_g_t = F.restricted_g_t\n\nlet addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )\n\nlet non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })\n\nlet live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )\n\nnoeq\ntype loc' (#al: aloc_t u#x) (c: cls al) : Type u#x =\n | Loc:\n (regions: Ghost.erased (Set.set HS.rid)) ->\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } ) ->\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags)) ->\n (live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs)) ->\n (aux: Ghost.erased (GSet.set (aloc c)) {\n aloc_domain c regions live_addrs `GSet.subset` Ghost.reveal aux /\\\n Ghost.reveal aux `GSet.subset` (aloc_domain c regions (fun _ -> GSet.complement GSet.empty))\n } ) ->\n loc' c\n\nlet loc = loc'\n\nlet mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f\n\nlet mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f\n\nlet loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)\n\nlet regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)\n\nlet addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)\n\nlet addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))\n\nlet addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)\n\nlet addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()\n\nlet loc_union #al #c s1 s2 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let regions = Set.union regions1 regions2 in\n let region_liveness_tags : Ghost.erased (Set.set HS.rid) = (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1)) (Ghost.reveal (Loc?.region_liveness_tags s2)))) in\n let gregions = Ghost.hide regions in\n let non_live_addrs =\n F.on_dom_g (addrs_dom gregions) #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\n in\n let live_addrs =\n F.on_dom_g (addrs_dom gregions) #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\n in\n let aux = Ghost.hide\n (Ghost.reveal (Loc?.aux s1) `GSet.union` Ghost.reveal (Loc?.aux s2))\n in\n Loc\n (Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux\n\nlet fun_set_equal (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) :Tot Type0 =\n forall (x: t) . {:pattern (f1 x) \\/ (f2 x) } f1 x `GSet.equal` f2 x\n\nlet fun_set_equal_elim (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) : Lemma\n (requires (fun_set_equal f1 f2))\n (ensures (f1 == f2))\n// [SMTPat (fun_set_equal f1 f2)]\n= assert (f1 `FunctionalExtensionality.feq_g` f2)\n\nlet loc_equal (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : GTot Type0 =\n let Loc regions1 region_liveness_tags1 _ _ aux1 = s1 in\n let Loc regions2 region_liveness_tags2 _ _ aux2 = s2 in\n Ghost.reveal regions1 `Set.equal` Ghost.reveal regions2 /\\\n Ghost.reveal region_liveness_tags1 `Set.equal` Ghost.reveal region_liveness_tags2 /\\\n fun_set_equal (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2) /\\\n fun_set_equal (Loc?.live_addrs s1) (Loc?.live_addrs s2) /\\\n Ghost.reveal (Loc?.aux s1) `GSet.equal` Ghost.reveal (Loc?.aux s2)\n\nlet loc_equal_elim (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : Lemma\n (requires (loc_equal s1 s2))\n (ensures (s1 == s2))\n [SMTPat (s1 `loc_equal` s2)]\n= fun_set_equal_elim (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2);\n fun_set_equal_elim (Loc?.live_addrs s1) (Loc?.live_addrs s2)\n\n\nlet loc_union_idem #al #c s =\n assert (loc_union s s `loc_equal` s)\n\nlet loc_union_comm #al #c s1 s2 =\n assert (loc_union s1 s2 `loc_equal` loc_union s2 s1)\n\nlet loc_union_assoc #al #c s1 s2 s3 =\n assert (loc_union s1 (loc_union s2 s3) `loc_equal` loc_union (loc_union s1 s2) s3)\n\nlet loc_union_loc_none_l #al #c s =\n assert (loc_union loc_none s `loc_equal` s)\n\nlet loc_union_loc_none_r #al #c s =\n assert (loc_union s loc_none `loc_equal` s)\n\nlet loc_of_aloc #al #c #r #n b =\n let regions = (Ghost.hide (Set.singleton r)) in\n let region_liveness_tags = (Ghost.hide (Set.empty)) in\n Loc\n regions\n region_liveness_tags\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide (GSet.singleton (ALoc r n (Some b))))\n\nlet loc_of_aloc_not_none #al #c #r #n b = ()\n\nlet loc_addresses #al #c preserve_liveness r n =\n let regions = (Ghost.hide (Set.singleton r)) in\n Loc\n regions\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> if preserve_liveness then GSet.empty else GSet.of_set n))\n (mk_live_addrs (fun _ -> GSet.of_set n))\n (Ghost.hide (aloc_domain c regions (fun _ -> GSet.of_set n)))\n\nlet loc_regions_region_liveness_tags (preserve_liveness: bool) (r: Set.set HS.rid) : Tot (Ghost.erased (Set.set HS.rid)) =\n if preserve_liveness then Ghost.hide Set.empty else Ghost.hide r\n\nlet loc_regions #al #c preserve_liveness r =\n let region_liveness_tags = loc_regions_region_liveness_tags preserve_liveness r in\n let addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { r' `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y } ) =\n GSet.complement GSet.empty\n in\n let live_addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { addrs r' `GSet.subset` y } ) =\n addrs r'\n in\n Loc\n (Ghost.hide r)\n region_liveness_tags\n (mk_non_live_addrs addrs)\n (mk_live_addrs live_addrs)\n (Ghost.hide (aloc_domain c (Ghost.hide r) addrs))\n\nlet aloc_includes (#al: aloc_t) (#c: cls al) (b0 b: aloc c) : GTot Type0 =\n b0.region == b.region /\\ b0.addr == b.addr /\\ Some? b0.loc == Some? b.loc /\\ (if Some? b0.loc && Some? b.loc then c.aloc_includes (Some?.v b0.loc) (Some?.v b.loc) else True)\n\nlet loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b: aloc c)\n: GTot Type0\n (decreases s)\n= exists (b0 : aloc c) . b0 `GSet.mem` s /\\ b0 `aloc_includes` b\n\nlet loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: GTot Type0\n (decreases s2)\n= forall (b2: aloc c) . GSet.mem b2 s2 ==> loc_aux_includes_buffer s1 b2\n\nlet loc_aux_includes_union_l\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s \\/ loc_aux_includes s2 s))\n (ensures (loc_aux_includes (GSet.union s1 s2) s))\n (decreases s)\n= ()\n\nlet loc_aux_includes_refl\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n: Lemma\n (loc_aux_includes s s)\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)\n\nlet loc_aux_includes_subset\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)\n\nlet loc_aux_includes_subset'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n [SMTPatOr [\n [SMTPat (s1 `GSet.subset` s2)];\n [SMTPat (loc_aux_includes s2 s1)];\n ]]\n= loc_aux_includes_subset s1 s2\n\nlet loc_aux_includes_union_l_r\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s s') s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s s' s\n\nlet loc_aux_includes_union_l_l\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s' s) s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s' s s\n\nlet loc_aux_includes_buffer_includes\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b1 b2: aloc c)\n: Lemma\n (requires (loc_aux_includes_buffer s b1 /\\ b1 `aloc_includes` b2))\n (ensures (loc_aux_includes_buffer s b2))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))\n\nlet loc_aux_includes_loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n (b: aloc c)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\n= Classical.forall_intro_3 (fun s b1 b2 -> Classical.move_requires (loc_aux_includes_buffer_includes #al #c s b1) b2)\n\nlet loc_aux_includes_trans\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))\n\nlet addrs_of_loc_weak_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc_weak (loc_union l1 l2) r == GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r))\n [SMTPat (addrs_of_loc_weak (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc_weak (loc_union l1 l2) r) (GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r)))\n\nlet addrs_of_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc (loc_union l1 l2) r == GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r))\n [SMTPat (addrs_of_loc (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc (loc_union l1 l2) r) (GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r)))\n\nunfold\nlet loc_includes' #al (#c: cls al) (s1 s2: loc c) =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in (\n Set.subset regions2 regions1 /\\\n Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) /\\\n (\n forall (r: HS.rid { Set.mem r regions2 } ) .\n GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r)\n ) /\\\n (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r)\n ) /\\ (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r)\n ) /\\ (\n (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2))\n )\n )\n\nlet loc_includes #al #c s1 s2 =\n loc_includes' s1 s2\n\nlet loc_includes_refl #al #c s =\n loc_aux_includes_refl (Ghost.reveal (Loc?.aux s))\n\nlet loc_includes_refl'\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]\n= loc_includes_refl s\n\nlet loc_includes_trans #al #c s1 s2 s3 =\n loc_aux_includes_trans (Ghost.reveal (Loc?.aux s1)) (Ghost.reveal (Loc?.aux s2)) (Ghost.reveal (Loc?.aux s3))\n\nlet loc_includes_union_r #al #c s s1 s2 = ()\n\nlet loc_includes_union_l #al #c s1 s2 s =\n let u12 = loc_union s1 s2 in\n Classical.or_elim\n #(loc_includes s1 s)\n #(loc_includes s2 s)\n #(fun _ -> loc_includes (loc_union s1 s2) s)\n (fun _ ->\n loc_aux_includes_union_l_r (Ghost.reveal (Loc?.aux s1)) (Ghost.reveal (Loc?.aux s2));\n assert (loc_includes (loc_union s1 s2) s1);\n loc_includes_trans u12 s1 s)\n (fun _ ->\n loc_aux_includes_union_l_l (Ghost.reveal (Loc?.aux s2)) (Ghost.reveal (Loc?.aux s1));\n assert (loc_includes (loc_union s1 s2) s2);\n loc_includes_trans u12 s2 s)\n\nlet loc_includes_none #al #c s = ()\n\nlet loc_includes_none_elim #al #c s =\n assert (s `loc_equal` loc_none)\n\nlet loc_includes_aloc #al #c #r #n b1 b2 = ()\n\nlet loc_includes_aloc_elim #aloc #c #r1 #r2 #n1 #n2 b1 b2 = ()\n\nlet addrs_of_loc_loc_of_aloc\n (#al: aloc_t)\n (#c: cls al)\n (#r: HS.rid)\n (#a: nat)\n (p: al r a)\n (r': HS.rid)\n: Lemma\n (addrs_of_loc (loc_of_aloc #_ #c p) r' `GSet.equal` (if r = r' then GSet.singleton a else GSet.empty))\n [SMTPat (addrs_of_loc (loc_of_aloc #_ #c p) r')]\n= ()\n\nlet loc_includes_addresses_aloc #al #c preserve_liveness r s #a p = ()\n\nlet loc_includes_region_aloc #al #c preserve_liveness s #r #a b = ()\n\nlet loc_includes_region_addresses #al #c s preserve_liveness1 preserve_liveness2 r a = ()\n\nlet loc_includes_region_region #al #c preserve_liveness1 preserve_liveness2 s1 s2 = ()\n\nlet loc_includes_region_union_l #al #c preserve_liveness l s1 s2 =\n assert ((loc_regions #_ #c preserve_liveness (Set.intersect s2 (Set.complement s1)) `loc_union` loc_regions #_ #c preserve_liveness (Set.intersect s2 s1)) `loc_equal` loc_regions preserve_liveness s2);\n loc_includes_region_region #_ #c preserve_liveness preserve_liveness s1 (Set.intersect s2 s1);\n loc_includes_union_l (loc_regions preserve_liveness s1) l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)));\n loc_includes_union_l (loc_regions preserve_liveness s1) l (loc_regions preserve_liveness (Set.intersect s2 s1));\n loc_includes_union_r (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1))) (loc_regions preserve_liveness (Set.intersect s2 s1))\n\nlet loc_includes_addresses_addresses #al c preserve_liveness1 preserve_liveness2 r s1 s2 = ()\n\n(* Disjointness of two memory locations *)\n\nlet aloc_disjoint (#al: aloc_t) (#c: cls al) (b1 b2: aloc c) : GTot Type0 =\n if b1.region = b2.region && b1.addr = b2.addr\n then Some? b1.loc /\\ Some? b2.loc /\\ c.aloc_disjoint (Some?.v b1.loc) (Some?.v b2.loc)\n else True\n\nlet aloc_disjoint_sym (#al: aloc_t) (#c: cls al) (b1 b2: aloc c) : Lemma\n (aloc_disjoint b1 b2 <==> aloc_disjoint b2 b1)\n= Classical.forall_intro_2 (fun r a -> Classical.forall_intro_2 (fun b1 b2 -> c.aloc_disjoint_sym #r #a b1 b2))\n\nlet loc_aux_disjoint\n (#al: aloc_t) (#c: cls al)\n (l1 l2: GSet.set (aloc c))\n: GTot Type0\n= forall (b1 b2: aloc c) . (GSet.mem b1 l1 /\\ GSet.mem b2 l2) ==> aloc_disjoint b1 b2\n\nlet loc_aux_disjoint_union_l\n (#al: aloc_t) (#c: cls al)\n (ll1 lr1 l2: GSet.set (aloc c))\n: Lemma\n (ensures (loc_aux_disjoint (GSet.union ll1 lr1) l2 <==> (loc_aux_disjoint ll1 l2 /\\ loc_aux_disjoint lr1 l2)))\n= ()\n\nlet loc_aux_disjoint_union_r\n (#al: aloc_t) (#c: cls al)\n (l1 ll2 lr2: GSet.set (aloc c))\n: Lemma\n (loc_aux_disjoint l1 (GSet.union ll2 lr2) <==> (loc_aux_disjoint l1 ll2 /\\ loc_aux_disjoint l1 lr2))\n= ()\n\nlet loc_aux_disjoint_sym\n (#al: aloc_t) (#c: cls al)\n (l1 l2: GSet.set (aloc c))\n: Lemma\n (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1))\n= Classical.forall_intro_2 (aloc_disjoint_sym #al #c)\n\nlet regions_of_loc_loc_union\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (regions_of_loc (loc_union s1 s2) == regions_of_loc s1 `Set.union` regions_of_loc s2)\n [SMTPat (regions_of_loc (loc_union s1 s2))]\n= assert (regions_of_loc (loc_union s1 s2) `Set.equal` (regions_of_loc s1 `Set.union` regions_of_loc s2))\n\nlet regions_of_loc_monotonic\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_includes s1 s2))\n (ensures (Set.subset (regions_of_loc s2) (regions_of_loc s1)))\n= ()\n\nlet loc_disjoint_region_liveness_tags (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n Set.subset (Set.intersect (Ghost.reveal (Loc?.region_liveness_tags l1)) (Ghost.reveal (Loc?.region_liveness_tags l2))) Set.empty\n\nlet loc_disjoint_addrs (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n (forall (r: HS.rid) .\n GSet.subset (GSet.intersect (addrs_of_loc_weak l1 r) (addrs_of_loc l2 r)) GSet.empty /\\\n GSet.subset (GSet.intersect (addrs_of_loc l1 r) (addrs_of_loc_weak l2 r)) GSet.empty\n )\n\nlet loc_disjoint_aux (#al: aloc_t) (#c: cls al) (l1 l2: loc c) : GTot Type0 =\n loc_aux_disjoint (Ghost.reveal (Loc?.aux l1)) (Ghost.reveal (Loc?.aux l2))\n\nlet loc_disjoint'\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n: GTot Type0\n= loc_disjoint_region_liveness_tags l1 l2 /\\\n loc_disjoint_addrs l1 l2 /\\\n loc_disjoint_aux l1 l2\n\nlet loc_disjoint = loc_disjoint'\n\nlet loc_disjoint_sym #al #c l1 l2 =\n Classical.forall_intro_2 (loc_aux_disjoint_sym #al #c)\n\nlet loc_disjoint_sym'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\n [SMTPat (loc_disjoint s1 s2)]\n= loc_disjoint_sym s1 s2\n\nlet loc_disjoint_none_r #al #c s = ()\n\nlet loc_disjoint_union_r #al #c s s1 s2 = ()\n\nlet aloc_disjoint_includes (#al: aloc_t) (#c: cls al) (b1 b2 b3 : aloc c) : Lemma\n (requires (aloc_disjoint b1 b2 /\\ aloc_includes b2 b3))\n (ensures (aloc_disjoint b1 b3))\n= if b1.region = b2.region && b1.addr = b2.addr\n then begin\n c.aloc_includes_refl (Some?.v b1.loc);\n c.aloc_disjoint_includes (Some?.v b1.loc) (Some?.v b2.loc) (Some?.v b1.loc) (Some?.v b3.loc)\n end\n else ()\n\nlet loc_aux_disjoint_loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (l1 l2 l3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes l2 l3))\n (ensures (loc_aux_disjoint l1 l3))\n= // FIXME: WHY WHY WHY do I need this assert?\n assert (forall (b1 b3: aloc c) . (GSet.mem b1 l1 /\\ GSet.mem b3 l3) ==> (exists (b2: aloc c) . GSet.mem b2 l2 /\\ aloc_disjoint b1 b2 /\\ aloc_includes b2 b3));\n Classical.forall_intro_3 (fun b1 b2 b3 -> Classical.move_requires (aloc_disjoint_includes #al #c b1 b2) b3)\n\nlet loc_disjoint_includes #al #c p1 p2 p1' p2' =\n regions_of_loc_monotonic p1 p1';\n regions_of_loc_monotonic p2 p2';\n let l1 = Ghost.reveal (Loc?.aux p1) in\n let l2 = Ghost.reveal (Loc?.aux p2) in\n let l1' = Ghost.reveal (Loc?.aux p1') in\n let l2' = Ghost.reveal (Loc?.aux p2') in\n loc_aux_disjoint_loc_aux_includes l1 l2 l2';\n loc_aux_disjoint_sym l1 l2';\n loc_aux_disjoint_loc_aux_includes l2' l1 l1';\n loc_aux_disjoint_sym l2' l1'\n\nlet loc_disjoint_aloc_intro #al #c #r1 #a1 #r2 #a2 b1 b2 = ()\n\nlet loc_disjoint_aloc_elim #al #c #r1 #a1 #r2 #a2 b1 b2 =\n // FIXME: WHY WHY WHY this assert?\n assert (aloc_disjoint (ALoc #_ #c r1 a1 (Some b1)) (ALoc #_ #c r2 a2 (Some b2)))\n\n#push-options \"--z3rlimit 15\"\nlet loc_disjoint_addresses_intro #al #c preserve_liveness1 preserve_liveness2 r1 r2 n1 n2 =\n // FIXME: WHY WHY WHY this assert?\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_addresses #_ #c preserve_liveness1 r1 n1))) (Ghost.reveal (Loc?.aux (loc_addresses #_ #c preserve_liveness2 r2 n2))))\n#pop-options\n\nlet loc_disjoint_addresses_elim #al #c preserve_liveness1 preserve_liveness2 r1 r2 n1 n2 = ()\n\nlet loc_disjoint_aloc_addresses_intro #al #c #r' #a' p preserve_liveness r n = ()\n\nlet loc_disjoint_aloc_addresses_elim #al #c #r' #a' p preserve_liveness r n = ()\n\nlet loc_disjoint_regions #al #c preserve_liveness1 preserve_liveness2 rs1 rs2 =\n // FIXME: WHY WHY WHY this assert?\n assert (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_regions #_ #c preserve_liveness1 rs1))) (Ghost.reveal (Loc?.aux (loc_regions #_ #c preserve_liveness2 rs2))))\n\nlet loc_none_in_some_region #a (c: cls a) (r: HS.rid) : GTot (loc c) =\n Loc\n (Ghost.hide (Set.singleton r))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)\n\n(** Liveness-insensitive memory locations *)\n\nlet address_liveness_insensitive_locs #al c =\n Loc\n (Ghost.hide (Set.complement Set.empty))\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.complement GSet.empty))\n (Ghost.hide (aloc_domain c (Ghost.hide (Set.complement Set.empty)) (fun _ -> GSet.complement GSet.empty)))\n\nlet loc_includes_address_liveness_insensitive_locs_aloc #al #c #r #n a = ()\n\nlet loc_includes_address_liveness_insensitive_locs_addresses #al c r a = ()\n\nlet region_liveness_insensitive_locs #al c =\n Loc\n (Ghost.hide (Set.complement Set.empty))\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> GSet.complement GSet.empty))\n (mk_live_addrs (fun _ -> GSet.complement GSet.empty))\n (Ghost.hide (aloc_domain c (Ghost.hide (Set.complement Set.empty)) (fun _ -> GSet.complement GSet.empty)))\n\nlet loc_includes_region_liveness_insensitive_locs_address_liveness_insensitive_locs #al c = ()\n\nlet loc_includes_region_liveness_insensitive_locs_loc_regions #al c r = ()\n\nlet loc_includes_region_liveness_insensitive_locs_loc_addresses #al c preserve_liveness r a = ()\n\nlet loc_includes_region_liveness_insensitive_locs_loc_of_aloc #al c #r #a x = ()\n\n(** The modifies clause proper *)\n\nlet modifies_preserves_livenesses\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (t: Type) (pre: Preorder.preorder t) (p: HS.mreference t pre) .\n let r = HS.frameOf p in (\n HS.contains h1 p /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s r)))\n ) ==> (\n HS.contains h2 p\n ))\n\nlet modifies_preserves_livenesses_elim\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (p: HS.mreference t pre)\n: Lemma\n (requires (modifies_preserves_livenesses s h1 h2 /\\ HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))))\n (ensures (HS.contains h2 p))\n= ()\n\nlet modifies_preserves_livenesses_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p))\n ))\n: Lemma\n (modifies_preserves_livenesses s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'\n\nlet modifies_preserves_mreferences\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (t: Type) (pre: Preorder.preorder t) (p: HS.mreference t pre) .\n let r = HS.frameOf p in (\n HS.contains h1 p /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s r)))\n ) ==> (\n HS.contains h2 p /\\\n HS.sel h2 p == HS.sel h1 p\n ))\n\nlet modifies_preserves_mreferences_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p /\\ HS.sel h2 p == HS.sel h1 p))\n ))\n: Lemma\n (modifies_preserves_mreferences s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p /\\ h2 `HS.sel` p == h1 `HS.sel` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'\n\nlet modifies_preserves_alocs\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (r: HS.rid) (a: nat) (b: al r a) .\n loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b)))\n ==>\n c.aloc_preserved b h1 h2\n )\n\nlet modifies_preserves_alocs_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (u: unit { modifies_preserves_mreferences s h1 h2 } )\n (f: (\n (r: HS.rid) ->\n (a: nat) ->\n (b: al r a) ->\n Lemma\n (requires (\n Set.mem r (regions_of_loc s) /\\\n (~ (GSet.mem a (addrs_of_loc_weak s r))) /\\\n (GSet.mem a (addrs_of_loc_aux s r) /\\ loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b))))\n ))\n (ensures (c.aloc_preserved b h1 h2))\n ))\n: Lemma\n (modifies_preserves_alocs s h1 h2)\n= let f'\n (r: HS.rid)\n (a: nat)\n (b: al r a)\n : Lemma\n (requires (loc_aux_disjoint (Ghost.reveal (Loc?.aux s)) (GSet.singleton (ALoc r a (Some b)))))\n (ensures (c.aloc_preserved b h1 h2))\n = if Set.mem r (regions_of_loc s) && (not (GSet.mem a (addrs_of_loc_weak s r)))\n then begin\n if GSet.mem a (addrs_of_loc_aux s r)\n then\n Classical.move_requires (f r a) b\n else\n c.same_mreference_aloc_preserved b h1 h2 (fun a' pre' r' -> ())\n end else if Set.mem r (regions_of_loc s)\n then begin\n assert (GSet.mem a (addrs_of_loc_weak s r));\n assert (GSet.mem (ALoc r a None) (Ghost.reveal (Loc?.aux s)));\n assert (aloc_disjoint #_ #c (ALoc r a None) (ALoc r a (Some b)));\n assert False\n end\n else\n c.same_mreference_aloc_preserved b h1 h2 (fun a' pre' r' -> ())\n in\n Classical.forall_intro_3 (fun r a b -> Classical.move_requires (f' r a) b)\n\nlet modifies_preserves_regions\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= forall (r: HS.rid) . (HS.live_region h1 r /\\ ~ (Set.mem r (Ghost.reveal (Loc?.region_liveness_tags s)))) ==> HS.live_region h2 r\n\n\nlet modifies_preserves_not_unused_in\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= (forall (r: HS.rid) (n: nat) . (\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ) ==> (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))\n\nlet modifies_preserves_not_unused_in_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ))\n (ensures (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))\n ))\n: Lemma\n (modifies_preserves_not_unused_in s h1 h2)\n= let f'\n (r: HS.rid)\n (n: nat)\n : Lemma\n ((\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r) /\\\n (Set.mem r (regions_of_loc s) ==> ~ (GSet.mem n (Loc?.non_live_addrs s r)))\n ) ==> (\n n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r)\n ))\n = Classical.move_requires (f r) n\n in\n Classical.forall_intro_2 f'\n\nlet modifies'\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n: GTot Type0\n= modifies_preserves_regions s h1 h2 /\\\n modifies_preserves_not_unused_in s h1 h2 /\\\n modifies_preserves_mreferences s h1 h2 /\\\n modifies_preserves_livenesses s h1 h2 /\\\n modifies_preserves_alocs s h1 h2\n\nlet modifies = modifies'\n\nval modifies_intro_strong\n (#al: aloc_t) (#c: cls al) (l: loc c) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((loc_disjoint (loc_mreference b) l) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (\n (Set.mem r (regions_of_loc l) ==> ~ (GSet.mem n (Loc?.non_live_addrs l r))) /\\\n HS.live_region h r /\\\n HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)\n ))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (r: HS.rid) ->\n (a: nat) ->\n (x: al r a) ->\n Lemma\n (requires (loc_disjoint (loc_of_aloc x) l))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies l h h')\n\nlet modifies_intro_strong #al #c l h h' regions mrefs lives unused_ins alocs =\n Classical.forall_intro (Classical.move_requires regions);\n assert (modifies_preserves_regions l h h');\n\n let aux (t:Type) (pre:Preorder.preorder t) (p:HS.mreference t pre)\n :Lemma (requires (HS.contains h p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc l) ==> ~ (GSet.mem (HS.as_addr p) (addrs_of_loc l (HS.frameOf p))))))\n (ensures (HS.contains h' p /\\ HS.sel h' p == HS.sel h p))\n =\n assert_norm (Loc?.region_liveness_tags (loc_mreference #_ #c p) == Ghost.hide Set.empty);\n assert (loc_disjoint_region_liveness_tags (loc_mreference p) l);\n // FIXME: WHY WHY WHY is this assert necessary?\n assert_spinoff (loc_aux_disjoint (Ghost.reveal (Loc?.aux (loc_mreference p))) (Ghost.reveal (Loc?.aux l)));\n // FIXME: Now this one is too :)\n assert (loc_disjoint_addrs (loc_mreference p) l);\n assert ((loc_disjoint (loc_mreference p) l));\n mrefs t pre p\n in\n\n modifies_preserves_mreferences_intro l h h' aux;\n Classical.forall_intro_3 (fun t pre p -> Classical.move_requires (lives t pre) p);\n modifies_preserves_not_unused_in_intro l h h' (fun r n ->\n unused_ins r n\n );\n modifies_preserves_alocs_intro l h h' () (fun r a b ->\n loc_aux_disjoint_sym (Ghost.reveal (Loc?.aux l)) (Ghost.reveal (Loc?.aux (loc_of_aloc b)));\n alocs r a b\n )\n\nlet modifies_intro #al #c l h h' regions mrefs lives unused_ins alocs =\n modifies_intro_strong l h h'\n regions\n mrefs\n lives\n (fun r n -> unused_ins r n)\n alocs\n\nlet modifies_none_intro #al #c h h' regions mrefs unused_ins =\n modifies_intro_strong #_ #c loc_none h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> mrefs t pre b)\n (fun r n -> unused_ins r n)\n (fun r a x ->\n c.same_mreference_aloc_preserved x h h' (fun t pre b -> mrefs t pre b)\n )\n\nlet modifies_address_intro #al #c r n h h' regions mrefs unused_ins =\n Classical.forall_intro (Classical.move_requires regions);\n let l : loc c = loc_addresses #_ #c false r (Set.singleton n) in\n modifies_preserves_mreferences_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_livenesses_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_not_unused_in_intro l h h'\n (fun r n -> unused_ins r n)\n ;\n modifies_preserves_alocs_intro l h h' ()\n (fun r a b ->\n c.same_mreference_aloc_preserved b h h' (fun t pre p -> mrefs t pre p)\n )\n\nlet modifies_aloc_intro #al #c #r #n x h h' regions mrefs livenesses unused_ins alocs =\n modifies_intro_strong #_ #c (loc_of_aloc x) h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> livenesses t pre b)\n (fun r n -> unused_ins r n)\n (fun r' n' z ->\n if r' = r && n' = n\n then begin\n loc_disjoint_aloc_elim #_ #c z x;\n alocs z\n end else\n c.same_mreference_aloc_preserved z h h' (fun t pre p ->\n mrefs t pre p\n )\n )\n\nlet modifies_live_region #al #c s h1 h2 r = ()\n\nlet modifies_mreference_elim #al #c #t #pre b p h h' = ()\n\nlet modifies_aloc_elim #al #c #r #a b p h h' = ()\n\nlet modifies_refl #al #c s h =\n Classical.forall_intro_3 (fun r a b -> c.aloc_preserved_refl #r #a b h)\n\nlet modifies_loc_includes #al #c s1 h h' s2 =\n assert (modifies_preserves_mreferences s1 h h');\n Classical.forall_intro_2 (loc_aux_disjoint_sym #al #c);\n Classical.forall_intro_3 (fun l1 l2 l3 -> Classical.move_requires (loc_aux_disjoint_loc_aux_includes #al #c l1 l2) l3);\n assert (modifies_preserves_alocs s1 h h')\n\nlet modifies_preserves_liveness #al #c s1 s2 h h' #t #pre r = ()\n\n#push-options \"--z3rlimit 20 --max_fuel 0 --max_ifuel 0\"\nlet modifies_preserves_liveness_strong #al #c s1 s2 h h' #t #pre r x =\n let rg = HS.frameOf r in\n let ad = HS.as_addr r in\n let la = loc_of_aloc #_ #c #rg #ad x in\n if Set.mem rg (regions_of_loc s2)\n then begin\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` Loc?.non_live_addrs (address_liveness_insensitive_locs c) rg);\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` GSet.empty);\n assert (~ (GSet.mem ad (Loc?.non_live_addrs s2 rg)));\n if Set.mem rg (regions_of_loc s1)\n then begin\n if GSet.mem ad (Loc?.non_live_addrs s1 rg)\n then begin\n assert (loc_disjoint_aux s1 la);\n assert (GSet.subset (Loc?.non_live_addrs s1 rg) (Loc?.live_addrs s1 rg));\n assert (aloc_domain c (Loc?.regions s1) (Loc?.live_addrs s1) `GSet.subset` (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad None) (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad (Some x)) (Ghost.reveal (Loc?.aux la)));\n assert (aloc_disjoint (ALoc rg ad None) (ALoc #_ #c rg ad (Some x)));\n ()\n end else ()\n end else ()\n end else ()\n#pop-options\n\nlet modifies_preserves_region_liveness #al #c l1 l2 h h' r = ()\n\nlet modifies_preserves_region_liveness_reference #al #c l1 l2 h h' #t #pre r = ()\n", "sketch": [ "Step 1: We will assume the `modifies` relation holds for the union of `l1` and `l2`, and that the region `r` is live in the original memory state `h`. We will also assume that the region liveness-insensitive locations are included in `l2`, and that the location of the address `x` is disjoint from `l1`.\n\nStep 2: We will then show that the region `r` remains live in the updated memory state `h'`. This will involve reasoning about the liveness of the region `r` in the context of the modifications made to the memory state.", "Step 1: We will first assume the hypothesis that the modifies clause preserves the region liveness for a specific memory location `x` in region `r`. We will also assume that the region liveness of `l2` is insensitive to liveness changes. \n\nStep 2: We will then use the modifies clause to show that the resulting memory state `h'` still maintains the liveness of region `r`.", "Step 1: We want to prove that if the modifies clause preserves the region liveness of a memory location, and the region liveness of the second location is insensitive, and the first location is disjoint from the memory location represented by the aloc, and the region is live in the initial heap, then the region remains live in the final heap.\n\nStep 2: We will first assume that the modifies clause preserves the region liveness of the union of the two locations, and that the region liveness of the second location is insensitive.\n\nStep 3: We will then assume that the first location is disjoint from the memory location represented by the aloc, and that the region is live in the initial heap.\n\nStep 4: Using these assumptions, we will aim to prove that the region remains live in the final heap.", "Step 1: We will assume the `modifies` relation holds for the union of memory locations `l1` and `l2`, and that the region `r` is live in the initial heap `h`. \n\nStep 2: We will assume that the region liveness of `l2` is preserved, and that the memory location `x` is disjoint from `l1`. \n\nStep 3: We will show that the region `r` remains live in the final heap `h'`.", "Step 1: We will first assume the hypothesis that the modifies clause preserves the region liveness for a specific memory location `x` in region `r`. This means that after the modification, the region `r` remains live in the memory heap.\n\nStep 2: We will then use the fact that the modifies clause preserves the region liveness for the union of two memory locations `l1` and `l2`. This will allow us to assert that the region `r` remains live in the memory heap after the modification.", "Step 1: We will first assume the hypothesis that the modifies clause preserves the region liveness for a specific memory location `x` in region `r`. \n\nStep 2: We will then use the modifies clause to show that the region liveness is preserved in the post-state `h'` for the region `r`. \n\nStep 3: We will also use the fact that the modifies clause preserves the liveness of the region `r` in the post-state `h'` to complete the proof.", "Step 1: We will start by assuming the hypothesis that the modifies clause preserves the region liveness for a specific memory location. This means that after the modification, the memory location remains live.\n\nStep 2: We will then assume that the region liveness of the second location is insensitive, meaning it does not affect the liveness of the region.\n\nStep 3: Next, we will assume that the first location and the memory location of interest are disjoint, meaning they do not share any common elements.\n\nStep 4: We will also assume that the region of interest is live in the original memory state.\n\nStep 5: Using these assumptions, we will prove that the region of interest remains live in the modified memory state.", "Step 1: We will first assume the hypothesis that the modifies clause preserves the region liveness for a specific memory location `x` in region `r`. We will also assume that the region liveness of `l2` is insensitive to liveness changes. \n\nStep 2: We will then use the modifies clause to show that the resulting memory state `h'` still maintains the liveness of region `r`.", "Step 1: We will assume the `modifies` predicate for the union of `l1` and `l2`, and the fact that `l2` includes the region liveness insensitive locations. We will also assume that the location of the aloc `x` is disjoint from `l1` and that the region `r` is live in the heap `h`.\n\nStep 2: We will show that if the region liveness insensitive locations are included in `l2`, and the location of the aloc `x` is disjoint from `l1`, then the region `r` remains live in the heap `h'` after the modification.", "Step 1: We will start by assuming the hypothesis that the modifies clause preserves the region liveness of the memory locations. This means that after the modification, the liveness of the memory regions remains unchanged.\n\nStep 2: We will then assume that the region liveness of the second location `l2` is insensitive to liveness changes. This means that the liveness of the memory regions in `l2` is not affected by the modification.\n\nStep 3: Next, we will assume that the memory location `l1` is disjoint from the memory location of the aloc `x`. This means that there is no overlap between the memory regions of `l1` and the memory region of `x`.\n\nStep 4: Finally, we will assume that the memory region `r` is live in the initial memory `h`. This means that the memory region `r` is active and in use in the initial memory state." ], "generated_solution": [ "let modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "// The completion of the proof will be generated here.", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "let modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))", "// Your F* code here. You should only generate the completion of the proof. Do not include the lemma definition.\n\nlet modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))\n= ()" ] }, { "file_name": "ReifyTestTSST.fst", "name": "ReifyTestTSST.get_timestamp", "opens_and_abbrevs": [ { "open": "FStar.Monotonic.Witnessed" }, { "open": "FStar.Preorder" }, { "open": "FStar.Monotonic.Witnessed" }, { "open": "FStar.Preorder" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val get_timestamp : #state:Type -> timestamped_state state -> timestamp", "source_definition": "let get_timestamp #state tss = fst tss", "source_range": { "start_line": 29, "start_col": 0, "end_line": 29, "end_col": 38 }, "interleaved": false, "definition": "fun tss -> FStar.Pervasives.Native.fst tss", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "ReifyTestTSST.timestamped_state", "FStar.Pervasives.Native.fst", "ReifyTestTSST.timestamp" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "tss: ReifyTestTSST.timestamped_state state -> ReifyTestTSST.timestamp", "prompt": "let get_timestamp #state tss =\n ", "expected_response": "fst tss", "source": { "project_name": "FStar", "file_name": "examples/preorders/ReifyTestTSST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "ReifyTestTSST.fst", "checked_file": "dataset/ReifyTestTSST.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Witnessed.fsti.checked" ] }, "definitions_in_context": [ "let timestamp = nat", "val timestamp : Type0", "let timestamped_state (state:Type) = timestamp * state" ], "closest": [ "val synth_timestamp (x: timestamp') : timestamp\nlet synth_timestamp (x: timestamp') : timestamp =\n match x with (epoch,counter) -> {\n epoch = epoch;\n counter = counter;\n }", "val lift_timestamp (st: s_timestamp)\n : i_timestamp\nlet lift_timestamp (st: s_timestamp)\n : i_timestamp\n = let epoch = st.epoch in\n let ctr = st.counter in\n { e = U32.v epoch; c = U32.v ctr }", "val next (t: T.timestamp) : option T.timestamp\nlet next (t:T.timestamp)\r\n : option T.timestamp\r\n = if FStar.UInt.fits (U32.v t.counter + 1) 32\r\n then Some ({ t with counter = t.counter `U32.add` 1ul })\r\n else None", "val next (t: T.timestamp) : option T.timestamp\nlet next (t:T.timestamp)\r\n : option T.timestamp\r\n = match Zeta.Steel.Util.check_overflow_add32 t.counter 1ul with\r\n | None -> None\r\n | Some ctr -> Some ({ t with counter = ctr })", "val get (st: state) (k: F.key_t) : option F.value_t\nlet get (st:state) (k:F.key_t) : option F.value_t =\n Map.sel st k", "val synth_timestamp (x: Zeta.Formats.Aux.Timestamp.timestamp)\n : Tot Zeta.Steel.LogEntry.Types.timestamp\nlet synth_timestamp\n (x: Zeta.Formats.Aux.Timestamp.timestamp)\n: Tot Zeta.Steel.LogEntry.Types.timestamp\n= {\n Zeta.Steel.LogEntry.Types.epoch = x.epoch;\n counter = x.counter;\n}", "val spec_parser_timestamp : spec_parser timestamp\nlet spec_parser_timestamp x =\n match LPC.parse spec_parser_timestamp' x with\n | None -> None\n | Some (res, consumed) -> Some (res, consumed)", "val get (#s: _) : st s s\nlet get #s\n : st s s\n = fun s -> s, s", "val synth_timestamp_recip (x: timestamp) : timestamp'\nlet synth_timestamp_recip (x: timestamp) : timestamp' = (x.epoch,x.counter)", "val get:st machine_state\nlet get : st machine_state =\n fun s -> (s, s)", "val get:st state\nlet get :st state =\n fun s -> s, s", "val epoch_of_timestamp (t: T.timestamp) : epoch_id\nlet epoch_of_timestamp (t:T.timestamp)\r\n : epoch_id\r\n = t.epoch", "val clock (#vspec: _) (gl: verifiable_log vspec) (i: sseq_index gl) : GTot timestamp\nlet clock (#vspec:_) (gl: verifiable_log vspec) (i: sseq_index gl)\n : GTot timestamp\n = let tid,j = i in\n let tl = index gl tid in\n T.clock tl j", "val witnessed : #state:Type -> rel:preorder state -> p:(state -> Type0) -> Type0\nlet witnessed #state rel p = get (fun s -> forall s'. rel s s' ==> p s')", "val vevictb (tsm: thread_state_model) (s: slot_id) (t: timestamp) : thread_state_model\nlet vevictb (tsm:thread_state_model)\r\n (s:slot_id)\r\n (t:timestamp)\r\n : thread_state_model\r\n = if not (check_slot_bounds s) then fail tsm\r\n else if not (sat_evictb_checks tsm s t)\r\n then fail tsm\r\n else (\r\n let Some r = get_entry tsm s in\r\n if r.add_method <> BAdd\r\n then fail tsm\r\n else (\r\n let tsm = vevictb_update_hash_clock tsm s t in\r\n bevict_from_store tsm s\r\n )\r\n )", "val blum_add_timestamp (#vspec: _) (e: verifier_log_entry vspec {is_blum_add e}) : timestamp\nlet blum_add_timestamp #vspec (e: verifier_log_entry vspec {is_blum_add e})\n : timestamp\n = match e with\n | AddB _ _ t _ -> t", "val synth_timestamp_recip (x: Zeta.Steel.LogEntry.Types.timestamp)\n : Tot Zeta.Formats.Aux.Timestamp.timestamp\nlet synth_timestamp_recip\n (x: Zeta.Steel.LogEntry.Types.timestamp)\n: Tot Zeta.Formats.Aux.Timestamp.timestamp\n= {\n Zeta.Formats.Aux.Timestamp.epoch = x.epoch;\n counter = x.counter;\n}", "val st (_:unit) : state\nlet st _ = st_var", "val vaddb\n (tsm: thread_state_model)\n (s: slot_id)\n (t: T.timestamp)\n (thread_id: T.thread_id)\n (r: T.record)\n : thread_state_model\nlet vaddb (tsm:thread_state_model)\r\n (s:slot_id)\r\n (t:T.timestamp)\r\n (thread_id:T.thread_id) \r\n (r:T.record)\r\n : thread_state_model\r\n = if not (check_slot_bounds s) then fail tsm\r\n else match r with\r\n | ( k, v ) ->\r\n if is_root_key k then fail tsm //root key\r\n else if Some? (get_entry tsm s) then fail tsm //slot is already full\r\n else if not (epoch_greater_than_last_verified_epoch \r\n tsm.last_verified_epoch\r\n (epoch_of_timestamp t))\r\n then fail tsm\r\n else (\r\n //add hash (k, v, t, thread_id) to hadd.[epoch_of_timestamp t]\r\n let tsm = update_hadd tsm (epoch_of_timestamp t) (k, v) t thread_id in\r\n match next t with //increment the time\r\n | None -> \r\n fail tsm //overflow\r\n | Some t' -> \r\n let tsm = if tsm.clock `timestamp_lt` (max tsm.clock t') \r\n then update_last_evict_key tsm root_base_key \r\n else tsm in\r\n let tsm = update_clock tsm (max tsm.clock t') in\r\n put_entry tsm s (mk_entry k v BAdd)\r\n )", "val get: s: Type -> Prims.unit -> st s s\nlet get (s:Type) () : st s s = fun s0 -> s0, s0", "val get: #s: _ -> Prims.unit -> st s s\nlet get #s () : st s s = fun s -> s, s", "val snapshot (#b: Ghost.erased bool) (t:top_level_state b) (_ : tid_log_map) : vprop\nlet snapshot (#b: Ghost.erased bool) (t:top_level_state b) (tlm:tid_log_map)\r\n : vprop\r\n = TLM.global_snapshot t.aeh.mlogs tlm", "val vevictb_update_hash_clock\n (tsm: thread_state_model)\n (s: slot)\n (t: timestamp{sat_evictb_checks tsm s t})\n : thread_state_model\nlet vevictb_update_hash_clock (tsm:thread_state_model)\r\n (s:slot)\r\n (t:timestamp { sat_evictb_checks tsm s t })\r\n : thread_state_model\r\n = let Some r = get_entry tsm s in\r\n let k = r.key in\r\n let bk = to_base_key k in\r\n let v = r.value in\r\n (* update evict hash *)\r\n let tsm = update_hevict tsm (epoch_of_timestamp t) (k, v) t tsm.thread_id in\r\n let tsm = update_last_evict_key tsm bk in\r\n {tsm with clock = t}", "val Zeta.GenericVerifier.blum_evict_timestamp = e: Zeta.GenericVerifier.verifier_log_entry vspec {Zeta.GenericVerifier.is_blum_evict e}\n -> Zeta.Time.timestamp\nlet blum_evict_timestamp #vspec (e: verifier_log_entry vspec {is_blum_evict e})\n = match e with\n | EvictB _ t -> t\n | EvictBM _ _ t -> t", "val serialize_timestamp\n (#bs: Ghost.erased (Seq.seq FStar.UInt8.t))\n (a: byte_array{A.length a == 8})\n (v: timestamp)\n : STT U32.t\n (A.pts_to a full_perm bs)\n (fun slice_len ->\n exists_ (fun (bs: bytes) ->\n (A.pts_to a full_perm bs) `star` (pure (spec_serializer_timestamp v == bs))))\nlet serialize_timestamp (#bs:Ghost.erased (Seq.seq FStar.UInt8.t))\n (a:byte_array { A.length a == 8 })\n (v: timestamp)\n : STT U32.t\n (A.pts_to a full_perm bs)\n (fun slice_len ->\n exists_ (fun (bs:bytes) ->\n A.pts_to a full_perm bs `star`\n pure (\n spec_serializer_timestamp v == bs)))\n = intro_exists_erased bs (array_pts_to a);\n let n = zeta__serialize_timestamp 8ul 0ul a v in\n let bs = elim_exists () in\n elim_pure _;\n // intro_pure (eq2 #bytes (spec_serializer_timestamp v) bs);\n // intro_exists_erased bs (fun (bs:bytes) -> A.pts_to a full_perm bs `star`\n // pure (spec_serializer_timestamp v == bs));\n return n", "val st_var:state\nlet st_var : state =\n let l0_image_header_size = 1ul in\n let l0_binary_size = 1ul in\n let ghost_state = B.mgcmalloc HS.root (G.hide (true, true)) 1ul in\n let cdi = B.gcmalloc HS.root (I.u8 0) digest_len in\n let l0_image_header = B.gcmalloc HS.root (I.u8 0) l0_image_header_size in\n let l0_image_header_sig = B.gcmalloc HS.root (I.u8 0) 64ul in\n let l0_binary = B.gcmalloc HS.root (I.u8 0) l0_binary_size in\n let l0_binary_hash = B.gcmalloc HS.root (I.u8 0) digest_len in\n let l0_image_auth_pubkey = B.gcmalloc HS.root (I.u8 0) 32ul in\n\n let l0 = {\n l0_image_header_size = l0_image_header_size;\n l0_image_header = l0_image_header;\n l0_image_header_sig = l0_image_header_sig;\n l0_binary_size = l0_binary_size;\n l0_binary = l0_binary;\n l0_binary_hash = l0_binary_hash;\n l0_image_auth_pubkey = l0_image_auth_pubkey } in\n\n { ghost_state = ghost_state;\n cdi = cdi;\n l0 = l0 }", "val get: unit -> stexn int\nlet get (_:unit) : stexn int = fun s0 -> (Some s0, s0)", "val get_state_impl\n (inv: memory_invariant)\n (p: parser)\n: Tot (repr_impl _ _ _ _ _ _ inv (get_state_spec p))\nlet get_state_impl\n inv p\n=\n fun b len pos ->\n let h = HST.get () in\n ICorrect (Ghost.hide (contents p h b 0ul pos)) pos", "val clock (#vspec #n: _) (il: verifiable_log vspec n) (i: seq_index il) : GTot timestamp\nlet clock (#vspec #n:_) (il: verifiable_log vspec n) (i: seq_index il)\n : GTot timestamp\n = let ti = i2s_map il i in\n G.clock (to_glog il) ti", "val accessor'_timestamp_epoch:LL.accessor gaccessor'_timestamp_epoch\nlet accessor'_timestamp_epoch : LL.accessor gaccessor'_timestamp_epoch = (LL.accessor_then_fst (LL.accessor_id timestamp'_parser))", "val timestamp: unit\n -> ST (lbytes 4)\n (requires (fun h0 -> True))\n (ensures (fun h0 _ h1 -> HS.modifies Set.empty h0 h1))\nlet timestamp: unit -> ST (lbytes 4)\n (requires (fun h0 -> True))\n (ensures (fun h0 _ h1 -> HS.modifies Set.empty h0 h1)) =\n fun () ->\n let time = FStar.Date.secondsFromDawn () in\n lemma_repr_bytes_values time;\n //assume(Platform.Bytes.repr_bytes time = FStar.Bytes.repr_bytes time);// temporary\n bytes_of_int 4 time", "val vevictbm (tsm: thread_state_model) (s s': slot_id) (t: timestamp) : thread_state_model\nlet vevictbm (tsm:thread_state_model)\r\n (s s':slot_id)\r\n (t:timestamp)\r\n : thread_state_model\r\n = if not (check_slot_bounds s)\r\n || not (check_slot_bounds s') then fail tsm\r\n else if s = s' then fail tsm\r\n else if not (sat_evictb_checks tsm s t)\r\n then fail tsm\r\n else if None? (get_entry tsm s')\r\n then fail tsm\r\n else (\r\n let Some r = get_entry tsm s in\r\n let Some r' = get_entry tsm s' in\r\n if r.add_method <> MAdd\r\n then fail tsm\r\n else (\r\n let gk = r.key in\r\n let gk' = r'.key in\r\n let v' = r'.value in\r\n let k = to_base_key gk in\r\n let k' = to_base_key gk' in\r\n if not (KU.is_proper_descendent k k')\r\n then fail tsm\r\n else (\r\n let Some mv' = to_merkle_value v' in\r\n let d = KU.desc_dir k k' in\r\n let dh' = desc_hash_dir mv' d in\r\n match dh' with\r\n | T.Dh_vnone _ -> fail tsm\r\n | T.Dh_vsome {T.dhd_key=k2; T.dhd_h=h2; T.evicted_to_blum = b2} ->\r\n if (not (eq_base_key k2 k)) || (b2 = T.Vtrue)\r\n then fail tsm\r\n else if None? r.parent_slot\r\n || fst (Some?.v r.parent_slot) <> s'\r\n || snd (Some?.v r.parent_slot) <> d\r\n then fail tsm\r\n else (\r\n let tsm = vevictb_update_hash_clock tsm s t in\r\n let mv'_upd = update_merkle_value mv' d k h2 true in\r\n let tsm = update_value tsm s' (MValue mv'_upd) in\r\n mevict_from_store tsm s s' d\r\n )\r\n )\r\n )\r\n )", "val get (s: state) (x y: index) : Tot uint64\nlet get (s:state) (x:index) (y:index) : Tot uint64 =\n s.[x + 5 * y]", "val first (e: epoch) : timestamp\nlet first (e: epoch): timestamp\n = { e; c = 0 }", "val t: stateful unit -> Type0\nlet t (dt: stateful unit) = t_ (dt_s dt)", "val timestamp_size:size_nat\nlet timestamp_size : size_nat = 12", "val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p (s0, s0))\nlet get #st () : ST st st (fun s0 p -> p (s0, s0)) =\n ST?.reflect (fun s0 -> (s0, s0))", "val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p (s0, s0))\nlet get #st ()\n : ST st st (fun s0 p -> p (s0, s0))\n = ST?.reflect (fun s0 -> (s0, s0))", "val get: unit -> st heap\nlet get (_:unit): st heap =\n fun x -> x, x", "val g (i: nat{i > 0}) : STATE int (int >< (fun p s0 -> forall k. k > s0 ==> p s0 k))\nlet g (i:nat{i > 0}) \n : STATE int (int >< (fun p s0 -> forall k . k > s0 ==> p s0 k))\n = let j = get () in put (i + j); j", "val get: Prims.unit -> TAC proofstate (fun ps post -> post (Success ps ps))\nlet get ()\n : TAC proofstate (fun ps post -> post (Success ps ps))\n = TAC?.reflect (fun ps -> Success ps ps)", "val get (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : ST (get_result v)\r\n (perm a init m b)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\nlet get #v #c #vp #init #m #b a i =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n let high_value = R.read a.high in\r\n let r = above_high_water_mark high_value i in\r\n if r returns ST _\r\n _\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\r\n\r\n then begin\r\n let ret = Fresh in\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n end\r\n else begin\r\n let x = ETbl.get a.etbl i in\r\n match x returns ST _\r\n (ETbl.get_post (repr_to_eht_repr m) b a.etbl i x\r\n `star`\r\n R.pts_to a.high Steel.FractionalPermission.full_perm w)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init) with\r\n | ETbl.Missing j ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Missing j))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n pure (ETbl.map_contains_prop j (repr_to_eht_repr m)));\r\n elim_pure (ETbl.map_contains_prop j (repr_to_eht_repr m));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Absent ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i ETbl.Absent)\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b);\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Present x ->\r\n let ret = Found x in\r\n assert (Some? (PartialMap.sel (repr_to_eht_repr m) i));\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Present x))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m (PartialMap.upd b i x) w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m (PartialMap.upd b i x) a.high);\r\n rewrite (perm a init m (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i))\r\n (get_post init m b a i ret);\r\n return ret\r\n end", "val accessor'_timestamp_counter:LL.accessor gaccessor'_timestamp_counter\nlet accessor'_timestamp_counter : LL.accessor gaccessor'_timestamp_counter = (LL.accessor_then_snd (LL.accessor_id timestamp'_parser) LL.jump_u32)", "val clock_evict_key (#vspec: verifier_spec_base) (vtls: vspec.vtls_t{vspec.valid vtls})\n : Zeta.TimeKey.timestamp_key\nlet clock_evict_key (#vspec: verifier_spec_base) (vtls: vspec.vtls_t {vspec.valid vtls})\n : Zeta.TimeKey.timestamp_key\n = vspec.clock vtls, vspec.last_evict_key vtls", "val update_clock (tsm: thread_state_model) (ts: T.timestamp) : thread_state_model\nlet update_clock (tsm:thread_state_model) (ts:T.timestamp)\r\n : thread_state_model\r\n = { tsm with clock = ts }", "val increment_epoch (t: timestamp) : option timestamp\nlet increment_epoch (t:timestamp)\r\n : option timestamp\r\n = if FStar.UInt.fits (U32.v t.epoch + 1) 32\r\n then Some ({t with epoch = t.epoch `U32.add` 1ul; counter = 0ul })\r\n else None", "val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p s0 s0)\nlet get #st () : ST st st (fun s0 p -> p s0 s0) =\n ST?.reflect (fun s0 -> (s0, s0))", "val get: #st: _ -> Prims.unit -> ST st st (fun s0 p -> p s0 s0)\nlet get #st () : ST st st (fun s0 p -> p s0 s0) =\n ST?.reflect (fun s0 -> (s0, s0))", "val get: #state: Type u#2 -> #rel: P.preorder state -> Prims.unit\n -> MSTATETOT state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\\ r == s1)\nlet get (#state:Type u#2) (#rel:P.preorder state) ()\n : MSTATETOT state state rel\n (fun _ -> True)\n (fun s0 r s1 -> s0 == r /\\ r == s1)\n =\n MSTATETOT?.reflect (fun s0 -> s0, s0)", "val Zeta.Time.epoch_of = t: Zeta.Time.timestamp -> Zeta.Time.epoch\nlet epoch_of (t: timestamp)\n = t.e", "val vevictm (tsm: thread_state_model) (s s': slot_id) : thread_state_model\nlet vevictm (tsm:thread_state_model)\r\n (s s':slot_id)\r\n : thread_state_model\r\n = if not (check_slot_bounds s)\r\n || not (check_slot_bounds s') then fail tsm\r\n else if s = s' then fail tsm\r\n else (\r\n match get_entry tsm s,\r\n get_entry tsm s'\r\n with\r\n | None, _\r\n | _, None -> fail tsm\r\n | Some r, Some r' ->\r\n let gk = r.key in\r\n let v = r.value in\r\n let gk' = r'.key in\r\n let v' = r'.value in\r\n let k = to_base_key gk in\r\n let k' = to_base_key gk' in\r\n (* check k is a proper descendent of k' *)\r\n if not (KU.is_proper_descendent k k') then fail tsm\r\n (* check k does not have a (merkle) child in the store *)\r\n else if points_to_some_slot tsm s true\r\n || points_to_some_slot tsm s false\r\n then fail tsm\r\n else (\r\n let d = KU.desc_dir k k' in\r\n let Some v' = to_merkle_value v' in\r\n let dh' = desc_hash_dir v' d in\r\n let h = HashValue.hashfn v in\r\n match dh' with\r\n | T.Dh_vnone _ -> fail tsm\r\n | T.Dh_vsome {T.dhd_key=k2; T.dhd_h=h2; T.evicted_to_blum = b2} ->\r\n if not (eq_base_key k2 k) then fail tsm\r\n else if Some? r.parent_slot &&\r\n (fst (Some?.v r.parent_slot) <> s' ||\r\n snd (Some?.v r.parent_slot) <> d)\r\n then fail tsm\r\n else if None? r.parent_slot\r\n && points_to_some_slot tsm s' d\r\n then fail tsm\r\n else\r\n let v'_upd = update_merkle_value v' d k h false in\r\n let tsm = update_value tsm s' (T.MValue v'_upd) in\r\n mevict_from_store tsm s s' d\r\n )\r\n )", "val gaccessor_stamped_record_sr_timestamp : LL.gaccessor stamped_record_parser timestamp_parser clens_stamped_record_sr_timestamp\nlet gaccessor_stamped_record_sr_timestamp = LL.gaccessor_ext (gaccessor_stamped_record_stamped_record' `LL.gaccessor_compose` gaccessor'_stamped_record_sr_timestamp) clens_stamped_record_sr_timestamp ()", "val get_0:(get_t inv_0)\nlet get_0 :(get_t inv_0) =\n fun s ->\n let r = hd s in\n read_weak r", "val put (s: state) : Eff unit\nlet put (s:state) : Eff unit\n= EFF?.reflect (fun (_, n, _) -> (), n, s)", "val Zeta.Steel.ThreadStateModel.clock_lek = tsm: Zeta.Steel.ThreadStateModel.thread_state_model\n -> Prims.GTot (Zeta.Steel.LogEntry.Types.timestamp * Zeta.Steel.KeyUtils.base_key)\nlet clock_lek (tsm: thread_state_model) \r\n = tsm.clock, tsm.last_evict_key", "val as_kv: (#a: alg) -> state_s a -> GTot (kv a)\nlet as_kv #a (Ek _ kv _) =\n G.reveal kv", "val get:\n s:state\n -> x:index\n -> y:index\n -> Stack uint64\n (requires fun h -> live h s)\n (ensures fun h0 r h1 ->\n modifies loc_none h0 h1 /\\\n r == S.get (as_seq h0 s) (v x) (v y))\nlet get s x y = s.(x +! 5ul *! y)", "val timestamp_bytesize (x:timestamp) : GTot nat\nlet timestamp_bytesize (x:timestamp) : GTot nat = Seq.length (timestamp_serializer x)", "val get: #s: _ -> Prims.unit -> NDS s s\nlet get #s ()\n : NDS s s\n = NDS?.reflect (fun t n s -> s, s, n)", "val get: #state: Type u#2 -> #rel: P.preorder state -> Prims.unit\n -> MSTATE state state rel (fun _ -> True) (fun s0 r s1 -> s0 == r /\\ r == s1)\nlet get (#state:Type u#2) (#rel:P.preorder state) ()\n : MSTATE state state rel\n (fun _ -> True)\n (fun s0 r s1 -> s0 == r /\\ r == s1)\n =\n MSTATE?.reflect (fun s0 -> s0, s0)", "val accessor_timestamp_counter : LL.accessor gaccessor_timestamp_counter\nlet accessor_timestamp_counter = LL.accessor_ext (LL.accessor_compose accessor_timestamp_timestamp' accessor'_timestamp_counter ()) clens_timestamp_counter ()", "val get_state_p (#a: alg) (#m: m_spec) (s: s a m) : Tot (Core.state_p a m)\nlet get_state_p (#a : alg) (#m : m_spec) (s : s a m) : Tot (Core.state_p a m) =\n match s with _, p -> p", "val zeta__serialize_timestamp : serializer spec_serializer_timestamp\nlet zeta__serialize_timestamp =\n fun len offset a v ->\n LowParse.Low.Combinators.serialize32_synth\n Zeta.Formats.Aux.Timestamp.timestamp_lserializer\n Zeta.Formats.Synth.synth_timestamp\n Zeta.Formats.Synth.synth_timestamp_recip\n (fun x -> Zeta.Formats.Synth.synth_timestamp_recip x)\n ()\n v a offset", "val vaddm (tsm: thread_state_model) (s s': T.slot_id) (r: T.record) : GTot thread_state_model\nlet vaddm (tsm:thread_state_model)\r\n (s s': T.slot_id)\r\n (r: T.record)\r\n : GTot thread_state_model\r\n = if not (check_slot_bounds s)\r\n || not (check_slot_bounds s') \r\n then fail tsm\r\n else (\r\n match r with\r\n | ( gk, gv ) ->\r\n begin\r\n (* check store contains slot s' *)\r\n match get_entry tsm s' with\r\n | None -> fail tsm\r\n | Some r' ->\r\n let k' = to_base_key r'.key in\r\n let v' = r'.value in\r\n let k = to_base_key gk in\r\n (* check k is a proper desc of k' *)\r\n if not (KU.is_proper_descendent k k') then fail tsm\r\n (* check store does not contain slot s *)\r\n else if Some? (get_entry tsm s) then fail tsm\r\n (* check v' is a merkle value *)\r\n else match to_merkle_value v' with\r\n | None -> fail tsm (* TODO: Remove this? we can assert(False) here *)\r\n | Some v' ->\r\n let d = KU.desc_dir k k' in\r\n let dh' = desc_hash_dir v' d in\r\n let h = HashValue.hashfn gv in\r\n match dh' with\r\n | T.Dh_vnone _ -> (* k' has no child in direction d *)\r\n (* first add must be init value *)\r\n if not (eq_value gv (init_value gk)) then fail tsm\r\n else if points_to_some_slot tsm s' d then fail tsm\r\n else (\r\n let tsm = madd_to_store tsm s gk gv s' d in\r\n let v'_upd = update_merkle_value v' d k zero false in\r\n update_value tsm s' (T.MValue v'_upd)\r\n )\r\n | T.Dh_vsome {T.dhd_key=k2; T.dhd_h=h2; T.evicted_to_blum = b2} ->\r\n if eq_base_key k2 k then (* k is a child of k' *)\r\n (* check hashes match and k was not evicted to blum *)\r\n if not (h2 = h && b2 = T.Vfalse) then fail tsm\r\n (* check slot s' does not contain a desc along direction d *)\r\n else if points_to_some_slot tsm s' d then fail tsm\r\n else madd_to_store tsm s gk gv s' d\r\n else if not (eq_value gv (init_value gk)) then fail tsm\r\n (* check k2 is a proper desc of k *)\r\n else if not (KU.is_proper_descendent k2 k) then fail tsm\r\n else (\r\n let d2 = KU.desc_dir k2 k in\r\n let Some mv = to_merkle_value gv in\r\n let mv_upd = update_merkle_value mv d2 k2 h2 (b2=T.Vtrue) in\r\n let v'_upd = update_merkle_value v' d k zero false in\r\n let tsm =\r\n if points_to_some_slot tsm s' d then\r\n madd_to_store_split tsm s gk (MValue mv_upd) s' d d2\r\n else \r\n madd_to_store tsm s gk (MValue mv_upd) s' d\r\n in\r\n update_value tsm s' (MValue v'_upd)\r\n )\r\n end\r\n )", "val set (s: state) : st unit\nlet set (s:state) :st unit =\n fun _ -> (), s", "val get (#a: Type) (m: map16 a) (n: int) : a\nlet get (#a:Type) (m:map16 a) (n:int) : a =\n sel m n", "val ts_gt (t1 t2: timestamp) : bool\nlet ts_gt (t1 t2: timestamp): bool =\n not (t1 `ts_leq` t2)", "val gaccessor_timestamp_epoch : LL.gaccessor timestamp_parser LPI.parse_u32 clens_timestamp_epoch\nlet gaccessor_timestamp_epoch = LL.gaccessor_ext (gaccessor_timestamp_timestamp' `LL.gaccessor_compose` gaccessor'_timestamp_epoch) clens_timestamp_epoch ()", "val state_eta (s: state) : state\nlet state_eta (s:state) : state =\n {s with\n ms_heap = coerce ({ (coerce s.ms_heap) with vf_heaplets = Map16.eta (coerce s.ms_heap).vf_heaplets });\n }", "val accessor_timestamp_epoch : LL.accessor gaccessor_timestamp_epoch\nlet accessor_timestamp_epoch = LL.accessor_ext (LL.accessor_compose accessor_timestamp_timestamp' accessor'_timestamp_epoch ()) clens_timestamp_epoch ()", "val gaccessor_timestamp_counter : LL.gaccessor timestamp_parser LPI.parse_u32 clens_timestamp_counter\nlet gaccessor_timestamp_counter = LL.gaccessor_ext (gaccessor_timestamp_timestamp' `LL.gaccessor_compose` gaccessor'_timestamp_counter) clens_timestamp_counter ()", "val dt_t (dt: stateful unit) : Type0\nlet dt_t (dt : stateful unit) : Type0 = dt.smfi_stateful.t ()", "val put (st: state) (k: F.key_t) (v: F.value_t) : state\nlet put (st:state) (k:F.key_t) (v:F.value_t) : state =\n Map.upd st k (Some v)", "val spec_serializer_timestamp : spec_serializer spec_parser_timestamp\nlet spec_serializer_timestamp x = LPC.serialize spec_serializer_timestamp' x", "val check (valid: (state -> bool)) : st unit\nlet check (valid: state -> bool) : st unit =\n let* s = get in\n if valid s then\n return ()\n else\n fail", "val serialize_iv (a: byte_array{A.length a == 96}) (v: timestamp)\n : Steel.ST.Util.STT unit\n (exists_ (fun bs ->\n (A.pts_to a full_perm bs) `star` (pure (seq_suffix_is_zero bs timestamp_len))))\n (fun slice_len ->\n exists_ (fun (bs: _) ->\n (A.pts_to a full_perm bs)\n `star`\n (pure (seq_suffix_is_zero bs timestamp_len /\\ spec_serializer_iv v == bs))))\nlet serialize_iv (a:byte_array { A.length a == 96 })\n (v: timestamp)\n : Steel.ST.Util.STT unit\n (exists_ (fun bs -> A.pts_to a full_perm bs `star` pure (seq_suffix_is_zero bs timestamp_len)))\n (fun slice_len ->\n exists_ (fun (bs:_) ->\n A.pts_to a full_perm bs `star`\n pure (\n seq_suffix_is_zero bs timestamp_len /\\\n spec_serializer_iv v == bs)))\n = let bs = elim_exists () in\n A.pts_to_length a bs;\n elim_pure _;\n seq_suffix_is_zero_elim bs timestamp_len;\n let adj = A.ghost_split a 8sz in\n let n = serialize_timestamp (A.split_l a 8sz) v in \n let bs_l = elim_exists () in\n A.pts_to_length (A.split_l a 8sz) bs_l;\n elim_pure _;\n assert_ (A.pts_to (A.split_l a 8sz) full_perm bs_l `star`\n A.pts_to (A.split_r a 8sz) full_perm (Seq.slice bs 8 (Seq.length bs)));\n A.ghost_join (A.split_l a 8sz) (A.split_r a 8sz) adj;\n rewrite (A.pts_to (A.merge (A.split_l a 8sz) (A.split_r a 8sz)) _ _)\n (A.pts_to a full_perm (spec_serializer_iv v));\n intro_pure (seq_suffix_is_zero (spec_serializer_iv v) timestamp_len /\\\n spec_serializer_iv v == spec_serializer_iv v);\n return ()", "val get' : unit -> STINT int (fun z post -> post (z, z))\nlet get' () = STINT?.reflect (action_get ())", "val accessor'_stamped_record_sr_timestamp:LL.accessor gaccessor'_stamped_record_sr_timestamp\nlet accessor'_stamped_record_sr_timestamp : LL.accessor gaccessor'_stamped_record_sr_timestamp = (LL.accessor_then_snd (LL.accessor_then_fst (LL.accessor_id stamped_record'_parser)) record_jumper)", "val v (#dt: stateful unit) (h: HS.mem) (ll: t dt) : GTot (list (dt_t dt))\nlet v: #dt:stateful unit -> h:HS.mem -> ll:t dt -> GTot (list (dt_t dt)) =\n fun #dt h ll ->\n elems_v h (get_elems h ll)", "val clock_base (#vspec: _) (tl: verifiable_log vspec) : GTot timestamp\nlet clock_base (#vspec:_) (tl: verifiable_log vspec): GTot timestamp\n = let vs = state tl in\n vspec.clock vs", "val state_eta (s: vale_state) : vale_state\nlet state_eta (s:vale_state) : vale_state =\n {s with\n vs_regs = Regs.eta s.vs_regs;\n vs_heap = {s.vs_heap with vf_heaplets = Map16.eta s.vs_heap.vf_heaplets};\n }", "val get_entry (tsm: thread_state_model) (s: T.slot) : GTot (option store_entry)\nlet get_entry (tsm:thread_state_model) (s:T.slot)\r\n : GTot (option store_entry)\r\n = Seq.index tsm.store (U16.v s)", "val get_s : unit \n -> MST state (fun _ -> True)\n\t (fun t0 s t1 -> t0 == t1 /\\ (match t1 with \n | Ok s1 -> s1 == s\n | Tmp _ s1 -> s1 == s))\nlet get_s _ = \n let t = get () in\n match t with\n | Ok s -> s\n | Tmp _ s -> s", "val intro_in_state (r: ref chan_val) (p: prot) (v: chan_val_p p)\n : SteelT unit (pts_to r half v) (fun _ -> in_state r p)\nlet intro_in_state (r:ref chan_val) (p:prot) (v:chan_val_p p)\n : SteelT unit (pts_to r half v) (fun _ -> in_state r p)\n = intro_pure (in_state_prop p v);\n intro_exists v (fun (v:chan_val) -> pts_to r half v `star` in_state_slprop p v)", "val step (entry: log_entry) (st: state) : option state\nlet step (entry:log_entry) (st:state) : option state =\n match entry with\n | Vget k v ->\n let st_v = get st k in\n if st_v = None then None\n else let Some v' = st_v in\n if v' = v then Some st else None\n | Vput k v -> Some (put st k v)", "val get (p: point) : ST (nat * nat) (fun h0 -> live p h0) (fun h0 _ h1 -> live p h1)\nlet get\n (p:point) :ST (nat * nat) (fun h0 -> live p h0) (fun h0 _ h1 -> live p h1)\n = match p with\n | C _ fp f ->\n let _, g = f in\n g fp", "val put (s: state) : EFF unit [WR]\nlet put (s:state) : EFF unit [WR] =\n EFF?.reflect (fun _ -> (Some (), s))", "val accessor_timestamp_timestamp':LL.accessor gaccessor_timestamp_timestamp'\nlet accessor_timestamp_timestamp' : LL.accessor gaccessor_timestamp_timestamp' = synth_timestamp_inverse (); synth_timestamp_injective (); synth_timestamp_recip_inverse (); LL.accessor_synth timestamp'_parser synth_timestamp synth_timestamp_recip ()", "val get: #state: Type u#2 -> #rel: P.preorder state -> Prims.unit\n -> NMSTATETOT state state rel (fun _ -> True) (fun s0 s s1 -> s0 == s /\\ s == s1)\nlet get (#state:Type u#2) (#rel:P.preorder state) ()\n : NMSTATETOT state state rel\n (fun _ -> True)\n (fun s0 s s1 -> s0 == s /\\ s == s1)\n =\n NMSTATETOT?.reflect (fun (_, n) -> MSTTotal.get (), n)", "val get_nonce: #nc: config -> handshake_state nc -> Tot nat\nlet get_nonce : #nc:config -> handshake_state nc -> Tot nat =\n fun #nc state -> state.sym_state.c_state.n", "val get_reference: log -> GTot HS.some_ref\nlet get_reference l =\n HS.(Ref l)", "val Zeta.Steel.Rel.s_timestamp = Type0\nlet s_timestamp = T.timestamp", "val sum_state (s0 s1: state) : Tot state\nlet sum_state (s0:state) (s1:state) : Tot state =\n map2 (+.) s0 s1", "val dt_v: #dt: stateful unit -> HS.mem -> x: dt_s dt -> GTot (dt_t dt)\nlet dt_v (#dt : stateful unit) : HS.mem -> x:dt_s dt -> GTot (dt_t dt) =\n dt.smfi_stateful.v ()", "val get (#s: _) : st s monoid_nat_plus 0 s\nlet get #s : st s monoid_nat_plus 0 s = fun s -> s, s", "val evictbm (#vcfg: _) (s s': slot_id vcfg) (t: timestamp) (vs: vtls_t vcfg {vs.valid})\n : vtls_t vcfg\nlet evictbm #vcfg (s:slot_id vcfg) (s':slot_id vcfg) (t:timestamp)\r\n (vs:vtls_t vcfg {vs.valid}): vtls_t vcfg =\r\n let st = vs.st in\r\n if s = s' then fail vs\r\n else if not (sat_evictb_checks s t vs) || add_method_of st s <> HV.MAdd then fail vs\r\n else if empty_slot st s' then fail vs\r\n else\r\n let k = stored_base_key st s in\r\n let k' = stored_base_key st s' in\r\n let v' = stored_value st s' in\r\n (* check k is a proper desc of k' *)\r\n if not (is_proper_desc k k') then fail vs\r\n else\r\n let v' = to_merkle_value v' in\r\n let d = desc_dir k k' in\r\n let dh' = desc_hash v' d in\r\n match dh' with\r\n | Empty -> fail vs\r\n | Desc k2 h2 b2 ->\r\n if k2 <> k || b2 then fail vs\r\n else if not (has_parent st s) || parent_slot st s <> s' || parent_dir st s <> d then fail vs\r\n else\r\n (* update the evict hash and the clock *)\r\n let vs = vevictb_update_hash_clock s t vs in\r\n // assert(thread_store vs == thread_store vs_upd);\r\n\r\n (* update the hash at k' *)\r\n let v'_upd = Merkle.update_value v' d k h2 true in\r\n let st = update_value st s' (IntV v'_upd) in\r\n\r\n (* evict s' from store *)\r\n let st = mevict_from_store st s s' d in\r\n update_thread_store vs st", "val get_post:\n #v: Type ->\n #c: Type ->\n #vp: (M.epoch_id -> v -> c -> vprop) ->\n init: G.erased c ->\n m: G.erased (repr c) ->\n b: G.erased (borrows v) ->\n a: tbl vp ->\n i: M.epoch_id ->\n get_result v\n -> vprop\nlet get_post\r\n (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (init:G.erased c)\r\n (m:G.erased (repr c))\r\n (b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : get_result v -> vprop\r\n = fun o ->\r\n match o with\r\n | Found x ->\r\n perm a init m (PartialMap.upd b i x) //when `get` succeeds, the key is added to `borrows`\r\n `star`\r\n vp i x (Map.sel m i) //in addition, we return the vp permission for the key\r\n\r\n | _ ->\r\n perm a init m b", "val write (s: state) : GST unit RW\nlet write (s:state) : GST unit RW = GST?.reflect (gst_write s)", "val get (#s: _) (#srel: erel s) : st srel srel\nlet get #s (#srel:erel s) : st srel srel =\n fun s0 -> s0, s0", "val gaccessor_timestamp_timestamp':LL.gaccessor timestamp_parser\n timestamp'_parser\n clens_timestamp_timestamp'\nlet gaccessor_timestamp_timestamp' : LL.gaccessor timestamp_parser timestamp'_parser clens_timestamp_timestamp' = synth_timestamp_inverse (); synth_timestamp_injective (); synth_timestamp_recip_inverse (); LL.gaccessor_synth timestamp'_parser synth_timestamp synth_timestamp_recip ()" ], "closest_src": [ { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.synth_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fst", "name": "Zeta.Steel.Rel.lift_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.next" }, { "project_name": "zeta", "file_name": "Zeta.Steel.VerifierSteps.fst", "name": "Zeta.Steel.VerifierSteps.next" }, { "project_name": "zeta", "file_name": "Zeta.KeyValueStore.StateMachine.fst", "name": "Zeta.KeyValueStore.StateMachine.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Synth.fsti", "name": "Zeta.Formats.Synth.synth_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Spec.fst", "name": "Zeta.Steel.LogEntry.Spec.spec_parser_timestamp" }, { "project_name": "FStar", "file_name": "MonadFunctorInference.fst", "name": "MonadFunctorInference.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.synth_timestamp_recip" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.get" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.get" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.epoch_of_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Generic.Global.fsti", "name": "Zeta.Generic.Global.clock" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.witnessed" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vevictb" }, { "project_name": "zeta", "file_name": "Zeta.GenericVerifier.fsti", "name": "Zeta.GenericVerifier.blum_add_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Synth.fsti", "name": "Zeta.Formats.Synth.synth_timestamp_recip" }, { "project_name": "dice-star", "file_name": "HWAbstraction.fst", "name": "HWAbstraction.st" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vaddb" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ST.fst", "name": "FStar.DM4F.ST.get" }, { "project_name": "FStar", "file_name": "OPLSS2021.BasicState.fst", "name": "OPLSS2021.BasicState.get" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Main.fst", "name": "Zeta.Steel.Main.snapshot" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vevictb_update_hash_clock" }, { "project_name": "zeta", "file_name": "Zeta.GenericVerifier.fsti", "name": "Zeta.GenericVerifier.blum_evict_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.IV.fst", "name": "Zeta.Steel.IV.serialize_timestamp" }, { "project_name": "dice-star", "file_name": "HWAbstraction.fst", "name": "HWAbstraction.st_var" }, { "project_name": "FStar", "file_name": "FStar.DM4F.StExn.fst", "name": "FStar.DM4F.StExn.get" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.get_state_impl" }, { "project_name": "zeta", "file_name": "Zeta.Generic.Interleave.fsti", "name": "Zeta.Generic.Interleave.clock" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.accessor'_timestamp_epoch" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Nonce.fsti", "name": "MiTLS.Nonce.timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vevictbm" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.fst", "name": "Spec.SHA3.get" }, { "project_name": "zeta", "file_name": "Zeta.Time.fsti", "name": "Zeta.Time.first" }, { "project_name": "noise-star", "file_name": "Impl.Noise.LinkedList.fst", "name": "Impl.Noise.LinkedList.t" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Instances.fst", "name": "Spec.Noise.Instances.timestamp_size" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.get" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.get" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.get" }, { "project_name": "FStar", "file_name": "IST.fst", "name": "IST.g" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.get" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.accessor'_timestamp_counter" }, { "project_name": "zeta", "file_name": "Zeta.GenericVerifier.fsti", "name": "Zeta.GenericVerifier.clock_evict_key" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.update_clock" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.increment_epoch" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.get" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.get" }, { "project_name": "FStar", "file_name": "FStar.MSTTotal.fst", "name": "FStar.MSTTotal.get" }, { "project_name": "zeta", "file_name": "Zeta.Time.fsti", "name": "Zeta.Time.epoch_of" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vevictm" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Stamped_record.fst", "name": "Zeta.Formats.Aux.Stamped_record.gaccessor_stamped_record_sr_timestamp" }, { "project_name": "FStar", "file_name": "ProgramEquivalence.fst", "name": "ProgramEquivalence.get_0" }, { "project_name": "steel", "file_name": "MParIndex.fst", "name": "MParIndex.put" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.clock_lek" }, { "project_name": "hacl-star", "file_name": "EverCrypt.AEAD.fst", "name": "EverCrypt.AEAD.as_kv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA3.fst", "name": "Hacl.Impl.SHA3.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.timestamp_bytesize" }, { "project_name": "FStar", "file_name": "OPLSS2021.NDS.fst", "name": "OPLSS2021.NDS.get" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.accessor_timestamp_counter" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.get_state_p" }, { "project_name": "zeta", "file_name": "Zeta.LowStar.LogEntry.fst", "name": "Zeta.LowStar.LogEntry.zeta__serialize_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.vaddm" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.set" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Map16.fsti", "name": "Vale.Lib.Map16.get" }, { "project_name": "zeta", "file_name": "Zeta.Time.fsti", "name": "Zeta.Time.ts_gt" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.gaccessor_timestamp_epoch" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.State.fsti", "name": "Vale.PPC64LE.State.state_eta" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.accessor_timestamp_epoch" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.gaccessor_timestamp_counter" }, { "project_name": "noise-star", "file_name": "Impl.Noise.LinkedList.fsti", "name": "Impl.Noise.LinkedList.dt_t" }, { "project_name": "zeta", "file_name": "Zeta.KeyValueStore.StateMachine.fst", "name": "Zeta.KeyValueStore.StateMachine.put" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Spec.fst", "name": "Zeta.Steel.LogEntry.Spec.spec_serializer_timestamp" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.check" }, { "project_name": "zeta", "file_name": "Zeta.Steel.IV.fst", "name": "Zeta.Steel.IV.serialize_iv" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.get'" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Stamped_record.fst", "name": "Zeta.Formats.Aux.Stamped_record.accessor'_stamped_record_sr_timestamp" }, { "project_name": "noise-star", "file_name": "Impl.Noise.LinkedList.fsti", "name": "Impl.Noise.LinkedList.v" }, { "project_name": "zeta", "file_name": "Zeta.Generic.Thread.fsti", "name": "Zeta.Generic.Thread.clock_base" }, { "project_name": "hacl-star", "file_name": "Vale.X64.State.fsti", "name": "Vale.X64.State.state_eta" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.get_entry" }, { "project_name": "FStar", "file_name": "SnapshotST.fst", "name": "SnapshotST.get_s" }, { "project_name": "steel", "file_name": "Steel.Channel.Simplex.fst", "name": "Steel.Channel.Simplex.intro_in_state" }, { "project_name": "zeta", "file_name": "Zeta.KeyValueStore.StateMachine.fst", "name": "Zeta.KeyValueStore.StateMachine.step" }, { "project_name": "FStar", "file_name": "Point.fst", "name": "Point.get" }, { "project_name": "FStar", "file_name": "Lattice.fst", "name": "Lattice.put" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.accessor_timestamp_timestamp'" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.get" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Base.Definitions.fsti", "name": "Spec.Noise.Base.Definitions.get_nonce" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.HandshakeLog.fst", "name": "MiTLS.HandshakeLog.get_reference" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_timestamp" }, { "project_name": "hacl-star", "file_name": "Spec.Chacha20.fst", "name": "Spec.Chacha20.sum_state" }, { "project_name": "noise-star", "file_name": "Impl.Noise.LinkedList.fsti", "name": "Impl.Noise.LinkedList.dt_v" }, { "project_name": "FStar", "file_name": "GradedMonad.fst", "name": "GradedMonad.get" }, { "project_name": "zeta", "file_name": "Zeta.Intermediate.Verifier.fsti", "name": "Zeta.Intermediate.Verifier.evictbm" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fsti", "name": "Zeta.Steel.EpochMap.get_post" }, { "project_name": "FStar", "file_name": "Sec1.GST.fst", "name": "Sec1.GST.write" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.get" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.Timestamp.fst", "name": "Zeta.Formats.Aux.Timestamp.gaccessor_timestamp_timestamp'" } ], "selected_premises": [ "ReifyTestTSST.timestamp", "ReifyTestTSST.timestamped_state", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Preorder.preorder_rel", "FStar.Pervasives.id", "FStar.Pervasives.st_post_h", "FStar.Pervasives.ex_pre", "FStar.Pervasives.all_post_h", "Prims.min", "FStar.Preorder.stable", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.ex_post'", "FStar.Preorder.reflexive", "FStar.Preorder.transitive", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.ex_post", "Prims.__cache_version_number__", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.pure_close_wp", "Prims.abs", "Prims.pow2", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.st_stronger", "FStar.Pervasives.ex_stronger", "Prims.pure_post'", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.all_return", "Prims.returnM", "FStar.Pervasives.ex_wp", "FStar.Pervasives.st_return", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.all_stronger", "FStar.Pervasives.all_trivial", "Prims.pure_wp_monotonic", "Prims.l_True", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.div_hoare_to_wp", "Prims.pure_trivial", "FStar.Pervasives.st_trivial", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.all_ite_wp", "Prims.purewp_id", "Prims.pure_post", "FStar.Pervasives.st_ite_wp", "Prims.pure_stronger", "Prims.pure_wp_monotonic0", "FStar.Pervasives.all_if_then_else", "Prims.pure_pre", "FStar.Pervasives.ex_close_wp", "Prims.as_requires", "FStar.Pervasives.ex_return", "Prims.pure_wp'", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.st_if_then_else", "Prims.auto_squash", "Prims.pure_wp", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.ex_if_then_else", "Prims.op_Hat", "Prims.subtype_of", "Prims.l_False", "FStar.Pervasives.ex_ite_wp", "FStar.Pervasives.pure_return", "Prims.as_ensures", "FStar.Pervasives.lift_div_exn" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule ReifyTestTSST\n\nopen FStar.Preorder\nopen FStar.Monotonic.Witnessed\n\n(* *************************************************************************************************** *)\n(* A nat-valued instance of time-stamped preorder-indexed state monads for reify-recall demonstration. *)\n(* *************************************************************************************************** *)\n\nlet timestamp = nat\n\nlet timestamped_state (state:Type) = timestamp * state\n", "sketch": [ "To implement `get_timestamp`, we simply need to extract the first component of the timestamped state, which represents the timestamp.", "The definition `get_timestamp` takes a state of type `Type` and a `timestamped_state` and returns the timestamp component of the `timestamped_state`.\n\nStep 1: We want to define a function that extracts the timestamp from a `timestamped_state` in F*.\n\nStep 2: To implement this, we will pattern match on the `timestamped_state` and return the first component, which represents the timestamp.", "The definition `get_timestamp` takes a state of type `Type` and a `timestamped_state` and returns the timestamp component of the `timestamped_state`.\n\nStep 1: We want to define a function that extracts the timestamp from a `timestamped_state`.\nStep 2: We will pattern match on the `timestamped_state` to extract the timestamp component and return it.", "The definition `get_timestamp` takes a state of type `Type` and a `timestamped_state` and returns the timestamp component of the `timestamped_state`.\n\nStep 1: The `get_timestamp` function retrieves the timestamp from a `timestamped_state`.\n\nStep 2: To implement `get_timestamp`, we will simply pattern match on the `timestamped_state` and return the first component, which is the timestamp.", "To implement `get_timestamp`, we simply need to extract the first component of the timestamped state, which represents the timestamp.", "To implement `get_timestamp`, we simply need to extract the first component of the timestamped state, which represents the timestamp.", "To implement `get_timestamp`, we simply need to extract the first component of the timestamped state, which represents the timestamp.", "The definition `get_timestamp` takes a state of type `Type` and a `timestamped_state` and returns the timestamp component of the `timestamped_state`.\n\nStep 1: We want to define a function that extracts the timestamp from a `timestamped_state` in F*.\n\nStep 2: To implement this, we will simply pattern match on the `timestamped_state` and return the first component, which is the timestamp.", "The definition `get_timestamp` takes a state of type `Type` and a timestamped state, and returns the timestamp component of the timestamped state.\n\nStep 1: We need to define a function that extracts the timestamp from a timestamped state.\n\nStep 2: To implement `get_timestamp`, we will pattern match on the input timestamped state and return the first component, which is the timestamp.", "To implement `get_timestamp`, we simply need to extract the first component of the timestamped state, which represents the timestamp." ], "generated_solution": [ "val get_timestamp : #state:Type -> timestamped_state state -> timestamp\nlet get_timestamp {state} (ts, _) = ts", "let get_timestamp {state: Type} (ts: timestamped_state state): timestamp =\n match ts with\n | (t, _) -> t", "let get_timestamp {state:Type} (ts: timestamped_state state): timestamp =\n match ts with\n | (t, _) -> t", "let get_timestamp {state: Type} (ts: timestamped_state state): timestamp =\n match ts with\n | (t, _) -> t", "val get_timestamp : #state:Type -> timestamped_state state -> timestamp\nlet get_timestamp (state:Type) (ts: timestamped_state state) : timestamp = fst ts", "val get_timestamp : #state:Type -> timestamped_state state -> timestamp\nlet get_timestamp (state:Type) (ts: timestamped_state state) : timestamp = fst ts", "val get_timestamp : #state:Type -> timestamped_state state -> timestamp\nlet get_timestamp (state:Type) (ts:timestamped_state state) : timestamp = fst ts", "let get_timestamp {state: Type} (ts: timestamped_state state): timestamp =\n match ts with\n | (t, _) -> t", "let get_timestamp = fun (state: Type) (ts: timestamped_state state) -> fst ts", "val get_timestamp : #state:Type -> timestamped_state state -> timestamp\nlet get_timestamp (s:Type) (ts:timestamped_state s) : timestamp = fst ts" ] }, { "file_name": "Param.fst", "name": "Param.push_var_to_state", "opens_and_abbrevs": [ { "open": "FStar.Tactics.V2" }, { "open": "FStar.List" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state", "source_definition": "let push_var_to_state (v:namedv) (b0 b1 b2 : binder) (s:param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }", "source_range": { "start_line": 46, "start_col": 0, "end_line": 47, "end_col": 49 }, "interleaved": false, "definition": "fun v b0 b1 b2 s ->\n Param.Mkparam_state ((v, (b0, b1, b2)) :: Mkparam_state?.bvmap s)\n (Mkparam_state?.fresh s)\n (Mkparam_state?.recs s)\n <:\n Param.param_state", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Tactics.NamedView.namedv", "FStar.Tactics.NamedView.binder", "Param.param_state", "Param.Mkparam_state", "Prims.Cons", "FStar.Pervasives.Native.tuple2", "FStar.Pervasives.Native.tuple3", "FStar.Pervasives.Native.Mktuple2", "FStar.Pervasives.Native.Mktuple3", "Param.__proj__Mkparam_state__item__bvmap", "Param.__proj__Mkparam_state__item__fresh", "Param.__proj__Mkparam_state__item__recs" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "\n v: FStar.Tactics.NamedView.namedv ->\n b0: FStar.Tactics.NamedView.binder ->\n b1: FStar.Tactics.NamedView.binder ->\n b2: FStar.Tactics.NamedView.binder ->\n s: Param.param_state\n -> Param.param_state", "prompt": "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n ", "expected_response": "{ s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }", "source": { "project_name": "FStar", "file_name": "examples/param/Param.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "Param.fst", "checked_file": "dataset/Param.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Sealed.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Order.fst.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "bvmap", "let fvmap = list (fv * fv)", "param_state", "param_state", "bvmap", "bvmap", "fresh", "fresh", "recs", "recs", "let rec fold_right2 (f : 'a -> 'b -> 'c -> Tac 'c) (l1:list 'a) (l2:list 'b) (c:'c) : Tac 'c =\n match l1, l2 with\n | h1::t1, h2::t2 -> f h1 h2 (fold_right2 f t1 t2 c)\n | [], [] -> c\n | _ -> fail \"fold_right2\"", "let rec zip3 (l1 : list 'a) (l2 : list 'b) (l3 : list 'c) : list ('a * 'b * 'c) =\n match l1, l2, l3 with\n | h1::t1, h2::t2, h3::t3 -> (h1, h2, h3) :: (zip3 t1 t2 t3)\n | _ -> []", "let last (xs:list 'a) : Tac 'a =\n match List.Tot.rev xs with\n | h::_ -> h\n | [] -> fail \"last: empty list\"", "let fresh_binder_named (nm:string) (t:typ) : Tac binder =\n // useful?\n //let n = fresh () in\n //let nm = nm ^ \"_\" ^ string_of_int n in\n Tactics.V2.fresh_binder_named nm t", "let app_binders (t:term) (bs:list binder) : Tac term =\n mk_e_app t (List.Tot.map binder_to_term bs)" ], "closest": [ "val binder_to_namedv (b: binder) : Tot namedv\nlet binder_to_namedv (b : binder) : Tot namedv =\n {\n ppname = b.ppname;\n uniq = b.uniq;\n sort = seal b.sort;\n }", "val push_binder (name typ: string) (b: binders) : binders\nlet push_binder (name: string) (typ: string) (b: binders) : binders = {\n is_empty = false;\n bind = Printf.sprintf \"(%s %s) %s\" name typ b.bind;\n args = Printf.sprintf \" %s%s\" name b.args;\n}", "val subst_var (v: namedv) (s: subst) : term\nlet subst_var (v:namedv) (s:subst) : term =\n match find_matching_subst_elt_var s v with\n | Some (NT _ t) ->\n (match maybe_uniq_of_term t with\n | None -> t\n | Some k ->\n pack_ln (Tv_Var (pack_namedv { inspect_namedv v with uniq = k })))\n | Some (ND _ i) ->\n let bv = pack_bv {\n sort = (inspect_namedv v).sort;\n ppname = (inspect_namedv v).ppname;\n index = i;\n } in\n pack_ln (Tv_BVar bv)\n | _ -> pack_ln (Tv_Var v)", "val r_binder_to_namedv (b: binder) : R.namedv\nlet r_binder_to_namedv (b : binder) : R.namedv =\n pack_namedv {\n uniq = b.uniq;\n sort = seal b.sort;\n ppname = b.ppname;\n }", "val push_binding (e: env) (b: binding) : env\nlet push_binding (e:env) (b:binding) : env =\n let nv : namedv = pack_namedv {\n uniq = b.uniq;\n sort = seal b.sort;\n ppname = b.ppname;\n }\n in\n push_namedv e nv", "val binding_to_namedv (b: binding) : Tot namedv\nlet binding_to_namedv (b : binding) : Tot namedv =\n {\n ppname = b.ppname;\n sort = seal b.sort;\n uniq = b.uniq\n }", "val namedv_to_binder (v: namedv) (sort: term) : binder\nlet namedv_to_binder (v : namedv) (sort : term) : binder =\n {\n uniq = v.uniq;\n sort = sort;\n ppname = v.ppname;\n qual = Q_Explicit;\n attrs = [];\n }", "val binding_to_namedv (b: R.binding) : Tot namedv\nlet binding_to_namedv (b:R.binding) : Tot namedv =\n pack_namedv {\n RD.uniq = b.uniq;\n RD.sort = seal b.sort;\n RD.ppname = b.ppname;\n }", "val va_expand_state (s: state) : state\nlet va_expand_state (s:state) : state = s", "val state_inv (s: va_state) : prop0\nlet state_inv (s:va_state) : prop0 = M.mem_inv s.vs_heap", "val var_as_namedv (v: nat) : namedv\nlet var_as_namedv (v:nat) : namedv =\n pack_namedv {\n uniq = v;\n sort = sort_default;\n ppname = pp_name_default;\n }", "val state_inv (s: state) : prop0\nlet state_inv (s:state) : prop0 = M.mem_inv (coerce s.ms_heap)", "val st_var:state\nlet st_var : state =\n let l0_image_header_size = 1ul in\n let l0_binary_size = 1ul in\n let ghost_state = B.mgcmalloc HS.root (G.hide (true, true)) 1ul in\n let cdi = B.gcmalloc HS.root (I.u8 0) digest_len in\n let l0_image_header = B.gcmalloc HS.root (I.u8 0) l0_image_header_size in\n let l0_image_header_sig = B.gcmalloc HS.root (I.u8 0) 64ul in\n let l0_binary = B.gcmalloc HS.root (I.u8 0) l0_binary_size in\n let l0_binary_hash = B.gcmalloc HS.root (I.u8 0) digest_len in\n let l0_image_auth_pubkey = B.gcmalloc HS.root (I.u8 0) 32ul in\n\n let l0 = {\n l0_image_header_size = l0_image_header_size;\n l0_image_header = l0_image_header;\n l0_image_header_sig = l0_image_header_sig;\n l0_binary_size = l0_binary_size;\n l0_binary = l0_binary;\n l0_binary_hash = l0_binary_hash;\n l0_image_auth_pubkey = l0_image_auth_pubkey } in\n\n { ghost_state = ghost_state;\n cdi = cdi;\n l0 = l0 }", "val va_state_match (s0 s1: va_state)\n : Pure Type0 (requires True) (ensures fun b -> b ==> state_eq s0 s1)\nlet va_state_match (s0:va_state) (s1:va_state) : Pure Type0\n (requires True)\n (ensures fun b -> b ==> state_eq s0 s1)\n =\n FStar.Classical.move_requires (lemma_state_match s0) s1;\n state_match s0 s1", "val va_state_match (s0 s1: va_state)\n : Pure Type0 (requires True) (ensures fun b -> b ==> state_eq s0 s1)\nlet va_state_match (s0:va_state) (s1:va_state) : Pure Type0\n (requires True)\n (ensures fun b -> b ==> state_eq s0 s1)\n =\n FStar.Classical.move_requires (lemma_state_match s0) s1;\n state_match s0 s1", "val va_state_eq (s0 s1: va_state) : prop0\nlet va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1", "val va_state_eq (s0 s1: va_state) : prop0\nlet va_state_eq (s0:va_state) (s1:va_state) : prop0 = state_eq s0 s1", "val vbind0 (a: vprop) (t: Type0) (b: (t_of a -> Tot vprop)) : Tot vprop\nlet vbind0\n (a: vprop)\n (t: Type0)\n (b: (t_of a -> Tot vprop))\n: Tot vprop\n= a `vdep` vbind0_payload a t b `vrewrite` vbind0_rewrite a t b", "val push_pre (st: state) (inv_bv: bv) (t: term) : Tac term\nlet rec push_pre (st: state) (inv_bv: bv) (t: term): Tac term =\n match inspect t with\n | Tv_Arrow bv c ->\n let c =\n match inspect_comp c with\n | C_Eff us e a args decrs ->\n if string_of_name e = \"FStar_HyperStack_ST_Stack\" then\n let args =\n match args with\n | (pre, qual) :: rest ->\n let pre =\n match inspect pre with\n | Tv_Abs h body ->\n let body = mk_app (`( /\\ )) [ pack (Tv_Var inv_bv), Q_Explicit; body, Q_Explicit ] in\n pack (Tv_Abs h body)\n | _ ->\n fail \"impossible: argument to ST.Stack not a fun\"\n in\n (pre, qual) :: rest\n | _ ->\n fail (\"impossible: effect not fully applied \" ^ string_of_name e)\n in\n C_Eff us e a args decrs\n else\n fail (\"rewritten function has an unknown effect: \" ^ string_of_name e)\n | C_Total t ->\n C_Total (push_pre st inv_bv t)\n | _ ->\n fail (\"rewritten type is neither a Tot or a stateful arrow: \" ^ term_to_string t)\n in\n let c = pack_comp c in\n pack (Tv_Arrow bv c)\n | _ ->\n print (st.indent ^ \" WARN: no effect found, are you using the specialize tactic on pure code?\");\n t", "val va_expand_state (s: vale_state) : vale_state\nlet va_expand_state (s:vale_state) : vale_state = state_eta s", "val va_upd_operand_reg_opr (r: reg_opr) (v: nat64) (s: state) : state\nlet va_upd_operand_reg_opr (r:reg_opr) (v:nat64) (s:state) : state = va_upd_reg r v s", "val put (st: state) (k: F.key_t) (v: F.value_t) : state\nlet put (st:state) (k:F.key_t) (v:F.value_t) : state =\n Map.upd st k (Some v)", "val update_state (r: reg) (s' s: state) : state\nlet update_state (r:reg) (s' s:state) : state =\n update_reg s r (s' r)", "val update_state (r: reg) (s' s: state) : state\nlet update_state (r:reg) (s' s:state) : state =\n update_reg s r (s' r)", "val va_upd_operand_heaplet (h: heaplet_id) (v: vale_heap) (s: va_state) : va_state\nlet va_upd_operand_heaplet (h:heaplet_id) (v:vale_heap) (s:va_state) : va_state = va_upd_mem_heaplet h v s", "val va_upd_stack (stack: SI.vale_stack) (s: state) : state\nlet va_upd_stack (stack:SI.vale_stack) (s:state) : state = { s with ms_stack = (VSS.stack_to_s stack) }", "val va_upd_stack (stack: S.vale_stack) (s: vale_state) : vale_state\nlet va_upd_stack (stack:S.vale_stack) (s:vale_state) : vale_state = { s with vs_stack = stack }", "val freevars_binder (b: binder) : Tot (Set.set var) (decreases b)\nlet rec freevars (e:term)\n : FStar.Set.set var\n = match inspect_ln e with\n | Tv_Uvar _ _ -> Set.complement Set.empty\n \n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unknown \n | Tv_Unsupp\n | Tv_BVar _ -> Set.empty\n\n | Tv_Var x -> Set.singleton (namedv_uniq x)\n \n | Tv_App e1 (e2, _) ->\n Set.union (freevars e1) (freevars e2)\n\n | Tv_Abs b body -> \n Set.union (freevars_binder b) (freevars body)\n\n | Tv_Arrow b c ->\n Set.union (freevars_binder b) (freevars_comp c)\n\n | Tv_Refine b f ->\n freevars (binder_sort b) `Set.union`\n freevars f\n \n | Tv_Let recf attrs b def body ->\n freevars_terms attrs `Set.union`\n freevars (binder_sort b) `Set.union`\n freevars def `Set.union`\n freevars body\n\n | Tv_Match scr ret brs ->\n freevars scr `Set.union`\n freevars_opt ret freevars_match_returns `Set.union`\n freevars_branches brs\n\n | Tv_AscribedT e t tac b ->\n freevars e `Set.union`\n freevars t `Set.union`\n freevars_opt tac freevars\n \n | Tv_AscribedC e c tac b ->\n freevars e `Set.union`\n freevars_comp c `Set.union`\n freevars_opt tac freevars\n\nand freevars_opt (#a:Type0) (o:option a) (f: (x:a { x << o } -> FStar.Set.set var))\n : FStar.Set.set var\n = match o with\n | None -> Set.empty\n | Some x -> f x\n\nand freevars_comp (c:comp)\n : FStar.Set.set var\n = match inspect_comp c with\n | C_Total t\n | C_GTotal t ->\n freevars t\n\n | C_Lemma pre post pats ->\n freevars pre `Set.union`\n freevars post `Set.union`\n freevars pats\n\n | C_Eff us eff_name res args decrs ->\n freevars res `Set.union`\n freevars_args args `Set.union`\n freevars_terms decrs\n\nand freevars_args (ts:list argv)\n : FStar.Set.set var\n = match ts with\n | [] -> Set.empty\n | (t,q)::ts ->\n freevars t `Set.union`\n freevars_args ts\n\nand freevars_terms (ts:list term)\n : FStar.Set.set var\n = match ts with\n | [] -> Set.empty\n | t::ts ->\n freevars t `Set.union`\n freevars_terms ts\n \nand freevars_binder (b:binder)\n : Tot (Set.set var) (decreases b)\n = let bndr = inspect_binder b in\n freevars bndr.sort `Set.union`\n freevars_terms bndr.attrs \n\nand freevars_pattern (p:pattern) \n : Tot (Set.set var) (decreases p)\n = match p with\n | Pat_Constant _ ->\n Set.empty\n\n | Pat_Cons head univs subpats ->\n freevars_patterns subpats\n \n | Pat_Var bv s -> Set.empty\n\n | Pat_Dot_Term topt ->\n freevars_opt topt freevars\n\nand freevars_patterns (ps:list (pattern & bool))\n : Tot (Set.set var) (decreases ps)\n = match ps with\n | [] -> Set.empty\n | (p, b)::ps ->\n freevars_pattern p `Set.union`\n freevars_patterns ps\n\nand freevars_branch (br:branch)\n : Tot (Set.set var) (decreases br)\n = let p, t = br in\n freevars_pattern p `Set.union`\n freevars t\n\nand freevars_branches (brs:list branch)\n : Tot (Set.set var) (decreases brs)\n = match brs with\n | [] -> Set.empty\n | hd::tl -> freevars_branch hd `Set.union` freevars_branches tl\n \nand freevars_match_returns (m:match_returns_ascription)\n : Tot (Set.set var) (decreases m)\n = let b, (ret, as_, eq) = m in\n let b = freevars_binder b in\n let ret =\n match ret with\n | Inl t -> freevars t\n | Inr c -> freevars_comp c\n in\n let as_ = freevars_opt as_ freevars in\n b `Set.union` ret `Set.union` as_", "val state_or_fail (s: machine_state) (b: bool) (s': machine_state) : machine_state\nlet state_or_fail (s:machine_state) (b:bool) (s':machine_state) : machine_state =\n if b then s' else {s with ms_ok = false}", "val state_match (s0 s1: va_state) : Type0\nlet state_match (s0:va_state) (s1:va_state) : Type0 =\n s0.ok == s1.ok /\\\n Regs.equal s0.regs s1.regs /\\\n Vecs.equal s0.vecs s1.vecs /\\\n s0.cr0 == s1.cr0 /\\\n s0.xer == s1.xer /\\\n s0.ms_heap == s1.ms_heap /\\\n s0.ms_stack == s1.ms_stack /\\\n s0.ms_stackTaint == s1.ms_stackTaint", "val state_match (s0 s1: va_state) : Type0\nlet state_match (s0:va_state) (s1:va_state) : Type0 =\n s0.vs_ok == s1.vs_ok /\\\n all_regs_match s0.vs_regs s1.vs_regs /\\\n s0.vs_flags == s1.vs_flags /\\\n s0.vs_heap == s1.vs_heap /\\\n s0.vs_stack == s1.vs_stack /\\\n s0.vs_stackTaint == s1.vs_stackTaint", "val binder_to_binding (b: binder) : binding\nlet binder_to_binding (b : binder) : binding =\n {\n ppname = b.ppname;\n uniq = b.uniq;\n sort = b.sort;\n }", "val is_valid_state (e1: extern_ptr) (n1: SizeT.t) (e2: extern_ptr) (n2: SizeT.t) (b: bool)\n : Tot vprop\nlet is_valid_state\n (e1: extern_ptr)\n (n1: SizeT.t)\n (e2: extern_ptr)\n (n2: SizeT.t)\n (b: bool)\n: Tot vprop\n= if b then is_valid_state_true e1 n1 e2 n2 else emp", "val bind_st (s a b: Type) (f: st s a) (g: (a -> st s b)) : st s b\nlet bind_st (s:Type) (a:Type) (b:Type) (f:st s a) (g:a -> st s b) : st s b\n = fun (s0:s) -> let (x,s) = f s0 in g x s", "val subst_binder_sort (s: subst_t) (b: binder) : binder\nlet subst_binder_sort (s : subst_t) (b : binder) : binder =\n { b with sort = subst_term s b.sort }", "val run (f: st unit) (s: state) : state\nlet run (f:st unit) (s:state) : state = snd (f s)", "val genv_push_binder (ge: genv) (b: binder) (abs: bool) (t: option term) : Tac genv\nlet genv_push_binder (ge:genv) (b:binder) (abs:bool) (t:option term) : Tac genv =\n genv_push_bv ge (bv_of_binder b) (binder_sort b) abs t", "val update_stack_and_taint (ptr: int) (v: nat64) (s: state) (t: taint) : state\nlet update_stack_and_taint (ptr:int) (v:nat64) (s:state) (t:taint) : state =\n let Machine_stack init_r1 mem = s.ms_stack in\n { s with\n ms_stack = update_stack64' ptr v s.ms_stack;\n ms_stackTaint = update_n ptr 8 s.ms_stackTaint t;\n }", "val Pulse.Syntax.Naming.close_binder = b: Pulse.Syntax.Base.binder -> v: Pulse.Syntax.Base.var -> i: Prims.nat -> Pulse.Syntax.Base.binder\nlet close_binder b v i =\r\n subst_binder b [ ND v i ]", "val vbind (a: vprop) (t: Type0) (b: (t_of a -> Tot vprop)) : Tot vprop\nlet vbind\n (a: vprop)\n (t: Type0)\n (b: (t_of a -> Tot vprop))\n: Tot vprop\n= VUnit (vbind' a t b)", "val push (ss:ss_t) (x:var { ~ (contains ss x) }) (t:term) : ss_t\nlet push (ss:ss_t) (x:var { ~ (contains ss x) }) (t:term) : ss_t =\n \n is_dom_push ss.l ss.m x t;\n { l = x::ss.l;\n m = Map.upd ss.m x t }", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: (a -> pre_t state))\n (ens_g: (a -> post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:a -> pre_t state)\n (ens_g:a -> post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun s0 ->\n let x, s1 = f s0 in\n (g x) s1", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: (a -> pre_t state))\n (ens_g: (a -> post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:a -> pre_t state)\n (ens_g:a -> post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun s0 ->\n let x, s1 = f s0 in\n (g x) s1", "val r_subst_binder_sort (s: subst_t) (b: R.binder) : R.binder\nlet r_subst_binder_sort (s : subst_t) (b : R.binder) : R.binder =\n let v = inspect_binder b in\n let v = { v with sort = subst_term s v.sort } in\n pack_binder v", "val push_stack_parameters_maintains_variable_among_gvars\n (v: var_id_t)\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (var_ids: list var_id_t)\n (parameters: list object_value_t)\n (s: Armada.State.t)\n : Lemma (requires variable_among_gvars s.mem v)\n (ensures\n (match\n push_stack_parameters actor\n writer_pc\n writer_expression_number\n method_id\n frame_uniq\n var_ids\n parameters\n s\n with\n | ComputationImpossible | ComputationUndefined -> True\n | ComputationProduces s' -> variable_among_gvars s'.mem v))\n (decreases parameters)\nlet rec push_stack_parameters_maintains_variable_among_gvars\n (v: var_id_t)\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (var_ids: list var_id_t)\n (parameters: list object_value_t)\n (s: Armada.State.t)\n : Lemma (requires variable_among_gvars s.mem v)\n (ensures (match push_stack_parameters actor writer_pc writer_expression_number method_id frame_uniq\n var_ids parameters s with\n | ComputationImpossible | ComputationUndefined -> True\n | ComputationProduces s' -> variable_among_gvars s'.mem v))\n (decreases parameters) =\n match parameters, var_ids with\n | [], [] -> ()\n | first_parameter :: remaining_parameters, first_var_id :: remaining_var_ids ->\n let first_initializer =\n { var_id = first_var_id; iv = InitializerSpecific first_parameter; weakly_consistent = false } in\n push_stack_variable_maintains_variable_among_gvars v actor writer_pc writer_expression_number method_id frame_uniq\n first_initializer s;\n (match push_stack_variable actor writer_pc writer_expression_number method_id frame_uniq first_initializer s with\n | ComputationImpossible | ComputationUndefined -> ()\n | ComputationProduces s' ->\n push_stack_parameters_maintains_variable_among_gvars v actor writer_pc (writer_expression_number + 1)\n method_id frame_uniq remaining_var_ids remaining_parameters s')\n | _ -> ()", "val handle_has_state (h: handle_t) (s: st_t) : vprop\nlet handle_has_state (h:handle_t) (s:st_t) : vprop = pts_to h s", "val vbind0_payload (a: vprop) (t: Type0) (b: (t_of a -> Tot vprop)) (x: t_of a) : Tot vprop\nlet vbind0_payload\n (a: vprop)\n (t: Type0)\n (b: (t_of a -> Tot vprop))\n (x: t_of a)\n: Tot vprop\n= vpure (t == t_of (b x)) `star` b x", "val make_namedv_with_name (s: pp_name_t) (n: nat) : namedv_view\nlet make_namedv_with_name (s:pp_name_t) (n:nat) : namedv_view = {\n ppname = s;\n uniq = n;\n sort = sort_default;\n}", "val make_bv_with_name (s: pp_name_t) (n: nat) : bv_view\nlet make_bv_with_name (s:pp_name_t) (n:nat) : bv_view = {\n ppname = s;\n index = n;\n sort = sort_default;\n}", "val params_of_typ_or_comp (c: typ_or_comp) : list binder\nlet params_of_typ_or_comp (c : typ_or_comp) : list binder =\n match c with\n | TC_Typ _ pl _ | TC_Comp _ pl _ -> pl", "val run (#s #a #n: _) (f: m s a n) (state: s) (bools: tape) (pos: nat) : (a & s)\nlet rec run #s #a #n (f:m s a n) (state:s) (bools:tape) (pos:nat)\n : (a & s)\n = match f with\n | Ret x -> x, state\n \n | _ ->\n let Step _ f' state' pos' = step pos f state bools in\n run f' state' bools pos'", "val binder_to_term (b: binder) : Tot term\nlet binder_to_term (b : binder) : Tot term =\n pack (Tv_Var (binder_to_namedv b))", "val binder_to_term (b: binder) : Tot term\nlet binder_to_term (b:binder) : Tot term =\n pack (Tv_Var (binder_to_namedv b))", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: (a -> M.pre_t state))\n (ens_g: (a -> M.post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:a -> M.pre_t state)\n (ens_g:a -> M.post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun (t, n) ->\n let x, n1 = f (t, n) in\n (g x) (t, n1)", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: (a -> M.pre_t state))\n (ens_g: (a -> M.post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:a -> M.pre_t state)\n (ens_g:a -> M.post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun (t, n) ->\n let x, n1 = f (t, n) in\n (g x) (t, n1)", "val input_b (s:input_state)\n: Tot (b: input_buffer{\n Buffer.disjoint_ref_1 b (input_pos s) /\\\n Buffer.frameOf b = Mem.frameOf (input_pos s) /\\ \n Buffer.length b = v maxlen})\nlet input_b s = s.b", "val state_eq (s0 s1: state) : prop0\nlet state_eq (s0:state) (s1:state) : prop0 =\n s0.ok == s1.ok /\\\n Regs.equal s0.regs s1.regs /\\\n Vecs.equal s0.vecs s1.vecs /\\\n s0.cr0 == s1.cr0 /\\\n s0.xer == s1.xer /\\\n M.vale_full_heap_equal (coerce s0.ms_heap) (coerce s1.ms_heap) /\\\n s0.ms_stack == s1.ms_stack /\\\n s0.ms_stackTaint == s1.ms_stackTaint", "val binder_to_string_paren (b: binder) : T.Tac string\nlet rec binder_to_string_paren (b:binder)\n : T.Tac string\n = sprintf \"(%s%s:%s)\"\n (match T.unseal b.binder_attrs with\n | [] -> \"\"\n | l -> sprintf \"[@@@ %s] \" (String.concat \";\" (T.map (term_to_string' \"\") l)))\n (T.unseal b.binder_ppname.name)\n (term_to_string' \"\" b.binder_ty)\n\nand term_to_string' (level:string) (t:term)\n : T.Tac string\n = match t.t with\n | Tm_Emp -> \"emp\"\n\n | Tm_Pure p ->\n sprintf \"pure (%s)\" \n (term_to_string' (indent level) p)\n \n | Tm_Star p1 p2 ->\n sprintf \"%s ** \\n%s%s\" \n (term_to_string' level p1)\n level\n (term_to_string' level p2)\n \n | Tm_ExistsSL _ _ _ ->\n let bs, body = collect_binders Tm_ExistsSL? t in\n sprintf \"(exists* %s.\\n%s%s)\"\n (T.map binder_to_string_paren bs |> String.concat \" \")\n level\n (term_to_string' (indent level) body)\n\n | Tm_ForallSL u b body ->\n let bs, body = collect_binders Tm_ForallSL? t in\n sprintf \"(forall* %s.\\n%s%s)\"\n (T.map binder_to_string_paren bs |> String.concat \" \")\n level\n (term_to_string' (indent level) body)\n \n | Tm_VProp -> \"vprop\"\n | Tm_Inames -> \"inames\"\n | Tm_EmpInames -> \"emp_inames\"\n | Tm_Unknown -> \"_\"\n | Tm_AddInv i is ->\n sprintf \"add_inv %s %s\"\n (term_to_string' level i)\n (term_to_string' level is)\n | Tm_Inv i ->\n sprintf \"inv %s\"\n (term_to_string' level i)\n | Tm_FStar t ->\n T.term_to_string t", "val genv_push_bv (ge: genv) (b: bv) (sort: typ) (abs: bool) (t: option term) : Tac genv\nlet genv_push_bv (ge:genv) (b:bv) (sort:typ) (abs:bool) (t:option term) : Tac genv =\n let br = mk_binder b sort in\n let sv = genv_get_from_name ge (name_of_bv b) in\n let svars' = if Some? sv then fst (Some?.v sv) :: ge.svars else ge.svars in\n let e' = push_binder ge.env br in\n let tm = if Some? t then Some?.v t else pack (Tv_Var b) in\n let bmap' = bind_map_push ge.bmap b (sort, abs, tm) in\n mk_genv e' bmap' svars'", "val va_upd_operand_heaplet (n: heaplet_id) (h: vale_heap) (s: state) : state\nlet va_upd_operand_heaplet (n:heaplet_id) (h:vale_heap) (s:state) : state =\n va_upd_mem_heaplet n h s", "val va_upd_reg (r: reg) (v: nat64) (s: state) : state\nlet va_upd_reg (r:reg) (v:nat64) (s:state) : state = update_reg r v s", "val vbind' (a: vprop) (t: Type0) (b: (t_of a -> Tot vprop)) : GTot vprop'\nlet vbind'\n (a: vprop)\n (t: Type0)\n (b: (t_of a -> Tot vprop))\n: GTot vprop'\n= {\n hp = vbind_hp a t b;\n t = t;\n sel = vbind_sel a t b;\n}", "val binder_to_term (b: binder) : Tac term\nlet binder_to_term (b : binder) : Tac term =\n let bview = inspect_binder b in\n bv_to_term bview.binder_bv", "val put (#state: Type u#2) (#rel: P.preorder state) (s: state)\n : NMSTATETOT unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)\nlet put (#state:Type u#2) (#rel:P.preorder state) (s:state)\n : NMSTATETOT unit state rel\n (fun s0 -> rel s0 s)\n (fun _ _ s1 -> s1 == s)\n =\n NMSTATETOT?.reflect (fun (_, n) -> MSTTotal.put s, n)", "val upd_register (r: reg) (v: t_reg r) (s: vale_state) : vale_state\nlet upd_register (r:reg) (v:t_reg r) (s:vale_state) : vale_state = update_reg r v s", "val pure_handle_has_state (h: pure_handle_t) (s: pure_st_t) : vprop\nlet pure_handle_has_state (h:pure_handle_t) (s:pure_st_t) : vprop = pts_to h #one_half s", "val state_eq (s0 s1: vale_state) : prop0\nlet state_eq (s0:vale_state) (s1:vale_state) : prop0 =\n s0.vs_ok == s1.vs_ok /\\\n Regs.equal s0.vs_regs s1.vs_regs /\\\n Flags.equal s0.vs_flags s1.vs_flags /\\\n vale_full_heap_equal s0.vs_heap s1.vs_heap /\\\n s0.vs_stack == s1.vs_stack /\\\n s0.vs_stackTaint == s1.vs_stackTaint", "val g (i: nat{i > 0}) : STATE int (int >< (fun p s0 -> forall k. k > s0 ==> p s0 k))\nlet g (i:nat{i > 0}) \n : STATE int (int >< (fun p s0 -> forall k . k > s0 ==> p s0 k))\n = let j = get () in put (i + j); j", "val storeState_inner:\n s:state\n -> j:size_t{v j < 25}\n -> block:lbuffer uint8 200ul\n -> Stack unit\n (requires fun h0 -> live h0 s /\\ live h0 block /\\ disjoint s block)\n (ensures fun h0 _ h1 ->\n modifies (loc block) h0 h1 /\\\n as_seq h1 block == S.storeState_inner (as_seq h0 s) (v j) (as_seq h0 block))\nlet storeState_inner s j block =\n let sj = s.(j) in\n let h0 = ST.get () in\n update_sub_f h0 block (j *! 8ul) 8ul\n (fun h -> Lib.ByteSequence.uint_to_bytes_le sj)\n (fun _ -> uint_to_bytes_le #U64 (sub block (j *! 8ul) 8ul) sj)", "val fresh_binder_named (s: string) (t: typ) : Tac simple_binder\nlet fresh_binder_named (s : string) (t : typ) : Tac simple_binder =\n let n = fresh () in\n {\n ppname = seal s;\n sort = t;\n uniq = n;\n qual = Q_Explicit;\n attrs = [] ;\n }", "val st_var (x: var) (v: nstype int) : GTot sttype\nlet st_var\n (x: var)\n (v: nstype int)\n: GTot sttype\n= let f (s1 s2: heap) : GTot Type0 = holds v (sel s1 x) (sel s2 x) in\n Classical.forall_intro_2 (holds_equiv f);\n f", "val bind_st (#s #a #b: Type) (f: st s a) (g: (a -> st s b)) : st s b\nlet bind_st (#s:Type) (#a:Type) (#b:Type) (f:st s a) (g:a -> st s b) : st s b\n = fun s0 -> let x, s1 = f s0 in g x s1", "val push_stack_variable\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializer: initializer_t)\n (s: Armada.State.t)\n : GTot (conditional_computation_t Armada.State.t)\nlet push_stack_variable\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializer: initializer_t)\n (s: Armada.State.t)\n : GTot (conditional_computation_t Armada.State.t) =\n let root_id = RootIdStack actor method_id frame_uniq initializer.var_id in\n let root = s.mem root_id in\n if not (stack_variable_ready_for_push root initializer) then\n ComputationImpossible\n else\n let thread = s.threads actor in\n let var_id = initializer.var_id in\n if list_contains var_id thread.top.local_variables then\n ComputationImpossible\n else\n let local_variables' = var_id :: thread.top.local_variables in\n let top' = { thread.top with local_variables = local_variables' } in\n let thread' = { thread with top = top' } in\n let threads' = upd s.threads actor thread' in\n let root' = RootStackVariable true false (RootStackVariable?.storage root) in\n let mem' = Spec.Map.upd s.mem root_id root' in\n let s' = { s with mem = mem'; threads = threads' } in\n (match initializer.iv with\n | InitializerArbitrary td -> return s'\n | InitializerSpecific value ->\n let td = (object_value_to_td value) in\n update_expression (ExpressionLocalVariable td var_id) actor writer_pc writer_expression_number\n false value s')", "val find_matching_subst_elt_var (s: subst) (v: namedv) : option subst_elt\nlet rec find_matching_subst_elt_var (s:subst) (v:namedv) : option subst_elt =\n match s with\n | [] -> None\n | (NT y _)::rest \n | (ND y _)::rest ->\n if y = namedv_uniq v\n then Some (L.hd s)\n else find_matching_subst_elt_var rest v\n | _::rest -> find_matching_subst_elt_var rest v", "val va_wp_Xgetbv_Avx (va_s0: va_state) (va_k: (va_state -> unit -> Type0)) : Type0\nlet va_wp_Xgetbv_Avx (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ osxsave_enabled /\\ va_get_reg64 rRcx va_s0 = 0 /\\ (forall (va_x_rax:nat64)\n (va_x_rdx:nat64) . let va_sM = va_upd_reg64 rRdx va_x_rdx (va_upd_reg64 rRax va_x_rax va_s0) in\n va_get_ok va_sM /\\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled\n /\\ Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled ==> va_k va_sM\n (())))", "val state_permute (s: state) : Tot state\nlet state_permute (s:state) : Tot state =\n repeati 24 state_permute1 s", "val update_reg (r: reg) (v: t_reg r) (s: vale_state) : vale_state\nlet update_reg (r:reg) (v:t_reg r) (s:vale_state) : vale_state =\n {s with vs_regs = Regs.upd r v s.vs_regs}", "val put (#state: Type u#2) (#rel: P.preorder state) (s: state)\n : NMSTATE unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)\nlet put (#state:Type u#2) (#rel:P.preorder state) (s:state)\n : NMSTATE unit state rel\n (fun s0 -> rel s0 s)\n (fun _ _ s1 -> s1 == s)\n =\n NMSTATE?.reflect (fun (_, n) -> MST.put s, n)", "val push_two_fresh_vars : env -> string -> typ -> Tac (term & binder & term & binder & env)\nlet push_two_fresh_vars e0 basename ty =\n let e1, b1 = push_fresh_binder e0 basename ty in\n let e2, b2 = push_fresh_binder e1 basename ty in\n let v1 = pack (Tv_Var (bv_of_binder b1)) in\n let v2 = pack (Tv_Var (bv_of_binder b2)) in\n v1, b1, v2, b2, e2", "val nvar_as_binder (x: nvar) (t: term) : binder\nlet nvar_as_binder (x:nvar) (t:term) : binder =\n mk_binder_ppname t (fst x)", "val make_push_stack_variables_lemma:\n pred:\n actor_state_predicate\n { (forall actor writer_pc writer_expression_number method_id frame_uniq initializer s.\n match\n push_stack_variable actor\n writer_pc\n writer_expression_number\n method_id\n frame_uniq\n initializer\n s\n with\n | ComputationProduces s' -> pred actor s s'\n | _ -> True) /\\ actor_state_predicate_reflexive pred /\\\n actor_state_predicate_transitive pred } ->\n unit\n -> Lemma\n (forall actor writer_pc writer_expression_number method_id frame_uniq initializers s.\n {:pattern\n\n push_stack_variables actor\n writer_pc\n writer_expression_number\n method_id\n frame_uniq\n initializers\n s}\n match\n push_stack_variables actor\n writer_pc\n writer_expression_number\n method_id\n frame_uniq\n initializers\n s\n with\n | ComputationProduces s' -> pred actor s s'\n | _ -> True)\nlet make_push_stack_variables_lemma\n (pred: actor_state_predicate{\n (forall actor writer_pc writer_expression_number method_id frame_uniq initializer s.\n match push_stack_variable actor writer_pc writer_expression_number method_id frame_uniq\n initializer s with\n | ComputationProduces s' -> pred actor s s'\n | _ -> True)\n /\\ actor_state_predicate_reflexive pred\n /\\ actor_state_predicate_transitive pred})\n : unit -> Lemma\n (forall actor writer_pc writer_expression_number method_id frame_uniq initializers s.\n {:pattern push_stack_variables actor writer_pc writer_expression_number method_id\n frame_uniq initializers s}\n match push_stack_variables actor writer_pc writer_expression_number method_id\n frame_uniq initializers s with\n | ComputationProduces s' -> pred actor s s'\n | _ -> True) =\n make_push_stack_variables_lemma_conditional pred (fun _ -> true)", "val subst_binder_typ (s: FStar.Stubs.Syntax.Syntax.subst_t) (b: Tactics.NamedView.binder)\n : Tactics.NamedView.binder\nlet subst_binder_typ (s : FStar.Stubs.Syntax.Syntax.subst_t) (b : Tactics.NamedView.binder) : Tactics.NamedView.binder =\n { b with sort = FStar.Stubs.Reflection.V2.Builtins.subst_term s b.sort }", "val bind (a b s: _) (f: st a s) (g: (a -> st b s)) : st b s\nlet bind a b s (f:st a s) (g:a -> st b s)\n : st b s\n = fun s ->\n let x, s' = f s in\n g x s'", "val __binding_to_binder (bnd: binding) (b: R.binder) : binder\nlet __binding_to_binder (bnd : binding) (b : R.binder) : binder =\n {\n ppname = bnd.ppname;\n uniq = bnd.uniq;\n sort = bnd.sort;\n qual = (inspect_binder b).qual;\n attrs = (inspect_binder b).attrs;\n }", "val push_stack_variables\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializers: list initializer_t)\n (s: Armada.State.t)\n : GTot (conditional_computation_t Armada.State.t) (decreases initializers)\nlet rec push_stack_variables\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializers: list initializer_t)\n (s: Armada.State.t)\n : GTot (conditional_computation_t Armada.State.t)\n (decreases initializers) =\n match initializers with\n | [] -> return s\n | first_initializer :: remaining_initializers ->\n let? s' = push_stack_variable actor writer_pc writer_expression_number method_id frame_uniq first_initializer s in\n push_stack_variables actor writer_pc (writer_expression_number + 1) method_id frame_uniq remaining_initializers s'\n | _ -> ComputationImpossible", "val push_stack_parameters_maintains_gvar_has_type\n (v: var_id_t)\n (td: object_td_t)\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (var_ids: list var_id_t)\n (parameters: list object_value_t)\n (s: Armada.State.t)\n : Lemma (requires gvar_has_type s.mem v td)\n (ensures\n (match\n push_stack_parameters actor\n writer_pc\n writer_expression_number\n method_id\n frame_uniq\n var_ids\n parameters\n s\n with\n | ComputationImpossible | ComputationUndefined -> True\n | ComputationProduces s' -> gvar_has_type s'.mem v td))\n (decreases parameters)\nlet rec push_stack_parameters_maintains_gvar_has_type\n (v: var_id_t)\n (td: object_td_t)\n (actor: tid_t)\n (writer_pc: pc_t)\n (writer_expression_number: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (var_ids: list var_id_t)\n (parameters: list object_value_t)\n (s: Armada.State.t)\n : Lemma (requires gvar_has_type s.mem v td)\n (ensures (match push_stack_parameters actor writer_pc writer_expression_number method_id frame_uniq\n var_ids parameters s with\n | ComputationImpossible | ComputationUndefined -> True\n | ComputationProduces s' -> gvar_has_type s'.mem v td))\n (decreases parameters) =\n match parameters, var_ids with\n | [], [] -> ()\n | first_parameter :: remaining_parameters, first_var_id :: remaining_var_ids ->\n let first_initializer =\n { var_id = first_var_id; iv = InitializerSpecific first_parameter; weakly_consistent = false } in\n push_stack_variable_maintains_gvar_has_type v td actor writer_pc writer_expression_number method_id frame_uniq\n first_initializer s;\n (match push_stack_variable actor writer_pc writer_expression_number method_id frame_uniq first_initializer s with\n | ComputationImpossible | ComputationUndefined -> ()\n | ComputationProduces s' ->\n push_stack_parameters_maintains_gvar_has_type v td actor writer_pc (writer_expression_number + 1)\n method_id frame_uniq remaining_var_ids remaining_parameters s')\n | _ -> ()", "val bind (a b: Type) (v: repr a) (f: (a -> repr b)) : repr b\nlet bind (a b : Type) (v : repr a) (f : (a -> repr b)) : repr b =\n fun () -> f (v ()) ()", "val binding_to_binder (bnd: binding) : binder\nlet binding_to_binder (bnd : binding) : binder =\n {\n ppname = bnd.ppname;\n uniq = bnd.uniq;\n sort = bnd.sort;\n qual = Q_Explicit;\n attrs = []\n }", "val state0 (uses: inames) : S.st0\nlet state0 (uses:inames) : S.st0 =\n {\n S.mem = mem;\n S.core = core_mem;\n S.full_mem_pred = full_mem_pred;\n S.locks_preorder = mem_evolves;\n S.hprop = slprop;\n S.locks_invariant = locks_invariant uses;\n\n S.disjoint = disjoint;\n S.join = join;\n\n S.interp = interp;\n\n S.emp = emp;\n S.star = star;\n\n S.equals = equiv\n }", "val put (#state: Type u#2) (#rel: P.preorder state) (s: state)\n : MSTATE unit state rel (fun s0 -> rel s0 s) (fun _ _ s1 -> s1 == s)\nlet put (#state:Type u#2) (#rel:P.preorder state) (s:state)\n : MSTATE unit state rel\n (fun s0 -> rel s0 s)\n (fun _ _ s1 -> s1 == s)\n =\n MSTATE?.reflect (fun _ -> (), s)", "val push_binding (g:env) (x:var { ~ (Set.mem x (dom g)) }) (n:ppname) (t:typ)\n : g':env { fstar_env g' == fstar_env g }\nlet push_binding g x p t =\n { g with bs = (x, t)::g.bs;\n names = p::g.names;\n m = Map.upd g.m x t }", "val is_bvar (t: term) : option nat\nlet is_bvar (t:term) : option nat =\n let open R in\n match t.t with\n | Tm_FStar host_term ->\n begin match R.inspect_ln host_term with\n | R.Tv_BVar bv ->\n let bv_view = R.inspect_bv bv in\n Some bv_view.index\n | _ -> None\n end\n | _ -> None", "val push_stack_variable_doesnt_depend_on_gvars_helper\n (vs: list var_id_t)\n (actor: tid_t)\n (writer_pc1 writer_pc2: pc_t)\n (writer_expression_number1 writer_expression_number2: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializer: initializer_t)\n (s1 s2: Armada.State.t)\n (thread1 thread2: Armada.Thread.t)\n (local_variables1' local_variables2': list var_id_t)\n (top1' top2': stack_frame_t)\n (thread1' thread2': Armada.Thread.t)\n (threads1' threads2': Armada.Threads.t)\n : Lemma\n (requires\n positions_valid_in_state s1 /\\ positions_valid_in_state s2 /\\\n positions_in_write_buffers_match_except_global_variables vs s1.threads s2.threads /\\\n thread1 == s1.threads actor /\\ thread2 == s2.threads actor /\\\n local_variables1' == initializer.var_id :: thread1.top.local_variables /\\\n local_variables2' == initializer.var_id :: thread2.top.local_variables /\\\n top1' == { thread1.top with local_variables = local_variables1' } /\\\n top2' == { thread2.top with local_variables = local_variables2' } /\\\n thread1' == { thread1 with top = top1' } /\\ thread2' == { thread2 with top = top2' } /\\\n threads1' == Spec.Map.upd s1.threads actor thread1' /\\\n threads2' == Spec.Map.upd s2.threads actor thread2' /\\ positions_valid_in_threads threads1' /\\\n positions_valid_in_threads threads2')\n (ensures positions_in_write_buffers_match_except_global_variables vs threads1' threads2')\nlet push_stack_variable_doesnt_depend_on_gvars_helper\n (vs: list var_id_t)\n (actor: tid_t)\n (writer_pc1: pc_t)\n (writer_pc2: pc_t)\n (writer_expression_number1: nat)\n (writer_expression_number2: nat)\n (method_id: method_id_t)\n (frame_uniq: root_id_uniquifier_t)\n (initializer: initializer_t)\n (s1: Armada.State.t)\n (s2: Armada.State.t)\n (thread1: Armada.Thread.t)\n (thread2: Armada.Thread.t)\n (local_variables1': list var_id_t)\n (local_variables2': list var_id_t)\n (top1': stack_frame_t)\n (top2': stack_frame_t)\n (thread1': Armada.Thread.t)\n (thread2': Armada.Thread.t)\n (threads1': Armada.Threads.t)\n (threads2': Armada.Threads.t)\n : Lemma (requires positions_valid_in_state s1\n /\\ positions_valid_in_state s2\n /\\ positions_in_write_buffers_match_except_global_variables vs s1.threads s2.threads\n /\\ thread1 == s1.threads actor\n /\\ thread2 == s2.threads actor\n /\\ local_variables1' == initializer.var_id :: thread1.top.local_variables\n /\\ local_variables2' == initializer.var_id :: thread2.top.local_variables\n /\\ top1' == { thread1.top with local_variables = local_variables1' }\n /\\ top2' == { thread2.top with local_variables = local_variables2' }\n /\\ thread1' == { thread1 with top = top1' }\n /\\ thread2' == { thread2 with top = top2' }\n /\\ threads1' == Spec.Map.upd s1.threads actor thread1'\n /\\ threads2' == Spec.Map.upd s2.threads actor thread2'\n /\\ positions_valid_in_threads threads1'\n /\\ positions_valid_in_threads threads2')\n (ensures positions_in_write_buffers_match_except_global_variables vs threads1' threads2') =\n introduce forall sender_tid receiver_tid. write_buffers_match_except_global_variables vs\n (unread_write_buffer threads1' sender_tid receiver_tid)\n (unread_write_buffer threads2' sender_tid receiver_tid)\n with (\n assert (sender_receiver_trigger sender_tid receiver_tid);\n assert (write_buffers_match_except_global_variables vs\n (unread_write_buffer s1.threads sender_tid receiver_tid)\n (unread_write_buffer s2.threads sender_tid receiver_tid));\n assert (unread_write_buffer threads1' sender_tid receiver_tid ==\n unread_write_buffer s1.threads sender_tid receiver_tid);\n assert (unread_write_buffer threads2' sender_tid receiver_tid ==\n unread_write_buffer s2.threads sender_tid receiver_tid)\n );\n assert (positions_in_write_buffers_match_except_global_variables vs threads1' threads2')", "val bv_of_binder (b: binder) : bv\nlet bv_of_binder (b : binder) : bv = (inspect_binder b).binder_bv", "val push_name (env: qenv) (name: string) : qenv\nlet push_name (env:qenv) (name:string) : qenv =\r\n { env with local_names = name::env.local_names }", "val bind_m (#s #a #b: _) (x: m s a) (y: (a -> m s b)) : m s b\nlet rec bind_m #s #a #b (x:m s a) (y: (a -> m s b)) : m s b =\n match x with\n | Ret x -> y x\n | Get k -> Get (fun s -> bind_m (k s) y)\n | Put s k -> Put s (bind_m k y)", "val instr_write_output_explicit\n (i: instr_operand_explicit)\n (v: instr_val_t (IOpEx i))\n (o: instr_operand_t i)\n (s_orig s: machine_state)\n : machine_state\nlet instr_write_output_explicit\n (i:instr_operand_explicit) (v:instr_val_t (IOpEx i)) (o:instr_operand_t i) (s_orig s:machine_state)\n : machine_state =\n match i with\n | IOp64 ->\n state_or_fail s (valid_dst_operand64 o s_orig) (update_operand64_preserve_flags'' o v s_orig s)\n | IOpXmm ->\n state_or_fail s (valid_dst_operand128 o s_orig) (update_operand128_preserve_flags'' o v s_orig s)", "val update_mem_and_taint (ptr: int) (v: nat64) (s: state) (t: taint) : state\nlet update_mem_and_taint (ptr:int) (v:nat64) (s:state) (t:taint) : state =\n if valid_addr64 ptr (heap_get s.ms_heap) then\n { s with\n ms_heap = heap_upd s.ms_heap\n (update_heap64 ptr v (heap_get s.ms_heap))\n (update_n ptr 8 (heap_taint s.ms_heap) t)\n }\n else s", "val va_upd_stackTaint (stackTaint: M.memtaint) (s: vale_state) : vale_state\nlet va_upd_stackTaint (stackTaint:M.memtaint) (s:vale_state) : vale_state = { s with vs_stackTaint = stackTaint }", "val state_eq (s0 s1: state) : Pure Type0 (requires True) (ensures fun b -> b ==> s0 `feq` s1)\nlet state_eq (s0 s1:state) : Pure Type0\n (requires True)\n (ensures fun b -> b ==> s0 `feq` s1)\n =\n s0 Rax == s1 Rax /\\\n s0 Rbx == s1 Rbx /\\\n s0 Rcx == s1 Rcx /\\\n s0 Rdx == s1 Rdx" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Tactics.V2.SyntaxCoercions.fst", "name": "FStar.Tactics.V2.SyntaxCoercions.binder_to_namedv" }, { "project_name": "everparse", "file_name": "Z3TestGen.fst", "name": "Z3TestGen.push_binder" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.subst_var" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fst", "name": "FStar.Tactics.NamedView.r_binder_to_namedv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Derived.fst", "name": "FStar.Reflection.V2.Derived.push_binding" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.SyntaxCoercions.fst", "name": "FStar.Tactics.V2.SyntaxCoercions.binding_to_namedv" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fsti", "name": "FStar.Tactics.NamedView.namedv_to_binder" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.binding_to_namedv" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_expand_state" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.state_inv" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.var_as_namedv" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.state_inv" }, { "project_name": "dice-star", "file_name": "HWAbstraction.fst", "name": "HWAbstraction.st_var" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.QuickCodes.fsti", "name": "Vale.PPC64LE.QuickCodes.va_state_match" }, { "project_name": "hacl-star", "file_name": "Vale.X64.QuickCodes.fsti", "name": "Vale.X64.QuickCodes.va_state_match" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_state_eq" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_state_eq" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vbind0" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.push_pre" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_expand_state" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_upd_operand_reg_opr" }, { "project_name": "zeta", "file_name": "Zeta.KeyValueStore.StateMachine.fst", "name": "Zeta.KeyValueStore.StateMachine.put" }, { "project_name": "FStar", "file_name": "OPLSS2021.Vale.fst", "name": "OPLSS2021.Vale.update_state" }, { "project_name": "FStar", "file_name": "MiniValeSemantics.fst", "name": "MiniValeSemantics.update_state" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_upd_operand_heaplet" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_upd_stack" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_upd_stack" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.freevars_binder" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.state_or_fail" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.QuickCodes.fsti", "name": "Vale.PPC64LE.QuickCodes.state_match" }, { "project_name": "hacl-star", "file_name": "Vale.X64.QuickCodes.fsti", "name": "Vale.X64.QuickCodes.state_match" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fsti", "name": "FStar.Tactics.NamedView.binder_to_binding" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ExternalPtr.fsti", "name": "Zeta.Steel.ExternalPtr.is_valid_state" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ST.fst", "name": "FStar.DM4F.ST.bind_st" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fst", "name": "FStar.Tactics.NamedView.subst_binder_sort" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.run" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Base.fst", "name": "FStar.InteractiveHelpers.Base.genv_push_binder" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.update_stack_and_taint" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.close_binder" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vbind" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Substs.fst", "name": "Pulse.Checker.Prover.Substs.push" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.bind" }, { "project_name": "FStar", "file_name": "FStar.MSTTotal.fst", "name": "FStar.MSTTotal.bind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fst", "name": "FStar.Tactics.NamedView.r_subst_binder_sort" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Permanent.fst", "name": "Strategies.GlobalVars.Permanent.push_stack_parameters_maintains_variable_among_gvars" }, { "project_name": "steel", "file_name": "GhostStateMachine.fst", "name": "GhostStateMachine.handle_has_state" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vbind0_payload" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.make_namedv_with_name" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.make_bv_with_name" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ExploreTerm.fst", "name": "FStar.InteractiveHelpers.ExploreTerm.params_of_typ_or_comp" }, { "project_name": "FStar", "file_name": "OPLSS2021.ParTot.fst", "name": "OPLSS2021.ParTot.run" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.SyntaxCoercions.fst", "name": "FStar.Tactics.V2.SyntaxCoercions.binder_to_term" }, { "project_name": "FStar", "file_name": "FStar.Tactics.MkProjectors.fst", "name": "FStar.Tactics.MkProjectors.binder_to_term" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.bind" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.bind" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Record.fst", "name": "MiTLS.Record.input_b" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.State.fsti", "name": "Vale.PPC64LE.State.state_eq" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Printer.fst", "name": "Pulse.Syntax.Printer.binder_to_string_paren" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Base.fst", "name": "FStar.InteractiveHelpers.Base.genv_push_bv" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_upd_operand_heaplet" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_upd_reg" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.vbind'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.binder_to_term" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.put" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.upd_register" }, { "project_name": "steel", "file_name": "GhostStateMachine.fst", "name": "GhostStateMachine.pure_handle_has_state" }, { "project_name": "hacl-star", "file_name": "Vale.X64.State.fsti", "name": "Vale.X64.State.state_eq" }, { "project_name": "FStar", "file_name": "IST.fst", "name": "IST.g" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA3.fst", "name": "Hacl.Impl.SHA3.storeState_inner" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.fresh_binder_named" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fsti", "name": "Benton2004.DDCC.st_var" }, { "project_name": "FStar", "file_name": "FStar.DM4F.MonadLaws.fst", "name": "FStar.DM4F.MonadLaws.bind_st" }, { "project_name": "Armada", "file_name": "Armada.Init.fst", "name": "Armada.Init.push_stack_variable" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.find_matching_subst_elt_var" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fsti", "name": "Vale.X64.InsBasic.va_wp_Xgetbv_Avx" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.fst", "name": "Spec.SHA3.state_permute" }, { "project_name": "hacl-star", "file_name": "Vale.X64.State.fsti", "name": "Vale.X64.State.update_reg" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.put" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Base.fst", "name": "FStar.InteractiveHelpers.Base.push_two_fresh_vars" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fsti", "name": "Pulse.Typing.Combinators.nvar_as_binder" }, { "project_name": "Armada", "file_name": "Strategies.ArmadaStatement.fst", "name": "Strategies.ArmadaStatement.make_push_stack_variables_lemma" }, { "project_name": "steel", "file_name": "Pulse.Recursion.fst", "name": "Pulse.Recursion.subst_binder_typ" }, { "project_name": "FStar", "file_name": "OPLSS2021.BasicState.fst", "name": "OPLSS2021.BasicState.bind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fst", "name": "FStar.Tactics.NamedView.__binding_to_binder" }, { "project_name": "Armada", "file_name": "Armada.Init.fst", "name": "Armada.Init.push_stack_variables" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Types.fst", "name": "Strategies.GlobalVars.Types.push_stack_parameters_maintains_gvar_has_type" }, { "project_name": "FStar", "file_name": "DivAction.fst", "name": "DivAction.bind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.NamedView.fsti", "name": "FStar.Tactics.NamedView.binding_to_binder" }, { "project_name": "steel", "file_name": "Steel.Semantics.Instantiate.fsti", "name": "Steel.Semantics.Instantiate.state0" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.put" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.push_binding" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Pure.fst", "name": "Pulse.Syntax.Pure.is_bvar" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Util.fst", "name": "Strategies.GlobalVars.Util.push_stack_variable_doesnt_depend_on_gvars_helper" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.fst", "name": "FStar.Reflection.V1.Derived.bv_of_binder" }, { "project_name": "everparse", "file_name": "Desugar.fst", "name": "Desugar.push_name" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.bind_m" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.instr_write_output_explicit" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.update_mem_and_taint" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_upd_stackTaint" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVCNoProp.fst", "name": "OPLSS2021.ValeVCNoProp.state_eq" } ], "selected_premises": [ "FStar.Heap.trivial_preorder", "FStar.ST.op_Bang", "Param.app_binders", "FStar.Pervasives.Native.fst", "Param.fresh_binder_named", "FStar.Pervasives.Native.snd", "FStar.ST.alloc", "Param.last", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "Param.fold_right2", "Param.fvmap", "Param.zip3", "FStar.All.op_Bar_Greater", "FStar.List.map", "FStar.Monotonic.Heap.mref", "FStar.Preorder.preorder_rel", "FStar.Heap.trivial_rel", "FStar.Pervasives.id", "FStar.All.op_Less_Bar", "FStar.List.fold_left", "FStar.List.iter", "FStar.List.for_all", "FStar.ST.contains_pred", "FStar.Pervasives.st_post_h", "FStar.List.mapT", "FStar.Pervasives.ex_pre", "FStar.ST.read", "FStar.List.fold_right", "FStar.Pervasives.pure_bind_wp", "FStar.ST.get", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.st_pre_h", "Prims.pow2", "Prims.__cache_version_number__", "FStar.Pervasives.ex_post'", "Prims.auto_squash", "FStar.Monotonic.Heap.only", "FStar.Pervasives.all_post_h", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_post_h'", "FStar.ST.lift_gst_state", "FStar.Pervasives.st_bind_wp", "FStar.Monotonic.Heap.set", "FStar.ST.op_Colon_Equals", "FStar.ST.lift_div_gst", "FStar.ST.gst_pre", "FStar.Monotonic.Heap.fresh", "FStar.Preorder.transitive", "Prims.pure_post'", "FStar.ST.gst_wp", "FStar.Preorder.reflexive", "FStar.Pervasives.ex_post", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_post_h'", "FStar.ST.lemma_functoriality", "FStar.ST.heap_rel", "FStar.Monotonic.Heap.modifies", "FStar.Pervasives.all_bind_wp", "FStar.List.concatMap", "FStar.Pervasives.st_wp_h", "FStar.List.filter_map", "FStar.Pervasives.ex_stronger", "FStar.Order.order_from_int", "FStar.Pervasives.st_close_wp", "FStar.Order.compare_int", "Prims.pure_pre", "Prims.as_requires", "Prims.purewp_id", "Prims.pure_trivial", "FStar.Pervasives.ex_bind_wp", "Prims.pure_stronger", "FStar.Pervasives.st_trivial", "Prims.returnM", "FStar.ST.gst_post", "FStar.ST.st_pre", "Prims.op_Hat", "FStar.Set.subset", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.st_return", "FStar.Pervasives.all_close_wp", "Prims.pure_wp", "FStar.Preorder.stable", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.ex_wp", "FStar.Monotonic.Heap.only_t", "FStar.List.collect", "FStar.All.all_pre", "FStar.Monotonic.Heap.equal_dom", "Prims.as_ensures", "FStar.List.tl", "FStar.Order.compare_option", "FStar.Pervasives.all_stronger", "FStar.Pervasives.ex_close_wp", "FStar.Monotonic.Heap.modifies_t" ], "source_upto_this": "module Param\n\nopen FStar.List\nopen FStar.Tactics.V2\n\ntype bvmap = list (namedv & (binder & binder & binder))\nlet fvmap = list (fv * fv)\n\nnoeq\ntype param_state = {\n bvmap : bvmap;\n fresh : int;\n recs : fvmap;\n}\n\nlet rec fold_right2 (f : 'a -> 'b -> 'c -> Tac 'c) (l1:list 'a) (l2:list 'b) (c:'c) : Tac 'c =\n match l1, l2 with\n | h1::t1, h2::t2 -> f h1 h2 (fold_right2 f t1 t2 c)\n | [], [] -> c\n | _ -> fail \"fold_right2\"\n\nlet rec zip3 (l1 : list 'a) (l2 : list 'b) (l3 : list 'c) : list ('a * 'b * 'c) =\n match l1, l2, l3 with\n | h1::t1, h2::t2, h3::t3 -> (h1, h2, h3) :: (zip3 t1 t2 t3)\n | _ -> []\n\nlet last (xs:list 'a) : Tac 'a =\n match List.Tot.rev xs with\n | h::_ -> h\n | [] -> fail \"last: empty list\"\n\n(* Override it to add freshness. The code for typechecking an inductive\nraises a failure if two binders of the same constructor have the same name. *)\n// noeq type t = | A of x:int -> x:int -> x:int -> t\n// but this doesn't fail nor warn... why??\n\nlet fresh_binder_named (nm:string) (t:typ) : Tac binder =\n // useful?\n //let n = fresh () in\n //let nm = nm ^ \"_\" ^ string_of_int n in\n Tactics.V2.fresh_binder_named nm t\n\nlet app_binders (t:term) (bs:list binder) : Tac term =\n mk_e_app t (List.Tot.map binder_to_term bs)\n", "sketch": [ "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current parameter state `s`. It then constructs a new parameter state by adding the named variable `v` along with the three binders to the `bvmap` field of the parameter state. The `fresh` field of the new state is incremented by 1, and the `recs` field remains unchanged.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, and a `param_state` `s` as input. It then constructs a new `param_state` by adding the named variable `v` and the three binders to the `bvmap` field of the input `param_state` `s`. The `fresh` field of the new `param_state` is incremented by 1, and the `recs` field remains unchanged.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current `param_state` `s`. It then constructs a new `param_state` by adding the new variable binding to the `bvmap` field of the input `param_state`.", "To implement `push_var_to_state`, we need to create a new `bvmap` by adding the provided `namedv` and its corresponding binders to the existing `bvmap` in the parameter state. We also need to increment the freshness counter in the parameter state.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current parameter state `s`. It then constructs a new parameter state by adding the named variable `v` along with the three binders to the `bvmap` field of the parameter state. The `fresh` field remains unchanged, and the `recs` field is also left unchanged.", "To implement `push_var_to_state`, we will create a new `param_state` with the given variable `v` added to the `bvmap` and the fresh counter updated. We will also update the `recs` field to include the new variable binding.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current parameter state `s`. It then adds the named variable `v` along with the three binders to the `bvmap` field of the parameter state `s`, and increments the `fresh` field of the parameter state by 1.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current parameter state `s`. It then constructs a new parameter state by adding the named variable `v` along with the three binders to the `bvmap` field of the parameter state. The `fresh` field of the parameter state is incremented by 1, and the updated parameter state is returned.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current `param_state` `s`. It then constructs a new `param_state` by adding the new variable binding to the `bvmap` field of the input `param_state`.", "The `push_var_to_state` function takes a named variable `v` and three binders `b0`, `b1`, and `b2`, along with the current parameter state `s`. It then constructs a new parameter state by adding the named variable `v` along with the three binders to the existing `bvmap` field of the parameter state." ], "generated_solution": [ "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n {\n bvmap = (v, (b0, b1, b2)) :: s.bvmap;\n fresh = s.fresh + 1;\n recs = s.recs;\n }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap; fresh = s.fresh + 1 }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n {\n bvmap = (v, (b0, b1, b2)) :: s.bvmap;\n fresh = s.fresh + 1;\n recs = s.recs;\n }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n {\n bvmap = (v, (b0, b1, b2)) :: s.bvmap;\n fresh = s.fresh + 1;\n recs = (v.fv, v.fv) :: s.recs;\n }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n {\n bvmap = (v, (b0, b1, b2)) :: s.bvmap;\n fresh = s.fresh + 1;\n recs = s.recs;\n }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n {\n bvmap = (v, (b0, b1, b2)) :: s.bvmap;\n fresh = s.fresh + 1;\n recs = s.recs;\n }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }", "let push_var_to_state (v: namedv) (b0 b1 b2: binder) (s: param_state) : param_state =\n { s with bvmap = (v, (b0, b1, b2)) :: s.bvmap }" ] }, { "file_name": "SnapshotST.fst", "name": "SnapshotST.witnessed", "opens_and_abbrevs": [ { "open": "FStar.Monotonic.Witnessed" }, { "open": "FStar.Preorder" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let witnessed (p:predicate t) = witnessed rel_t p", "source_range": { "start_line": 96, "start_col": 0, "end_line": 96, "end_col": 49 }, "interleaved": false, "definition": "fun p -> FStar.Monotonic.Witnessed.witnessed SnapshotST.rel_t p", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Preorder.predicate", "SnapshotST.t", "FStar.Monotonic.Witnessed.witnessed", "SnapshotST.rel_t" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "p: FStar.Preorder.predicate SnapshotST.t -> Type0", "prompt": "let witnessed (p: predicate t) =\n ", "expected_response": "witnessed rel_t p", "source": { "project_name": "FStar", "file_name": "examples/preorders/SnapshotST.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "SnapshotST.fst", "checked_file": "dataset/SnapshotST.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Witnessed.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "state", "val rel_s : preorder state", "t", "Ok", "Ok", "Ok", "Tmp", "Tmp", "Tmp", "let rel_t (t0:t) (t1:t) \n = match t0 , t1 with\n | Ok s0 , Ok s1 -> rel_s s0 s1\n | Ok s0 , Tmp s1 _ -> rel_s s0 s1\n | Tmp s0 _ , Ok s1 -> rel_s s0 s1\n | Tmp s0 _ , Tmp s1 _ -> rel_s s0 s1", "let lift_predicate (p:predicate state{stable p rel_s}) (t:t) \n = match t with\n | Ok s -> p s\n | Tmp s _ -> p s", "val lift_stability : p:predicate state{stable p rel_s}\n\t\t -> t0:t\n\t\t -> t1:t\n\t\t -> Lemma (requires (lift_predicate p t0 /\\ rel_t t0 t1))\n\t\t (ensures (lift_predicate p t1))", "let lift_stability p t0 t1 = ()", "let mst_pre = t -> Type0", "let mst_post (a:Type) = a -> t -> Type0", "let mst_wp (a:Type) = mst_post a -> Tot mst_pre", "let div_lift (a:Type) (wp:pure_wp a) (p:mst_post a) (x:t) = wp (fun y -> p y x)" ], "closest": [ "val MRefST.ist_witnessed = p: FStar.Preorder.predicate MRefHeap.heap {FStar.Preorder.stable p MRefST.heap_rel} -> Type0\nlet ist_witnessed (p:predicate heap{stable p heap_rel}) = witnessed heap_rel p", "val ImmutableST.ist_witnessed = p: FStar.Preorder.predicate NatHeap.heap {FStar.Preorder.stable p ImmutableST.heap_rel} -> Type0\nlet ist_witnessed (p:predicate heap{stable p heap_rel}) = witnessed heap_rel p", "val AllocST.ist_witnessed = p: FStar.Preorder.predicate NatHeap.heap {FStar.Preorder.stable p AllocST.heap_rel} -> Type0\nlet ist_witnessed (p:predicate heap{stable p heap_rel}) = witnessed heap_rel p", "val MSeqExn.witnessed = p: MSeqExn.s_pred -> Type0\nlet witnessed (p:s_pred) = W.witnessed grows p", "val AllocSTwHeaps.ist_witnessed = \n p:\n FStar.Preorder.predicate FStar.Monotonic.Heap.heap\n {FStar.Preorder.stable p AllocSTwHeaps.heap_rel}\n -> Type0\nlet ist_witnessed (p:predicate FStar.Heap.heap{stable p heap_rel}) = witnessed heap_rel p", "val ImmutableSTwHeaps.ist_witnessed = \n p:\n FStar.Preorder.predicate FStar.Monotonic.Heap.heap\n {FStar.Preorder.stable p ImmutableSTwHeaps.heap_rel}\n -> Type0\nlet ist_witnessed (p:predicate heap{stable p heap_rel}) = witnessed heap_rel p", "val FStar.Monotonic.Witnessed.witnessed_past = rel: FStar.Preorder.preorder state -> p: (_: state -> Type0) -> Type0\nlet witnessed_past (#state:Type) (rel:preorder state) (p:(state -> Type0)) = \n get (fun s -> exists s'. rel s' s /\\ (forall s''. rel s' s'' ==> p s''))", "val witnessed (#s: Type) (#rel: preorder s) (p: predicate s) : Type0\nlet witnessed (#s:Type) (#rel:preorder s) (p:predicate s) :Type0 = W.witnessed rel p", "val witnessed (#s: Type) (#rel: preorder s) (p: predicate s) : Type0\nlet witnessed (#s:Type) (#rel:preorder s) (p:predicate s) :Type0 = W.witnessed rel p", "val ReifyTestTSST.witnessed = \n ts: ReifyTestTSST.timestamp ->\n p:\n FStar.Preorder.predicate ReifyTestTSST.state {FStar.Preorder.stable p ReifyTestTSST.state_rel}\n -> Type0\nlet witnessed (ts:timestamp) (p:predicate state{stable p state_rel}) = witnessed state_rel p", "val witness : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t p:predicate heap{stable_on_heap m p} ->\n\t MRefST unit (fun h0 -> p h0)\n\t (fun h0 _ h1 -> h0 == h1 /\\\n\t\t\t ist_witnessed p)\nlet witness #a #r m p =\n ist_witness p", "val witnessed (p: heap_predicate{stable p}) : Type0\nlet witnessed (p:heap_predicate{stable p}) : Type0 = W.witnessed heap_rel p", "val FStar.Witnessed.Core.s_predicate = state: Type -> Type\nlet s_predicate (state:Type u#a) = state -> Type0", "val witness (#s:Type u#s) (#rel:preorder s) (p: s -> prop { stable p rel })\r\n : mst rel (witnessed p) (fun s0 -> p s0) (fun s0 x s1 -> s0 == s1)\nlet witness p\r\n= fun s -> (), s", "val witnessed (p:mem_predicate) :Type0\nlet witnessed p = W.witnessed mem_rel p", "val witness (state: Type u#2) (rel: P.preorder state) (p: W.s_predicate state)\n : NMSTATE (W.witnessed state rel p)\n state\n rel\n (fun s0 -> p s0 /\\ W.stable state rel p)\n (fun s0 _ s1 -> s0 == s1)\nlet witness (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state)\n : NMSTATE (W.witnessed state rel p) state rel\n (fun s0 -> p s0 /\\ W.stable state rel p)\n (fun s0 _ s1 -> s0 == s1)\n =\n NMSTATE?.reflect (fun (_, n) -> M.witness state rel p, n)", "val witness (state: Type u#2) (rel: P.preorder state) (p: W.s_predicate state)\n : NMSTATETOT (W.witnessed state rel p)\n state\n rel\n (fun s0 -> p s0 /\\ W.stable state rel p)\n (fun s0 _ s1 -> s0 == s1)\nlet witness (state:Type u#2) (rel:P.preorder state) (p:W.s_predicate state)\n : NMSTATETOT (W.witnessed state rel p) state rel\n (fun s0 -> p s0 /\\ W.stable state rel p)\n (fun s0 _ s1 -> s0 == s1)\n =\n NMSTATETOT?.reflect (fun (_, n) -> M.witness state rel p, n)", "val mr_witness (#r:erid) (#a:Type) (#b:preorder a)\n (m:m_rref r a b) (p:mem_predicate)\n :ST unit (requires (fun h0 -> p h0 /\\ stable_on_t m p))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ witnessed p))\nlet mr_witness #r #_ #_ m p =\n recall m;\n let p_pred (#i:erid) (#a:Type) (#b:preorder a)\n (r:m_rref i a b) (p:mem_predicate)\n :mem_predicate\n = fun m -> m `contains` r /\\ p m\n in\n gst_witness (p_pred m p);\n lemma_functoriality (p_pred m p) p", "val lemma_witnessed_constant :#state:Type\n -> rel:preorder state\n -> p:Type0\n -> Lemma (witnessed rel (fun _ -> p) <==> p)\nlet lemma_witnessed_constant #state rel p = get_constant_lemma state p", "val witnessed_constant (p: Type0) : Lemma (witnessed (fun _ -> p) <==> p)\nlet witnessed_constant (p:Type0)\n: Lemma (witnessed (fun _ -> p) <==> p)\n= W.lemma_witnessed_constant grows p", "val FStar.Witnessed.Core.stable = state: Type -> rel: FStar.Preorder.preorder state -> p: FStar.Witnessed.Core.s_predicate state\n -> Prims.logical\nlet stable (state:Type u#a)\n (rel:P.preorder state)\n (p:s_predicate state) =\n forall s0 s1. (p s0 /\\ rel s0 s1) ==> p s1", "val witnessed : #state:Type -> rel:preorder state -> p:(state -> Type0) -> Type0\nlet witnessed #state rel p = get (fun s -> forall s'. rel s s' ==> p s')", "val witnessed (#s:Type u#s) (p: s -> prop) : Type0\nlet witnessed p\r\n= unit", "val lemma_witnessed_forall :#state:Type\n -> #t:Type\n -> rel:preorder state\n -> p:(t -> state -> Type0) \n -> Lemma ((witnessed rel (fun s -> forall x. p x s)) <==> (forall x. witnessed rel (p x)))\nlet lemma_witnessed_forall #state #t rel p =\n let aux () :Lemma (requires (forall x. witnessed rel (fun s -> p x s)))\n (ensures (witnessed rel (fun s -> forall x. p x s)))\n = get_forall_2 #state #t (fun x s -> forall s'. rel s s' ==> p x s')\n in\n FStar.Classical.move_requires aux ()", "val witnessed (state:Type u#a)\n (rel:P.preorder state)\n (p:s_predicate state)\n : Type0\nlet witnessed (state:Type u#a)\n (rel:P.preorder state)\n (p:s_predicate state)\n : Type0\n = unit", "val lemma_witnessed_exists (#t:Type) (p:(t -> mem_predicate))\n :Lemma ((exists x. witnessed (p x)) ==> witnessed (fun s -> exists x. p x s))\nlet lemma_witnessed_exists #_ p = W.lemma_witnessed_exists mem_rel p", "val witness: p:(heap -> Type){ST.stable p} ->\n ST unit\n (requires (fun h0 -> p h0))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ witnessed p))\nlet witness p = gst_witness p", "val recall : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t p:predicate heap{stable_on_heap m p} ->\n\t MRefST unit (fun h0 -> ist_witnessed p)\n\t (fun h0 _ h1 -> h0 == h1 /\\\n\t\t\t p h1)\nlet recall #a #r m p =\n ist_recall p", "val lemma_witnessed_impl :#state:Type\n -> rel:preorder state\n -> p:(state -> Type0)\n -> q:(state -> Type0)\n -> Lemma ((witnessed rel (fun s -> p s ==> q s) /\\ witnessed rel p) ==> witnessed rel q)\nlet lemma_witnessed_impl #state rel p q = \n let aux () :Lemma (requires ((witnessed rel (fun s -> p s ==> q s) /\\ witnessed rel p)))\n (ensures (witnessed rel q))\n = get_and_2 (fun s -> forall s'. rel s s' ==> p s' ==> q s') (fun s -> forall s'. rel s s' ==> p s')\n in\n FStar.Classical.move_requires aux ()", "val witness_p (#a:Type0) (#rel:preorder a) (r:mreference a rel) (p:mem_predicate)\n :ST unit (fun h0 -> p h0 /\\ p `stable_on` r)\n (fun h0 _ h1 -> h0 == h1 /\\ token_p r p)\nlet witness_p #_ #_ r p =\n gst_recall (ref_contains_pred r);\n gst_recall (region_contains_pred (HS.frameOf r));\n HS.lemma_next_addr_contained_refs_addr ();\n gst_witness (mem_rel_predicate r p)", "val witnessed_defs_equiv_2 :#state:Type\n -> rel:preorder state\n -> p:(state -> Type0)\n -> Lemma (requires (witnessed #state rel p)) \n (ensures (witnessed #state rel p))\nlet witnessed_defs_equiv_2 #state rel p = \n get_weakening #state (fun s -> exists s'. rel s' s /\\ (forall s''. rel s' s'' ==> p s'')) \n (fun s -> forall s'. rel s s' ==> p s')", "val lemma_witnessed_constant (p:Type0)\n :Lemma (witnessed (fun (m:mem) -> p) <==> p)\nlet lemma_witnessed_constant p = W.lemma_witnessed_constant mem_rel p", "val witnessed_exists (#t: Type) (p: (t -> s_pred))\n : Lemma ((exists x. witnessed (p x)) ==> witnessed (fun s -> exists x. p x s))\nlet witnessed_exists (#t:Type) (p:(t -> s_pred))\n: Lemma ((exists x. witnessed (p x)) ==> witnessed (fun s -> exists x. p x s))\n= W.lemma_witnessed_exists grows p", "val snapshot (#v: Type0) (#p: preorder v) (#s: anchor_rel p) (a: avalue s) : avalue s\nlet snapshot (#v:Type0) (#p:preorder v) (#s:anchor_rel p)\n (a: avalue s)\n : avalue s\n = (None, None), avalue_val a", "val witnessed_forall (#t: Type) (p: (t -> s_pred))\n : Lemma ((witnessed (fun s -> forall x. p x s)) <==> (forall x. witnessed (p x)))\nlet witnessed_forall (#t:Type) (p:(t -> s_pred))\n: Lemma ((witnessed (fun s -> forall x. p x s)) <==> (forall x. witnessed (p x)))\n= W.lemma_witnessed_forall grows p", "val lemma_witnessed_and :#state:Type\n -> rel:preorder state\n -> p:(state -> Type0) \n -> q:(state -> Type0)\n -> Lemma (witnessed rel (fun s -> p s /\\ q s) <==> (witnessed rel p /\\ witnessed rel q))\nlet lemma_witnessed_and #state rel p q =\n let aux () :Lemma (requires (witnessed rel p /\\ witnessed rel q))\n (ensures (witnessed rel (fun s -> p s /\\ q s)))\n = get_and_2 (fun s -> forall s'. rel s s' ==> p s') (fun s -> forall s'. rel s s' ==> q s')\n in\n FStar.Classical.move_requires aux ()", "val Steel.GhostMonotonicHigherReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val Steel.Memory.is_witness_invariant = p: (_: a -> Steel.Memory.slprop) -> Prims.logical\nlet is_witness_invariant #a (p : a -> slprop) =\n forall x y m. interp (p x) m /\\ interp (p y) m ==> x == y", "val lemma_witnessed_forall (#t:Type) (p:(t -> mem_predicate))\n :Lemma ((witnessed (fun s -> forall x. p x s)) <==> (forall x. witnessed (p x)))\nlet lemma_witnessed_forall #_ p = W.lemma_witnessed_forall mem_rel p", "val Steel.GhostMonotonicReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val FStar.ST.stable = p: FStar.ST.heap_predicate -> Prims.logical\nlet stable (p:heap_predicate) =\n forall (h1:heap) (h2:heap). (p h1 /\\ heap_rel h1 h2) ==> p h2", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n : Type0\n = MR.witnessed r fact", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n : Type0\n = MR.witnessed r fact", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n = MHR.witnessed r (lift_property fact)", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n = MHR.witnessed r (lift_property fact)", "val Steel.ST.GhostMonotonicReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val PulseCore.Memory.is_witness_invariant = p: (_: a -> PulseCore.Memory.slprop) -> Prims.logical\nlet is_witness_invariant #a (p : a -> slprop) =\n forall x y m. interp (p x) m /\\ interp (p y) m ==> x == y", "val witnessed (#a:Type u#1) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed #a #p r fact =\n PR.witnessed r (lift_fact fact)", "val witnessed (#a:Type u#1) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed #a #p r fact =\n M.witnessed r (lift_fact fact)", "val Steel.ST.MonotonicReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val PulseCore.Heap.is_witness_invariant = p: (_: a -> PulseCore.Heap.slprop) -> Prims.logical\nlet is_witness_invariant #a (p : a -> slprop) =\n forall x y m. interp (p x) m /\\ interp (p y) m ==> x == y", "val witnessed_nested (p: s_pred) : Lemma (witnessed (fun s -> witnessed p) <==> witnessed p)\nlet witnessed_nested (p:s_pred)\n: Lemma (witnessed (fun s -> witnessed p) <==> witnessed p)\n= assert_norm (witnessed (fun _ -> witnessed p) ==\n W.witnessed grows (fun _ -> W.witnessed grows p));\n assert_norm (witnessed p == W.witnessed grows p);\n W.lemma_witnessed_nested grows p", "val witnessed_impl (p q: s_pred)\n : Lemma ((witnessed (fun s -> p s ==> q s) /\\ witnessed p) ==> witnessed q)\nlet witnessed_impl (p q:s_pred)\n: Lemma ((witnessed (fun s -> p s ==> q s) /\\ witnessed p) ==> witnessed q)\n= W.lemma_witnessed_impl grows p q", "val Steel.MonotonicReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : STAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n = coerce_atomic (witness' r fact v pf)", "val Steel.MonotonicHigherReference.stable_property = p: FStar.Preorder.preorder a -> Type\nlet stable_property (#a:Type) (p:Preorder.preorder a)\n = fact:property a { Preorder.stable fact p }", "val witness_hsref (#a:Type) (#rel:preorder a) (r:HS.mreference a rel)\n :ST unit (fun h0 -> h0 `HS.contains` r)\n (fun h0 _ h1 -> h0 == h1 /\\ witnessed (ref_contains_pred r))\nlet witness_hsref #_ #_ r =\n HS.lemma_rid_ctr_pred ();\n HS.lemma_next_addr_contained_refs_addr ();\n gst_witness (ref_contains_pred r)", "val lemma_witnessed_impl (p q:mem_predicate)\n :Lemma ((witnessed (fun s -> p s ==> q s) /\\ witnessed p) ==> witnessed q)\nlet lemma_witnessed_impl p q = W.lemma_witnessed_impl mem_rel p q", "val Steel.Heap.is_witness_invariant = p: (_: a -> Steel.Heap.slprop) -> Prims.logical\nlet is_witness_invariant #a (p : a -> slprop) =\n forall x y m. interp (p x) m /\\ interp (p y) m ==> x == y", "val witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : STAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n = coerce_atomic (witness' r fact v pf)", "val recall\n (state: Type u#2)\n (rel: P.preorder state)\n (p: W.s_predicate state)\n (w: W.witnessed state rel p)\n : NMSTATETOT unit state rel (fun _ -> True) (fun s0 _ s1 -> s0 == s1 /\\ p s1)\nlet recall (state:Type u#2)\n (rel:P.preorder state)\n (p:W.s_predicate state)\n (w:W.witnessed state rel p)\n : NMSTATETOT unit state rel\n (fun _ -> True)\n (fun s0 _ s1 -> s0 == s1 /\\ p s1)\n =\n NMSTATETOT?.reflect (fun (_, n) -> M.recall state rel p w, n)", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) ()", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:Ghost.erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let h = witness_exists #_ #_ #(pts_to_body r q v) () in\n let _ = elim_pure #_ #_ #_ #q r v h in\n\n assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');\n lift_fact_is_stable #a #p fact;\n\n let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () _ in\n\n rewrite_slprop (PR.pts_to r h) (pts_to_body r q v h) (fun m ->\n emp_unit (M.pts_to r h);\n pure_star_interp (M.pts_to r h) (history_val h v q) m);\n\n intro_exists_erased h (pts_to_body r q v);\n return w", "val witness_p (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (p:spred a)\n :HST.ST unit (requires (fun h0 -> p (as_seq h0 b) /\\ p `stable_on` rel))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ b `witnessed` p))\nlet witness_p #a #rrel #rel b p =\n match b with\n | Null -> ()\n | Buffer _ content _ _ ->\n lemma_stable_on_rel_is_stable_on_rrel b p;\n //AR: TODO: the proof doesn't go through without this assertion, which should follow directly from the lemma call\n assert (HST.stable_on #(Seq.lseq a (U32.v (Buffer?.max_length b))) #(srel_to_lsrel (U32.v (Buffer?.max_length b)) rrel) (spred_as_mempred b p) (Buffer?.content b));\n HST.witness_p content (spred_as_mempred b p)", "val weaken_witness (p q:mem_predicate)\n :Lemma ((forall h. p h ==> q h) /\\ witnessed p ==> witnessed q)\nlet weaken_witness p q =\n let aux () :Lemma (requires ((forall h. p h ==> q h) /\\ witnessed p)) (ensures (witnessed q))\n = lemma_functoriality p q\n in\n FStar.Classical.move_requires aux ()", "val lemma_witnessed_nested (p:mem_predicate)\n : Lemma (witnessed (fun (m:mem) -> witnessed p) <==> witnessed p)\nlet lemma_witnessed_nested p =\n assert_norm (witnessed (fun (m:mem) -> witnessed p) ==\n W.witnessed mem_rel (fun (m:mem) -> W.witnessed mem_rel p));\n assert_norm (witnessed p == W.witnessed mem_rel p);\n W.lemma_witnessed_nested mem_rel p", "val lemma_witnessed_or (p q:mem_predicate)\n :Lemma ((witnessed p \\/ witnessed q) ==> witnessed (fun s -> p s \\/ q s))\nlet lemma_witnessed_or p q = W.lemma_witnessed_or mem_rel p q", "val stable (p:mem_predicate) :Type0\nlet stable p = forall (h1:mem) (h2:mem).{:pattern (mem_rel h1 h2)} (p h1 /\\ mem_rel h1 h2) ==> p h2", "val recall\n (state: Type u#2)\n (rel: P.preorder state)\n (p: W.s_predicate state)\n (w: W.witnessed state rel p)\n : NMSTATE unit state rel (fun _ -> True) (fun s0 _ s1 -> s0 == s1 /\\ p s1)\nlet recall (state:Type u#2)\n (rel:P.preorder state) \n (p:W.s_predicate state)\n (w:W.witnessed state rel p)\n : NMSTATE unit state rel\n (fun _ -> True)\n (fun s0 _ s1 -> s0 == s1 /\\ p s1)\n =\n NMSTATE?.reflect (fun (_, n) -> M.recall state rel p w, n)", "val witnessed_or (p q: s_pred)\n : Lemma ((witnessed p \\/ witnessed q) ==> witnessed (fun s -> p s \\/ q s))\nlet witnessed_or (p q:s_pred)\n: Lemma ((witnessed p \\/ witnessed q) ==> witnessed (fun s -> p s \\/ q s))\n= W.lemma_witnessed_or grows p q", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let w = MHR.witness r (lift_property fact) (U.raise_val (reveal v)) () in\n return w", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let h = witness_exists #_ #_ #(pts_to_body r q v) () in\n let _ = elim_pure #_ #_ #_ #q r v h in\n\n assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');\n lift_fact_is_stable #a #p fact;\n\n let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () () in\n\n \n intro_pure_full r v h;\n rewrite_slprop (pts_to _ q _) (pts_to r q v) (fun _ -> ());\n return w", "val Lib.Buffer.witnessed = b: Lib.Buffer.glbuffer a len -> s: Lib.Sequence.lseq a (Lib.IntTypes.v len) -> Type0\nlet witnessed (#a:Type0) (#len:size_t) (b:glbuffer a len) (s:Seq.lseq a (v len)) =\n B.witnessed (CB.as_mbuf b) (cpred s)", "val FStar.MRef.p_pred = r: FStar.ST.mref a b -> p: (_: a -> Type0) -> h: FStar.Monotonic.Heap.heap -> Prims.logical\nlet p_pred (#a:Type) (#b:preorder a) (r:mref a b) (p:(a -> Type))\n = fun h -> h `contains` r /\\ p (sel h r)", "val witnessed_and (p q: s_pred)\n : Lemma (witnessed (fun s -> p s /\\ q s) <==> (witnessed p /\\ witnessed q))\nlet witnessed_and (p q:s_pred)\n: Lemma (witnessed (fun s -> p s /\\ q s) <==> (witnessed p /\\ witnessed q))\n= W.lemma_witnessed_and grows p q", "val testify_forall (#c:Type) (#p:(c -> mem -> Type0))\n ($s:squash (forall (x:c). witnessed (p x)))\n :ST unit (requires (fun h -> True))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ (forall (x:c). p x h1)))\nlet testify_forall #c #p $s =\n W.lemma_witnessed_forall mem_rel p;\n gst_recall (fun h -> forall (x:c). p x h)", "val FStar.ReflexiveTransitiveClosure.stable = \n p: (_: a -> Type0) ->\n rel:\n FStar.ReflexiveTransitiveClosure.binrel a {FStar.ReflexiveTransitiveClosure.preorder_rel rel}\n -> Prims.logical\nlet stable (#a:Type u#a) (p:a -> Type0) (rel:binrel u#a u#r a{preorder_rel rel}) =\n forall (x:a) (y:a). (p x /\\ squash (rel x y)) ==> p y", "val lemma_witnessed_and (p q:mem_predicate)\n :Lemma (witnessed (fun s -> p s /\\ q s) <==> (witnessed p /\\ witnessed q))\nlet lemma_witnessed_and p q = W.lemma_witnessed_and mem_rel p q", "val witness (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (fact:Steel.Preorder.stable_property pcm)\n (v:erased a)\n (_:squash (Steel.Preorder.fact_valid_compat fact v))\n : SteelAtomicUT (witnessed r fact) o\n (pts_to r v)\n (fun _ -> pts_to r v)\nlet witness (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (fact:Steel.Preorder.stable_property pcm)\n (v:erased a)\n (_:squash (Steel.Preorder.fact_valid_compat fact v))\n = P.witness r fact v ()", "val witnessed (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (p:spred a) :Type0\nlet witnessed #_ #rrel #rel b p =\n match b with\n | Null -> p Seq.empty\n | Buffer max_length content idx length ->\n HST.token_p content (spred_as_mempred b p)", "val witness_contents (#a: Type0) (b: ibuffer a) (s: Seq.seq a)\n : HST.ST unit\n (requires (fun h0 -> Seq.equal (as_seq h0 b) s))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ witnessed b (cpred s)))\nlet witness_contents (#a:Type0) (b:ibuffer a) (s:Seq.seq a)\n :HST.ST unit (requires (fun h0 -> Seq.equal (as_seq h0 b) s))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ witnessed b (cpred s)))\n = witness_p b (cpred s)", "val FStar.Fin.under = p: Prims.nat -> Type0\nlet under (p:nat) = x:nat {x witnessed p))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ p h1))\nlet testify (p:mem_predicate) = gst_recall p", "val FStar.Monotonic.HyperStack.mreference = a: Type0 -> rel: FStar.Preorder.preorder a -> Type0\nlet mreference a rel = mreference' a rel", "val witness':\n #inames: _ ->\n #a: Type ->\n #q: perm ->\n #p: Preorder.preorder a ->\n r: ref a p ->\n fact: stable_property p ->\n v: erased a ->\n pf: squash (fact v) ->\n unit\n -> Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact)\n inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness' (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n (_:unit)\n : Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = MR.witness #inames #a #q #p r fact v pf", "val witness':\n #inames: _ ->\n #a: Type ->\n #q: perm ->\n #p: Preorder.preorder a ->\n r: erased (ref a p) ->\n fact: stable_property p ->\n v: erased a ->\n pf: squash (fact v) ->\n unit\n -> Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact)\n inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness' (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n (_:unit)\n : Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = MR.witness #inames #a #q #p r fact v pf", "val FStar.MRef.stable = p: FStar.Preorder.predicate _ -> rel: FStar.Preorder.relation _ {FStar.Preorder.preorder_rel rel}\n -> Prims.logical\nlet stable = FStar.Preorder.stable", "val sealed_ (#a: Type u#a) (witness: a) : Type u#0\nlet sealed_ (#a:Type u#a)\n (witness:a)\n : Type u#0\n = FStar.Sealed.sealed a", "val ghost_witnessed\r\n (#a:Type u#1)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n: Type0\nlet ghost_witnessed \r\n (#a:Type u#1) \r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n= witnessed (reveal r) f", "val snapshot (c: connection) (h0: heap{h0 `live_connection` c}) : (p: heap_predicate{stable p})\nlet snapshot (c:connection) (h0:heap{h0 `live_connection` c}) :(p:heap_predicate{stable p}) =\n fun h -> h `live_connection` c /\\\n ctr c h0 <= ctr c h /\\ ctr c h0 <= Seq.length (log c h) /\\ log c h0 `is_prefix_of` log c h", "val FStar.Preorder.stable = p: FStar.Preorder.predicate a -> rel: FStar.Preorder.relation a {FStar.Preorder.preorder_rel rel}\n -> Prims.logical\nlet stable (#a:Type) (p:predicate a) (rel:relation a{preorder_rel rel}) =\n forall (x:a) (y:a). (p x /\\ rel x y) ==> p y", "val MSeqExn.stable = p: MSeqExn.s_pred -> Prims.logical\nlet stable (p:s_pred) =\n forall s0 s1. (p s0 /\\ grows s0 s1) ==> p s1", "val FStar.ST.st_pre = Type\nlet st_pre = gst_pre", "val tree_sl'_witinv (#a: Type0) (ptr: t a) : Lemma (is_witness_invariant (tree_sl' ptr))\nlet tree_sl'_witinv (#a: Type0) (ptr: t a) : Lemma(is_witness_invariant (tree_sl' ptr))\n = let rec aux (ptr:t a) (x y:tree (node a)) (m:mem) : Lemma\n (requires interp (tree_sl' ptr x) m /\\ interp (tree_sl' ptr y) m)\n (ensures x == y)\n (decreases x)\n = match x with\n | Spec.Leaf -> begin match y with\n | Spec.Leaf -> ()\n | Spec.Node data left right ->\n Mem.pure_interp (ptr == null_t) m;\n Mem.affine_star (pts_to_sl ptr full_perm data `Mem.star` tree_sl' (get_left data) left)\n (tree_sl' (get_right data) right) m;\n Mem.affine_star (pts_to_sl ptr full_perm data) (tree_sl' (get_left data) left) m;\n pts_to_not_null ptr full_perm data m\n end\n | Spec.Node data1 left1 right1 -> begin match y with\n | Spec.Leaf ->\n Mem.pure_interp (ptr == null_t) m;\n Mem.affine_star (pts_to_sl ptr full_perm data1 `Mem.star` tree_sl' (get_left data1) left1)\n (tree_sl' (get_right data1) right1) m;\n Mem.affine_star (pts_to_sl ptr full_perm data1) (tree_sl' (get_left data1) left1) m;\n pts_to_not_null ptr full_perm data1 m\n | Spec.Node data2 left2 right2 ->\n pts_to_witinv ptr full_perm;\n aux (get_left data1) left1 left2 m;\n aux (get_right data1) right1 right2 m\n end\n\n in Classical.forall_intro_3 (Classical.move_requires_3 (aux ptr))", "val witness_token: #a:Type -> #b:preorder a -> m:mref a b -> p:(a -> Type){stable p b}\n -> ST unit (requires (fun h0 -> p (sel h0 m)))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ token m p))\nlet witness_token #_ #_ m p =\n gst_recall (contains_pred m);\n gst_witness (p_pred m p)", "val GMST.stable = p: FStar.Preorder.predicate a -> rel: FStar.Preorder.preorder a -> Prims.logical\nlet stable (#a:Type) (p:predicate a) (rel:preorder a) \n = forall x y . p x /\\ rel x y ==> p y", "val anchored_snapshot\n (#v: Type0)\n (#p: preorder v)\n (#s: anchor_rel p)\n (a: avalue s {s (curval (avalue_val a)) (curval (avalue_val a))})\n : avalue s & avalue s\nlet anchored_snapshot (#v:Type0) (#p:preorder v) (#s:anchor_rel p)\n (a: avalue s { s (curval (avalue_val a)) (curval (avalue_val a)) })\n : avalue s & avalue s\n = let (p,a0), v = a in\n let a =\n match a0 with\n | None -> Some (curval v)\n | Some a -> Some a\n in\n ((p, None), v),\n ((None, a), v)", "val FStar.ST.st_wp = a: Type -> Type\nlet st_wp = gst_wp", "val FStar.Monotonic.HyperStack.mref = a: Type0 -> rel: FStar.Preorder.preorder a -> Type0\nlet mref (a:Type) (rel:preorder a) =\n s:mreference a rel{ is_eternal_region_hs (frameOf s) && not (is_mm s) }", "val token_p (#a:Type0) (#rel:preorder a) (r:mreference a rel) (p:mem_predicate) :Type0\nlet token_p #_ #_ r p = witnessed (mem_rel_predicate r p)" ], "closest_src": [ { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.ist_witnessed" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.ist_witnessed" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.ist_witnessed" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.ist_witnessed" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.ist_witnessed" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.witnessed_past" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.witnessed" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.witnessed" }, { "project_name": "FStar", "file_name": "ReifyTestTSST.fsti", "name": "ReifyTestTSST.witnessed" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.witness" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.witnessed" }, { "project_name": "FStar", "file_name": "FStar.Witnessed.Core.fsti", "name": "FStar.Witnessed.Core.s_predicate" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.witness" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.witnessed" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.witness" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.witness" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.mr_witness" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.lemma_witnessed_constant" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_constant" }, { "project_name": "FStar", "file_name": "FStar.Witnessed.Core.fsti", "name": "FStar.Witnessed.Core.stable" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.witnessed" }, { "project_name": "steel", "file_name": "PulseCore.MonotonicStateMonad.fst", "name": "PulseCore.MonotonicStateMonad.witnessed" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.lemma_witnessed_forall" }, { "project_name": "FStar", "file_name": "FStar.Witnessed.Core.fst", "name": "FStar.Witnessed.Core.witnessed" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_exists" }, { "project_name": "FStar", "file_name": "FStar.MRef.fst", "name": "FStar.MRef.witness" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.recall" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.lemma_witnessed_impl" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.witness_p" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.witnessed_defs_equiv_2" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_constant" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_exists" }, { "project_name": "steel", "file_name": "Steel.FractionalAnchoredPreorder.fst", "name": "Steel.FractionalAnchoredPreorder.snapshot" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_forall" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Witnessed.fst", "name": "FStar.Monotonic.Witnessed.lemma_witnessed_and" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fsti", "name": "Steel.GhostMonotonicHigherReference.stable_property" }, { "project_name": "steel", "file_name": "Steel.Memory.fsti", "name": "Steel.Memory.is_witness_invariant" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_forall" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fsti", "name": "Steel.GhostMonotonicReference.stable_property" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.stable" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fsti", "name": "Steel.ST.GhostMonotonicReference.stable_property" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.is_witness_invariant" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fsti", "name": "Steel.ST.MonotonicReference.stable_property" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.is_witness_invariant" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_nested" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_impl" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fsti", "name": "Steel.MonotonicReference.stable_property" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witness" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fsti", "name": "Steel.MonotonicHigherReference.stable_property" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.witness_hsref" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_impl" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.is_witness_invariant" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witness" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.recall" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.witness" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.witness" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.witness_p" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.weaken_witness" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_nested" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_or" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.stable" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.recall" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_or" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.witness" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.witness" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.witnessed" }, { "project_name": "FStar", "file_name": "FStar.MRef.fst", "name": "FStar.MRef.p_pred" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.witnessed_and" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.testify_forall" }, { "project_name": "FStar", "file_name": "FStar.ReflexiveTransitiveClosure.fsti", "name": "FStar.ReflexiveTransitiveClosure.stable" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.lemma_witnessed_and" }, { "project_name": "steel", "file_name": "Steel.GhostPCMReference.fst", "name": "Steel.GhostPCMReference.witness" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.witnessed" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.witness_contents" }, { "project_name": "FStar", "file_name": "FStar.Fin.fsti", "name": "FStar.Fin.under" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.testify" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.mreference" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witness'" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witness'" }, { "project_name": "FStar", "file_name": "FStar.MRef.fsti", "name": "FStar.MRef.stable" }, { "project_name": "FStar", "file_name": "FStar.Sealed.Inhabited.fst", "name": "FStar.Sealed.Inhabited.sealed_" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_witnessed" }, { "project_name": "FStar", "file_name": "Protocol.fst", "name": "Protocol.snapshot" }, { "project_name": "FStar", "file_name": "FStar.Preorder.fst", "name": "FStar.Preorder.stable" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.stable" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_pre" }, { "project_name": "steel", "file_name": "Selectors.Tree.Core.fst", "name": "Selectors.Tree.Core.tree_sl'_witinv" }, { "project_name": "FStar", "file_name": "FStar.MRef.fst", "name": "FStar.MRef.witness_token" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.stable" }, { "project_name": "steel", "file_name": "Steel.FractionalAnchoredPreorder.fst", "name": "Steel.FractionalAnchoredPreorder.anchored_snapshot" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_wp" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.mref" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.token_p" } ], "selected_premises": [ "SnapshotST.rel_t", "SnapshotST.lift_predicate", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Pervasives.id", "FStar.Preorder.preorder_rel", "SnapshotST.mst_pre", "FStar.Preorder.reflexive", "FStar.Pervasives.dfst", "FStar.Preorder.stable", "FStar.Pervasives.coerce_eq", "Prims.l_False", "FStar.Pervasives.reveal_opaque", "Prims.l_True", "FStar.Pervasives.dsnd", "Prims.min", "FStar.Preorder.transitive", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.st_post_h", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.all_post_h", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.ex_pre", "Prims.pure_pre", "Prims.subtype_of", "FStar.Pervasives.st_post_h'", "SnapshotST.mst_post", "FStar.Pervasives.all_return", "Prims.returnM", "Prims.abs", "Prims.pow2", "FStar.Pervasives.st_stronger", "FStar.Pervasives.ex_post", "Prims.__cache_version_number__", "Prims.auto_squash", "FStar.Pervasives.all_stronger", "FStar.Pervasives.st_trivial", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.all_trivial", "FStar.Pervasives.ex_post'", "FStar.Pervasives.st_return", "Prims.pure_post'", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.ex_trivial", "SnapshotST.mst_wp", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.all_bind_wp", "Prims.purewp_id", "Prims.pure_wp_monotonic", "FStar.Pervasives.trivial_pure_post", "Prims.pure_trivial", "FStar.Pervasives.pure_close_wp", "Prims.pure_post", "FStar.Pervasives.ex_ite_wp", "Prims.pure_stronger", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.pure_ite_wp", "Prims.pure_wp'", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.st_close_wp", "Prims.as_requires", "Prims.pure_wp", "Prims.pure_wp_monotonic0", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.ex_return", "FStar.Pervasives.pure_return", "Prims.op_Hat", "Prims.as_ensures", "FStar.Pervasives.lift_div_exn", "SnapshotST.div_lift", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.st_bind_wp" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule SnapshotST\n\n(*\n An example of preorder-indexed state monads in which\n it is possible for the state to temporarily invalidate\n the given preorder. Witnessing and recalling of stable\n predicates is only possible when the state is consistent.\n*)\n\nopen FStar.Preorder\nopen FStar.Monotonic.Witnessed\n\n(* The original type of states and a preorder on it *)\n\nassume type state\nassume val rel_s : preorder state\n\n(* The richer state type that allows us to temporarily violate rel *)\n\nnoeq type t =\n | Ok : state -> t\n | Tmp : state -> state -> t\n\n(* The lifting of rel to the richer state type *)\n\nlet rel_t (t0:t) (t1:t)\n = match t0 , t1 with\n | Ok s0 , Ok s1 -> rel_s s0 s1\n | Ok s0 , Tmp s1 _ -> rel_s s0 s1\n | Tmp s0 _ , Ok s1 -> rel_s s0 s1\n | Tmp s0 _ , Tmp s1 _ -> rel_s s0 s1\n\n(* Lifting predicates from state to t *)\n\nlet lift_predicate (p:predicate state{stable p rel_s}) (t:t)\n = match t with\n | Ok s -> p s\n | Tmp s _ -> p s\n\n(* Lifting stability from state to t *)\n\nval lift_stability : p:predicate state{stable p rel_s}\n\t\t -> t0:t\n\t\t -> t1:t\n\t\t -> Lemma (requires (lift_predicate p t0 /\\ rel_t t0 t1))\n\t\t (ensures (lift_predicate p t1))\nlet lift_stability p t0 t1 = ()\n\n\n(* ************************************************************************************************** *)\n\n(*\n A temporary definition of monotonic-state monad specialized to\n this snapshots example, in order to make sub-effecting to work.\n*)\n\n(* Preconditions, postconditions, and WPs for the monotonic-state monad. *)\n\nlet mst_pre = t -> Type0\nlet mst_post (a:Type) = a -> t -> Type0\nlet mst_wp (a:Type) = mst_post a -> Tot mst_pre\n\n(* A WP-style monotonic-state monad specialised for this example. *)\n\nnew_effect MSTATE = STATE_h t\n\n(* DIV is a sub-effect of the snapshots instance of the monotonic-state monad. *)\n\n(* AR: this failed when inline, investigate more *)\nunfold let div_lift (a:Type) (wp:pure_wp a) (p:mst_post a) (x:t) = wp (fun y -> p y x)\nsub_effect DIV ~> MSTATE = div_lift\n\n(* A pre- and postcondition version of this monotonic-state monad. *)\n\neffect MST (a:Type) (pre:mst_pre) (post:(t -> Tot (mst_post a)))\n =\n MSTATE a (fun p t0 -> pre t0 /\\ (forall x t1 . pre t0 /\\ post t0 x t1 ==> p x t1))\n\n(* The logical witnessed capability for the richer type of states *)\n", "sketch": [ "The `witnessed` function is implemented by directly returning the Type0, as it does not require any additional computation or manipulation.", "The `witnessed` function is implemented by simply taking a predicate `p` over the type `SnapshotST.t` and returning Type0.", "The `witnessed` definition is implemented by taking a predicate `p` over the state type `SnapshotST.t` and returning a Type0.", "The `witnessed` type is implemented by defining a predicate on the richer state type `t` that is witnessed and stable with respect to the original state type `state` and its preorder relation.", "The definition of `witnessed` is about defining a type that represents a predicate on the state type `t` in the SnapshotST module.\n\nStep 1: We define a type `witnessed` that takes a predicate `p` of type `FStar.Preorder.predicate SnapshotST.t` and returns `Type0`.\n\nStep 2: The `witnessed` type is implemented by directly defining it as a type that takes a predicate `p` and returns `Type0`.", "To implement the `witnessed` function, we will define it as a simple function that takes a predicate `p` over the state type `SnapshotST.t` and returns Type0.", "The `witnessed` type is implemented by taking a predicate `p` of type `FStar.Preorder.predicate SnapshotST.t` and returning `Type0`.", "The `witnessed` type is implemented as a dependent pair, where the first component is a predicate `p` on the state type `SnapshotST.t`, and the second component is a proof that the predicate `p` is stable with respect to the preorder `rel_s` on the state type.", "The `witnessed` definition is implemented by taking a predicate `p` over the state type `SnapshotST.t` and returning a Type0, indicating that the predicate is witnessed.", "The `witnessed` definition is implemented by defining a type that takes a predicate `p` on the state type `t` and returns `Type0`. This type represents the witnessed predicate on the richer state type `t`." ], "generated_solution": [ "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0\nlet witnessed p = Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0\nlet witnessed p = { t:SnapshotST.t | SnapshotST.lift_predicate p t }", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0\nlet witnessed p = { pred: (t:SnapshotST.t) -> Type0\n stable_proof: FStar.Preorder.stable p SnapshotST.rel_s pred }", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0", "val witnessed : p: FStar.Preorder.predicate SnapshotST.t -> Type0" ] }, { "file_name": "MonadFunctorInference.fst", "name": "MonadFunctorInference.test_st2", "opens_and_abbrevs": [ { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let test_st2 () =\n y <-- get;\n x <-- get_inc;\n if x > 17\n then put (x + y)\n else put y", "source_range": { "start_line": 37, "start_col": 0, "end_line": 42, "end_col": 12 }, "interleaved": false, "definition": "fun _ ->\n MonadFunctorInference.bind MonadFunctorInference.get\n (fun y ->\n MonadFunctorInference.bind MonadFunctorInference.get_inc\n (fun x ->\n (match x > 17 with\n | true -> MonadFunctorInference.put (x + y)\n | _ -> MonadFunctorInference.put y)\n <:\n MonadFunctorInference.st Prims.int Prims.unit))", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.unit", "MonadFunctorInference.bind", "MonadFunctorInference.st", "Prims.int", "MonadFunctorInference.st_monad", "MonadFunctorInference.get", "MonadFunctorInference.get_inc", "Prims.op_GreaterThan", "MonadFunctorInference.put", "Prims.op_Addition", "Prims.bool" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "_: Prims.unit -> MonadFunctorInference.st Prims.int Prims.unit", "prompt": "let test_st2 () =\n ", "expected_response": "y <-- get ;\nx <-- get_inc ;\nif x > 17 then put (x + y) else put y", "source": { "project_name": "FStar", "file_name": "examples/typeclasses/MonadFunctorInference.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "MonadFunctorInference.fst", "checked_file": "dataset/MonadFunctorInference.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.Typeclasses.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked" ] }, "definitions_in_context": [ "monad", "monad", "class monad (m:Type -> Type) =\n{\n return : (#a:Type -> a -> m a);\n bind : (#a:Type -> #b:Type -> (f:m a) -> (g:(a -> m b)) -> m b);\n}", "class monad (m:Type -> Type) =\n{\n return : (#a:Type -> a -> m a);\n bind : (#a:Type -> #b:Type -> (f:m a) -> (g:(a -> m b)) -> m b);\n}", "return", "return", "bind", "bind", "let st (s:Type) (a:Type) = s -> a & s", "instance st_monad s : monad (st s) =\n{\n return = (fun #a (x:a) -> (fun s -> x, s));\n bind = (fun #a #b (f: st s a) (g: a -> st s b) (s0:s) ->\n let x, s1 = f s0 in\n g x s1);\n}", "let get #s\n : st s s\n = fun s -> s, s", "let put #s (x:s)\n : st s unit\n = fun _ -> (), x", "let get_inc =\n x <-- get;\n return (x + 1)" ], "closest": [ "val BasicTests.test2 = _: Prims.unit -> Prims.unit\nlet test2 () = assert_norm (calc_chain_compatible [(<=); (<)] (<))", "val STLC.Infer.test_id = _: Prims.unit -> Prims.unit\nlet test_id () = assert (foo () == ()) by (T.compute ())", "val GradedMonad.test = GradedMonad.st s GradedMonad.monoid_nat_plus (GradedMonad.op 0 1) Prims.unit\nlet test #s =\n x <-- get #s ;\n put x", "val BasicTests.test1 = _: Prims.unit -> Prims.unit\nlet test1 () = assert_norm (calc_chain_compatible [(<); (<=)] (<))", "val CalcImpl.test3 = _: Prims.unit -> Prims.unit\nlet test3 () =\n calc any {\n p /\\ p;\n <==> {}\n p;\n ==> { lem () } (* works per-step, even if the final relation is something else *)\n q /\\ q;\n <==> {}\n q;\n }", "val CalcImpl.test = _: Prims.unit -> Prims.unit\nlet test () =\n calc (==>) {\n p;\n ==> { lem () } (* this is only working since desugaring is wrapping\n * the justification with a calc_push_impl, otherwise\n * our goal would be squash (p ==> q) and we could\n * not call lem (as p cannot be proven) *)\n q;\n }", "val Preprocess.test = _: Prims.unit -> Prims.unit\nlet test () =\n assert (test_add_1' 5 == 7)", "val Rewrite.Monoid.test = a: Prims.int -> b: Prims.int -> p: Type0 -> Prims.unit\nlet test (a b : int) (p:Type) =\n assert ((((a + b + 0) == (a + b)) ==> p) ==> p)\n by (norm [];\n rewrite_int true;\n apply_imp (implies_intro());\n norm [delta; zeta;iota; primops];\n apply (`refl))", "val MutualUnion.test_fun = _: Prims.unit -> FStar.Int16.t\nlet test_fun () = 0s", "val Monad.g' = {| _: Monad.monad m |} -> x: m a -> Prims.unit\nlet g' #a #b #m {| monad m |} (x : m a) =\n (laws #m).idL () (fun () -> x);\n (laws #m).idR x;\n assert (bind #m x (return #m) == bind #m (return #m ()) (fun () -> x))", "val BasicTests.test3 = _: Prims.unit -> Prims.unit\nlet test3 () = assert_norm (calc_chain_compatible [(<); (<)] (<))", "val test2: Prims.unit -> HoareST int (fun _ -> True) (fun _ _ _ -> True)\nlet test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)\n= g 2 (f 0)", "val CalcImpl.test4 = _: Prims.unit -> Prims.unit\nlet test4 () =\n calc any {\n p /\\ p;\n <==> {}\n p;\n l_imp { lem () } (* can also use l_imp instead of ==> *)\n q /\\ q;\n <==> {}\n q;\n }", "val CalcImpl.test5 = _: Prims.unit -> Prims.unit\nlet test5 () =\n calc (==>) {\n 1;\n ==> {}\n 2;\n }", "val Functor.t2 = Functor.compose Prims.list Prims.list Prims.int\nlet t2 = fmap #(compose list list) (fun x -> x + 1) [[1] ; [2 ; 3]]", "val BasicTests.test5 = _: Prims.unit -> Prims.unit\nlet test5 () = assert_norm (calc_chain_compatible [(<); (==); (<=)] (<))", "val Monad.g = {| d: Monad.monad m |} -> x: m a -> Prims.unit\nlet g #a #b #m {| d : monad m |} (x : m a) =\n d.laws.idL () (fun () -> x);\n d.laws.idR x;\n assert (bind #m x (return #m) == bind #m (return #m ()) (fun () -> x))", "val BasicTests.test4 = _: Prims.unit -> Prims.unit\nlet test4 () = assert_norm (calc_chain_compatible [(<)] (<))", "val RBTreeIntrinsic.test = _: Prims.unit -> FStar.All.ALL Prims.unit\nlet test () = loop (RBTree Leaf)", "val STLC.Core.test_id = _: Prims.unit -> Prims.unit\nlet test_id () = assert (foo () == ()) by (T.compute ())", "val SimplePrintf.test = _: Prims.unit -> (Prims.string <: Type0)\nlet test () = sprintf \"%d: Hello %s, sprintf %s\" 0 \"#fstar-hackery\" \"works!\"", "val test: Prims.unit -> St unit\nlet test (): St unit =\n let r = HS.(new_region root) in\n let b = B.malloc HS.root 0ul 1ul in\n let l: t UInt32.t = create_in r in\n push l 0ul;\n push l 1ul;\n push l 2ul;\n B.upd b 0ul 1ul;\n let h0 = ST.get () in\n assert (v h0 l == [ 2ul; 1ul; 0ul ]);\n assert (B.deref h0 b == 1ul);\n ignore (pop l);\n let h1 = ST.get () in\n assert (v h1 l == [ 1ul; 0ul ]);\n assert (B.deref h0 b == 1ul);\n clear l;\n let h2 = ST.get () in\n assert (v h2 l == []);\n assert (B.deref h2 b == 1ul);\n free l;\n ()", "val ImmutableBuffer.test_witnessed_functoriality = _: Prims.unit -> Prims.unit\nlet test_witnessed_functoriality () =\n assert (LowStar.Monotonic.Buffer.rrel_rel_always_compatible (B.trivial_preorder int) (B.trivial_preorder int));\n assert (LowStar.Monotonic.Buffer.rrel_rel_always_compatible (IB.immutable_preorder int) (IB.immutable_preorder int))", "val test_st: Prims.unit -> Pure (option int) True (fun _ -> True)\nlet test_st () : Pure (option int) True (fun _ -> True)\n= reify (test ()) ()", "val test: Prims.unit -> STT unit ((p `star` p) `star` p) (fun _ -> (p `star` p) `star` p)\nlet test () : STT unit (p `star` p `star` p) (fun _ -> p `star` p `star` p)\n = f 0; ()", "val SimpleTactic.test = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet test () =\n dump \"Test\";\n print \"hello\";\n admit_all()", "val RewriteTactic.test1 = _: _ -> Prims.unit\nlet test1 _ =\n assert (rewrite_with_tactic tau1 (foo 1) == (foo 2))", "val test: Prims.unit -> M unit (fun _ -> True) (fun _ _ s1 -> st_q s1)\nlet test () : M unit (fun _ -> True) (fun _ _ s1 -> st_q s1) =\n g ();\n f ();\n h ()", "val FStar.Tactics.CanonCommSemiring.test = a: Prims.int -> Prims.unit\nlet test (a:int) =\n let open FStar.Mul in\n assert (a + - a + 2 * a + - a == -a + 2 * a) by (int_semiring ())", "val FStar.Real.test = Prims.unit\nlet test = assert (two >. one)", "val FStar.Real.test_le2 = Prims.unit\nlet test_le2 = assert (1.0R <=. 1.0R)", "val Spec.Box.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let pk1 : lbytes 32 = Spec.Curve25519.secret_to_public sk1 in\n let pk2 : lbytes 32 = Spec.Curve25519.secret_to_public sk2 in\n let mac_cipher = box_detached sk1 pk2 nonce plain in\n let (mac, cipher) =\n match mac_cipher with | Some p -> p | None -> (create 16 (u8 0), create 72 (u8 0)) in\n\n let dec = box_open_detached pk1 sk2 nonce mac cipher in\n let dec_p = match dec with | Some p -> p | None -> create 72 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plain in\n\n if result_decryption\n then begin IO.print_string \"\\nCryptoBox: Success!\\n\"; true end\n else begin IO.print_string \"\\nCryptoBox: Failure :(\"; false end", "val test: Prims.unit -> HoareST int (fun _ -> True) (fun _ r _ -> r == 1)\nlet test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)\n= f 0", "val FStar.Real.test_lt2 = Prims.unit\nlet test_lt2 = assert (~ (1.0R <. 1.0R))", "val test5: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> True)\nlet test5 ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> True)\n= let y = test () in\n y", "val test2: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> r >= 4 /\\ h0 == h1)\nlet test2 ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> r >= 4 /\\ h0 == h1)\n= let x = test () in\n let y = test () in\n x + y", "val test_dep_f2: Prims.unit -> HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True)\nlet test_dep_f2 () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =\n let x = pure_g () in\n dep_f x", "val FStar.Real.test1 = Prims.unit\nlet test1 = assert (one = 1.0R)", "val test: Prims.unit -> ST int int null\nlet test () : ST int int null =\n let x = get () in\n put (x + x);\n get () + get ()", "val test: Prims.unit -> ST int int null\nlet test () : ST int int null =\n let x = get () in\n put (x + x);\n get () + get ()", "val test: Prims.unit -> ST int int null\nlet test () : ST int int null =\n let x = get () in\n put (x + x);\n get () + get ()", "val test: unit -> ST (Int32.t) (fun _ -> true) (fun _ _ _ -> true)\nlet test () =\n let l: B.pointer_or_null (t Int32.t) = B.malloc HS.root B.null 1ul in\n let l_region = new_region HS.root in\n push #Int32.t l_region (G.hide []) l 1l;\n push #Int32.t l_region (G.hide [1l]) l 0l;\n let r = pop #Int32.t l_region (G.hide [0l; 1l]) l in\n TestLib.checku32 (length (G.hide [1l]) !*l) 1ul;\n r", "val test4: Prims.unit -> HoareST int (fun _ -> True) (fun _ r _ -> r == 3)\nlet test4 ()\n: HoareST int\n (fun _ -> True)\n (fun _ r _ -> r == 3)\n= let _ = test () in\n f_pure ()", "val test6: Prims.unit -> HoareST int (fun _ -> True) (fun _ r _ -> r == 3)\nlet test6 ()\n: HoareST int\n (fun _ -> True)\n (fun _ r _ -> r == 3)\n= let x = f_pure () in\n let y = test () in\n x", "val test13: Prims.unit -> HoareST unit (fun _ -> True) (fun _ _ _ -> True)\nlet test13 () : HoareST unit (fun _ -> True) (fun _ _ _ -> True) = \n let _ : squash some_pred = proof_of_pred () in\n test12 ()", "val Effects.Def.morphism_lift_ex_stexn = Prims.unit\nlet morphism_lift_ex_stexn = \n morphism_laws_via_eq ex stexn eq_stexn\n\t\t return_ex bind_ex \n\t\t return_stexn bind_stexn \n\t\t lift_ex_stexn", "val Spec.Blake2.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nAll tests successful !\\n\"; true end\n else begin IO.print_string \"\\n\\nSome test failed !\\n\"; false end", "val Spec.Salsa20.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let result = test_quarter_round () &&\n test_row_round () &&\n test_column_round () &&\n test_column_round2 () &&\n test_salsa20_core () in\n if result then begin IO.print_string \"\\nSuccess!\\n\"; true end\n else begin IO.print_string \"\\nFailure :(\"; false end", "val Functor.t1 = Prims.list Prims.int\nlet t1 = fmap #list (fun x -> x + 1) [1 ; 2 ; 3]", "val Effects.Def.morphism_lift_st_exnst = Prims.unit\nlet morphism_lift_st_exnst = \n morphism_laws_via_eq st exnst eq_exnst\n\t\t return_st bind_st \n\t\t return_exnst bind_exnst \n\t\t lift_st_exnst", "val FStar.Real.test_gt2 = Prims.unit\nlet test_gt2 = assert (~ (1.0R >. 1.0R))", "val Effects.Def.morphism_lift_st_exn = Prims.unit\nlet morphism_lift_st_exn =\n morphism_laws_via_eq st stexn eq_stexn\n\t\t return_st bind_st \n\t\t return_stexn bind_stexn \n\t\t lift_st_stexn", "val Spec.Hash.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHash: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHash: Failure :(\\n\"; false end", "val ExtractionTest.zero = _: Prims.unit -> FStar.UInt32.t\nlet zero () = 0ul", "val Cert.ACLs.test = _: Prims.unit -> Prims.unit\nlet test () = \n delete tmp; (* ok *)\n//delete pwd; (* type error *)\n let v1 = read tmp in (* ok, rule 1. *)\n let v2 = read readme in (* ok, rule 2. *)\n ()", "val Spec.Chacha20.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let cipher = chacha20_encrypt_bytes test_key test_nonce test_counter test_plaintext in\n let res = PS.print_compare true (length test_plaintext) test_ciphertext cipher in\n\n if res\n then begin IO.print_string \"\\n\\nChacha20 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nChacha20: Failure :(\\n\"; false end", "val Intro.test_add = Prims.unit\nlet test_add = assert (add3 1 2 3 == 6)", "val Spec.Poly1305.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let mac = poly1305_mac msg key in\n let res = PS.print_compare true (length mac) expected mac in\n\n if res then begin IO.print_string \"\\nPoly1305: Success!\\n\"; true end\n else begin IO.print_string \"\\nPoly1305: Failure :(\\n\"; false end", "val FStar.Real.test_mul_lt = Prims.unit\nlet test_mul_lt = assert (2.0R *. 2.0R <. 5.0R)", "val CalcTest.test_ge = _: Prims.unit -> Prims.unit\nlet test_ge () =\n calc (>=) {\n 10;\n >= {}\n 9;\n >= {}\n 8;\n == {}\n 4+4;\n >= {}\n 0;\n }", "val MonadicLetBindings.applicative_eq = m: (_: Type -> Type) -> fmap: (_: (_: a -> b) -> _: m a -> m b) -> Prims.unit\nlet applicative_eq (m: Type -> Type) (fmap: (#a:Type -> #b:Type -> (a -> b) -> m a -> m b)) =\n let (<*>) (pair: (#a:Type -> #b:Type -> m a -> m b -> m (a * b)))\n : #a:Type -> #b:Type -> m (a -> b) -> m a -> m b\n = fun f o -> fmap (fun (f, x) -> f x) (pair f o) in\n let pair ((<*>): (#a:Type -> #b:Type -> m (a -> b) -> m a -> m b))\n : #a:Type -> #b:Type -> m a -> m b -> m (a * b)\n = fun x y -> fmap Mktuple2 x <*> y in\n ()", "val CalcTest.test_gt = _: Prims.unit -> Prims.unit\nlet test_gt () =\n calc (>) {\n 10;\n >= {}\n 9;\n > { () }\n 8;\n == {}\n 4+4;\n >= {}\n 0;\n }", "val FStar.Real.test_mul_eq = Prims.unit\nlet test_mul_eq = assert (2.0R *. 2.0R = 4.0R)", "val test_incremental_api: Prims.unit -> St unit\nlet test_incremental_api (): St unit =\n // Note: this function cannot be in the Stack effect because it performs some\n // allocations (even though it frees them afterwards).\n push_frame ();\n let b1 = B.alloca_of_list [ u8 0x00; u8 0x01; u8 0x02; u8 0x04 ] in\n let b2 = B.alloca_of_list [ u8 0x05; u8 0x06; u8 0x07; u8 0x08 ] in\n\n let st = HI.malloc SHA2_256 HyperStack.root in\n HI.reset (G.hide SHA2_256) st ();\n let h0 = ST.get () in\n assert B.(loc_disjoint (S.footprint HI.evercrypt_hash SHA2_256 h0 st) (loc_buffer b1));\n assert (S.seen HI.evercrypt_hash SHA2_256 h0 st `Seq.equal` Seq.empty);\n\n assert_norm (4 < pow2 61);\n let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b1 4ul in\n let h1 = ST.get () in\n assert (HI.hashed h1 st `Seq.equal` (Seq.append Seq.empty (B.as_seq h0 b1)));\n Seq.append_empty_l (B.as_seq h0 b1);\n assert (HI.hashed h1 st `Seq.equal` (B.as_seq h0 b1));\n\n assert (Seq.length (Ghost.reveal (Ghost.hide (B.as_seq h0 b1))) = 4);\n assert_norm (8 < pow2 61);\n let EverCrypt.Error.Success = HI.update (G.hide SHA2_256) st b2 4ul in\n let h2 = ST.get () in\n assert (HI.hashed h2 st `Seq.equal` (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2)));\n\n // An example of how to call the hash preservation lemma...\n let dst = B.alloca (u8 0) 32ul in\n let h3 = ST.get () in\n // Auto-framing!\n HI.digest (G.hide SHA2_256) st dst ();\n\n let h4 = ST.get () in\n assert (Seq.equal (B.as_seq h4 dst)\n (Spec.Agile.Hash.hash SHA2_256 (Seq.append (B.as_seq h0 b1) (B.as_seq h0 b2))));\n\n HI.free (G.hide SHA2_256) st;\n pop_frame ()", "val test2: Prims.unit -> Lemma (True)\nlet test2 () : Lemma (True) =\n let s1 = empty $:: 1 in\n let s2 = s1 $:: 2 in\n let s3 = s2 $:: 3 in\n let s4 = s3 $:: 4 in\n let s5 = s4 $:: 5 in\n assert (length s2 = 1 + length s1);\n assert (length s2 = 2);\n assert (length s5 = 5);\n assert (s5 $@ 1 == 2);\n assert (forall (s: seq int) (n: nat). n < 2 ==> (s2 $+ s) $@ n = s2 $@ n);\n assert (drop (drop s5 1) 2 == drop s5 3);\n assert (forall (v: int). length (s5 $:: v) = 6);\n assert (s3 $<= s5);\n assert (length (update s5 3 7) == 5);\n assert ((update s5 3 7) $@ 2 == 3);\n assert ((update s5 3 7) $@ 3 == 7);\n assert (length (slice s5 1 3) == 2)", "val FStar.Real.test_add_eq' = Prims.unit\nlet test_add_eq' = assert (1.0R +. 3.0R = 4.0R)", "val test9: Prims.unit -> FStar.ST.STATE int (fun p _ -> forall h1. p 3 h1)\nlet test9 ()\n: FStar.ST.STATE int (fun p _ -> forall h1. p 3 h1)\n= st_reify (fun _ -> test6 ()) ()", "val FStar.Real.test_add_lt = Prims.unit\nlet test_add_lt = assert (1.0R +. 1.0R <. 3.0R)", "val FStar.Real.test_add_eq = Prims.unit\nlet test_add_eq = assert (1.0R +. 1.0R = 2.0R)", "val FStar.Real.test_sqrt_2_mul = Prims.unit\nlet test_sqrt_2_mul = assert (sqrt_2 *. sqrt_2 = 2.0R)", "val test: Prims.unit -> Exn int True (fun _ -> True)\nlet test () : Exn int True (fun _ -> True)\n= 4", "val main: Prims.unit -> HST.Stack (unit) (fun _ -> True) (fun _ _ _ -> True)\nlet main () : HST.Stack (unit) (fun _ -> True) (fun _ _ _ -> True) =\n HST.push_frame ();\n let d : dll UInt32.t = dll_new () in\n let n1 = node_of 1ul in\n let n2 = node_of 2ul in\n dll_insert_at_head d n1;\n dll_insert_at_tail d n2;\n let h0 = HST.get () in\n reverse d;\n let h1 = HST.get () in\n assert (n2 `L.memP` as_list h1 d); // OBSERVE. TODO: WHY????!???\n let n1' = dll_head d in\n let t = node_val n1' in\n assert (t == 2ul); // Yay!\n HST.pop_frame ()", "val forall_intros: Prims.unit -> Tac binders\nlet forall_intros () : Tac binders = repeat1 forall_intro", "val Spec.Curve25519.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res1 = test_scalarmult scalar1 point1 expected1 in\n let res2 = test_scalarmult scalar2 point2 expected2 in\n \n let res = res1 && res2 in\n if res then begin IO.print_string \"\\n\\nCurve25519 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nCurve25519: Failure :(\\n\"; false end", "val FStar.Real.test_le1 = Prims.unit\nlet test_le1 = assert (1.0R <=. 2.0R)", "val FStar.Tactics.CanonMonoid.lem0 = a: Prims.int -> b: Prims.int -> c: Prims.int -> d: Prims.int -> Prims.unit\nlet lem0 (a b c d : int) =\n assert_by_tactic (0 + a + b + c + d == (0 + a) + (b + c + 0) + (d + 0))\n (fun _ -> canon_monoid int_plus_monoid (* string_of_int *); trefl())", "val FStar.DM4F.MonadLaws.right_unit_st = s: Type -> a: Type -> f: FStar.DM4F.MonadLaws.st s a -> Prims.unit\nlet right_unit_st (s:Type) (a:Type) (f:st s a) =\n assert (feq (bind_st f (return_st)) f)", "val Spec.SecretBox.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let (mac, cipher) = secretbox_detached key nonce plaintext in\n let result_encryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) cipher xcipher in\n let result_mac_compare =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) mac xmac in\n\n let dec = secretbox_open_detached key nonce xmac xcipher in\n let dec_p = match dec with | Some p -> p | None -> create 131 (u8 0) in\n let result_decryption =\n for_all2 (fun a b -> uint_to_nat #U8 a = uint_to_nat #U8 b) dec_p plaintext in\n\n if result_encryption && result_mac_compare && result_decryption\n then begin IO.print_string \"\\nSuccess!\\n\"; true end\n else begin IO.print_string \"\\nFailure :(\"; false end", "val test: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> r > 1 /\\ h0 == h1)\nlet test ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> r > 1 /\\ h0 == h1)\n= 3", "val FStar.InteractiveHelpers.ParseTest.x2 = Prims.int\nlet x2 = 3", "val test_inline: Prims.unit -> FStar.All.ML unit\nlet test_inline () : FStar.All.ML unit =\n test_inline_mov_input ();\n test_inline_mov_add_input ();\n test_inline_mul_inputs ();\n test_inline_mov_mul_rax_100 ();\n test_inline_mov_mul_inputs ();\n// This test leads (rightfully) to a failure in the printer due to a gcc bug\n// test_inline_mov_add_input_dummy_mul ();\n test_inline_comment_add ();\n test_inline_same_line ();\n test_inline_same_line_newline ();\n ()", "val FStar.Tactics.CanonCommMonoid.lem1 = a: Prims.int -> b: Prims.int -> c: Prims.int -> d: Prims.int -> Prims.unit\nlet lem1 (a b c d : int) =\n assert_by_tactic (0 + 1 + a + b + c + d + 2 == (b + 0) + 2 + d + (c + a + 0) + 1)\n (fun _ -> canon_monoid_const int_plus_cm; trefl())", "val Pruning.tau2 = _: Prims.unit -> FStar.Tactics.Effect.Tac Prims.unit\nlet tau2 =\n (fun () ->\n prune \"\";\n FStar.Tactics.split ();\n (* rev [1;2] == [2;1] *)\n addns \"FStar.List\";\n addns \"Prims\";\n smt ();\n (* 1 == 1 *)\n smt ())", "val FStar.Real.test_ge2 = Prims.unit\nlet test_ge2 = assert (1.0R >=. 1.0R)", "val FStar.Real.test_le3 = Prims.unit\nlet test_le3 = assert (~ (2.0R <=. 1.0R))", "val Unification.test = l1: Prims.list _ -> l2: Prims.list _ -> l3: Prims.list _ -> Prims.unit\nlet test l1 l2 l3 = assert (l1 ++ l2 ++ l3 == (l1 ++ l2) ++ l3)", "val FStar.Tactics.CanonCommMonoid.lem0 = a: Prims.int -> b: Prims.int -> c: Prims.int -> d: Prims.int -> Prims.unit\nlet lem0 (a b c d : int) =\n assert (0 + 1 + a + b + c + d + 2 == (b + 0) + 2 + d + (c + a + 0) + 1)\n by (canon_monoid int_plus_cm; trefl ())", "val FStar.Real.test_lt1 = Prims.unit\nlet test_lt1 = assert (1.0R <. 2.0R)", "val FStar.Tactics.CanonCommMonoidSimple.lem0 = a: Prims.int -> b: Prims.int -> c: Prims.int -> d: Prims.int -> Prims.unit\nlet lem0 (a b c d : int) =\n assert_by_tactic (0 + 1 + a + b + c + d + 2 == (b + 0) + 2 + d + (c + a + 0) + 1)\n (fun _ -> canon_monoid int_plus_cm; trefl())", "val test_dep_f: Prims.unit -> HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True)\nlet test_dep_f () : HoareST (t_int (pure_g ())) (fun _ -> True) (fun _ _ _ -> True) =\n dep_f (pure_g ())", "val StatefulLens.test3 = c: FStar.ST.ref (FStar.ST.ref Prims.int) -> FStar.ST.ST Prims.int\nlet test3 (c:ref (ref int)) = c.[v |.. v]", "val PulseLambdas.ss = _: Prims.unit -> PulseLambdas.swap_fun\nlet ss = s1", "val test: Prims.unit -> SteelT unit ((p `star` p) `star` p) (fun _ -> (p `star` p) `star` p)\nlet test () : SteelT unit (p `star` p `star` p) (fun _ -> p `star` p `star` p)\n = f 0; ()", "val ut_ex2: Prims.unit -> ST.ST unit (requires (fun _ -> True)) (ensures (fun _ _ _ -> True))\nlet ut_ex2 () : ST.ST unit (requires (fun _ -> True)) (ensures (fun _ _ _ -> True)) =\n let l : list int = [1; 2; 3; 4; 5; 6] in\n let h0 = ST.get () in\n let r = sf2 l in (* This dummy function introduces some equalities in the context *)\n let h1 = ST.get () in\n assert(B.as_seq h1 r == B.as_seq h1 r); (* <- Try here *)\n ()", "val Spec.SHA3.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nSHA3 : Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nSHA3: Failure :(\\n\"; false end", "val test_alloc_free: Prims.unit -> STT unit emp (fun _ -> emp)\nlet test_alloc_free\n ()\n: STT unit\n emp\n (fun _ -> emp)\n=\n let a = array_alloc (scalar bool) 42sz in\n let _ = gen_elim () in\n if array_is_null a\n then begin\n rewrite (array_pts_to_or_null _ _) emp;\n rewrite (freeable_or_null_array _) emp;\n noop ()\n end else begin\n let s = vpattern_replace (array_pts_to_or_null _) in\n rewrite (array_pts_to_or_null _ _) (array_pts_to a s);\n rewrite (freeable_or_null_array _) (freeable_array a);\n array_free a\n end", "val test_alloc_free: Prims.unit -> STT unit emp (fun _ -> emp)\nlet test_alloc_free\n ()\n: STT unit\n emp\n (fun _ -> emp)\n=\n let a = array_alloc (scalar bool) 42sz in\n let _ = gen_elim () in\n if array_is_null a\n then begin\n rewrite (array_pts_to_or_null _ _) emp;\n rewrite (freeable_or_null_array _) emp;\n noop ()\n end else begin\n let s = vpattern_replace (array_pts_to_or_null _) in\n rewrite (array_pts_to_or_null _ _) (array_pts_to a s);\n rewrite (freeable_or_null_array _) (freeable_array a);\n array_free a\n end", "val GC.test2 = old: GC.gc_state -> Prims.unit\nlet test2 old = assert (gc_inv old /\\ (forall i. old.color i <> Gray) ==> sweep_aux_inv old mem_lo old)", "val Spec.HKDF.Test.test = _: Prims.unit -> FStar.All.ALL Prims.bool\nlet test () =\n let res = List.for_all test_one test_vectors in\n if res then begin IO.print_string \"\\n\\nHKDF: Success!\\n\"; true end\n else begin IO.print_string \"\\n\\nHKDF: Failure :(\\n\"; false end", "val test3: Prims.unit -> HoareST int (fun _ -> True) (fun _ r _ -> r >= 5)\nlet test3 ()\n: HoareST int\n (fun _ -> True)\n (fun _ r _ -> r >= 5)\n= let x = test () in\n let y = f_pure () in\n x + y" ], "closest_src": [ { "project_name": "FStar", "file_name": "BasicTests.fst", "name": "BasicTests.test2" }, { "project_name": "FStar", "file_name": "STLC.Infer.fst", "name": "STLC.Infer.test_id" }, { "project_name": "FStar", "file_name": "GradedMonad.fst", "name": "GradedMonad.test" }, { "project_name": "FStar", "file_name": "BasicTests.fst", "name": "BasicTests.test1" }, { "project_name": "FStar", "file_name": "CalcImpl.fst", "name": "CalcImpl.test3" }, { "project_name": "FStar", "file_name": "CalcImpl.fst", "name": "CalcImpl.test" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.test" }, { "project_name": "FStar", "file_name": "Rewrite.Monoid.fst", "name": "Rewrite.Monoid.test" }, { "project_name": "steel", "file_name": "MutualUnion.fst", "name": "MutualUnion.test_fun" }, { "project_name": "FStar", "file_name": "Monad.fst", "name": "Monad.g'" }, { "project_name": "FStar", "file_name": "BasicTests.fst", "name": "BasicTests.test3" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test2" }, { "project_name": "FStar", "file_name": "CalcImpl.fst", "name": "CalcImpl.test4" }, { "project_name": "FStar", "file_name": "CalcImpl.fst", "name": "CalcImpl.test5" }, { "project_name": "FStar", "file_name": "Functor.fst", "name": "Functor.t2" }, { "project_name": "FStar", "file_name": "BasicTests.fst", "name": "BasicTests.test5" }, { "project_name": "FStar", "file_name": "Monad.fst", "name": "Monad.g" }, { "project_name": "FStar", "file_name": "BasicTests.fst", "name": "BasicTests.test4" }, { "project_name": "FStar", "file_name": "RBTreeIntrinsic.fst", "name": "RBTreeIntrinsic.test" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.test_id" }, { "project_name": "FStar", "file_name": "SimplePrintf.fst", "name": "SimplePrintf.test" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.test" }, { "project_name": "FStar", "file_name": "ImmutableBuffer.fst", "name": "ImmutableBuffer.test_witnessed_functoriality" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.test_st" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test" }, { "project_name": "FStar", "file_name": "SimpleTactic.fst", "name": "SimpleTactic.test" }, { "project_name": "FStar", "file_name": "RewriteTactic.fst", "name": "RewriteTactic.test1" }, { "project_name": "FStar", "file_name": "HoareSTFree.fst", "name": "HoareSTFree.test" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le2" }, { "project_name": "hacl-star", "file_name": "Spec.Box.Test.fst", "name": "Spec.Box.Test.test" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_lt2" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test5" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test2" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test_dep_f2" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test1" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.test" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.test" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.test" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.test" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test4" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test6" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test13" }, { "project_name": "FStar", "file_name": "Effects.Def.fst", "name": "Effects.Def.morphism_lift_ex_stexn" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Test.fst", "name": "Spec.Blake2.Test.test" }, { "project_name": "hacl-star", "file_name": "Spec.Salsa20.Test.fst", "name": "Spec.Salsa20.Test.test" }, { "project_name": "FStar", "file_name": "Functor.fst", "name": "Functor.t1" }, { "project_name": "FStar", "file_name": "Effects.Def.fst", "name": "Effects.Def.morphism_lift_st_exnst" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_gt2" }, { "project_name": "FStar", "file_name": "Effects.Def.fst", "name": "Effects.Def.morphism_lift_st_exn" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Test.fst", "name": "Spec.Hash.Test.test" }, { "project_name": "steel", "file_name": "ExtractionTest.fst", "name": "ExtractionTest.zero" }, { "project_name": "FStar", "file_name": "Cert.ACLs.fst", "name": "Cert.ACLs.test" }, { "project_name": "hacl-star", "file_name": "Spec.Chacha20.Test.fst", "name": "Spec.Chacha20.Test.test" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.test_add" }, { "project_name": "hacl-star", "file_name": "Spec.Poly1305.Test.fst", "name": "Spec.Poly1305.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_mul_lt" }, { "project_name": "FStar", "file_name": "CalcTest.fst", "name": "CalcTest.test_ge" }, { "project_name": "FStar", "file_name": "MonadicLetBindings.fst", "name": "MonadicLetBindings.applicative_eq" }, { "project_name": "FStar", "file_name": "CalcTest.fst", "name": "CalcTest.test_gt" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_mul_eq" }, { "project_name": "hacl-star", "file_name": "Test.Hash.fst", "name": "Test.Hash.test_incremental_api" }, { "project_name": "FStar", "file_name": "Tests.fst", "name": "Tests.test2" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_add_eq'" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test9" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_add_lt" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_add_eq" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_sqrt_2_mul" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.test" }, { "project_name": "FStar", "file_name": "Example.fst", "name": "Example.main" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Logic.fst", "name": "FStar.Tactics.V1.Logic.forall_intros" }, { "project_name": "hacl-star", "file_name": "Spec.Curve25519.Test.fst", "name": "Spec.Curve25519.Test.test" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le1" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonMonoid.fst", "name": "FStar.Tactics.CanonMonoid.lem0" }, { "project_name": "FStar", "file_name": "FStar.DM4F.MonadLaws.fst", "name": "FStar.DM4F.MonadLaws.right_unit_st" }, { "project_name": "hacl-star", "file_name": "Spec.SecretBox.Test.fst", "name": "Spec.SecretBox.Test.test" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.x2" }, { "project_name": "hacl-star", "file_name": "Vale.Test.TestInline.fst", "name": "Vale.Test.TestInline.test_inline" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.lem1" }, { "project_name": "FStar", "file_name": "Pruning.fst", "name": "Pruning.tau2" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_ge2" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_le3" }, { "project_name": "FStar", "file_name": "Unification.fst", "name": "Unification.test" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.lem0" }, { "project_name": "FStar", "file_name": "FStar.Real.fsti", "name": "FStar.Real.test_lt1" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.lem0" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test_dep_f" }, { "project_name": "FStar", "file_name": "StatefulLens.fst", "name": "StatefulLens.test3" }, { "project_name": "steel", "file_name": "PulseLambdas.fst", "name": "PulseLambdas.ss" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Tutorial.fst", "name": "FStar.InteractiveHelpers.Tutorial.ut_ex2" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.Test.fst", "name": "Spec.SHA3.Test.test" }, { "project_name": "steel", "file_name": "HaclExample.fst", "name": "HaclExample.test_alloc_free" }, { "project_name": "steel", "file_name": "HaclExample2.fst", "name": "HaclExample2.test_alloc_free" }, { "project_name": "FStar", "file_name": "GC.fst", "name": "GC.test2" }, { "project_name": "hacl-star", "file_name": "Spec.HKDF.Test.fst", "name": "Spec.HKDF.Test.test" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test3" } ], "selected_premises": [ "FStar.FunctionalExtensionality.feq", "FStar.Tactics.Effect.raise", "MonadFunctorInference.get", "FStar.FunctionalExtensionality.on_dom", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Pervasives.reveal_opaque", "FStar.Tactics.Types.issues", "MonadFunctorInference.put", "FStar.Tactics.Effect.get", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.FunctionalExtensionality.on", "MonadFunctorInference.get_inc", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "MonadFunctorInference.st_monad", "MonadFunctorInference.st", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.FunctionalExtensionality.restricted_t", "FStar.Issue.mk_issue", "FStar.FunctionalExtensionality.arrow", "FStar.Tactics.Effect.tactic", "FStar.FunctionalExtensionality.is_restricted", "FStar.Issue.issue_level_string", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Pervasives.id", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Tactics.Typeclasses.solve", "FStar.FunctionalExtensionality.feq_g", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Pervasives.st_post_h", "FStar.FunctionalExtensionality.on_dom_g", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.Tactics.Effect.tac", "FStar.FunctionalExtensionality.efun", "FStar.Pervasives.ex_pre", "FStar.FunctionalExtensionality.on_g", "FStar.FunctionalExtensionality.efun_g", "FStar.Monotonic.Pure.is_monotonic", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_bind_wp", "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.is_restricted_g", "FStar.Pervasives.st_pre_h", "Prims.min", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.coerce_eq", "FStar.Pervasives.all_post_h", "FStar.Pervasives.ex_stronger", "FStar.Tactics.Effect.tac_if_then_else_wp", "FStar.Tactics.Effect.tac_wp_monotonic", "FStar.Pervasives.ex_post", "FStar.Tactics.Effect.lift_div_tac", "FStar.Pervasives.st_return", "Prims.__cache_version_number__", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.ex_post'", "FStar.Tactics.Effect.tac_repr", "Prims.pure_stronger", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Monotonic.Pure.elim_pure", "Prims.abs", "FStar.Tactics.Effect.tac_bind_wp", "FStar.Pervasives.st_ite_wp", "Prims.returnM", "FStar.Pervasives.st_close_wp", "Prims.l_True", "FStar.Pervasives.pure_ite_wp", "FStar.Tactics.Effect.tac_close", "FStar.Tactics.Effect.tac_return", "FStar.Pervasives.all_stronger", "FStar.Tactics.Effect.lift_div_tac_wp", "Prims.subtype_of", "Prims.pure_post", "Prims.pure_post'", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.st_trivial", "FStar.Pervasives.pure_close_wp", "Prims.op_Hat", "Prims.pure_wp'", "FStar.Pervasives.trivial_pure_post", "Prims.pow2", "FStar.Pervasives.st_wp_h", "Prims.pure_trivial", "FStar.Pervasives.ex_wp", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.pure_null_wp", "Prims.pure_wp_monotonic0", "Prims.pure_wp_monotonic", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.div_hoare_to_wp", "Prims.as_requires", "FStar.Tactics.Effect.tac_return_wp", "FStar.Pervasives.ex_return", "FStar.Pervasives.ex_trivial", "Prims.purewp_id" ], "source_upto_this": "module MonadFunctorInference\n\n//SNIPPET_START: monad$\nclass monad (m:Type -> Type) =\n{\n return : (#a:Type -> a -> m a);\n bind : (#a:Type -> #b:Type -> (f:m a) -> (g:(a -> m b)) -> m b);\n}\n//SNIPPET_END: monad$\n\n//SNIPPET_START: st$\nlet st (s:Type) (a:Type) = s -> a & s\n\ninstance st_monad s : monad (st s) =\n{\n return = (fun #a (x:a) -> (fun s -> x, s));\n bind = (fun #a #b (f: st s a) (g: a -> st s b) (s0:s) ->\n let x, s1 = f s0 in\n g x s1);\n}\n//SNIPPET_END: st$\n\n//SNIPPET_START: get_inc$\nlet get #s\n : st s s\n = fun s -> s, s\n\nlet put #s (x:s)\n : st s unit\n = fun _ -> (), x\n\nlet get_inc =\n x <-- get;\n return (x + 1)\n//SNIPPET_END: get_inc$\n" }, { "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.id", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "open": "OPLSS2021" }, { "open": "OPLSS2021" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val id (#a: Type) (x: a) : a", "source_definition": "let id (#a:Type) (x:a) : a = x", "source_range": { "start_line": 54, "start_col": 0, "end_line": 54, "end_col": 30 }, "interleaved": false, "definition": "fun x -> x <: a", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "x: a -> a", "prompt": "let id (#a: Type) (x: a) : a =\n ", "expected_response": "x", "source": { "project_name": "FStar", "file_name": "examples/oplss2021/OPLSS2021.Basic.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS2021.Basic.fst", "checked_file": "dataset/OPLSS2021.Basic.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Printf.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [ "", "let nat = x:int{ x >= 0 }", "let rec factorial (n:nat)\n : nat\n = if n = 0 then 1 else n * factorial (n - 1)", "let rec factorial_increasing (n:nat)\n : _:unit{factorial n >= n}\n = if n <= 2 then ()\n else factorial_increasing (n - 1)", "let rec factorial_increasing_lemma (n:nat)\n : Lemma (factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma (n - 1)", "let rec factorial_increasing_lemma' (n:int)\n : Lemma \n (requires n >= 0)\n (ensures factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma' (n - 1)" ], "closest": [ "val id (#a: Type) (x: a) : a\nlet id (#a: Type) (x: a) : a = x", "val id (#a: Type0) (x: a) : a\nlet id (#a:Type0) (x:a) : a = x", "val typed_id (a: _) (x: a) : a\nlet typed_id a (x:a): a = x", "val id (#t: Type) (x: t) : Tot t\nlet id (#t: Type) (x: t) : Tot t = x", "val id (#t: Type) (x: t) : Tot t\nlet id\n (#t: Type)\n (x: t)\n: Tot t\n= x", "val return_id (a: Type) (x: a) : id a\nlet return_id (a:Type) (x:a) : id a = fun () -> x", "val return (#a: Type) (x: a) : st a\nlet return (#a:Type) (x:a) :st a =\n fun s -> x, s", "val return (#a: Type) (x: a) : st a\nlet return (#a:Type) (x:a) : st a =\n fun s -> (x, s)", "val m (a : Type u#a) : Type u#a\nlet m a = list a", "val t (a:Type0) : Type0\nlet t a = list a", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val as_t (#a: Type) (x: normal a) : a\nlet as_t (#a:Type) (x:normal a) : a = x", "val bind_id (a b: Type) (x: id a) (f: (a -> id b)) : id b\nlet bind_id (a:Type) (b:Type) (x:id a) (f:(a -> id b)) : id b =\n fun () ->\n let x = x () in\n f x ()", "val return (#a: Type) (x: a) : protocol a\nlet return (#a:Type) (x:a) : protocol a = Return x", "val return (#a: Type) (x: a) : possibly a\nlet return (#a:Type) (x:a) : possibly a =\n Ok x", "val normal (#a: Type) (x: a) : a\nlet normal (#a:Type) (x:a) : a = norm [zeta; iota; delta_attr [`%instr_attr]] x", "val normal (#a: Type) (x: a) : a\nlet normal (#a:Type) (x:a) : a =\n FStar.Pervasives.norm\n [iota;\n zeta;\n delta_attr [`%__reduce__; `%BigOps.__reduce__];\n delta_only [`%Base?; `%Array?; `%Some?; `%Some?.v; `%list_of_string];\n primops;\n simplify]\n x", "val normal (#a: Type) (x: a) : a\nlet normal (#a:Type) (x:a) : a =\n FStar.Pervasives.norm\n [iota;\n zeta;\n delta_attr [`%__printf_reduce__; `%BigOps.__reduce__];\n delta_only [`%Base?; `%Array?; `%Some?; `%Some?.v; `%list_of_string];\n primops;\n simplify]\n x", "val normal (#a: Type) (x: a) : a\nlet normal (#a:Type) (x:a) : a =\n FStar.Pervasives.norm\n [iota;\n zeta;\n delta_attr [`%__reduce__; `%BigOps.__reduce__];\n delta_only [`%TD_Buffer?;\n `%BS.Mkmachine_state?.ms_ok;\n `%BS.Mkmachine_state?.ms_regs;\n `%BS.Mkmachine_state?.ms_flags;\n `%BS.Mkmachine_state?.ms_heap;\n `%BS.Mkmachine_state?.ms_stack;\n `%BS.Mkmachine_state?.ms_stackTaint;\n `%BS.Mkmachine_state?.ms_trace;\n `%FStar.FunctionalExtensionality.on_dom;\n `%FStar.FunctionalExtensionality.on;\n `%List.Tot.fold_right_gtot;\n `%List.Tot.map_gtot;\n `%List.Tot.length;\n `%fst;\n `%snd;\n `%Mktuple2?._1;\n `%Mktuple2?._2\n ];\n primops;\n simplify]\n x", "val normal (#a: Type) (x: a) : a\nlet normal (#a: Type) (x: a) : a =\n FStar.Pervasives.norm [\n iota;\n zeta;\n delta_only [`%L.fold_right_gtot; `%L.map_gtot];\n delta_attr [`%__reduce__];\n primops;\n simplify\n ]\n x", "val t : a:Type u#a -> Type u#a\nlet t a = list a", "val return (#a: Type) (x: a) : erased a\nlet return (#a: Type) (x: a) : erased a = hide x", "val Intro.id = x: a -> a\nlet id (#a:Type) (x:a) = x", "val poly_id (#a: Type) (x: int{x >= 0}) (r: a) : a\nlet poly_id (#a:Type) (x:int{x >= 0}) (r:a) : a =\n let rec countdown (y:nat) =\n if y=0 then r\n else countdown (y - 1)\n in\n countdown x", "val length (#a: Type) (x: t a) : nat\nlet length (#a:Type) (x:t a) : nat = U32.v (len x)", "val add : #a:Type -> x:a -> m:t a -> t a\nlet add #a x m = x :: m", "val p (x: Type u#1) : Type u#0\nlet p (x : Type u#1) : Type u#0 =\n exists a. i a == x /\\ ~(a x)", "val p (x: Type u#1) : Type u#0\nlet p (x : Type u#1) : Type u#0 =\n exists a. pa x a", "val return (a: Type) (x: a) : repr a\nlet return (a : Type) (x : a) : repr a =\n fun () -> x", "val alloc (#a:Type) (x:a)\n : stt (ref a) emp (fun r -> pts_to r x)\nlet alloc = alloc'", "val alloc (#a:Type) (x:a)\n : stt (ref a) emp (fun r -> pts_to r x)\nlet alloc = alloc'", "val put (s: Type) (x: s) : st s unit\nlet put (s:Type) (x:s) : st s unit = fun _ -> (), x", "val set (a: Type u#a) : Type u#a\nlet set (a: Type) : Tot Type = F.restricted_g_t a (fun _ -> bool)", "val return (a: Type) (x: a) : repr a ()\nlet return (a:Type) (x:a)\n: repr a ()\n= fun (t, n, s) -> (x, n, s)", "val contains (#a:Type) (s:seq a) (x:a) : Tot Type0\nlet contains #a s x =\n exists (k:nat). k < Seq.length s /\\ Seq.index s k == x", "val return (a: Type) (x: a) : repr a []\nlet return (a:Type) (x:a)\n : repr a []\n =\n fun () -> x", "val return (a: Type) (x: a) : repr a []\nlet return (a:Type) (x:a)\n : repr a [] =\n fun s0 -> (Some x, s0)", "val return (a: Type) (x: a) : tree a []\nlet return (a:Type) (x:a)\n : tree a []\n = Return x", "val return (a: Type) (x: a) : tree a []\nlet return (a:Type) (x:a)\n : tree a []\n = Return x", "val refl (#a: Type) (x: a) : (x == x)\nlet refl (#a:Type) (x:a) : (x==x) = FStar.Squash.return_squash Refl", "val ( exists* ) (#a:Type) (p:a -> vprop) : vprop\nlet op_exists_Star = op_exists_Star", "val t:\n a:Type u#a\n -> Type u#a\nlet t a = (l:len_t & raw a l)", "val f (a: Type) : s (s (s (s (s (s (s (s z)))))))\nlet f (a:Type) : s (s (s (s (s (s (s (s z))))))) = x", "val v (a: Type0) : Tot Type0\nlet v (a: Type0) = list a", "val height (#a: Type) (x: tree a) : nat\nlet rec height (#a: Type) (x: tree a) : nat =\n match x with\n | Leaf -> 0\n | Node data left right ->\n if height left > height right then (height left) + 1\n else (height right) + 1", "val idk (#frame: vprop) (#a: Type) (x: a) : SteelT a frame (fun x -> frame)\nlet idk (#frame:vprop) (#a:Type) (x:a) : SteelT a frame (fun x -> frame)\n = noop(); return x", "val v (#a:Type0) (x : t a) : G.erased (list a)\nlet v x = G.hide x", "val return (a: Type) (x: a) (s: _) : st a s\nlet return (a:Type) (x:a) s\n : st a s\n = fun s -> x, s", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val coerce (#b #a: Type) (x: a{a == b}) : b\nlet coerce (#b #a:Type) (x:a{a == b}) : b = x", "val ambient (#a: Type) (x: a) : Type0\nlet ambient #_ _ = True", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc_pt x) in\n r", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc x) in\n r", "val ch : Type u#1\nlet ch : Type u#1 = (p:dprot & channel p)", "val ( .() ) (#a: Type) (x: t a) (i: index_t (as_raw x)) : Tot a\nlet op_Array_Access\n (#a:Type)\n (x:t a)\n (i:index_t (as_raw x))\n : Tot a\n = (as_raw x).[i]", "val id_lens (#a: _) : lens a a\nlet id_lens #a : lens a a = {\n get= (fun x -> x);\n put= (fun x s -> x);\n lens_laws = ()\n}", "val t (a: Type0) : Tot Type0\nlet t a = cllist_lvalue a", "val with_norm (#a: Type) (x: a) : (y: a{y == x})\nlet with_norm (#a : Type) (x : a) : (y:a{y==x}) =\n normalize_term x", "val raise_val : #a:Type u#a -> x:a -> raise_t u#a u#b a\nlet raise_val #a x = Ret x", "val ref (a:Type0) : Type0\nlet ref (a:Type) = nat", "val const (#a: Type) (xa: a) : amap a\nlet const (#a:Type) (xa:a) : amap a = ([], xa)", "val const (#a: Type) (xa: a) : amap a\nlet const (#a:Type) (xa:a) : amap a = ([], xa)", "val const (#a: Type) (xa: a) : amap a\nlet const (#a:Type) (xa:a) : amap a = ([], xa)", "val m (a: Type u#aa) (i: idx) : Type u#aa\nlet m (a:Type u#aa) (i:idx) : Type u#aa =\n match i with\n | T -> unit -> Tot a\n | G -> unit -> GTot a\n | D -> raise_t (unit -> Dv a)", "val set (a:Type u#a) : Type u#(max 1 a)\nlet set a = F.restricted_t a (fun _ -> prop)", "val length (#a:Type0) (x:t a) : GTot nat\nlet length x = L.length x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x", "val as_normal_t (#a: Type) (x: a) : normal a\nlet as_normal_t (#a:Type) (x:a) : normal a = x" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.id" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.id" }, { "project_name": "steel", "file_name": "Domains.fst", "name": "Domains.typed_id" }, { "project_name": "everparse", "file_name": "EverParse3d.Prelude.fsti", "name": "EverParse3d.Prelude.id" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BitSum.fst", "name": "LowParse.Spec.BitSum.id" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Id.fst", "name": "FStar.DM4F.Id.return_id" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Semantics_s.fst", "name": "Vale.PPC64LE.Semantics_s.return" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Machine_Semantics_s.fst", "name": "Vale.X64.Machine_Semantics_s.return" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.m" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMdecryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMdecryptOpt.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Aes.fsti", "name": "Vale.Stdcalls.X64.Aes.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMencryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMencryptOpt.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCM_IV.fst", "name": "Vale.Stdcalls.X64.GCM_IV.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Cpuid.fsti", "name": "Vale.Stdcalls.X64.Cpuid.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fswap.fsti", "name": "Vale.Stdcalls.X64.Fswap.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.as_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.as_t" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Id.fst", "name": "FStar.DM4F.Id.bind_id" }, { "project_name": "steel", "file_name": "Steel.Channel.Protocol.fst", "name": "Steel.Channel.Protocol.return" }, { "project_name": "hacl-star", "file_name": "Vale.Def.PossiblyMonad.fst", "name": "Vale.Def.PossiblyMonad.return" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Instruction_s.fsti", "name": "Vale.X64.Instruction_s.normal" }, { "project_name": "FStar", "file_name": "LowStar.Printf.fst", "name": "LowStar.Printf.normal" }, { "project_name": "steel", "file_name": "Steel.ST.Printf.fst", "name": "Steel.ST.Printf.normal" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.normal" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fsti", "name": "FStar.BigOps.normal" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.t" }, { "project_name": "FStar", "file_name": "FStar.Ghost.fsti", "name": "FStar.Ghost.return" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.id" }, { "project_name": "FStar", "file_name": "Simple.fst", "name": "Simple.poly_id" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.length" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.add" }, { "project_name": "FStar", "file_name": "InjectiveTypeFormers.SMT.fst", "name": "InjectiveTypeFormers.SMT.p" }, { "project_name": "FStar", "file_name": "InjectiveTypeFormers.Explicit.fst", "name": "InjectiveTypeFormers.Explicit.p" }, { "project_name": "FStar", "file_name": "DivAction.fst", "name": "DivAction.return" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.alloc" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.alloc" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ST.fst", "name": "FStar.DM4F.ST.put" }, { "project_name": "FStar", "file_name": "FStar.GSet.fst", "name": "FStar.GSet.set" }, { "project_name": "steel", "file_name": "MParIndex.fst", "name": "MParIndex.return" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.contains" }, { "project_name": "FStar", "file_name": "LatticeEff.fst", "name": "LatticeEff.return" }, { "project_name": "FStar", "file_name": "Lattice.fst", "name": "Lattice.return" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.return" }, { "project_name": "FStar", "file_name": "Alg.fst", "name": "Alg.return" }, { "project_name": "FStar", "file_name": "Rewrite.Monoid.fst", "name": "Rewrite.Monoid.refl" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.op_exists_Star" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fst", "name": "FStar.Vector.Base.t" }, { "project_name": "FStar", "file_name": "Big.fst", "name": "Big.f" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.v" }, { "project_name": "steel", "file_name": "Trees.fst", "name": "Trees.height" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.Unix.fst", "name": "Steel.Primitive.ForkJoin.Unix.idk" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.v" }, { "project_name": "FStar", "file_name": "OPLSS2021.BasicState.fst", "name": "OPLSS2021.BasicState.return" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.HeapLemmas.fsti", "name": "Vale.Arch.HeapLemmas.coerce" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.fst", "name": "Hacl.SHA2.Scalar32.coerce" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.Hash.fst", "name": "Spec.Agile.Hash.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory_Sems.fsti", "name": "Vale.PPC64LE.Memory_Sems.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory_Sems.fsti", "name": "Vale.X64.Memory_Sems.coerce" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Keccak.fst", "name": "Hacl.Streaming.Keccak.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Instruction_s.fsti", "name": "Vale.X64.Instruction_s.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.X64.MemoryAdapters.fsti", "name": "Vale.X64.MemoryAdapters.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.State.fsti", "name": "Vale.PPC64LE.State.coerce" }, { "project_name": "hacl-star", "file_name": "Vale.X64.StateLemmas.fsti", "name": "Vale.X64.StateLemmas.coerce" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fst", "name": "FStar.Pervasives.ambient" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.alloc" }, { "project_name": "steel", "file_name": "Duplex.PCM.fst", "name": "Duplex.PCM.ch" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.op_Array_Access" }, { "project_name": "FStar", "file_name": "LowStar.Lens.Buffer.fsti", "name": "LowStar.Lens.Buffer.id_lens" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.t" }, { "project_name": "noise-star", "file_name": "Meta.Noise.fsti", "name": "Meta.Noise.with_norm" }, { "project_name": "FStar", "file_name": "FStar.Universe.fst", "name": "FStar.Universe.raise_val" }, { "project_name": "FStar", "file_name": "NatHeap.fst", "name": "NatHeap.ref" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.const" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.const" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.const" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.m" }, { "project_name": "FStar", "file_name": "FStar.TSet.fst", "name": "FStar.TSet.set" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.length" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMdecryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMdecryptOpt.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCMencryptOpt.fst", "name": "Vale.Stdcalls.X64.GCMencryptOpt.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.as_normal_t" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.as_normal_t" } ], "selected_premises": [ "FStar.Printf.sprintf", "FStar.Printf.arg_type", "FStar.String.length", "FStar.Integers.within_bounds", "FStar.Heap.trivial_preorder", "FStar.Tactics.Effect.raise", "FStar.String.strlen", "OPLSS2021.Basic.nat", "FStar.ST.op_Bang", "FStar.UInt.size", "FStar.Integers.op_Less_Equals", "FStar.Pervasives.Native.fst", "FStar.Integers.op_Greater_Equals", "OPLSS2021.Basic.factorial", "FStar.Integers.op_Less", "FStar.Integers.op_Plus", "FStar.Integers.op_Percent", "FStar.Pervasives.Native.snd", "FStar.Integers.op_Greater", "FStar.Integers.op_Subtraction", "FStar.Integers.op_Slash", "FStar.Tactics.Types.issues", "FStar.Integers.fixed_width", "OPLSS2021.Basic.factorial_increasing", "FStar.Printf.dir_type", "FStar.ST.alloc", "FStar.Mul.op_Star", "FStar.Integers.nat", "FStar.Integers.width_of_sw", "FStar.Pervasives.reveal_opaque", "FStar.Integers.norm", "FStar.Printf.ext_sprintf", "OPLSS2021.Basic.factorial_increasing_lemma'", "FStar.Printf.string_of_dirs", "OPLSS2021.Basic.factorial_increasing_lemma", "FStar.Tactics.Effect.get", "FStar.Pervasives.dfst", "FStar.String.string_of_char", "FStar.Integers.nat_of_width", "FStar.Pervasives.dsnd", "FStar.Integers.op_Star", "FStar.Printf.string_of_arg", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Printf.parse_format", "FStar.Integers.nat_of_fixed_width", "FStar.Integers.u", "FStar.Printf.parse_format_string", "FStar.Integers.v", "FStar.All.op_Bar_Greater", "FStar.Int.size", "FStar.List.iter", "FStar.List.map", "FStar.Integers.k", "FStar.List.for_all", "FStar.Integers.int", "FStar.All.op_Less_Bar", "FStar.Issue.mk_issue", "FStar.List.fold_left", "FStar.Integers.within_bounds'", "FStar.Tactics.Effect.tactic", "FStar.Heap.trivial_rel", "FStar.String.concat_injective", "FStar.Monotonic.Heap.mref", "FStar.Integers.h", "FStar.Pervasives.id", "FStar.Preorder.preorder_rel", "FStar.Printf.no_extensions", "FStar.ST.contains_pred", "FStar.Int.op_At_Percent", "FStar.List.mapT", "FStar.Int32.n", "FStar.UInt32.n", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.UInt64.n", "FStar.Int64.n", "FStar.UInt.max_int", "FStar.BitVector.logor_vec", "FStar.Issue.issue_level_string", "FStar.Tactics.Effect.tac", "FStar.Math.Lemmas.pow2_plus", "FStar.String.index_list_of_string", "FStar.UInt.to_vec", "FStar.List.fold_right", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.UInt16.n", "FStar.Int16.n", "FStar.String.maxlen", "FStar.UInt8.n", "FStar.Int8.n", "FStar.Integers.op_Star_Question", "FStar.Int64.lt", "FStar.UInt32.lt", "FStar.Int32.lt", "FStar.Int8.lt", "FStar.Int128.lt", "FStar.UInt8.lt", "FStar.Int16.lt", "FStar.UInt16.lt", "FStar.UInt64.lt", "FStar.Integers.op_Star_Percent" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule OPLSS2021.Basic\nopen FStar.Mul\n\n/// A refinement type\nlet nat = x:int{ x >= 0 }\n\n/// A simple recursive function\nlet rec factorial (n:nat)\n : nat\n = if n = 0 then 1 else n * factorial (n - 1)\n\n/// A proof by induction about factorial\nlet rec factorial_increasing (n:nat)\n : _:unit{factorial n >= n}\n = if n <= 2 then ()\n else factorial_increasing (n - 1)\n\n/// Lemma is syntactic sugar\nlet rec factorial_increasing_lemma (n:nat)\n : Lemma (factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma (n - 1)\n\n/// More sugar for lemma\n#push-options \"--z3rlimit 20\"\nlet rec factorial_increasing_lemma' (n:int)\n : Lemma\n (requires n >= 0)\n (ensures factorial n >= n)\n = if n <= 2 then ()\n else factorial_increasing_lemma' (n - 1)\n#pop-options\n\n////////////////////////////////////////////////////////////////////////////////\n\n/// Polymorphic functions\n/// - #a is notation for an implicit argument\n/// a Type argument, in this case", "sketch": [ "The definition is for a polymorphic function called \"id\" that takes a type argument \"a\" and a value of type \"a\" as input, and returns the same value without any modification.\n\nStep 1: The \"id\" function takes a type argument and a value of that type, and returns the same value.\n\nStep 2: The \"id\" function implementation simply returns the input value without any modification.", "The definition is for a polymorphic function called \"id\" that takes a type argument and a value of that type, and returns the same value.\n\nStep 1: The \"id\" function takes a type argument and a value of that type, and returns the same value.\nStep 2: The \"id\" function is implemented by simply returning the input value.", "The definition is about a polymorphic function called \"id\" that takes a type argument and a value of that type, and returns the same value.\n\nStep 1: The \"id\" function is a polymorphic function that takes a type argument and a value of that type, and returns the same value.\n\nStep 2: The \"id\" function is implemented by simply returning the input value without any modification, as it is a polymorphic identity function.", "The definition is for a polymorphic function called \"id\" that takes a type argument \"a\" and a value of type \"a\", and returns the same value of type \"a\".", "The definition is for a polymorphic function called \"id\" that takes a type argument and a value of that type, and returns the same value.\n\nStep 1: The \"id\" function takes a type argument and a value of that type, and returns the same value.\nStep 2: The \"id\" function is implemented by simply returning the input value.", "The definition is for a polymorphic function called \"id\" that takes a type argument \"a\" and a value of type \"a\", and returns the same value of type \"a\".", "The definition is about a polymorphic function called \"id\" that takes a type argument and a value of that type, and returns the same value.\n\nStep 1: The \"id\" function is a polymorphic function that takes a type argument and a value of that type.\nStep 2: The \"id\" function simply returns the value it receives as an argument.", "The definition of the function \"id\" is about creating an identity function that takes a value of any type and returns the same value.\n\nStep 1: The \"id\" function takes a value of any type and returns the same value.\nStep 2: The \"id\" function is implemented by simply returning the input value.", "The definition is for a polymorphic function called \"id\" that takes a type argument \"a\" and a value of type \"a\", and returns the same value without any modification.", "The definition is for a polymorphic identity function that takes a type argument and a value of that type, and returns the same value.\n\nStep 1: The definition is a polymorphic identity function that takes a type argument and a value of that type.\nStep 2: The implementation simply returns the input value without any modification." ], "generated_solution": [ "let id (a: Type) (x: a) : a = x", "let id (a: Type) (x: a) : a = x", "let id (a: Type) (x: a) : a = x", "val id (a: Type) (x: a) : a", "let id (a: Type) (x: a) : a = x", "val id (a: Type) (x: a) : a", "let id (a: Type) (x: a) : a = x", "let id (a: Type) (x: a) : a = x", "let id (a: Type) (x: a) : a = x", "let id (a: Type) (x: a) : a = x" ] }, { "file_name": "Pulse.Lib.Trade.fst", "name": "Pulse.Lib.Trade.trade_elim_exists", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Pulse.Lib.InvList" }, { "open": "Pulse.Lib.Pervasives" }, { "open": "Pulse.Lib.Core" }, { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Pulse.Lib.InvList" }, { "open": "Pulse.Lib.Pervasives" }, { "open": "Pulse.Lib.Core" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop", "source_definition": "let trade_elim_exists (is:invlist) (hyp extra concl : vprop) : vprop =\n pure (squash (trade_elim_t is hyp extra concl))", "source_range": { "start_line": 27, "start_col": 0, "end_line": 28, "end_col": 49 }, "interleaved": false, "definition": "fun is hyp extra concl ->\n Pulse.Lib.Core.pure (Prims.squash (Pulse.Lib.Trade.trade_elim_t is hyp extra concl))\n <:\n Pulse.Lib.Core.vprop", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Lib.InvList.invlist", "Pulse.Lib.Core.vprop", "Pulse.Lib.Core.pure", "Prims.squash", "Pulse.Lib.Trade.trade_elim_t" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "\n is: Pulse.Lib.InvList.invlist ->\n hyp: Pulse.Lib.Core.vprop ->\n extra: Pulse.Lib.Core.vprop ->\n concl: Pulse.Lib.Core.vprop\n -> Pulse.Lib.Core.vprop", "prompt": "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n ", "expected_response": "pure (squash (trade_elim_t is hyp extra concl))", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/pledge/Pulse.Lib.Trade.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.Trade.fst", "checked_file": "dataset/Pulse.Lib.Trade.fst.checked", "interface_file": true, "dependencies": [ "dataset/Pulse.Lib.Pervasives.fst.checked", "dataset/Pulse.Lib.InvList.fsti.checked", "dataset/Pulse.Lib.Core.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.IndefiniteDescription.fsti.checked" ] }, "definitions_in_context": [ "let trade_elim_t is hyp extra concl : Type u#2 =\n unit -> stt_ghost unit (invlist_v is ** extra ** hyp) (fun _ -> invlist_v is ** concl)" ], "closest": [ "val should_elim_exists (v: vprop) : T.Tac bool\nlet should_elim_exists (v:vprop) : T.Tac bool =\n match v.t with\n | Tm_ExistsSL _ _ _ -> true\n | _ -> false", "val stick :\n (hyp : vprop) ->\n (concl : vprop) ->\n vprop\nlet stick (p q : vprop) =\n T.trade p q", "val stick :\n (hyp : vprop) ->\n (concl : vprop) ->\n vprop\nlet stick (p q:vprop)\n: vprop\n= exists* (v:vprop). ctx v ** pure (exists_implication (v ** p) q)", "val intro_implies\n (#opened: _)\n (hyp concl v: vprop)\n (f_elim: (opened': inames -> STGhostT unit opened' (v `star` hyp) (fun _ -> concl)))\n : STGhostT unit opened v (fun _ -> ( @==> ) hyp concl)\nlet intro_implies\n (#opened: _)\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: (\n (opened': inames) ->\n STGhostT unit opened'\n (v `star` hyp)\n (fun _ -> concl)\n ))\n: STGhostT unit opened\n v\n (fun _ -> (@==>) hyp concl)\n= intro_implies_gen hyp concl v f_elim", "val is_implies (is: inames) (hyp concl v: vprop) : GTot prop\nlet is_implies\n (is : inames)\n (hyp concl: vprop)\n (v: vprop)\n: GTot prop\n= squash (elim_implies_t is hyp concl v)", "val collect_exists (g: env) (l: list vprop)\n : exs: list vprop &\n rest: list vprop &\n vprop_equiv g (list_as_vprop l) (list_as_vprop (exs @ rest))\nlet rec collect_exists (g:env) (l:list vprop)\n : exs:list vprop &\n rest:list vprop &\n vprop_equiv g (list_as_vprop l) (list_as_vprop (exs @ rest)) =\n \n match l with\n | [] -> (| [], [], VE_Refl _ _ |)\n | hd::tl ->\n let (| exs, rest, _ |) = collect_exists g tl in\n match hd.t with\n | Tm_ExistsSL _ _ _ ->\n (| hd::exs, rest, RU.magic #(vprop_equiv _ _ _) () |)\n | _ -> (| exs, hd::rest, RU.magic #(vprop_equiv _ _ _) () |)", "val invlist_v (is: invlist) : vprop\nlet rec invlist_v (is : invlist) : vprop =\n match is with\n | [] -> emp\n | i :: is -> dfst i ** invlist_v is", "val elim_implies (#opened: _) (hyp concl: vprop)\n : STGhostT unit opened ((implies_ hyp concl) `star` hyp) (fun _ -> concl)\nlet elim_implies\n (#opened: _)\n (hyp concl: vprop)\n: STGhostT unit opened\n ((implies_ hyp concl) `star` hyp)\n (fun _ -> concl)\n= elim_implies_gen hyp concl", "val tele_p (x: gen_elim_tele) : Tot vprop\nlet rec tele_p (x: gen_elim_tele) : Tot vprop =\n match x with\n | TRet v p -> v `star` pure p\n | TExists ty body -> exists_ (fun x -> tele_p (body x))", "val tele_p (x: gen_elim_tele) : Tot vprop\nlet rec tele_p (x: gen_elim_tele) : Tot vprop =\n match x with\n | TRet v p -> v `star` pure p\n | TExists ty body -> exists_ (fun x -> tele_p (body x))", "val id_elim_exists (#a:Type) (p : a -> slprop) (h:heap)\n : Pure (erased a)\n (requires (interp (h_exists p) h))\n (ensures (fun x -> interp (p x) h))\nlet id_elim_exists #a p m =\n let existsprop (x:a) = interp (p x) m in\n elim_h_exists p m;\n let x = IndefiniteDescription.indefinite_description_tot _ existsprop in\n x", "val id_elim_exists (#a:Type) (p : a -> slprop) (h:heap)\n : Pure (erased a)\n (requires (interp (h_exists p) h))\n (ensures (fun x -> interp (p x) h))\nlet id_elim_exists #a p m =\n let existsprop (x:a) = interp (p x) m in\n elim_h_exists p m;\n let x = IndefiniteDescription.indefinite_description_tot _ existsprop in\n x", "val implies_fold\n (#opened: _)\n (#is: inames)\n (hyp concl v: vprop)\n (f_elim: elim_implies_t is hyp concl v)\n : STGhostT unit opened v (fun _ -> ( @==> ) #is hyp concl)\nlet implies_fold\n (#opened: _)\n (#is : inames)\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: elim_implies_t is hyp concl v)\n: STGhostT unit opened\n v\n (fun _ -> (@==>) #is hyp concl)\n= intro_pure (squash (elim_implies_t is hyp concl v));\n intro_exists v (fun v -> v `star` pure (squash (elim_implies_t is hyp concl v)))", "val h_exists (#a: _) (p: (a -> vprop)) : vprop\nlet h_exists #a (p:a -> vprop) : vprop = to_vprop (h_exists_sl p)", "val intro_implies_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is : inames)\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: (\n (opened': inames {opened' /! is}) ->\n STGhostT unit opened'\n (v `star` hyp)\n (fun _ -> concl)\n ))\n: STGhostT unit opened\n v\n (fun _ -> (@==>) #is hyp concl)\nlet intro_implies_gen #opened #is = implies_fold #opened #is", "val implies_\n (#[T.exact (`(hide Set.empty))] is : inames) // Empty inames by default\n (hyp concl: vprop)\n: Tot vprop\nlet implies_\n (#is : inames)\n (hyp concl: vprop)\n: Tot vprop\n= exists_ (fun (v: vprop) ->\n v `star` pure (is_implies is hyp concl v)\n )", "val elim_exists (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt')\nlet elim_exists (#g:env) (#ctxt:term)\n (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt') =\n\n let ctxt_emp_typing : tot_typing g (tm_star ctxt tm_emp) tm_vprop = RU.magic () in\n let (| g', ctxt', ctxt'_emp_typing, k |) =\n elim_exists_frame ctxt_emp_typing (mk_env (fstar_env g)) in\n let k = k_elab_equiv k (VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _))\n (VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)) in\n (| g', ctxt', star_typing_inversion_l ctxt'_emp_typing, k |)", "val implies_unfold (#opened: _) (#is: inames) (hyp concl: vprop)\n : STGhost vprop\n opened\n (( @==> ) #is hyp concl)\n (fun v -> v)\n True\n (fun v -> is_implies is hyp concl v)\nlet implies_unfold\n (#opened: _)\n (#is : inames)\n (hyp concl: vprop)\n: STGhost vprop opened\n ((@==>) #is hyp concl)\n (fun v -> v)\n True\n (fun v -> is_implies is hyp concl v)\n= let v = elim_exists () in\n let _ = elim_pure _ in\n v", "val elim_implies_gen\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is : inames{opened /! is})\n (hyp concl: vprop)\n: STGhostT unit opened\n ((implies_ #is hyp concl) `star` hyp)\n (fun _ -> concl)\nlet elim_implies_gen\n (#opened: _)\n (#is : inames{opened /! is})\n (hyp concl: vprop)\n: STGhostT unit opened\n (((@==>) #is hyp concl) `star` hyp)\n (fun _ -> concl)\n= let v = implies_unfold hyp concl in\n implies_apply #opened #is v hyp concl", "val id_elim_exists (#a:Type) (p : a -> slprop) (m:mem)\n : Pure (erased a)\n (requires (interp (h_exists p) m))\n (ensures (fun x -> interp (p x) m))\nlet id_elim_exists #a p m =\n let existsprop (x:a) =\n interp (p x) m\n in\n elim_h_exists p m;\n let x = IndefiniteDescription.indefinite_description_tot _ existsprop in\n x", "val elim_exists (#a:Type) (p:a -> vprop)\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p (reveal x))\nlet elim_exists #a p = A.elim_exists p", "val exists_ (#a:Type u#a) (p:a -> vprop) : vprop\nlet exists_ (#a:Type u#a) (p:a -> vprop)\n : vprop\n = SEA.h_exists p", "val elim_h_exists (#a:_) (p:a -> slprop) (m:mem)\n : Lemma (interp (h_exists p) m ==> (exists x. interp (p x) m))\nlet elim_h_exists (#a:_) (p:a -> slprop) (m:mem) = H.elim_h_exists p (heap_of_mem m)", "val elim_h_exists (#a:_) (p:a -> slprop) (m:mem)\n : Lemma (interp (h_exists p) m ==> (exists x. interp (p x) m))\nlet elim_h_exists (#a:_) (p:a -> slprop) (m:mem) = H.elim_h_exists p (heap_of_mem m)", "val exists_elim\n (goal #a: Type)\n (#p: (a -> Type))\n (_: squash (exists (x: a). p x))\n (_: (x: a{p x} -> GTot (squash goal)))\n : Lemma goal\nlet exists_elim goal #a #p have f =\n bind_squash #_\n #goal\n (join_squash have)\n (fun (| x , pf |) ->\n return_squash pf;\n f x)", "val elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (exists* x. p x) (fun x -> p x)\nlet elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (exists* x. p x) (fun x -> p x)\r\n= coerce_eq (exists_equiv #a #p) (elim_exists' #a p)", "val elim_exists_and_pure (#g:env) (#ctxt:vprop)\n (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt')\nlet elim_exists_and_pure (#g:env) (#ctxt:vprop)\n (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt') =\n \n let (| g1, ctxt1, d1, k1 |) = ElimExists.elim_exists ctxt_typing in\n let (| g2, ctxt2, d2, k2 |) = ElimPure.elim_pure d1 in\n (| g2, ctxt2, d2, k_elab_trans k1 k2 |)", "val elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\nlet elim_exists (#a:Type u#a) (p:a -> slprop)\r\n: stt_ghost (erased a) (exists* x. p x) (fun x -> p x)\r\n= Ghost.hide (A.elim_exists p)", "val pledge (is:invlist) (f:vprop) (v:vprop) : vprop\nlet pledge opens f v = (==>*) #opens f (f ** v)", "val exists_n (r: ref nat) : vprop\nlet exists_n (r:ref nat) : vprop = exists* n. pts_to r n", "val h_exists (#a:Type u#b) (f: (a -> slprop u#a)) : slprop u#a\nlet h_exists = H.h_exists", "val h_exists (#a:Type u#b) (f: (a -> slprop u#a)) : slprop u#a\nlet h_exists = H.h_exists", "val intro_stick\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: unit -> (\n stt_ghost unit\n (v ** hyp)\n (fun _ -> concl)\n ))\n: stt_ghost unit\n v\n (fun _ -> stick hyp concl)\nlet intro_stick p q v f =\n T.intro_trade p q v f", "val intro_stick\n (hyp concl: vprop)\n (v: vprop)\n (f_elim: unit -> (\n stt_ghost unit\n (v ** hyp)\n (fun _ -> concl)\n ))\n: stt_ghost unit\n v\n (fun _ -> stick hyp concl)\nlet intro_stick = __intro_stick", "val mk_elim_exists (u: R.universe) (a p: R.term) : R.term\nlet mk_elim_exists (u:R.universe) (a p:R.term) : R.term =\n let t = R.pack_ln (R.Tv_UInst (R.pack_fv elim_exists_lid) [u]) in\n let t = R.pack_ln (R.Tv_App t (a, R.Q_Implicit)) in\n R.pack_ln (R.Tv_App t (p, R.Q_Explicit))", "val implies_apply (#opened: _) (#is: inames{opened /! is}) (v hyp concl: vprop)\n : STGhost unit\n opened\n (v `star` hyp)\n (fun _ -> concl)\n (is_implies is hyp concl v)\n (fun _ -> True)\nlet implies_apply\n (#opened: _)\n (#is : inames{opened /! is})\n (v hyp concl: vprop)\n: STGhost unit opened\n (v `star` hyp)\n (fun _ -> concl)\n (is_implies is hyp concl v)\n (fun _ -> True)\n= let sq : squash (is_implies is hyp concl v) = () in\n let _ : squash (elim_implies_t is hyp concl v) = FStar.Squash.join_squash sq in\n let f : Ghost.erased (elim_implies_t is hyp concl v) = FStar.IndefiniteDescription.elim_squash #(elim_implies_t is hyp concl v) () in\n Ghost.reveal f _", "val tele_star_vprop_correct_exists\n (v: vprop)\n (p: prop)\n (ty: _)\n (body: (ty -> gen_elim_tele))\n (ih:\n (x: ty\n -> GTot\n (vprop_rewrite (((tele_p (body x)) `star` v) `star` (pure p))\n (tele_p (tele_star_vprop (body x) v p)))))\n : Tot\n (vprop_rewrite (((tele_p (TExists ty body)) `star` v) `star` (pure p))\n (tele_p (tele_star_vprop (TExists ty body) v p)))\nlet tele_star_vprop_correct_exists\n (v: vprop) (p: prop)\n (ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))\n: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))\n= fun _ ->\n rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));\n let x = elim_exists' () in\n ih x _;\n intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));\n rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)", "val tele_star_vprop_correct_exists\n (v: vprop)\n (p: prop)\n (ty: _)\n (body: (ty -> gen_elim_tele))\n (ih:\n (x: ty\n -> GTot\n (vprop_rewrite (((tele_p (body x)) `star` v) `star` (pure p))\n (tele_p (tele_star_vprop (body x) v p)))))\n : Tot\n (vprop_rewrite (((tele_p (TExists ty body)) `star` v) `star` (pure p))\n (tele_p (tele_star_vprop (TExists ty body) v p)))\nlet tele_star_vprop_correct_exists\n (v: vprop) (p: prop)\n (ty: _) (body: ty -> gen_elim_tele) (ih: (x: ty) -> GTot (vprop_rewrite (tele_p (body x) `star` v `star` pure p) (tele_p (tele_star_vprop (body x) v p))))\n: Tot (vprop_rewrite (tele_p (TExists ty body) `star` v `star` pure p) (tele_p (tele_star_vprop (TExists ty body) v p)))\n= fun _ ->\n rewrite_with_trefl (tele_p _) (exists_ (fun x -> tele_p (body x)));\n let x = elim_exists' () in\n ih x _;\n intro_exists x (fun x -> tele_p (tele_star_vprop (body x) v p));\n rewrite_with_trefl (exists_ (fun x -> tele_p (tele_star_vprop (body x) v p))) (tele_p _)", "val comp_elim_exists (u: universe) (t p: term) (x: nvar) : comp\nlet comp_elim_exists (u:universe) (t:term) (p:term) (x:nvar)\n : comp\n = C_STGhost {\n u=u;\n res=mk_erased u t;\n pre=tm_exists_sl u (as_binder t) p;\n post=elim_exists_post u t p x\n }", "val intro_h_exists (#a:_) (x:a) (p:a -> slprop) (m:mem)\n : Lemma (interp (p x) m ==> interp (h_exists p) m)\nlet intro_h_exists #a x p m = H.intro_h_exists x p (heap_of_mem m)", "val intro_h_exists (#a:_) (x:a) (p:a -> slprop) (m:mem)\n : Lemma (interp (p x) m ==> interp (h_exists p) m)\nlet intro_h_exists #a x p m = H.intro_h_exists x p (heap_of_mem m)", "val elim_exists (t: term) : Tac (binding & binding)\nlet elim_exists (t : term) : Tac (binding & binding) =\n apply_lemma (`(__elim_exists' (`#(t))));\n let x = intro () in\n let pf = intro () in\n (x, pf)", "val __elim_exists'\n (#t: _)\n (#pred: (t -> Type0))\n (#goal: _)\n (h: (exists x. pred x))\n (k: (x: t -> pred x -> squash goal))\n : squash goal\nlet __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))\n (k : (x:t -> pred x -> squash goal)) : squash goal =\n FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)", "val __elim_exists'\n (#t: _)\n (#pred: (t -> Type0))\n (#goal: _)\n (h: (exists x. pred x))\n (k: (x: t -> pred x -> squash goal))\n : squash goal\nlet __elim_exists' #t (#pred : t -> Type0) #goal (h : (exists x. pred x))\n (k : (x:t -> pred x -> squash goal)) : squash goal =\n FStar.Squash.bind_squash #(x:t & pred x) h (fun (|x, pf|) -> k x pf)", "val invlist_sub (is1 is2: invlist) : prop\nlet invlist_sub (is1 is2 : invlist) : prop =\n inames_subset (invlist_names is1) (invlist_names is2)", "val lock_inv (r: ref bool) (v: vprop) : vprop\nlet lock_inv (r:ref bool) (v:vprop) : vprop = exists_ (lock_inv_pred r v)", "val elim_exists' (#a: Type u#a) (p: (a -> slprop))\n : act (erased a) emp_inames (op_exists_Star p) (fun x -> p x)\nlet elim_exists' (#a:Type u#a) (p:a -> slprop)\r\n: act (erased a) emp_inames (op_exists_Star p) (fun x -> p x)\r\n= fun #ictx -> mem_action_as_action _ _ _ _ (witness_h_exists #ictx (F.on_dom a p))", "val mem_inv (#p: vprop) (u: inames) (i: inv p) : GTot bool\nlet mem_inv (#p:vprop) (u:inames) (i:inv p) : GTot bool =\n Set.mem (reveal (name i)) (reveal u)", "val tele_star_vprop (i: gen_elim_tele) (v: vprop) (p: prop) : Tot gen_elim_tele (decreases i)\nlet rec tele_star_vprop (i: gen_elim_tele) (v: vprop) (p: prop) : Tot gen_elim_tele (decreases i) =\n match i with\n | TRet v' p' -> TRet (v `star` v') (p /\\ p')\n | TExists ty f -> TExists ty (fun x -> tele_star_vprop (f x) v p)", "val lockinv (p: vprop) (r: ref bool) : vprop\nlet lockinv (p:vprop) (r:ref bool) : vprop =\n h_exists (fun b -> pts_to r full_perm b `star` (if b then emp else p))", "val gen_elim_nondep_p (ty: list (Type u#a))\n : Tot\n (\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) ->\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop)\n -> Tot vprop)\nlet rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =\n match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with\n | [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))\n | t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))", "val remove_inv (#p: vprop) (e: inames) (i: inv p) : inames\nlet remove_inv (#p:vprop) (e:inames) (i:inv p) : inames = Set.remove (name_of_inv i) e", "val mem_inv (#p: vprop) (e: inames) (i: inv p) : erased bool\nlet mem_inv (#p:vprop) (e:inames) (i:inv p) : erased bool = elift2 (fun e i -> Set.mem i e) e (name_of_inv i)", "val mem_inv (#p: vprop) (e: inames) (i: inv p) : erased bool\nlet mem_inv (#p:vprop) (e:inames) (i:inv p) : erased bool = mem_iname e (name_of_inv i)", "val inv_p (is: invlist) (f v1 v2: vprop) (r1 r2: GR.ref bool) : vprop\nlet inv_p (is:invlist) (f v1 v2 : vprop) (r1 r2 : GR.ref bool) : vprop =\n exists* b1 b2. inv_p' is f v1 v2 r1 r2 b1 b2", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij", "val elim_stick\n (hyp concl: vprop)\n: stt_ghost unit\n ((stick hyp concl) ** hyp)\n (fun _ -> concl)\nlet elim_stick = __elim_stick", "val elim_stick\n (hyp concl: vprop)\n: stt_ghost unit\n ((stick hyp concl) ** hyp)\n (fun _ -> concl)\nlet elim_stick p q =\n T.elim_trade_ghost p q", "val lock_inv_pred: r: ref bool -> v: vprop -> bool -> vprop\nlet lock_inv_pred (r:ref bool) (v:vprop) : bool -> vprop =\n fun b -> pts_to r full_perm b `star` (if b then v else emp)", "val witness_h_exists (#a:_) (p:a -> slprop)\n : action_with_frame (h_exists p) (erased a) (fun x -> p x)\nlet witness_h_exists #a p =\n fun frame h0 ->\n let w = FStar.IndefiniteDescription.indefinite_description_tot\n a\n (fun x -> interp (p x `star` frame) h0) in\n (| w, h0 |)", "val witness_h_exists (#a:_) (p:a -> slprop)\n : action_with_frame (h_exists p) (erased a) (fun x -> p x)\nlet witness_h_exists #a p =\n fun frame h0 ->\n let w = FStar.IndefiniteDescription.indefinite_description_tot\n a\n (fun x -> interp (p x `star` frame) h0) in\n (| w, h0 |)", "val intro_exists (#a:_) (p:a -> slprop) (x:erased a)\n : action_with_frame (p x) unit (fun _ -> h_exists p)\nlet intro_exists #a p x =\n fun frame h0 ->\n intro_h_exists (reveal x) p h0;\n (| (), h0 |)", "val elim_exists': #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit\n -> STGhostT (a) opened_invariants (exists_ p) (fun x -> p x)\nlet elim_exists' (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (a) opened_invariants\n (exists_ p)\n (fun x -> p x)\n= let gx = elim_exists () in\n let x = Ghost.reveal gx in\n rewrite (p gx) (p x);\n x", "val elim_exists': #a: Type -> #opened_invariants: _ -> #p: (a -> vprop) -> unit\n -> STGhostT (a) opened_invariants (exists_ p) (fun x -> p x)\nlet elim_exists' (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (a) opened_invariants\n (exists_ p)\n (fun x -> p x)\n= let gx = elim_exists () in\n let x = Ghost.reveal gx in\n rewrite (p gx) (p x);\n x", "val elim_exists (t: term) : Tac (binder & binder)\nlet elim_exists (t : term) : Tac (binder & binder) =\n apply_lemma (`(__elim_exists' (`#(t))));\n let x = intro () in\n let pf = intro () in\n (x, pf)", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij", "val inv (p: vprop) : Type0\nlet inv (p:vprop) : Type0 = Mem.inv (hp_of p)", "val acquire_loop_inv: p: vprop -> bool -> vprop\nlet acquire_loop_inv (p:vprop) : bool -> vprop =\n fun b -> if b then emp else p", "val gen_elim_nondep_p (ty: list Type0)\n : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot vprop)\nlet rec gen_elim_nondep_p (ty: list Type0) : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot vprop) =\n match ty as ty' returns curried_function_type ty' vprop -> curried_function_type ty' prop -> Tot vprop with\n | [] -> fun q post -> q `star` pure post\n | t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))", "val bind_pledge' (#is:invlist) (#f:vprop) (#v1:vprop) (#v2:vprop)\n (extra : vprop)\n (k : ustep is (extra ** v1) (pledge is f v2))\n : stt_ghost unit (pledge is f v1 ** extra) (fun () -> pledge is f v2)\nlet bind_pledge' = __bind_pledge'", "val elim_vprop_equiv (#p #q:_) (_:vprop_equiv p q) : squash (p == q)\nlet elim_vprop_equiv #p #q pf = slprop_equiv_elim p q", "val name_of_inv (#p: vprop) (i: inv p) : GTot iname\nlet name_of_inv (#p:vprop) (i:inv p) : GTot iname = Mem.name_of_inv i", "val elim_exists (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (Ghost.erased a) opened_invariants\n (exists_ p)\n (fun x -> p x)\nlet elim_exists #a #o #p _\n = coerce_ghost (fun _ -> SEA.witness_exists #a #o #p ())", "val intro_exists'' (#a: Type u#a) (p: (a -> slprop)) (x: erased a)\n : act unit emp_inames (p x) (thunk (exists* x. p x))\nlet intro_exists'' (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (thunk (exists* x. p x))\r\n= coerce_eq (exists_equiv #a #p) (intro_exists' #a p x)", "val compute_gen_elim_p (x: gen_elim_i) : Tot vprop\nlet rec compute_gen_elim_p\n (x: gen_elim_i)\n: Tot vprop\n= match x with\n | GEUnit i -> compute_gen_unit_elim_p i\n | GEStarL left right -> compute_gen_elim_p left `star` compute_gen_unit_elim_p right\n | GEStarR left right -> compute_gen_unit_elim_p left `star` compute_gen_elim_p right\n | GEStar left right -> compute_gen_elim_p left `star` compute_gen_elim_p right\n | GEExistsNoAbs #a p -> exists_ p\n | GEExistsUnit #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists #a body -> exists_ (fun x -> compute_gen_elim_p (body x))", "val compute_gen_elim_p (x: gen_elim_i) : Tot vprop\nlet rec compute_gen_elim_p\n (x: gen_elim_i)\n: Tot vprop\n= match x with\n | GEUnit i -> compute_gen_unit_elim_p i\n | GEStarL left right -> compute_gen_elim_p left `star` compute_gen_unit_elim_p right\n | GEStarR left right -> compute_gen_unit_elim_p left `star` compute_gen_elim_p right\n | GEStar left right -> compute_gen_elim_p left `star` compute_gen_elim_p right\n | GEExistsNoAbs0 #a p -> exists_ p\n | GEExistsUnit0 #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists0 #a body -> exists_ (fun x -> compute_gen_elim_p (body x))\n | GEExistsNoAbs1 #a p -> exists_ p\n | GEExistsUnit1 #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists1 #a body -> exists_ (fun x -> compute_gen_elim_p (body x))", "val vprop_equiv_trans (v0 v1 v2:vprop) (_:vprop_equiv v0 v1) (_:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\nlet vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p", "val adjoint_elim_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is: inames{opened /! is})\n (p q r: vprop)\n (f: (opened: inames{opened /! is} -> STGhostT unit opened p (fun _ -> ( @==> ) #is q r)))\n : STGhostT unit opened (p `star` q) (fun _ -> r)\nlet adjoint_elim_implies\n (#opened: _)\n (#[T.exact (`(hide Set.empty))] is : inames{opened /! is})\n (p q r: vprop)\n (f: (\n (opened: inames { opened /! is }) ->\n STGhostT unit opened\n p (fun _ -> (@==>) #is q r)\n ))\n: STGhostT unit opened\n (p `star` q)\n (fun _ -> r)\n= f _;\n elim_implies_gen #opened q r", "val exists_elim2\n (goal:Type) (#a:Type) (#b:(a -> Type)) (#p:(x:a -> b x -> Type))\n (_:squash (exists (x:a) (y:b x). p x y))\n (f:(x:a -> y:b x{p x y} -> GTot (squash goal)))\n : Lemma goal\nlet exists_elim2 goal #a #b #p _ f =\n let open FStar.Classical in\n exists_elim goal () (fun (x:a{exists (y:b x). p x y}) ->\n exists_elim goal () (fun (y:b x{p x y}) ->\n f x y))", "val add_inv (#p: vprop) (e: inames) (i: inv p) : inames\nlet add_inv (#p:vprop) (e:inames) (i:inv p) : inames = add_iname e (name_of_inv i)", "val add_inv (#p: vprop) (e: inames) (i: inv p) : inames\nlet add_inv (#p:vprop) (e:inames) (i:inv p) : inames =\n Set.union (Set.singleton (name_of_inv i)) (reveal e)", "val bind_pledge (#is:invlist) (#f:vprop) (#v1:vprop) (#v2:vprop)\n (extra : vprop)\n (k : ustep is (f ** extra ** v1) (f ** pledge is f v2))\n : stt_ghost unit (pledge is f v1 ** extra) (fun () -> pledge is f v2)\nlet bind_pledge #os #f #v1 #v2 extra k = __bind_pledge #os #f #v1 #v2 extra k", "val Pulse.Syntax.Builder.tm_elim_exists = p: Pulse.Syntax.Base.vprop -> Pulse.Syntax.Base.st_term'\nlet tm_elim_exists p = Tm_ElimExists { p }", "val lift_h_exists (#a:_) (p:a -> slprop)\n : action (h_exists p) unit\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\nlet lift_h_exists (#a:_) (p:a -> slprop)\n : action (h_exists p) unit\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\n = let g : refined_pre_action (h_exists p) unit (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\n = fun h ->\n let aux (x:a) (h:heap)\n : Lemma\n (requires interp (p x) h)\n (ensures interp (h_exists (U.lift_dom p)) h)\n [SMTPat (interp (p x) h)]\n = assert (interp (U.lift_dom p (U.raise_val x)) h)\n in\n (| (), h |)\n in\n refined_pre_action_as_action g", "val lift_h_exists (#a:_) (p:a -> slprop)\n : action (h_exists p) unit\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\nlet lift_h_exists (#a:_) (p:a -> slprop)\n : action (h_exists p) unit\n (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\n = let g : refined_pre_action (h_exists p) unit (fun _a -> h_exists #(U.raise_t a) (U.lift_dom p))\n = fun h ->\n let aux (x:a) (h:heap)\n : Lemma\n (requires interp (p x) h)\n (ensures interp (h_exists (U.lift_dom p)) h)\n [SMTPat (interp (p x) h)]\n = assert (interp (U.lift_dom p (U.raise_val x)) h)\n in\n (| (), h |)\n in\n refined_pre_action_as_action g", "val make_pledge (#is:invlist) (f:vprop) (v:vprop) (extra:vprop)\n ($k : ustep is (f ** extra) (f ** v))\n : stt_ghost unit extra (fun _ -> pledge f v)\nlet make_pledge #is f v extra k = __make_pledge #is f v extra k", "val make_pledge (is:invlist) (f:vprop) (v:vprop) (extra:vprop)\n ($k : ustep is (f ** extra) (f ** v))\n : stt_ghost unit extra (fun _ -> pledge is f v)\nlet make_pledge os f v extra k = __make_pledge os f v extra k", "val vprop_equiv_sym (v0 v1:vprop) (_:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\nlet vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p", "val vprop_list_equiv (g:env) (vp:term)\n : GTot (vprop_equiv g vp (canon_vprop vp))\nlet rec vprop_list_equiv (g:env)\n (vp:term)\n : GTot (vprop_equiv g vp (canon_vprop vp))\n (decreases vp)\n = match vp.t with\n | Tm_Emp -> VE_Refl _ _\n | Tm_Star vp0 vp1 ->\n let eq0 = vprop_list_equiv g vp0 in\n let eq1 = vprop_list_equiv g vp1 in \n let app_eq\n : vprop_equiv _ (canon_vprop vp) (tm_star (canon_vprop vp0) (canon_vprop vp1))\n = list_as_vprop_append g (vprop_as_list vp0) (vprop_as_list vp1)\n in\n let step\n : vprop_equiv _ vp (tm_star (canon_vprop vp0) (canon_vprop vp1))\n = VE_Ctxt _ _ _ _ _ eq0 eq1\n in\n VE_Trans _ _ _ _ step (VE_Sym _ _ _ app_eq)\n \n | _ -> \n VE_Refl _ _", "val compute_gen_elim_tele_correct_exists_no_abs (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n intro_exists x (fun x -> body x `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)", "val intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (fun _ -> exists* x. p x)\nlet intro_exists (#a:Type u#a) (p:a -> slprop) (x:erased a)\r\n: act unit emp_inames (p x) (fun _ -> exists* x. p x)\r\n= intro_exists'' p x", "val add_elims (#g:env) (#ctxt:term) (#frame:term)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (ctxt_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame))\nlet rec add_elims (#g:env) (#ctxt:term) (#frame:term)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (ctxt_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame))\n = let progress, res = add_elims_aux f mk ctxt_typing uvs in\n if not progress\n then res\n else (\n let (| g', ctxt', ctxt'_typing, k |) = res in\n let (| g'', ctxt'', ctxt''_typing, k' |) = add_elims f mk ctxt'_typing uvs in\n (| g'', ctxt'', ctxt''_typing, k_elab_trans k k' |)\n )", "val exists_equiv (#a:_)\n (p:a -> vprop)\n (q:a -> vprop {forall x. equiv (p x) (q x) })\n : Lemma (equiv (exists_ p) (exists_ q))\nlet exists_equiv #a p1 p2\n = SEA.exists_equiv p1 p2", "val lift_cond_exists_to_e_exists:\n inv: (bool -> vprop) ->\n cond: (unit -> STT bool (exists_ inv) (fun b -> inv b)) ->\n unit\n -> STT bool (exists_ (fun (b: erased bool) -> inv b)) (fun b -> inv b)\nlet lift_cond_exists_to_e_exists\n (inv: bool -> vprop)\n (cond: (unit -> STT bool\n (exists_ inv)\n (fun b -> inv b)))\n (_:unit)\n : STT bool\n (exists_ (fun (b:erased bool) -> inv b))\n (fun b -> inv b)\n = e_exists_to_exists inv;\n let b = cond () in\n b", "val compute_gen_elim_tele_correct_exists_no_abs1 (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs1\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n intro_exists x (fun x -> body x `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)", "val intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\nlet intro_forall\n (#a:Type)\n (#p:a->vprop)\n (v:vprop)\n (f_elim : (x:a -> stt_ghost unit v (fun _ -> p x)))\n: stt_ghost unit\n v\n (fun _ -> forall* x. p x)\n= let _ : squash (universal_quantifier v p) = FStar.Squash.return_squash f_elim in\n let m1\n : stt_ghost unit (emp ** v) (fun _ -> pure (is_forall v p) ** v) \n = frame_ghost v (intro_pure (is_forall v p) ()) in\n let m2 ()\n : stt_ghost unit\n (pure (is_forall v p) ** token v) \n (fun _ -> forall* x. p x)\n = intro_exists (fun (v:vprop) -> pure (is_forall v p) ** token v) v\n in\n let m = bind_ghost m1 m2 in\n sub_ghost v _\n (vprop_equiv_unit _)\n (intro_vprop_post_equiv _ _ (fun _ -> vprop_equiv_refl _))\n m", "val add_elims_aux\n (#g: env)\n (#ctxt #frame: term)\n (f: (vprop -> T.Tac bool))\n (mk: mk_t)\n (ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs: env{disjoint uvs g})\n : T.Tac\n (bool &\n (g': env{env_extends g' g /\\ disjoint uvs g'} &\n ctxt': term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\nlet add_elims_aux (#g:env) (#ctxt:term) (#frame:term)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (bool & \n (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\n = let (| ctxt', ctxt'_typing, k |) = canon_right ctxt_frame_typing f in\n let progress, (| g', ctxt'', ctxt''_typing, k' |) =\n elim_all f mk ctxt'_typing uvs in\n progress, (| g', ctxt'', ctxt''_typing, k_elab_trans k k' |)", "val exists_equiv (#a:_) (p:a -> vprop) (q:a -> vprop {forall x. equiv (p x) (q x) })\n : Lemma (h_exists p `equiv` h_exists q)\nlet exists_equiv p q =\n Classical.forall_intro_2 reveal_equiv;\n h_exists_cong (h_exists_sl' p) (h_exists_sl' q)", "val elim_all\n (#g: env)\n (f: (vprop -> T.Tac bool))\n (mk: mk_t)\n (#ctxt #frame: term)\n (ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs: env{disjoint uvs g})\n : T.Tac\n (bool &\n (g': env{env_extends g' g /\\ disjoint uvs g'} &\n ctxt': term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\nlet rec elim_all (#g:env)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (#ctxt:term) (#frame:term) (ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (bool & \n (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\n = match ctxt.t with\n | Tm_Star ctxt' p ->\n let p_typing =\n star_typing_inversion_r #_ #ctxt' #p (star_typing_inversion_l ctxt_frame_typing) in\n if f p\n then match mk #_ #p p_typing with\n | Some (| nx, e1, c1, e1_typing |) ->\n let (| g', _, ctxt_typing', k |) =\n elim_one ctxt' frame p (RU.magic ()) nx e1 c1 e1_typing uvs in\n let k\n : continuation_elaborator g (tm_star (tm_star ctxt' frame) p)\n g' (tm_star _ frame) = k in\n let k\n : continuation_elaborator g (tm_star (tm_star ctxt' p) frame)\n g' (tm_star _ frame) =\n k_elab_equiv k\n (RU.magic ()) (VE_Refl _ _) in\n let _, (| g'', ctxt'', ctxt_typing'', k' |) =\n elim_all #g' f mk ctxt_typing' uvs in\n true, (| g'', ctxt'', ctxt_typing'', k_elab_trans k k' |)\n | None ->\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)\n else begin\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)\n end\n | _ ->\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)", "val compute_gen_elim_tele_correct_exists_no_abs0 (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs0\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n rewrite (body x) (body (U.downgrade_val (U.raise_val x)));\n intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Checker.Prover.ElimExists.fst", "name": "Pulse.Checker.Prover.ElimExists.should_elim_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Stick.fst", "name": "Pulse.Lib.Stick.stick" }, { "project_name": "steel", "file_name": "Pulse.Lib.Priv.Trade0.fst", "name": "Pulse.Lib.Priv.Trade0.stick" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.intro_implies" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.is_implies" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.fst", "name": "Pulse.Checker.Prover.collect_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist_v" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.elim_implies" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.tele_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.tele_p" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.id_elim_exists" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.id_elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.implies_fold" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fsti", "name": "Steel.Effect.Atomic.h_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.intro_implies_gen" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.implies_" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.ElimExists.fst", "name": "Pulse.Checker.Prover.ElimExists.elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.implies_unfold" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.elim_implies_gen" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.id_elim_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.exists_" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.elim_h_exists" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.elim_h_exists" }, { "project_name": "FStar", "file_name": "FStar.Classical.fst", "name": "FStar.Classical.exists_elim" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.elim_exists" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.fst", "name": "Pulse.Checker.Prover.elim_exists_and_pure" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.elim_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.pledge" }, { "project_name": "steel", "file_name": "DependentTuples.fst", "name": "DependentTuples.exists_n" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.h_exists" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.h_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Stick.fst", "name": "Pulse.Lib.Stick.intro_stick" }, { "project_name": "steel", "file_name": "Pulse.Lib.Priv.Trade0.fst", "name": "Pulse.Lib.Priv.Trade0.intro_stick" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.implies_apply" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.tele_star_vprop_correct_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.tele_star_vprop_correct_exists" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.comp_elim_exists" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.intro_h_exists" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.intro_h_exists" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Logic.fst", "name": "FStar.Tactics.V2.Logic.elim_exists" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Logic.fst", "name": "FStar.Tactics.V1.Logic.__elim_exists'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Logic.fst", "name": "FStar.Tactics.V2.Logic.__elim_exists'" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fsti", "name": "Pulse.Lib.InvList.invlist_sub" }, { "project_name": "steel", "file_name": "Steel.ST.CancellableSpinLock.fst", "name": "Steel.ST.CancellableSpinLock.lock_inv" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.elim_exists'" }, { "project_name": "steel", "file_name": "Steel.DisposableInvariant.fsti", "name": "Steel.DisposableInvariant.mem_inv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fsti", "name": "Steel.ST.GenElim.Base.tele_star_vprop" }, { "project_name": "steel", "file_name": "Steel.SpinLock.fst", "name": "Steel.SpinLock.lockinv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_nondep_p" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fsti", "name": "Pulse.Lib.Core.remove_inv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.mem_inv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fsti", "name": "Pulse.Lib.Core.mem_inv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.inv_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop" }, { "project_name": "steel", "file_name": "Pulse.Lib.Priv.Trade0.fst", "name": "Pulse.Lib.Priv.Trade0.elim_stick" }, { "project_name": "steel", "file_name": "Pulse.Lib.Stick.fst", "name": "Pulse.Lib.Stick.elim_stick" }, { "project_name": "steel", "file_name": "Steel.ST.CancellableSpinLock.fst", "name": "Steel.ST.CancellableSpinLock.lock_inv_pred" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.witness_h_exists" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.witness_h_exists" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.intro_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.elim_exists'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.elim_exists'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Logic.fst", "name": "FStar.Tactics.V1.Logic.elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_prop" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.inv" }, { "project_name": "steel", "file_name": "Steel.ST.SpinLock.fst", "name": "Steel.ST.SpinLock.acquire_loop_inv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_nondep_p" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.bind_pledge'" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.elim_vprop_equiv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.name_of_inv" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.elim_exists" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.intro_exists''" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fsti", "name": "Steel.ST.GenElim.Base.compute_gen_elim_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_p" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_equiv_trans" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fsti", "name": "Steel.ST.Util.adjoint_elim_implies" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Meta.fst", "name": "Vale.Lib.Meta.exists_elim2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fsti", "name": "Pulse.Lib.Core.add_inv" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.add_inv" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.bind_pledge" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Builder.fst", "name": "Pulse.Syntax.Builder.tm_elim_exists" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.lift_h_exists" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.lift_h_exists" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.Simple.fst", "name": "Pulse.Lib.Par.Pledge.Simple.make_pledge" }, { "project_name": "steel", "file_name": "Pulse.Lib.Par.Pledge.fst", "name": "Pulse.Lib.Par.Pledge.make_pledge" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.vprop_equiv_sym" }, { "project_name": "steel", "file_name": "Pulse.Checker.VPropEquiv.fst", "name": "Pulse.Checker.VPropEquiv.vprop_list_equiv" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_tele_correct_exists_no_abs" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.intro_exists" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.add_elims" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.exists_equiv" }, { "project_name": "steel", "file_name": "Steel.ST.Loops.fst", "name": "Steel.ST.Loops.lift_cond_exists_to_e_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists_no_abs1" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.intro_forall" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.add_elims_aux" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.exists_equiv" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.elim_all" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists_no_abs0" } ], "selected_premises": [ "Pulse.Lib.Core.emp_inames", "Pulse.Lib.InvList.invlist_v", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Pervasives.perform", "Pulse.Lib.Reference.cond", "Pulse.Lib.Core.all_inames", "Pulse.Lib.Core.inames", "FStar.Real.one", "FStar.PCM.composable", "Pulse.Lib.InvList.invlist_elem", "FStar.PCM.compatible", "FStar.Real.two", "PulseCore.FractionalPermission.comp_perm", "FStar.PCM.op", "Pulse.Lib.Pervasives.vprop_equiv_norm", "FStar.UInt.size", "PulseCore.FractionalPermission.sum_perm", "Pulse.Lib.InvList.invlist0", "Pulse.Lib.Core.one_half", "Pulse.Lib.InvList.invlist_names", "FStar.Mul.op_Star", "Pulse.Lib.InvList.invlist", "FStar.Pervasives.reveal_opaque", "Pulse.Lib.InvList.invlist_empty", "Pulse.Lib.Pervasives.inames_join_self", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "Pulse.Lib.Pervasives.tfst", "Pulse.Lib.Core.unit_non_informative", "Pulse.Lib.InvList.invlist_nodups", "Pulse.Lib.Core.join_inames", "Pulse.Lib.Pervasives.default_arg", "Pulse.Lib.Pervasives.perform_ghost", "Pulse.Lib.Core.prop_non_informative", "Pulse.Lib.Core.add_iname", "PulseCore.FractionalPermission.writeable", "Pulse.Lib.Core.erased_non_informative", "Pulse.Lib.Core.add_inv", "Pulse.Lib.Core.inames_subset", "Pulse.Lib.Core.mem_inv", "FStar.Pervasives.dfst", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.FractionalPermission.half_perm", "Pulse.Lib.Pervasives.tthd", "FStar.Pervasives.dsnd", "Pulse.Lib.Pervasives.inames_ext", "Pulse.Lib.Core.squash_non_informative", "Pulse.Lib.InvList.invlist_sub", "Pulse.Lib.Core.mem_iname", "FStar.Real.zero", "Pulse.Lib.Core.remove_inv", "Pulse.Lib.InvList.add_one", "Pulse.Lib.Pervasives.tsnd", "FStar.Math.Lemmas.pow2_plus", "PulseCore.Observability.at_most_one_observable", "FStar.Math.Lib.max", "FStar.PCM.frame_compatible", "FStar.Pervasives.id", "FStar.Pervasives.st_post_h", "FStar.Math.Lib.div_non_eucl", "FStar.Math.Lib.min", "FStar.Preorder.preorder_rel", "FStar.Math.Lib.div_non_eucl_decr_lemma", "PulseCore.FractionalPermission.lesser_equal_perm", "FStar.UInt32.n_minus_one", "FStar.Pervasives.ex_pre", "FStar.Math.Lib.div", "FStar.UInt.sub", "FStar.Ghost.return", "FStar.UInt.shift_left", "FStar.Pervasives.st_pre_h", "FStar.Set.as_set", "FStar.UInt.shift_right", "FStar.Ghost.tot_to_gtot", "FStar.UInt.minus", "FStar.Real.test_le3", "FStar.Ghost.op_let_At", "FStar.Pervasives.all_post_h", "FStar.UInt.udiv", "FStar.UInt32.op_Greater_Equals_Hat", "FStar.Set.subset", "FStar.Real.test_ge1", "FStar.Math.Lib.powx", "FStar.Set.disjoint", "FStar.UInt.incr", "FStar.UInt32.minus", "FStar.Pervasives.all_post_h'", "FStar.UInt.one", "FStar.PCM.frame_preserving_val_to_fp_upd", "FStar.BitVector.lognot_vec", "FStar.Real.test_le2", "FStar.UInt.div", "FStar.Pervasives.st_post_h'", "FStar.UInt.one_extend", "FStar.Real.test_ge2", "FStar.Real.test_ge3", "FStar.Preorder.stable", "FStar.Ghost.bind", "FStar.Set.as_set'", "FStar.PCM.lem_commutative" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.Trade\n\nopen Pulse.Lib.Core\nopen Pulse.Lib.Pervasives\nopen Pulse.Lib.InvList\nmodule T = FStar.Tactics\n\nlet trade_elim_t is hyp extra concl : Type u#2 =\n unit -> stt_ghost unit (invlist_v is ** extra ** hyp) (fun _ -> invlist_v is ** concl)\n", "sketch": [ "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop by applying the `trade_elim_t` function to eliminate the trade.\n\nStep 1: We need to apply the `trade_elim_t` function to eliminate the trade.\nStep 2: We will call the `trade_elim_t` function with appropriate arguments to achieve the elimination and construct the new vprop.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to produce a new vprop that represents the existence of a trade elimination.\n\nStep 1: We will use the `trade_elim_t` function to create a trade elimination by combining the invariant list, extra information, hypothesis, and conclusion.\n\nStep 2: We will call the `trade_elim_t` function with the provided inputs to generate the vprop representing the existence of a trade elimination.", "The `trade_elim_exists` function takes an invariant list `is` and three vprops `hyp`, `extra`, and `concl` as input. It returns a vprop that represents the existence of a trade elimination.\n\nStep 1: We need to define a vprop that represents the existence of a trade elimination.\n\nStep 2: We can implement the `trade_elim_exists` function by using the `trade_elim_t` function and combining it with the input vprops to represent the existence of a trade elimination.", "The `trade_elim_exists` function takes an invariant list `is`, hypotheses `hyp`, extra information `extra`, and a conclusion `concl` as input. It returns a new vprop that represents the existence of a trade elimination.\n\nStep 1: The `trade_elim_exists` function creates a new vprop that represents the existence of a trade elimination.\n\nStep 2: To implement the `trade_elim_exists` function, we will use the `trade_elim_t` function to define the new vprop by combining the invariant list, extra information, and conclusion.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop representing the existence of a trade elimination.\n\nStep 1: We need to create a new vprop that represents the existence of a trade elimination.\nStep 2: We can achieve this by using the `trade_elim_t` function and providing it with the appropriate inputs to construct the vprop representing the trade elimination existence.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop by applying the `trade_elim_t` function to eliminate the trade.\n\nStep 1: We need to apply the `trade_elim_t` function to eliminate the trade.\nStep 2: Construct a new vprop by applying the `trade_elim_t` function to the input parameters.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop by applying the `trade_elim_t` function to eliminate the trade.\n\nStep 1: We want to create a new vprop by eliminating the trade using the `trade_elim_t` function.\n\nStep 2: We will call the `trade_elim_t` function with the provided inputs to eliminate the trade and construct the new vprop.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop representing the existence of a trade elimination.\n\nStep 1: We need to create a new vprop that represents the existence of a trade elimination.\nStep 2: We can achieve this by using the `trade_elim_t` function and providing it with the appropriate inputs to construct the vprop for the trade elimination existence.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop by applying the `trade_elim_t` function to eliminate the trade.\n\nStep 1: We want to create a new vprop by applying the trade elimination tactic to the given hypothesis, extra information, and conclusion.\n\nStep 2: We will call the `trade_elim_t` function with the provided parameters to achieve the trade elimination and construct the new vprop.", "The `trade_elim_exists` function takes an invariant list `is`, hypothesis `hyp`, extra information `extra`, and conclusion `concl` as input. It aims to construct a new vprop by applying the `trade_elim_t` function to eliminate the trade.\n\nStep 1: We want to create a new vprop by applying the trade elimination tactic to the given inputs.\n\nStep 2: We will call the `trade_elim_t` function with the provided inputs to eliminate the trade and construct the new vprop." ], "generated_solution": [ "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl", "let trade_elim_exists (is: invlist) (hyp extra concl: vprop) : vprop =\n trade_elim_t is hyp extra concl ()" ] }, { "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.test2", "opens_and_abbrevs": [ { "open": "FStar.Calc" }, { "open": "FStar.Map" }, { "open": "FStar.Set" }, { "open": "FStar.List.Tot" }, { "open": "OPLSS2021" }, { "open": "OPLSS2021" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val test2 (l: lref) (h: href) : IST unit (single h) (single l) [single l, single h]", "source_definition": "let test2 (l:lref) (h:href)\n : IST unit (single h)\n (single l)\n [single l, single h]\n = let x = read l in\n write h x", "source_range": { "start_line": 565, "start_col": 0, "end_line": 570, "end_col": 13 }, "interleaved": false, "definition": "fun l h ->\n (let x = OPLSS2021.IFC.read l in\n OPLSS2021.IFC.write h x)\n <:\n OPLSS2021.IFC.IST Prims.unit", "effect": "OPLSS2021.IFC.IST", "effect_flags": [], "mutual_with": [], "premises": [ "OPLSS2021.IFC.lref", "OPLSS2021.IFC.href", "OPLSS2021.IFC.write", "Prims.unit", "Prims.int", "OPLSS2021.IFC.read", "OPLSS2021.IFC.single", "Prims.Cons", "OPLSS2021.IFC.flow", "FStar.Pervasives.Native.Mktuple2", "OPLSS2021.IFC.label", "Prims.Nil" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "l: OPLSS2021.IFC.lref -> h: OPLSS2021.IFC.href -> OPLSS2021.IFC.IST Prims.unit", "prompt": "let test2 (l: lref) (h: href) : IST unit (single h) (single l) [single l, single h] =\n ", "expected_response": "let x = read l in\nwrite h x", "source": { "project_name": "FStar", "file_name": "examples/oplss2021/OPLSS2021.IFC.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS2021.IFC.fst", "checked_file": "dataset/OPLSS2021.IFC.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let loc = int", "let store = m:Map.t loc int{forall l. contains m l}", "let sel (s:store) (l:loc) : int = Map.sel s l", "let upd (s:store) (l:loc) (x:int) : store = Map.upd s l x", "let label = Set.set loc", "let label_inclusion (l0 l1:label) = Set.subset l0 l1", "let bot : label = Set.empty", "let single (l:loc) : label = Set.singleton l", "let union (l0 l1:label) = Set.union l0 l1", "let comp a = store -> a & store", "let havoc s l x = upd s l x", "let writes_ok #a (f:comp a) (writes:Set.set loc) =\n forall (l:loc). ~(Set.mem l writes) ==>\n (forall (s0:store).\n let x1, s0' = f s0 in\n sel s0 l == sel s0' l)", "let does_not_read_loc_v #a (f:comp a) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in //s0 and s0' agree except on l\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in // run f twice, once on s0, once on s0'\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same in both runs\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))", "let does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v", "let reads_ok #a (f:comp a) (reads:label) =\n forall (l:loc) (s:store). ~(Set.mem l reads) ==> does_not_read_loc f l s", "let flow = label & label", "let flows = list flow", "let has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f", "let has_flow (from to:loc) (fs:flows) = exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs", "let no_leakage_k #a (f:comp a) (from to:loc) (k:int) =\n forall s0.{:pattern (havoc s0 from k)}\n sel (snd (f s0)) to == sel (snd (f (havoc s0 from k))) to", "let no_leakage #a (f:comp a) (from to:loc) = forall k. no_leakage_k f from to k", "let respects_flows #a (f:comp a) (fs:flows) =\n forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to", "let ist a (writes:label) (reads:label) (fs:flows) =\n f:comp a {\n reads_ok f reads /\\\n writes_ok f writes /\\\n respects_flows f fs\n }", "let iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s", "let iwrite (l:loc) (x:int) : ist unit (single l) bot [] = fun s -> (), upd s l x", "let return (a:Type) (x:a) : ist a bot bot [] = fun s -> x,s", "let add_source (r:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> union r r0, w0) fs", "let add_sink (w:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> r0, union w w0) fs", "let flows_included_in (fs0 fs1:flows) =\n forall f0. f0 `List.Tot.memP` fs0 ==>\n (forall from to. has_flow_1 from to f0 /\\ from <> to ==> (exists f1. f1 `List.Tot.memP` fs1 /\\ has_flow_1 from to f1))", "let flows_equiv (fs0 fs1:flows) = fs0 `flows_included_in` fs1 /\\ fs1 `flows_included_in` fs0", "let flows_equiv_refl fs\n : Lemma (fs `flows_equiv` fs)\n = ()", "let flows_equiv_trans fs0 fs1 fs2\n : Lemma (fs0 `flows_equiv` fs1 /\\ fs1 `flows_equiv` fs2 ==> fs0 `flows_equiv` fs2)\n = ()", "let flows_included_in_union_distr_dest (a b c:label)\n : Lemma (flows_equiv [a, union b c] [a, b; a, c])\n = ()", "let flows_included_in_union_distr_src (a b c:label)\n : Lemma (flows_equiv [union a b, c] [a, c; b, c])\n = ()", "let flows_included_in_union (a b c:label)\n : Lemma (flows_equiv ([a, union b c; union a b, c])\n ([a, b; union a b, c]))\n = ()", "let bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1", "let bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x l s0);\n assert (does_not_read_loc_v x l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()", "let bind_comp_writes_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (writes_ok (bind_comp x y) (union w0 w1))\n = ()", "let rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "let has_flow_append (from to:loc) (fs fs':flows)\n : Lemma (has_flow from to fs ==>\n has_flow from to (fs @ fs') /\\\n has_flow from to (fs' @ fs))\n = let rec aux (rs:_)\n : Lemma (requires\n List.Tot.memP rs fs)\n (ensures\n List.Tot.memP rs (fs @ fs') /\\\n List.Tot.memP rs (fs' @ fs))\n [SMTPat (List.Tot.memP rs fs)]\n = memP_append_or rs fs fs';\n memP_append_or rs fs' fs\n in\n ()", "let elim_has_flow_seq (from to:loc)\n (r0 r1 w1:label)\n (fs0 fs1:flows)\n : Lemma (requires (~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1)))))\n (ensures (~(has_flow from to fs0) /\\\n (~(Set.mem from r0) \\/ ~(Set.mem to w1)) /\\\n ~(has_flow from to (add_source r0 fs1))))\n = assert (add_source r0 ((bot, w1)::fs1) ==\n (Set.union r0 bot, w1)::add_source r0 fs1);\n assert (Set.union r0 bot `Set.equal` r0);\n has_flow_append from to fs0 ((r0, w1)::add_source r0 fs1);\n assert (~(has_flow from to fs0));\n has_flow_append from to ((r0, w1)::add_source r0 fs1) fs0;\n assert (~(has_flow from to (((r0, w1)::add_source r0 fs1))));\n assert ((r0, w1)::add_source r0 fs1 ==\n [r0, w1] @ add_source r0 fs1);\n has_flow_append from from [r0, w1] (add_source r0 fs1)", "let rec add_source_monotonic (from to:loc) (r:label) (fs:flows)\n : Lemma (has_flow from to fs ==> has_flow from to (add_source r fs))\n = match fs with\n | [] -> ()\n | _::tl -> add_source_monotonic from to r tl", "let has_flow_soundness #a #r #w #fs (f:ist a r w fs)\n (from to:loc) (s:store) (k:int)\n : Lemma (requires\n (let x, s1 = f s in\n let _, s1' = f (havoc s from k) in\n from <> to /\\\n sel s1 to <> sel s1' to))\n (ensures has_flow from to fs)\n = let aux ()\n : Lemma (requires (~(has_flow from to fs)))\n (ensures False)\n [SMTPat ()]\n = assert (respects_flows f fs);\n assert (no_leakage f from to)\n in\n ()", "let bind_comp_no_leakage (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n (from to:loc)\n (s0:store) (k:_)\n : Lemma\n (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1))))\n (ensures (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\n = let f = bind_comp x y in\n assert (reads_ok x r0);\n let s0' = havoc s0 from k in\n let _, s2f = f s0 in\n let _, s2f' = f s0' in\n let flows = (fs0 @ add_source r0 ((r1, w1)::fs1)) in\n let v0, s1 = x s0 in\n let v0', s1' = x s0' in\n elim_has_flow_seq from to r0 r1 w1 fs0 fs1;\n assert (~(has_flow from to fs0));\n assert (respects_flows x fs0);\n assert (no_leakage x from to);\n assert (sel s1 to == sel s1' to);\n let _, s2 = y v0 s1 in\n let _, s2' = y v0' s1' in\n assert (s2 == s2f);\n assert (s2' == s2f');\n //Given: (from not-in r0 U r1) \\/ (to not-in w1)\n //suppose (from in r0) \\/ (from in r1)\n // them to not-in w1\n //suppose (from not-in r0 U r1)\n //then v0 = v0'\n // s1' = havoc from s1 k\n // s2 to = s2' to\n if Set.mem to w1\n then begin\n assert (~(Set.mem from r0));\n assert (reads_ok x r0);\n assert (does_not_read_loc x from s0);\n assert (does_not_read_loc_v x from s0 k);\n assert (v0 == v0');\n assert (forall l. l <> from ==> sel s1 l == sel s1' l);\n assert (Map.equal s1' (havoc s1 from k) \\/ Map.equal s1' s1);\n if (sel s1 from = sel s1' from)\n then begin\n assert (Map.equal s1 s1')\n end\n else begin\n assert (Map.equal s1' (havoc s1 from k));\n assert (reads_ok (y v0) r1);\n if (sel s2 to = sel s2' to)\n then ()\n else begin\n assert (sel s2 to <> sel s1 to \\/ sel s2' to <> sel s1' to);\n has_flow_soundness (y v0) from to s1 k;\n assert (has_flow from to fs1);\n add_source_monotonic from to r0 fs1\n //y reads from and writes to, so (from, to) should be in fs1\n //so, we should get a contradiction\n end\n end\n end\n else //to is not in w1, so y does not write it\n ()", "let bind_comp_flows_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1)::fs1)))\n = let f = bind_comp x y in\n let flows = (fs0 @ add_source r0 ((bot, w1)::fs1)) in\n let respects_flows_lemma (from to:loc)\n : Lemma (requires from <> to /\\ ~(has_flow from to flows))\n (ensures no_leakage f from to)\n [SMTPat (no_leakage f from to)]\n = let aux (s0:store) (k:_)\n : Lemma (let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to)\n [SMTPat (havoc s0 from k)]\n = bind_comp_no_leakage x y from to s0 k\n in\n ()\n in\n ()", "let triple = label & label & flows", "let unit_triple = bot, bot, []", "let comp_triple (w0, r0, fs0) (w1, r1, fs1) = (union w0 w1, union r0 r1, (fs0 @ add_source r0 ((bot, w1)::fs1)))", "let label_equiv (s0 s1:label) = Set.equal s0 s1", "let triple_equiv (w0, r0, f0) (w1, r1, f1) = label_equiv w0 w1 /\\ label_equiv r0 r1 /\\ flows_equiv f0 f1", "let triple_equiv_refl t0\n : Lemma (triple_equiv t0 t0)\n = ()", "let rec add_source_bot (f:flows)\n : Lemma (add_source bot f `flows_equiv` f)\n = match f with\n | [] -> ()\n | _::tl -> add_source_bot tl", "let left_unit (w, r, f) =\n assert (Set.equal (union bot bot) bot);\n add_source_bot f;\n assert (comp_triple unit_triple (w, r, f) `triple_equiv` (w, r, f))", "let flows_included_append (f0 f1 g0 g1:flows)\n : Lemma (requires flows_included_in f0 g0 /\\\n flows_included_in f1 g1)\n (ensures flows_included_in (f0@f1) (g0@g1))\n = let aux (f:_) (from to:_)\n : Lemma (requires List.Tot.memP f (f0@f1) /\\\n from <> to /\\\n has_flow_1 from to f)\n (ensures (exists g. g `List.Tot.memP` (g0@g1) /\\ has_flow_1 from to g))\n [SMTPat (has_flow_1 from to f)]\n = memP_append_or f f0 f1;\n assert (exists g. g `List.Tot.memP` g0 \\/ g `List.Tot.memP` g1 /\\ has_flow_1 from to g);\n FStar.Classical.forall_intro (fun g -> memP_append_or g g0 g1)\n in\n ()", "let flows_equiv_append (f0 f1 g0 g1:flows)\n : Lemma (requires flows_equiv f0 g0 /\\ flows_equiv f1 g1)\n (ensures flows_equiv (f0@f1) (g0@g1))\n = flows_included_append f0 f1 g0 g1;\n flows_included_append g0 g1 f0 f1", "let rec append_nil_r #a (l:list a)\n : Lemma (l @ [] == l)\n = match l with\n | [] -> ()\n | _::tl -> append_nil_r tl", "let right_unit (w, r, f) =\n calc (==) {\n comp_triple (w, r, f) unit_triple;\n (==) { }\n (w `union` bot, r `union` bot, f @ add_source r ((bot, bot)::[]));\n };\n assert (flows_equiv (add_source r [(bot, bot)]) []);\n flows_equiv_append f (add_source r [(bot, bot)]) f [];\n append_nil_r f;\n assert (comp_triple (w, r, f) unit_triple `triple_equiv` (w, r, f))", "let assoc_comp (w0, r0, fs0) (w1, r1, fs1) (w2, r2, fs2) =\n calc (==) {\n comp_triple (w0, r0, fs0) (comp_triple (w1, r1, fs1) (w2, r2, fs2)) ;\n (==) { }\n comp_triple (w0, r0, fs0) (union w1 w2, union r1 r2, (fs1 @ add_source r1 ((bot, w2)::fs2)));\n (==) { }\n (union w0 (union w1 w2), union r0 (union r1 r2), fs0 @ (add_source r0 ((bot, union w1 w2) :: (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { assert (forall w0 w1 w2. Set.equal (union w0 (union w1 w2)) (union (union w0 w1) w2)) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n fs0 @ (add_source r0 ((bot, union w1 w2) :: (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n (fs0 @ ((union r0 bot, union w1 w2) :: add_source r0 (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { assert (forall s. Set.equal (union s bot) s) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n (fs0 @ ((r0, union w1 w2) :: add_source r0 (fs1 @ (r1, w2) ::add_source r1 fs2))));\n };\n calc (==) {\n comp_triple (comp_triple (w0, r0, fs0) (w1, r1, fs1)) (w2, r2, fs2);\n (==) { }\n comp_triple (union w0 w1, union r0 r1, (fs0 @ add_source r0 ((bot, w1)::fs1))) (w2, r2, fs2);\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ add_source r0 ((bot, w1)::fs1)) @ (add_source (union r0 r1) ((bot, w2) :: fs2))));\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ ((union r0 bot, w1)::add_source r0 fs1)) @ ((union (union r0 r1) bot, w2) :: add_source (union r0 r1) fs2)));\n (==) { assert (forall s. Set.equal (union s bot) s) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ ((r0, w1)::add_source r0 fs1)) @ ((union r0 r1, w2) :: add_source (union r0 r1) fs2)));\n }", "let bind (a b:Type)\n (w0 r0 w1 r1:label) (fs0 fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : ist b\n (union w0 w1) // union the writes\n (union r0 r1) // union the reads\n (fs0 @ // flows of x\n add_source r0 ((bot, w1) // plus flows from whatever x reads to whatever y writes\n ::fs1)) //plus the flows of y\n = let f = fun s0 -> let v, s1 = x s0 in y v s1 in\n bind_comp_reads_ok x y;\n bind_comp_reads_ok x y;\n bind_comp_flows_ok x y;\n f", "let subcomp (a:Type) (w0 r0 w1 r1:label) (fs0 fs1:flows) (f:ist a w0 r0 fs0)\n : Pure (ist a w1 r1 fs1)\n (requires label_inclusion w0 w1 /\\\n label_inclusion r0 r1 /\\\n fs0 `flows_included_in` fs1)\n (fun _ -> True)\n = let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l r1)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k :_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = f s0 in\n let v', s1' = f (havoc s0 l k) in\n assert (does_not_read_loc f l s0);\n assert (v == v');\n assert (not (Set.mem l w0) ==> sel s1' l = k);\n assert (not (Set.mem l w1) ==> sel s1' l = k);\n ()\n in\n ()\n in\n f", "let read (l:loc) : IST int bot (single l) [] = IST?.reflect (iread l)", "let write (l:loc) (x:int) : IST unit (single l) bot [] = IST?.reflect (iwrite l x)", "let tot a = unit -> Tot a", "let lift_tot (a:Type) (x:tot a)\n : ist a bot bot []\n = return a (x())", "let ref (l:label) = r:loc {r `Set.mem` l}", "val high : label", "let low : label = Set.complement high", "let lref = ref low", "let href = ref high", "let test (l:lref) (h:href)\n : IST unit (union bot (single h))\n (union (single l) bot)\n (add_source (single l) [bot, single h])\n = let x = read l in\n write h x" ], "closest": [ "val test2 (l: lref) (h: href) : IST unit (single h) (single l) [single l, single h]\nlet test2 (l:lref) (h:href)\n : IST unit (single h)\n (single l)\n [single l, single h]\n = let x = read l in\n write h x", "val test3 (l: lref) (h: href) : IST unit (single h) (single l) [single l, single h]\nlet test3 (l:lref) (h:href)\n : IST unit (single h)\n (single l)\n [single l, single h]\n = write h (read l)", "val test7 (l: lref) (h: href) : IST unit (single l) (single h) [high, low]\nlet test7 (l:lref) (h:href)\n : IST unit (single l)\n (single h)\n [high, low]\n = let x = read h in\n write l x", "val test9 (l: lref) (h: href)\n : IST unit (single l) (union (single h) (single l)) [((single l) `union` (single h), single l)]\nlet test9 (l:lref) (h:href)\n : IST unit (single l)\n (union (single h) (single l))\n [(single l `union` single h, single l)]\n = let x= (let x0 = read h in\n read l)\n in\n write l x", "val test (l: lref) (h: href)\n : IST unit (union bot (single h)) (union (single l) bot) (add_source (single l) [bot, single h])\nlet test (l:lref) (h:href)\n : IST unit (union bot (single h))\n (union (single l) bot)\n (add_source (single l) [bot, single h])\n = let x = read l in\n write h x", "val test2 (l: lref) (h: href)\n : HIFC unit\n (single l)\n (single h)\n [single l, single h]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\nlet test2 (l:lref) (h:href)\n : HIFC unit (single l)\n (single h)\n [single l, single h]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\n = let x = read l in\n write h x", "val test3_1 (l: lref) (h: href) (x: int) : IST int (single h) (single l) []\nlet test3_1 (l:lref) (h:href) (x:int)\n : IST int (single h)\n (single l)\n []\n = write h 0;\n read l", "val test6 (l: lref) (h: href) : IST unit high low [low, high]\nlet test6 (l:lref) (h:href)\n : IST unit high low [low, high]\n = let x = read l in\n write h x", "val test5 (l: lref) (h: href) (x: int) : IST int (single l) (single h) []\nlet test5 (l:lref) (h:href) (x:int)\n : IST int (single l)\n (single h)\n []\n = write l x;\n read h", "val test4 (l: lref) (h: href) (x: int) : IST int (single l) (single h) [single h, bot]\nlet test4 (l:lref) (h:href) (x:int)\n : IST int (single l)\n (single h)\n [single h, bot]\n = write l x;\n read h", "val test3 (l: lref) (h: href)\n : HIFC unit\n (single l)\n (single h)\n [single l, single h]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\nlet test3 (l:lref) (h:href)\n : HIFC unit (single l)\n (single h)\n [single l, single h]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\n = write h (read l)", "val test8 (l: lref) (h: href)\n : HIFC unit\n (union (single h) (single l))\n (single l)\n [(single h, single l)]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l + 1)\nlet test8 (l:lref) (h:href)\n : HIFC unit (union (single h) (single l)) (single l) [(single h, single l)]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l + 1)\n = let x0 = read h in\n let x = read l in\n write l (x + 1)", "val test (l: lref) (h: href)\n : HIFC unit\n (union (single l) bot)\n (union bot (single h))\n (add_source (single l) [bot, single h])\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\nlet test (l:lref) (h:href)\n : HIFC unit (union (single l) bot)\n (union bot (single h))\n (add_source (single l) [bot, single h])\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\n = let x = read l in\n write h x", "val test3_lab (l: lref) (h: href) : IST unit high low [low, high]\nlet test3_lab (l:lref) (h:href)\n : IST unit high low [low, high]\n = write h (read l)", "val test9 (l: lref) (h: href)\n : HIFC unit\n (union (single h) (single l))\n (single l)\n [((single l) `union` (single h), single l)]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l)\nlet test9 (l:lref) (h:href)\n : HIFC unit (union (single h) (single l)) (single l)\n [(single l `union` single h, single l)]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l)\n = let x= (let x0 = read h in\n read l)\n in\n write l x", "val test7 (l: lref) (h: href)\n : HIFC unit\n (single h)\n (single l)\n [high, low]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == sel s0 h)\nlet test7 (l:lref) (h:href)\n : HIFC unit (single h) (single l) [high, low]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == sel s0 h)\n = let x = read h in\n write l x", "val refine_test9 (l: lref) (h: href)\n : (unit\n -> HIFC unit\n (union (single h) (single l))\n (single l)\n []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l))\nlet refine_test9 (l:lref) (h:href)\n : (unit -> HIFC unit (union (single h) (single l))\n (single l)\n []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l))\n = refine_flow (fun () -> test9 l h)", "val test6 (l: lref) (h: href)\n : HIFC unit\n low\n high\n [low, high]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 h == sel s0 l)\nlet test6 (l:lref) (h:href)\n : HIFC unit low high [low, high]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 h == sel s0 l)\n = let x = read l in\n write h x", "val test15 (l: lref) : IST unit (single l) (single l) []\nlet test15 (l:lref)\n : IST unit (single l) (single l) []\n = write l (read l)", "val refine_test8: l: lref -> h: href -> unit\n -> HIFC unit\n (union (single h) (single l))\n (single l)\n []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l + 1)\nlet refine_test8 (l:lref) (h:href)\n : unit -> HIFC unit (union (single h) (single l)) (single l) []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 l == sel s0 l + 1)\n = refine_flow (fun () -> test8 l h)", "val test3_lab (l: lref) (h: href)\n : HIFC unit\n low\n high\n [low, high]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\nlet test3_lab (l:lref) (h:href)\n : HIFC unit low high [low, high]\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s1 h == sel s0 l)\n = write h (read l)", "val test3_1 (l: lref) (h: href) (x: int)\n : HIFC int\n (single l)\n (single h)\n []\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 h == 0 /\\ r == sel s1 l)\nlet test3_1 (l:lref) (h:href) (x:int)\n : HIFC int (single l) (single h) []\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 h == 0 /\\ r == sel s1 l)\n = write h 0;\n read l", "val test4 (l: lref) (h: href) (x: int)\n : HIFC int\n (single h)\n (single l)\n [single h, bot]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == x /\\ r == sel s1 h)\nlet test4 (l:lref) (h:href) (x:int)\n : HIFC int (single h) (single l) [single h, bot]\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == x /\\ r == sel s1 h)\n = write l x;\n read h", "val test5 (l: lref) (h: href) (x: int)\n : HIFC int\n (single h)\n (single l)\n []\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == x /\\ r == sel s1 h)\nlet test5 (l:lref) (h:href) (x:int)\n : HIFC int (single h) (single l) []\n (requires fun _ -> True)\n (ensures fun s0 r s1 -> sel s1 l == x /\\ r == sel s1 h)\n = write l x;\n read h", "val test15 (l: lref)\n : HIFC unit\n (single l)\n (single l)\n []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s0 l == sel s1 l)\nlet test15 (l:lref)\n : HIFC unit (single l) (single l) []\n (requires fun _ -> True)\n (ensures fun s0 _ s1 -> sel s0 l == sel s1 l)\n = write l (read l)", "val test (l: list int {List.Tot.length l == 10}) : HST.St unit\nlet test (l:list int{List.Tot.length l == 10}) :HST.St unit =\n let ls = Seq.seq_of_list l in\n let b = IB.igcmalloc_of_list HS.root l in\n assert (B.length b == 10);\n havoc b;\n IB.recall_contents b ls;\n let h = HST.get () in\n assert (B.as_seq h b == ls);\n assert (B.live h b);\n \n let sb = IB.isub b 0ul 2ul in\n IB.witness_contents sb (Seq.slice ls 0 2);\n havoc sb;\n IB.recall_contents sb (Seq.slice ls 0 2);\n IB.recall_contents b ls;\n let h = HST.get () in\n assert (B.as_seq h b == ls);\n assert (B.as_seq h sb = Seq.slice ls 0 2);\n\n //test partial API\n let b1 = IB.igcmalloc_of_list_partial HS.root l in\n if B.is_null b1 then ()\n else begin\n assert (B.length b1 == 10);\n IB.recall_contents b1 ls;\n let h = HST.get () in\n assert (B.as_seq h b1 == ls)\n end", "val test2 (r1 r2: ref int)\n : Steel unit\n ((vptr r1) `star` (vptr r2))\n (fun _ -> (vptr r1) `star` (vptr r2))\n (requires fun h -> sel r1 h == 1)\n (ensures fun h0 _ h1 -> sel r1 h1 == 0 /\\ sel r2 h0 == sel r2 h1)\nlet test2 (r1 r2:ref int) : Steel unit\n (vptr r1 `star` vptr r2) (fun _ -> vptr r1 `star` vptr r2)\n (requires fun h -> sel r1 h == 1)\n (ensures fun h0 _ h1 -> sel r1 h1 == 0 /\\ sel r2 h0 == sel r2 h1)\n = write r1 0;\n write r1 0", "val test2 (c: ref (ref int))\n : ST (ref (ref int))\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures (fun h0 d h1 -> c == d /\\ sel h1 (sel h1 c) = sel h0 (sel h0 c)))\nlet test2 (c:ref (ref int)) : ST (ref (ref int))\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures (fun h0 d h1 -> c == d /\\ sel h1 (sel h1 c) = sel h0 (sel h0 c))) =\n let i = (compose_stlens stlens_ref stlens_ref).st_get c in\n (compose_stlens stlens_ref stlens_ref).st_put i c", "val test2 (lll: list int {List.Tot.length lll > 0 /\\ List.Tot.length lll <= UInt.max_int 32})\n : HST.ST unit (fun h0 -> HS.is_stack_region (HS.get_tip h0)) (fun _ _ _ -> True)\nlet test2 (lll:list int{List.Tot.length lll > 0 /\\\n List.Tot.length lll <= UInt.max_int 32})\n :HST.ST unit (fun h0 -> HS.is_stack_region (HS.get_tip h0)) (fun _ _ _ -> True)=\n let b = B.gcmalloc_of_list HS.root l in\n assert (B.length b == 10);\n let h = HST.get () in\n assert (B.as_seq h b == Seq.seq_of_list l);\n assert (B.length b == List.Tot.length l);\n let ll = [1;2;3;4;5;6;7;8;9;10;11] in\n HST.push_frame ();\n let b = B.alloca_of_list ll in\n assert (B.length b == 11);\n let h = HST.get () in\n assert (B.as_seq h b == Seq.seq_of_list ll);\n assert (B.length b == List.Tot.length ll);\n let b = B.alloca_of_list lll in\n let h = HST.get () in\n assert (B.as_seq h b == Seq.seq_of_list lll);\n assert (B.length b == List.Tot.length lll);\n HST.pop_frame ()", "val test1 (c: ref (ref int))\n : ST (ref (ref int))\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures\n (fun h0 d h1 ->\n c == d /\\ (h1, d) == (compose_hlens hlens_ref hlens_ref).put 0 (h0, c) /\\\n h1 == upd (upd h0 (sel h0 c) 0) c (sel h0 c) /\\ sel h0 c == sel h1 c /\\\n sel h1 (sel h1 c) = 0))\nlet test1 (c:ref (ref int)) : ST (ref (ref int))\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures (fun h0 d h1 ->\n c == d /\\\n (h1, d) == (compose_hlens hlens_ref hlens_ref).put 0 (h0, c) /\\\n h1 == upd (upd h0 (sel h0 c) 0) c (sel h0 c) /\\\n sel h0 c == sel h1 c /\\ sel h1 (sel h1 c) = 0)) =\n (compose_stlens stlens_ref stlens_ref).st_put 0 c", "val test4 (c: ref (ref int))\n : ST unit\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures (fun h0 d h1 -> sel h1 (sel h1 c) = sel h0 (sel h0 c)))\nlet test4 (c:ref (ref int)) : ST unit\n (requires (fun h -> addr_of (sel h c) <> addr_of c))\n (ensures (fun h0 d h1 -> sel h1 (sel h1 c) = sel h0 (sel h0 c))) =\n c.[v |.. v] <- c.[v |.. v]", "val test_ite2 (r: rref bool) (v: erased bool) : STT unit (pts_to r v) (fun _ -> pts_to r v)\nlet test_ite2 (r:rref bool) (v:erased bool)\n : STT unit (pts_to r v) (fun _ -> pts_to r v)\n = let x = !r in\n if x\n then (\n rewrite (pts_to r v) (pts_to r true);\n ftrue r;\n rewrite (pts_to r true) (pts_to r v)\n )\n else (\n rewrite (pts_to r v) (pts_to r false);\n ffalse r;\n rewrite (pts_to r false) (pts_to r v)\n )", "val test1 (r1: rid) (r2: rid{includes r1 r2}) : unit\nlet test1 (r1:rid) (r2:rid{includes r1 r2}) :unit = assert (includes r1 (hide ((0, 0, false)::(Ghost.reveal r2))))", "val test26 (r1 r2: ref)\n : SteelAtomicT unit Set.empty ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r2) `star` (ptr r1))\nlet test26 (r1 r2:ref) : SteelAtomicT unit Set.empty (ptr r1 `star` ptr r2) (fun _ -> ptr r2 `star` ptr r1)\n = let _ = ghost_read r1 in\n ()", "val test0 (c: ref (ref int))\n : ST int\n (requires (fun h -> True))\n (ensures (fun h0 i h1 -> h0 == h1 /\\ i == sel h1 (sel h1 c)))\nlet test0 (c:ref (ref int)) : ST int\n (requires (fun h -> True))\n (ensures (fun h0 i h1 -> h0 == h1 /\\ i == sel h1 (sel h1 c)))\n = (compose_stlens stlens_ref stlens_ref).st_get c", "val test8 (b1 b2 b3: ref)\n : STT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test8 (b1 b2 b3:ref) : STT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n = write b2 0", "val test0 (r: ref int)\n : Steel unit\n (vptr r)\n (fun _ -> vptr r)\n (requires fun h -> sel r h == 0)\n (ensures fun _ _ h1 -> sel r h1 == 1)\nlet test0 (r:ref int) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun h -> sel r h == 0)\n (ensures fun _ _ h1 -> sel r h1 == 1)\n = let x = gget (vptr r) in\n assert (x == Ghost.hide 0);\n write r 1;\n let x = gget (vptr r) in\n assert (x == Ghost.hide 1);\n write r 1", "val test2 (b1 b2 b3: ref)\n : STT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b3) `star` (ptr b2)) `star` (ptr b1))\nlet test2 (b1 b2 b3: ref) : STT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b3 `star` ptr b2 `star` ptr b1)\n =\n let x = read b1 in\n x", "val test6 (r1 r2: ref) : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r2) `star` (ptr r1))\nlet test6 (r1 r2:ref) : SteelT unit (ptr r1 `star` ptr r2) (fun _ -> ptr r2 `star` ptr r1)\n = let _ = read r1 in\n ()", "val test4 (b1 b2 b3: ref)\n : STT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test4 (b1 b2 b3: ref) : STT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n write b2 x", "val test5 (b1 b2 b3: ref)\n : STT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test5 (b1 b2 b3: ref) : STT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n write b2 (x + 1)", "val test6 (b1 b2 b3: ref)\n : STT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test6 (b1 b2 b3: ref) : STT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n let b4 = alloc x in\n write b2 (x + 1);\n free b4", "val read (l: loc) : IST int bot (single l) []\nlet read (l:loc) : IST int bot (single l) [] = IST?.reflect (iread l)", "val test2: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> r >= 4 /\\ h0 == h1)\nlet test2 ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> r >= 4 /\\ h0 == h1)\n= let x = test () in\n let y = test () in\n x + y", "val test1 (r: ref int)\n : Steel unit\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> sel r h1 == 0)\nlet test1 (r:ref int) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> sel r h1 == 0)\n = write r 1;\n write r 0", "val test2 (r: ref) : SteelT int (ptr r) (fun _ -> ptr r)\nlet test2 (r:ref) : SteelT int (ptr r) (fun _ -> ptr r) =\n let x = read r in\n x", "val test3 (r1 r2 r3: ref int)\n : Steel unit\n ((vptr r1) `star` ((vptr r2) `star` (vptr r3)))\n (fun _ -> (vptr r1) `star` ((vptr r2) `star` (vptr r3)))\n (requires fun _ -> True)\n (ensures fun h0 _ h1 -> sel r1 h1 == 0 /\\ sel r2 h0 == sel r2 h1 /\\ sel r3 h0 == sel r3 h1)\nlet test3 (r1 r2 r3:ref int) : Steel unit\n (vptr r1 `star` (vptr r2 `star` vptr r3)) (fun _ -> vptr r1 `star` (vptr r2 `star` vptr r3))\n (requires fun _ -> True)\n (ensures fun h0 _ h1 ->\n sel r1 h1 == 0 /\\\n sel r2 h0 == sel r2 h1 /\\\n sel r3 h0 == sel r3 h1\n )\n = let x2_0 = gget (vptr r2) in\n write r1 1;\n let x1_1 = gget (vptr r1) in\n let x2_1 = gget (vptr r2) in\n assert (x1_1 == Ghost.hide 1);\n assert (x2_0 == x2_1);\n write r1 0", "val test_if8 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if8 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0);\n write r2 0", "val test2: Prims.unit -> HoareST int (fun _ -> True) (fun _ _ _ -> True)\nlet test2 () : HoareST int (fun _ -> True) (fun _ _ _ -> True)\n= g 2 (f 0)", "val test0: r:rid -> a:m_rref r (seq nat) grows -> k:nat -> ST unit\n (requires (fun h -> k < Seq.length (HS.sel h a)))\n (ensures (fun h0 result h1 -> True))\nlet test0 r a k =\n let h0 = HST.get() in\n let _ = \n let s = HS.sel h0 a in \n at_least_is_stable k (Seq.index (HS.sel h0 a) k) a;\n Seq.contains_intro s k (Seq.index s k) in\n mr_witness a (at_least k (Seq.index (HS.sel h0 a) k) a)", "val test_if2 (b: bool) (r: ref) : STT unit (ptr r) (fun _ -> ptr r)\nlet test_if2 (b:bool) (r: ref) : STT unit (ptr r) (fun _ -> ptr r)\n = if b then write r 0 else write r 1", "val test_if7 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if7 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val test: Prims.unit -> STT unit ((p `star` p) `star` p) (fun _ -> (p `star` p) `star` p)\nlet test () : STT unit (p `star` p `star` p) (fun _ -> p `star` p `star` p)\n = f 0; ()", "val test1 (b1 b2 b3: ref)\n : STT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b1) `star` (ptr b2)) `star` (ptr b3))\nlet test1 (b1 b2 b3: ref) : STT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b1 `star` ptr b2 `star` ptr b3)\n =\n let x = (let y = read b1 in y) in\n x", "val test_ite (r: rref bool) (v: erased bool) : STT unit (pts_to r v) (fun _ -> pts_to r v)\nlet test_ite (r:rref bool) (v:erased bool)\n : STT unit (pts_to r v) (fun _ -> pts_to r v)\n = let x = !r in\n if x\n then fany r v\n else fany r v", "val invariant: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> Type0\nlet invariant #_ #_ h ll =\n LL2.invariant h ll", "val test0 (b1 b2 b3: ref)\n : STT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b1) `star` (ptr b2)) `star` (ptr b3))\nlet test0 (b1 b2 b3: ref) : STT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b1 `star` ptr b2 `star` ptr b3)\n =\n let x = read b1 in\n x", "val test8 (b1 b2 b3: ref)\n : SteelT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test8 (b1 b2 b3:ref) : SteelT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n = write b2 0", "val test: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> r > 1 /\\ h0 == h1)\nlet test ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> r > 1 /\\ h0 == h1)\n= 3", "val test4 (r: ref nat) : SteelT unit (vptr r) (fun _ -> vptr r)\nlet test4 (r: ref nat) : SteelT unit (vptr r) (fun _ -> vptr r) =\n share r;\n gather r", "val test1 (l: list nat) : LV nat (fun _ -> True) (fun _ n _ -> n == L.length l)\nlet rec test1 (l:list nat) : LV nat (fun _ -> True) (fun _ n _ -> n == L.length l)\n= match l with\n | [] -> 0\n | _::tl ->\n let n = test1 tl in //let binding is important, can't write 1 + test1 tl, see #881\n n + 1", "val witness_hsref (#a:Type) (#rel:preorder a) (r:HS.mreference a rel)\n :ST unit (fun h0 -> h0 `HS.contains` r)\n (fun h0 _ h1 -> h0 == h1 /\\ witnessed (ref_contains_pred r))\nlet witness_hsref #_ #_ r =\n HS.lemma_rid_ctr_pred ();\n HS.lemma_next_addr_contained_refs_addr ();\n gst_witness (ref_contains_pred r)", "val comment (s: string)\n : HST.Stack unit (requires (fun _ -> True)) (ensures (fun h _ h' -> h == h'))\nlet comment (s: string) : HST.Stack unit\n (requires (fun _ -> True))\n (ensures (fun h _ h' -> h == h'))\n= LowStar.Comment.comment s", "val test6 (b1 b2 b3: ref)\n : SteelT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test6 (b1 b2 b3: ref) : SteelT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n let b4 = alloc x in\n write b2 (x + 1);\n free b4", "val test4 (b1 b2 b3: ref)\n : SteelT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test4 (b1 b2 b3: ref) : SteelT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n write b2 x", "val test2_msg:lbytes 1\nlet test2_msg : lbytes 1 =\n let l = List.Tot.map u8_from_UInt8 [ 0x72uy ] in\n assert_norm (List.Tot.length l == 1);\n of_list l", "val get (u: unit) : ST heap (fun h -> True) (fun h0 h h1 -> h0 == h1 /\\ h == h1)\nlet get (u:unit) :ST heap (fun h -> True) (fun h0 h h1 -> h0==h1 /\\ h==h1) = gst_get ()", "val test_if10 (b: bool) (r1 r2 r3: ref)\n : STT unit\n (((ptr r1) `star` (ptr r2)) `star` (ptr r3))\n (fun _ -> ((ptr r1) `star` (ptr r2)) `star` (ptr r3))\nlet test_if10 (b:bool) (r1 r2 r3: ref) : STT unit\n (ptr r1 `star` ptr r2 `star` ptr r3)\n (fun _ -> ptr r1 `star` ptr r2 `star` ptr r3)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val test5 (b1 b2 b3: ref)\n : SteelT unit\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test5 (b1 b2 b3: ref) : SteelT unit\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n write b2 (x + 1)", "val iwrite (l: loc) (x: int) : ist unit (single l) bot []\nlet iwrite (l:loc) (x:int) : ist unit (single l) bot [] = fun s -> (), upd s l x", "val test2 (b1 b2 b3: ref)\n : SteelT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b3) `star` (ptr b2)) `star` (ptr b1))\nlet test2 (b1 b2 b3: ref) : SteelT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b3 `star` ptr b2 `star` ptr b1)\n =\n let x = read b1 in\n x", "val write (l: loc) (x: int) : IST unit (single l) bot []\nlet write (l:loc) (x:int) : IST unit (single l) bot [] = IST?.reflect (iwrite l x)", "val test2 (x: (int * int)) (print_pair: ((int * int) -> StTrivial unit))\n : Stack unit (requires (fun h0 -> True)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet test2 (x:(int * int)) (print_pair:(int * int) -> StTrivial unit)\n : Stack unit\n (requires (fun h0 -> True))\n (ensures (fun h0 _ h1 -> h0 == h1))\n = printf \"Hello pair %a\" print_pair x done", "val test5: Prims.unit -> HoareST int (fun _ -> True) (fun h0 r h1 -> True)\nlet test5 ()\n: HoareST int\n (fun _ -> True)\n (fun h0 r h1 -> True)\n= let y = test () in\n y", "val test (x:B.pointer int)\n : stl unit 1 (loc_buf x) (fun _ -> loc_buf x)\n (fun h ->\n B.live h x /\\\n B.get h x 0 > 17)\n (fun h0 _ h1 ->\n B.live h1 x /\\\n B.get h1 x 0 >\n B.get h0 x 0)\nlet test x hinit fresh =\n let v = B.index fresh 0ul in\n let y = B.index x 0ul in\n B.upd x 0ul (y + y)", "val test2: Prims.unit -> Lemma (True)\nlet test2 () : Lemma (True) =\n let s1 = empty $:: 1 in\n let s2 = s1 $:: 2 in\n let s3 = s2 $:: 3 in\n let s4 = s3 $:: 4 in\n let s5 = s4 $:: 5 in\n assert (length s2 = 1 + length s1);\n assert (length s2 = 2);\n assert (length s5 = 5);\n assert (s5 $@ 1 == 2);\n assert (forall (s: seq int) (n: nat). n < 2 ==> (s2 $+ s) $@ n = s2 $@ n);\n assert (drop (drop s5 1) 2 == drop s5 3);\n assert (forall (v: int). length (s5 $:: v) = 6);\n assert (s3 $<= s5);\n assert (length (update s5 3 7) == 5);\n assert ((update s5 3 7) $@ 2 == 3);\n assert ((update s5 3 7) $@ 3 == 7);\n assert (length (slice s5 1 3) == 2)", "val valid\n (#l: P.union_typ)\n (h: HS.mem)\n (tgs: tags l)\n (p: P.pointer (typ l))\n: GTot Type0\nlet valid\n (#l: P.union_typ)\n (h: HS.mem)\n (tgs: tags l)\n (p: P.pointer (typ l))\n: GTot Type0\n=\n let tag_ptr = P.gfield p (tag_field l) in\n let u_ptr = P.gfield p (union_field l) in\n let t = P.gread h tag_ptr in\n P.readable h tag_ptr /\\\n List.Tot.mem t tgs /\\\n (let f = field_of_tag #l tgs t in\n P.is_active_union_field h u_ptr f)", "val test1:Type u#2\nlet test1 : Type u#2 = Type u#1", "val read : #a:Type -> \n r:ref a -> \n\t ImmutableST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t\t\t\t x == sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val test_if8 (b: bool) (r1 r2: ref)\n : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if8 (b:bool) (r1 r2: ref) : SteelT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0);\n write r2 0", "val test3 (b1 b2 b3: ref)\n : STT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b2) `star` (ptr b1)) `star` (ptr b3))\nlet test3 (b1 b2 b3: ref) : STT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b2 `star` ptr b1 `star` ptr b3)\n =\n let x = read b3 in\n x", "val test_if7 (b: bool) (r1 r2: ref)\n : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if7 (b:bool) (r1 r2: ref) : SteelT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val test_ite_g2 (#o: _) (r: rref bool) (v: erased bool)\n : STGhostT unit o (pts_to r v) (fun _ -> pts_to r v)\nlet test_ite_g2 (#o:_) (r:rref bool) (v:erased bool)\n : STGhostT unit o (pts_to r v) (fun _ -> pts_to r v)\n = let x = gread r _ in\n if x\n then (\n rewrite (pts_to r v) (pts_to r true);\n gtrue r;\n rewrite (pts_to r true) (pts_to r v)\n )\n else (\n rewrite (pts_to r v) (pts_to r false);\n gfalse r;\n rewrite (pts_to r false) (pts_to r v)\n )", "val test_if9 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if9 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = write r1 0;\n if b then (write r1 0) else (write r2 0);\n write r2 0;\n if b then (write r1 0) else (write r2 0);\n write r1 0", "val intro_llist_cons (#a:Type0) (ptr1 ptr2:t a)\n : Steel unit (vptr ptr1 `star` llist ptr2)\n (fun _ -> llist ptr1)\n (requires fun h -> next (sel ptr1 h) == ptr2)\n (ensures fun h0 _ h1 -> v_llist ptr1 h1 == (data (sel ptr1 h0)) :: v_llist ptr2 h0)\nlet intro_llist_cons\n #a ptr1 ptr2\n=\n llist0_of_llist ptr2;\n let n = nllist_of_llist0 ptr2 in\n (* set the fuel of the new cons cell *)\n let c = read ptr1 in\n let c' = {c with tail_fuel = n} in\n write ptr1 c' ;\n (* actually cons the cell *)\n vptr_not_null ptr1;\n intro_vdep\n (vptr ptr1)\n (nllist a n ptr2)\n (llist_vdep ptr1);\n intro_vrewrite\n (vptr ptr1 `vdep` llist_vdep ptr1)\n (llist_vrewrite ptr1);\n change_equal_slprop\n ((vptr ptr1 `vdep` llist_vdep ptr1) `vrewrite` llist_vrewrite ptr1)\n (llist0 ptr1);\n llist_of_llist0 ptr1", "val intro_llist_cons (#a:Type0) (ptr1 ptr2:t a)\n : Steel unit (vptr ptr1 `star` llist ptr2)\n (fun _ -> llist ptr1)\n (requires fun h -> next (sel ptr1 h) == ptr2)\n (ensures fun h0 _ h1 -> v_llist ptr1 h1 == (data (sel ptr1 h0)) :: v_llist ptr2 h0)\nlet intro_llist_cons\n #a ptr1 ptr2\n=\n llist0_of_llist ptr2;\n let n = nllist_of_llist0 ptr2 in\n (* set the fuel of the new cons cell *)\n let c = read ptr1 in\n let c' = {c with tail_fuel = n} in\n write ptr1 c' ;\n (* actually cons the cell *)\n vptr_not_null ptr1;\n intro_vdep\n (vptr ptr1)\n (nllist a n ptr2)\n (llist_vdep ptr1);\n intro_vrewrite\n (vptr ptr1 `vdep` llist_vdep ptr1)\n (llist_vrewrite ptr1);\n change_equal_slprop\n ((vptr ptr1 `vdep` llist_vdep ptr1) `vrewrite` llist_vrewrite ptr1)\n (llist0 ptr1);\n llist_of_llist0 ptr1", "val intro_llist_cons (#a:Type0) (ptr1 ptr2:t a)\n : Steel unit (vptr ptr1 `star` llist ptr2)\n (fun _ -> llist ptr1)\n (requires fun h -> next (sel ptr1 h) == ptr2)\n (ensures fun h0 _ h1 -> v_llist ptr1 h1 == (data (sel ptr1 h0)) :: v_llist ptr2 h0)\nlet intro_llist_cons ptr1 ptr2 =\n let h = get () in\n let x = hide (sel ptr1 h) in\n let l = hide (v_llist ptr2 h) in\n reveal_star (vptr ptr1) (llist ptr2);\n change_slprop (vptr ptr1 `star` llist ptr2) (llist ptr1) (reveal x, reveal l) (data x :: l) (fun m -> intro_cons_lemma ptr1 ptr2 x l m)", "val test0:unit\nlet test0 :unit =\n assert (includes (hide [(0, 1, false) ; (1, 0, false)]) (hide [(2, 2, false); (0, 1, false); (1, 0, false)]))", "val test: Prims.unit -> HoareST int (fun _ -> True) (fun _ r _ -> r == 1)\nlet test () : HoareST int (fun _ -> True) (fun _ r _ -> r == 1)\n= f 0", "val read : #a:Type -> \n r:ref a -> \n\t AllocST a (fun h0 -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t contains r h1 /\\ \n\t\t\t\t sel h1 r == x)\nlet read #a r =\n let h = ist_get () in\n ist_recall (contains r); //recalling that the current heap must contain the given reference\n sel h r", "val intro_llist_cons (#a:Type0) (ptr1 ptr2:t a) (r:ref a)\n : Steel unit (vptr ptr1 `star` vptr r `star` llist_ptr ptr2)\n (fun _ -> llist_ptr ptr1)\n (requires fun h -> data (sel ptr1 h) == r /\\ next (sel ptr1 h) == ptr2)\n (ensures fun h0 _ h1 -> v_ptrlist ptr1 h1 == (sel r h0) :: v_ptrlist ptr2 h0)\nlet intro_llist_cons (#a:Type0) (ptr1 ptr2:t a) (r:ref a)\n : Steel unit (vptr ptr1 `star` vptr r `star` llist_ptr ptr2)\n (fun _ -> llist_ptr ptr1)\n (requires fun h -> data (sel ptr1 h) == r /\\ next (sel ptr1 h) == ptr2)\n (ensures fun h0 _ h1 -> v_ptrlist ptr1 h1 == (sel r h0) :: v_ptrlist ptr2 h0)\n = let x = gget (vptr ptr1) in\n let v = gget (vptr r) in\n let l = gget (llist_ptr ptr2) in\n change_slprop (vptr ptr1 `star` llist_ptr ptr2 `star` vptr r) (llist_ptr ptr1)\n ((reveal x, reveal l), reveal v)\n (reveal v :: l)\n (fun m ->\n intro_cons_lemma ptr1 x v l m)", "val test8 (l: list int) : HoareST int (fun _ -> Cons? l /\\ Cons?.hd l > 0) (fun _ _ _ -> True)\nlet test8 (l:list int)\n: HoareST int (fun _ -> Cons? l /\\ Cons?.hd l > 0) (fun _ _ _ -> True)\n= match l with\n | hd::_ -> test7 hd", "val test2_data:lbytes 28\nlet test2_data : lbytes 28 =\n let l = List.Tot.map u8_from_UInt8 [\n 0x77uy; 0x68uy; 0x61uy; 0x74uy; 0x20uy; 0x64uy; 0x6fuy; 0x20uy;\n 0x79uy; 0x61uy; 0x20uy; 0x77uy; 0x61uy; 0x6euy; 0x74uy; 0x20uy;\n 0x66uy; 0x6fuy; 0x72uy; 0x20uy; 0x6euy; 0x6fuy; 0x74uy; 0x68uy;\n 0x69uy; 0x6euy; 0x67uy; 0x3fuy\n ] in\n assert_norm (List.Tot.length l == 28);\n of_list l", "val test: unit -> ST (Int32.t) (fun _ -> true) (fun _ _ _ -> true)\nlet test () =\n let l: B.pointer_or_null (t Int32.t) = B.malloc HS.root B.null 1ul in\n let l_region = new_region HS.root in\n push #Int32.t l_region (G.hide []) l 1l;\n push #Int32.t l_region (G.hide [1l]) l 0l;\n let r = pop #Int32.t l_region (G.hide [0l; 1l]) l in\n TestLib.checku32 (length (G.hide [1l]) !*l) 1ul;\n r", "val trace (s: string) : ST unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1)) =\n if DebugFlags.debug_Record then print else (fun _ -> ())", "val trace (s: string) : ST unit (requires (fun _ -> True)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet trace: s:string -> ST unit\n (requires (fun _ -> True))\n (ensures (fun h0 _ h1 -> h0 == h1)) =\n if DebugFlags.debug_Epochs then print else (fun _ -> ())", "val read (l: loc)\n : HIFC int (single l) bot [] (requires fun _ -> True) (ensures fun s0 x s1 -> x == sel s0 l)\nlet read (l:loc)\n : HIFC int (single l) bot []\n (requires fun _ -> True)\n (ensures fun s0 x s1 -> x == sel s0 l)\n = HIFC?.reflect (iread l)", "val create2: #a:Type -> x0:a -> x1:a -> lseq a 2\nlet create2 #a x0 x1 =\n let l = [x0; x1] in\n assert_norm (List.Tot.length l = 2);\n createL l", "val test (m: UInt64.t) (l: UInt32.t) (#r #s: _) (x: LB.mbuffer bool r s {LB.len x = l})\n : Stack unit (requires (fun h0 -> LB.live h0 x)) (ensures (fun h0 _ h1 -> h0 == h1))\nlet test (m:UInt64.t) (l:UInt32.t) (#r:_) (#s:_) (x:LB.mbuffer bool r s{LB.len x = l})\n : Stack unit\n (requires (fun h0 -> LB.live h0 x))\n (ensures (fun h0 _ h1 -> h0 == h1))\n = printf \"Hello %b Low* %uL Printf %xb %s\"\n true //%b boolean\n m //%uL u64\n l x //%xb (buffer bool)\n \"bye\"\n done", "val test_if10 (b: bool) (r1 r2 r3: ref)\n : SteelT unit\n (((ptr r1) `star` (ptr r2)) `star` (ptr r3))\n (fun _ -> ((ptr r1) `star` (ptr r2)) `star` (ptr r3))\nlet test_if10 (b:bool) (r1 r2 r3: ref) : SteelT unit\n (ptr r1 `star` ptr r2 `star` ptr r3)\n (fun _ -> ptr r1 `star` ptr r2 `star` ptr r3)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0" ], "closest_src": [ { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test2" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test3" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test7" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test9" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test2" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test3_1" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test6" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test5" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test4" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test3" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test8" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test3_lab" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test9" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test7" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.refine_test9" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test6" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.test15" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.refine_test8" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test3_lab" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test3_1" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test4" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test5" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.test15" }, { "project_name": "FStar", "file_name": "ImmutableBuffer.fst", "name": "ImmutableBuffer.test" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test2" }, { "project_name": "FStar", "file_name": "StatefulLens.fst", "name": "StatefulLens.test2" }, { "project_name": "FStar", "file_name": "ImmutableBuffer.fst", "name": "ImmutableBuffer.test2" }, { "project_name": "FStar", "file_name": "StatefulLens.fst", "name": "StatefulLens.test1" }, { "project_name": "FStar", "file_name": "StatefulLens.fst", "name": "StatefulLens.test4" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_ite2" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fst", "name": "FStar.Monotonic.HyperHeap.test1" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.test26" }, { "project_name": "FStar", "file_name": "StatefulLens.fst", "name": "StatefulLens.test0" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test8" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test0" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test2" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.test6" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test4" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test5" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test6" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.read" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test2" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test1" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.test2" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test3" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if8" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test2" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Seq.fst", "name": "FStar.Monotonic.Seq.test0" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if2" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if7" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test1" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_ite" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.invariant" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test0" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test8" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test4" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.test1" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fst", "name": "FStar.HyperStack.ST.witness_hsref" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.fst", "name": "LowParse.Low.Base.comment" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test6" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test4" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.Test.fst", "name": "Spec.Ed25519.Test.test2_msg" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.get" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if10" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test5" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.iwrite" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test2" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.write" }, { "project_name": "FStar", "file_name": "LowStar.Printf.fst", "name": "LowStar.Printf.test2" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test5" }, { "project_name": "FStar", "file_name": "WithLocal.fst", "name": "WithLocal.test" }, { "project_name": "FStar", "file_name": "Tests.fst", "name": "Tests.test2" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.valid" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.test1" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.read" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if8" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test3" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if7" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_ite_g2" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if9" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.intro_llist_cons" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.intro_llist_cons" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.intro_llist_cons" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fst", "name": "FStar.Monotonic.HyperHeap.test0" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.test" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.read" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.intro_llist_cons" }, { "project_name": "FStar", "file_name": "TestHoareST.fst", "name": "TestHoareST.test8" }, { "project_name": "hacl-star", "file_name": "Spec.HMAC.Test.fst", "name": "Spec.HMAC.Test.test2_data" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.test" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Record.fsti", "name": "MiTLS.Record.trace" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Old.Epochs.fsti", "name": "MiTLS.Old.Epochs.trace" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.read" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.create2" }, { "project_name": "FStar", "file_name": "LowStar.Printf.fst", "name": "LowStar.Printf.test" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if10" } ], "selected_premises": [ "OPLSS2021.IFC.test", "OPLSS2021.IFC.lref", "OPLSS2021.IFC.href", "OPLSS2021.IFC.ref", "FStar.Preorder.preorder_rel", "OPLSS2021.IFC.return", "OPLSS2021.IFC.label_equiv", "OPLSS2021.IFC.bot", "OPLSS2021.IFC.memP_append_or", "FStar.Preorder.stable", "OPLSS2021.IFC.low", "OPLSS2021.IFC.label", "OPLSS2021.IFC.flow", "OPLSS2021.IFC.flows_equiv_append", "OPLSS2021.IFC.flows", "OPLSS2021.IFC.has_flow", "OPLSS2021.IFC.upd", "OPLSS2021.IFC.union", "FStar.Preorder.reflexive", "OPLSS2021.IFC.writes_ok", "OPLSS2021.IFC.single", "OPLSS2021.IFC.sel", "OPLSS2021.IFC.add_source_bot", "OPLSS2021.IFC.has_flow_1", "FStar.Pervasives.st_post_h", "OPLSS2021.IFC.ist", "OPLSS2021.IFC.label_inclusion", "FStar.Preorder.transitive", "OPLSS2021.IFC.subcomp", "OPLSS2021.IFC.does_not_read_loc_v", "FStar.Pervasives.Native.fst", "OPLSS2021.IFC.comp", "OPLSS2021.IFC.add_source_monotonic", "OPLSS2021.IFC.flows_included_in", "OPLSS2021.IFC.append_nil_r", "OPLSS2021.IFC.flows_equiv", "OPLSS2021.IFC.reads_ok", "FStar.Pervasives.Native.snd", "OPLSS2021.IFC.triple", "OPLSS2021.IFC.add_source", "OPLSS2021.IFC.flows_included_append", "FStar.Pervasives.st_return", "OPLSS2021.IFC.elim_has_flow_seq", "OPLSS2021.IFC.has_flow_soundness", "FStar.Pervasives.id", "OPLSS2021.IFC.no_leakage", "OPLSS2021.IFC.read", "OPLSS2021.IFC.respects_flows", "OPLSS2021.IFC.iread", "OPLSS2021.IFC.does_not_read_loc", "OPLSS2021.IFC.havoc", "FStar.Pervasives.st_pre_h", "FStar.Calc.calc_chain_related", "FStar.Pervasives.st_post_h'", "Prims.returnM", "OPLSS2021.IFC.tot", "OPLSS2021.IFC.no_leakage_k", "Prims.pure_pre", "FStar.Pervasives.all_return", "OPLSS2021.IFC.has_flow_append", "OPLSS2021.IFC.iwrite", "FStar.Pervasives.st_trivial", "OPLSS2021.IFC.lift_tot", "FStar.Pervasives.all_pre_h", "OPLSS2021.IFC.write", "OPLSS2021.IFC.bind_comp_no_leakage", "FStar.Pervasives.all_post_h", "OPLSS2021.IFC.bind_comp", "FStar.Calc.calc_chain_compatible", "FStar.Pervasives.ex_pre", "FStar.Pervasives.pure_return", "Prims.pow2", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.st_wp_h", "Prims.__cache_version_number__", "FStar.Pervasives.dfst", "OPLSS2021.IFC.bind", "FStar.Pervasives.st_stronger", "Prims.pure_post'", "FStar.Pervasives.ex_post'", "FStar.Map.const_on", "FStar.Pervasives.ex_post", "FStar.Pervasives.all_trivial", "FStar.Pervasives.trivial_pure_post", "OPLSS2021.IFC.unit_triple", "OPLSS2021.IFC.triple_equiv", "OPLSS2021.IFC.add_sink", "FStar.Pervasives.coerce_eq", "OPLSS2021.IFC.comp_triple", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.st_if_then_else", "Prims.subtype_of", "Prims.pure_post", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_stronger", "OPLSS2021.IFC.loc", "OPLSS2021.IFC.bind_comp_reads_ok", "FStar.Pervasives.ex_return", "Prims.op_Hat", "FStar.Pervasives.dsnd" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule OPLSS2021.IFC\nopen FStar.List.Tot\nopen FStar.Set\nopen FStar.Map\n\n(* This module defines another abstraction for reasoning about\n information flows in stateful computations reading and writing to\n an integer store.\n\n The main computation type it defines at the end is `IST a w r fs`,\n where\n - `a` is the result type\n - `w` is the set of memory locations written\n - `r` is the set of memory locations read\n - `fs` is a set of flows, ordered pairs of sets of locations\n between bounding the information flows in the program\n\n The point is to illustrate that you can choose whatever abstraction\n you like to reason about your programs, not necessarily a Hoare\n logic.\n\n This turns out to be an instance of Katsumata's graded monads.\n\n Read more about it in this paper:\n https://www.fstar-lang.org/papers/layeredeffects/\n*)\n\n/// The type of memory locations\nlet loc = int\n\n/// A store itself is a total map from locations to integers\nlet store = m:Map.t loc int{forall l. contains m l}\n\n/// Two functions to read and write the store\nlet sel (s:store) (l:loc) : int = Map.sel s l\nlet upd (s:store) (l:loc) (x:int) : store = Map.upd s l x\n\n/// Our abstraction to reason about information flows is based on\n/// labels, sets of memory locations\nlet label = Set.set loc\n\n/// An ordering on labels, just set inclusion\nlet label_inclusion (l0 l1:label) = Set.subset l0 l1\n\n/// A bottom for the label lattice\nlet bot : label = Set.empty\n\n/// A singleton label\nlet single (l:loc) : label = Set.singleton l\n\n/// A join for our lattice: just set union\nlet union (l0 l1:label) = Set.union l0 l1\n\n/// comp a: A computation monad representing our stateful computations\nlet comp a = store -> a & store\n\n/// havoc, or mess up, a single memory location in s by updating it\nlet havoc s l x = upd s l x\n\n/// Now, we're going to have to (slowly) define what it means for a\n/// program to have or not have certain kinds of information flows.\n\n/// Defining what it means for f's mutations to be confined to\n/// `writes` is easy\n/// -- all locations not in writes do not change\nlet writes_ok #a (f:comp a) (writes:Set.set loc) =\n forall (l:loc). ~(Set.mem l writes) ==>\n (forall (s0:store).\n let x1, s0' = f s0 in\n sel s0 l == sel s0' l)\n\n/// Definiting what it means for `f` to not read a location `l`\n/// is trickier. It involves a \"relational\" property, relating\n/// multiple executions of `f`\nlet does_not_read_loc_v #a (f:comp a) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in //s0 and s0' agree except on l\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in // run f twice, once on s0, once on s0'\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same in both runs\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))\n\n/// does_not_read_loc: Lifting the prior property to all values for\n/// the havoc'd location l\nlet does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v\n\n/// A reads label is ok for `f` if it is a bound on the set of\n/// locations that `f` reads\nlet reads_ok #a (f:comp a) (reads:label) =\n forall (l:loc) (s:store). ~(Set.mem l reads) ==> does_not_read_loc f l s\n\n/// Now for the flows index\nlet flow = label & label //from, to\nlet flows = list flow\n\n/// `has_flow from to fs` defines when the edge `from -> to` is includes in\n/// the flows `fs`\nlet has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f\nlet has_flow (from to:loc) (fs:flows) = exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs\n\n/// Now, as with reads and writes, we have to give an interpretation\n/// to flows tying it to the computational representation\n\n/// `f` leaks no info along the flow edge `from -> to`\n/// --- This is a textbook definition of noninterference\nlet no_leakage_k #a (f:comp a) (from to:loc) (k:int) =\n forall s0.{:pattern (havoc s0 from k)}\n sel (snd (f s0)) to == sel (snd (f (havoc s0 from k))) to\nlet no_leakage #a (f:comp a) (from to:loc) = forall k. no_leakage_k f from to k\n/// A computation `f` respects all the flows in `fs`\n/// if it there is no leakage along any of the flow-edges in `f`\nlet respects_flows #a (f:comp a) (fs:flows) =\n forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to\n\n/// Now, we can define our representation type, a refinement of the\n/// comp type where the refinement \"gives a meaning\" to the labels\n/// involved\nlet ist a (writes:label) (reads:label) (fs:flows) =\n f:comp a {\n reads_ok f reads /\\\n writes_ok f writes /\\\n respects_flows f fs\n }\n\n/// Now, proving that this representation is stable is going to take\n/// some work.\n\n/// Some basic actions to read and write and a return are easy enough\nlet iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s\nlet iwrite (l:loc) (x:int) : ist unit (single l) bot [] = fun s -> (), upd s l x\nlet return (a:Type) (x:a) : ist a bot bot [] = fun s -> x,s\n\n/// But, proving that ist computations can be sequentially composed is\n/// a bit challenging\n\n/// First, some auxiliary notions defining a small algebra on flows\nlet add_source (r:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> union r r0, w0) fs\nlet add_sink (w:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> r0, union w w0) fs\nlet flows_included_in (fs0 fs1:flows) =\n forall f0. f0 `List.Tot.memP` fs0 ==>\n (forall from to. has_flow_1 from to f0 /\\ from <> to ==> (exists f1. f1 `List.Tot.memP` fs1 /\\ has_flow_1 from to f1))\nlet flows_equiv (fs0 fs1:flows) = fs0 `flows_included_in` fs1 /\\ fs1 `flows_included_in` fs0\nlet flows_equiv_refl fs\n : Lemma (fs `flows_equiv` fs)\n = ()\nlet flows_equiv_trans fs0 fs1 fs2\n : Lemma (fs0 `flows_equiv` fs1 /\\ fs1 `flows_equiv` fs2 ==> fs0 `flows_equiv` fs2)\n = ()\nlet flows_included_in_union_distr_dest (a b c:label)\n : Lemma (flows_equiv [a, union b c] [a, b; a, c])\n = ()\nlet flows_included_in_union_distr_src (a b c:label)\n : Lemma (flows_equiv [union a b, c] [a, c; b, c])\n = ()\nlet flows_included_in_union (a b c:label)\n : Lemma (flows_equiv ([a, union b c; union a b, c])\n ([a, b; union a b, c]))\n = ()\n\n\n\nlet bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1\n\nlet bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x l s0);\n assert (does_not_read_loc_v x l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()\n\nlet bind_comp_writes_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (writes_ok (bind_comp x y) (union w0 w1))\n = ()\n\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1\n\nlet has_flow_append (from to:loc) (fs fs':flows)\n : Lemma (has_flow from to fs ==>\n has_flow from to (fs @ fs') /\\\n has_flow from to (fs' @ fs))\n = let rec aux (rs:_)\n : Lemma (requires\n List.Tot.memP rs fs)\n (ensures\n List.Tot.memP rs (fs @ fs') /\\\n List.Tot.memP rs (fs' @ fs))\n [SMTPat (List.Tot.memP rs fs)]\n = memP_append_or rs fs fs';\n memP_append_or rs fs' fs\n in\n ()\n\nlet elim_has_flow_seq (from to:loc)\n (r0 r1 w1:label)\n (fs0 fs1:flows)\n : Lemma (requires (~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1)))))\n (ensures (~(has_flow from to fs0) /\\\n (~(Set.mem from r0) \\/ ~(Set.mem to w1)) /\\\n ~(has_flow from to (add_source r0 fs1))))\n = assert (add_source r0 ((bot, w1)::fs1) ==\n (Set.union r0 bot, w1)::add_source r0 fs1);\n assert (Set.union r0 bot `Set.equal` r0);\n has_flow_append from to fs0 ((r0, w1)::add_source r0 fs1);\n assert (~(has_flow from to fs0));\n has_flow_append from to ((r0, w1)::add_source r0 fs1) fs0;\n assert (~(has_flow from to (((r0, w1)::add_source r0 fs1))));\n assert ((r0, w1)::add_source r0 fs1 ==\n [r0, w1] @ add_source r0 fs1);\n has_flow_append from from [r0, w1] (add_source r0 fs1)\n\nlet rec add_source_monotonic (from to:loc) (r:label) (fs:flows)\n : Lemma (has_flow from to fs ==> has_flow from to (add_source r fs))\n = match fs with\n | [] -> ()\n | _::tl -> add_source_monotonic from to r tl\n\nlet has_flow_soundness #a #r #w #fs (f:ist a r w fs)\n (from to:loc) (s:store) (k:int)\n : Lemma (requires\n (let x, s1 = f s in\n let _, s1' = f (havoc s from k) in\n from <> to /\\\n sel s1 to <> sel s1' to))\n (ensures has_flow from to fs)\n = let aux ()\n : Lemma (requires (~(has_flow from to fs)))\n (ensures False)\n [SMTPat ()]\n = assert (respects_flows f fs);\n assert (no_leakage f from to)\n in\n ()\n\nlet bind_comp_no_leakage (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n (from to:loc)\n (s0:store) (k:_)\n : Lemma\n (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1))))\n (ensures (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\n = let f = bind_comp x y in\n assert (reads_ok x r0);\n let s0' = havoc s0 from k in\n let _, s2f = f s0 in\n let _, s2f' = f s0' in\n let flows = (fs0 @ add_source r0 ((r1, w1)::fs1)) in\n let v0, s1 = x s0 in\n let v0', s1' = x s0' in\n elim_has_flow_seq from to r0 r1 w1 fs0 fs1;\n assert (~(has_flow from to fs0));\n assert (respects_flows x fs0);\n assert (no_leakage x from to);\n assert (sel s1 to == sel s1' to);\n let _, s2 = y v0 s1 in\n let _, s2' = y v0' s1' in\n assert (s2 == s2f);\n assert (s2' == s2f');\n //Given: (from not-in r0 U r1) \\/ (to not-in w1)\n //suppose (from in r0) \\/ (from in r1)\n // them to not-in w1\n //suppose (from not-in r0 U r1)\n //then v0 = v0'\n // s1' = havoc from s1 k\n // s2 to = s2' to\n if Set.mem to w1\n then begin\n assert (~(Set.mem from r0));\n assert (reads_ok x r0);\n assert (does_not_read_loc x from s0);\n assert (does_not_read_loc_v x from s0 k);\n assert (v0 == v0');\n assert (forall l. l <> from ==> sel s1 l == sel s1' l);\n assert (Map.equal s1' (havoc s1 from k) \\/ Map.equal s1' s1);\n if (sel s1 from = sel s1' from)\n then begin\n assert (Map.equal s1 s1')\n end\n else begin\n assert (Map.equal s1' (havoc s1 from k));\n assert (reads_ok (y v0) r1);\n if (sel s2 to = sel s2' to)\n then ()\n else begin\n assert (sel s2 to <> sel s1 to \\/ sel s2' to <> sel s1' to);\n has_flow_soundness (y v0) from to s1 k;\n assert (has_flow from to fs1);\n add_source_monotonic from to r0 fs1\n //y reads from and writes to, so (from, to) should be in fs1\n //so, we should get a contradiction\n end\n end\n end\n else //to is not in w1, so y does not write it\n ()\n\nlet bind_comp_flows_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1)::fs1)))\n = let f = bind_comp x y in\n let flows = (fs0 @ add_source r0 ((bot, w1)::fs1)) in\n let respects_flows_lemma (from to:loc)\n : Lemma (requires from <> to /\\ ~(has_flow from to flows))\n (ensures no_leakage f from to)\n [SMTPat (no_leakage f from to)]\n = let aux (s0:store) (k:_)\n : Lemma (let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to)\n [SMTPat (havoc s0 from k)]\n = bind_comp_no_leakage x y from to s0 k\n in\n ()\n in\n ()\n\nlet triple = label & label & flows\nlet unit_triple = bot, bot, []\nlet comp_triple (w0, r0, fs0) (w1, r1, fs1) = (union w0 w1, union r0 r1, (fs0 @ add_source r0 ((bot, w1)::fs1)))\n\nlet label_equiv (s0 s1:label) = Set.equal s0 s1\nlet triple_equiv (w0, r0, f0) (w1, r1, f1) = label_equiv w0 w1 /\\ label_equiv r0 r1 /\\ flows_equiv f0 f1\nlet triple_equiv_refl t0\n : Lemma (triple_equiv t0 t0)\n = ()\nlet rec add_source_bot (f:flows)\n : Lemma (add_source bot f `flows_equiv` f)\n = match f with\n | [] -> ()\n | _::tl -> add_source_bot tl\nlet left_unit (w, r, f) =\n assert (Set.equal (union bot bot) bot);\n add_source_bot f;\n assert (comp_triple unit_triple (w, r, f) `triple_equiv` (w, r, f))\nlet flows_included_append (f0 f1 g0 g1:flows)\n : Lemma (requires flows_included_in f0 g0 /\\\n flows_included_in f1 g1)\n (ensures flows_included_in (f0@f1) (g0@g1))\n = let aux (f:_) (from to:_)\n : Lemma (requires List.Tot.memP f (f0@f1) /\\\n from <> to /\\\n has_flow_1 from to f)\n (ensures (exists g. g `List.Tot.memP` (g0@g1) /\\ has_flow_1 from to g))\n [SMTPat (has_flow_1 from to f)]\n = memP_append_or f f0 f1;\n assert (exists g. g `List.Tot.memP` g0 \\/ g `List.Tot.memP` g1 /\\ has_flow_1 from to g);\n FStar.Classical.forall_intro (fun g -> memP_append_or g g0 g1)\n in\n ()\nlet flows_equiv_append (f0 f1 g0 g1:flows)\n : Lemma (requires flows_equiv f0 g0 /\\ flows_equiv f1 g1)\n (ensures flows_equiv (f0@f1) (g0@g1))\n = flows_included_append f0 f1 g0 g1;\n flows_included_append g0 g1 f0 f1\nlet rec append_nil_r #a (l:list a)\n : Lemma (l @ [] == l)\n = match l with\n | [] -> ()\n | _::tl -> append_nil_r tl\nlet right_unit (w, r, f) =\n calc (==) {\n comp_triple (w, r, f) unit_triple;\n (==) { }\n (w `union` bot, r `union` bot, f @ add_source r ((bot, bot)::[]));\n };\n assert (flows_equiv (add_source r [(bot, bot)]) []);\n flows_equiv_append f (add_source r [(bot, bot)]) f [];\n append_nil_r f;\n assert (comp_triple (w, r, f) unit_triple `triple_equiv` (w, r, f))\nopen FStar.Calc\nlet assoc_comp (w0, r0, fs0) (w1, r1, fs1) (w2, r2, fs2) =\n calc (==) {\n comp_triple (w0, r0, fs0) (comp_triple (w1, r1, fs1) (w2, r2, fs2)) ;\n (==) { }\n comp_triple (w0, r0, fs0) (union w1 w2, union r1 r2, (fs1 @ add_source r1 ((bot, w2)::fs2)));\n (==) { }\n (union w0 (union w1 w2), union r0 (union r1 r2), fs0 @ (add_source r0 ((bot, union w1 w2) :: (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { assert (forall w0 w1 w2. Set.equal (union w0 (union w1 w2)) (union (union w0 w1) w2)) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n fs0 @ (add_source r0 ((bot, union w1 w2) :: (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n (fs0 @ ((union r0 bot, union w1 w2) :: add_source r0 (fs1 @ add_source r1 ((bot, w2)::fs2)))));\n (==) { assert (forall s. Set.equal (union s bot) s) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n (fs0 @ ((r0, union w1 w2) :: add_source r0 (fs1 @ (r1, w2) ::add_source r1 fs2))));\n };\n calc (==) {\n comp_triple (comp_triple (w0, r0, fs0) (w1, r1, fs1)) (w2, r2, fs2);\n (==) { }\n comp_triple (union w0 w1, union r0 r1, (fs0 @ add_source r0 ((bot, w1)::fs1))) (w2, r2, fs2);\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ add_source r0 ((bot, w1)::fs1)) @ (add_source (union r0 r1) ((bot, w2) :: fs2))));\n (==) { }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ ((union r0 bot, w1)::add_source r0 fs1)) @ ((union (union r0 r1) bot, w2) :: add_source (union r0 r1) fs2)));\n (==) { assert (forall s. Set.equal (union s bot) s) }\n (union (union w0 w1) w2,\n union (union r0 r1) r2,\n ((fs0 @ ((r0, w1)::add_source r0 fs1)) @ ((union r0 r1, w2) :: add_source (union r0 r1) fs2)));\n }\n\n/// But, here, we have it:\nlet bind (a b:Type)\n (w0 r0 w1 r1:label) (fs0 fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : ist b\n (union w0 w1) // union the writes\n (union r0 r1) // union the reads\n (fs0 @ // flows of x\n add_source r0 ((bot, w1) // plus flows from whatever x reads to whatever y writes\n ::fs1)) //plus the flows of y\n = let f = fun s0 -> let v, s1 = x s0 in y v s1 in\n bind_comp_reads_ok x y;\n bind_comp_reads_ok x y;\n bind_comp_flows_ok x y;\n f\n\n/// A subsumption rule to weaken the labels\nlet subcomp (a:Type) (w0 r0 w1 r1:label) (fs0 fs1:flows) (f:ist a w0 r0 fs0)\n : Pure (ist a w1 r1 fs1)\n (requires label_inclusion w0 w1 /\\\n label_inclusion r0 r1 /\\\n fs0 `flows_included_in` fs1)\n (fun _ -> True)\n = let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l r1)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k :_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = f s0 in\n let v', s1' = f (havoc s0 l k) in\n assert (does_not_read_loc f l s0);\n assert (v == v');\n assert (not (Set.mem l w0) ==> sel s1' l = k);\n assert (not (Set.mem l w1) ==> sel s1' l = k);\n ()\n in\n ()\n in\n f\n\n/// Package it up as an effect\nreflectable\nlayered_effect {\n IST : a:Type ->\n w:label ->\n w:label ->\n fs:flows ->\n Effect\n with\n repr = ist;\n return = return;\n bind = bind;\n subcomp = subcomp\n}\nlet read (l:loc) : IST int bot (single l) [] = IST?.reflect (iread l)\nlet write (l:loc) (x:int) : IST unit (single l) bot [] = IST?.reflect (iwrite l x)\n\nlet tot a = unit -> Tot a\nlet lift_tot (a:Type) (x:tot a)\n : ist a bot bot []\n = return a (x())\nsub_effect PURE ~> IST = lift_tot\n\n////////////////////////////////////////////////////////////////////////////////\n// Now for some examples\n////////////////////////////////////////////////////////////////////////////////\nlet ref (l:label) = r:loc {r `Set.mem` l}\nassume val high : label\nlet low : label = Set.complement high\nlet lref = ref low\nlet href = ref high\n\nlet test (l:lref) (h:href)\n : IST unit (union bot (single h))\n (union (single l) bot)\n (add_source (single l) [bot, single h])\n = let x = read l in\n write h x\n", "sketch": [ "The `test2` function is implemented as follows:\n1. It reads from the low label location `l`.\n2. It writes the value read to the high label location `h`.\n3. The information flow is confined from the low label to the high label, ensuring that the flow is from `l` to `h`.\n\n```fstar\nval test2 (l: lref) (h: href) : IST unit (single h) (single l) [single l, single h] =\n let x = read l in\n write h x\n```" ], "generated_solution": [] }, { "file_name": "FStar.Int16.fsti", "name": "FStar.Int16.op_Percent_Hat", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "open": "FStar.Int" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 0, "initial_ifuel": 1, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let op_Percent_Hat = rem", "source_range": { "start_line": 125, "start_col": 7, "end_line": 125, "end_col": 31 }, "interleaved": false, "definition": "FStar.Int16.rem", "effect": "Prims.Pure", "effect_flags": [], "mutual_with": [], "premises": [ "FStar.Int16.rem" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t", "prompt": "let op_Percent_Hat =\n ", "expected_response": "rem", "source": { "project_name": "FStar", "file_name": "ulib/FStar.Int16.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Int16.fsti", "checked_file": "dataset/FStar.Int16.fsti.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.UInt.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Int.fsti.checked" ] }, "definitions_in_context": [ "let n = 16", "val t : eqtype", "val v (x:t) : Tot (int_t n)", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))", "val uv_inv (x : t) : Lemma\n (ensures (int_to_t (v x) == x))\n [SMTPat (v x)]", "val vu_inv (x : int_t n) : Lemma\n (ensures (v (int_to_t x) == x))\n [SMTPat (int_to_t x)]", "val v_inj (x1 x2: t): Lemma\n (requires (v x1 == v x2))\n (ensures (x1 == x2))", "val zero : x:t{v x = 0}", "val one : x:t{v x = 1}", "val add (a:t) (b:t) : Pure t\n (requires (size (v a + v b) n))\n (ensures (fun c -> v a + v b = v c))", "val sub (a:t) (b:t) : Pure t\n (requires (size (v a - v b) n))\n (ensures (fun c -> v a - v b = v c))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))", "val div (a:t) (b:t{v b <> 0}) : Pure t\n // division overflows on INT_MIN / -1\n (requires (size (v a / v b) n))\n (ensures (fun c -> v a / v b = v c))", "val rem (a:t) (b:t{v b <> 0}) : Pure t\n (requires (size (v a / v b) n))\n (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))", "val logand (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logand` v y = v z))", "val logxor (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logxor` v y == v z))", "val logor (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logor` v y == v z))", "val lognot (x:t) : Pure t\n (requires True)\n (ensures (fun z -> lognot (v x) == v z))", "val shift_right (a:t) (s:UInt32.t) : Pure t\n (requires (0 <= v a /\\ UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))", "val shift_left (a:t) (s:UInt32.t) : Pure t\n (requires (0 <= v a /\\ v a * pow2 (UInt32.v s) <= max_int n /\\ UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))", "val shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t\n (requires (UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))", "let eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)", "let gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)", "let gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)", "let lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)", "let lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)", "let op_Plus_Hat = add", "let op_Subtraction_Hat = sub", "let op_Star_Hat = mul", "let op_Slash_Hat = div" ], "closest": [ "val FStar.UInt16.op_Percent_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t{FStar.UInt16.v b <> 0} -> Prims.Pure FStar.UInt16.t\nlet op_Percent_Hat = rem", "val FStar.Int32.op_Percent_Hat = a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t\nlet op_Percent_Hat = rem", "val FStar.Int8.op_Percent_Hat = a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t\nlet op_Percent_Hat = rem", "val FStar.Int128.op_Percent_Hat = a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t\nlet op_Percent_Hat = rem", "val FStar.Int64.op_Percent_Hat = a: FStar.Int64.t -> b: FStar.Int64.t{FStar.Int64.v b <> 0} -> Prims.Pure FStar.Int64.t\nlet op_Percent_Hat = rem", "val FStar.UInt32.op_Percent_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t\nlet op_Percent_Hat = rem", "val FStar.UInt16.op_Plus_Percent_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Plus_Percent_Hat = add_mod", "val FStar.UInt16.op_Star_Percent_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Star_Percent_Hat = mul_mod", "val FStar.UInt64.op_Percent_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t{FStar.UInt64.v b <> 0} -> Prims.Pure FStar.UInt64.t\nlet op_Percent_Hat = rem", "val FStar.UInt8.op_Percent_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t{FStar.UInt8.v b <> 0} -> Prims.Pure FStar.UInt8.t\nlet op_Percent_Hat = rem", "val FStar.UInt16.op_Subtraction_Percent_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Subtraction_Percent_Hat = sub_mod", "val FStar.UInt32.op_Star_Percent_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Star_Percent_Hat = mul_mod", "val FStar.UInt32.op_Plus_Percent_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Plus_Percent_Hat = add_mod", "val FStar.UInt64.op_Star_Percent_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Star_Percent_Hat = mul_mod", "val FStar.UInt64.op_Plus_Percent_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Plus_Percent_Hat = add_mod", "val FStar.UInt128.op_Plus_Percent_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Plus_Percent_Hat = add_mod", "val FStar.UInt8.op_Plus_Percent_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Plus_Percent_Hat = add_mod", "val FStar.UInt32.op_Subtraction_Percent_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Subtraction_Percent_Hat = sub_mod", "val FStar.UInt8.op_Star_Percent_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Star_Percent_Hat = mul_mod", "val FStar.UInt8.op_Subtraction_Percent_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Subtraction_Percent_Hat = sub_mod", "val FStar.UInt16.op_Slash_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t{FStar.UInt16.v b <> 0} -> Prims.Pure FStar.UInt16.t\nlet op_Slash_Hat = div", "val FStar.UInt128.op_Subtraction_Percent_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Subtraction_Percent_Hat = sub_mod", "val FStar.UInt64.op_Subtraction_Percent_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Subtraction_Percent_Hat = sub_mod", "val FStar.Int32.op_Slash_Hat = a: FStar.Int32.t -> b: FStar.Int32.t{FStar.Int32.v b <> 0} -> Prims.Pure FStar.Int32.t\nlet op_Slash_Hat = div", "val FStar.Int8.op_Slash_Hat = a: FStar.Int8.t -> b: FStar.Int8.t{FStar.Int8.v b <> 0} -> Prims.Pure FStar.Int8.t\nlet op_Slash_Hat = div", "val FStar.Int128.op_Slash_Hat = a: FStar.Int128.t -> b: FStar.Int128.t{FStar.Int128.v b <> 0} -> Prims.Pure FStar.Int128.t\nlet op_Slash_Hat = div", "val FStar.UInt16.op_Star_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Star_Hat = mul", "val FStar.Int64.op_Slash_Hat = a: FStar.Int64.t -> b: FStar.Int64.t{FStar.Int64.v b <> 0} -> Prims.Pure FStar.Int64.t\nlet op_Slash_Hat = div", "val FStar.UInt16.op_Plus_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Plus_Hat = add", "val FStar.UInt32.op_Slash_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t{FStar.UInt32.v b <> 0} -> Prims.Pure FStar.UInt32.t\nlet op_Slash_Hat = div", "val FStar.Int32.op_Star_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t\nlet op_Star_Hat = mul", "val FStar.Int32.op_Plus_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t\nlet op_Plus_Hat = add", "val FStar.Int8.op_Star_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t\nlet op_Star_Hat = mul", "val FStar.UInt8.op_Slash_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t{FStar.UInt8.v b <> 0} -> Prims.Pure FStar.UInt8.t\nlet op_Slash_Hat = div", "val FStar.Int64.op_Star_Hat = a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.Pure FStar.Int64.t\nlet op_Star_Hat = mul", "val FStar.UInt64.op_Slash_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t{FStar.UInt64.v b <> 0} -> Prims.Pure FStar.UInt64.t\nlet op_Slash_Hat = div", "val FStar.Int8.op_Plus_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t\nlet op_Plus_Hat = add", "val FStar.Int64.op_Plus_Hat = a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.Pure FStar.Int64.t\nlet op_Plus_Hat = add", "val FStar.Int128.op_Star_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t\nlet op_Star_Hat = mul", "val FStar.Int128.op_Plus_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t\nlet op_Plus_Hat = add", "val FStar.UInt16.op_Subtraction_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt32.op_Plus_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Plus_Hat = add", "val FStar.Int8.op_Subtraction_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.Pure FStar.Int8.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt32.op_Star_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Star_Hat = mul", "val FStar.UInt128.op_Hat_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Hat_Hat = logxor", "val FStar.Int32.op_Subtraction_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.Pure FStar.Int32.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt16.op_Less_Less_Hat = a: FStar.UInt16.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt16.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt16.op_Plus_Question_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Plus_Question_Hat = add_underspec", "val FStar.UInt128.op_Amp_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Amp_Hat = logand", "val FStar.UInt16.op_Greater_Greater_Hat = a: FStar.UInt16.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt16.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.Int128.op_Subtraction_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t\nlet op_Subtraction_Hat = sub", "val FStar.Int32.op_Less_Less_Hat = a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t\nlet op_Less_Less_Hat = shift_left", "val FStar.Int8.op_Less_Less_Hat = a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t\nlet op_Less_Less_Hat = shift_left", "val FStar.Int64.op_Subtraction_Hat = a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.Pure FStar.Int64.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt128.op_Plus_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Plus_Hat = add", "val FStar.UInt16.op_Equals_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool\nlet op_Equals_Hat = eq", "val FStar.UInt8.op_Plus_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Plus_Hat = add", "val FStar.Int128.op_Less_Less_Hat = a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt64.op_Plus_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Plus_Hat = add", "val FStar.UInt64.op_Star_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Star_Hat = mul", "val FStar.UInt128.op_Bar_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Bar_Hat = logor", "val FStar.UInt16.op_Less_Equals_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool\nlet op_Less_Equals_Hat = lte", "val FStar.Int8.op_Greater_Greater_Hat = a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.Int32.op_Greater_Greater_Hat = a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.UInt8.op_Star_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Star_Hat = mul", "val FStar.UInt16.op_Subtraction_Question_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Subtraction_Question_Hat = sub_underspec", "val FStar.UInt16.op_Less_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool\nlet op_Less_Hat = lt", "val FStar.Int64.op_Less_Less_Hat = a: FStar.Int64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int64.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt16.op_Star_Question_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.Pure FStar.UInt16.t\nlet op_Star_Question_Hat = mul_underspec", "val FStar.UInt32.op_Subtraction_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt16.op_Greater_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool\nlet op_Greater_Hat = gt", "val FStar.Int128.op_Greater_Greater_Hat = a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.Int32.op_Greater_Greater_Greater_Hat = a: FStar.Int32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int32.t\nlet op_Greater_Greater_Greater_Hat = shift_arithmetic_right", "val FStar.Int32.op_Less_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool\nlet op_Less_Hat = lt", "val FStar.Int8.op_Greater_Greater_Greater_Hat = a: FStar.Int8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int8.t\nlet op_Greater_Greater_Greater_Hat = shift_arithmetic_right", "val FStar.UInt8.op_Subtraction_Hat = a: FStar.UInt8.t -> b: FStar.UInt8.t -> Prims.Pure FStar.UInt8.t\nlet op_Subtraction_Hat = sub", "val FStar.Int64.op_Greater_Greater_Hat = a: FStar.Int64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int64.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.UInt16.op_Greater_Equals_Hat = a: FStar.UInt16.t -> b: FStar.UInt16.t -> Prims.bool\nlet op_Greater_Equals_Hat = gte", "val FStar.Int32.op_Equals_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool\nlet op_Equals_Hat = eq", "val FStar.Int128.op_Greater_Greater_Greater_Hat = a: FStar.Int128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int128.t\nlet op_Greater_Greater_Greater_Hat = shift_arithmetic_right", "val FStar.UInt128.op_Subtraction_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure FStar.UInt128.t\nlet op_Subtraction_Hat = sub", "val FStar.Int128.op_Less_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool\nlet op_Less_Hat = lt", "val FStar.Int32.op_Greater_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool\nlet op_Greater_Hat = gt", "val FStar.UInt32.op_Less_Less_Hat = a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Less_Less_Hat = shift_left", "val FStar.Int128.op_Equals_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool\nlet op_Equals_Hat = eq", "val FStar.Int8.op_Less_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool\nlet op_Less_Hat = lt", "val FStar.UInt128.op_Less_Less_Hat = a: FStar.UInt128.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt128.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt64.op_Subtraction_Hat = a: FStar.UInt64.t -> b: FStar.UInt64.t -> Prims.Pure FStar.UInt64.t\nlet op_Subtraction_Hat = sub", "val FStar.UInt64.op_Less_Less_Hat = a: FStar.UInt64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt64.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt8.op_Less_Less_Hat = a: FStar.UInt8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt8.t\nlet op_Less_Less_Hat = shift_left", "val FStar.UInt32.op_Plus_Question_Hat = a: FStar.UInt32.t -> b: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Plus_Question_Hat = add_underspec", "val FStar.Int64.op_Greater_Greater_Greater_Hat = a: FStar.Int64.t -> s: FStar.UInt32.t -> Prims.Pure FStar.Int64.t\nlet op_Greater_Greater_Greater_Hat = shift_arithmetic_right", "val FStar.Int8.op_Equals_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool\nlet op_Equals_Hat = eq", "val FStar.Int8.op_Greater_Hat = a: FStar.Int8.t -> b: FStar.Int8.t -> Prims.bool\nlet op_Greater_Hat = gt", "val FStar.Int128.op_Greater_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.bool\nlet op_Greater_Hat = gt", "val FStar.Int64.op_Equals_Hat = a: FStar.Int64.t -> b: FStar.Int64.t -> Prims.bool\nlet op_Equals_Hat = eq", "val FStar.UInt32.op_Greater_Greater_Hat = a: FStar.UInt32.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt32.t\nlet op_Greater_Greater_Hat = shift_right", "val FStar.Int32.op_Less_Equals_Hat = a: FStar.Int32.t -> b: FStar.Int32.t -> Prims.bool\nlet op_Less_Equals_Hat = lte", "val FStar.UInt128.op_Less_Hat = a: FStar.UInt128.t -> b: FStar.UInt128.t -> Prims.Pure Prims.bool\nlet op_Less_Hat = lt", "val FStar.UInt8.op_Greater_Greater_Hat = a: FStar.UInt8.t -> s: FStar.UInt32.t -> Prims.Pure FStar.UInt8.t\nlet op_Greater_Greater_Hat = shift_right" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Plus_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Star_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Subtraction_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Star_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Plus_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Star_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Plus_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Plus_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Plus_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Subtraction_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Star_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Subtraction_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Subtraction_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Subtraction_Percent_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Slash_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Hat_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Plus_Question_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Amp_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Plus_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Bar_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Less_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Star_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Subtraction_Question_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Star_Question_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Greater_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Greater_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fsti", "name": "FStar.UInt16.op_Greater_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Greater_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Subtraction_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fsti", "name": "FStar.UInt64.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Less_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Plus_Question_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Greater_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int8.fsti", "name": "FStar.Int8.op_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int64.fsti", "name": "FStar.Int64.op_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fsti", "name": "FStar.UInt32.op_Greater_Greater_Hat" }, { "project_name": "FStar", "file_name": "FStar.Int32.fsti", "name": "FStar.Int32.op_Less_Equals_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fsti", "name": "FStar.UInt128.op_Less_Hat" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fsti", "name": "FStar.UInt8.op_Greater_Greater_Hat" } ], "selected_premises": [ "FStar.UInt.size", "FStar.Mul.op_Star", "FStar.Pervasives.reveal_opaque", "FStar.Math.Lemmas.pow2_plus", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Int.op_At_Percent", "FStar.Math.Lemmas.pow2_le_compat", "FStar.Math.Lemmas.pow2_lt_compat", "FStar.Int.size", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.Pervasives.dfst", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Pervasives.dsnd", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "FStar.Math.Lemmas.lemma_div_lt", "FStar.Math.Lemmas.distributivity_add_right", "FStar.Math.Lemmas.distributivity_sub_left", "FStar.UInt.max_int", "FStar.Int.op_Slash", "FStar.Math.Lemmas.lemma_mod_twice", "FStar.Math.Lemmas.lemma_mod_mul_distr_l", "FStar.Math.Lemmas.lemma_mod_plus", "FStar.Math.Lemmas.distributivity_sub_right", "FStar.Math.Lemmas.modulo_distributivity", "FStar.Int16.lt", "FStar.UInt32.lt", "FStar.Math.Lemmas.lemma_div_lt_nat", "FStar.UInt.fits", "FStar.Math.Lemmas.lemma_mult_lt_sqr", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1", "FStar.UInt.to_vec", "FStar.Math.Lemmas.lemma_mod_sub", "FStar.UInt32.op_Star_Percent_Hat", "FStar.Math.Lemmas.lemma_div_le", "FStar.UInt32.op_Percent_Hat", "FStar.Math.Lemmas.modulo_addition_lemma", "FStar.Math.Lib.slash_decr_axiom", "FStar.Int.max_int", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_2", "FStar.Math.Lemmas.lemma_mod_mod", "FStar.Math.Lemmas.lemma_mod_spec2", "FStar.Math.Lemmas.lemma_mod_mult_zero", "FStar.Math.Lemmas.multiple_division_lemma", "FStar.Math.Lemmas.division_multiplication_lemma", "FStar.UInt32.op_Plus_Percent_Hat", "FStar.UInt32.op_Plus_Hat", "FStar.Int16.op_Plus_Hat", "FStar.Math.Lemmas.multiple_modulo_lemma", "FStar.UInt32.op_Subtraction_Percent_Hat", "FStar.Math.Lemmas.div_exact_r", "FStar.Int.fits", "FStar.Math.Lemmas.mod_mul_div_exact", "FStar.UInt32.n", "FStar.Math.Lemmas.division_addition_lemma", "FStar.Math.Lemmas.modulo_sub_lemma", "FStar.UInt32.lte", "FStar.Int16.lte", "FStar.UInt32.gt", "FStar.Int16.gt", "FStar.Int16.n", "FStar.Math.Lib.max", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_1", "FStar.Int.to_vec", "FStar.UInt32.op_Subtraction_Hat", "FStar.Int16.op_Subtraction_Hat", "FStar.Int16.op_Star_Hat", "FStar.UInt32.op_Star_Hat", "FStar.UInt.mul_mod", "FStar.UInt.min_int", "FStar.Math.Lib.signed_modulo", "FStar.Math.Lemmas.lemma_div_plus", "FStar.Math.Lemmas.sub_div_mod_1", "FStar.UInt32.op_Equals_Hat", "FStar.Math.Lemmas.pow2_modulo_division_lemma_1", "FStar.UInt.xor", "FStar.Math.Lib.op_Plus_Percent", "FStar.Math.Lemmas.modulo_add", "FStar.Math.Lemmas.pow2_modulo_division_lemma_2", "FStar.Math.Lib.powx", "FStar.UInt32.eq", "FStar.Int16.eq", "FStar.Int16.gte", "FStar.UInt32.gte", "FStar.Int.to_uint", "FStar.Math.Lemmas.lemma_mul_sub_distr", "FStar.UInt32.op_Bar_Hat", "FStar.Math.Lib.slash_star_axiom", "FStar.Math.Lemmas.pow2_minus", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_2", "FStar.Math.Lemmas.modulo_scale_lemma", "FStar.Math.Lemmas.modulo_sub", "FStar.UInt.to_uint_t", "FStar.Math.Lemmas.division_definition", "FStar.Int16.op_Slash_Hat", "FStar.UInt32.op_Slash_Hat", "FStar.Math.Lib.log_2", "FStar.Math.Lemmas.lemma_div_lt_cancel", "FStar.UInt32.op_Greater_Equals_Hat" ], "source_upto_this": "(*\n Copyright 2008-2019 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Int16\n\n(**** THIS MODULE IS GENERATED AUTOMATICALLY USING [mk_int.sh], DO NOT EDIT DIRECTLY ****)\n\nunfold let n = 16\n\nopen FStar.Int\nopen FStar.Mul\n\n#set-options \"--max_fuel 0 --max_ifuel 0\"\n\n(* NOTE: anything that you fix/update here should be reflected in [FStar.UIntN.fstp], which is mostly\n * a copy-paste of this module. *)\n\nnew val t : eqtype\n\nval v (x:t) : Tot (int_t n)\n\nval int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\n\nval uv_inv (x : t) : Lemma\n (ensures (int_to_t (v x) == x))\n [SMTPat (v x)]\n\nval vu_inv (x : int_t n) : Lemma\n (ensures (v (int_to_t x) == x))\n [SMTPat (int_to_t x)]\n\nval v_inj (x1 x2: t): Lemma\n (requires (v x1 == v x2))\n (ensures (x1 == x2))\n\nval zero : x:t{v x = 0}\n\nval one : x:t{v x = 1}\n\nval add (a:t) (b:t) : Pure t\n (requires (size (v a + v b) n))\n (ensures (fun c -> v a + v b = v c))\n\n(* Subtraction primitives *)\nval sub (a:t) (b:t) : Pure t\n (requires (size (v a - v b) n))\n (ensures (fun c -> v a - v b = v c))\n\n(* Multiplication primitives *)\nval mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\n\n(* Division primitives *)\nval div (a:t) (b:t{v b <> 0}) : Pure t\n // division overflows on INT_MIN / -1\n (requires (size (v a / v b) n))\n (ensures (fun c -> v a / v b = v c))\n\n(* Modulo primitives *)\n(* If a/b is not representable the result of a%b is undefind *)\nval rem (a:t) (b:t{v b <> 0}) : Pure t\n (requires (size (v a / v b) n))\n (ensures (fun c -> FStar.Int.mod (v a) (v b) = v c))\n\n(* Bitwise operators *)\nval logand (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logand` v y = v z))\n\nval logxor (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logxor` v y == v z))\n\nval logor (x:t) (y:t) : Pure t\n (requires True)\n (ensures (fun z -> v x `logor` v y == v z))\n\nval lognot (x:t) : Pure t\n (requires True)\n (ensures (fun z -> lognot (v x) == v z))\n\n(* Shift operators *)\n\n(** If a is negative the result is implementation-defined *)\nval shift_right (a:t) (s:UInt32.t) : Pure t\n (requires (0 <= v a /\\ UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_right (v a) (UInt32.v s) = v c))\n\n(** If a is negative or a * pow2 s is not representable the result is undefined *)\nval shift_left (a:t) (s:UInt32.t) : Pure t\n (requires (0 <= v a /\\ v a * pow2 (UInt32.v s) <= max_int n /\\ UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_left (v a) (UInt32.v s) = v c))\n\nval shift_arithmetic_right (a:t) (s:UInt32.t) : Pure t\n (requires (UInt32.v s < n))\n (ensures (fun c -> FStar.Int.shift_arithmetic_right (v a) (UInt32.v s) = v c))\n\n(* Comparison operators *)\nlet eq (a:t) (b:t) : Tot bool = eq #n (v a) (v b)\nlet gt (a:t) (b:t) : Tot bool = gt #n (v a) (v b)\nlet gte (a:t) (b:t) : Tot bool = gte #n (v a) (v b)\nlet lt (a:t) (b:t) : Tot bool = lt #n (v a) (v b)\nlet lte (a:t) (b:t) : Tot bool = lte #n (v a) (v b)\n\n(* Infix notations *)\nunfold let op_Plus_Hat = add\nunfold let op_Subtraction_Hat = sub\nunfold let op_Star_Hat = mul\nunfold let op_Slash_Hat = div", "sketch": [ "The definition `op_Percent_Hat` is a function that computes the remainder of the division of two 16-bit integers.\n\nStep 1: We need to define a function that computes the remainder of the division of two 16-bit integers.\nStep 2: We will implement the function `op_Percent_Hat` by using the `rem` primitive provided by the FStar.Int16 module.", "The definition `op_Percent_Hat` is a function that computes the remainder of the division of two 16-bit integers.\n\nStep 1: We need to define a function that computes the remainder of the division of two 16-bit integers.\nStep 2: We can implement the function by using the `rem` primitive provided by the `FStar.Int16` module.", "The definition `op_Percent_Hat` is a function that computes the remainder of the division of two 16-bit integers.\n\nStep 1: We need to define a function that computes the remainder of the division of two 16-bit integers.\nStep 2: We will implement the function `op_Percent_Hat` using the `rem` primitive provided by the `FStar.Int16` module.", "The definition `op_Percent_Hat` is a function that calculates the remainder of the division of two 16-bit integers.\n\nStep 1: We need to define a function that computes the remainder of the division of two 16-bit integers.\nStep 2: We will implement the function by using the `rem` primitive provided by the `FStar.Int16` module.", "The definition `op_Percent_Hat` represents the modulo operation for 16-bit integers.\n\nStep 1: We need to define the modulo operation for 16-bit integers.\nStep 2: The modulo operation will take two 16-bit integers `a` and `b`, and return the result of `a % b`.", "The definition `op_Percent_Hat` is a function that computes the remainder of the division of two 16-bit integers.\n\nStep 1: We define a function `op_Percent_Hat` that takes two 16-bit integers `a` and `b` and returns the remainder of the division of `a` by `b`.\n\nStep 2: To implement `op_Percent_Hat`, we will use the `rem` function provided by the FStar.Int16 module, which computes the remainder of the division of two 16-bit integers.", "The definition `op_Percent_Hat` represents the modulo operation for 16-bit integers.\n\nStep 1: We need to define the modulo operation for 16-bit integers.\nStep 2: The modulo operation can be implemented by using the `rem` function provided in the module `FStar.Int16`.", "The definition is for the modulo operator (%) for 16-bit integers.\n\nStep 1: The modulo operator returns the remainder of the division of the first operand by the second operand.\n\nStep 2: To implement the modulo operator, we will use the `rem` function provided by the FStar.Int16 module. This function takes two 16-bit integers and returns the remainder of the division of the first operand by the second operand.", "The definition `op_Percent_Hat` represents the modulo operation for 16-bit integers.\n\nStep 1: We need to define the modulo operation for 16-bit integers.\nStep 2: The modulo operation will take two 16-bit integers `a` and `b`, and return the result of `a` modulo `b`.", "The definition `op_Percent_Hat` is a function that computes the remainder of the division of two 16-bit integers.\n\nStep 1: We need to define a function that calculates the remainder of the division of two 16-bit integers.\n\nStep 2: We will implement the `op_Percent_Hat` function by using the `rem` primitive provided by the FStar.Int16 module. This function will take two 16-bit integers `a` and `b` as input and return the remainder of the division of `a` by `b`." ], "generated_solution": [ "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) FStar.Int16.n))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b)) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b)) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) FStar.Int16.n))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (FStar.Int16.size (FStar.Int16.v a / FStar.Int16.v b) FStar.Int16.n))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b)) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))", "val op_Percent_Hat : a: FStar.Int16.t -> b: FStar.Int16.t{FStar.Int16.v b <> 0} -> Prims.Pure FStar.Int16.t\n (requires (size (FStar.Int16.v a / FStar.Int16.v b) 16))\n (ensures (fun c -> FStar.Int.mod (FStar.Int16.v a) (FStar.Int16.v b) = FStar.Int16.v c))" ] }, { "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.mk_fraction_seq_split", "opens_and_abbrevs": [ { "abbrev": "SZ", "full_module": "FStar.SizeT" }, { "abbrev": "P", "full_module": "Steel.FractionalPermission" }, { "open": "Steel.C.Typenat" }, { "open": "Steel.ST.C.Types.Base" }, { "open": "Steel.ST.Util" }, { "open": "Steel.ST.C.Types" }, { "open": "Steel.ST.C.Types" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "source_definition": "let mk_fraction_seq_split\n (#opened: _)\n (#t: Type) (#td: typedef t) (r: array td) (v: Ghost.erased (Seq.seq t) { fractionable_seq td v }) (p1 p2: P.perm)\n: STGhost unit opened\n (array_pts_to r v)\n (fun _ -> array_pts_to r (mk_fraction_seq td v p1) `star` array_pts_to r (mk_fraction_seq td v p2))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)\n= mk_fraction_seq_full td v;\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n mk_fraction_seq_split_gen r v P.full_perm p1 p2", "source_range": { "start_line": 991, "start_col": 0, "end_line": 1001, "end_col": 49 }, "interleaved": false, "definition": "fun r v p1 p2 ->\n (Steel.ST.C.Types.Array.mk_fraction_seq_full td (FStar.Ghost.reveal v);\n Steel.ST.Util.rewrite (Steel.ST.C.Types.Array.array_pts_to r v)\n (Steel.ST.C.Types.Array.array_pts_to r\n (FStar.Ghost.hide (Steel.ST.C.Types.Array.mk_fraction_seq td\n (FStar.Ghost.reveal v)\n Steel.FractionalPermission.full_perm)));\n Steel.ST.C.Types.Array.mk_fraction_seq_split_gen r\n (FStar.Ghost.reveal v)\n Steel.FractionalPermission.full_perm\n p1\n p2)\n <:\n Steel.ST.Effect.Ghost.STGhost Prims.unit", "effect": "Steel.ST.Effect.Ghost.STGhost", "effect_flags": [], "mutual_with": [], "premises": [ "Steel.Memory.inames", "Steel.ST.C.Types.Base.typedef", "Steel.ST.C.Types.Array.array", "FStar.Ghost.erased", "FStar.Seq.Base.seq", "Steel.ST.C.Types.Array.fractionable_seq", "FStar.Ghost.reveal", "Steel.FractionalPermission.perm", "Steel.ST.C.Types.Array.mk_fraction_seq_split_gen", "Steel.FractionalPermission.full_perm", "Prims.unit", "Steel.ST.Util.rewrite", "Steel.ST.C.Types.Array.array_pts_to", "FStar.Ghost.hide", "Steel.ST.C.Types.Array.mk_fraction_seq", "Steel.ST.C.Types.Array.mk_fraction_seq_full", "Steel.Effect.Common.star", "Steel.Effect.Common.vprop", "Prims.eq2", "Steel.FractionalPermission.sum_perm", "Prims.l_True" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n r: Steel.ST.C.Types.Array.array td ->\n v:\n FStar.Ghost.erased (FStar.Seq.Base.seq t)\n {Steel.ST.C.Types.Array.fractionable_seq td (FStar.Ghost.reveal v)} ->\n p1: Steel.FractionalPermission.perm ->\n p2: Steel.FractionalPermission.perm\n -> Steel.ST.Effect.Ghost.STGhost Prims.unit", "prompt": "let mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True) =\n ", "expected_response": "mk_fraction_seq_full td v;\nrewrite (array_pts_to _ _) (array_pts_to _ _);\nmk_fraction_seq_split_gen r v P.full_perm p1 p2", "source": { "project_name": "steel", "file_name": "lib/steel/c/Steel.ST.C.Types.Array.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Steel.ST.C.Types.Array.fsti", "checked_file": "dataset/Steel.ST.C.Types.Array.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Steel.ST.Util.fsti.checked", "dataset/Steel.ST.C.Types.Base.fsti.checked", "dataset/Steel.ST.C.Types.Array.Base.fst.checked", "dataset/Steel.FractionalPermission.fst.checked", "dataset/Steel.C.Typenat.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.SizeT.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Ghost.fsti.checked" ] }, "definitions_in_context": [ "let array_size_t = (n: SZ.t { SZ.v n > 0 })", "val base_array_t ([@@@strictly_positive] t: Type0) (tn: Type0 (* using Typenat (or Typestring for `#define`d constants) *)) (n: array_size_t) : Type0", "let base_array_index_t (n: array_size_t) : Tot eqtype =\n Steel.ST.C.Types.Array.Base.array_domain (Ghost.hide n)", "val base_array0 (#t: Type0) (tn: Type0) (td: typedef t) (n: array_size_t) : Tot (typedef (base_array_t t tn n))", "let base_array (#t: Type0) (#tn: Type0) (td: typedef t) (n: nat {SZ.fits n /\\ n > 0}) (# [solve_nat_t_of_nat ()] prf: squash (norm norm_typenat (nat_t_of_nat n == tn))) : Tot (typedef (base_array_t t tn (SZ.uint_to_t n)))\n= base_array0 tn td (SZ.uint_to_t n)", "val base_array_index (#t: Type0) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (i: base_array_index_t n) : GTot t", "val base_array_eq (#t: Type0) (#tn: Type0) (#n: array_size_t) (a1 a2: base_array_t t tn n) : Ghost prop\n (requires True)\n (ensures (fun y ->\n (y <==> (a1 == a2)) /\\\n (y <==> (forall (i: base_array_index_t n) . base_array_index a1 i == base_array_index a2 i))\n ))", "val mk_base_array (#t: Type) (tn: Type0) (n: array_size_t) (v: Seq.seq t) : Ghost (base_array_t t tn n)\n (requires (\n Seq.length v == SZ.v n\n ))\n (ensures (fun y -> True))", "val mk_base_array_index (#t: Type) (tn: Type) (n: array_size_t) (v: Seq.seq t) (i: base_array_index_t n) : Lemma\n (requires (Seq.length v == SZ.v n))\n (ensures (\n Seq.length v == SZ.v n /\\\n base_array_index (mk_base_array tn n v) i == Seq.index v (SZ.v i)\n ))\n [SMTPat (base_array_index (mk_base_array tn n v) i)]", "let mk_base_array_inj (#t: Type) (tn: Type0) (n: array_size_t) (v1 v2: Seq.seq t) : Lemma\n (requires (\n Seq.length v1 == SZ.v n /\\\n Seq.length v2 == SZ.v n /\\\n mk_base_array tn n v1 == mk_base_array tn n v2\n ))\n (ensures (v1 == v2))\n [SMTPat (mk_base_array tn n v1); SMTPat (mk_base_array tn n v2)]\n= assert (forall (i: nat) . i < SZ.v n ==> base_array_index (mk_base_array tn n v1) (SZ.uint_to_t i) == base_array_index (mk_base_array tn n v2) (SZ.uint_to_t i));\n assert (v1 `Seq.equal` v2)", "val base_array_fractionable (#t: Type) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (td: typedef t) : Lemma\n (\n fractionable (base_array0 tn td n) a <==>\n (forall (i: base_array_index_t n) . fractionable td (base_array_index a i))\n )\n [SMTPat (fractionable (base_array0 tn td n) a)]", "val base_array_mk_fraction (#t: Type) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (td: typedef t) (p: P.perm) (i: base_array_index_t n) : Lemma\n (requires (\n fractionable (base_array0 tn td n) a\n ))\n (ensures (\n fractionable (base_array0 tn td n) a /\\\n base_array_index (mk_fraction (base_array0 tn td n) a p) i == mk_fraction td (base_array_index a i) p\n ))\n [SMTPat (base_array_index (mk_fraction (base_array0 tn td n) a p) i)]", "val base_array_index_unknown (#t: Type) (tn: Type0) (n: array_size_t) (td: typedef t) (i: base_array_index_t n) : Lemma\n (base_array_index (unknown (base_array0 tn td n)) i == unknown td)\n [SMTPat (base_array_index (unknown (base_array0 tn td n)) i)]", "val base_array_index_uninitialized (#t: Type) (tn: Type0) (n: array_size_t) (td: typedef t) (i: base_array_index_t n) : Lemma\n (base_array_index (uninitialized (base_array0 tn td n)) i == uninitialized td)\n [SMTPat (base_array_index (uninitialized (base_array0 tn td n)) i)]", "val base_array_index_full (#t: Type) (#tn: Type0) (#n: array_size_t) (td: typedef t) (x: base_array_t t tn n) : Lemma\n (full (base_array0 tn td n) x <==> (forall (i: base_array_index_t n) . full td (base_array_index x i)))\n [SMTPat (full (base_array0 tn td n) x)]", "val has_base_array_cell\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: Tot vprop", "val has_base_array_cell_post\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhost unit opened\n (has_base_array_cell r i r')\n (fun _ -> has_base_array_cell r i r')\n (True)\n (fun _ -> SZ.v i < SZ.v n)", "val has_base_array_cell_dup\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r')\n (fun _ -> has_base_array_cell r i r' `star` has_base_array_cell r i r')", "val has_base_array_cell_inj\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r1 `star` has_base_array_cell r i r2)\n (fun _ -> has_base_array_cell r i r1 `star` has_base_array_cell r i r2 `star` ref_equiv r1 r2)", "val has_base_array_cell_equiv_from\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r1 r2: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhostT unit opened\n (has_base_array_cell r1 i r' `star` ref_equiv r1 r2)\n (fun _ -> has_base_array_cell r2 i r' `star` ref_equiv r1 r2)", "val has_base_array_cell_equiv_to\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r1 `star` ref_equiv r1 r2)\n (fun _ -> has_base_array_cell r i r2 `star` ref_equiv r1 r2)", "val array_void_ptr : Type0", "let array_ptr_gen ([@@@unused] t: Type0) : Tot Type0 = array_void_ptr", "let array_ptr (#t: Type) (td: typedef t) = array_ptr_gen t", "val null_array_void_ptr: array_void_ptr", "let null_array_ptr (#t: Type) (td: typedef t) : Tot (array_ptr td) = null_array_void_ptr", "val g_array_ptr_is_null (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost bool\n (requires True)\n (ensures (fun y -> y == true <==> a == null_array_ptr td))", "let array_ref (#t: Type) (td: typedef t) = (a: array_ptr td { g_array_ptr_is_null a == false })", "val array_ref_base_size (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost SZ.t\n (requires True)\n (ensures (fun y -> SZ.v y == 0 <==> a == null_array_ptr td))", "val has_array_ref_base (#t: Type) (#td: typedef t) (a: array_ref td) (#ty: Type) (r: ref (base_array0 ty td (array_ref_base_size a))) : GTot prop", "val has_array_ref_base_inj (#t: Type) (#td: typedef t) (a: array_ref td) (#ty: Type) (r1 r2: ref (base_array0 ty td (array_ref_base_size a))) : Lemma\n (requires (has_array_ref_base a r1 /\\ has_array_ref_base a r2))\n (ensures (r1 == r2))", "val array_ref_offset (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost SZ.t\n (requires True)\n (ensures (fun y -> SZ.v y <= SZ.v (array_ref_base_size a)))", "val array_ref_base_offset_inj (#t: Type) (#td: typedef t) (#ty: Type) (a1: array_ref td) (r1: ref (base_array0 ty td (array_ref_base_size a1))) (a2: array_ref td) (r2: ref (base_array0 ty td (array_ref_base_size a2))) : Lemma\n (requires (\n array_ref_base_size a1 == array_ref_base_size a2 /\\\n has_array_ref_base a1 r1 /\\\n has_array_ref_base a2 r2 /\\\n r1 == coerce_eq () r2 /\\\n array_ref_offset a1 == array_ref_offset a2\n ))\n (ensures (a1 == a2))", "let array_len_t (#t: Type) (#td: typedef t) (r: array_ptr td) : Tot Type0 =\n (len: Ghost.erased SZ.t { SZ.v (array_ref_offset r) + SZ.v len <= SZ.v (array_ref_base_size r) })", "let array_or_null (#t: Type) (td: typedef t) : Tot Type0 = (r: array_ptr td & array_len_t r)", "let array_ptr_of (#t: Type) (#td: typedef t) (ar: array_or_null td) : Tot (array_ptr td) =\n match ar with\n | (| a, _ |) -> a", "let array_len_of (#t: Type) (#td: typedef t) (ar: array_or_null td) : Tot (array_len_t (array_ptr_of ar)) =\n match ar with\n | (| _, a |) -> a", "let g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool =\n g_array_ptr_is_null (array_ptr_of a)", "let array (#t: Type) (td: typedef t) : Tot Type0 = (a: array_or_null td { g_array_is_null a == false })", "let array_ref_of (#t: Type) (#td: typedef t) (ar: array td) : Tot (array_ref td) =\n array_ptr_of ar", "let mk_array (#t: Type) (#td: typedef t) (a: array_ref td) (len: array_len_t a) : Tot (array td) =\n (| a, len |)", "let array_length\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: GTot nat\n= SZ.v (dsnd a)", "val array_pts_to\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop", "let array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop\n= if g_array_is_null r\n then emp\n else array_pts_to r v", "val array_ptr_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_ptr td)\n (len: array_len_t r)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null (| r, len |) v)\n (fun _ -> array_pts_to_or_null (| r, len |) v)\n (True)\n (fun b -> b == g_array_is_null (| r, len |))", "let array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\n= let a = array_ptr_of r in\n let len : array_len_t a = dsnd r in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null (| a, len |) v);\n let res = array_ptr_is_null a len in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null r v);\n return res", "val array_pts_to_length\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t))\n: STGhost unit opened\n (array_pts_to r v)\n (fun _ -> array_pts_to r v)\n (True)\n (fun _ -> Seq.length v == SZ.v (dsnd r))", "let has_array_of_base\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (a: array td)\n: GTot prop\n= let (| al, len |) = a in\n array_ref_base_size al == n /\\\n has_array_ref_base al #tn r /\\\n array_ref_offset al == 0sz /\\\n Ghost.reveal len == n", "let has_array_of_base_inj\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (a1 a2: array td)\n: Lemma\n (requires (\n has_array_of_base #t #tn #n #td r a1 /\\\n has_array_of_base #t #tn #n #td r a2\n ))\n (ensures (a1 == a2))\n= let (| ar1, _ |) = a1 in\n let (| ar2, _ |) = a2 in\n array_ref_base_offset_inj #t #td #tn ar1 r ar2 r", "let seq_of_base_array\n (#t: Type)\n (#tn: Type)\n (#n: array_size_t)\n (v: base_array_t t tn n)\n: GTot (Seq.lseq t (SZ.v n))\n= Seq.init_ghost (SZ.v n) (fun i -> base_array_index v (SZ.uint_to_t i))", "val ghost_array_of_base_focus\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n (a: array td)\n: STGhost unit opened\n (pts_to r v)\n (fun _ -> array_pts_to a (seq_of_base_array v))\n (has_array_of_base r a)\n (fun _ -> True)", "val ghost_array_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STGhostT (a: Ghost.erased (array td) { has_array_of_base r a }) opened\n (pts_to r v)\n (fun a -> array_pts_to a (seq_of_base_array v))", "let array_ref_of_base_post\n (#t: Type)\n (#tn: Type0)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n (a: array_ref td)\n (ar: array td)\n: GTot prop\n=\n array_ptr_of ar == a /\\\n array_ref_base_size a == Ghost.reveal n /\\\n array_ref_offset a == 0sz /\\\n has_array_of_base r ar /\\\n Ghost.reveal (dsnd ar) == Ghost.reveal n", "val array_ref_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STAtomicBase (array_ref td) false opened Unobservable\n (pts_to r v)\n (fun a -> exists_ (fun (ar: array td) ->\n array_pts_to ar (seq_of_base_array v) `star` pure (\n array_ref_of_base_post v r a ar\n )))\n (True)\n (fun _ -> True)", "let array_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STAtomicBase (a: array td { has_array_of_base r a }) false opened Unobservable\n (pts_to r v)\n (fun a -> array_pts_to a (seq_of_base_array v))\n (True)\n (fun _ -> True)\n= let al = array_ref_of_base r in\n let _ = elim_exists () in\n elim_pure _;\n let a = (| al, Ghost.hide (n <: SZ.t) |) in\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n return a", "val unarray_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: ref (base_array0 tn td n))\n (a: array td)\n: STGhost (Ghost.erased (base_array_t t tn n)) opened\n (array_pts_to a v)\n (fun v' -> pts_to r v')\n (\n has_array_of_base r a\n )\n (fun v' -> Ghost.reveal v `Seq.equal` seq_of_base_array v')", "val freeable_array\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: Tot vprop", "let freeable_or_null_array\n (#t: Type)\n (#td: typedef t)\n (a: array_or_null td)\n: Tot vprop\n= if g_array_is_null a\n then emp\n else freeable_array a", "val array_ptr_alloc\n (#t: Type)\n (td: typedef t)\n (sz: SZ.t { SZ.v sz > 0 })\n: STT (array_ptr td)\n emp\n (fun a ->\n exists_ (fun (ar: array_or_null td) -> exists_ (fun (s: Seq.seq t) ->\n freeable_or_null_array ar `star`\n array_pts_to_or_null ar s `star` pure (\n array_ptr_of ar == a /\\\n (g_array_is_null ar == false ==> array_length ar == SZ.v sz) /\\\n Ghost.reveal s `Seq.equal` FStar.Seq.create (SZ.v sz) (uninitialized td)\n ))))", "let array_alloc\n (#t: Type)\n (td: typedef t)\n (sz: SZ.t { SZ.v sz > 0 })\n: STT (array_or_null td)\n emp\n (fun ar ->\n freeable_or_null_array ar `star`\n exists_ (fun s ->\n array_pts_to_or_null ar s `star` pure (\n (g_array_is_null ar == false ==> array_length ar == SZ.v sz) /\\\n Ghost.reveal s == FStar.Seq.create (SZ.v sz) (uninitialized td)\n )))\n= let a : array_ptr td = array_ptr_alloc td sz in\n let ar' : Ghost.erased (array_or_null td) = elim_exists () in\n let s = elim_exists () in\n elim_pure _;\n let len : array_len_t a = dsnd ar' in\n let ar = (| a, len |) in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null ar s);\n rewrite (freeable_or_null_array _) (freeable_or_null_array ar);\n noop ();\n return ar", "let full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop =\n forall (i: nat { i < Seq.length v }) . {:pattern (Seq.index v i)} full td (Seq.index v i)", "let full_seq_seq_of_base_array\n (#t: Type0) (tn: Type0) (td: typedef t) (#n: array_size_t)\n (b: base_array_t t tn n)\n: Lemma\n (ensures (full_seq td (seq_of_base_array b) <==> full (base_array0 tn td n) b))\n [SMTPat (full_seq td (seq_of_base_array b))]\n= assert (forall (i: base_array_index_t n) . base_array_index b i == Seq.index (seq_of_base_array b) (SZ.v i))", "val array_ref_free\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array_ref td)\n (n: array_len_t a)\n: ST unit\n (freeable_array (| a, n |) `star` array_pts_to (| a, n |) s)\n (fun _ -> emp)\n (full_seq td s)\n (fun _ -> True)", "let array_free\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n: ST unit\n (freeable_array a `star` array_pts_to a s)\n (fun _ -> emp)\n (full_seq td s)\n (fun _ -> True)\n= let al = array_ptr_of a in\n let n: array_len_t al = dsnd a in\n rewrite (freeable_array _) (freeable_array (| al, n |));\n rewrite (array_pts_to _ _) (array_pts_to (| al, n |) s);\n array_ref_free al n", "val has_array_cell\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: Tot vprop", "val has_array_cell_post\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r': ref td)\n: STGhost unit opened\n (has_array_cell a i r')\n (fun _ -> has_array_cell a i r')\n (True)\n (fun _ -> SZ.v i < SZ.v (dsnd a))", "val has_array_cell_has_base_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n (#ty: Type)\n (br: ref (base_array0 ty td (array_ref_base_size (array_ptr_of a))))\n: STGhost (Ghost.erased SZ.t) opened\n (has_array_cell a i r)\n (fun j -> has_base_array_cell br j r)\n (has_array_ref_base (array_ptr_of a) br)\n (fun j ->\n SZ.v j == SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v i\n )", "val has_base_array_cell_has_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n (#ty: Type)\n (br: ref (base_array0 ty td (array_ref_base_size (array_ptr_of a))))\n: STGhost (Ghost.erased SZ.t) opened\n (has_base_array_cell br i r)\n (fun j -> has_array_cell a j r)\n (has_array_ref_base (array_ptr_of a) br /\\\n SZ.v i >= SZ.v (array_ref_offset (array_ptr_of a)) /\\\n SZ.v i < SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v (dsnd a)\n )\n (fun j ->\n SZ.v i == SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v j\n )", "val has_array_cell_inj\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (\n has_array_cell a i r1 `star`\n has_array_cell a i r2\n )\n (fun _ ->\n has_array_cell a i r1 `star`\n has_array_cell a i r2 `star`\n ref_equiv r1 r2\n )", "val ghost_array_cell_focus\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: STGhostT (squash (SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s `star` has_array_cell a i r)\n (fun _ -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)", "val ghost_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: STGhost (r: Ghost.erased (ref td) { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a) }) opened\n (array_pts_to a s)\n (fun r -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v (dsnd a))\n )\n (fun _ -> True)", "val array_ref_cell\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array_ref td)\n (len: array_len_t a)\n (i: SZ.t)\n: ST (r: ref td { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v len })\n (array_pts_to (| a, len |) s)\n (fun r -> array_pts_to (| a, len |) (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell (| a, len |) i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v len)\n )\n (fun _ -> True)", "let array_cell\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: ST (r: ref td { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a) })\n (array_pts_to a s)\n (fun r -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v (dsnd a))\n )\n (fun _ -> True)\n= let (| al, len |) = a in\n rewrite (array_pts_to _ _) (array_pts_to _ s);\n let r = array_ref_cell al len i in\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n rewrite (has_array_cell _ _ _) (has_array_cell a i r);\n return r", "val unarray_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (#v: Ghost.erased t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: STGhost (squash (SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s `star` pts_to r v `star` has_array_cell a i r)\n (fun _ -> array_pts_to a (Seq.upd s (SZ.v i) v) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s ==> Seq.index s (SZ.v i) == unknown td)\n )\n (fun _ -> True)", "val array_ref_shift\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n (i: SZ.t)\n: Ghost (array_ref td)\n (requires (SZ.v (array_ref_offset a) + SZ.v i <= SZ.v (array_ref_base_size a)))\n (ensures (fun y -> \n array_ref_base_size y == array_ref_base_size a /\\\n (forall ty r . has_array_ref_base a #ty r ==> has_array_ref_base y #ty (coerce_eq () r)) /\\\n array_ref_offset y == array_ref_offset a `SZ.add` i\n ))", "val array_ref_shift_zero\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n: Lemma\n (ensures (\n array_ref_shift a 0sz == a\n ))", "val array_ref_shift_assoc\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n (i1 i2: SZ.t)\n: Lemma\n (requires (SZ.v (array_ref_offset a) + SZ.v i1 + SZ.v i2 <= SZ.v (array_ref_base_size a)))\n (ensures (\n array_ref_shift a (SZ.add i1 i2) == array_ref_shift (array_ref_shift a i1) i2\n ))", "let array_split_l\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n: Pure (array td)\n (requires (SZ.v i <= SZ.v (dsnd a)))\n (ensures (fun _ -> True))\n= let (| al, _ |) = a in\n (| al, Ghost.hide i |)", "let array_split_r\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n: Ghost (array td)\n (requires (SZ.v i <= SZ.v (dsnd a)))\n (ensures (fun _ -> True))\n= let (| al, len |) = a in\n (| array_ref_shift al i, Ghost.hide (len `SZ.sub` i) |)", "val ghost_array_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: STGhost (squash (SZ.v i <= SZ.v (dsnd a) /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s)\n (fun _ -> array_pts_to (array_split_l a i) (Seq.slice s 0 (SZ.v i)) `star`\n array_pts_to (array_split_r a i) (Seq.slice s (SZ.v i) (Seq.length s)))\n (SZ.v i <= SZ.v (dsnd a) \\/ SZ.v i <= Seq.length s)\n (fun _ -> True)", "let array_ref_split_post\n (#t: Type)\n (#td: typedef t)\n (s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n (sl sr: Ghost.erased (Seq.seq t))\n: GTot prop\n= SZ.v i <= array_length a /\\ Seq.length s == array_length a /\\\n Ghost.reveal sl == Seq.slice s 0 (SZ.v i) /\\\n Ghost.reveal sr == Seq.slice s (SZ.v i) (Seq.length s)", "val array_ref_split\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (al: array_ref td)\n (len: array_len_t al)\n (i: SZ.t { SZ.v i <= SZ.v len })\n: ST (array_ref td)\n (array_pts_to (mk_array al len) s)\n (fun ar -> exists_ (fun sl -> exists_ (fun sr ->\n array_pts_to (array_split_l (mk_array al len) i) sl `star`\n array_pts_to (array_split_r (mk_array al len) i) sr `star`\n pure (array_ref_split_post s (mk_array al len) i sl sr)\n )))\n True\n (fun ar ->\n SZ.v i <= SZ.v len /\\ SZ.v i <= Seq.length s /\\\n ar == array_ptr_of (array_split_r (mk_array al len) i)\n )", "let array_split\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t { SZ.v i <= array_length a })\n: ST (array td)\n (array_pts_to a s)\n (fun a' -> exists_ (fun sl -> exists_ (fun sr ->\n array_pts_to (array_split_l a i) sl `star`\n array_pts_to a' sr `star`\n pure (array_ref_split_post s a i sl sr)\n )))\n True\n (fun a' ->\n SZ.v i <= array_length a /\\ SZ.v i <= Seq.length s /\\\n a' == array_split_r a i\n )\n= let (| al, len |) = a in\n rewrite (array_pts_to _ _) (array_pts_to _ s);\n let ar = array_ref_split al len i in\n let _ = elim_exists () in\n let _ = elim_exists () in\n elim_pure _;\n [@@inline_let]\n let a' = mk_array ar (Ghost.hide (len `SZ.sub` i)) in\n vpattern_rewrite #_ #_ #(array_split_l _ _) (fun a -> array_pts_to a _) (array_split_l a i);\n vpattern_rewrite #_ #_ #(array_split_r _ _) (fun a -> array_pts_to a _) a';\n return a'", "val array_join\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#sl #sr: Ghost.erased (Seq.seq t))\n (a al ar: array td)\n (i: SZ.t)\n: STGhost unit opened\n (array_pts_to al sl `star` array_pts_to ar sr)\n (fun _ -> array_pts_to a (sl `Seq.append` sr))\n (\n SZ.v i <= SZ.v (dsnd a) /\\\n al == array_split_l a i /\\\n ar == array_split_r a i\n )\n (fun _ -> True)", "let fractionable_seq (#t: Type) (td: typedef t) (s: Seq.seq t) : GTot prop =\n forall (i: nat). i < Seq.length s ==> fractionable td (Seq.index s i)", "let mk_fraction_seq (#t: Type) (td: typedef t) (s: Seq.seq t) (p: P.perm) : Ghost (Seq.seq t)\n (requires (fractionable_seq td s))\n (ensures (fun _ -> True))\n= Seq.init_ghost (Seq.length s) (fun i -> mk_fraction td (Seq.index s i) p)", "let mk_fraction_seq_full (#t: Type0) (td: typedef t) (x: Seq.seq t) : Lemma\n (requires (fractionable_seq td x))\n (ensures (mk_fraction_seq td x P.full_perm == x))\n [SMTPat (mk_fraction_seq td x P.full_perm)]\n= assert (mk_fraction_seq td x P.full_perm `Seq.equal` x)", "val mk_fraction_seq_split_gen\n (#opened: _)\n (#t: Type) (#td: typedef t) (r: array td) (v: Seq.seq t { fractionable_seq td v }) (p p1 p2: P.perm)\n: STGhost unit opened\n (array_pts_to r (mk_fraction_seq td v p))\n (fun _ -> array_pts_to r (mk_fraction_seq td v p1) `star` array_pts_to r (mk_fraction_seq td v p2))\n (p == p1 `P.sum_perm` p2 /\\ (p `P.lesser_equal_perm` P.full_perm \\/ Seq.length v == 0))\n (fun _ -> True)" ], "closest": [ "val mk_fraction_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: ref td)\n (v: Ghost.erased t {fractionable td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (pts_to r v)\n (fun _ -> (pts_to r (mk_fraction td v p1)) `star` (pts_to r (mk_fraction td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet mk_fraction_split\n (#opened: _)\n (#t: Type) (#td: typedef t) (r: ref td) (v: Ghost.erased t { fractionable td v }) (p1 p2: P.perm) : STGhost unit opened\n (pts_to r v)\n (fun _ -> pts_to r (mk_fraction td v p1) `star` pts_to r (mk_fraction td v p2))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)\n= mk_fraction_full td v;\n rewrite (pts_to _ _) (pts_to _ _);\n mk_fraction_split_gen r v P.full_perm p1 p2", "val mk_fraction_seq (#t: Type) (td: typedef t) (s: Seq.seq t) (p: perm)\n : Ghost (Seq.seq t) (requires (fractionable_seq td s)) (ensures (fun _ -> True))\nlet mk_fraction_seq (#t: Type) (td: typedef t) (s: Seq.seq t) (p: perm) : Ghost (Seq.seq t)\n (requires (fractionable_seq td s))\n (ensures (fun _ -> True))\n= Seq.init_ghost (Seq.length s) (fun i -> mk_fraction td (Seq.index s i) p)", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= rewrite\n (pts_to a _ _)\n (H.pts_to a p (seq_map raise x));\n H.share a p p1 p2;\n rewrite\n (H.pts_to a p1 _)\n (pts_to a p1 x);\n rewrite\n (H.pts_to a p2 _)\n (pts_to a p2 x)", "val share\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (a: array elt)\n (p p1 p2: P.perm)\n: STGhost unit opened\n (pts_to a p x)\n (fun _ -> pts_to a p1 x `star` pts_to a p2 x)\n (p == p1 `P.sum_perm` p2)\n (fun _ -> True)\nlet share\n #_ #_ #x a p p1 p2\n= elim_pts_to a p x;\n mk_carrier_share (US.v (ptr_of a).base_len) (ptr_of a).offset x p1 p2;\n R.split (ptr_of a).base _\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p1)\n (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset x p2);\n intro_pts_to a p1 x;\n intro_pts_to a p2 x", "val share_gen\n (#t: Type)\n (#opened: _)\n (#p: perm)\n (#v: t)\n (r: ref t)\n (p1 p2: perm)\n: STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n #_ #_ #_ #v r p1 p2\n= coerce_ghost (fun _ -> R.ghost_share_gen_pt #_ #_ #_ #v r p1 p2)", "val scalar_unique (#opened: _) (#t: Type) (v1 v2: t) (p1 p2: P.perm) (r: ref (scalar t))\n : STGhost unit\n opened\n ((pts_to r (mk_fraction (scalar t) (mk_scalar v1) p1))\n `star`\n (pts_to r (mk_fraction (scalar t) (mk_scalar v2) p2)))\n (fun _ ->\n (pts_to r (mk_fraction (scalar t) (mk_scalar v1) p1))\n `star`\n (pts_to r (mk_fraction (scalar t) (mk_scalar v2) p2)))\n (True)\n (fun _ -> v1 == v2 /\\ (p1 `P.sum_perm` p2) `P.lesser_equal_perm` P.full_perm)\nlet scalar_unique\n (#opened: _)\n (#t: Type)\n (v1 v2: t)\n (p1 p2: P.perm)\n (r: ref (scalar t))\n: STGhost unit opened\n (pts_to r (mk_fraction (scalar t) (mk_scalar v1) p1) `star` pts_to r (mk_fraction (scalar t) (mk_scalar v2) p2))\n (fun _ -> pts_to r (mk_fraction (scalar t) (mk_scalar v1) p1) `star` pts_to r (mk_fraction (scalar t) (mk_scalar v2) p2))\n (True)\n (fun _ -> v1 == v2 /\\ (p1 `P.sum_perm` p2) `P.lesser_equal_perm` P.full_perm)\n= fractional_permissions_theorem (mk_scalar v1) (mk_scalar v2) p1 p2 r;\n mk_scalar_inj v1 v2 P.full_perm P.full_perm", "val mk_fraction_seq_full (#t: Type0) (td: typedef t) (x: Seq.seq t)\n : Lemma (requires (fractionable_seq td x))\n (ensures (mk_fraction_seq td x full_perm == x))\n [SMTPat (mk_fraction_seq td x full_perm)]\nlet mk_fraction_seq_full (#t: Type0) (td: typedef t) (x: Seq.seq t) : Lemma\n (requires (fractionable_seq td x))\n (ensures (mk_fraction_seq td x full_perm == x))\n [SMTPat (mk_fraction_seq td x full_perm)]\n= assert (mk_fraction_seq td x full_perm `Seq.equal` x)", "val pts_to_range_split\n (#opened: _)\n (#elt: Type0)\n (#p: P.perm)\n (#s: Seq.seq elt)\n (a: array elt)\n (i m j: nat)\n: STGhost unit opened\n (pts_to_range a i j p s)\n (fun _ -> exists_ (fun s1 -> exists_ (fun s2 ->\n pts_to_range a i m p s1 `star`\n pts_to_range a m j p s2 `star`\n pure (\n i <= m /\\ m <= j /\\ j <= length a /\\\n Seq.length s == j - i /\\\n s1 == Seq.slice s 0 (m - i) /\\\n s2 == Seq.slice s (m - i) (Seq.length s) /\\\n s == Seq.append s1 s2\n ))))\n (i <= m /\\ m <= j)\n (fun _ -> True)\nlet pts_to_range_split\n #_ #_ #p #s a i m j\n= length_fits a;\n pts_to_range_prop a i j p s;\n let a' = pts_to_range_elim' a i j p s in\n let mi = US.uint_to_t (m - i) in\n ptr_shift_add (ptr_of a) (US.uint_to_t i) mi;\n let _ = ghost_split a' mi in\n pts_to_range_intro' a m j p (split_r a' mi) _;\n pts_to_range_intro' a i m p (split_l a' mi) _;\n noop ()", "val pts_to_length\n (#opened: _)\n (#elt: Type u#1)\n (#p: P.perm)\n (a: array elt)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to a p s)\n (fun _ -> pts_to a p s)\n (True)\n (fun _ -> Seq.length s == length a)\nlet pts_to_length\n a s\n=\n elim_pts_to a _ s;\n intro_pts_to a _ s", "val gather\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (#x1: Seq.seq elt) (p1: P.perm)\n (#x2: Seq.seq elt) (p2: P.perm)\n: STGhost unit opened\n (pts_to a p1 x1 `star` pts_to a p2 x2)\n (fun _ -> pts_to a (p1 `P.sum_perm` p2) x1)\n (True)\n (fun _ -> x1 == x2)\nlet gather\n #_ #_ a #x1 p1 #x2 p2\n= rewrite\n (pts_to a p1 _)\n (H.pts_to a p1 (seq_map raise x1));\n rewrite\n (pts_to a p2 _)\n (H.pts_to a p2 (seq_map raise x2));\n H.gather a p1 p2;\n rewrite\n (H.pts_to a _ _)\n (pts_to _ _ _)", "val gather\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (#x1: Seq.seq elt) (p1: P.perm)\n (#x2: Seq.seq elt) (p2: P.perm)\n: STGhost unit opened\n (pts_to a p1 x1 `star` pts_to a p2 x2)\n (fun _ -> pts_to a (p1 `P.sum_perm` p2) x1)\n (True)\n (fun _ -> x1 == x2)\nlet gather\n a #x1 p1 #x2 p2\n= elim_pts_to a p1 x1;\n elim_pts_to a p2 x2;\n let _ = R.gather (ptr_of a).base\n (mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 p1)\n (mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset) x2 p2)\n in\n mk_carrier_gather (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 x2 p1 p2;\n mk_carrier_valid_sum_perm (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 p1 p2;\n intro_pts_to a (p1 `P.sum_perm` p2) x1", "val intro_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (#v: _) (p: P.perm) (s: Seq.seq elt)\n : STGhost unit\n opened\n (R.pts_to (ptr_of a).base v)\n (fun _ -> pts_to a p s)\n (v == mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p /\\\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a)\n (fun _ -> True)\nlet intro_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (#v: _) (p: P.perm) (s: Seq.seq elt) : STGhost unit opened\n (R.pts_to (ptr_of a).base v)\n (fun _ -> pts_to a p s)\n (\n v == mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p /\\\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a\n )\n (fun _ -> True)\n= change_r_pts_to (ptr_of a).base v (ptr_of a).base (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p);\n intro_pure _;\n rewrite\n (pts_to0 a p s)\n (pts_to a p s)", "val pts_to_length\n (#opened: _)\n (#elt: Type0)\n (#p: P.perm)\n (a: array elt)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to a p s)\n (fun _ -> pts_to a p s)\n (True)\n (fun _ -> Seq.length s == length a)\nlet pts_to_length a s =\n H.pts_to_length a _", "val ghost_split\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (#p: P.perm)\n (a: array elt)\n (i: US.t)\n: STGhost (squash (US.v i <= length a /\\ US.v i <= Seq.length x)) opened\n (pts_to a p x)\n (fun res ->\n pts_to (split_l a i) p (Seq.slice x 0 (US.v i)) `star`\n pts_to (split_r a i) p (Seq.slice x (US.v i) (Seq.length x)))\n (US.v i <= length a)\n (fun res ->\n x == Seq.append (Seq.slice x 0 (US.v i)) (Seq.slice x (US.v i) (Seq.length x))\n )\nlet ghost_split\n #_ #_ #x #p a i\n=\n rewrite\n (pts_to a _ _)\n (H.pts_to a p (seq_map raise x));\n let _ = H.ghost_split a i in\n //H.ghost_split a i;\n assert (seq_map raise (Seq.slice x 0 (US.v i)) `Seq.equal` Seq.slice (seq_map raise x) 0 (US.v i));\n rewrite\n (H.pts_to (H.split_l a i) _ _)\n (H.pts_to (split_l a i) p (seq_map raise (Seq.slice x 0 (US.v i))));\n rewrite\n (H.pts_to (split_l a i) _ _)\n (pts_to (split_l a i) _ _);\n assert (seq_map raise (Seq.slice x (US.v i) (Seq.length x)) `Seq.equal` Seq.slice (seq_map raise x) (US.v i) (Seq.length (seq_map raise x)));\n Seq.lemma_split x (US.v i);\n rewrite\n (H.pts_to (H.split_r a i) _ _)\n (H.pts_to (split_r a i) p (seq_map raise (Seq.slice x (US.v i) (Seq.length x))));\n rewrite\n (H.pts_to (split_r a i) _ _)\n (pts_to (split_r a i) _ _)", "val ghost_split\n (#opened: _)\n (#elt: Type)\n (#x: Seq.seq elt)\n (#p: P.perm)\n (a: array elt)\n (i: US.t)\n: STGhost (squash (US.v i <= length a /\\ US.v i <= Seq.length x)) opened\n (pts_to a p x)\n (fun res ->\n pts_to (split_l a i) p (Seq.slice x 0 (US.v i)) `star`\n pts_to (split_r a i) p (Seq.slice x (US.v i) (Seq.length x)))\n (US.v i <= length a)\n (fun res ->\n x == Seq.append (Seq.slice x 0 (US.v i)) (Seq.slice x (US.v i) (Seq.length x))\n )\nlet ghost_split\n #_ #_ #x #p a i\n=\n elim_pts_to a p x;\n mk_carrier_split\n (US.v (ptr_of a).base_len)\n ((ptr_of a).offset)\n x\n (p)\n (US.v i);\n Seq.lemma_split x (US.v i);\n let xl = Seq.slice x 0 (US.v i) in\n let xr = Seq.slice x (US.v i) (Seq.length x) in\n let vl = mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset) xl (p) in\n let vr = mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset + US.v i) xr (p) in\n R.split (ptr_of a).base _ vl vr;\n change_r_pts_to\n (ptr_of a).base vl\n (ptr_of (split_l a i)).base vl;\n intro_pts_to (split_l a i) #vl p (Seq.slice x 0 (US.v i));\n change_r_pts_to\n (ptr_of a).base vr\n (ptr_of (split_r a i)).base vr;\n intro_pts_to (split_r a i) #vr p (Seq.slice x (US.v i) (Seq.length x))", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val share_gen (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : STGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n r p1 p2\n= coerce_ghost (fun _ -> R.share_gen_pt r p1 p2)", "val elim_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (p: P.perm) (s: Seq.seq elt)\n : STGhost unit\n opened\n (pts_to a p s)\n (fun _ ->\n R.pts_to (ptr_of a).base (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p))\n (True)\n (fun _ ->\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a)\nlet elim_pts_to (#opened: _) (#elt: Type u#1) (a: array elt) (p: P.perm) (s: Seq.seq elt) : STGhost unit opened\n (pts_to a p s)\n (fun _ -> R.pts_to (ptr_of a).base (mk_carrier (US.v (ptr_of a).base_len) (ptr_of a).offset s p))\n (True)\n (fun _ ->\n valid_perm (US.v (ptr_of a).base_len) (ptr_of a).offset (Seq.length s) p /\\\n Seq.length s == length a\n )\n= rewrite\n (pts_to a p s)\n (pts_to0 a p s);\n elim_pure _", "val gather\n (#a:Type)\n (v:vec a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n : stt_ghost unit\n (requires pts_to v #p0 s0 ** pts_to v #p1 s1)\n (ensures fun _ -> pts_to v #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather v = A.gather v", "val share (#opened: _) (#elt: Type) (a: array elt) (p p1 p2: P.perm)\n : SteelGhost unit\n opened\n (varrayp a p)\n (fun _ -> (varrayp a p1) `star` (varrayp a p2))\n (fun _ -> p == p1 `P.sum_perm` p2)\n (fun h _ h' -> aselp a p1 h' == aselp a p h /\\ aselp a p2 h' == aselp a p h)\nlet share\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (p p1 p2: P.perm)\n: SteelGhost unit opened\n (varrayp a p)\n (fun _ -> varrayp a p1 `star` varrayp a p2)\n (fun _ -> p == p1 `P.sum_perm` p2)\n (fun h _ h' ->\n aselp a p1 h' == aselp a p h /\\\n aselp a p2 h' == aselp a p h\n )\n= let _ = elim_varrayp a p in\n A.share a p p1 p2;\n intro_varrayp a p1 _;\n intro_varrayp a p2 _", "val share_gen_pt (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen_pt #a #uses #p #v r p1 p2 =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share_gen r p1 p2;\n rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ());\n rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ())", "val pts_to_not_null\n (#opened: _)\n (#elt: Type0)\n (#p: P.perm)\n (a: array elt)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to a p s)\n (fun _ -> pts_to a p s)\n (True)\n (fun _ -> a =!= null)\nlet pts_to_not_null #_ #t #p a s =\n let _ = H.pts_to_not_null #_ #_ #p a (seq_map raise s) in\n assert (a =!= H.null #(raise_t t));\n Classical.move_requires (h_array_eq' a) (H.null #(raise_t t));\n noop ()", "val pts_to_not_null\n (#opened: _)\n (#elt: Type u#1)\n (#p: P.perm)\n (a: array elt)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to a p s)\n (fun _ -> pts_to a p s)\n (True)\n (fun _ -> a =!= null)\nlet pts_to_not_null\n a s\n= elim_pts_to a _ s;\n R.pts_to_not_null _ _;\n intro_pts_to a _ s", "val on_range_split\n (#opened: _)\n (p: (nat -> vprop))\n (i j k: nat)\n: STGhost unit opened\n (on_range p i k)\n (fun _ -> on_range p i j `star` on_range p j k)\n (i <= j /\\ j <= k)\n (fun _ -> True)\nlet rec on_range_split\n (#opened: _)\n (p: (nat -> vprop))\n (i j k: nat)\n: STGhost unit opened\n (on_range p i k)\n (fun _ -> on_range p i j `star` on_range p j k)\n (i <= j /\\ j <= k)\n (fun _ -> True)\n (decreases (j - i))\n= if i = j\n then begin\n rewrite emp (on_range p i j);\n rewrite (on_range p i k) (on_range p j k)\n end else begin\n rewrite (on_range p i k) (p i `star` on_range p (i + 1) k);\n on_range_split p (i + 1) j k;\n rewrite (p i `star` on_range p (i + 1) j) (on_range p i j)\n end", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share = share'", "val share_atomic_raw_gen\n (#a #uses: _)\n (#p: perm)\n (r: ref a {perm_ok p})\n (v0: erased a)\n (p1 p2: perm)\n : SteelGhost unit\n uses\n (pts_to_raw r p v0)\n (fun _ -> (pts_to_raw r p1 v0) `star` (pts_to_raw r p2 v0))\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_atomic_raw_gen #a #uses (#p:perm) (r:ref a{perm_ok p}) (v0:erased a) (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to_raw r p v0)\n (fun _ -> pts_to_raw r p1 v0 `star` pts_to_raw r p2 v0)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = rewrite_slprop\n (pts_to_raw r p v0)\n (RP.pts_to r _)\n (fun _ -> ());\n RP.split r (Some (Ghost.reveal v0, p)) (Some (Ghost.reveal v0, p1)) (Some (Ghost.reveal v0, p2));\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p1 v0)\n (fun _ -> ());\n rewrite_slprop\n (RP.pts_to r _)\n (pts_to_raw r p2 v0)\n (fun _ -> ())", "val read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t))\n : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1\n )\nlet read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t)) : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p . (* {:pattern (mk_fraction (scalar t) (mk_scalar v0) p)} *) Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1)\n= let v0 = FStar.IndefiniteDescription.indefinite_description_tot _ (fun v0 -> exists p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p) in\n let p = FStar.IndefiniteDescription.indefinite_description_tot _ (fun p -> Ghost.reveal v == mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p) in\n let prf v0' p' : Lemma\n (requires (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p'))\n (ensures (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = mk_scalar_inj (Ghost.reveal v0) v0' p p'\n in\n let prf' v0' p' : Lemma\n (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p' ==> (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = Classical.move_requires (prf v0') p'\n in\n Classical.forall_intro_2 prf';\n rewrite (pts_to _ _) (pts_to r (mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p));\n let v1 = read0 r in\n rewrite (pts_to _ _) (pts_to r v);\n return v1", "val pts_to_range_split\n (#elt: Type0)\n (a: array elt)\n (i m j: nat)\n (#p: perm)\n (#s: Seq.seq elt)\n: stt_ghost unit\n (pts_to_range a i j #p s **\n pure (i <= m /\\ m <= j)\n )\n (fun _ -> exists* s1 s2.\n pts_to_range a i m #p s1 **\n pts_to_range a m j #p s2 **\n pure (\n i <= m /\\ m <= j /\\ j <= length a /\\\n Seq.length s == j - i /\\\n s1 == Seq.slice s 0 (m - i) /\\\n s2 == Seq.slice s (m - i) (Seq.length s) /\\\n s == Seq.append s1 s2\n ))\nlet pts_to_range_split = pts_to_range_split'", "val pts_to_range_join\n (#opened: _)\n (#elt: Type0)\n (#p: P.perm)\n (#s1 #s2: Seq.seq elt)\n (a: array elt)\n (i m j: nat)\n: STGhostT unit opened\n (pts_to_range a i m p s1 `star` pts_to_range a m j p s2)\n (fun _ -> pts_to_range a i j p (s1 `Seq.append` s2))\nlet pts_to_range_join\n #_ #_ #p #s1 #s2 a i m j\n= length_fits a;\n pts_to_range_prop a i m p s1;\n pts_to_range_prop a m j p s2;\n let a1 = pts_to_range_elim' a i m p s1 in\n let a2 = pts_to_range_elim' a m j p s2 in\n ghost_join a1 a2 ();\n pts_to_range_intro' a i j p _ _", "val split (#p:dprot) (r:chan p) (v_full v0 v1:t p) (_:squash (composable v0 v1)) (_:squash (v_full == compose v0 v1))\n : SteelT unit (pts_to r v_full) (fun _ -> pts_to r v0 `star` pts_to r v1)\nlet split r v v0 v1 u1 u2 =\n rewrite_slprop (pts_to r v) (pts_to r (reveal (hide v))) (fun _ -> ());\n split r v v0 v1;\n rewrite_slprop (pts_to r (reveal (hide v0))) (pts_to r v0) (fun _ -> ());\n rewrite_slprop (pts_to r (reveal (hide v1))) (pts_to r v1) (fun _ -> ())", "val intro_vptrp\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h0 _ h1 ->\n Seq.create 1 (selp r p h1) == A.aselp r p h0\n )\nlet intro_vptrp r p =\n let h0 = get () in\n intro_vptrp' r p;\n let h1 = get () in\n assert (Seq.create 1 (selp r p h1) `Seq.equal` A.aselp r p h0)", "val gather (#opened: _) (#elt: Type) (a: array elt) (p1 p2: P.perm)\n : SteelGhost unit\n opened\n ((varrayp a p1) `star` (varrayp a p2))\n (fun _ -> varrayp a (p1 `P.sum_perm` p2))\n (fun _ -> True)\n (fun h _ h' ->\n aselp a (p1 `P.sum_perm` p2) h' == aselp a p1 h /\\\n aselp a (p1 `P.sum_perm` p2) h' == aselp a p2 h)\nlet gather\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (p1: P.perm)\n (p2: P.perm)\n: SteelGhost unit opened\n (varrayp a p1 `star` varrayp a p2)\n (fun _ -> varrayp a (p1 `P.sum_perm` p2))\n (fun _ -> True)\n (fun h _ h' ->\n aselp a (p1 `P.sum_perm` p2) h' == aselp a p1 h /\\\n aselp a (p1 `P.sum_perm` p2) h' == aselp a p2 h\n )\n= let _ = elim_varrayp a p1 in\n let _ = elim_varrayp a p2 in\n A.gather a p1 p2;\n intro_varrayp a _ _", "val pts_to_range_split\n (#elt: Type)\n (a: array elt)\n (i m j: nat)\n (#p: perm)\n (#s: Seq.seq elt)\n: stt_ghost unit\n (pts_to_range a i j #p s **\n pure (i <= m /\\ m <= j)\n )\n (fun _ -> exists* s1 s2.\n pts_to_range a i m #p s1 **\n pts_to_range a m j #p s2 **\n pure (\n i <= m /\\ m <= j /\\ j <= length a /\\\n Seq.length s == j - i /\\\n s1 == Seq.slice s 0 (m - i) /\\\n s2 == Seq.slice s (m - i) (Seq.length s) /\\\n s == Seq.append s1 s2\n ))\nlet pts_to_range_split = pts_to_range_split'", "val pts_to_range_elim\n (#opened: _)\n (#elt: Type0) (a: array elt)\n (p: P.perm)\n (s: Seq.seq elt)\n: STGhostT unit opened\n (pts_to_range a 0 (length a) p s)\n (fun _ -> pts_to a p s)\nlet pts_to_range_elim\n a p s\n= ptr_shift_zero (ptr_of a);\n let a' = pts_to_range_elim' a 0 (length a) p s in\n vpattern_rewrite (fun a' -> pts_to a' _ _) a", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Seq.seq elt)\n (#p: P.perm)\n (a1 a2: array elt)\n (h: squash (adjacent a1 a2))\n: STGhostT unit opened\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to (merge a1 a2) p (x1 `Seq.append` x2))\nlet ghost_join\n #_ #_ #x1 #x2 #p a1 a2 h\n= elim_pts_to a1 p x1;\n elim_pts_to a2 p x2;\n mk_carrier_merge (US.v (ptr_of a1).base_len) ((ptr_of a1).offset) x1 x2 (p);\n change_r_pts_to\n (ptr_of a2).base _\n (ptr_of a1).base (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset + Seq.length x1) x2 p);\n R.gather (ptr_of a1).base\n (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset) x1 (p))\n (mk_carrier (US.v (ptr_of a1).base_len) ((ptr_of a1).offset + Seq.length x1) x2 (p));\n change_r_pts_to\n (ptr_of a1).base _\n (ptr_of (merge a1 a2)).base (mk_carrier (US.v (ptr_of (merge a1 a2)).base_len) ((ptr_of (merge a1 a2)).offset) (x1 `Seq.append` x2) (p));\n intro_pts_to (merge a1 a2) p (Seq.append x1 x2)", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Seq.seq elt)\n (#p: P.perm)\n (a1 a2: array elt)\n (h: squash (adjacent a1 a2))\n: STGhostT unit opened\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to (merge a1 a2) p (x1 `Seq.append` x2))\nlet ghost_join\n #_ #_ #x1 #x2 #p a1 a2 h\n= rewrite\n (pts_to a1 _ _)\n (H.pts_to a1 p (seq_map raise x1));\n rewrite\n (pts_to a2 _ _)\n (H.pts_to a2 p (seq_map raise x2));\n H.ghost_join a1 a2 h;\n assert (seq_map raise (x1 `Seq.append` x2) `Seq.equal` (seq_map raise x1 `Seq.append` seq_map raise x2));\n rewrite\n (H.pts_to _ _ _)\n (H.pts_to (merge a1 a2) p (seq_map raise (x1 `Seq.append` x2)));\n rewrite\n (H.pts_to _ _ _)\n (pts_to (merge a1 a2) _ _)", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n: stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share #a arr #s #p = H.share arr #(raise_seq s) #p", "val elim_vptrp\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (vptrp r p)\n (fun _ -> A.varrayp r p)\n (fun _ -> True)\n (fun h0 _ h1 ->\n A.aselp r p h1 == Seq.create 1 (selp r p h0)\n )\nlet elim_vptrp\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (vptrp r p)\n (fun _ -> A.varrayp r p)\n (fun _ -> True)\n (fun h _ h' ->\n A.aselp r p h' `Seq.equal` Seq.create 1 (selp r p h)\n )\n= change_slprop_rel\n (vptrp r p)\n (vptr0 r p)\n (fun v1 v2 -> v1 === v2)\n (fun m ->\n assert (interp (hp_of (vptr0 r p)) m);\n assert_norm (sel_of (vptr0 r p) m === sel_of (vptrp r p) m)\n );\n elim_vptr0 r p", "val ghost_join\n (#opened: _)\n (#elt: Type)\n (#p: P.perm)\n (a1 a2: array elt)\n (sq: squash (adjacent a1 a2))\n : SteelGhost unit\n opened\n ((varrayp a1 p) `star` (varrayp a2 p))\n (fun res -> varrayp (merge a1 a2) p)\n (fun _ -> True)\n (fun h _ h' -> aselp (merge a1 a2) p h' == (aselp a1 p h) `Seq.append` (aselp a2 p h))\nlet ghost_join\n (#opened: _)\n (#elt: Type)\n (#p: P.perm)\n (a1 a2: array elt)\n (sq: squash (adjacent a1 a2))\n: SteelGhost unit opened\n (varrayp a1 p `star` varrayp a2 p)\n (fun res -> varrayp (merge a1 a2) p)\n (fun _ -> True)\n (fun h _ h' ->\n aselp (merge a1 a2) p h' == aselp a1 p h `Seq.append` aselp a2 p h\n )\n= let _ = elim_varrayp a1 p in\n let _ = elim_varrayp a2 p in\n A.ghost_join a1 a2 ();\n intro_varrayp _ _ _", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1:a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost\n (fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1:a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost\n (fun _ -> R.pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n #_ #_ #p0 #p1 #v0 #v1 r\n= rewrite (pts_to r p0 v0) (RST.pts_to r.reveal p0 v0);\n rewrite (pts_to r p1 v1) (RST.pts_to r.reveal p1 v1);\n RST.pts_to_injective_eq #_ #_ #_ #_ #v0 #v1 r.reveal;\n rewrite (RST.pts_to r.reveal p0 v0) (pts_to r p0 v0);\n rewrite (RST.pts_to r.reveal p1 v0) (pts_to r p1 v0)", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Ghost.erased (Seq.seq elt))\n (#p: P.perm)\n (a1: array elt)\n (a2: Ghost.erased (array elt))\n : STAtomicBase (array elt)\n false\n opened\n Unobservable\n ((pts_to a1 p x1) `star` (pts_to a2 p x2))\n (fun res -> pts_to res p (x1 `Seq.append` x2))\n (adjacent a1 a2)\n (fun res -> merge_into a1 a2 res)\nlet join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Ghost.erased (Seq.seq elt))\n (#p: P.perm)\n (a1: array elt)\n (a2: Ghost.erased (array elt))\n: STAtomicBase (array elt) false opened Unobservable\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to res p (x1 `Seq.append` x2))\n (adjacent a1 a2)\n (fun res -> merge_into a1 a2 res)\n= let _ : squash (adjacent a1 a2) = () in\n ghost_join a1 a2 ();\n let res = merge a1 a2 in\n rewrite\n (pts_to (merge a1 (Ghost.hide (Ghost.reveal a2))) p (x1 `Seq.append` x2))\n (pts_to res p (x1 `Seq.append` x2));\n return res", "val join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Ghost.erased (Seq.seq elt))\n (#p: P.perm)\n (a1: array elt)\n (a2: Ghost.erased (array elt))\n : STAtomicBase (array elt)\n false\n opened\n Unobservable\n ((pts_to a1 p x1) `star` (pts_to a2 p x2))\n (fun res -> pts_to res p (x1 `Seq.append` x2))\n (adjacent a1 a2)\n (fun res -> merge_into a1 a2 res)\nlet join\n (#opened: _)\n (#elt: Type)\n (#x1 #x2: Ghost.erased (Seq.seq elt))\n (#p: P.perm)\n (a1: array elt)\n (a2: Ghost.erased (array elt))\n: STAtomicBase (array elt) false opened Unobservable\n (pts_to a1 p x1 `star` pts_to a2 p x2)\n (fun res -> pts_to res p (x1 `Seq.append` x2))\n (adjacent a1 a2)\n (fun res -> merge_into a1 a2 res)\n= let _ : squash (adjacent a1 a2) = () in\n ghost_join a1 a2 ();\n let res = merge a1 a2 in\n rewrite\n (pts_to (merge a1 (Ghost.hide (Ghost.reveal a2))) p (x1 `Seq.append` x2))\n (pts_to res p (x1 `Seq.append` x2));\n return res", "val intro_vptrp' (#opened: _) (#a: Type0) (r: ref a) (p: perm)\n : SteelGhost unit\n opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\ selp r p h' == Seq.index s 0)\nlet intro_vptrp'\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\\n selp r p h' == Seq.index s 0\n )\n= intro_vptr0 r p;\n change_slprop_rel\n (vptr0 r p)\n (vptrp r p)\n (fun v1 v2 -> v1 === v2)\n (fun m ->\n assert (interp (hp_of (vptrp r p)) m);\n assert_norm (sel_of (vptrp r p) m === sel_of (vptr0 r p) m)\n )", "val split (r:ref stepper p) (v_full v0 v1:stepper)\n : Steel unit (pts_to r v_full) (fun _ -> pts_to r v0 `star` pts_to r v1)\n (fun _ -> composable v0 v1 /\\ v_full == compose v0 v1)\n (fun _ _ _ -> True)\nlet split r v_full v0 v1 = split r v_full v0 v1", "val pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: erased a)\n (r: ref a)\n : SteelGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r =\n extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1)\n (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m);\n rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ())", "val pts_to_len (#a:Type0) (v:vec a) (#p:perm) (#s:Seq.seq a)\n : stt_ghost unit\n (pts_to v #p s)\n (fun _ \u2192 pts_to v #p s ** pure (length v == Seq.length s))\nlet pts_to_len v = A.pts_to_len v", "val seq_seq_match_seq_list_match\n (#opened: _)\n (#t1 #t2: Type)\n (p: (t1 -> t2 -> vprop))\n (c: Seq.seq t1)\n (l: list t2)\n : STGhost unit\n opened\n (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l))\n (fun _ -> seq_list_match c l p)\n (Seq.length c == List.Tot.length l)\n (fun _ -> True)\n (decreases l)\nlet rec seq_seq_match_seq_list_match\n (#opened: _)\n (#t1 #t2: Type)\n (p: t1 -> t2 -> vprop)\n (c: Seq.seq t1)\n (l: list t2)\n: STGhost unit opened\n (seq_seq_match p c (Seq.seq_of_list l) 0 (List.Tot.length l))\n (fun _ -> seq_list_match c l p)\n (Seq.length c == List.Tot.length l)\n (fun _ -> True)\n (decreases l)\n= match l with\n | [] ->\n drop (seq_seq_match p _ _ _ _);\n rewrite\n (seq_list_match_nil0 c)\n (seq_list_match c l p)\n | a :: q ->\n Seq.lemma_seq_of_list_induction (a :: q);\n seq_list_match_cons_eq c l p;\n on_range_uncons\n (seq_seq_match_item p _ _)\n _ 1 _;\n rewrite\n (seq_seq_match_item p _ _ _)\n (p (Seq.head c) (List.Tot.hd l));\n let _ = seq_seq_match_tail_intro\n p _ _ 1 _ _\n in\n rewrite\n (seq_seq_match p _ _ _ _)\n (seq_seq_match p (Seq.tail c) (Seq.seq_of_list (List.Tot.tl l)) 0 (List.Tot.length (List.Tot.tl l)));\n seq_seq_match_seq_list_match p _ (List.Tot.tl l);\n rewrite\n (seq_list_match_cons0 c l p seq_list_match)\n (seq_list_match c l p)", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (pts_to r p x)\n (fun _ -> pts_to r p1 x `star`\n pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop\n (pts_to r p v)\n (pts_to' r p v)\n (fun _ -> ());\n elim_pure (perm_ok p);\n share_atomic_raw_gen r v p1 p2;\n intro_pts_to p1 r;\n intro_pts_to p2 r", "val share (#a:Type) (r:box a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share b = R.share b", "val init_compare_inv\n (#o: _)\n (#t: eqtype)\n (#p0 #p1: perm)\n (a0 a1: array t)\n (#s0 #s1: Seq.seq t)\n (l: US.t)\n (ctr: R.ref (option US.t))\n : STGhost unit\n o\n (let open US in\n ((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))\n `star`\n (R.pts_to ctr Steel.FractionalPermission.full_perm (Some 0sz)))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\n (requires (length a0 > 0 /\\ length a0 == length a1 /\\ US.v l == length a0))\n (ensures (fun _ -> True))\nlet init_compare_inv #o\n (#t:eqtype)\n (#p0 #p1:perm)\n (a0 a1:array t)\n (#s0: Seq.seq t)\n (#s1: Seq.seq t)\n (l:US.t)\n (ctr : R.ref (option US.t))\n : STGhost unit o\n (let open US in\n pts_to a0 p0 s0 `star`\n pts_to a1 p1 s1 `star`\n R.pts_to ctr Steel.FractionalPermission.full_perm (Some 0sz))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\n (requires (\n length a0 > 0 /\\\n length a0 == length a1 /\\\n US.v l == length a0\n ))\n (ensures (fun _ -> True))\n = pts_to_length a0 _;\n pts_to_length a1 _;\n intro_pure (equal_up_to s0 s1 (Ghost.hide (Some 0sz)));\n rewrite\n (R.pts_to ctr Steel.FractionalPermission.full_perm (Some 0sz))\n (R.pts_to ctr Steel.FractionalPermission.full_perm (Ghost.hide (Some 0sz)));\n intro_exists_compare_inv a0 a1 l ctr (Ghost.hide (Some 0sz))", "val share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share_pt r)", "val higher_ref_pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: erased a)\n (r: ref a)\n : SteelGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r =\n extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1)\n (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m);\n rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ())", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share r)", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share\n r\n= RST.share r.reveal", "val pts_to_range_intro\n (#opened: _)\n (#elt: Type0) (a: array elt)\n (p: P.perm)\n (s: Seq.seq elt)\n: STGhostT unit opened\n (pts_to a p s)\n (fun _ -> pts_to_range a 0 (length a) p s)\nlet pts_to_range_intro\n a p s\n= ptr_shift_zero (ptr_of a);\n pts_to_range_intro' a 0 (length a) p a s", "val free (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit opened\n (pts_to r full_perm v) (fun _ -> emp)\nlet free\n #_ #a #v r\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_free gr)", "val intro_exists_compare_inv\n (#o: _)\n (#t: eqtype)\n (#p0 #p1: perm)\n (a0 a1: array t)\n (#s0 #s1: Seq.seq t)\n (l: US.t)\n (ctr: R.ref (option US.t))\n (x: Ghost.erased (option US.t))\n : STGhostT unit\n o\n (let open US in\n (((pts_to a0 p0 s0) `star` (pts_to a1 p1 s1))\n `star`\n (R.pts_to ctr Steel.FractionalPermission.full_perm x))\n `star`\n (pure (equal_up_to s0 s1 x)))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\nlet intro_exists_compare_inv #o\n (#t:eqtype)\n (#p0 #p1:perm)\n (a0 a1:array t)\n (#s0: Seq.seq t)\n (#s1: Seq.seq t)\n (l:US.t)\n (ctr : R.ref (option US.t))\n (x: Ghost.erased (option US.t))\n : STGhostT unit o\n (let open US in\n pts_to a0 p0 s0 `star`\n pts_to a1 p1 s1 `star`\n R.pts_to ctr Steel.FractionalPermission.full_perm x `star`\n pure (equal_up_to s0 s1 x))\n (fun _ -> exists_ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr))\n = let b : bool =\n match Ghost.reveal x with\n | None -> false\n | Some x -> US.(x <^ l)\n in\n assert (within_bounds x l b);\n intro_compare_inv #_ #_ #p0 #p1 a0 a1 #s0 #s1 l ctr x b;\n intro_exists _ (compare_inv #_ #p0 #p1 a0 a1 s0 s1 l ctr)", "val pts_to_length (#opened:_) (#n:US.t) (#p:perm) (bv:bv_t n) (s:repr)\n : STGhost unit opened\n (pts_to bv p s)\n (fun _ -> pts_to bv p s)\n (requires True)\n (ensures fun _ -> Seq.length s == US.v n)\nlet pts_to_length bv s = A.pts_to_length bv s", "val pack_tperm\n (#opened: _)\n (#k: eqtype)\n (#v: Type0)\n (#contents: Type)\n (#vp: vp_t k v contents)\n (#h: hash_fn k)\n (s: Seq.seq (option (k & v)))\n (m: repr k contents)\n (borrows: Map.t k v)\n (a: tbl vp h)\n : STGhost unit\n opened\n ((A.pts_to a.store full_perm s) `star` (value_vprops vp s m borrows))\n (fun _ -> tperm a m borrows)\n (requires pure_invariant a m borrows s)\n (ensures fun _ -> True)\nlet pack_tperm (#opened:_)\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (#vp:vp_t k v contents)\n (#h:hash_fn k)\n (s:Seq.seq (option (k & v)))\n (m:repr k contents)\n (borrows:Map.t k v)\n (a:tbl vp h)\n : STGhost unit opened\n (A.pts_to a.store full_perm s\n `star`\n value_vprops vp s m borrows)\n (fun _ -> tperm a m borrows)\n (requires pure_invariant a m borrows s)\n (ensures fun _ -> True)\n = intro_pure (pure_invariant a m borrows s);\n intro_exists s (store_contents_pred a m borrows)", "val pts_to_range_prop\n (#opened: _)\n (#elt: Type0) (a: array elt) (i j: nat)\n (p: P.perm)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to_range a i j p s)\n (fun _ -> pts_to_range a i j p s)\n True\n (fun _ -> i <= j /\\ j <= length a /\\ Seq.length s == j - i)\nlet pts_to_range_prop\n a i j p s\n= let a' = pts_to_range_elim' a i j p s in\n pts_to_length a' s;\n pts_to_range_intro' a i j p a' s", "val split (#inames: _)\n (#a:Type)\n (#p:pcm a)\n (r:ref a p)\n (v:erased a)\n (v0:erased a)\n (v1:erased a)\n : SteelGhost unit inames (pts_to r v)\n (fun _ -> pts_to r v0 `star` pts_to r v1)\n (requires fun _ ->\n composable p v0 v1 /\\\n v == hide (op p v0 v1))\n (ensures fun _ _ _ -> True)\nlet split #_ #a #p r v v0 v1 =\n let _:squash (composable p v0 v1) = () in\n rewrite_slprop (pts_to r v) (pts_to r (op p v0 v1)) (fun _ -> ());\n split' r v0 v1;\n rewrite_slprop (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> ())", "val intro_varrayp\n (#opened: _) (#elt: Type) (a: array elt) (p: P.perm) (s: Seq.seq elt)\n: SteelGhost unit opened\n (pts_to a p s)\n (fun _ -> varrayp a p)\n (fun _ -> True)\n (fun _ _ h' ->\n aselp a p h' == s\n )\nlet intro_varrayp\n a p s\n=\n pts_to_length a _;\n change_equal_slprop\n (pts_to a p s)\n (pts_to' a p s);\n mk_selector_vprop_intro _ (pts_to'_inj a p);\n change_equal_slprop\n (mk_selector_vprop _ _)\n (varrayp a p)", "val memcpy\n (#t: _)\n (#p0: perm)\n (a0 a1: array t)\n (#s0 #s1: Ghost.erased (Seq.seq t))\n (l: US.t{US.v l == length a0 /\\ length a0 == length a1})\n : STT unit\n ((pts_to a0 p0 s0) `star` (pts_to a1 full_perm s1))\n (fun _ -> (pts_to a0 p0 s0) `star` (pts_to a1 full_perm s0))\nlet memcpy (#t:_) (#p0:perm)\n (a0 a1:array t)\n (#s0 #s1:Ghost.erased (Seq.seq t))\n (l:US.t { US.v l == length a0 /\\ length a0 == length a1 } )\n : STT unit\n (pts_to a0 p0 s0 `star` pts_to a1 full_perm s1)\n (fun _ -> pts_to a0 p0 s0 `star` pts_to a1 full_perm s0)\n= blit #t #p0 #s0 #s1 a0 0sz a1 0sz l;\n let s1' = elim_exists () in\n elim_pure (blit_post s0 s1 a0 0sz a1 0sz l s1');\n vpattern_rewrite (pts_to a1 full_perm) (Ghost.reveal s0);\n return ()", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather (#a:Type)\n (#uses:_)\n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost (fun _ -> R.gather #a #uses #p0 #p1 #v0 #v1 r)", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather\n p1 r\n= RST.gather p1 r.reveal", "val split (#inames: _)\n (#a:Type)\n (#p:pcm a)\n (r:ref a p)\n (v:erased a)\n (v0:erased a)\n (v1:erased a)\n : STGhost unit inames (pts_to r v)\n (fun _ -> pts_to r v0 `star` pts_to r v1)\n (requires\n composable p v0 v1 /\\\n v == hide (op p v0 v1))\n (ensures fun _ -> True)\nlet split r v v0 v1 = C.coerce_ghost (fun _ -> P.split r v v0 v1)", "val pts_to_range_elim'\n (#opened: _)\n (#elt: Type0)\n (a: array elt)\n (i j: nat)\n (p: P.perm)\n (s: Seq.seq elt)\n : STGhost (Ghost.erased (array elt))\n opened\n (pts_to_range a i j p s)\n (fun a' -> pts_to a' p s)\n True\n (fun a' -> i <= j /\\ j <= length a /\\ Ghost.reveal a' == array_slice a i j ())\nlet pts_to_range_elim'\n (#opened: _)\n (#elt: Type0) (a: array elt) (i j: nat)\n (p: P.perm)\n (s: Seq.seq elt)\n: STGhost (Ghost.erased (array elt)) opened\n (pts_to_range a i j p s)\n (fun a' -> pts_to a' p s)\n True\n (fun a' -> i <= j /\\ j <= length a /\\\n Ghost.reveal a' == array_slice a i j ()\n )\n= rewrite (pts_to_range a i j p s) (exists_ (pts_to_range_body a i j p s));\n let _ = elim_exists () in\n vpattern_replace_erased (fun a' -> pts_to a' p s)", "val gather\n (#a:Type)\n (arr:array a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n: stt_ghost unit\n (requires pts_to arr #p0 s0 ** pts_to arr #p1 s1)\n (ensures fun _ -> pts_to arr #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather = gather'", "val pts_to_range_intro'\n (#opened: _)\n (#elt: Type0)\n (a: array elt)\n (i j: nat)\n (p: P.perm)\n (a': array elt)\n (s: Seq.seq elt)\n : STGhost unit\n opened\n (pts_to a' p s)\n (fun _ -> pts_to_range a i j p s)\n (i <= j /\\ j <= length a /\\ a' == array_slice a i j ())\n (fun _ -> True)\nlet pts_to_range_intro'\n (#opened: _)\n (#elt: Type0) (a: array elt) (i j: nat)\n (p: P.perm)\n (a': array elt)\n (s: Seq.seq elt)\n: STGhost unit opened\n (pts_to a' p s)\n (fun _ -> pts_to_range a i j p s)\n (i <= j /\\ j <= length a /\\\n a' == array_slice a i j ()\n )\n (fun _ -> True)\n= let sq : squash (i <= j /\\ j <= length a) = () in\n rewrite (pts_to a' p s) (pts_to (array_slice a i j sq) p s);\n rewrite (exists_ (pts_to_range_body a i j p s)) (pts_to_range a i j p s)", "val share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\nlet share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\n = coerce_ghost (fun _ -> R.ghost_share_pt r)", "val rewrite_value_vprops_prefix_and_suffix\n (#opened: _)\n (#k: eqtype)\n (#v: Type0)\n (#contents: Type)\n (vp: vp_t k v contents)\n (s1 s2: Seq.seq (option (k & v)))\n (m1 m2: Map.t k contents)\n (borrows1 borrows2: Map.t k v)\n (idx: US.t{Seq.length s1 == Seq.length s2 /\\ US.v idx < Seq.length s1})\n : STGhost unit\n opened\n ((value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1)\n `star`\n (value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1))\n (fun _ ->\n (value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2)\n `star`\n (value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2))\n (requires\n value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2 /\\\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (ensures fun _ -> True)\nlet rewrite_value_vprops_prefix_and_suffix (#opened:_)\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (s1 s2:Seq.seq (option (k & v)))\n (m1 m2:Map.t k contents)\n (borrows1 borrows2:Map.t k v)\n (idx:US.t{Seq.length s1 == Seq.length s2 /\\ US.v idx < Seq.length s1})\n : STGhost unit opened\n (value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1\n `star`\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1)\n (fun _ ->\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2\n `star`\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (requires value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2 /\\\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1 ==\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)\n (ensures fun _ -> True)\n = rewrite\n (value_vprops vp (seq_until s1 (US.v idx)) m1 borrows1\n `star`\n value_vprops vp (seq_from s1 (US.v idx)) m1 borrows1)\n (value_vprops vp (seq_until s2 (US.v idx)) m2 borrows2\n `star`\n value_vprops vp (seq_from s2 (US.v idx)) m2 borrows2)", "val elim_vptr0 (#opened: _) (#a: Type0) (r: ref a) (p: perm)\n : SteelGhost unit\n opened\n (vptr0 r p)\n (fun _ -> A.varrayp r p)\n (fun _ -> True)\n (fun h _ h' -> (A.aselp r p h') `Seq.equal` (Seq.create 1 (h (vptr0 r p))))\nlet elim_vptr0\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (vptr0 r p)\n (fun _ -> A.varrayp r p)\n (fun _ -> True)\n (fun h _ h' ->\n A.aselp r p h' `Seq.equal` Seq.create 1 (h (vptr0 r p))\n )\n=\n change_equal_slprop (vptr0 r p) (vptr1 r p);\n elim_vrewrite (A.varrayp r p `vrefine` vptr0_refine r) (vptr0_rewrite r p);\n elim_vrefine (A.varrayp r p) (vptr0_refine r)", "val fractionable_seq (#t: Type) (td: typedef t) (s: Seq.seq t) : GTot prop\nlet fractionable_seq (#t: Type) (td: typedef t) (s: Seq.seq t) : GTot prop =\n forall (i: nat). i < Seq.length s ==> fractionable td (Seq.index s i)", "val intro_vptr (#opened: _) (#a: Type0) (r: ref a)\n : SteelGhost unit\n opened\n (A.varray r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> A.asel r h0 == Seq.create 1 (sel r h1))\nlet intro_vptr (#opened: _)\n (#a: Type0)\n (r: ref a)\n: SteelGhost unit opened\n (A.varray r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> A.asel r h0 == Seq.create 1 (sel r h1))\n = intro_vptrp r full_perm", "val ghost_gather_gen (#a:Type0) (#uses:_) (r:ghost_ref a) (p0:perm) (p1:perm)\n : SteelGhost perm uses\n (ghost_vptrp r p0 `star` ghost_vptrp r p1)\n (fun res -> ghost_vptrp r res)\n (fun _ -> True)\n (fun h res h' ->\n res == sum_perm p0 p1 /\\\n h' (ghost_vptrp r res) == h (ghost_vptrp r p0) /\\\n h' (ghost_vptrp r res) == h (ghost_vptrp r p1)\n )\nlet ghost_gather_gen #a #_ r p0 p1 =\n let x1 = elim_ghost_vptr r p1 in\n let x0 = elim_ghost_vptr r p0 in\n ghost_gather_pt #_ #_ #p0 #p1 #x0 #x1 r;\n intro_ghost_vptr r (sum_perm p0 p1) x0;\n sum_perm p0 p1", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather\n (#a:Type)\n (arr:array a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n : stt_ghost unit\n (requires pts_to arr #p0 s0 ** pts_to arr #p1 s1)\n (ensures fun _ -> pts_to arr #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather = gather'", "val to_vec_pts_to (#a:Type0) (v:vec a) (#p:perm) (#s:Seq.seq a)\n : stt_ghost unit\n (A.pts_to (vec_to_array v) #p s)\n (fun _ \u2192 pts_to v #p s)\nlet to_vec_pts_to v #p #s =\n rewrite (A.pts_to (vec_to_array v) #p s)\n (pts_to v #p s)\n (vprop_equiv_refl _)", "val intro_vptr0 (#opened: _) (#a: Type0) (r: ref a) (p: perm)\n : SteelGhost unit\n opened\n (A.varrayp r p)\n (fun _ -> vptr0 r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\ h' (vptr0 r p) == Seq.index s 0)\nlet intro_vptr0\n (#opened: _)\n (#a: Type0)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (A.varrayp r p)\n (fun _ -> vptr0 r p)\n (fun _ -> True)\n (fun h _ h' ->\n let s = A.aselp r p h in\n Seq.length s == 1 /\\\n h' (vptr0 r p) == Seq.index s 0\n )\n= A.varrayp_not_null r p;\n intro_vrefine (A.varrayp r p) (vptr0_refine r);\n intro_vrewrite (A.varrayp r p `vrefine` vptr0_refine r) (vptr0_rewrite r p);\n change_equal_slprop (vptr1 r p) (vptr0 r p)", "val gather (#a:Type) (r:box a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather b = R.gather b", "val seq_seq_match_weaken\n (#opened: _)\n (#t1 #t2: Type)\n (p p': (t1 -> t2 -> vprop))\n (w: (x1: t1 -> x2: t2 -> STGhostT unit opened (p x1 x2) (fun _ -> p' x1 x2)))\n (c1 c1': Seq.seq t1)\n (c2 c2': Seq.seq t2)\n (i j: nat)\n : STGhost unit\n opened\n (seq_seq_match p c1 c2 i j)\n (fun _ -> seq_seq_match p' c1' c2' i j)\n (i <= j /\\\n (i == j \\/\n (j <= Seq.length c1 /\\ j <= Seq.length c2 /\\ j <= Seq.length c1' /\\ j <= Seq.length c2' /\\\n (Seq.slice c1 i j) `Seq.equal` (Seq.slice c1' i j) /\\\n (Seq.slice c2 i j) `Seq.equal` (Seq.slice c2' i j))))\n (fun _ -> True)\nlet seq_seq_match_weaken\n (#opened: _)\n (#t1 #t2: Type)\n (p p': t1 -> t2 -> vprop)\n (w: ((x1: t1) -> (x2: t2) -> STGhostT unit opened\n (p x1 x2) (fun _ -> p' x1 x2)\n ))\n (c1 c1': Seq.seq t1)\n (c2 c2': Seq.seq t2)\n (i j: nat)\n: STGhost unit opened\n (seq_seq_match p c1 c2 i j)\n (fun _ -> seq_seq_match p' c1' c2' i j)\n (i <= j /\\ (i == j \\/ (\n j <= Seq.length c1 /\\ j <= Seq.length c2 /\\\n j <= Seq.length c1' /\\ j <= Seq.length c2' /\\\n Seq.slice c1 i j `Seq.equal` Seq.slice c1' i j /\\\n Seq.slice c2 i j `Seq.equal` Seq.slice c2' i j\n )))\n (fun _ -> True)\n=\n on_range_weaken\n (seq_seq_match_item p c1 c2)\n (seq_seq_match_item p' c1' c2')\n i j\n (fun k ->\n 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)));\n w _ _;\n rewrite (p' _ _) (seq_seq_match_item p' c1' c2' k)\n )", "val swap\n (#t: Type0)\n (#s0: Ghost.erased (Seq.seq t))\n (a: array t)\n (n: SZ.t)\n (l: SZ.t)\n: ST (Ghost.erased (Seq.seq t))\n (pts_to a full_perm s0)\n (fun s -> pts_to a full_perm s)\n (\n SZ.v n == length a /\\\n SZ.v l <= SZ.v n\n )\n (fun s ->\n SZ.v n == Seq.length s0 /\\\n SZ.v l <= SZ.v n /\\\n s `Seq.equal` (Seq.slice s0 (SZ.v l) (SZ.v n) `Seq.append` Seq.slice s0 0 (SZ.v l))\n )\nlet swap\n a n l\n= pts_to_length a _;\n Gen.array_swap_gen (array_index a) (array_upd a) _ n l", "val ghost_share_gen_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen_pt\n #_ #_ #_ #x r p1 p2\n= H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2", "val join (#opened: _) (#elt: Type) (#p: P.perm) (a1: array elt) (a2: Ghost.erased (array elt))\n : SteelAtomicBase (array elt)\n false\n opened\n Unobservable\n ((varrayp a1 p) `star` (varrayp a2 p))\n (fun res -> varrayp res p)\n (fun _ -> adjacent a1 a2)\n (fun h res h' ->\n merge_into a1 a2 res /\\ aselp res p h' == (aselp a1 p h) `Seq.append` (aselp a2 p h))\nlet join\n (#opened: _)\n (#elt: Type)\n (#p: P.perm)\n (a1: array elt)\n (a2: Ghost.erased (array elt))\n: SteelAtomicBase (array elt) false opened Unobservable\n (varrayp a1 p `star` varrayp a2 p)\n (fun res -> varrayp res p)\n (fun _ -> adjacent a1 a2)\n (fun h res h' ->\n merge_into a1 a2 res /\\\n aselp res p h' == aselp a1 p h `Seq.append` aselp a2 p h\n )\n= let _ = elim_varrayp a1 _ in\n let _ = elim_varrayp a2 _ in\n let res = A.join a1 a2 in\n intro_varrayp res _ _;\n return res", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))\nlet pts_to_perm_bound = pts_to_perm_bound'", "val compare (#t:eqtype) (#p0 #p1:perm)\n (a0 a1:array t)\n (#s0 #s1:Ghost.erased (Seq.seq t))\n (l:US.t { US.v l == length a0 /\\ length a0 == length a1 } )\n : ST bool\n (pts_to a0 p0 s0 `star` pts_to a1 p1 s1)\n (fun _ -> pts_to a0 p0 s0 `star` pts_to a1 p1 s1)\n (requires True)\n (ensures fun b -> b <==> eq2 #(Seq.seq t) s0 s1)\nlet compare\n #t #p0 #p1 a0 a1 #s0 #s1 l\n =\n pts_to_length a0 _;\n pts_to_length a1 _;\n if l = 0sz\n then (\n assert (Seq.equal s0 s1);\n return true\n )\n else (\n compare_pts a0 a1 l\n )", "val memcpy (#t:_) (#p0:perm)\n (a0 a1:array t)\n (#s0 #s1:Ghost.erased (Seq.seq t))\n (l:US.t { US.v l == length a0 /\\ length a0 == length a1 } )\n : STT unit\n (pts_to a0 p0 s0 `star` pts_to a1 full_perm s1)\n (fun _ -> pts_to a0 p0 s0 `star` pts_to a1 full_perm s0)\nlet memcpy\n a0 a1 l\n=\n H.memcpy a0 a1 l" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.ST.C.Types.Base.fsti", "name": "Steel.ST.C.Types.Base.mk_fraction_split" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.mk_fraction_seq" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.scalar_unique" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.mk_fraction_seq_full" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_split" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.pts_to_length" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.intro_pts_to" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_length" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.ghost_split" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.ghost_split" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.elim_pts_to" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.gather" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_not_null" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.pts_to_not_null" }, { "project_name": "steel", "file_name": "Steel.ST.OnRange.fst", "name": "Steel.ST.OnRange.on_range_split" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_atomic_raw_gen" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.pts_to_range_split" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_join" }, { "project_name": "steel", "file_name": "Duplex.PCM.fst", "name": "Duplex.PCM.split" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptrp" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.pts_to_range_split" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_elim" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.ghost_join" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.ghost_join" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.share" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.elim_vptrp" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.ghost_join" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.join" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fsti", "name": "Steel.ST.Array.join" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptrp'" }, { "project_name": "steel", "file_name": "Steel.Stepper.fst", "name": "Steel.Stepper.split" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.pts_to_len" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_seq_match_seq_list_match" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.init_compare_inv" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.higher_ref_pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_intro" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.intro_exists_compare_inv" }, { "project_name": "steel", "file_name": "Steel.ST.BitVector.fst", "name": "Steel.ST.BitVector.pts_to_length" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.pack_tperm" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_prop" }, { "project_name": "steel", "file_name": "Steel.PCMReference.fst", "name": "Steel.PCMReference.split" }, { "project_name": "steel", "file_name": "Steel.Array.fst", "name": "Steel.Array.intro_varrayp" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.memcpy" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.PCMReference.fst", "name": "Steel.ST.PCMReference.split" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_elim'" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.gather" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.pts_to_range_intro'" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.rewrite_value_vprops_prefix_and_suffix" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.elim_vptr0" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.fractionable_seq" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fsti", "name": "Steel.ArrayRef.intro_vptr" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_gather_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.to_vec_pts_to" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.intro_vptr0" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.gather" }, { "project_name": "steel", "file_name": "Steel.ST.SeqMatch.fst", "name": "Steel.ST.SeqMatch.seq_seq_match_weaken" }, { "project_name": "steel", "file_name": "Steel.ST.Array.Swap.fst", "name": "Steel.ST.Array.Swap.swap" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.join" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.pts_to_perm_bound" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.compare" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.memcpy" } ], "selected_premises": [ "Steel.ST.C.Types.Base.mk_fraction_split", "Steel.Effect.Common.normal", "Steel.ST.C.Types.Array.array_length", "FStar.Mul.op_Star", "Steel.ST.C.Types.Array.base_array", "Steel.C.Typenat.solve_nat_t_of_nat", "Steel.ST.C.Types.Array.base_array_index_t", "FStar.UInt.size", "Steel.Memory.inames", "Steel.Effect.Common.to_vprop'", "Steel.FractionalPermission.full_perm", "Steel.Effect.Common.star", "Steel.ST.C.Types.Array.array_len_t", "Steel.ST.C.Types.Array.array_pts_to_or_null", "Steel.ST.C.Types.Array.array_or_null", "Steel.Effect.Common.rmem", "Steel.Effect.Common.rmem'", "Steel.ST.C.Types.Array.freeable_or_null_array", "Steel.ST.C.Types.Array.array_free", "Steel.Effect.Common.vc_norm", "Steel.ST.C.Types.Array.Base.array_domain", "Steel.Memory.full_mem", "Steel.ST.C.Types.Array.array_ptr_gen", "Steel.ST.C.Types.Array.seq_of_base_array", "Steel.ST.Util.op_At_Equals_Equals_Greater", "Steel.ST.C.Types.Base.ref", "Steel.ST.C.Types.Array.mk_array", "Steel.Effect.Common.to_vprop", "Steel.Effect.Common.t_of", "Steel.C.Typenat.norm_typenat", "Steel.ST.C.Types.Base.null", "Steel.ST.C.Types.Base.freeable_or_null", "FStar.List.Tot.Base.length", "Steel.ST.C.Types.Array.null_array_ptr", "Steel.C.Typenat.nat_t_of_nat", "FStar.Real.two", "Steel.Effect.Common.pure", "Steel.Effect.Common.hp_of", "Steel.Effect.Common.rm", "Steel.ST.C.Types.Base.ptr", "Steel.Effect.Common.normal_steps", "Steel.ST.C.Types.Base.pts_to_or_null", "Steel.ST.C.Types.Array.array_ptr", "Steel.ST.C.Types.Array.array_alloc", "Steel.ST.C.Types.Base.typeof", "Steel.FractionalPermission.comp_perm", "Steel.ST.C.Types.Array.mk_fraction_seq", "FStar.Reflection.V2.Data.var", "Steel.ST.C.Types.Array.array", "Steel.Preorder.pcm_history", "Steel.Effect.Common.mk_rmem", "Steel.Effect.Common.vrefine'", "Steel.Effect.Common.focus_rmem", "Steel.ST.C.Types.Base.ref_of_void_ptr", "FStar.List.Tot.Base.map", "FStar.Pervasives.reveal_opaque", "Steel.ST.Util.wand_is_implies", "FStar.PCM.composable", "Steel.ST.C.Types.Array.array_ref", "Steel.Memory.hmem", "Steel.FractionalPermission.sum_perm", "FStar.Real.one", "Steel.Effect.Common.focus_rmem_refl", "Steel.Effect.Common.vrefine", "Steel.ST.C.Types.Base.assert_null", "Steel.Effect.Common.req", "Steel.ST.C.Types.Array.array_of_base", "Steel.Effect.Common.guard_vprop", "Steel.ST.Util.intro_implies", "Steel.Effect.Common.hmem", "Steel.ST.Util.elim_implies", "Steel.ST.Util.emp_inames", "Steel.ST.Util.rewrite_with_implies", "FStar.PCM.op", "Steel.ST.C.Types.Base.assert_not_null", "FStar.List.Tot.Base.op_At", "Steel.ST.C.Types.Base.void_ptr_of_ref", "Steel.Effect.Common.extract_contexts", "FStar.Reflection.V2.Derived.mk_app", "Steel.ST.C.Types.Array.array_cell", "Steel.Effect.Common.unrestricted_focus_rmem", "Steel.Effect.Common.focus_rmem'", "Steel.Effect.Common.frame_vc_norm", "FStar.Reflection.V2.Derived.mk_e_app", "Steel.Effect.Common.unfold_guard", "Steel.ST.Util.implies_trans_gen", "Steel.Effect.Common.mk_rmem'", "Steel.ST.Util.implies_join_gen", "Steel.ST.C.Types.Array.array_size_t", "Steel.ST.C.Types.Array.array_ref_of_base_post", "FStar.Math.Lemmas.pow2_plus", "Steel.ST.C.Types.Array.array_is_null", "Steel.Preorder.history_val", "Steel.Effect.Common.inv", "FStar.PCM.compatible", "Steel.ST.Util.implies_trans_r1", "FStar.FunctionalExtensionality.feq", "Steel.Effect.Common.norm_return_pre", "Steel.ST.Util.implies_trans_l1", "Steel.ST.Util.implies_trans" ], "source_upto_this": "module Steel.ST.C.Types.Array\nopen Steel.ST.Util\ninclude Steel.ST.C.Types.Base\nopen Steel.C.Typenat\n\nmodule P = Steel.FractionalPermission\nmodule SZ = FStar.SizeT\n\n// To be extracted as: t[tn]\n// Per the C standard, base array types must be of nonzero size\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_size_t = (n: SZ.t { SZ.v n > 0 })\nval base_array_t ([@@@strictly_positive] t: Type0) (tn: Type0 (* using Typenat (or Typestring for `#define`d constants) *)) (n: array_size_t) : Type0\ninline_for_extraction [@@noextract_to \"krml\"]\nlet base_array_index_t (n: array_size_t) : Tot eqtype =\n Steel.ST.C.Types.Array.Base.array_domain (Ghost.hide n)\n[@@noextract_to \"krml\"]\nval base_array0 (#t: Type0) (tn: Type0) (td: typedef t) (n: array_size_t) : Tot (typedef (base_array_t t tn n))\n\ninline_for_extraction\n[@@noextract_to \"krml\"] // proof-only\nlet base_array (#t: Type0) (#tn: Type0) (td: typedef t) (n: nat {SZ.fits n /\\ n > 0}) (# [solve_nat_t_of_nat ()] prf: squash (norm norm_typenat (nat_t_of_nat n == tn))) : Tot (typedef (base_array_t t tn (SZ.uint_to_t n)))\n= base_array0 tn td (SZ.uint_to_t n)\n\nval base_array_index (#t: Type0) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (i: base_array_index_t n) : GTot t\nval base_array_eq (#t: Type0) (#tn: Type0) (#n: array_size_t) (a1 a2: base_array_t t tn n) : Ghost prop\n (requires True)\n (ensures (fun y ->\n (y <==> (a1 == a2)) /\\\n (y <==> (forall (i: base_array_index_t n) . base_array_index a1 i == base_array_index a2 i))\n ))\nval mk_base_array (#t: Type) (tn: Type0) (n: array_size_t) (v: Seq.seq t) : Ghost (base_array_t t tn n)\n (requires (\n Seq.length v == SZ.v n\n ))\n (ensures (fun y -> True))\nval mk_base_array_index (#t: Type) (tn: Type) (n: array_size_t) (v: Seq.seq t) (i: base_array_index_t n) : Lemma\n (requires (Seq.length v == SZ.v n))\n (ensures (\n Seq.length v == SZ.v n /\\\n base_array_index (mk_base_array tn n v) i == Seq.index v (SZ.v i)\n ))\n [SMTPat (base_array_index (mk_base_array tn n v) i)]\n\nlet mk_base_array_inj (#t: Type) (tn: Type0) (n: array_size_t) (v1 v2: Seq.seq t) : Lemma\n (requires (\n Seq.length v1 == SZ.v n /\\\n Seq.length v2 == SZ.v n /\\\n mk_base_array tn n v1 == mk_base_array tn n v2\n ))\n (ensures (v1 == v2))\n [SMTPat (mk_base_array tn n v1); SMTPat (mk_base_array tn n v2)]\n= assert (forall (i: nat) . i < SZ.v n ==> base_array_index (mk_base_array tn n v1) (SZ.uint_to_t i) == base_array_index (mk_base_array tn n v2) (SZ.uint_to_t i));\n assert (v1 `Seq.equal` v2)\nval base_array_fractionable (#t: Type) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (td: typedef t) : Lemma\n (\n fractionable (base_array0 tn td n) a <==>\n (forall (i: base_array_index_t n) . fractionable td (base_array_index a i))\n )\n [SMTPat (fractionable (base_array0 tn td n) a)]\nval base_array_mk_fraction (#t: Type) (#tn: Type0) (#n: array_size_t) (a: base_array_t t tn n) (td: typedef t) (p: P.perm) (i: base_array_index_t n) : Lemma\n (requires (\n fractionable (base_array0 tn td n) a\n ))\n (ensures (\n fractionable (base_array0 tn td n) a /\\\n base_array_index (mk_fraction (base_array0 tn td n) a p) i == mk_fraction td (base_array_index a i) p\n ))\n [SMTPat (base_array_index (mk_fraction (base_array0 tn td n) a p) i)]\n\nval base_array_index_unknown (#t: Type) (tn: Type0) (n: array_size_t) (td: typedef t) (i: base_array_index_t n) : Lemma\n (base_array_index (unknown (base_array0 tn td n)) i == unknown td)\n [SMTPat (base_array_index (unknown (base_array0 tn td n)) i)]\n\nval base_array_index_uninitialized (#t: Type) (tn: Type0) (n: array_size_t) (td: typedef t) (i: base_array_index_t n) : Lemma\n (base_array_index (uninitialized (base_array0 tn td n)) i == uninitialized td)\n [SMTPat (base_array_index (uninitialized (base_array0 tn td n)) i)]\n\nval base_array_index_full (#t: Type) (#tn: Type0) (#n: array_size_t) (td: typedef t) (x: base_array_t t tn n) : Lemma\n (full (base_array0 tn td n) x <==> (forall (i: base_array_index_t n) . full td (base_array_index x i)))\n [SMTPat (full (base_array0 tn td n) x)]\n\nval has_base_array_cell\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: Tot vprop\n\nval has_base_array_cell_post\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhost unit opened\n (has_base_array_cell r i r')\n (fun _ -> has_base_array_cell r i r')\n (True)\n (fun _ -> SZ.v i < SZ.v n)\n\nval has_base_array_cell_dup\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r')\n (fun _ -> has_base_array_cell r i r' `star` has_base_array_cell r i r')\n\nval has_base_array_cell_inj\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r1 `star` has_base_array_cell r i r2)\n (fun _ -> has_base_array_cell r i r1 `star` has_base_array_cell r i r2 `star` ref_equiv r1 r2)\n\nval has_base_array_cell_equiv_from\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r1 r2: ref (base_array0 tn td n))\n (i: SZ.t)\n (r': ref td)\n: STGhostT unit opened\n (has_base_array_cell r1 i r' `star` ref_equiv r1 r2)\n (fun _ -> has_base_array_cell r2 i r' `star` ref_equiv r1 r2)\n\nval has_base_array_cell_equiv_to\n (#opened: _)\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (has_base_array_cell r i r1 `star` ref_equiv r1 r2)\n (fun _ -> has_base_array_cell r i r2 `star` ref_equiv r1 r2)\n\n// contrary to array fields, one is not supposed to take an array cell directly from a base array. one should use arrays instead\n\n// To be extracted to: t* (array type decays to pointer type)\n\n// We still want to prove that cutting off some cell range on the\n// right-hand end of an array won't change the C pointer to which an\n// array extracts to. This is why we separately introduce `array_ref`\n// to represent the \"base+offset\" pointer, and `array` which holds the\n// ghost length of an array.\n\n[@@noextract_to \"krml\"] // primitive\nval array_void_ptr : Type0\n[@@noextract_to \"krml\"] // primitive\nlet array_ptr_gen ([@@@unused] t: Type0) : Tot Type0 = array_void_ptr\ninline_for_extraction [@@noextract_to \"krml\"] // primitive\nlet array_ptr (#t: Type) (td: typedef t) = array_ptr_gen t\n[@@noextract_to \"krml\"] // primitive\nval null_array_void_ptr: array_void_ptr\n[@@noextract_to \"krml\"] // primitive\nlet null_array_ptr (#t: Type) (td: typedef t) : Tot (array_ptr td) = null_array_void_ptr\nval g_array_ptr_is_null (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost bool\n (requires True)\n (ensures (fun y -> y == true <==> a == null_array_ptr td))\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_ref (#t: Type) (td: typedef t) = (a: array_ptr td { g_array_ptr_is_null a == false })\n\n(*\nval array_ref_base_size_type (#t: Type) (#td: typedef t) (a: array_ref td) : GTot Type0\n*)\nval array_ref_base_size (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost SZ.t\n (requires True)\n (ensures (fun y -> SZ.v y == 0 <==> a == null_array_ptr td))\nval has_array_ref_base (#t: Type) (#td: typedef t) (a: array_ref td) (#ty: Type) (r: ref (base_array0 ty td (array_ref_base_size a))) : GTot prop\nval has_array_ref_base_inj (#t: Type) (#td: typedef t) (a: array_ref td) (#ty: Type) (r1 r2: ref (base_array0 ty td (array_ref_base_size a))) : Lemma\n (requires (has_array_ref_base a r1 /\\ has_array_ref_base a r2))\n (ensures (r1 == r2))\nval array_ref_offset (#t: Type) (#td: typedef t) (a: array_ptr td) : Ghost SZ.t\n (requires True)\n (ensures (fun y -> SZ.v y <= SZ.v (array_ref_base_size a)))\nval array_ref_base_offset_inj (#t: Type) (#td: typedef t) (#ty: Type) (a1: array_ref td) (r1: ref (base_array0 ty td (array_ref_base_size a1))) (a2: array_ref td) (r2: ref (base_array0 ty td (array_ref_base_size a2))) : Lemma\n (requires (\n array_ref_base_size a1 == array_ref_base_size a2 /\\\n has_array_ref_base a1 r1 /\\\n has_array_ref_base a2 r2 /\\\n r1 == coerce_eq () r2 /\\\n array_ref_offset a1 == array_ref_offset a2\n ))\n (ensures (a1 == a2))\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_len_t (#t: Type) (#td: typedef t) (r: array_ptr td) : Tot Type0 =\n (len: Ghost.erased SZ.t { SZ.v (array_ref_offset r) + SZ.v len <= SZ.v (array_ref_base_size r) })\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_or_null (#t: Type) (td: typedef t) : Tot Type0 = (r: array_ptr td & array_len_t r)\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_ptr_of (#t: Type) (#td: typedef t) (ar: array_or_null td) : Tot (array_ptr td) =\n match ar with\n | (| a, _ |) -> a\n\nlet array_len_of (#t: Type) (#td: typedef t) (ar: array_or_null td) : Tot (array_len_t (array_ptr_of ar)) =\n match ar with\n | (| _, a |) -> a\n\nlet g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool =\n g_array_ptr_is_null (array_ptr_of a)\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array (#t: Type) (td: typedef t) : Tot Type0 = (a: array_or_null td { g_array_is_null a == false })\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_ref_of (#t: Type) (#td: typedef t) (ar: array td) : Tot (array_ref td) =\n array_ptr_of ar\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet mk_array (#t: Type) (#td: typedef t) (a: array_ref td) (len: array_len_t a) : Tot (array td) =\n (| a, len |)\n\nlet array_length\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: GTot nat\n= SZ.v (dsnd a)\n\nval array_pts_to\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop\n\nlet array_pts_to_or_null\n (#t: Type)\n (#td: typedef t)\n (r: array_or_null td)\n (v: Ghost.erased (Seq.seq t))\n: Tot vprop\n= if g_array_is_null r\n then emp\n else array_pts_to r v\n\n[@@noextract_to \"krml\"] // primitive\nval array_ptr_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_ptr td)\n (len: array_len_t r)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null (| r, len |) v)\n (fun _ -> array_pts_to_or_null (| r, len |) v)\n (True)\n (fun b -> b == g_array_is_null (| r, len |))\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\n= let a = array_ptr_of r in\n let len : array_len_t a = dsnd r in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null (| a, len |) v);\n let res = array_ptr_is_null a len in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null r v);\n return res\n\nval array_pts_to_length\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t))\n: STGhost unit opened\n (array_pts_to r v)\n (fun _ -> array_pts_to r v)\n (True)\n (fun _ -> Seq.length v == SZ.v (dsnd r))\n\n#set-options \"--print_implicits\"\n\nlet has_array_of_base\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (a: array td)\n: GTot prop\n= let (| al, len |) = a in\n array_ref_base_size al == n /\\\n has_array_ref_base al #tn r /\\\n array_ref_offset al == 0sz /\\\n Ghost.reveal len == n\n\nlet has_array_of_base_inj\n (#t: Type)\n (#tn: Type0)\n (#n: array_size_t)\n (#td: typedef t)\n (r: ref (base_array0 tn td n))\n (a1 a2: array td)\n: Lemma\n (requires (\n has_array_of_base #t #tn #n #td r a1 /\\\n has_array_of_base #t #tn #n #td r a2\n ))\n (ensures (a1 == a2))\n= let (| ar1, _ |) = a1 in\n let (| ar2, _ |) = a2 in\n array_ref_base_offset_inj #t #td #tn ar1 r ar2 r\n\nlet seq_of_base_array\n (#t: Type)\n (#tn: Type)\n (#n: array_size_t)\n (v: base_array_t t tn n)\n: GTot (Seq.lseq t (SZ.v n))\n= Seq.init_ghost (SZ.v n) (fun i -> base_array_index v (SZ.uint_to_t i))\n\nval ghost_array_of_base_focus\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n (a: array td)\n: STGhost unit opened\n (pts_to r v)\n (fun _ -> array_pts_to a (seq_of_base_array v))\n (has_array_of_base r a)\n (fun _ -> True)\n\nval ghost_array_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STGhostT (a: Ghost.erased (array td) { has_array_of_base r a }) opened\n (pts_to r v)\n (fun a -> array_pts_to a (seq_of_base_array v))\n\nlet array_ref_of_base_post\n (#t: Type)\n (#tn: Type0)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n (a: array_ref td)\n (ar: array td)\n: GTot prop\n=\n array_ptr_of ar == a /\\\n array_ref_base_size a == Ghost.reveal n /\\\n array_ref_offset a == 0sz /\\\n has_array_of_base r ar /\\\n Ghost.reveal (dsnd ar) == Ghost.reveal n\n\n// to be extracted to just r\n[@@noextract_to \"krml\"] // primitive\nval array_ref_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STAtomicBase (array_ref td) false opened Unobservable\n (pts_to r v)\n (fun a -> exists_ (fun (ar: array td) ->\n array_pts_to ar (seq_of_base_array v) `star` pure (\n array_ref_of_base_post v r a ar\n )))\n (True)\n (fun _ -> True)\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: Ghost.erased array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (base_array_t t tn n))\n (r: ref (base_array0 tn td n))\n: STAtomicBase (a: array td { has_array_of_base r a }) false opened Unobservable\n (pts_to r v)\n (fun a -> array_pts_to a (seq_of_base_array v))\n (True)\n (fun _ -> True)\n= let al = array_ref_of_base r in\n let _ = elim_exists () in\n elim_pure _;\n let a = (| al, Ghost.hide (n <: SZ.t) |) in\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n return a\n\nval unarray_of_base\n (#t: Type)\n (#tn: Type0)\n (#opened: _)\n (#n: array_size_t)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: ref (base_array0 tn td n))\n (a: array td)\n: STGhost (Ghost.erased (base_array_t t tn n)) opened\n (array_pts_to a v)\n (fun v' -> pts_to r v')\n (\n has_array_of_base r a\n )\n (fun v' -> Ghost.reveal v `Seq.equal` seq_of_base_array v')\n\nval freeable_array\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: Tot vprop\n\nlet freeable_or_null_array\n (#t: Type)\n (#td: typedef t)\n (a: array_or_null td)\n: Tot vprop\n= if g_array_is_null a\n then emp\n else freeable_array a\n\n[@@noextract_to \"krml\"] // primitive\nval array_ptr_alloc\n (#t: Type)\n (td: typedef t)\n (sz: SZ.t { SZ.v sz > 0 })\n: STT (array_ptr td)\n emp\n (fun a ->\n exists_ (fun (ar: array_or_null td) -> exists_ (fun (s: Seq.seq t) ->\n freeable_or_null_array ar `star`\n array_pts_to_or_null ar s `star` pure (\n array_ptr_of ar == a /\\\n (g_array_is_null ar == false ==> array_length ar == SZ.v sz) /\\\n Ghost.reveal s `Seq.equal` FStar.Seq.create (SZ.v sz) (uninitialized td)\n ))))\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_alloc\n (#t: Type)\n (td: typedef t)\n (sz: SZ.t { SZ.v sz > 0 })\n: STT (array_or_null td)\n emp\n (fun ar ->\n freeable_or_null_array ar `star`\n exists_ (fun s ->\n array_pts_to_or_null ar s `star` pure (\n (g_array_is_null ar == false ==> array_length ar == SZ.v sz) /\\\n Ghost.reveal s == FStar.Seq.create (SZ.v sz) (uninitialized td)\n )))\n= let a : array_ptr td = array_ptr_alloc td sz in\n let ar' : Ghost.erased (array_or_null td) = elim_exists () in\n let s = elim_exists () in\n elim_pure _;\n let len : array_len_t a = dsnd ar' in\n let ar = (| a, len |) in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null ar s);\n rewrite (freeable_or_null_array _) (freeable_or_null_array ar);\n noop ();\n return ar\n\nlet full_seq (#t: Type) (td: typedef t) (v: Seq.seq t) : GTot prop =\n forall (i: nat { i < Seq.length v }) . {:pattern (Seq.index v i)} full td (Seq.index v i)\n\nlet full_seq_seq_of_base_array\n (#t: Type0) (tn: Type0) (td: typedef t) (#n: array_size_t)\n (b: base_array_t t tn n)\n: Lemma\n (ensures (full_seq td (seq_of_base_array b) <==> full (base_array0 tn td n) b))\n [SMTPat (full_seq td (seq_of_base_array b))]\n= assert (forall (i: base_array_index_t n) . base_array_index b i == Seq.index (seq_of_base_array b) (SZ.v i))\n\n[@@noextract_to \"krml\"] // primitive\nval array_ref_free\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array_ref td)\n (n: array_len_t a)\n: ST unit\n (freeable_array (| a, n |) `star` array_pts_to (| a, n |) s)\n (fun _ -> emp)\n (full_seq td s)\n (fun _ -> True)\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_free\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n: ST unit\n (freeable_array a `star` array_pts_to a s)\n (fun _ -> emp)\n (full_seq td s)\n (fun _ -> True)\n= let al = array_ptr_of a in\n let n: array_len_t al = dsnd a in\n rewrite (freeable_array _) (freeable_array (| al, n |));\n rewrite (array_pts_to _ _) (array_pts_to (| al, n |) s);\n array_ref_free al n\n\n(*\nval has_array_of_ref\n (#t: Type)\n (#td: typedef t)\n (r: ref td)\n (a: array td)\n: Tot vprop\n\nval has_array_of_ref_post\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: ref td)\n (a: array td)\n: STGhost unit opened\n (has_array_of_ref r a)\n (fun _ -> has_array_of_ref r a)\n (True)\n (fun _ ->\n let (| al, len |) = a in\n array_ref_base_size al == 1sz /\\\n array_ref_offset al == 0sz /\\\n Ghost.reveal len == 1sz\n )\n\n// val has_array_of_ref_inj\n// (#t: Type)\n// (#td: typedef t)\n// (r: ref td)\n// (a1 a2: array td)\n// : Lemma\n// (requires (\n// has_array_of_ref r a1 /\\\n// has_array_of_ref r a2\n// ))\n// (ensures a1 == a2)\n\nval ghost_array_of_ref_focus\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (r: ref td)\n (a: array td)\n: STGhostT unit opened\n (pts_to r v `star` has_array_of_ref r a)\n (fun _ -> has_array_of_ref r a `star` array_pts_to a (Seq.create 1 (Ghost.reveal v)))\n\nval ghost_array_of_ref\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (r: ref td)\n: STGhostT (Ghost.erased (array td)) opened\n (pts_to r v)\n (fun a -> array_pts_to a (Seq.create 1 (Ghost.reveal v)) `star` has_array_of_ref r a)\n\n// to be extracted to just r\n[@@noextract_to \"krml\"] // primitive\nval array_ref_of_ref\n (#t: Type)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (r: ref td)\n: STT (a: array_ref td { array_ref_base_size a == 1sz /\\ array_ref_offset a == 0sz })\n (pts_to r v)\n (fun a -> array_pts_to (| a, Ghost.hide 1sz |) (Seq.create 1 (Ghost.reveal v)) `star` has_array_of_ref r (| a, Ghost.hide 1sz |))\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_of_ref\n (#t: Type)\n (#td: typedef t)\n (#v: Ghost.erased t)\n (r: ref td)\n: STT (array td)\n (pts_to r v)\n (fun a -> array_pts_to a (Seq.create 1 (Ghost.reveal v)) `star` has_array_of_ref r a)\n= let al = array_ref_of_ref r in\n let a : array td = (| al, Ghost.hide 1sz |) in\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n rewrite (has_array_of_ref _ _) (has_array_of_ref r a);\n return a\n\nval unarray_of_ref\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (r: ref td)\n (a: array td)\n: STGhostT (squash (Seq.length s == 1)) opened\n (array_pts_to a s `star` has_array_of_ref r a)\n (fun _ -> pts_to r (Seq.index s 0) `star` has_array_of_ref r a)\n*)\n\nval has_array_cell\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: Tot vprop\n(*\n= SZ.v i < SZ.v (dsnd a) /\\\n has_base_array_cell (array_ref_base (array_ptr_of a)) (array_ref_offset (array_ptr_of a) `SZ.add` i) r\n*)\n\nval has_array_cell_post\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r': ref td)\n: STGhost unit opened\n (has_array_cell a i r')\n (fun _ -> has_array_cell a i r')\n (True)\n (fun _ -> SZ.v i < SZ.v (dsnd a))\n\nval has_array_cell_has_base_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n (#ty: Type)\n (br: ref (base_array0 ty td (array_ref_base_size (array_ptr_of a))))\n: STGhost (Ghost.erased SZ.t) opened\n (has_array_cell a i r)\n (fun j -> has_base_array_cell br j r)\n (has_array_ref_base (array_ptr_of a) br)\n (fun j ->\n SZ.v j == SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v i\n )\n\nval has_base_array_cell_has_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n (#ty: Type)\n (br: ref (base_array0 ty td (array_ref_base_size (array_ptr_of a))))\n: STGhost (Ghost.erased SZ.t) opened\n (has_base_array_cell br i r)\n (fun j -> has_array_cell a j r)\n (has_array_ref_base (array_ptr_of a) br /\\\n SZ.v i >= SZ.v (array_ref_offset (array_ptr_of a)) /\\\n SZ.v i < SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v (dsnd a)\n )\n (fun j ->\n SZ.v i == SZ.v (array_ref_offset (array_ptr_of a)) + SZ.v j\n )\n\nval has_array_cell_inj\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n (r1 r2: ref td)\n: STGhostT unit opened\n (\n has_array_cell a i r1 `star`\n has_array_cell a i r2\n )\n (fun _ ->\n has_array_cell a i r1 `star`\n has_array_cell a i r2 `star`\n ref_equiv r1 r2\n )\n// = has_base_array_cell_inj (array_ref_base (array_ptr_of a)) (array_ref_offset (array_ptr_of a) `SZ.add` i) r1 r2\n\n(*\nval has_array_cell_array_of_ref\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: ref td)\n (a: array td)\n: SteelGhostT unit opened\n (has_array_of_ref r a)\n (fun _ -> has_array_of_ref r a `star` has_array_cell a 0sz r)\n*)\n\nval ghost_array_cell_focus\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: STGhostT (squash (SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s `star` has_array_cell a i r)\n (fun _ -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)\n\nval ghost_array_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: STGhost (r: Ghost.erased (ref td) { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a) }) opened\n (array_pts_to a s)\n (fun r -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v (dsnd a))\n )\n (fun _ -> True)\n\n[@@noextract_to \"krml\"] // primitive\nval array_ref_cell\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array_ref td)\n (len: array_len_t a)\n (i: SZ.t)\n: ST (r: ref td { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v len })\n (array_pts_to (| a, len |) s)\n (fun r -> array_pts_to (| a, len |) (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell (| a, len |) i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v len)\n )\n (fun _ -> True)\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_cell\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: ST (r: ref td { SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a) })\n (array_pts_to a s)\n (fun r -> array_pts_to a (Seq.upd s (SZ.v i) (unknown td)) `star` pts_to r (Seq.index s (SZ.v i)) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s \\/ SZ.v i < SZ.v (dsnd a))\n )\n (fun _ -> True)\n= let (| al, len |) = a in\n rewrite (array_pts_to _ _) (array_pts_to _ s);\n let r = array_ref_cell al len i in\n rewrite (array_pts_to _ _) (array_pts_to _ _);\n rewrite (has_array_cell _ _ _) (has_array_cell a i r);\n return r\n\nval unarray_cell\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (#v: Ghost.erased t)\n (a: array td)\n (i: SZ.t)\n (r: ref td)\n: STGhost (squash (SZ.v i < Seq.length s /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s `star` pts_to r v `star` has_array_cell a i r)\n (fun _ -> array_pts_to a (Seq.upd s (SZ.v i) v) `star` has_array_cell a i r)\n (\n (SZ.v i < Seq.length s ==> Seq.index s (SZ.v i) == unknown td)\n )\n (fun _ -> True)\n\nval array_ref_shift\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n (i: SZ.t)\n: Ghost (array_ref td)\n (requires (SZ.v (array_ref_offset a) + SZ.v i <= SZ.v (array_ref_base_size a)))\n (ensures (fun y ->\n array_ref_base_size y == array_ref_base_size a /\\\n (forall ty r . has_array_ref_base a #ty r ==> has_array_ref_base y #ty (coerce_eq () r)) /\\\n array_ref_offset y == array_ref_offset a `SZ.add` i\n ))\n\nval array_ref_shift_zero\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n: Lemma\n (ensures (\n array_ref_shift a 0sz == a\n ))\n\nval array_ref_shift_assoc\n (#t: Type)\n (#td: typedef t)\n (a: array_ref td)\n (i1 i2: SZ.t)\n: Lemma\n (requires (SZ.v (array_ref_offset a) + SZ.v i1 + SZ.v i2 <= SZ.v (array_ref_base_size a)))\n (ensures (\n array_ref_shift a (SZ.add i1 i2) == array_ref_shift (array_ref_shift a i1) i2\n ))\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_split_l\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n: Pure (array td)\n (requires (SZ.v i <= SZ.v (dsnd a)))\n (ensures (fun _ -> True))\n= let (| al, _ |) = a in\n (| al, Ghost.hide i |)\n\nlet array_split_r\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n (i: SZ.t)\n: Ghost (array td)\n (requires (SZ.v i <= SZ.v (dsnd a)))\n (ensures (fun _ -> True))\n= let (| al, len |) = a in\n (| array_ref_shift al i, Ghost.hide (len `SZ.sub` i) |)\n\nval ghost_array_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n: STGhost (squash (SZ.v i <= SZ.v (dsnd a) /\\ Seq.length s == SZ.v (dsnd a))) opened\n (array_pts_to a s)\n (fun _ -> array_pts_to (array_split_l a i) (Seq.slice s 0 (SZ.v i)) `star`\n array_pts_to (array_split_r a i) (Seq.slice s (SZ.v i) (Seq.length s)))\n (SZ.v i <= SZ.v (dsnd a) \\/ SZ.v i <= Seq.length s)\n (fun _ -> True)\n\nlet array_ref_split_post\n (#t: Type)\n (#td: typedef t)\n (s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t)\n (sl sr: Ghost.erased (Seq.seq t))\n: GTot prop\n= SZ.v i <= array_length a /\\ Seq.length s == array_length a /\\\n Ghost.reveal sl == Seq.slice s 0 (SZ.v i) /\\\n Ghost.reveal sr == Seq.slice s (SZ.v i) (Seq.length s)\n\n[@@noextract_to \"krml\"] // primitive\nval array_ref_split\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (al: array_ref td)\n (len: array_len_t al)\n (i: SZ.t { SZ.v i <= SZ.v len })\n: ST (array_ref td)\n (array_pts_to (mk_array al len) s)\n (fun ar -> exists_ (fun sl -> exists_ (fun sr ->\n array_pts_to (array_split_l (mk_array al len) i) sl `star`\n array_pts_to (array_split_r (mk_array al len) i) sr `star`\n pure (array_ref_split_post s (mk_array al len) i sl sr)\n )))\n True\n (fun ar ->\n SZ.v i <= SZ.v len /\\ SZ.v i <= Seq.length s /\\\n ar == array_ptr_of (array_split_r (mk_array al len) i)\n )\n\ninline_for_extraction [@@noextract_to \"krml\"]\nlet array_split\n (#t: Type)\n (#td: typedef t)\n (#s: Ghost.erased (Seq.seq t))\n (a: array td)\n (i: SZ.t { SZ.v i <= array_length a })\n: ST (array td)\n (array_pts_to a s)\n (fun a' -> exists_ (fun sl -> exists_ (fun sr ->\n array_pts_to (array_split_l a i) sl `star`\n array_pts_to a' sr `star`\n pure (array_ref_split_post s a i sl sr)\n )))\n True\n (fun a' ->\n SZ.v i <= array_length a /\\ SZ.v i <= Seq.length s /\\\n a' == array_split_r a i\n )\n= let (| al, len |) = a in\n rewrite (array_pts_to _ _) (array_pts_to _ s);\n let ar = array_ref_split al len i in\n let _ = elim_exists () in\n let _ = elim_exists () in\n elim_pure _;\n [@@inline_let]\n let a' = mk_array ar (Ghost.hide (len `SZ.sub` i)) in\n vpattern_rewrite #_ #_ #(array_split_l _ _) (fun a -> array_pts_to a _) (array_split_l a i);\n vpattern_rewrite #_ #_ #(array_split_r _ _) (fun a -> array_pts_to a _) a';\n return a'\n\nval array_join\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (#sl #sr: Ghost.erased (Seq.seq t))\n (a al ar: array td)\n (i: SZ.t)\n: STGhost unit opened\n (array_pts_to al sl `star` array_pts_to ar sr)\n (fun _ -> array_pts_to a (sl `Seq.append` sr))\n (\n SZ.v i <= SZ.v (dsnd a) /\\\n al == array_split_l a i /\\\n ar == array_split_r a i\n )\n (fun _ -> True)\n\nlet fractionable_seq (#t: Type) (td: typedef t) (s: Seq.seq t) : GTot prop =\n forall (i: nat). i < Seq.length s ==> fractionable td (Seq.index s i)\n\nlet mk_fraction_seq (#t: Type) (td: typedef t) (s: Seq.seq t) (p: P.perm) : Ghost (Seq.seq t)\n (requires (fractionable_seq td s))\n (ensures (fun _ -> True))\n= Seq.init_ghost (Seq.length s) (fun i -> mk_fraction td (Seq.index s i) p)\n\nlet mk_fraction_seq_full (#t: Type0) (td: typedef t) (x: Seq.seq t) : Lemma\n (requires (fractionable_seq td x))\n (ensures (mk_fraction_seq td x P.full_perm == x))\n [SMTPat (mk_fraction_seq td x P.full_perm)]\n= assert (mk_fraction_seq td x P.full_perm `Seq.equal` x)\n\nval mk_fraction_seq_split_gen\n (#opened: _)\n (#t: Type) (#td: typedef t) (r: array td) (v: Seq.seq t { fractionable_seq td v }) (p p1 p2: P.perm)\n: STGhost unit opened\n (array_pts_to r (mk_fraction_seq td v p))\n (fun _ -> array_pts_to r (mk_fraction_seq td v p1) `star` array_pts_to r (mk_fraction_seq td v p2))\n (p == p1 `P.sum_perm` p2 /\\ (p `P.lesser_equal_perm` P.full_perm \\/ Seq.length v == 0))\n (fun _ -> True)\n", "sketch": [ "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements, and splitting it into two parts. Then, the `mk_fraction_seq` function is used to create fractions for each part with different permissions `p1` and `p2`. Finally, the `array_pts_to` predicate is used to specify the permissions for the array `r` with the fractions for the two parts.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and creating fractions for each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements and creating fractions for each part of the sequence using the given permissions `p1` and `p2`. The resulting fractions are then associated with the array `r`.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements and splitting it into two parts. Then, the function assigns different permissions `p1` and `p2` to each part of the sequence. Finally, it ensures that the sum of permissions `p1` and `p2` is equal to the full permission.", "The definition `mk_fraction_seq_split` is about splitting a sequence into two parts and creating fractions for each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` and splitting it into two parts. Then, it creates fractions for each part using the `mk_fraction_seq` function. Finally, it ensures that the sum of the two fractions is equal to the full permission.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements, and splitting it into two parts. Then, the function assigns different permissions `p1` and `p2` to each part of the sequence. The function ensures that the permissions assigned to the two parts sum up to the full permission.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements, and splitting it into two parts. Then, the function assigns different permissions `p1` and `p2` to each part of the sequence.", "The `mk_fraction_seq_split` function takes an array `r`, a sequence `v` of type `t` that is fractionable, and two permissions `p1` and `p2`. It ensures that the array `r` points to the sequences `v` with permissions `p1` and `p2` such that the sum of `p1` and `p2` equals `P.full_perm`.", "The `mk_fraction_seq_split` function takes as input an array `r`, a sequence `v` of elements, and two permissions `p1` and `p2`. It then ensures that the array `r` points to the sequence `v` with permissions `p1` and `p2` such that the sum of `p1` and `p2` equals the full permission.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of elements, and splitting it into two parts. Then, the function assigns different permissions `p1` and `p2` to each part, ensuring that the sum of the permissions is equal to the full permission.", "The definition `mk_fraction_seq_split` is about splitting a sequence of elements into two parts and assigning different permissions to each part.\n\nThe implementation of `mk_fraction_seq_split` involves taking a sequence `v` of type `Seq.seq t` and splitting it into two parts. Then, the function assigns different permissions `p1` and `p2` to each part and ensures that the combined permission is equal to `P.full_perm`." ], "generated_solution": [ "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)", "val mk_fraction_seq_split\n (#opened: _)\n (#t: Type)\n (#td: typedef t)\n (r: array td)\n (v: Ghost.erased (Seq.seq t) {fractionable_seq td v})\n (p1 p2: P.perm)\n : STGhost unit\n opened\n (array_pts_to r v)\n (fun _ ->\n (array_pts_to r (mk_fraction_seq td v p1))\n `star`\n (array_pts_to r (mk_fraction_seq td v p2)))\n (P.full_perm == p1 `P.sum_perm` p2)\n (fun _ -> True)" ] }, { "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.write", "opens_and_abbrevs": [ { "abbrev": "MG", "full_module": "FStar.ModifiesGen" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "DM", "full_module": "FStar.DependentMap" }, { "open": "FStar.HyperStack.ST" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HH", "full_module": "FStar.HyperStack" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 16, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val write: #a:typ -> b:pointer a -> z:type_of_typ a -> HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z ))", "source_definition": "let write #a b z =\n owrite b (ovalue_of_value a z)", "source_range": { "start_line": 4114, "start_col": 0, "end_line": 4115, "end_col": 32 }, "interleaved": false, "definition": "fun b z -> FStar.Pointer.Base.owrite b (FStar.Pointer.Base.ovalue_of_value a z)", "effect": "FStar.HyperStack.ST.Stack", "effect_flags": [], "mutual_with": [], "premises": [ "FStar.Pointer.Base.typ", "FStar.Pointer.Base.pointer", "FStar.Pointer.Base.type_of_typ", "FStar.Pointer.Base.owrite", "FStar.Pointer.Base.ovalue_of_value", "Prims.unit" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "b: FStar.Pointer.Base.pointer a -> z: FStar.Pointer.Base.type_of_typ a\n -> FStar.HyperStack.ST.Stack Prims.unit", "prompt": "let write #a b z =\n ", "expected_response": "owrite b (ovalue_of_value a z)", "source": { "project_name": "FStar", "file_name": "ulib/legacy/FStar.Pointer.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Pointer.Base.fst", "checked_file": "dataset/FStar.Pointer.Base.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.UInt16.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.ModifiesGen.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Int8.fsti.checked", "dataset/FStar.Int64.fsti.checked", "dataset/FStar.Int32.fsti.checked", "dataset/FStar.Int16.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.DependentMap.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Char.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "base_typ", "TUInt", "TUInt", "TUInt", "TUInt8", "TUInt8", "TUInt8", "TUInt16", "TUInt16", "TUInt16", "TUInt32", "TUInt32", "TUInt32", "TUInt64", "TUInt64", "TUInt64", "TInt", "TInt", "TInt", "TInt8", "TInt8", "TInt8", "TInt16", "TInt16", "TInt16", "TInt32", "TInt32", "TInt32", "step", "TInt64", "TInt64", "TInt64", "StepField", "StepField", "StepField", "TChar", "TChar", "TChar", "l", "l", "TBool", "TBool", "TBool", "fd", "fd", "TUnit", "TUnit", "TUnit", "StepUField", "StepUField", "StepUField", "l", "l", "array_length_t", "fd", "fd", "typ", "StepCell", "StepCell", "StepCell", "TBase", "TBase", "TBase", "length", "length", "b", "b", "value", "value", "index", "index", "TStruct", "TStruct", "TStruct", "l", "l", "path", "TUnion", "TUnion", "TUnion", "PathBase", "PathBase", "PathBase", "l", "l", "PathStep", "PathStep", "PathStep", "TArray", "TArray", "TArray", "through", "through", "length", "length", "to", "to", "t", "t", "p", "p", "s", "s", "TPointer", "TPointer", "TPointer", "t", "t", "let step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()", "TNPointer", "TNPointer", "TNPointer", "t", "t", "TBuffer", "TBuffer", "TBuffer", "t", "t", "struct_typ'", "struct_typ", "struct_typ", "let rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s", "name", "name", "fields", "fields", "union_typ", "let struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "let struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "let union_field = struct_field", "let typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "let typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "_npointer", "Pointer", "Pointer", "Pointer", "from", "from", "contents", "contents", "let typ_of_union_field\n (l: union_typ)\n (f: union_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field l f", "p", "p", "NullPtr", "NullPtr", "NullPtr", "let npointer (t: typ): Tot Type0 =\n _npointer t", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let nullptr (#t: typ): Tot (npointer t) = NullPtr", "let g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false", "let g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()", "let not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true", "let rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "buffer_root", "BufferRootSingleton", "BufferRootSingleton", "BufferRootSingleton", "p", "p", "BufferRootArray", "BufferRootArray", "BufferRootArray", "max_length", "max_length", "p", "p", "let buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len", "_buffer", "Buffer", "Buffer", "Buffer", "broot", "broot", "bidx", "bidx", "blength", "blength", "let buffer (t: typ): Tot Type0 = _buffer t", "val npointer (t: typ) : Tot Type0", "val nullptr (#t: typ): Tot (npointer t)", "val g_is_null (#t: typ) (p: npointer t) : GTot bool", "val g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n [SMTPat (g_is_null (nullptr #t))]", "let gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )", "let pointer (t: typ) : Tot Type0 = (p: npointer t { g_is_null p == false } )", "let _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u", "val buffer (t: typ): Tot Type0", "let gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u", "let type_of_base_typ\n (t: base_typ)\n: Tot Type0\n= match t with\n | TUInt -> nat\n | TUInt8 -> FStar.UInt8.t\n | TUInt16 -> FStar.UInt16.t\n | TUInt32 -> FStar.UInt32.t\n | TUInt64 -> FStar.UInt64.t\n | TInt -> int\n | TInt8 -> FStar.Int8.t\n | TInt16 -> FStar.Int16.t\n | TInt32 -> FStar.Int32.t\n | TInt64 -> FStar.Int64.t\n | TChar -> FStar.Char.char\n | TBool -> bool\n | TUnit -> unit", "let gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v", "let gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)", "array", "let type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "let gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()", "let type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "val struct (l: struct_typ) : Tot Type0", "val union (l: union_typ) : Tot Type0", "let rec type_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t", "let rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()", "let type_of_typ_array\n (len: array_length_t)\n (t: typ)\n: Lemma\n (type_of_typ (TArray len t) == array len (type_of_typ t))\n [SMTPat (type_of_typ (TArray len t))]\n= ()", "let _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v", "let struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f", "let type_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l (fun (x:typ{x << l}) -> type_of_typ x)", "let struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v", "let type_of_typ_struct\n (l: struct_typ)\n: Lemma\n (type_of_typ (TStruct l) == struct l)\n [SMTPat (type_of_typ (TStruct l))]\n= assert_norm (type_of_typ (TStruct l) == struct l)", "let struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f", "let struct_sel_struct_create_fun l f fd = ()", "let union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v", "let type_of_typ_type_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (type_of_typ (typ_of_struct_field l f) == type_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "let union_get_value #l v fd = gtdata_get_value v fd", "let union_create l fd v = gtdata_create fd v", "val struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f)", "let rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul", "let dfst_struct_field\n (s: struct_typ)\n (p: (x: struct_field s & type_of_struct_field s x))\n: Tot string\n=\n let (| f, _ |) = p in\n f", "let struct_literal (s: struct_typ) : Tot Type0 = list (x: struct_field s & type_of_struct_field s x)", "let struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool =\n List.Tot.sortWith FStar.String.compare (List.Tot.map fst s.fields) =\n List.Tot.sortWith FStar.String.compare\n (List.Tot.map (dfst_struct_field s) l)", "let fun_of_list\n (s: struct_typ)\n (l: struct_literal s)\n (f: struct_field s)\n: Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n=\n let f' : string = f in\n let phi (p: (x: struct_field s & type_of_struct_field s x)) : Tot bool =\n dfst_struct_field s p = f'\n in\n match List.Tot.find phi l with\n | Some p -> let (| _, v |) = p in v\n | _ ->\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map fst s.fields);\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map (dfst_struct_field s) l);\n List.Tot.mem_memP f' (List.Tot.map fst s.fields);\n List.Tot.mem_count (List.Tot.map fst s.fields) f';\n List.Tot.mem_count (List.Tot.map (dfst_struct_field s) l) f';\n List.Tot.mem_memP f' (List.Tot.map (dfst_struct_field s) l);\n List.Tot.memP_map_elim (dfst_struct_field s) f' l;\n Classical.forall_intro (Classical.move_requires (List.Tot.find_none phi l));\n false_elim ()", "val struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l)", "let struct_create\n (s: struct_typ)\n (l: struct_literal s)\n: Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n= struct_create_fun s (fun_of_list s l)", "val struct_sel_struct_create_fun\n (l: struct_typ)\n (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd)))\n (fd: struct_field l)\n: Lemma\n (struct_sel (struct_create_fun l f) fd == f fd)\n [SMTPat (struct_sel (struct_create_fun l f) fd)]", "let rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)", "let type_of_typ_union\n (l: union_typ)\n: Lemma\n (type_of_typ (TUnion l) == union l)\n [SMTPat (type_of_typ (TUnion l))]\n= assert_norm (type_of_typ (TUnion l) == union l)", "val union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l)", "val union_get_value\n (#l: union_typ)\n (v: union l)\n (fd: struct_field l)\n: Pure (type_of_struct_field l fd)\n (requires (union_get_key v == fd))\n (ensures (fun _ -> True))", "let otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ", "val union_create\n (l: union_typ)\n (fd: struct_field l)\n (v: type_of_struct_field l fd)\n: Tot (union l)", "let otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "val equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))", "let otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()", "val as_addr (#t: typ) (p: pointer t): GTot (x: nat { x > 0 } )", "let otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()", "val unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0", "val live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0", "let ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))", "let ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f", "let ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)", "val nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0", "let ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)", "let otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)", "val live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (nlive h p <==> live h p)\n [SMTPat (nlive h p)]", "let ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))", "val g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n: Lemma\n (requires (g_is_null p))\n (ensures (nlive h p))\n [SMTPat (g_is_null p); SMTPat (nlive h p)]", "let ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)", "let ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd", "val live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (ensures (live h p /\\ p `unused_in` h ==> False))\n [SMTPat (live h p); SMTPat (p `unused_in` h)]", "let ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)", "val gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)", "let otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)", "val frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid", "let struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true", "val live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]", "val disjoint_roots_intro_pointer_vs_pointer\n (#value1 value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 =!= as_addr p2))", "let rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v", "val disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))", "val disjoint_roots_intro_reference_vs_pointer\n (#value1: Type)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ p2 `unused_in` h))\n (ensures (HS.frameOf p1 <> frameOf p2 \\/ HS.as_addr p1 =!= as_addr p2))", "val is_mm\n (#value: typ)\n (p: pointer value)\n: GTot bool", "val gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: GTot (pointer (typ_of_struct_field l fd))", "let ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)", "val as_addr_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (as_addr (gfield p fd) == as_addr p))\n [SMTPat (as_addr (gfield p fd))]", "let ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v", "val unused_in_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (unused_in (gfield p fd) h <==> unused_in p h))\n [SMTPat (unused_in (gfield p fd) h)]", "val live_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (live h (gfield p fd) <==> live h p))\n [SMTPat (live h (gfield p fd))]", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in (\n Some? v /\\\n ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)\n )))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= let (v: ostruct l) = v in\n assert_norm (ovalue_is_readable (TStruct l) v == List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n assert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n assert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))", "val gread_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (gread h (gfield p fd) == struct_sel (gread h p) fd))\n [SMTPatOr [[SMTPat (gread h (gfield p fd))]; [SMTPat (struct_sel (gread h p) fd)]]]", "val frameOf_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (frameOf (gfield p fd) == frameOf p))\n [SMTPat (frameOf (gfield p fd))]", "let ovalue_is_readable_array_elim\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n: Lemma\n (requires (ovalue_is_readable (TArray len t) v))\n (ensures (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n )))\n= ()", "val is_mm_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (is_mm (gfield p fd) <==> is_mm p))\n [SMTPat (is_mm (gfield p fd))]", "let ovalue_is_readable_array_intro\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n: Lemma\n (requires (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\ (\n forall (i: UInt32.t { UInt32.v i < UInt32.v len } ) .\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n ))))\n (ensures (ovalue_is_readable (TArray len t) v))\n= let (v: option (array len (otype_of_typ t))) = v in\n let (v: array len (otype_of_typ t)) = Some?.v v in\n let f\n (i: nat { i < UInt32.v len } )\n : Lemma\n (ovalue_is_readable t (Seq.index v i))\n = let (j : UInt32.t { UInt32.v j < UInt32.v len } ) = UInt32.uint_to_t i in\n assert (ovalue_is_readable t (Seq.index v (UInt32.v j)))\n in\n Classical.forall_intro f", "val gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot (pointer (typ_of_struct_field l fd))", "val as_addr_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (as_addr (gufield p fd) == as_addr p))\n [SMTPat (as_addr (gufield p fd))]", "val unused_in_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (unused_in (gufield p fd) h <==> unused_in p h))\n [SMTPat (unused_in (gufield p fd) h)]", "let ostruct_field_of_struct_field\n (l: struct_typ)\n (ovalue_of_value: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Pure (otype_of_typ t)\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: struct l)\n (f: struct_field l)\n: Tot (otype_of_struct_field l f)\n= ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)", "val live_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (live h (gufield p fd) <==> live h p))\n [SMTPat (live h (gufield p fd))]", "val gread_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (union_get_key (gread h p) == fd))\n (ensures (\n union_get_key (gread h p) == fd /\\\n gread h (gufield p fd) == union_get_value (gread h p) fd\n ))\n [SMTPatOr [[SMTPat (gread h (gufield p fd))]; [SMTPat (union_get_value (gread h p) fd)]]]", "let seq_init_index\n (#a:Type) (len:nat) (contents:(i:nat { i < len } -> Tot a)) (i: nat)\n: Lemma\n (requires (i < len))\n (ensures (i < len /\\ Seq.index (Seq.init len contents) i == contents i))\n [SMTPat (Seq.index (Seq.init len contents) i)]\n= Seq.init_index len contents", "let rec ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Tot (otype_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let oval\n (t' : typ)\n (v' : type_of_typ t')\n : Pure (otype_of_typ t')\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_of_value t' v'\n in\n ostruct_create l (ostruct_field_of_struct_field l oval v)\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n assert (UInt32.v len == Seq.length v);\n let f\n (i: nat {i < UInt32.v len})\n : Tot (otype_of_typ t)\n = ovalue_of_value t (Seq.index v i)\n in\n let (v': array len (otype_of_typ t)) = Seq.init (UInt32.v len) f in\n Some v'\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ounion_create l k (ovalue_of_value (typ_of_struct_field l k) (union_get_value v k))\n | _ -> Some v", "val frameOf_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (frameOf (gufield p fd) == frameOf p))\n [SMTPat (frameOf (gufield p fd))]", "val is_mm_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (is_mm (gufield p fd) <==> is_mm p))\n [SMTPat (is_mm (gufield p fd))]", "val gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Ghost (pointer value)\n (requires (UInt32.v i < UInt32.v length))\n (ensures (fun _ -> True))", "val as_addr_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ as_addr (gcell p i) == as_addr p))\n [SMTPat (as_addr (gcell p i))]", "let ovalue_is_readable_ostruct_field_of_struct_field\n (l: struct_typ)\n (ih: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n ))\n (v: struct l)\n (f: struct_field l)\n: Lemma\n (ovalue_is_readable (typ_of_struct_field l f) (ostruct_field_of_struct_field l ovalue_of_value v f))\n= ih (typ_of_struct_field l f) (struct_sel #l v f)", "val unused_in_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ (unused_in (gcell p i) h <==> unused_in p h)))\n [SMTPat (unused_in (gcell p i) h)]", "let rec ovalue_is_readable_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (requires True)\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n (decreases t)\n [SMTPat (ovalue_is_readable t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let (v: struct l) = v in\n let (v': ostruct l) = ovalue_of_value (TStruct l) v in\n let phi\n (t: typ)\n (v: type_of_typ t)\n : Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n = ovalue_is_readable_ovalue_of_value t v\n in\n Classical.forall_intro (ovalue_is_readable_ostruct_field_of_struct_field l phi v);\n ovalue_is_readable_struct_intro l v'\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n let (v': otype_of_typ (TArray len t)) = ovalue_of_value (TArray len t) v in\n let (v': array len (otype_of_typ t)) = Some?.v v' in\n let phi\n (i: nat { i < Seq.length v' } )\n : Lemma\n (ovalue_is_readable t (Seq.index v' i))\n = ovalue_is_readable_ovalue_of_value t (Seq.index v i)\n in\n Classical.forall_intro phi\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ovalue_is_readable_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()", "val live_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ (live h (gcell p i) <==> live h p)))\n [SMTPat (live h (gcell p i))]", "val gread_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ gread h (gcell p i) == Seq.index (gread h p) (UInt32.v i)))\n [SMTPat (gread h (gcell p i))]", "val frameOf_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ frameOf (gcell p i) == frameOf p))\n [SMTPat (frameOf (gcell p i))]", "val is_mm_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ is_mm (gcell p i) == is_mm p))\n [SMTPat (is_mm (gcell p i))]", "let rec value_of_ovalue\n (t: typ)\n (v: otype_of_typ t)\n: Tot (type_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n if Some? v\n then\n let phi\n (f: struct_field l)\n : Tot (type_of_struct_field l f)\n = value_of_ovalue (typ_of_struct_field l f) (ostruct_sel v f)\n in\n struct_create_fun l phi\n else dummy_val t\n | TArray len t' ->\n let (v: option (array len (otype_of_typ t'))) = v in\n begin match v with\n | None -> dummy_val t\n | Some v ->\n let phi\n (i: nat { i < UInt32.v len } )\n : Tot (type_of_typ t')\n = value_of_ovalue t' (Seq.index v i)\n in\n Seq.init (UInt32.v len) phi\n end\n | TUnion l ->\n let (v: ounion l) = v in\n begin match v with\n | None -> dummy_val t\n | _ ->\n let k = ounion_get_key v in\n union_create l k (value_of_ovalue (typ_of_struct_field l k) (ounion_get_value v k))\n end\n | TBase b ->\n let (v: option (type_of_base_typ b)) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TPointer t' ->\n let (v: option (pointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TNPointer t' ->\n let (v: option (npointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TBuffer t' ->\n let (v: option (buffer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end", "val includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool", "val includes_refl\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (includes p p))\n [SMTPat (includes p p)]", "val includes_trans\n (#t1 #t2 #t3: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n (p3: pointer t3)\n: Lemma\n (requires (includes p1 p2 /\\ includes p2 p3))\n (ensures (includes p1 p3))", "val includes_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (includes p (gfield p fd)))", "val includes_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (includes p (gufield p fd)))", "val includes_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ includes p (gcell p i)))", "val readable\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: GTot Type0", "let ovalue_of_value_array_index\n (#len: array_length_t)\n (t' : typ)\n (v: array len (type_of_typ t'))\n (sv: array len (otype_of_typ t'))\n: Lemma\n (requires (ovalue_of_value (TArray len t') v == Some sv))\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index sv i == ovalue_of_value t' (Seq.index v i)))\n= ()", "val readable_live\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: Lemma\n (requires (readable h b))\n (ensures (live h b))\n [SMTPatOr [\n [SMTPat (readable h b)];\n [SMTPat (live h b)];\n ]]", "let value_of_ovalue_array_index\n (#len: array_length_t)\n (t': typ)\n (sv: array len (otype_of_typ t'))\n: Lemma\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index (value_of_ovalue (TArray len t') (Some sv)) i == value_of_ovalue t' (Seq.index sv i)))\n= ()", "val readable_gfield\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (readable h p))\n (ensures (readable h (gfield p fd)))\n [SMTPat (readable h (gfield p fd))]", "let rec value_of_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (value_of_ovalue t (ovalue_of_value t v) == v)\n [SMTPat (value_of_ovalue t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let v : struct l = v in\n let v' : struct l = value_of_ovalue t (ovalue_of_value t v) in\n let phi\n (f: struct_field l)\n : Lemma\n (struct_sel #l v' f == struct_sel #l v f)\n = value_of_ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n in\n Classical.forall_intro phi;\n DM.equal_intro v' v;\n DM.equal_elim #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) v' v\n | TArray len t' ->\n let (v: array len (type_of_typ t')) = v in\n let ov : option (array len (otype_of_typ t')) = ovalue_of_value (TArray len t') v in\n assert (Some? ov);\n let sv : array len (otype_of_typ t') = Some?.v ov in\n assert (Seq.length sv == UInt32.v len);\n// assert (forall (i : nat { i < UInt32.v len } ) . Seq.index sv i == ovalue_of_value t' (Seq.index v i));\n ovalue_of_value_array_index t' v sv;\n let v' : array len (type_of_typ t') = value_of_ovalue t ov in\n assert (Seq.length v' == UInt32.v len);\n// assert (forall (i: nat { i < UInt32.v len } ) . Seq.index v' i == value_of_ovalue t' (Seq.index sv i));\n value_of_ovalue_array_index t' sv;\n let phi\n (i: nat { i < UInt32.v len } )\n : Lemma\n (value_of_ovalue t' (ovalue_of_value t' (Seq.index v i)) == Seq.index v i)\n = value_of_ovalue_of_value t' (Seq.index v i)\n in\n Classical.forall_intro phi;\n Seq.lemma_eq_intro v' v;\n Seq.lemma_eq_elim v' v\n | TUnion l ->\n let v : union l = v in\n let k = _union_get_key v in\n value_of_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()", "val readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))", "val readable_struct_forall_mem\n (#l: struct_typ)\n (p: pointer (TStruct l))\n: Lemma (forall\n (h: HS.mem)\n . (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ) ==>\n readable h p\n )", "val readable_struct_fields\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: GTot Type0", "val readable_struct_fields_nil\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (readable_struct_fields h p [])\n [SMTPat (readable_struct_fields h p [])]", "val readable_struct_fields_cons\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (f: string)\n (q: list string)\n: Lemma\n (requires (readable_struct_fields h p q /\\ (List.Tot.mem f (List.Tot.map fst l.fields) ==> (let f : struct_field l = f in readable h (gfield p f)))))\n (ensures (readable_struct_fields h p (f::q)))\n [SMTPat (readable_struct_fields h p (f::q))]", "let none_ovalue\n (t: typ)\n: Tot (otype_of_typ t)\n= match t with\n | TStruct l -> (None <: ostruct l)\n | TArray len t' -> (None <: option (array len (otype_of_typ t')))\n | TUnion l -> (None <: ounion l)\n | TBase b -> (None <: option (type_of_base_typ b))\n | TPointer t' -> (None <: option (pointer t'))\n | TNPointer t' -> (None <: option (npointer t'))\n | TBuffer t' -> (None <: option (buffer t'))", "val readable_struct_fields_readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (readable_struct_fields h p (normalize_term (List.Tot.map fst l.fields))))\n (ensures (readable h p))", "let not_ovalue_is_readable_none_ovalue\n (t: typ)\n: Lemma\n (ovalue_is_readable t (none_ovalue t) == false)\n= ()", "val readable_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length /\\ readable h p))\n (ensures (UInt32.v i < UInt32.v length /\\ readable h (gcell p i)))\n [SMTPat (readable h (gcell p i))]", "let step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n= match s with\n | StepField l fd ->\n let (m': ostruct l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ -> ostruct_sel m' fd\n end\n | StepUField l fd ->\n let (m' : ounion l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ ->\n if fd = ounion_get_key m'\n then ounion_get_value m' fd\n else none_ovalue to\n end\n | StepCell length value i ->\n let (m': option (array length (otype_of_typ to))) = m' in\n begin match m' with\n | None -> none_ovalue to\n | Some m' -> Seq.index m' (UInt32.v i)\n end", "val readable_array\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n: Lemma\n (requires (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v length ==>\n readable h (gcell p i)\n ))\n (ensures (readable h p))", "val readable_gufield\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (readable h (gufield p fd) <==> (readable h p /\\ union_get_key (gread h p) == fd)))\n [SMTPat (readable h (gufield p fd))]", "val is_active_union_field\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot Type0", "val is_active_union_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (live h p))\n [SMTPat (is_active_union_field h p fd)]", "let ovalue_is_readable_step_sel_cell\n (#length: array_length_t)\n (#value: typ)\n (m': otype_of_typ (TArray length value))\n (index: UInt32.t { UInt32.v index < UInt32.v length } )\n: Lemma\n (requires (ovalue_is_readable (TArray length value) m'))\n (ensures (ovalue_is_readable value (step_sel m' (StepCell length value index))))\n [SMTPat (ovalue_is_readable value (step_sel m' (StepCell length value index)))]\n= ()", "val is_active_union_field_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (live h (gufield p fd)))\n [SMTPat (is_active_union_field h p fd)]", "let ovalue_is_readable_step_sel_field\n (#l: struct_typ)\n (m: ostruct l)\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) m))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd)))]\n= ()", "val is_active_union_field_eq\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd1 /\\ is_active_union_field h p fd2))\n (ensures (fd1 == fd2))\n [SMTPat (is_active_union_field h p fd1); SMTPat (is_active_union_field h p fd2)]", "let ovalue_is_readable_step_sel_union_same\n (#l: union_typ)\n (m: ounion l)\n (fd: struct_field l)\n: Lemma\n (requires (\n ovalue_is_readable (TUnion l) m /\\\n ounion_get_key m == fd\n ))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepUField l fd))))\n= ()", "val is_active_union_field_get_key\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (union_get_key (gread h p) == fd))\n [SMTPat (is_active_union_field h p fd)]", "let step_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (s: step from to)\n: Lemma\n (step_sel (none_ovalue from) s == none_ovalue to)\n= ()", "val is_active_union_field_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd /\\ readable h (gufield p fd)))\n (ensures (readable h p))\n [SMTPat (is_active_union_field h p fd); SMTPat (readable h (gufield p fd))]", "let rec path_sel\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n: Tot (otype_of_typ to)\n (decreases p)\n= match p with\n | PathBase -> m\n | PathStep through' to' p' s ->\n let (m': otype_of_typ through') = path_sel m p' in\n step_sel m' s", "val is_active_union_field_includes_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (#t': typ)\n (p' : pointer t')\n: Lemma\n (requires (includes (gufield p fd) p' /\\ readable h p'))\n (ensures (is_active_union_field h p fd))", "let rec path_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_sel (none_ovalue from) p == none_ovalue to))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' s ->\n path_sel_none_ovalue p'", "let equal_values #a h (b:pointer a) h' (b':pointer a) : GTot Type0 =\n (live h b ==> live h' b') /\\ (\n readable h b ==> (\n readable h' b' /\\\n gread h b == gread h' b'\n ))", "let step_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases s)\n= match s with\n | StepField l fd ->\n let (m: ostruct l) = m in\n begin match m with\n | None ->\n (* whole structure does not exist yet,\n so create one with only one field initialized,\n and all others uninitialized *)\n let phi\n (fd' : struct_field l)\n : Tot (otype_of_struct_field l fd')\n = if fd' = fd\n then v\n else none_ovalue (typ_of_struct_field l fd')\n in\n ostruct_create l phi\n | Some _ -> ostruct_upd m fd v\n end\n | StepCell len _ i ->\n let (m: option (array len (otype_of_typ to))) = m in\n begin match m with\n | None ->\n (* whole array does not exist yet,\n so create one with only one cell initialized,\n and all others uninitialized *)\n let phi\n (j: nat { j < UInt32.v len } )\n : Tot (otype_of_typ to)\n = if j = UInt32.v i\n then v\n else none_ovalue to\n in\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.init (UInt32.v len) phi)\n in\n m'\n | Some m ->\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.upd m (UInt32.v i) v)\n in\n m'\n end\n | StepUField l fd ->\n (* overwrite the whole union with the new field *)\n ounion_create l fd v", "val gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: GTot (buffer t)", "val singleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gsingleton_buffer_of_pointer p))", "val gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: GTot (buffer t)", "val buffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gbuffer_of_array_pointer p))", "val buffer_length\n (#t: typ)\n (b: buffer t)\n: GTot UInt32.t", "val buffer_length_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_length (gsingleton_buffer_of_pointer p) == 1ul))\n [SMTPat (buffer_length (gsingleton_buffer_of_pointer p))]", "val buffer_length_gbuffer_of_array_pointer\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_length (gbuffer_of_array_pointer p) == len))\n [SMTPat (buffer_length (gbuffer_of_array_pointer p))]", "val buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0", "let step_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Lemma\n (step_sel (step_upd m s v) s == v)\n= ()", "val buffer_live_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_live h (gsingleton_buffer_of_pointer p) <==> live h p ))\n [SMTPat (buffer_live h (gsingleton_buffer_of_pointer p))]", "let rec path_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases p)\n= match p with\n | PathBase -> v\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n path_upd m p' (step_upd s st v)", "val buffer_live_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_live h (gbuffer_of_array_pointer p) <==> live h p))\n [SMTPat (buffer_live h (gbuffer_of_array_pointer p))]", "val buffer_unused_in\n (#t: typ)\n (b: buffer t)\n (h: HS.mem)\n: GTot Type0", "let rec path_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_sel (path_upd m p v) p == v))\n (decreases p)\n [SMTPat (path_sel (path_upd m p v) p)]\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n step_sel_upd_same s st v;\n let s' = step_upd s st v in\n path_sel_upd_same m p' s'", "val buffer_live_not_unused_in\n (#t: typ)\n (b: buffer t)\n (h: HS.mem)\n: Lemma\n ((buffer_live h b /\\ buffer_unused_in b h) ==> False)", "val buffer_unused_in_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_unused_in (gsingleton_buffer_of_pointer p) h <==> unused_in p h ))\n [SMTPat (buffer_unused_in (gsingleton_buffer_of_pointer p) h)]", "val buffer_unused_in_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_unused_in (gbuffer_of_array_pointer p) h <==> unused_in p h))\n [SMTPat (buffer_unused_in (gbuffer_of_array_pointer p) h)]", "let rec path_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Pure (path from to)\n (requires True)\n (ensures (fun _ -> True))\n (decreases q)\n= match q with\n | PathBase -> p\n | PathStep through' to' q' st -> PathStep through' to' (path_concat p q') st", "val frameOf_buffer\n (#t: typ)\n (b: buffer t)\n: GTot HS.rid", "let path_concat_base_r\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (ensures (path_concat p PathBase == p))\n= ()", "val frameOf_buffer_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (frameOf_buffer (gsingleton_buffer_of_pointer p) == frameOf p))\n [SMTPat (frameOf_buffer (gsingleton_buffer_of_pointer p))]", "val frameOf_buffer_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: Lemma\n (ensures (frameOf_buffer (gbuffer_of_array_pointer p) == frameOf p))\n [SMTPat (frameOf_buffer (gbuffer_of_array_pointer p))]", "let rec path_concat_base_l\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_concat PathBase p == p))\n (decreases p)\n [SMTPat (path_concat PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' _ -> path_concat_base_l p'", "val live_region_frameOf_buffer\n (#value: typ)\n (h: HS.mem)\n (p: buffer value)\n: Lemma\n (requires (buffer_live h p))\n (ensures (HS.live_region h (frameOf_buffer p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf_buffer p))];\n [SMTPat (buffer_live h p)]\n ]]", "let rec path_concat_assoc\n (#t0 #t1 #t2 #t3: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n (p23: path t2 t3)\n: Lemma\n (requires True)\n (ensures (path_concat (path_concat p01 p12) p23 == path_concat p01 (path_concat p12 p23)))\n (decreases p23)\n= match p23 with\n | PathBase -> ()\n | PathStep _ _ p23' _ -> path_concat_assoc p01 p12 p23'", "val buffer_as_addr\n (#t: typ)\n (b: buffer t)\n: GTot (x: nat { x > 0 } )", "val buffer_as_addr_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (buffer_as_addr (gsingleton_buffer_of_pointer p) == as_addr p))\n [SMTPat (buffer_as_addr (gsingleton_buffer_of_pointer p))]", "let rec path_sel_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_sel m (path_concat p q) == path_sel (path_sel m p) q))\n (decreases q)\n [SMTPat (path_sel m (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_sel_concat m p q'", "val buffer_as_addr_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: Lemma\n (ensures (buffer_as_addr (gbuffer_of_array_pointer p) == as_addr p))\n [SMTPat (buffer_as_addr (gbuffer_of_array_pointer p))]", "val gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Ghost (buffer t)\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (fun _ -> True))", "let rec path_upd_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_upd m (path_concat p q) v == path_upd m p (path_upd (path_sel m p) q v)))\n (decreases q)\n [SMTPat (path_upd m (path_concat p q) v)]\n= match q with\n | PathBase -> ()\n | PathStep through' to' q' st ->\n let (s: otype_of_typ through') = path_sel m (path_concat p q') in\n let (s': otype_of_typ through') = step_upd s st v in\n path_upd_concat m p q' s'", "val frameOf_buffer_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n frameOf_buffer (gsub_buffer b i len) == frameOf_buffer b\n ))\n [SMTPat (frameOf_buffer (gsub_buffer b i len))]", "val buffer_as_addr_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n buffer_as_addr (gsub_buffer b i len) == buffer_as_addr b\n ))\n [SMTPat (buffer_as_addr (gsub_buffer b i len))]", "let rec path_includes\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Ghost bool\n (requires True)\n (ensures (fun _ -> True))\n (decreases p2)\n= (to1 = to2 && p1 = p2) || (match p2 with\n | PathBase -> false\n | PathStep _ _ p2' _ ->\n path_includes p1 p2'\n )", "val sub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: HST.Stack (buffer t)\n (requires (fun h -> UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h b' h' -> UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ h' == h /\\ b' == gsub_buffer b i len ))", "let rec path_includes_base\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes (PathBase #from) p))\n (decreases p)\n [SMTPat (path_includes PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p2' _ -> path_includes_base p2'", "val offset_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: HST.Stack (buffer t)\n (requires (fun h -> UInt32.v i <= UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h b' h' -> UInt32.v i <= UInt32.v (buffer_length b) /\\ h' == h /\\ b' == gsub_buffer b i (UInt32.sub (buffer_length b) i)))", "let path_includes_refl\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes p p))\n [SMTPat (path_includes p p)]\n= ()", "val buffer_length_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_length (gsub_buffer b i len) == len))\n [SMTPat (buffer_length (gsub_buffer b i len))]", "let path_includes_step_r\n (#from #through #to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (PathStep through to p s)))\n [SMTPat (path_includes p (PathStep through to p s))]\n= ()", "val buffer_live_gsub_buffer_equiv\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ (buffer_live h (gsub_buffer b i len) <==> buffer_live h b)))\n [SMTPat (buffer_live h (gsub_buffer b i len))]", "let rec path_includes_trans\n (#from #to1 #to2 #to3: typ)\n (p1: path from to1)\n (p2: path from to2)\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3})\n: Lemma\n (requires True)\n (ensures (path_includes p1 p3))\n (decreases p3)\n= FStar.Classical.or_elim\n #(to2 == to3 /\\ p2 == p3)\n #(match p3 with\n | PathBase -> False\n | PathStep _ _ p3' _ ->\n\tpath_includes p2 p3')\n #(fun _ -> path_includes p1 p3)\n (fun _ -> ())\n (fun _ -> match p3 with\n | PathBase -> assert False\n | PathStep _ _ p3' _ ->\n\tpath_includes_trans p1 p2 p3'\n )", "val buffer_live_gsub_buffer_intro\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (buffer_live h b /\\ UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_live h (gsub_buffer b i len)))\n [SMTPat (buffer_live h (gsub_buffer b i len))]", "val buffer_unused_in_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ (buffer_unused_in (gsub_buffer b i len) h <==> buffer_unused_in b h)))\n [SMTPat (buffer_unused_in (gsub_buffer b i len) h)]", "let rec path_includes_ind\n (#from: typ)\n (x:((#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2 {path_includes p1 p2} ) ->\n GTot Type0))\n (h_step:\n ((#through: typ) ->\n (#to: typ) ->\n (p: path from through) ->\n (s: step through to { path_includes p (PathStep through to p s) } ) ->\n Lemma (x p (PathStep through to p s))))\n (h_refl:\n ((#to: typ) ->\n (p: path from to {path_includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#to1: typ) ->\n (#to2: typ) ->\n (#to3: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3 /\\ path_includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (requires True)\n (ensures (x p1 p2))\n (decreases p2)\n= FStar.Classical.or_elim\n #(to1 == to2 /\\ p1 == p2)\n #(match p2 with\n | PathBase -> False\n | PathStep _ _ p' _ -> path_includes p1 p')\n #(fun _ -> x p1 p2)\n (fun _ -> h_refl p1)\n (fun _ -> match p2 with\n | PathBase -> assert False\n | PathStep _ _ p2' st ->\n let _ = path_includes_ind x h_step h_refl h_trans p1 p2' in\n let _ = path_includes_step_r p2' st in\n let _ = h_step p2' st in\n h_trans p1 p2' p2\n )", "val gsub_buffer_gsub_buffer\n (#a: typ)\n (b: buffer a)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v len1\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v len1 /\\\n gsub_buffer (gsub_buffer b i1 len1) i2 len2 == gsub_buffer b FStar.UInt32.(i1 +^ i2) len2\n ))\n [SMTPat (gsub_buffer (gsub_buffer b i1 len1) i2 len2)]", "val gsub_buffer_zero_buffer_length\n (#a: typ)\n (b: buffer a)\n: Lemma\n (ensures (gsub_buffer b 0ul (buffer_length b) == b))\n [SMTPat (gsub_buffer b 0ul (buffer_length b))]", "val buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot (Seq.seq (type_of_typ t))", "val buffer_length_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires True)\n (ensures (Seq.length (buffer_as_seq h b) == UInt32.v (buffer_length b)))\n [SMTPat (Seq.length (buffer_as_seq h b))]", "val buffer_as_seq_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_as_seq h (gsingleton_buffer_of_pointer p) == Seq.create 1 (gread h p)))\n [SMTPat (buffer_as_seq h (gsingleton_buffer_of_pointer p))]", "let rec path_length\n (#from #to: typ)\n (p: path from to)\n: Tot nat\n (decreases p)\n= match p with\n | PathBase -> 0\n | PathStep _ _ p' _ -> 1 + path_length p'", "val buffer_as_seq_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray length t))\n: Lemma\n (requires True)\n (ensures (buffer_as_seq h (gbuffer_of_array_pointer p) == gread h p))\n [SMTPat (buffer_as_seq h (gbuffer_of_array_pointer p))]", "let path_includes_length\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (ensures (path_length p1 <= path_length p2))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_length p1_ <= path_length p2_)\n (fun #through #to p st -> ())\n (fun #to p -> ())\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> ())\n p1 p2", "val buffer_as_seq_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_as_seq h (gsub_buffer b i len) == Seq.slice (buffer_as_seq h b) (UInt32.v i) (UInt32.v i + UInt32.v len)))\n [SMTPat (buffer_as_seq h (gsub_buffer b i len))]", "let path_includes_step_l\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (~ (path_includes (PathStep through to p s) p)))\n [SMTPat (path_includes (PathStep through to p s) p)]\n= assert (path_length (PathStep through to p s) > path_length p);\n FStar.Classical.forall_intro (path_includes_length #from #to #through (PathStep through to p s))", "val gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Ghost (pointer t)\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (fun _ -> True))", "val pointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: HST.Stack (pointer t)\n (requires (fun h -> UInt32.v i < UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h p h' -> UInt32.v i < UInt32.v (buffer_length b) /\\ h' == h /\\ p == gpointer_of_buffer_cell b i))", "let rec path_includes_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (path_concat p q)))\n (decreases q)\n [SMTPat (path_includes p (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_includes_concat p q'", "val gpointer_of_buffer_cell_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len /\\\n gpointer_of_buffer_cell (gsub_buffer b i1 len) i2 == gpointer_of_buffer_cell b FStar.UInt32.(i1 +^ i2)\n ))", "let path_includes_exists_concat\n (#from #through: typ)\n (p: path from through)\n (#to: typ)\n (q: path from to { path_includes p q } )\n: Lemma\n (ensures (exists (r: path through to) . q == path_concat p r))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> exists r . p2_ == path_concat p1_ r)\n (fun #through #to_ p s -> \n let r = PathStep through to_ PathBase s in\n assert_norm (PathStep through to_ p s == path_concat p r)\n )\n (fun #to p -> FStar.Classical.exists_intro (fun r -> p == path_concat p r) PathBase)\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ ->\n FStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r12 -> p2_ == path_concat p1_ r12) () (fun r12 ->\n\tFStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r23 -> p3_ == path_concat p2_ r23) () (fun r23 ->\n\t path_concat_assoc p1_ r12 r23;\n\t FStar.Classical.exists_intro (fun r -> p3_ == path_concat p1_ r) (path_concat r12 r23)\n\t)\n )\n )\n p q", "let gpointer_of_buffer_cell_gsub_buffer'\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len /\\\n gpointer_of_buffer_cell (gsub_buffer b i1 len) i2 == gpointer_of_buffer_cell b FStar.UInt32.(i1 +^ i2)\n ))\n [SMTPat (gpointer_of_buffer_cell (gsub_buffer b i1 len) i2)]\n= gpointer_of_buffer_cell_gsub_buffer b i1 len i2", "let path_concat_includes\n (#from #through: typ)\n (p: path from through)\n (phi: (\n (#to: typ) ->\n (p': path from to) ->\n Ghost Type0\n (requires (path_includes p p'))\n (ensures (fun _ -> True))\n ))\n (f: (\n (to: typ) ->\n (p': path through to) ->\n Lemma\n (ensures (phi (path_concat p p')))\n ))\n (#to: typ)\n (q: path from to)\n: Lemma\n (requires (path_includes p q))\n (ensures (path_includes p q /\\ phi q))\n= Classical.forall_intro_2 f;\n path_includes_exists_concat p q", "val live_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b) /\\\n (live h (gpointer_of_buffer_cell b i) <==> buffer_live h b)\n ))\n [SMTPat (live h (gpointer_of_buffer_cell b i))]", "val gpointer_of_buffer_cell_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < 1))\n (ensures (UInt32.v i < 1 /\\ gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) i == p))\n [SMTPat (gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) i)]", "let step_disjoint\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: GTot bool\n= match s1 with\n | StepField _ fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 <> fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n UInt32.v i1 <> UInt32.v i2\n | StepUField _ _ ->\n (* two fields of the same union are never disjoint *)\n false", "val gpointer_of_buffer_cell_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (p: pointer (TArray length t))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i == gcell p i))\n [SMTPat (gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i)]", "val frameOf_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ frameOf (gpointer_of_buffer_cell b i) == frameOf_buffer b))\n [SMTPat (frameOf (gpointer_of_buffer_cell b i))]", "let step_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Tot (b: bool { b = true <==> to1 == to2 /\\ s1 == s2 } )\n= match s1 with\n | StepField l1 fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 = fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n i1 = i2\n | StepUField l1 fd1 ->\n let (StepUField _ fd2) = s2 in\n fd1 = fd2", "val as_addr_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ as_addr (gpointer_of_buffer_cell b i) == buffer_as_addr b))\n [SMTPat (as_addr (gpointer_of_buffer_cell b i))]", "val gread_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gread h (gpointer_of_buffer_cell b i) == Seq.index (buffer_as_seq h b) (UInt32.v i)))\n [SMTPat (gread h (gpointer_of_buffer_cell b i))]", "let step_disjoint_not_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2 == true))\n (ensures (step_eq s1 s2 == false))\n= ()", "val gread_gpointer_of_buffer_cell'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gread h (gpointer_of_buffer_cell b i) == Seq.index (buffer_as_seq h b) (UInt32.v i)))", "let step_disjoint_sym\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2))\n (ensures (step_disjoint s2 s1))\n= ()", "val index_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: nat)\n: Lemma\n (requires (i < UInt32.v (buffer_length b)))\n (ensures (i < UInt32.v (buffer_length b) /\\ Seq.index (buffer_as_seq h b) i == gread h (gpointer_of_buffer_cell b (UInt32.uint_to_t i))))\n [SMTPat (Seq.index (buffer_as_seq h b) i)]", "path_disjoint_t", "val gsingleton_buffer_of_pointer_gcell\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n (i: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v len\n ))\n (ensures (\n UInt32.v i < UInt32.v len /\\\n gsingleton_buffer_of_pointer (gcell p i) == gsub_buffer (gbuffer_of_array_pointer p) i 1ul\n ))\n [SMTPat (gsingleton_buffer_of_pointer (gcell p i))]", "PathDisjointStep", "PathDisjointStep", "PathDisjointStep", "through", "through", "to1", "to1", "to2", "to2", "p", "p", "s1", "s1", "s2", "s2", "PathDisjointIncludes", "PathDisjointIncludes", "PathDisjointIncludes", "to1", "to1", "to2", "to2", "p1", "p1", "p2", "p2", "val gsingleton_buffer_of_pointer_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b) /\\\n gsingleton_buffer_of_pointer (gpointer_of_buffer_cell b i) == gsub_buffer b i 1ul\n ))\n [SMTPat (gsingleton_buffer_of_pointer (gpointer_of_buffer_cell b i))]", "to1'", "to1'", "to2'", "to2'", "p1'", "p1'", "p2'", "p2'", "let rec path_disjoint_t_rect\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (h: path_disjoint_t p1 p2) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n (h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)) ->\n GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2'}) ->\n (h: path_disjoint_t p1 p2) ->\n (h': path_disjoint_t p1' p2') ->\n (ihx: x p1 p2 h) ->\n GTot (x p1' p2' h')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n: Ghost (x p1 p2 h)\n (requires True)\n (ensures (fun _ -> True))\n (decreases h)\n= match h with\n | PathDisjointStep p s1 s2 -> h_step p s1 s2 h\n | PathDisjointIncludes p1_ p2_ p1' p2' h_ -> h_includes p1_ p2_ p1' p2' h_ h (path_disjoint_t_rect x h_step h_includes p1_ p2_ h_)", "val buffer_readable\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0", "val buffer_readable_buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (buffer_readable h b))\n (ensures (buffer_live h b))\n [SMTPatOr [\n [SMTPat (buffer_readable h b)];\n [SMTPat (buffer_live h b)];\n ]]", "val buffer_readable_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n: Lemma\n (ensures (buffer_readable h (gsingleton_buffer_of_pointer p) <==> readable h p))\n [SMTPat (buffer_readable h (gsingleton_buffer_of_pointer p))]", "val buffer_readable_gbuffer_of_array_pointer\n (#len: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_readable h (gbuffer_of_array_pointer p) <==> readable h p))\n [SMTPat (buffer_readable h (gbuffer_of_array_pointer p))]", "let path_disjoint\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: GTot Type0\n= squash (path_disjoint_t p1 p2)", "val buffer_readable_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_readable h b))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_readable h (gsub_buffer b i len)))\n [SMTPat (buffer_readable h (gsub_buffer b i len))]", "let path_disjoint_ind\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2 {path_disjoint p1 p2} ) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 /\\ path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) } ) ->\n Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2) )))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2 { path_disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun (h: path_disjoint_t p1 p2) ->\n path_disjoint_t_rect\n (fun #v1 #v2 p1 p2 h -> let _ = FStar.Squash.return_squash h in squash (x p1 p2))\n (fun #through #to1 #to2 p s1 s2 h -> let _ = FStar.Squash.return_squash h in h_step p s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' h h' hx ->\n let _ = FStar.Squash.return_squash h in\n let _ = FStar.Squash.return_squash h' in\n let _ = FStar.Squash.return_squash hx in\n h_includes p1 p2 p1' p2')\n p1 p2 h)", "val readable_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ buffer_readable h b))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ readable h (gpointer_of_buffer_cell b i)))\n [SMTPat (readable h (gpointer_of_buffer_cell b i))]", "val buffer_readable_intro\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (\n buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )))\n (ensures (buffer_readable h b))", "val buffer_readable_elim\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (\n buffer_readable h b\n ))\n (ensures (\n buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )))", "val loc : Type u#0", "let path_disjoint_step\n (#from: typ)\n (#through: typ)\n (#to1: typ)\n (#to2: typ)\n (p: path from through)\n (s1: step through to1)\n (s2: step through to2 { step_disjoint s1 s2 } )\n: Lemma\n (requires True)\n (ensures (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2)))\n [SMTPat (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2))]\n= FStar.Classical.give_witness (FStar.Squash.return_squash (PathDisjointStep p s1 s2))", "val loc_none: loc", "val loc_union\n (s1 s2: loc)\n: GTot loc", "val loc_union_idem\n (s: loc)\n: Lemma\n (loc_union s s == s)\n [SMTPat (loc_union s s)]", "let path_disjoint_includes\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (#to2': typ)\n (p1': path from to1')\n (p2': path from to2')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1' /\\ path_includes p2 p2'))\n (ensures (path_disjoint p1' p2'))\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun h -> FStar.Squash.return_squash (PathDisjointIncludes p1 p2 p1' p2' h))", "val loc_pointer\n (#t: typ)\n (p: pointer t)\n: GTot loc", "val loc_buffer\n (#t: typ)\n (b: buffer t)\n: GTot loc", "val loc_addresses\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc", "val loc_regions\n (r: Set.set HS.rid)\n: GTot loc", "let path_disjoint_includes_l\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (p1': path from to1')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1'))\n (ensures (path_disjoint p1' p2))\n [SMTPatOr [\n [SMTPat (path_disjoint p1 p2); SMTPat (path_includes p1 p1')];\n [SMTPat (path_disjoint p1' p2); SMTPat (path_includes p1 p1')];\n ]]\n= path_disjoint_includes p1 p2 p1' p2", "val loc_includes\n (s1 s2: loc)\n: GTot Type0", "val loc_includes_refl\n (s: loc)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]", "val loc_includes_trans\n (s1 s2 s3: loc)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))", "let path_disjoint_sym\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint p2 p1))\n [SMTPatOr [[SMTPat (path_disjoint p1 p2)]; [SMTPat (path_disjoint p2 p1)]]]\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint p2 p1)\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step p s2 s1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_includes p2 p1 p2' p1')\n p1 p2", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]", "let rec path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Tot (b: bool { b == true <==> (value1 == value2 /\\ p1 == p2) } )\n (decreases p1)\n= match p1 with\n | PathBase -> PathBase? p2\n | PathStep _ _ p1' s1 ->\n PathStep? p2 && (\n let (PathStep _ _ p2' s2) = p2 in (\n path_equal p1' p2' &&\n step_eq s1 s2\n ))", "val loc_includes_none\n (s: loc)\n: Lemma\n (loc_includes s loc_none)\n [SMTPat (loc_includes s loc_none)]", "val loc_includes_pointer_pointer\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (includes p1 p2))\n (ensures (loc_includes (loc_pointer p1) (loc_pointer p2)))\n [SMTPat (loc_includes (loc_pointer p1) (loc_pointer p2))]", "let rec path_length_concat\n (#t0 #t1 #t2: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n: Lemma\n (requires True)\n (ensures (path_length (path_concat p01 p12) == path_length p01 + path_length p12))\n (decreases p12)\n= match p12 with\n | PathBase -> ()\n | PathStep _ _ p' s' -> path_length_concat p01 p'", "val loc_includes_gsingleton_buffer_of_pointer\n (l: loc)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_includes l (loc_pointer p)))\n (ensures (loc_includes l (loc_buffer (gsingleton_buffer_of_pointer p))))\n [SMTPat (loc_includes l (loc_buffer (gsingleton_buffer_of_pointer p)))]", "val loc_includes_gbuffer_of_array_pointer\n (l: loc)\n (#len: array_length_t)\n (#t: typ)\n (p: pointer (TArray len t))\n: Lemma\n (requires (loc_includes l (loc_pointer p)))\n (ensures (loc_includes l (loc_buffer (gbuffer_of_array_pointer p))))\n [SMTPat (loc_includes l (loc_buffer (gbuffer_of_array_pointer p)))]", "let rec path_concat_inj_l\n (#from #through1: typ)\n (p1_: path from through1)\n (#v1: typ)\n (p1: path through1 v1)\n (#through2 #v2: typ)\n (p2_: path from through2)\n (p2: path through2 v2)\n: Lemma\n (requires (path_equal (path_concat p1_ p1) (path_concat p2_ p2) == true /\\ path_length p1_ == path_length p2_))\n (ensures (path_equal p1_ p2_ == true /\\ path_equal p1 p2 == true))\n (decreases p1)\n= path_length_concat p1_ p1;\n path_length_concat p2_ p2;\n match p1 with\n | PathBase -> ()\n | PathStep _ _ p1' s1 ->\n let (PathStep _ _ p2' s2) = p2 in\n path_concat_inj_l p1_ p1' p2_ p2'", "val loc_includes_gpointer_of_array_cell\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_includes l (loc_pointer (gpointer_of_buffer_cell b i))))\n [SMTPat (loc_includes l (loc_pointer (gpointer_of_buffer_cell b i)))]", "val loc_includes_gsub_buffer_r\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer (gsub_buffer b i len))))\n [SMTPat (loc_includes l (loc_buffer (gsub_buffer b i len)))]", "path_disjoint_decomp_t", "PathDisjointDecomp", "PathDisjointDecomp", "PathDisjointDecomp", "d_through", "d_through", "val loc_includes_gsub_buffer_l\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\ UInt32.v i1 <= UInt32.v i2 /\\ UInt32.v i2 + UInt32.v len2 <= UInt32.v i1 + UInt32.v len1))\n (ensures (UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\ UInt32.v i1 <= UInt32.v i2 /\\ UInt32.v i2 + UInt32.v len2 <= UInt32.v i1 + UInt32.v len1 /\\ loc_includes (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2))))\n [SMTPat (loc_includes (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2)))]", "d_p", "d_p", "d_v1", "d_v1", "d_s1", "d_s1", "d_p1'", "d_p1'", "d_v2", "d_v2", "d_s2", "d_s2", "d_p2'", "d_p2'", "val loc_includes_addresses_pointer\n (#t: typ)\n (r: HS.rid)\n (s: Set.set nat)\n (p: pointer t)\n: Lemma\n (requires (frameOf p == r /\\ Set.mem (as_addr p) s))\n (ensures (loc_includes (loc_addresses r s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_addresses r s) (loc_pointer p))]", "let path_disjoint_decomp_includes\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (#value1': typ)\n (#value2': typ)\n (p1': path from value1')\n (p2': path from value2')\n: Lemma\n (requires (\n path_includes p1 p1' /\\\n path_includes p2 p2' /\\ (\n exists (d : path_disjoint_decomp_t p1 p2) . True\n )))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n= let f\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n (requires (\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n = let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_assoc (PathStep _ _ p s1) p1_ q1;\n path_concat_assoc (PathStep _ _ p s2) p2_ q2;\n let d' : path_disjoint_decomp_t p1' p2' =\n PathDisjointDecomp _ p _ s1 (path_concat p1_ q1) _ s2 (path_concat p2_ q2) ()\n in\n Classical.exists_intro (fun _ -> True) d'\n in\n let g\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n ((\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ) ==> (\n exists (d: path_disjoint_decomp_t p1' p2') . True\n ))\n = Classical.move_requires (f q1 q2) d // FIXME: annoying to repeat those type annotations above. WHY WHY WHY can't I just use (fun q1 q2 d -> Classical.move_requires (f q1 q2) d) as an argument of Classical.forall_intro_3 below instead of this g???\n in\n path_includes_exists_concat p1 p1' ;\n path_includes_exists_concat p2 p2' ;\n let _ : squash (exists (d: path_disjoint_decomp_t p1' p2') . True) =\n Classical.forall_intro_3 g\n in\n ()", "val loc_includes_addresses_buffer\n (#t: typ)\n (r: HS.rid)\n (s: Set.set nat)\n (p: buffer t)\n: Lemma\n (requires (frameOf_buffer p == r /\\ Set.mem (buffer_as_addr p) s))\n (ensures (loc_includes (loc_addresses r s) (loc_buffer p)))\n [SMTPat (loc_includes (loc_addresses r s) (loc_buffer p))]", "val loc_includes_region_pointer\n (#t: typ)\n (s: Set.set HS.rid)\n (p: pointer t)\n: Lemma\n (requires (Set.mem (frameOf p) s))\n (ensures (loc_includes (loc_regions s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_regions s) (loc_pointer p))]", "val loc_includes_region_buffer\n (#t: typ)\n (s: Set.set HS.rid)\n (b: buffer t)\n: Lemma\n (requires (Set.mem (frameOf_buffer b) s))\n (ensures (loc_includes (loc_regions s) (loc_buffer b)))\n [SMTPat (loc_includes (loc_regions s) (loc_buffer b))]", "val loc_includes_region_addresses\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions s) (loc_addresses r a)))\n [SMTPat (loc_includes (loc_regions s) (loc_addresses r a))]", "val loc_includes_region_region\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset s2 s1))\n (ensures (loc_includes (loc_regions s1) (loc_regions s2)))\n [SMTPat (loc_includes (loc_regions s1) (loc_regions s2))]", "val loc_includes_region_union_l\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2)))\n [SMTPat (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2))]", "let path_disjoint_decomp\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (exists (d: path_disjoint_decomp_t p1 p2) . True))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> exists (d: path_disjoint_decomp_t #from #v1 #v2 p1 p2) . True)\n (fun #through #to1 #to2 p s1 s2 ->\n let d : path_disjoint_decomp_t (PathStep _ _ p s1) (PathStep _ _ p s2) =\n PathDisjointDecomp _ p _ s1 PathBase _ s2 PathBase ()\n in\n Classical.exists_intro (fun _ -> True) d\n )\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_decomp_includes p1 p2 p1' p2')\n p1 p2", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0", "val loc_disjoint_sym\n (s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\n [SMTPat (loc_disjoint s1 s2)]", "val loc_disjoint_none_r\n (s: loc)\n: Lemma\n (ensures (loc_disjoint s loc_none))\n [SMTPat (loc_disjoint s loc_none)]", "let path_disjoint_not_path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_equal p1 p2 == false))\n= let f\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma (path_equal p1 p2 == false)\n = if path_equal p1 p2\n then\n let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_inj_l (PathStep _ _ p s1) p1_ (PathStep _ _ p s2) p2_\n else ()\n in\n path_disjoint_decomp p1 p2;\n Classical.forall_intro f", "val loc_disjoint_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]", "val loc_disjoint_root\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))\n (ensures (loc_disjoint (loc_pointer p1) (loc_pointer p2)))", "val loc_disjoint_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (fd1 <> fd2))\n (ensures (loc_disjoint (loc_pointer (gfield p fd1)) (loc_pointer (gfield p fd2))))\n [SMTPat (loc_disjoint (loc_pointer (gfield p fd1)) (loc_pointer (gfield p fd2)))]", "let rec path_destruct_l\n (#t0 #t2: typ)\n (p: path t0 t2)\n: Tot (\n x: option (t1: typ & (s: step t0 t1 & (p' : path t1 t2 { p == path_concat (PathStep _ _ PathBase s) p' /\\ path_length p' < path_length p } ) ) )\n { None? x <==> PathBase? p }\n )\n (decreases p)\n= match p with\n | PathBase -> None\n | PathStep _ _ p' s ->\n begin match path_destruct_l p' with\n | None -> Some (| _, (| s, PathBase |) |)\n | Some (| t_, (| s_, p_ |) |) ->\n Some (| t_, (| s_, PathStep _ _ p_ s |) |)\n end", "val loc_disjoint_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n UInt32.v i1 <> UInt32.v i2\n ))\n (ensures (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\ \n loc_disjoint (loc_pointer (gcell p i1)) (loc_pointer (gcell p i2))\n ))\n [SMTPat (loc_disjoint (loc_pointer (gcell p i1)) (loc_pointer (gcell p i2)))]", "let rec path_equal'\n (#from #to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Tot (b: bool { b == true <==> to1 == to2 /\\ p1 == p2 } )\n (decreases (path_length p1))\n= match path_destruct_l p1 with\n | None -> PathBase? p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> false\n | (Some (| t2, (| s2, p2' |) |) ) ->\n step_eq s1 s2 &&\n path_equal' p1' p2'\n end", "val loc_disjoint_includes\n (p1 p2 p1' p2' : loc)\n: Lemma\n (requires (loc_includes p1 p1' /\\ loc_includes p2 p2' /\\ loc_disjoint p1 p2))\n (ensures (loc_disjoint p1' p2'))", "let path_includes_concat_l\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_includes p1 p2))\n (ensures (path_includes (path_concat p0 p1) (path_concat p0 p2)))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_includes (path_concat p0 p1_) (path_concat p0 p2_))\n (fun #through #to p st -> ())\n (fun #to p -> path_includes_refl (path_concat p0 p))\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> path_includes_trans (path_concat p0 p1_) (path_concat p0 p2_) (path_concat p0 p3_))\n p1 p2", "val live_unused_in_disjoint_strong\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))", "let path_disjoint_concat\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint (path_concat p0 p1) (path_concat p0 p2)))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint (path_concat p0 p1) (path_concat p0 p2))\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step (path_concat p0 p) s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n path_includes_concat_l p0 p1 p1';\n path_includes_concat_l p0 p2 p2';\n path_disjoint_includes (path_concat p0 p1) (path_concat p0 p2) (path_concat p0 p1') (path_concat p0 p2'))\n p1 p2", "val live_unused_in_disjoint\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (loc_disjoint (loc_pointer p1) (loc_pointer p2)))\n [SMTPatOr [\n [SMTPat (loc_disjoint (loc_pointer p1) (loc_pointer p2)); SMTPat (live h p1)];\n [SMTPat (loc_disjoint (loc_pointer p1) (loc_pointer p2)); SMTPat (unused_in p2 h)];\n [SMTPat (live h p1); SMTPat (unused_in p2 h)];\n ]]", "val pointer_live_reference_unused_in_disjoint\n (#value1: typ)\n (#value2: Type0)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ HS.unused_in p2 h))\n (ensures (loc_disjoint (loc_pointer p1) (loc_addresses (HS.frameOf p2) (Set.singleton (HS.as_addr p2)))))\n [SMTPat (live h p1); SMTPat (HS.unused_in p2 h)]", "val reference_live_pointer_unused_in_disjoint\n (#value1: Type0)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ unused_in p2 h))\n (ensures (loc_disjoint (loc_addresses (HS.frameOf p1) (Set.singleton (HS.as_addr p1))) (loc_pointer p2)))\n [SMTPat (HS.contains h p1); SMTPat (unused_in p2 h)]", "val loc_disjoint_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v (buffer_length b) /\\ (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v i2 \\/\n UInt32.v i2 + UInt32.v len2 <= UInt32.v i1\n )))\n (ensures (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v (buffer_length b) /\\\n loc_disjoint (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2))\n ))\n [SMTPat (loc_disjoint (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2)))]", "let step_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2 {step_disjoint s1 s2})\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n: Lemma\n (step_sel (step_upd m s1 v) s2 == step_sel m s2)\n= match s1 with\n | StepField l1 fd1 ->\n let (m: ostruct l1) = m in\n let (StepField _ fd2) = s2 in\n begin match m with\n | None -> ()\n | Some m -> DM.sel_upd_other m fd1 v fd2\n end\n | StepCell length1 _ i1 ->\n let (m: option (array length1 (otype_of_typ to1))) = m in\n let (StepCell _ _ i2) = s2 in\n begin match m with\n | None -> ()\n | Some m ->\n Seq.lemma_index_upd2 m (UInt32.v i1) v (UInt32.v i2)\n end", "val loc_disjoint_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v (buffer_length b) /\\ (\n UInt32.v i1 <> UInt32.v i2\n )))\n (ensures (\n UInt32.v i1 < UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v (buffer_length b) /\\\n loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i1)) (loc_pointer (gpointer_of_buffer_cell b i2))\n ))\n [SMTPat (loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i1)) (loc_pointer (gpointer_of_buffer_cell b i2)))]", "let path_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_disjoint p1 p2})\n: Lemma\n (ensures (forall (m: otype_of_typ from) (v: otype_of_typ to1) . path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> forall (m: otype_of_typ from) (v: otype_of_typ v1) . path_sel (path_upd m p1_ v) p2_ == path_sel m p2_)\n (fun #through #to1_ #to2_ p s1 s2 ->\n FStar.Classical.forall_intro_sub #_ #(fun m -> forall (v: otype_of_typ to1_) . path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun m ->\n\t FStar.Classical.forall_intro_sub #_ #(fun v -> path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun v ->\n\t let m0 = path_sel m p in\n let m1 = step_sel m0 s1 in\n let m2 = step_sel m0 s2 in\n let m0' = step_upd m0 s1 v in\n path_sel_upd_same m p m0';\n step_sel_upd_other s1 s2 m0 v\n )))\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n let h1: squash (exists r1 . p1' == path_concat p1 r1) = path_includes_exists_concat p1 p1' in\n let h2: squash (exists r2 . p2' == path_concat p2 r2) = path_includes_exists_concat p2 p2' in\n FStar.Classical.forall_intro_sub #_ #(fun (m: otype_of_typ from) -> forall v . path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (m: otype_of_typ from) ->\n FStar.Classical.forall_intro_sub #_ #(fun (v: otype_of_typ v1') -> path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (v: otype_of_typ v1') ->\n FStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h1 (fun r1 ->\n\tFStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h2 (fun r2 ->\n\t path_upd_concat m p1 r1 v;\n\t path_sel_concat m p2 r2\n\t )))))\n p1 p2", "let loc_disjoint_gpointer_of_buffer_cell_r\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint l (loc_buffer b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint l (loc_pointer (gpointer_of_buffer_cell b i))))\n [SMTPat (loc_disjoint l (loc_pointer (gpointer_of_buffer_cell b i)))]\n= loc_disjoint_includes l (loc_buffer b) l (loc_pointer (gpointer_of_buffer_cell b i))", "let loc_disjoint_gpointer_of_buffer_cell_l\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint (loc_buffer b) l))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i)) l))\n [SMTPat (loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i)) l)]\n= loc_disjoint_includes (loc_buffer b) l (loc_pointer (gpointer_of_buffer_cell b i)) l", "let path_sel_upd_other'\n (#from: typ)\n (#to1: typ)\n (p1: path from to1)\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n (#to2: typ)\n (p2: path from to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_sel_upd_other p1 p2", "val loc_disjoint_addresses\n (r1 r2: HS.rid)\n (n1 n2: Set.set nat)\n: Lemma\n (requires (r1 <> r2 \\/ Set.subset (Set.intersect n1 n2) Set.empty))\n (ensures (loc_disjoint (loc_addresses r1 n1) (loc_addresses r2 n2)))\n [SMTPat (loc_disjoint (loc_addresses r1 n1) (loc_addresses r2 n2))]", "val loc_disjoint_pointer_addresses\n (#t: typ)\n (p: pointer t)\n (r: HS.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r <> frameOf p \\/ (~ (Set.mem (as_addr p) n))))\n (ensures (loc_disjoint (loc_pointer p) (loc_addresses r n)))\n [SMTPat (loc_disjoint (loc_pointer p) (loc_addresses r n))]", "let equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_equal (Pointer?.p p1) (Pointer?.p p2)", "val loc_disjoint_buffer_addresses\n (#t: typ)\n (p: buffer t)\n (r: HH.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r <> frameOf_buffer p \\/ (~ (Set.mem (buffer_as_addr p) n))))\n (ensures (loc_disjoint (loc_buffer p) (loc_addresses r n)))\n [SMTPat (loc_disjoint (loc_buffer p) (loc_addresses r n))]", "let as_addr (#t: typ) (p: pointer t) =\n HS.aref_as_addr (Pointer?.contents p)", "val loc_disjoint_regions\n (rs1 rs2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset (Set.intersect rs1 rs2) Set.empty))\n (ensures (loc_disjoint (loc_regions rs1) (loc_regions rs2)))\n [SMTPat (loc_disjoint (loc_regions rs1) (loc_regions rs2))]", "let _field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TStruct l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepField _ fd) in\n Pointer from contents p''", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0", "let _cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t {UInt32.v i < UInt32.v length})\n: Tot (pointer value)\n= let (Pointer from contents p') = p in\n let p' : path from (TArray length value) = p' in\n let p'' : path from value = PathStep _ _ p' (StepCell _ _ i) in\n Pointer from contents p''", "val modifies_loc_regions_intro\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions rs) h1 h2))", "val modifies_pointer_elim\n (s: loc)\n (h1 h2: HS.mem)\n (#a': typ)\n (p': pointer a')\n: Lemma\n (requires (\n modifies s h1 h2 /\\\n live h1 p' /\\\n loc_disjoint (loc_pointer p') s\n ))\n (ensures (\n equal_values h1 p' h2 p'\n ))\n [SMTPatOr [\n [ SMTPat (modifies s h1 h2); SMTPat (gread h1 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (readable h1 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (live h1 p') ];\n [ SMTPat (modifies s h1 h2); SMTPat (gread h2 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (readable h2 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (live h2 p') ]\n ] ]", "let _ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TUnion l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepUField _ fd) in\n Pointer from contents p''", "let unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0\n= let (Pointer from contents p') = p in\n HS.aref_unused_in contents h", "let pointer_ref_contents : Type0 = (t: typ & otype_of_typ t)", "let live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0\n= let rel = Heap.trivial_preorder pointer_ref_contents in\n let (Pointer from contents _) = p in (\n HS.aref_live_at h contents pointer_ref_contents rel /\\ (\n let untyped_contents = HS.greference_of contents pointer_ref_contents rel in (\n dfst (HS.sel h untyped_contents) == from\n )))", "val modifies_buffer_elim\n (#t1: typ)\n (b: buffer t1)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_buffer b) p /\\\n buffer_live h b /\\\n (UInt32.v (buffer_length b) == 0 ==> buffer_live h' b) /\\ // necessary for liveness, because all buffers of size 0 are disjoint for any memory location, so we cannot talk about their liveness individually without referring to a larger nonempty buffer\n modifies p h h'\n ))\n (ensures (\n buffer_live h' b /\\ (\n buffer_readable h b ==> (\n\tbuffer_readable h' b /\\\n\tbuffer_as_seq h b == buffer_as_seq h' b\n ))))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (buffer_as_seq h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_readable h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_live h b) ];\n [ SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_readable h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_live h' b) ]\n ] ]", "let nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0\n= if g_is_null p\n then True\n else live h p", "let live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= ()", "let g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n= ()", "val modifies_reference_elim\n (#t: Type0)\n (b: HS.reference t)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_addresses (HS.frameOf b) (Set.singleton (HS.as_addr b))) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]", "let greference_of\n (#value: typ)\n (p: pointer value)\n: Ghost (HS.reference pointer_ref_contents)\n (requires (exists h . live h p))\n (ensures (fun x -> (exists h . live h p) /\\ x == HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\ HS.aref_of x == Pointer?.contents p))\n= HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)", "let unused_in_greference_of\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: Lemma\n (requires (exists h . live h p))\n (ensures ((exists h . live h p) /\\ (HS.unused_in (greference_of p) h <==> unused_in p h)))\n [SMTPatOr [\n [SMTPat (HS.unused_in (greference_of p) h)];\n [SMTPat (unused_in p h)];\n ]]\n= ()", "val modifies_refl\n (s: loc)\n (h: HS.mem)\n: Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]", "let live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= let f () : Lemma\n (requires (live h p /\\ p `unused_in` h))\n (ensures False)\n = let r = greference_of p in\n HS.contains_aref_unused_in h r (Pointer?.contents p)\n in\n Classical.move_requires f ()", "val modifies_loc_includes\n (s1: loc)\n (h h': HS.mem)\n (s2: loc)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\n [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]", "let gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)\n= if StrongExcludedMiddle.strong_excluded_middle (live h p)\n then\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n value_of_ovalue value (path_sel c (Pointer?.p p))\n else\n dummy_val value", "val modifies_trans\n (s12: loc)\n (h1 h2: HS.mem)\n (s23: loc)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\n [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]", "let modifies_0 (h0 h1: HS.mem) : GTot Type0 =\n modifies loc_none h0 h1", "let frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid\n= HS.frameOf_aref (Pointer?.contents p)", "let modifies_1 (#t: typ) (p: pointer t) (h0 h1: HS.mem) : GTot Type0 =\n modifies (loc_pointer p) h0 h1", "let live_region_frameOf #value h p =\n let content = greference_of p in\n assert (HS.contains h content)", "val screate\n (value:typ)\n (s: option (type_of_typ value))\n: HST.StackInline (pointer value)\n (requires (fun h -> True))\n (ensures (fun (h0:HS.mem) b h1 ->\n unused_in b h0\n /\\ live h1 b\n /\\ frameOf b = HS.get_tip h0\n /\\ modifies_0 h0 h1\n /\\ begin match s with\n | Some s' ->\n\t readable h1 b /\\\n\t gread h1 b == s'\n | _ -> True\n end\n ))", "let disjoint_roots_intro_pointer_vs_pointer\n (#value1 value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 =!= as_addr p2))\n= ()", "let disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))\n= let r = greference_of p1 in\n assert (HS.contains h r)", "val ecreate\n (t:typ)\n (r:HS.rid)\n (s: option (type_of_typ t))\n: HST.ST (pointer t)\n (requires (fun h -> is_eternal_region r /\\ HST.witnessed (region_contains_pred r)))\n (ensures (fun (h0:HS.mem) b h1 -> unused_in b h0\n /\\ live h1 b\n /\\ frameOf b == r\n /\\ modifies_0 h0 h1\n /\\ begin match s with\n | Some s' ->\n\treadable h1 b /\\\n\tgread h1 b == s'\n | _ -> True\n end\n /\\ ~(is_mm b)))", "let disjoint_roots_intro_reference_vs_pointer\n (#value1: Type)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ p2 `unused_in` h))\n (ensures (HS.frameOf p1 <> frameOf p2 \\/ HS.as_addr p1 =!= as_addr p2))\n= ()", "val field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: HST.Stack (pointer (typ_of_struct_field l fd))\n (requires (fun h -> live h p))\n (ensures (fun h0 p' h1 -> h0 == h1 /\\ p' == gfield p fd))", "let is_mm\n (#value: typ)\n (p: pointer value)\n: GTot bool\n= HS.aref_is_mm (Pointer?.contents p)", "val ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: HST.Stack (pointer (typ_of_struct_field l fd))\n (requires (fun h -> live h p))\n (ensures (fun h0 p' h1 -> h0 == h1 /\\ p' == gufield p fd))", "val cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: HST.Stack (pointer value)\n (requires (fun h -> UInt32.v i < UInt32.v length /\\ live h p))\n (ensures (fun h0 p' h1 -> UInt32.v i < UInt32.v length /\\ h0 == h1 /\\ p' == gcell p i))", "let gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= _field p fd", "let as_addr_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "val read\n (#value: typ)\n (p: pointer value)\n: HST.Stack (type_of_typ value)\n (requires (fun h -> readable h p))\n (ensures (fun h0 v h1 -> readable h0 p /\\ h0 == h1 /\\ v == gread h0 p))", "let unused_in_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n (h: HS.mem)\n= ()", "val is_null\n (#t: typ)\n (p: npointer t)\n: HST.Stack bool\n (requires (fun h -> nlive h p))\n (ensures (fun h b h' -> h' == h /\\ b == g_is_null p))", "let live_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "val write: #a:typ -> b:pointer a -> z:type_of_typ a -> HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z ))", "let gread_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "val write_union_field\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: HST.Stack unit\n (requires (fun h -> live h p))\n (ensures (fun h0 _ h1 -> live h0 p /\\ live h1 p\n /\\ modifies_1 p h0 h1\n /\\ is_active_union_field h1 p fd\n ))", "let frameOf_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "let is_mm_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_regions (HS.mod_set (Set.singleton (HS.get_tip h1)))) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\n [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]", "let gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= _ufield p fd", "let as_addr_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let unused_in_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (h: HS.mem)\n= ()", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))", "let live_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let gread_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_regions (Set.singleton r)) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses r a) l) h1 h2))", "let frameOf_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_mm_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "val modifies_1_readable_struct\n (#l: struct_typ)\n (f: struct_field l)\n (p: pointer (TStruct l))\n (h h' : HS.mem)\n: Lemma\n (requires (readable h p /\\ modifies_1 (gfield p f) h h' /\\ readable h' (gfield p f)))\n (ensures (readable h' p))\n [SMTPatOr [\n [SMTPat (modifies_1 (gfield p f) h h'); SMTPat (readable h p)];\n [SMTPat (modifies_1 (gfield p f) h h'); SMTPat (readable h' p)];\n [SMTPat (readable h p); SMTPat (readable h' (gfield p f))];\n// [SMTPat (readable h' p); SMTPat (readable h' (gfield p f))]; // this pattern is incomplete\n [SMTPat (readable h p); SMTPat (readable h' p); SMTPat (gfield p f)];\n]]", "let gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= _cell p i", "let as_addr_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()", "let unused_in_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()", "val modifies_1_readable_array\n (#t: typ)\n (#len: array_length_t)\n (i: UInt32.t)\n (p: pointer (TArray len t))\n (h h' : HS.mem)\n: Lemma\n (requires (UInt32.v i < UInt32.v len /\\ readable h p /\\ modifies_1 (gcell p i) h h' /\\ readable h' (gcell p i)))\n (ensures (readable h' p))\n [SMTPatOr [\n [SMTPat (modifies_1 (gcell p i) h h'); SMTPat (readable h p)];\n [SMTPat (modifies_1 (gcell p i) h h'); SMTPat (readable h' p)];\n [SMTPat (readable h p); SMTPat (readable h' (gcell p i))];\n// [SMTPat (readable h' p); SMTPat (readable h' (gcell p i))]; // this pattern is incomplete\n [SMTPat (readable h p); SMTPat (readable h' p); SMTPat (gcell p i)];\n ]]", "let live_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()", "let gread_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()", "val read_buffer\t\t\n (#t: typ)\t\t\n (b: buffer t)\t\t\n (i: UInt32.t)\t\t\n: HST.Stack (type_of_typ t)\t\t\n (requires (fun h -> UInt32.v i < UInt32.v (buffer_length b) /\\ readable h (gpointer_of_buffer_cell b i)))\t\t\n (ensures (fun h v h' -> UInt32.v i < UInt32.v (buffer_length b) /\\ h' == h /\\ v == Seq.index (buffer_as_seq h b) (UInt32.v i)))", "let frameOf_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()", "val write_buffer\t\t\n (#t: typ)\t\t\n (b: buffer t)\t\t\n (i: UInt32.t)\t\t\n (v: type_of_typ t)\t\t\n: HST.Stack unit\t\t\n (requires (fun h -> UInt32.v i < UInt32.v (buffer_length b) /\\ buffer_live h b))\t\t\n (ensures (fun h _ h' ->\t\t\n UInt32.v i < UInt32.v (buffer_length b) /\\\t\t\n modifies_1 (gpointer_of_buffer_cell b i) h h' /\\\t\t\n buffer_live h' b /\\\t\t\n readable h' (gpointer_of_buffer_cell b i) /\\\t\t\n Seq.index (buffer_as_seq h' b) (UInt32.v i) == v /\\\t\t\n (buffer_readable h b ==> buffer_readable h' b)\t\t\n ))", "let is_mm_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()", "let includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_includes (Pointer?.p p1) (Pointer?.p p2)", "val buffer_live_unused_in_disjoint\n (#t1 #t2: typ)\n (h: HS.mem)\n (b1: buffer t1)\n (b2: buffer t2)\n: Lemma\n (requires (buffer_live h b1 /\\ buffer_unused_in b2 h))\n (ensures (loc_disjoint (loc_buffer b1) (loc_buffer b2)))\n [SMTPat (buffer_live h b1); SMTPat (buffer_unused_in b2 h)]", "let includes_refl\n (#value: typ)\n (p: pointer value)\n= ()", "let includes_trans\n (#value1 #value2 #value3: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n (p3: pointer value3)\n= path_includes_trans (Pointer?.p p1) (Pointer?.p p2) (Pointer?.p p3)", "val pointer_live_buffer_unused_in_disjoint\n (#t1 #t2: typ)\n (h: HS.mem)\n (b1: pointer t1)\n (b2: buffer t2)\n: Lemma\n (requires (live h b1 /\\ buffer_unused_in b2 h))\n (ensures (loc_disjoint (loc_pointer b1) (loc_buffer b2)))\n [SMTPat (live h b1); SMTPat (buffer_unused_in b2 h)]", "let includes_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "let includes_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "val buffer_live_pointer_unused_in_disjoint\n (#t1 #t2: typ)\n (h: HS.mem)\n (b1: buffer t1)\n (b2: pointer t2)\n: Lemma\n (requires (buffer_live h b1 /\\ unused_in b2 h))\n (ensures (loc_disjoint (loc_buffer b1) (loc_pointer b2)))\n [SMTPat (buffer_live h b1); SMTPat (unused_in b2 h)]", "let includes_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()", "val reference_live_buffer_unused_in_disjoint\n (#t1: Type0)\n (#t2: typ)\n (h: HS.mem)\n (b1: HS.reference t1)\n (b2: buffer t2)\n: Lemma\n (requires (HS.contains h b1 /\\ buffer_unused_in b2 h))\n (ensures (loc_disjoint (loc_addresses (HS.frameOf b1) (Set.singleton (HS.as_addr b1))) (loc_buffer b2)))\n [SMTPat (HS.contains h b1); SMTPat (buffer_unused_in b2 h)]", "let includes_ind\n (x:((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 {includes p1 p2} ) ->\n GTot Type0))\n (h_field:\n ((l: struct_typ) ->\n (p: pointer (TStruct l)) ->\n (fd: struct_field l {includes p (gfield p fd)}) ->\n Lemma (x p (gfield p fd))))\n (h_ufield:\n ((l: union_typ) ->\n (p: pointer (TUnion l)) ->\n (fd: struct_field l {includes p (gufield p fd)}) ->\n Lemma (x p (gufield p fd))))\n (h_cell:\n ((#length: array_length_t) ->\n (#value: typ) ->\n (p: pointer (TArray length value)) ->\n (i: UInt32.t {UInt32.v i < UInt32.v length /\\ includes p (gcell p i)}) ->\n Lemma (x p (gcell p i))))\n (h_refl:\n ((#value: typ) ->\n (p: pointer value {includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#value1: typ) ->\n (#value2: typ) ->\n (#value3: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2) ->\n (p3: pointer value3 {includes p1 p2 /\\ includes p2 p3 /\\ includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 {includes p1 p2})\n: Lemma (x p1 p2)\n= let (Pointer from contents _) = p1 in\n path_includes_ind\n (fun #to1 #to2 p1_ p2_ -> x (Pointer from contents p1_) (Pointer from contents p2_))\n (fun #through #to p s ->\n match s with\n | StepField l fd -> let (pt: pointer (TStruct l)) = (Pointer from contents p) in h_field l pt fd\n | StepUField l fd -> let (pt: pointer (TUnion l)) = (Pointer from contents p) in h_ufield l pt fd\n | StepCell length value i -> let (pt: pointer (TArray length value)) = (Pointer from contents p) in h_cell pt i\n )\n (fun #to p -> h_refl (Pointer from contents p))\n (fun #to1 #to2 #to3 p1_ p2_ p3_ -> h_trans (Pointer from contents p1_) (Pointer from contents p2_) (Pointer from contents p3_))\n (Pointer?.p p1)\n (Pointer?.p p2)", "val buffer_live_reference_unused_in_disjoint\n (#t1: typ)\n (#t2: Type0)\n (h: HS.mem)\n (b1: buffer t1)\n (b2: HS.reference t2)\n: Lemma\n (requires (buffer_live h b1 /\\ HS.unused_in b2 h))\n (ensures (loc_disjoint (loc_buffer b1) (loc_addresses (HS.frameOf b2) (Set.singleton (HS.as_addr b2)))))", "val root_buffer\n (#t: typ)\n (b: buffer t)\n: GTot (buffer t)", "val buffer_idx\n (#t: typ)\n (b: buffer t)\n: Ghost UInt32.t\n (requires True)\n (ensures (fun y ->\n UInt32.v y + UInt32.v (buffer_length b) <=\n UInt32.v (buffer_length (root_buffer b))\n ))", "val buffer_eq_gsub_root\n (#t: typ)\n (b: buffer t)\n: Lemma\n (b == gsub_buffer (root_buffer b) (buffer_idx b) (buffer_length b))", "val root_buffer_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n root_buffer (gsub_buffer b i len) == root_buffer b\n ))\n [SMTPat (root_buffer (gsub_buffer b i len))]", "val buffer_idx_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n buffer_idx (gsub_buffer b i len) == UInt32.add (buffer_idx b) i\n ))\n [SMTPat (buffer_idx (gsub_buffer b i len))]", "val buffer_includes\n (#t: typ)\n (blarge bsmall: buffer t)\n: GTot Type0", "val buffer_includes_refl\n (#t: typ)\n (b: buffer t)\n: Lemma\n (buffer_includes b b)\n [SMTPat (buffer_includes b b)]", "val buffer_includes_trans\n (#t: typ)\n (b1 b2 b3: buffer t)\n: Lemma\n (requires (buffer_includes b1 b2 /\\ buffer_includes b2 b3))\n (ensures (buffer_includes b1 b3))", "val buffer_includes_gsub_r\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n buffer_includes b (gsub_buffer b i len)\n ))", "let readable\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: GTot Type0\n= let () = () in // necessary to somehow remove the `logic` qualifier\n live h b /\\ (\n let content = greference_of b in\n let (| _, c |) = HS.sel h content in\n ovalue_is_readable a (path_sel c (Pointer?.p b))\n )", "val buffer_includes_gsub\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (i2: UInt32.t)\n (len1: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 <= UInt32.v i2 /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v i1 + UInt32.v len1 /\\\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v (buffer_length b) /\\\n buffer_includes (gsub_buffer b i1 len1) (gsub_buffer b i2 len2)\n ))\n [SMTPat (buffer_includes (gsub_buffer b i1 len1) (gsub_buffer b i2 len2))]", "let readable_live\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n= ()", "let readable_gfield\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()", "let readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))\n// [SMTPat (readable #(TStruct l) h p)] // TODO: dubious pattern, will probably trigger unreplayable hints\n= let dummy_field : struct_field l = fst (List.Tot.hd l.fields) in // struct is nonempty\n let dummy_field_ptr = gfield p dummy_field in\n assert (readable h dummy_field_ptr);\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let (v: otype_of_typ (TStruct l)) = path_sel c (Pointer?.p p) in\n let (v: ostruct l {Some? v}) = v in\n ovalue_is_readable_struct_intro l v", "val buffer_includes_elim\n (#t: typ)\n (b1 b2: buffer t)\n: Lemma\n (requires (\n buffer_includes b1 b2\n ))\n (ensures (\n UInt32.v (buffer_idx b1) <= UInt32.v (buffer_idx b2) /\\\n UInt32.v (buffer_idx b2) + UInt32.v (buffer_length b2) <= UInt32.v (buffer_idx b1) + UInt32.v (buffer_length b1) /\\\n b2 == gsub_buffer b1 (UInt32.sub (buffer_idx b2) (buffer_idx b1)) (buffer_length b2)\n ))", "val buffer_includes_loc_includes\n (#t: typ)\n (b1 b2: buffer t)\n: Lemma\n (requires (buffer_includes b1 b2))\n (ensures (loc_includes (loc_buffer b1) (loc_buffer b2)))\n [SMTPatOr [\n [SMTPat (buffer_includes b1 b2)];\n [SMTPat (loc_includes(loc_buffer b1) (loc_buffer b2))]\n ]]", "let readable_struct_forall_mem\n (#l: struct_typ)\n (p: pointer (TStruct l))\n: Lemma (forall\n (h: HS.mem)\n . (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ) ==>\n readable h p\n )\n= let f\n (h: HS.mem)\n : Lemma // FIXME: WHY WHY WHY do we need this explicit annotation?\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))\n = readable_struct h p\n in\n Classical.forall_intro (Classical.move_requires f)", "val cloc_aloc: HS.rid -> nat -> Tot Type0", "val cloc_cls: MG.cls cloc_aloc", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)", "let rec readable_struct_fields'\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: GTot Type0\n (decreases s)\n= match s with\n | [] -> True\n | f :: s' ->\n readable_struct_fields' h p s' /\\ (\n if List.Tot.mem f (List.Tot.map fst l.fields)\n then\n\tlet f : struct_field l = f in\n\treadable h (gfield p f)\n else\n\tTrue\n )", "val loc_of_cloc (l: MG.loc cloc_cls) : Tot loc", "val loc_of_cloc_of_loc (l: loc) : Lemma\n (loc_of_cloc (cloc_of_loc l) == l)\n [SMTPat (loc_of_cloc (cloc_of_loc l))]", "val cloc_of_loc_of_cloc (l: MG.loc cloc_cls) : Lemma\n (cloc_of_loc (loc_of_cloc l) == l)\n [SMTPat (cloc_of_loc (loc_of_cloc l))]", "val loc_includes_to_cloc (l1 l2: loc) : Lemma\n (loc_includes l1 l2 <==> MG.loc_includes (cloc_of_loc l1) (cloc_of_loc l2))", "val loc_disjoint_to_cloc (l1 l2: loc) : Lemma\n (loc_disjoint l1 l2 <==> MG.loc_disjoint (cloc_of_loc l1) (cloc_of_loc l2))", "val modifies_to_cloc (l: loc) (h1 h2: HS.mem) : Lemma\n (modifies l h1 h2 <==> MG.modifies (cloc_of_loc l) h1 h2)", "let readable_struct_fields #l h p s = readable_struct_fields' h p s", "let readable_struct_fields_nil #l h p = ()", "let readable_struct_fields_cons #l h p f q = ()", "let rec readable_struct_fields_elim\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: Lemma\n (requires (readable_struct_fields h p s))\n (ensures (forall f . (List.Tot.mem f s /\\ List.Tot.mem f (List.Tot.map fst l.fields)) ==> (let f : struct_field l = f in readable h (gfield p f))))\n (decreases s)\n= match s with\n | [] -> ()\n | _ :: q -> readable_struct_fields_elim h p q", "let readable_struct_fields_readable_struct #l h p =\n readable_struct_fields_elim h p (List.Tot.map fst l.fields);\n readable_struct h p", "let readable_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()", "let readable_array\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n= assert (readable h (gcell p 0ul)); // for Some?\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let (v0: otype_of_typ (TArray length value)) = path_sel c (Pointer?.p p) in\n ovalue_is_readable_array_intro v0", "let readable_gufield\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_active_union_field\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot Type0\n= let () = () in // necessary to somehow remove the `logic` qualifier\n live h p /\\ (\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let vu : otype_of_typ (TUnion l) = path_sel c (Pointer?.p p) in\n let vu : option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ)) = vu in\n Some? vu /\\ gtdata_get_key (Some?.v vu) == fd\n )", "let is_active_union_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_active_union_field_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_active_union_field_eq\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd1 fd2: struct_field l)\n= ()", "let is_active_union_field_get_key\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_active_union_field_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()", "let is_active_union_field_includes_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (#t': typ)\n (p' : pointer t')\n= let content = greference_of p in\n let (| _ , c |) = HS.sel h content in\n let t = typ_of_struct_field l fd in\n let (Pointer from cts p0) = p in\n let pf = PathStep _ _ p0 (StepUField l fd) in\n let (v0 : otype_of_typ t) = path_sel c pf in\n let phi\n (#t': typ)\n (pt': path from t')\n : Ghost Type0\n (requires (path_includes pf pt'))\n (ensures (fun _ -> True))\n = (~ (path_sel c pt' == none_ovalue t')) ==> is_active_union_field h p fd\n in\n let f\n (t' : typ)\n (pt' : path t t')\n : Lemma\n (ensures (phi (path_concat pf pt')))\n = path_sel_concat c pf pt';\n path_sel_none_ovalue pf;\n path_sel_none_ovalue pt'\n in\n path_concat_includes pf phi f (Pointer?.p p')", "let _singleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Tot (buffer t)\n= let Pointer from contents pth = p in\n match pth with\n | PathStep _ _ pth' (StepCell ln ty i) ->\n (* reconstruct the buffer to the enclosing array *)\n Buffer (BufferRootArray #ty #ln (Pointer from contents pth')) i 1ul \n | _ ->\n Buffer (BufferRootSingleton p) 0ul 1ul", "let gsingleton_buffer_of_pointer #t p = _singleton_buffer_of_pointer p", "let singleton_buffer_of_pointer #t p = _singleton_buffer_of_pointer p", "let gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: GTot (buffer t)\n= Buffer (BufferRootArray p) 0ul length", "let buffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gbuffer_of_array_pointer p))\n= Buffer (BufferRootArray p) 0ul length", "let buffer_length\n (#t: typ)\n (b: buffer t)\n: GTot UInt32.t\n= Buffer?.blength b", "let buffer_length_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_length (gsingleton_buffer_of_pointer p) == 1ul))\n [SMTPat (buffer_length (gsingleton_buffer_of_pointer p))]\n= ()", "let buffer_length_gbuffer_of_array_pointer\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_length (gbuffer_of_array_pointer p) == len))\n [SMTPat (buffer_length (gbuffer_of_array_pointer p))]\n= ()", "let buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= let () = () in ( // necessary to somehow remove the `logic` qualifier\n match b.broot with\n | BufferRootSingleton p -> live h p\n | BufferRootArray p -> live h p\n )", "let buffer_live_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_live h (gsingleton_buffer_of_pointer p) <==> live h p ))\n [SMTPat (buffer_live h (gsingleton_buffer_of_pointer p))]\n= ()", "let buffer_live_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_live h (gbuffer_of_array_pointer p) <==> live h p))\n [SMTPat (buffer_live h (gbuffer_of_array_pointer p))]\n= ()", "let buffer_unused_in #t b h =\n match b.broot with\n | BufferRootSingleton p -> unused_in p h\n | BufferRootArray p -> unused_in p h", "let buffer_live_not_unused_in #t b h = ()", "let buffer_unused_in_gsingleton_buffer_of_pointer #t p h = ()", "let buffer_unused_in_gbuffer_of_array_pointer #t #length p h = ()", "let frameOf_buffer\n (#t: typ)\n (b: buffer t)\n: GTot HS.rid\n= match b.broot with\n | BufferRootSingleton p -> frameOf p\n | BufferRootArray p -> frameOf p", "let frameOf_buffer_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n= ()", "let frameOf_buffer_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n= ()", "let live_region_frameOf_buffer #value h p = ()", "let buffer_as_addr #t b =\n match b.broot with\n | BufferRootSingleton p -> as_addr p\n | BufferRootArray p -> as_addr p", "let buffer_as_addr_gsingleton_buffer_of_pointer #t p = ()", "let buffer_as_addr_gbuffer_of_array_pointer #t #length p = ()", "let gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Buffer (Buffer?.broot b) FStar.UInt32.(Buffer?.bidx b +^ i) len", "let frameOf_buffer_gsub_buffer #t b i len = ()", "let buffer_as_addr_gsub_buffer #t b i len = ()", "let sub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Buffer (Buffer?.broot b) FStar.UInt32.(Buffer?.bidx b +^ i) len", "let offset_buffer #t b i =\n sub_buffer b i (UInt32.sub (Buffer?.blength b) i)", "let buffer_length_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= ()", "let buffer_live_gsub_buffer_equiv\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n h\n= ()", "let buffer_live_gsub_buffer_intro\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n h\n= ()", "let buffer_unused_in_gsub_buffer #t b i len h = ()", "let gsub_buffer_gsub_buffer\n (#a: typ)\n (b: buffer a)\n (i1: UInt32.t)\n len1 i2 len2\n= ()", "let gsub_buffer_zero_buffer_length\n (#a: typ)\n (b: buffer a)\n= ()", "let buffer_root_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer_root t)\n: GTot (Seq.seq (type_of_typ t))\n= match b with\n | BufferRootSingleton p ->\n Seq.create 1 (gread h p)\n | BufferRootArray p ->\n gread h p", "let length_buffer_root_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer_root t)\n: Lemma\n (requires True)\n (ensures (Seq.length (buffer_root_as_seq h b) == UInt32.v (buffer_root_length b)))\n [SMTPat (Seq.length (buffer_root_as_seq h b))]\n= ()", "let buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot (Seq.seq (type_of_typ t))\n= let i = UInt32.v (Buffer?.bidx b) in\n Seq.slice (buffer_root_as_seq h (Buffer?.broot b)) i (i + UInt32.v (Buffer?.blength b))", "let buffer_length_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()", "let buffer_as_seq_gsingleton_buffer_of_pointer #t h p =\n let Pointer from contents pth = p in\n match pth with\n | PathStep through to pth' (StepCell ln ty i) ->\n assert (through == TArray ln ty);\n assert (to == ty);\n assert (t == ty);\n let p' : pointer (TArray ln ty) = Pointer from contents pth' in\n let s : array ln (type_of_typ t) = gread h p' in\n let s1 = Seq.slice s (UInt32.v i) (UInt32.v i + 1) in\n let v = gread h p in\n assert (v == Seq.index s (UInt32.v i));\n let s2 = Seq.create 1 v in\n assert (Seq.length s1 == 1);\n assert (Seq.length s2 == 1);\n assert (Seq.index s1 0 == v);\n assert (Seq.index s2 0 == v);\n assert (Seq.equal s1 s2)\n | _ ->\n Seq.slice_length (Seq.create 1 (gread h p))", "let buffer_as_seq_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray length t))\n= let s : array length (type_of_typ t) = gread h p in\n Seq.slice_length s", "let buffer_as_seq_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Seq.slice_slice (buffer_root_as_seq h (Buffer?.broot b)) (UInt32.v (Buffer?.bidx b)) (UInt32.v (Buffer?.bidx b) + UInt32.v (Buffer?.blength b)) (UInt32.v i) (UInt32.v i + UInt32.v len)", "let gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i\n= match Buffer?.broot b with\n | BufferRootSingleton p -> p\n | BufferRootArray p ->\n gcell p FStar.UInt32.(Buffer?.bidx b +^ i)", "let pointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i\n= match Buffer?.broot b with\n | BufferRootSingleton p -> p\n | BufferRootArray p ->\n _cell p FStar.UInt32.(Buffer?.bidx b +^ i)", "let gpointer_of_buffer_cell_gsub_buffer\n (#t: typ)\n (b: buffer t)\n i1 len i2\n= ()", "let live_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i h\n= ()", "let gpointer_of_buffer_cell_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n i\n= ()", "let gpointer_of_buffer_cell_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (p: pointer (TArray length t))\n i\n= ()", "let frameOf_gpointer_of_buffer_cell #t b i = ()", "let as_addr_gpointer_of_buffer_cell #t b i = ()", "let gread_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()", "let gread_gpointer_of_buffer_cell'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()", "let index_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()", "let gsingleton_buffer_of_pointer_gcell #t #len p i = ()", "let gsingleton_buffer_of_pointer_gpointer_of_buffer_cell #t b i = ()", "let buffer_readable'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )", "let buffer_readable\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= buffer_readable' h b", "let buffer_readable_buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()", "let buffer_readable_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n= let phi () : Lemma\n (requires (buffer_readable h (gsingleton_buffer_of_pointer p)))\n (ensures (readable h p))\n = assert (readable h (gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) 0ul))\n in\n Classical.move_requires phi ()", "let buffer_readable_gbuffer_of_array_pointer\n (#len: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray len t))\n= let phi ()\n : Lemma\n (requires (buffer_readable h (gbuffer_of_array_pointer p)))\n (ensures (readable h p))\n = let psi\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n : Lemma\n (readable h (gcell p i))\n = assert (readable h (gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i))\n in\n Classical.forall_intro psi;\n readable_array h p\n in\n Classical.move_requires phi ()", "let buffer_readable_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Classical.forall_intro (Classical.move_requires (gpointer_of_buffer_cell_gsub_buffer b i len))", "let readable_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()", "let buffer_readable_intro\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()", "let buffer_readable_elim #t h b = ()", "let disjoint\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot Type0\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n Pointer?.from p1 == Pointer?.from p2 /\\\n Pointer?.contents p1 == Pointer?.contents p2 /\\\n path_disjoint (Pointer?.p p1) (Pointer?.p p2)\n else\n True", "let disjoint_root\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))\n (ensures (disjoint p1 p2))\n= ()", "let disjoint_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (fd1 <> fd2))\n (ensures (disjoint (gfield p fd1) (gfield p fd2)))\n [SMTPat (disjoint (gfield p fd1) (gfield p fd2))]\n= ()", "let disjoint_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n UInt32.v i1 <> UInt32.v i2\n ))\n (ensures (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n disjoint (gcell p i1) (gcell p i2)\n ))\n [SMTPat (disjoint (gcell p i1) (gcell p i2))]\n= ()", "let disjoint_includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n (#value1': typ)\n (#value2': typ)\n (p1': pointer value1')\n (p2': pointer value2')\n: Lemma\n (requires (includes p1 p1' /\\ includes p2 p2' /\\ disjoint p1 p2))\n (ensures (disjoint p1' p2'))\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n path_disjoint_includes (Pointer?.p p1) (Pointer?.p p2) (Pointer?.p p1') (Pointer?.p p2')\n else\n ()", "let disjoint_ind\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 {disjoint p1 p2} ) ->\n GTot Type0))\n (h_root:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 { frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2 } ) ->\n Lemma (x p1 p2)))\n (h_field:\n ((#l: struct_typ) ->\n (p: pointer (TStruct l)) ->\n (fd1: struct_field l) ->\n (fd2: struct_field l { fd1 <> fd2 /\\ disjoint (gfield p fd1) (gfield p fd2) } ) ->\n Lemma (x (gfield p fd1) (gfield p fd2))))\n (h_cell:\n ((#length: array_length_t) ->\n (#value: typ) ->\n (p: pointer (TArray length value)) ->\n (i1: UInt32.t {UInt32.v i1 < UInt32.v length}) ->\n (i2: UInt32.t {UInt32.v i2 < UInt32.v length /\\ UInt32.v i1 <> UInt32.v i2 /\\ disjoint (gcell p i1) (gcell p i2) }) ->\n Lemma (x (gcell p i1) (gcell p i2))\n ))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': pointer value1' {includes p1 p1'}) ->\n (p2': pointer value2' {includes p2 p2' /\\ disjoint p1 p2 /\\ disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 { disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n let (Pointer from contents _) = p1 in\n path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> x (Pointer from contents p1_) (Pointer from contents p2_))\n (fun #through #to1 #to2 p s1 s2 ->\n match s1 with\n | StepField l fd1 ->\n let (StepField _ fd2) = s2 in\n h_field #l (Pointer from contents p) fd1 fd2\n | StepCell le va i1 ->\n let (StepCell _ _ i2) = s2 in\n h_cell #le #va (Pointer from contents p) i1 i2\n )\n (fun #v1 #v2 p1_ p2_ #v1' #v2' p1' p2' -> h_includes (Pointer from contents p1_) (Pointer from contents p2_) (Pointer from contents p1') (Pointer from contents p2'))\n (Pointer?.p p1)\n (Pointer?.p p2);\n assert (x p1 p2)\n else\n h_root p1 p2", "let disjoint_sym\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (disjoint p1 p2))\n (ensures (disjoint p2 p1))\n= disjoint_ind\n (fun #v1 #v2 p1 p2 -> disjoint p2 p1)\n (fun #v1 #v2 p1 p2 -> disjoint_root p2 p1)\n (fun #l p fd1 fd2 -> disjoint_gfield p fd2 fd1)\n (fun #le #va p i1 i2 -> disjoint_gcell p i2 i1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> disjoint_includes p2 p1 p2' p1')\n p1 p2", "let disjoint_sym'\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires True)\n (ensures (disjoint p1 p2 <==> disjoint p2 p1))\n [SMTPat (disjoint p1 p2)]\n= FStar.Classical.move_requires (disjoint_sym #value1 #value2 p1) p2;\n FStar.Classical.move_requires (disjoint_sym #value2 #value1 p2) p1", "let disjoint_sym''\n (value1: typ)\n (value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (ensures (disjoint p1 p2 <==> disjoint p2 p1))\n= disjoint_sym' p1 p2", "let disjoint_includes_l #a #es #a' (x: pointer a) (subx:pointer es) (y:pointer a') : Lemma\n (requires (includes x subx /\\ disjoint x y))\n (ensures (disjoint subx y))\n [SMTPat (disjoint subx y); SMTPat (includes x subx)]\n = disjoint_includes x y subx y", "let disjoint_includes_l_swap #a #es #a' (x:pointer a) (subx:pointer es) (y:pointer a') : Lemma\n (requires (includes x subx /\\ disjoint x y))\n (ensures (disjoint y subx))\n [SMTPat (disjoint y subx); SMTPat (includes x subx)]\n = disjoint_includes_l x subx y;\n disjoint_sym subx y", "let disjoint_includes_r\n #t1 #t2 #t3\n (p1: pointer t1)\n (p2: pointer t2)\n (p3: pointer t3)\n: Lemma\n (requires (disjoint p1 p2 /\\ includes p2 p3))\n (ensures (disjoint p1 p3))\n [SMTPat (disjoint p1 p2); SMTPat (includes p2 p3)]\n= disjoint_sym p1 p2;\n disjoint_includes_l_swap p2 p3 p1", "loc_aux", "LocBuffer", "LocBuffer", "LocBuffer", "t", "t", "b", "b", "LocPointer", "LocPointer", "LocPointer", "t", "t", "p", "p", "let buffer_includes_pointer\n (#t1 #t2: typ)\n (b: buffer t1)\n (p: pointer t2)\n: GTot Type0\n= exists (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p", "let loc_aux_includes_pointer\n (s: loc_aux)\n (#t: typ)\n (p: pointer t)\n: GTot Type0\n= match s with\n | LocPointer p' -> \n p' `includes` p\n | LocBuffer b ->\n buffer_includes_pointer b p", "let loc_aux_includes_pointer_trans\n (s: loc_aux)\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (loc_aux_includes_pointer s p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_includes_pointer s p2))\n= match s with\n | LocPointer p -> includes_trans p p1 p2\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p1))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p2))\n = includes_trans (gpointer_of_buffer_cell b i) p1 p2\n in\n Classical.forall_intro (Classical.move_requires f)", "let loc_aux_includes_buffer\n (s: loc_aux)\n (#t: typ)\n (b: buffer t)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> loc_aux_includes_pointer s (gpointer_of_buffer_cell b i)", "let loc_aux_includes\n (s: loc_aux)\n (s2: loc_aux)\n: GTot Type0\n (decreases s2)\n= match s2 with\n | LocPointer p ->\n loc_aux_includes_pointer s p\n | LocBuffer b ->\n loc_aux_includes_buffer s b", "let loc_aux_includes_refl'\n (s: loc_aux)\n: Lemma\n (ensures (loc_aux_includes s s))\n= ()", "let loc_aux_includes_refl''\n (s: loc_aux)\n: Lemma\n (loc_aux_includes s s)\n [SMTPat (loc_aux_includes s s)]\n= loc_aux_includes_refl' s", "let loc_aux_includes_loc_aux_includes_pointer\n (s1: loc_aux)\n (s2: loc_aux)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_pointer s2 p))\n (ensures (loc_aux_includes_pointer s1 p))\n= match s2 with\n | LocPointer p' ->\n loc_aux_includes_pointer_trans s1 p' p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p))\n (ensures (loc_aux_includes_pointer s1 p))\n = loc_aux_includes_pointer_trans s1 (gpointer_of_buffer_cell b i) p\n in\n Classical.forall_intro (Classical.move_requires f)", "let loc_aux_includes_trans\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= match s3 with\n | LocPointer p ->\n loc_aux_includes_loc_aux_includes_pointer s1 s2 p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_aux_includes_pointer s1 (gpointer_of_buffer_cell b i)))\n = loc_aux_includes_loc_aux_includes_pointer s1 s2 (gpointer_of_buffer_cell b i)\n in\n Classical.forall_intro (Classical.move_requires f)", "let loc_aux_includes_trans'\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\n= Classical.move_requires (loc_aux_includes_trans s1 s2) s3", "let disjoint_buffer_vs_pointer\n (#t1 #t2: typ)\n (b: buffer t1)\n (p: pointer t2)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> disjoint (gpointer_of_buffer_cell b i) p", "let loc_aux_disjoint_pointer\n (l: loc_aux)\n (#t: typ)\n (p: pointer t)\n: GTot Type0\n= match l with\n | LocPointer p' -> disjoint p' p\n | LocBuffer b -> disjoint_buffer_vs_pointer b p", "let loc_aux_disjoint_buffer\n (l: loc_aux)\n (#t: typ)\n (b: buffer t)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> loc_aux_disjoint_pointer l (gpointer_of_buffer_cell b i)", "let loc_aux_disjoint_buffer_sym\n (#t1 #t2: typ)\n (b1: buffer t1)\n (b2: buffer t2)\n: Lemma\n (loc_aux_disjoint_buffer (LocBuffer b1) b2 <==> loc_aux_disjoint_buffer (LocBuffer b2) b1)\n= Classical.forall_intro_2 (disjoint_sym'' t1 t2)", "let loc_aux_disjoint_pointer_buffer_sym\n (#t1 #t2: typ)\n (b1: buffer t1)\n (p2: pointer t2)\n: Lemma\n (loc_aux_disjoint_pointer (LocBuffer b1) p2 <==> loc_aux_disjoint_buffer (LocPointer p2) b1)\n= Classical.forall_intro_2 (disjoint_sym'' t1 t2)", "let loc_aux_disjoint\n (l1 l2: loc_aux)\n: GTot Type0\n (decreases l2)\n= match l2 with\n | LocPointer p ->\n loc_aux_disjoint_pointer l1 p\n | LocBuffer b ->\n loc_aux_disjoint_buffer l1 b", "let loc_aux_disjoint_sym\n (l1 l2: loc_aux)\n: Lemma\n (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1))\n=\n begin match (l1, l2) with\n | (LocPointer p1, LocPointer p2) -> disjoint_sym' p1 p2\n | (LocPointer p1, LocBuffer b2) -> loc_aux_disjoint_pointer_buffer_sym b2 p1\n | (LocBuffer b1, LocPointer p2) -> loc_aux_disjoint_pointer_buffer_sym b1 p2\n | (LocBuffer b1, LocBuffer b2) -> loc_aux_disjoint_buffer_sym b1 b2\n end", "let loc_aux_disjoint_sym'\n (l1 l2: loc_aux)\n: Lemma\n (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)\n= loc_aux_disjoint_sym l1 l2", "let loc_aux_disjoint_pointer_includes\n (l: loc_aux)\n (#t1: typ)\n (p1: pointer t1)\n (#t2: typ)\n (p2: pointer t2)\n: Lemma\n (requires (loc_aux_disjoint_pointer l p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_disjoint_pointer l p2))\n= ()", "let loc_aux_disjoint_loc_aux_includes_pointer\n (l1 l2: loc_aux)\n (#t3: typ)\n (p3: pointer t3)\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes_pointer l2 p3))\n (ensures (loc_aux_disjoint_pointer l1 p3))\n= match l2 with\n | LocPointer p2 ->\n loc_aux_disjoint_pointer_includes l1 p2 p3\n | LocBuffer b2 ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b2) /\\\n gpointer_of_buffer_cell b2 i `includes` p3\n ))\n (ensures (loc_aux_disjoint_pointer l1 p3))\n = loc_aux_disjoint_pointer_includes l1 (gpointer_of_buffer_cell b2 i) p3\n in\n Classical.forall_intro (Classical.move_requires f)", "let loc_aux_disjoint_loc_aux_includes\n (l1 l2 l3: loc_aux)\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes l2 l3))\n (ensures (loc_aux_disjoint l1 l3))\n= match l3 with\n | LocPointer p3 ->\n loc_aux_disjoint_loc_aux_includes_pointer l1 l2 p3\n | LocBuffer b3 ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b3)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b3) /\\\n loc_aux_disjoint_pointer l1 (gpointer_of_buffer_cell b3 i)\n ))\n = loc_aux_disjoint_loc_aux_includes_pointer l1 l2 (gpointer_of_buffer_cell b3 i)\n in\n Classical.forall_intro (Classical.move_requires f)", "let pointer_preserved\n (#t: typ)\n (p: pointer t)\n (h h' : HS.mem)\n: GTot Type0\n= equal_values h p h' p", "let buffer_preserved\n (#t: typ)\n (b: buffer t)\n (h h' : HS.mem)\n: GTot Type0\n= forall (i: FStar.UInt32.t) . FStar.UInt32.v i < FStar.UInt32.v (buffer_length b) ==> pointer_preserved (gpointer_of_buffer_cell b i) h h'", "let loc_aux_preserved (l: loc_aux) (h h' : HS.mem) : GTot Type0 =\n match l with\n | LocBuffer b -> buffer_preserved b h h'\n | LocPointer p -> pointer_preserved p h h'", "let pointer_preserved_intro\n (#t: typ)\n (p: pointer t)\n (h1 h2 : HS.mem)\n (f: (\n (a' : Type0) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ frameOf p == HS.frameOf r' /\\ as_addr p == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (pointer_preserved p h1 h2)\n= let g () : Lemma\n (requires (live h1 p))\n (ensures (pointer_preserved p h1 h2))\n = f _ _ (greference_of p)\n in\n Classical.move_requires g ()", "let buffer_preserved_intro\n (#t: typ)\n (p: buffer t)\n (h1 h2 : HS.mem)\n (f: (\n (a' : Type0) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ frameOf_buffer p == HS.frameOf r' /\\ buffer_as_addr p == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (buffer_preserved p h1 h2)\n= let g\n (i: FStar.UInt32.t { FStar.UInt32.v i < FStar.UInt32.v (buffer_length p) } )\n : Lemma\n (ensures (pointer_preserved (gpointer_of_buffer_cell p i) h1 h2))\n = pointer_preserved_intro (gpointer_of_buffer_cell p i) h1 h2 f\n in\n Classical.forall_intro g", "let disjoint_not_self\n (#t: typ)\n (p: pointer t)\n: Lemma\n (disjoint p p ==> False)\n= Classical.move_requires (path_disjoint_not_path_equal (Pointer?.p p)) (Pointer?.p p)", "let loc_aux_in_addr\n (l: loc_aux)\n (r: HS.rid)\n (n: nat)\n: GTot Type0\n= match l with\n | LocBuffer b ->\n frameOf_buffer b == r /\\\n buffer_as_addr b == n\n | LocPointer p ->\n frameOf p == r /\\\n as_addr p == n", "let aloc (r: HS.rid) (n: nat) : Tot Type0 =\n (l: loc_aux { loc_aux_in_addr l r n } )", "let cls : MG.cls aloc = MG.Cls #aloc\n (fun #r #a -> loc_aux_includes)\n (fun #r #a x -> ())\n (fun #r #a -> loc_aux_includes_trans)\n (fun #r #a -> loc_aux_disjoint)\n (fun #r #a -> loc_aux_disjoint_sym)\n (fun #r #a larger1 larger2 smaller1 smaller2 ->\n loc_aux_disjoint_loc_aux_includes larger1 larger2 smaller2;\n loc_aux_disjoint_sym larger1 smaller2;\n loc_aux_disjoint_loc_aux_includes smaller2 larger1 smaller1;\n loc_aux_disjoint_sym smaller2 smaller1\n )\n (fun #r #a -> loc_aux_preserved)\n (fun #r #a x h -> ())\n (fun #r #a x h1 h2 h3 -> ())\n (fun #r #a b h1 h2 f ->\n match b with\n | LocPointer p -> pointer_preserved_intro p h1 h2 f\n | LocBuffer p -> buffer_preserved_intro p h1 h2 f\n )", "let loc = MG.loc cls", "let loc_none = MG.loc_none", "let loc_union = MG.loc_union", "let loc_union_idem = MG.loc_union_idem", "let loc_pointer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p)", "let loc_buffer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf_buffer p) #(buffer_as_addr p) (LocBuffer p)", "let loc_addresses = MG.loc_addresses #_ #cls false", "let loc_regions = MG.loc_regions false", "let loc_includes = MG.loc_includes", "let loc_includes_refl = MG.loc_includes_refl", "let loc_includes_trans = MG.loc_includes_trans", "let loc_includes_union_r = MG.loc_includes_union_r", "let loc_includes_union_l = MG.loc_includes_union_l", "let loc_includes_none = MG.loc_includes_none", "let loc_includes_pointer_pointer #t1 #t2 p1 p2 =\n MG.loc_includes_aloc #_ #cls #(frameOf p1) #(as_addr p1) (LocPointer p1) (LocPointer p2)", "let loc_includes_gsingleton_buffer_of_pointer l #t p =\n MG.loc_includes_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p) (LocBuffer (gsingleton_buffer_of_pointer p));\n MG.loc_includes_trans l (loc_pointer p) (loc_buffer (gsingleton_buffer_of_pointer p))", "let loc_includes_gbuffer_of_array_pointer l #len #t p =\n MG.loc_includes_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p) (LocBuffer (gbuffer_of_array_pointer p));\n MG.loc_includes_trans l (loc_pointer p) (loc_buffer (gbuffer_of_array_pointer p))", "let loc_includes_gpointer_of_array_cell l #t b i =\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b) (LocPointer (gpointer_of_buffer_cell b i));\n MG.loc_includes_trans l (loc_buffer b) (loc_pointer (gpointer_of_buffer_cell b i))", "let loc_includes_gsub_buffer_r l #t b i len =\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b) (LocBuffer (gsub_buffer b i len));\n MG.loc_includes_trans l (loc_buffer b) (loc_buffer (gsub_buffer b i len))", "let loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 =\n let b1 = gsub_buffer b i1 len1 in\n let b2 = gsub_buffer b1 (FStar.UInt32.sub i2 i1) len2 in\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b1) (LocBuffer b2)", "let loc_includes_addresses_pointer #t r s p =\n MG.loc_includes_addresses_aloc #_ #cls false r s #(as_addr p) (LocPointer p)", "let loc_includes_addresses_buffer #t r s p =\n MG.loc_includes_addresses_aloc #_ #cls false r s #(buffer_as_addr p) (LocBuffer p)", "let loc_includes_region_pointer #t s p =\n MG.loc_includes_region_aloc #_ #cls false s #(frameOf p) #(as_addr p) (LocPointer p)", "let loc_includes_region_buffer #t s b =\n MG.loc_includes_region_aloc #_ #cls false s #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b)", "let loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls false false", "let loc_includes_region_region = MG.loc_includes_region_region #_ #cls false false", "let loc_includes_region_union_l = MG.loc_includes_region_union_l false", "let loc_disjoint = MG.loc_disjoint", "let loc_disjoint_sym = MG.loc_disjoint_sym", "let loc_disjoint_none_r = MG.loc_disjoint_none_r", "let loc_disjoint_union_r = MG.loc_disjoint_union_r", "let loc_disjoint_root #value1 #value2 p1 p2 =\n MG.loc_disjoint_addresses #_ #cls false false (frameOf p1) (frameOf p2) (Set.singleton (as_addr p1)) (Set.singleton (as_addr p2));\n loc_includes_addresses_pointer (frameOf p1) (Set.singleton (as_addr p1)) p1;\n loc_includes_addresses_pointer (frameOf p2) (Set.singleton (as_addr p2)) p2;\n MG.loc_disjoint_includes #_ #cls (loc_addresses (frameOf p1) (Set.singleton (as_addr p1))) (loc_addresses (frameOf p2) (Set.singleton (as_addr p2))) (loc_pointer p1) (loc_pointer p2)", "let loc_disjoint_gfield #l p fd1 fd2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf p) #(as_addr p) #(frameOf p) #(as_addr p) (LocPointer (gfield p fd1)) (LocPointer (gfield p fd2))", "let loc_disjoint_gcell #length #value p i1 i2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf p) #(as_addr p) #(frameOf p) #(as_addr p) (LocPointer (gcell p i1)) (LocPointer (gcell p i2))", "let loc_disjoint_includes = MG.loc_disjoint_includes", "let live_unused_in_disjoint_strong #value1 #value2 h p1 p2 = ()", "let live_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_disjoint_root p1 p2", "let pointer_live_reference_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_includes_addresses_pointer (frameOf p1) (Set.singleton (as_addr p1)) p1;\n loc_includes_refl (MG.loc_freed_mreference p2);\n disjoint_roots_intro_pointer_vs_reference h p1 p2;\n MG.loc_disjoint_addresses #_ #cls false false (frameOf p1) (HS.frameOf p2) (Set.singleton (as_addr p1)) (Set.singleton (HS.as_addr p2));\n MG.loc_disjoint_includes #_ #cls (loc_addresses (frameOf p1) (Set.singleton (as_addr p1))) (MG.loc_freed_mreference p2) (loc_pointer p1) (MG.loc_freed_mreference p2)", "let reference_live_pointer_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_includes_addresses_pointer (frameOf p2) (Set.singleton (as_addr p2)) p2;\n loc_includes_refl (MG.loc_freed_mreference p1);\n disjoint_roots_intro_reference_vs_pointer h p1 p2;\n MG.loc_disjoint_addresses #_ #cls false false (HS.frameOf p1) (frameOf p2) (Set.singleton (HS.as_addr p1)) (Set.singleton (as_addr p2));\n MG.loc_disjoint_includes #_ #cls (MG.loc_freed_mreference p1) (loc_addresses (frameOf p2) (Set.singleton (as_addr p2))) (MG.loc_freed_mreference p1) (loc_pointer p2)", "let loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer (gsub_buffer b i1 len1)) (LocBuffer (gsub_buffer b i2 len2))", "let loc_disjoint_gpointer_of_buffer_cell #t b i1 i2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) #(frameOf_buffer b) #(buffer_as_addr b) (LocPointer (gpointer_of_buffer_cell b i1)) (LocPointer (gpointer_of_buffer_cell b i2))", "let loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls false false", "let loc_disjoint_pointer_addresses #t p r n =\n loc_disjoint_includes (loc_addresses (frameOf p) (Set.singleton (as_addr p))) (loc_addresses r n) (loc_pointer p) (loc_addresses r n)", "let loc_disjoint_buffer_addresses #t p r n =\n loc_disjoint_includes (loc_addresses (frameOf_buffer p) (Set.singleton (buffer_as_addr p))) (loc_addresses r n) (loc_buffer p) (loc_addresses r n)", "let loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls false false", "let modifies = MG.modifies", "let modifies_loc_regions_intro rs h1 h2 =\n MG.modifies_loc_regions_intro #_ #cls rs h1 h2;\n MG.loc_includes_region_region #_ #cls false true rs rs;\n MG.modifies_loc_includes (loc_regions rs) h1 h2 (MG.loc_regions true rs)", "let modifies_pointer_elim s h1 h2 #a' p' =\n MG.modifies_aloc_elim #_ #_ #(frameOf p') #(as_addr p') (LocPointer p') s h1 h2", "val modifies_buffer_elim'\n (#t1: typ)\n (b: buffer t1)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_buffer b) p /\\\n buffer_live h b /\\\n UInt32.v (buffer_length b) > 0 /\\\n modifies p h h'\n ))\n (ensures (\n buffer_live h' b /\\ (\n buffer_readable h b ==> (\n\tbuffer_readable h' b /\\\n\tbuffer_as_seq h b == buffer_as_seq h' b\n ))))", "let modifies_buffer_elim' #t1 b p h h' =\n Classical.forall_intro_2 HS.lemma_tip_top;\n loc_disjoint_sym (loc_buffer b) p;\n let n = UInt32.v (buffer_length b) in\n begin\n assert (n > 0);\n let pre\n (i: UInt32.t)\n : GTot Type0\n = UInt32.v i < n\n in\n let post\n (i: UInt32.t)\n : GTot Type0\n = pre i /\\ (\n\t let q = gpointer_of_buffer_cell b i in\n\t equal_values h q h' q\n )\n in\n let f\n (i: UInt32.t)\n : Lemma\n (requires (pre i))\n (ensures (post i))\n = modifies_pointer_elim p h h' (gpointer_of_buffer_cell b i)\n in\n f 0ul; // for the liveness of the whole buffer\n Classical.forall_intro (Classical.move_requires f);\n assert (buffer_readable h b ==> buffer_readable h' b);\n let g () : Lemma\n (requires (buffer_readable h b))\n (ensures (buffer_as_seq h b == buffer_as_seq h' b))\n = let s = buffer_as_seq h b in\n let s' = buffer_as_seq h' b in\n Seq.lemma_eq_intro s s';\n Seq.lemma_eq_elim s s'\n in\n Classical.move_requires g ()\n end", "let modifies_buffer_elim #t1 b p h h' =\n if buffer_length b = 0ul\n then ()\n else modifies_buffer_elim' b p h h'", "let modifies_reference_elim #t b p h h' =\n MG.loc_includes_addresses_addresses #_ cls false true (HS.frameOf b) (Set.singleton (HS.as_addr b)) (Set.singleton (HS.as_addr b));\n MG.loc_includes_refl p;\n MG.loc_disjoint_includes (MG.loc_freed_mreference b) p (MG.loc_mreference b) p;\n MG.modifies_mreference_elim b p h h'", "let modifies_refl = MG.modifies_refl", "let modifies_loc_includes = MG.modifies_loc_includes", "let modifies_trans = MG.modifies_trans", "let screate\n (value:typ)\n (s: option (type_of_typ value))\n= let h0 = HST.get () in\n let s = match s with\n | Some s -> ovalue_of_value value s\n | _ -> none_ovalue value\n in\n let content: HS.reference pointer_ref_contents =\n HST.salloc (| value, s |)\n in\n let aref = HS.aref_of content in\n let p = Pointer value aref PathBase in\n let h1 = HST.get () in\n assert (HS.aref_live_at h1 aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents));\n let f () : Lemma (\n let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n HS.sel h1 gref == HS.sel h1 content\n )\n = let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n assert (HS.frameOf content == HS.frameOf gref);\n assert (HS.as_addr content == HS.as_addr gref);\n HS.lemma_sel_same_addr h1 content gref\n in\n f ();\n MG.modifies_intro loc_none h0 h1\n (fun _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n (fun r a b ->\n cls.MG.same_mreference_aloc_preserved b h0 h1 (fun _ _ _ -> ())\n )\n ;\n p", "let domain_upd (#a:Type) (h:HS.mem) (x:HS.reference a{HS.live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (HS.upd h x v))))\n = let m = (HS.get_hmap h) in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')", "let ecreate\n (t:typ)\n (r:HS.rid)\n (s: option (type_of_typ t))\n= let h0 = HST.get () in\n let s0 = s in\n let s = match s with\n | Some s -> ovalue_of_value t s\n | _ -> none_ovalue t\n in\n let content: HS.ref pointer_ref_contents =\n HST.ralloc r (| t, s |)\n in\n domain_upd h0 content (| t, s |) ;\n let aref = HS.aref_of content in\n let p = Pointer t aref PathBase in\n let h1 = HST.get () in\n assert (HS.aref_live_at h1 aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents));\n let f () : Lemma (\n let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n HS.sel h1 gref == HS.sel h1 content\n )\n = let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n assert (HS.frameOf content == HS.frameOf gref);\n assert (HS.as_addr content == HS.as_addr gref);\n HS.lemma_sel_same_addr h1 content gref\n in\n f ();\n MG.modifies_intro loc_none h0 h1\n (fun _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n (fun r a b ->\n cls.MG.same_mreference_aloc_preserved b h0 h1 (fun _ _ _ -> ())\n )\n ;\n p", "let field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= _field p fd", "let ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= _ufield p fd", "let cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= _cell p i", "let reference_of\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Pure (HS.reference pointer_ref_contents)\n (requires (live h p))\n (ensures (fun x -> \n live h p /\\\n x == HS.reference_of h (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\\n HS.frameOf x == HS.frameOf (greference_of p) /\\\n HS.as_addr x == HS.as_addr (greference_of p) /\\\n (forall h' . h' `HS.contains` x <==> h' `HS.contains` (greference_of p)) /\\\n (forall h' . (h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.sel h' x == HS.sel h' (greference_of p))) /\\\n (forall h' z .\n (h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==>\n (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.upd h' x z == HS.upd h' (greference_of p) z)\n )))\n= let x =\n HS.reference_of h (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)\n in\n let f (h' : HS.mem) : Lemma\n ( (exists h' . live h' p) /\\ // necessary to typecheck Classical.forall_intro\n (h' `HS.contains` x <==> h' `HS.contains` (greference_of p)) /\\\n ((h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> HS.sel h' x == HS.sel h' (greference_of p)))\n = let y = greference_of p in\n Classical.move_requires (HS.lemma_sel_same_addr h' y) x;\n Classical.move_requires (HS.lemma_sel_same_addr h' x) y\n in\n let g (z: pointer_ref_contents) (h' : HS.mem) : Lemma (\n (exists h' . live h' p) /\\\n ((h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.upd h' x z == HS.upd h' (greference_of p) z))\n )\n = let y = greference_of p in\n Classical.move_requires (HS.lemma_upd_same_addr h' y x) z;\n Classical.move_requires (HS.lemma_upd_same_addr h' x y) z\n in\n Classical.forall_intro f ;\n Classical.forall_intro_2 g;\n x", "let read\n (#value: typ)\n (p: pointer value)\n= let h = HST.get () in\n let r = reference_of h p in\n HST.witness_region (HS.frameOf r);\n HST.witness_hsref r;\n let (| _ , c |) = !r in\n value_of_ovalue value (path_sel c (Pointer?.p p))", "let is_null\n (#t: typ)\n (p: npointer t)\n= match p with\n | NullPtr -> true\n | _ -> false", "let owrite\n (#a: typ)\n (b: pointer a)\n (z: otype_of_typ a)\n: HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 ->\n live h0 b /\\\n live h1 b /\\\n modifies_1 b h0 h1 /\\ (\n let g = greference_of b in\n let (| _, c1 |) = HS.sel h1 g in\n path_sel c1 (Pointer?.p b) == z\n )))\n= let h0 = HST.get () in\n let r = reference_of h0 b in\n HST.witness_region (HS.frameOf r);\n HST.witness_hsref r;\n let v0 = !r in\n let (| t , c0 |) = v0 in\n let c1 = path_upd c0 (Pointer?.p b) z in\n let v1 = (| t, c1 |) in\n r := v1;\n let h1 = HST.get () in\n let e () : Lemma (\n let gref = greference_of b in (\n HS.frameOf r == HS.frameOf gref /\\\n HS.as_addr r == HS.as_addr gref /\\\n HS.sel h0 gref == v0 /\\\n HS.sel h1 gref == v1\n ))\n = let gref = greference_of b in\n HS.lemma_sel_same_addr h0 r gref;\n HS.lemma_sel_same_addr h1 r gref\n in\n e ();\n let prf_alocs\n (r': HS.rid)\n (a': nat)\n (b' : aloc r' a')\n : Lemma\n (requires (MG.loc_disjoint (MG.loc_of_aloc b') (loc_pointer b)))\n (ensures (cls.MG.aloc_preserved b' h0 h1))\n =\n let f\n (t: typ)\n (p: pointer t)\n : Lemma\n (requires (\n live h0 p /\\\n disjoint b p\n ))\n (ensures (\n equal_values h0 p h1 p\n ))\n = let grefp = greference_of p in\n if frameOf p = frameOf b && as_addr p = as_addr b\n then begin\n HS.lemma_sel_same_addr h0 r grefp;\n HS.lemma_sel_same_addr h1 r grefp;\n path_sel_upd_other' (Pointer?.p b) c0 z (Pointer?.p p)\n end\n else ()\n in\n let f'\n (t: typ)\n (p: pointer t)\n : Lemma\n ( (\n live h0 p /\\\n disjoint b p\n ) ==> (\n equal_values h0 p h1 p\n ))\n = Classical.move_requires (f t) p\n in\n MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(frameOf b) #(as_addr b) b' (LocPointer b);\n Classical.forall_intro_2 f'\n in\n MG.modifies_intro (loc_pointer b) h0 h1\n (fun _ -> ())\n (fun t' pre' p' ->\n loc_disjoint_sym (MG.loc_mreference p') (loc_pointer b);\n MG.loc_disjoint_aloc_addresses_elim #_ #cls #(frameOf b) #(as_addr b) (LocPointer b) true (HS.frameOf p') (Set.singleton (HS.as_addr p'))\n )\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n prf_alocs" ], "closest": [ "val write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag #l h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\nlet write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\n=\n let tag_ptr = P.field p (tag_field l) in\n let u_ptr = P.field p (union_field l) in\n let t = tag_of_field #l tgs f in\n P.write tag_ptr t;\n let h11 = HST.get () in\n P.write (P.ufield u_ptr f) v;\n let h1 = HST.get () in\n // SMTPats for this lemma do not seem to trigger?\n// P.no_upd_lemma_1 h11 h1 u_ptr tag_ptr;\n assert (P.readable h1 tag_ptr);\n assert (P.readable h1 u_ptr);\n P.readable_struct_fields_readable_struct h1 p;\n let uf = P.ufield u_ptr f in\n P.is_active_union_field_includes_readable #l h1 u_ptr f uf;\n assert (P.is_active_union_field #l h1 u_ptr f)", "val write : #a:Type -> \n r:ref a -> \n\t x:a -> \n\t AllocST unit (fun h0 -> True)\n (fun h0 _ h1 -> contains r h0 /\\ \n\t\t\t h1 == upd h0 r x)\nlet write #a r x = \n let h0 = ist_get () in\n ist_recall (contains r); //recalling that the current heap must contain the given reference\n let h1 = upd h0 r x in\n ist_put h1", "val free (#a: Type0) (b: buffer a)\n : ST unit\n (requires fun h0 -> live h0 b /\\ freeable b)\n (ensures\n (fun h0 _ h1 ->\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free (#a:Type0) (b:buffer a)\n : ST unit\n (requires fun h0 ->\n live h0 b /\\\n freeable b)\n (ensures (fun h0 _ h1 -> \n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\n = B.free b", "val free (#a: Type0) (b: buffer a)\n : ST unit\n (requires fun h0 -> live h0 b /\\ freeable b)\n (ensures\n (fun h0 _ h1 ->\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free (#a:Type0) (b:buffer a)\n : ST unit\n (requires fun h0 ->\n live h0 b /\\\n freeable b)\n (ensures (fun h0 _ h1 -> \n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\n = B.free b", "val upd\n (#a: typ)\n (b: buffer a)\n (n: UInt32.t)\n (z: P.type_of_typ a)\n: HST.Stack unit\n (requires (fun h ->\n live h b /\\\n UInt32.v n < length b\n ))\n (ensures (fun h0 _ h1 ->\n live h1 b /\\\n UInt32.v n < length b /\\\n P.modifies (P.loc_pointer (P.gpointer_of_buffer_cell b n)) h0 h1 /\\\n as_seq h1 b == Seq.upd (as_seq h0 b) (UInt32.v n) z\n ))\nlet upd #a b n z =\n let h0 = HST.get () in\n P.write_buffer b n z;\n let h1 = HST.get () in\n assert (Seq.equal (as_seq h1 b) (Seq.upd (as_seq h0 b) (UInt32.v n) z))", "val upd: #a:Type -> b:buffer a -> n:UInt32.t -> z:a -> Stack unit\n (requires (fun h -> live h b /\\ v n < length b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\ v n < length b\n /\\ modifies_1 b h0 h1\n /\\ as_seq h1 b == Seq.upd (as_seq h0 b) (v n) z ))\nlet upd #a b n z =\n let h0 = HST.get () in\n let s0 = !b.content in\n let s = Seq.upd s0 (v b.idx + v n) z in\n b.content := s;\n lemma_aux b n z h0;\n let h = HST.get() in\n Seq.lemma_eq_intro (as_seq h b) (Seq.slice s (idx b) (idx b + length b));\n Seq.upd_slice s0 (idx b) (idx b + length b) (v n) z", "val write (#a:Type0) (r:ref a) (x:a) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> x == sel r h1)\nlet write r x =\n let _ = elim_vptr r _ in\n write_pt r x;\n intro_vptr r _ x", "val write (#a:Type0) (r:ref a) (x:a) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> x == sel r h1)\nlet write\n r x\n= elim_vptrp r full_perm;\n A.upd r 0sz x;\n intro_vptrp' r full_perm", "val write : #a:Type -> \n r:ref a -> \n\t x:a -> \n\t ImmutableST unit (fun h0 -> sel h0 r == x /\\ h0 `contains` r)\n (fun h0 _ h1 -> h1 == upd h0 r x)\nlet write #a r x =\n let h = ist_get () in\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n ist_put (upd h r x)", "val write : #a:Type -> \n r:ref a -> \n\t x:a -> \n\t AllocST unit (fun h0 -> FStar.Heap.contains h0 r)\n (fun h0 _ h1 -> h1 == FStar.Heap.upd h0 r x)\nlet write #a r x =\n let h = ist_get () in\n ist_put (upd h r x)", "val write : #a:Type -> \n r:ref a -> \n\t x:a -> \n\t ImmutableST unit (fun h0 -> contains r h0 /\\ \n\t sel h0 r == x)\n (fun h0 _ h1 -> h0 == h1)\nlet write #a r x = \n let h = ist_get () in\n ist_put h", "val op_Array_Assignment: #a:typ -> b:buffer a -> n:UInt32.t -> z:P.type_of_typ a -> HST.Stack unit\n (requires (fun h -> live h b /\\ UInt32.v n < length b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\ UInt32.v n < length b\n /\\ P.modifies (P.loc_pointer (P.gpointer_of_buffer_cell b n)) h0 h1\n /\\ as_seq h1 b == Seq.upd (as_seq h0 b) (UInt32.v n) z ))\nlet op_Array_Assignment #a b n z = upd #a b n z", "val write (#a:Type0) (r:ref a) (v:a)\n :ST unit (fun _ -> True) (fun h0 _ h1 -> h0 `contains` r /\\ modifies (only r) h0 h1 /\\ equal_dom h0 h1 /\\ sel h1 r == v)\nlet write #_ r v = write r v", "val write : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t x:a ->\n\t MRefST unit (fun h0 -> contains m h0 /\\\n\t r (sel h0 m) x)\n (fun h0 _ h1 -> contains m h0 /\\\n\t\t\t h1 == upd h0 m x)\nlet write #a #r m x =\n let h0 = ist_get () in\n ist_recall (contains m); //recalling that the current heap must contain the given reference\n let h1 = upd h0 m x in\n ist_put h1", "val free: #a:Type -> ll: t a -> ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.(modifies (footprint h0 ll) h0 h1))\nlet free #_ ll =\n let v = !* ll.v in\n LL1.free #_ #v ll.ptr;\n B.free ll.ptr;\n B.free ll.v", "val write (#a: Type) (#rel: preorder a) (r: mref a rel) (v: a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 ->\n rel (sel h0 r) v /\\ h0 `contains` r /\\ modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\ sel h1 r == v)\nlet write (#a:Type) (#rel:preorder a) (r:mref a rel) (v:a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 -> rel (sel h0 r) v /\\ h0 `contains` r /\\\n modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\\n sel h1 r == v)\n = let h0 = gst_get () in\n gst_recall (contains_pred r);\n let h1 = upd_tot h0 r v in\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n Heap.lemma_upd_equals_upd_tot_for_contained_refs h0 r v;\n gst_put h1", "val write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write_pt r x);\n return ()", "val fill: #t:typ\n -> b:buffer t\n -> z: P.type_of_typ t\n -> len:UInt32.t{UInt32.v len <= length b}\n -> HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\\n P.modifies (P.loc_buffer (gsub b 0ul len)) h0 h1\n /\\ Seq.slice (as_seq h1 b) 0 (UInt32.v len) == Seq.create (UInt32.v len) z\n /\\ Seq.slice (as_seq h1 b) (UInt32.v len) (length b) ==\n Seq.slice (as_seq h0 b) (UInt32.v len) (length b) ))\nlet fill #t b z len =\n let h0 = HST.get () in\n P.fill_buffer b 0ul len z;\n let h1 = HST.get () in\n assert (as_seq h1 (gsub b 0ul len) == Seq.slice (as_seq h1 b) 0 (UInt32.v len));\n assert (let g = gsub b len (UInt32.sub (P.buffer_length b) len) in as_seq h1 g == as_seq h0 g)", "val op_Array_Assignment: #a:Type -> b:buffer a -> n:UInt32.t -> z:a -> Stack unit\n (requires (fun h -> live h b /\\ v n < length b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\ v n < length b\n /\\ modifies_1 b h0 h1\n /\\ as_seq h1 b == Seq.upd (as_seq h0 b) (v n) z ))\nlet op_Array_Assignment #a b n z = upd #a b n z", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write r x);\n return ()", "val live (#a: typ) (h: HS.mem) (b: buffer a) : GTot Type0\nlet live (#a: typ) (h: HS.mem) (b: buffer a) : GTot Type0 = \n P.buffer_readable h b", "val free:\n #a:Type -> vec:vector a ->\n HST.ST unit\n (requires (fun h0 -> live h0 vec /\\ freeable vec))\n (ensures (fun h0 _ h1 -> modifies (loc_addr_of_vector vec) h0 h1))\nlet free #a vec =\n B.free (Vec?.vs vec)", "val write_ref (#a:Type0) (r:R.ref (vec a))\n (i:SZ.t)\n (x:a)\n (#v:erased (vec a))\n (#s:erased (Seq.seq a) { SZ.v i < Seq.length s})\n : stt unit\n (requires R.pts_to r v ** pts_to v s)\n (ensures fun _ -> R.pts_to r v ** pts_to v (Seq.upd s (SZ.v i) x))\nlet write_ref = write_ref'", "val alloc (#a:eqtype) (#b:a -> Type) (#inv:DM.t a (opt b) -> Type) (#r:HST.erid)\n (_:unit{inv (repr empty)})\n : ST (t r a b inv)\n (requires (fun h -> HyperStack.ST.witnessed (region_contains_pred r)))\n (ensures (fun h0 x h1 ->\n ralloc_post r empty h0 x h1))\nlet alloc #a #b #inv #r _ = ralloc r []", "val free: (#a: Type) -> (#n: G.erased (list a)) -> (pl: B.pointer (t a)) ->\n ST unit\n (requires (fun h ->\n let l = B.deref h pl in\n B.live h pl /\\\n well_formed h l n /\\\n invariant h l n /\\\n B.loc_disjoint (B.loc_buffer pl) (footprint h l n)\n ))\n (ensures (fun h0 _ h1 ->\n let l = B.deref h1 pl in\n well_formed h1 l [] /\\\n invariant h1 l [] /\\\n footprint h1 l [] == B.loc_none /\\\n cells h1 l [] == [] /\\\n B.(modifies (footprint h0 (B.deref h0 pl) n `loc_union` loc_buffer pl) h0 h1)))\nlet free #a #n pl =\n free_ #_ #n !*pl;\n pl *= B.null", "val free (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel)\n :HST.ST unit (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures (fun h0 _ h1 -> (not (g_is_null b)) /\\\n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free #_ #_ #_ b = HST.rfree (Buffer?.content b)", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : STGhost unit opened\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> MR.write r x)", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : ST unit\n (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires p v x)\n (ensures fun _ -> True)\n = coerce_steel (fun _ -> MR.write r x)", "val index\n (#a: typ)\n (b: buffer a)\n (n: UInt32.t)\n: HST.Stack (P.type_of_typ a)\n (requires (fun h ->\n UInt32.v n < length b /\\\n live h b\n ))\n (ensures (fun h0 z h1 ->\n UInt32.v n < length b /\\\n h1 == h0 /\\\n z == Seq.index (as_seq h0 b) (UInt32.v n)\n ))\nlet index #a b n =\n P.read_buffer b n", "val pop: #a:Type -> ll: t a -> ST a\n (requires fun h0 ->\n invariant h0 ll /\\\n Cons? (v h0 ll))\n (ensures fun h0 x h1 ->\n let hd :: tl = v h0 ll in\n invariant h1 ll /\\\n B.(modifies (footprint h0 ll) h0 h1) /\\\n // B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\\\n v h1 ll == tl /\\\n cells h1 ll == List.Tot.tl (cells h0 ll) /\\\n x == hd)\nlet pop #a ll =\n let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in\n let v = !* ll.v in\n ll.v *= G.hide (List.Tot.tl v);\n r", "val g2z: #al:Spec.alg -> #m:m_spec -> wv:state_p al m -> a:index_t -> b:index_t ->\n Stack unit\n (requires (fun h -> live h wv /\\ a <> b))\n (ensures (fun h0 _ h1 -> modifies (loc wv) h0 h1\n /\\ state_v h1 wv == Spec.g2z al (state_v h0 wv) (v a) (v b)))\nlet g2z #al #m wv a b =\n let h0 = ST.get() in\n let wv_a = rowi wv a in\n let wv_b = rowi wv b in\n add_row wv_a wv_b;\n let h1 = ST.get() in\n Lib.Sequence.eq_intro (state_v h1 wv) (Spec.g2z al (state_v h0 wv) (v a) (v b))", "val index:\n #ty:buftype\n -> #a:Type0\n -> b:buffer_t ty a\n -> i:size_t{v i < length b} ->\n Stack a\n (requires fun h0 -> live h0 b)\n (ensures fun h0 r h1 ->\n h0 == h1 /\\\n r == get h0 b (size_v i))\nlet index #ty #a b i =\n match ty with\n | IMMUT -> IB.index (b <: ibuffer a) i\n | MUT -> B.index (b <: buffer a) i\n | CONST -> CB.index (b <: cbuffer a) i", "val witness : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t p:predicate heap{stable_on_heap m p} ->\n\t MRefST unit (fun h0 -> p h0)\n\t (fun h0 _ h1 -> h0 == h1 /\\\n\t\t\t ist_witnessed p)\nlet witness #a #r m p =\n ist_witness p", "val precise_write : #a:Type -> \n r:ref a -> \n\t\t x:a -> \n\t\t AllocST unit (fun h0 -> FStar.Heap.contains h0 r)\n (fun h0 _ h1 -> h1 == FStar.Heap.upd h0 r x)\nlet precise_write #a r x =\n let h = ist_get () in\n ist_put (upd h r x)", "val witness_value (#a: Type0) (b: ibuffer a)\n : HST.ST unit\n (requires (fun h0 -> True))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ b `value_is` (Ghost.hide (as_seq h1 b))))\nlet witness_value (#a:Type0) (b:ibuffer a)\n :HST.ST unit (requires (fun h0 -> True))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ b `value_is` (Ghost.hide (as_seq h1 b))))\n = let h = HST.get () in\n let s = Ghost.hide (as_seq h b) in\n witness_p b (seq_eq s)", "val memset: b:bytes -> z:u8 -> len:u32 -> STL unit\n (requires (fun h -> live h b /\\ v len = length b))\n (ensures (fun h0 _ h1 -> \n live h1 b /\\ modifies_1 b h0 h1 /\\\n Seq.equal (as_seq h1 b) (Seq.create (v len) z)))\nlet memset b z len =\n let h0 = ST.get() in\n C.Compat.Loops.for 0ul len (fun h1 i -> live h1 b /\\ modifies_1 b h0 h1 /\\ i <= Buffer.length b /\\\n (forall (j:nat{j < i}).{:pattern Seq.index (as_seq h1 b) j} Seq.index (as_seq h1 b) j == z))\n (fun i -> b.(i) <- z)", "val upd:\n #a:Type0\n -> b:buffer a\n -> i:size_t{v i < length b}\n -> x:a ->\n Stack unit\n (requires fun h0 -> live h0 b)\n (ensures fun h0 _ h1 ->\n modifies1 b h0 h1 /\\\n B.as_seq h1 b == Seq.upd #a (B.as_seq h0 b) (v i) x)\nlet upd #a b i x =\n B.upd b i x", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val createL\n (#a: typ)\n (init:list (P.type_of_typ a))\n: HST.StackInline (buffer a)\n (requires (fun h -> p #a init))\n (ensures (fun (h0: HS.mem) b h1 ->\n let len = FStar.List.Tot.length init in\n len > 0 /\\\n b `unused_in` h0 /\\\n live h1 b /\\\n length b == len /\\\n frameOf b == (HS.get_tip h0) /\\\n P.modifies_0 h0 h1 /\\\n as_seq h1 b == Seq.seq_of_list init /\\\n q #a len b\n ))\nlet createL #a init =\n let len : P.array_length_t = UInt32.uint_to_t (List.Tot.length init) in\n let s = Seq.seq_of_list init in\n let content = P.screate (P.TArray len a) (Some s) in\n P.buffer_of_array_pointer content", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write #opened (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = MHR.write r (U.raise_val x);\n rewrite_slprop\n (MHR.pts_to _ _ _)\n (pts_to r full_perm x)\n (fun _ -> ())", "val write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#opened: _) (#a:Type) (#p:Preorder.preorder a) (#v:a)\n (r:ref a p) (x:a)\n : SteelGhost unit opened (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = let h_old_e = witness_exists #_ #_ #(pts_to_body r full_perm v) () in\n let _ = elim_pure r v h_old_e in\n\n let h_old = read r in\n let h: history a p = extend_history' h_old x in\n write r h_old_e h;\n\n intro_pure_full r x h", "val modifies_1_preserves_livenesses\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_livenesses (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n : GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre). h1 `HS.contains` r' ==> h2 `HS.contains` r'", "val recall: #a:Type\n -> b:buffer a{is_eternal_region (frameOf b) /\\ not (is_mm b.content)} -> Stack unit\n (requires (fun m -> True))\n (ensures (fun m0 _ m1 -> m0 == m1 /\\ live m1 b))\nlet recall #a b = recall b.content", "val rfree (#a: Type) (b: buffer a)\n : HST.ST unit\n (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures\n (fun h0 _ h1 ->\n (not (g_is_null b)) /\\\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet rfree\n (#a: Type)\n (b: buffer a)\n: HST.ST unit\n (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures (fun h0 _ h1 ->\n (not (g_is_null b)) /\\\n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\ \n (HS.get_tip h1) == (HS.get_tip h0) /\\\n modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)\n ))\n= free b", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = let h_old_e = witness_exists #_ #_ #(pts_to_body r full_perm v) () in\n let _ = elim_pure r v h_old_e in\n\n let h_old = read r h_old_e in\n let h: history a p = extend_history' h_old x in\n write r h_old_e h;\n\n intro_pure_full r x h", "val write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\nlet write (#a:Type) (#p:Preorder.preorder a) (#v:erased a)\n (r:ref a p) (x:a)\n : Steel unit (pts_to r full_perm v)\n (fun v -> pts_to r full_perm x)\n (requires fun _ -> p v x /\\ True)\n (ensures fun _ _ _ -> True)\n = MHR.write r (U.raise_val x);\n rewrite_slprop\n (MHR.pts_to _ _ _)\n (pts_to r full_perm x)\n (fun _ -> ())", "val write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write (#a:Type) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, full_perm)) in\n let v_new : fractional a = Some (x, full_perm) in\n rewrite_slprop (pts_to r full_perm v) (RP.pts_to r v_old `star` pure (perm_ok full_perm)) (fun _ -> ());\n\n elim_pure (perm_ok full_perm);\n\n RP.write r v_old v_new;\n rewrite_slprop (RP.pts_to r v_new) (pts_to r full_perm x)\n (fun m -> emp_unit (hp_of (pts_to_raw r full_perm x));\n pure_star_interp (hp_of (pts_to_raw r full_perm x)) (perm_ok full_perm) m)", "val read_write (#a: Type) (r0: reference a) (v0: erased a)\n : SteelT unit ((pts_to r0 full_perm v0) `star` r) (fun _ -> r `star` (pts_to r0 full_perm v0))\nlet read_write (#a:Type) (r0:reference a) (v0:erased a)\n : SteelT unit (pts_to r0 full_perm v0 `star` r)\n (fun _ -> r `star` pts_to r0 full_perm v0)\n = let u0 = rread r0 in\n rwrite_alt r0 v0 u0", "val recall_contents (#a: Type0) (b: ibuffer a) (s: Seq.seq a)\n : HST.ST unit\n (requires (fun h0 -> (recallable b \\/ live h0 b) /\\ witnessed b (cpred s)))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ live h0 b /\\ as_seq h0 b == s))\nlet recall_contents (#a:Type0) (b:ibuffer a) (s:Seq.seq a)\n :HST.ST unit (requires (fun h0 -> (recallable b \\/ live h0 b) /\\ witnessed b (cpred s)))\n (ensures (fun h0 _ h1 -> h0 == h1 /\\ live h0 b /\\ as_seq h0 b == s))\n = recall_p b (cpred s)", "val op_Array_Access: #a:typ -> b:buffer a -> n:UInt32.t -> HST.Stack (P.type_of_typ a)\n (requires (fun h -> UInt32.v n h1 == h0 /\\\n UInt32.v n ll: t a -> ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n invariant h1 ll /\\\n B.(modifies (footprint h0 ll) h0 h1) /\\\n // B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v `loc_union` loc_region_only true ll.spine_rid) h0 h1) /\\\n v h1 ll == [] /\\\n cells h1 ll == [])\nlet clear #a ll =\n let v = !* ll.v in\n LL1.free #_ #v ll.ptr;\n ll.v *= G.hide []", "val write (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (v0:a)\n (v1:a)\n : STGhost unit o\n (pts_to r v0)\n (fun _ -> pts_to r v1)\n (requires frame_preserving pcm v0 v1 /\\ pcm.refine v1)\n (ensures fun _ -> True)\nlet write (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (v0:a)\n (v1:a)\n : STGhost unit o\n (pts_to r v0)\n (fun _ -> pts_to r v1)\n (requires frame_preserving pcm v0 v1 /\\ pcm.refine v1)\n (ensures fun _ -> True)\n = coerce_ghost (fun _ -> G.write r (raise_val v0) (raise_val v1))", "val write_tag\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack unit\n (requires (fun h ->\n valid h tgs p\n ))\n (ensures (fun h0 _ h1 ->\n valid h0 tgs p /\\ valid h1 tgs p\n /\\ P.modifies_1 p h0 h1\n /\\ gread_tag #l h1 tgs p == normalize_term (tag_of_field tgs f)\n /\\ field_matches_tag tgs f (gread_tag h1 tgs p)\n ))\nlet write_tag\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack unit\n (requires (fun h ->\n valid h tgs p\n ))\n (ensures (fun h0 _ h1 ->\n valid h0 tgs p /\\ valid h1 tgs p\n /\\ P.modifies_1 p h0 h1\n /\\ gread_tag h1 tgs p == normalize_term (tag_of_field tgs f)\n /\\ field_matches_tag tgs f (gread_tag h1 tgs p)\n ))\n=\n let tag_ptr = P.field p (tag_field l) in\n let u_ptr : P.pointer (P.TUnion l) = P.field p (union_field l) in\n let t = tag_of_field #l tgs f in\n P.write tag_ptr t;\n P.write_union_field u_ptr f", "val write (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (v0:erased a)\n (v1:a)\n : ST unit\n (pts_to r v0)\n (fun _ -> pts_to r v1)\n (requires frame_preserving pcm v0 v1 /\\ pcm.refine v1)\n (ensures fun _ -> True)\nlet write r v0 v1 = C.coerce_steel (fun _ -> P.write r v0 v1)", "val live (#a: _) (h: mem) (b: buffer a) : GTot Type0\nlet live #a (h:mem) (b:buffer a) : GTot Type0 = HS.contains h b.content", "val read : #a:Type -> \n r:ref a -> \n\t AllocST a (fun h0 -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t contains r h1 /\\ \n\t\t\t\t sel h1 r == x)\nlet read #a r =\n let h = ist_get () in\n ist_recall (contains r); //recalling that the current heap must contain the given reference\n sel h r", "val upd'\n (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (i:U32.t)\n (v:a)\n :HST.Stack unit (requires (fun h -> live h b /\\ U32.v i < length b /\\\n rel (as_seq h b) (Seq.upd (as_seq h b) (U32.v i) v)))\n (ensures (fun h _ h' -> h' == g_upd b (U32.v i) v h))\nlet upd' #_ #_ #_ b i v =\n let open HST in\n let h = get() in\n let Buffer max_length content idx len = b in\n let s0 = !content in\n let sb0 = Seq.slice s0 (U32.v idx) (U32.v max_length) in\n let s_upd = Seq.upd sb0 (U32.v i) v in\n let sf = Seq.replace_subseq s0 (U32.v idx) (U32.v max_length) s_upd in\n assert (sf `Seq.equal`\n Seq.replace_subseq s0 (U32.v idx) (U32.v idx + U32.v len) (Seq.upd (as_seq h b) (U32.v i) v));\n content := sf", "val assignL (#a: _) (l: list a) (b: buffer a)\n : Stack unit\n (requires (fun h0 -> live h0 b /\\ length b = List.Tot.length l))\n (ensures (fun h0 _ h1 -> live h1 b /\\ modifies_1 b h0 h1 /\\ as_seq h1 b == Seq.seq_of_list l))\nlet rec assignL #a (l: list a) (b: buffer a): Stack unit\n (requires (fun h0 ->\n live h0 b /\\\n length b = List.Tot.length l))\n (ensures (fun h0 _ h1 ->\n live h1 b /\\\n modifies_1 b h0 h1 /\\\n as_seq h1 b == Seq.seq_of_list l))\n= lemma_seq_of_list_induction l;\n match l with\n | [] -> ()\n | hd :: tl ->\n let b_hd = sub b 0ul 1ul in\n let b_tl = offset b 1ul in\n b_hd.(0ul) <- hd;\n assignL tl b_tl;\n let h = HST.get () in\n assert (get h b_hd 0 == hd);\n assert (as_seq h b_tl == Seq.seq_of_list tl);\n assert (Seq.equal (as_seq h b) (Seq.append (as_seq h b_hd) (as_seq h b_tl)));\n assert (Seq.equal (as_seq h b) (Seq.seq_of_list l))", "val create\n (#a:typ)\n (init: P.type_of_typ a)\n (len:UInt32.t)\n: HST.StackInline (buffer a)\n (requires (fun h ->\n UInt32.v len > 0\n ))\n (ensures (fun (h0: HS.mem) b h1 ->\n UInt32.v len > 0 /\\\n b `unused_in` h0 /\\\n live h1 b /\\\n length b == UInt32.v len /\\\n frameOf b == (HS.get_tip h0) /\\\n P.modifies_0 h0 h1 /\\\n as_seq h1 b == Seq.create (UInt32.v len) init\n ))\nlet create #a init len =\n let len : P.array_length_t = len in\n let content = P.screate (P.TArray len a) (Some (Seq.create (UInt32.v len) init)) in\n P.buffer_of_array_pointer content", "val modifies_2 (#a #a': Type) (b: buffer a) (b': buffer a') (h0 h1: mem) : Type0\nlet modifies_2 (#a:Type) (#a':Type) (b:buffer a) (b':buffer a') (h0 h1:mem) :Type0 =\n HS.get_tip h0 == HS.get_tip h1 /\\\n (let rid = frameOf b in let rid' = frameOf b' in\n ((rid == rid' /\\ modifies_buf_2 rid b b' h0 h1 /\\ modifies_one rid h0 h1)\n \\/ (rid =!= rid' /\\ HS.modifies (Set.union (Set.singleton rid) (Set.singleton rid')) h0 h1\n /\\ modifies_buf_1 rid b h0 h1 /\\ modifies_buf_1 rid' b' h0 h1 )))", "val write_pt (#a:Type0) (#v:erased a) (r:ref a) (x:a)\n : SteelT unit (pts_to r full_perm v) (fun _ -> pts_to r full_perm x)\nlet write_pt #a #v r x =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r full_perm v) (H.pts_to r full_perm v') (fun _ -> ());\n let x' = U.raise_val x in\n H.write r x';\n rewrite_slprop (H.pts_to r full_perm (hide x')) (pts_to r full_perm x) (fun _ -> ())", "val extend\n (#a:eqtype)\n (#b:a -> Type)\n (#inv:DM.t a (opt b) -> Type)\n (#r:HST.erid)\n (t:t r a b inv)\n (x:a)\n (y:b x)\n : Stack unit\n (requires (fun h ->\n ~(defined t x h) /\\\n inv (repr (upd (HS.sel h t) x y))))\n (ensures (fun h0 u h1 ->\n let cur = HS.sel h0 t in\n HS.contains h1 t /\\\n HS.modifies (Set.singleton r) h0 h1 /\\\n HS.modifies_ref r (Set.singleton (HS.as_addr t)) h0 h1 /\\\n HS.sel h1 t == upd cur x y /\\\n witnessed (contains t x y)))\nlet extend #a #b #inv #r t x y =\n recall t;\n let cur = !t in\n t := upd cur x y;\n mr_witness t (contains t x y)", "val read : #a:Type -> \n r:ref a -> \n\t AllocST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t x == FStar.Heap.sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val free (#t_k: eqtype)\n (#t_v: Type0)\n (ll: t t_k t_v):\n ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.modifies (region_of ll) h0 h1)\nlet free #_ #_ ll =\n LL2.free ll", "val modifies_1 (#a: Type) (b: buffer a) (h0 h1: mem) : Type0\nlet modifies_1 (#a:Type) (b:buffer a) (h0 h1:mem) :Type0 =\n let rid = frameOf b in\n modifies_one rid h0 h1 /\\ modifies_buf_1 rid b h0 h1 /\\ HS.get_tip h0 == HS.get_tip h1", "val push: #a:Type -> ll: t a -> x: a -> ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n invariant h1 ll /\\\n // Coarse modifies clause\n B.(modifies (footprint h0 ll) h0 h1) /\\\n // Functional spec\n v h1 ll == x :: v h0 ll /\\\n // Precise effect on memory, ignore if you're content with reasoning via the\n // footprint (which is known to be always included in the region).\n Cons? (cells h1 ll) /\\ List.Tot.tl (cells h1 ll) == cells h0 ll /\\\n B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 ll))) h0 h1)\nlet push #a ll x =\n LL1.push ll.spine_rid (!* ll.v) ll.ptr x;\n let v = !* ll.v in\n ll.v *= G.hide (x :: v)", "val create: #a:Type -> init:a -> len:UInt32.t -> StackInline (buffer a)\n (requires (fun h -> True))\n (ensures (fun (h0:mem) b h1 -> b `unused_in` h0\n /\\ live h1 b /\\ idx b == 0 /\\ length b == v len\n /\\ frameOf b == HS.get_tip h0\n /\\ Map.domain (HS.get_hmap h1) == Map.domain (HS.get_hmap h0)\n /\\ modifies_0 h0 h1\n /\\ as_seq h1 b == Seq.create (v len) init))\nlet create #a init len =\n let content: reference (lseq a (v len)) =\n salloc (Seq.create (v len) init) in\n let b = MkBuffer len content 0ul len in\n let h = HST.get() in\n assert (Seq.equal (as_seq h b) (sel h b));\n b", "val upd (#a: Type0) (#rrel #rel: srel a) (b: mbuffer a rrel rel) (i: U32.t) (v: a)\n : HST.Stack unit\n (requires\n (fun h ->\n live h b /\\ U32.v i < length b /\\ rel (as_seq h b) (Seq.upd (as_seq h b) (U32.v i) v)))\n (ensures\n (fun h _ h' ->\n (not (g_is_null b)) /\\ modifies (loc_buffer b) h h' /\\ live h' b /\\\n as_seq h' b == Seq.upd (as_seq h b) (U32.v i) v))\nlet upd\n (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n (i:U32.t)\n (v:a)\n : HST.Stack unit (requires (fun h -> live h b /\\ U32.v i < length b /\\\n rel (as_seq h b) (Seq.upd (as_seq h b) (U32.v i) v)))\n (ensures (fun h _ h' -> (not (g_is_null b)) /\\\n modifies (loc_buffer b) h h' /\\\n live h' b /\\\n as_seq h' b == Seq.upd (as_seq h b) (U32.v i) v))\n = let h = HST.get () in\n upd' b i v;\n g_upd_seq_as_seq b (Seq.upd (as_seq h b) (U32.v i) v) h", "val recall : #a:Type -> \n r:ref a -> \n\t AllocST unit (fun h0 -> True) \n (fun h0 _ h1 -> h0 == h1 /\\ \n\t\t\t contains r h1)\nlet recall #a r = \n ist_recall (contains r)", "val recall : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t p:predicate heap{stable_on_heap m p} ->\n\t MRefST unit (fun h0 -> ist_witnessed p)\n\t (fun h0 _ h1 -> h0 == h1 /\\\n\t\t\t p h1)\nlet recall #a #r m p =\n ist_recall p", "val assign:\n #a:Type -> vec:vector a ->\n i:uint32_t -> v:a ->\n HST.ST unit\n (requires (fun h0 -> live h0 vec /\\ i < size_of vec))\n (ensures (fun h0 _ h1 ->\n hmap_dom_eq h0 h1 /\\\n modifies (loc_vector_within #a vec i (i + 1ul)) h0 h1 /\\\n get h1 vec i == v /\\\n S.equal (as_seq h1 vec) (S.upd (as_seq h0 vec) (U32.v i) v) /\\\n live h1 vec))\nlet assign #a vec i v =\n let hh0 = HST.get () in\n // NOTE: `B.upd (Vec?.vs vec) i v` makes more sense,\n // but the `modifies` postcondition is coarse-grained.\n B.upd (B.sub (Vec?.vs vec) i 1ul) 0ul v;\n let hh1 = HST.get () in\n loc_vector_within_disjoint vec 0ul i i (i + 1ul);\n modifies_as_seq_within\n vec 0ul i (loc_vector_within #a vec i (i + 1ul)) hh0 hh1;\n loc_vector_within_disjoint vec i (i + 1ul) (i + 1ul) (size_of vec);\n modifies_as_seq_within\n vec (i + 1ul) (size_of vec) (loc_vector_within #a vec i (i + 1ul)) hh0 hh1;\n slice_append (as_seq hh1 vec) 0 (U32.v i) (U32.v i + 1);\n slice_append (as_seq hh1 vec) 0 (U32.v i + 1) (U32.v (size_of vec));\n slice_append (S.upd (as_seq hh0 vec) (U32.v i) v) 0 (U32.v i) (U32.v i + 1);\n slice_append (S.upd (as_seq hh0 vec) (U32.v i) v) 0 (U32.v i + 1) (U32.v (size_of vec))", "val read (#a: Type0) (r: ref a)\n : Steel a\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\nlet read (#a:Type0) (r:ref a) : Steel a\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\n= readp r full_perm", "val read (#a: Type0) (r: ref a)\n : Steel a\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\nlet read (#a:Type0) (r:ref a) : Steel a\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\n= readp r full_perm", "val free:\n #a:Type0 -> #rst:Type -> #rg:regional rst a -> rv:rvector rg ->\n HST.ST unit\n (requires (fun h0 -> rv_inv h0 rv))\n (ensures (fun h0 _ h1 -> modifies (loc_rvector rv) h0 h1))\nlet free #a #rst #rg rv =\n let hh0 = HST.get () in\n (if V.size_of rv = 0ul then ()\n else free_elems rv (V.size_of rv - 1ul));\n let hh1 = HST.get () in\n rv_loc_elems_included hh0 rv 0ul (V.size_of rv);\n V.free rv", "val rfree (#a: Type) (b: buffer a)\n : ST unit\n (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures\n (fun h0 _ h1 ->\n is_mm (content b) /\\ is_eternal_region (frameOf b) /\\ h1 == HS.free (content b) h0))\nlet rfree (#a:Type) (b:buffer a)\n :ST unit (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures (fun h0 _ h1 -> is_mm (content b) /\\ is_eternal_region (frameOf b) /\\ h1 == HS.free (content b) h0))\n = rfree b.content", "val uupd (#a: Type0) (b: ubuffer a) (i: U32.t) (v: a)\n : HST.Stack unit\n (requires (fun h0 -> live h0 b /\\ U32.v i < length b))\n (ensures\n (fun h0 _ h1 ->\n modifies (loc_buffer b) h0 h1 /\\ live h1 b /\\\n as_seq h1 b == Seq.upd (as_seq h0 b) (U32.v i) (Some v) /\\ b `initialized_at` (U32.v i))\n )\nlet uupd (#a:Type0) (b:ubuffer a) (i:U32.t) (v:a)\n :HST.Stack unit (requires (fun h0 -> live h0 b /\\ U32.v i < length b))\n (ensures (fun h0 _ h1 -> modifies (loc_buffer b) h0 h1 /\\\n\t\t\t\t\t live h1 b /\\\n\t\t\t\t\t as_seq h1 b == Seq.upd (as_seq h0 b) (U32.v i) (Some v) /\\\n\t\t\t\t\t b `initialized_at` (U32.v i)))\n = upd b i (Some v);\n witness_p b (ipred (U32.v i))", "val modifies_1 (#t: typ) (p: pointer t) (h0 h1: HS.mem) : GTot Type0\nlet modifies_1 (#t: typ) (p: pointer t) (h0 h1: HS.mem) : GTot Type0 =\n modifies (loc_pointer p) h0 h1", "val live (#a:Type0) (#rrel #rel:srel a) (h:HS.mem) (b:mbuffer a rrel rel) :GTot Type0\nlet live #_ #rrel #rel h b =\n match b with\n | Null -> True\n | Buffer max_length content idx length ->\n h `HS.contains` content /\\\n buffer_compatible b", "val modifies_1_preserves_mreferences\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_mreferences (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre).\n ((frameOf b <> HS.frameOf r' \\/ as_addr b <> HS.as_addr r') /\\ h1 `HS.contains` r') ==>\n (h2 `HS.contains` r' /\\ HS.sel h1 r' == HS.sel h2 r')", "val lemma_aux_1 (#a: Type) (b: buffer a) (n: UInt32.t{v n < length b}) (z: a) (h0: mem) (tt: Type)\n : Lemma (requires (live h0 b))\n (ensures\n (live h0 b /\\\n (forall (bb: buffer tt).\n (live h0 bb /\\ disjoint b bb) ==>\n (let h1 = HS.upd h0 b.content (Seq.upd (sel h0 b) (idx b + v n) z) in\n as_seq h0 bb == as_seq h1 bb))))\nlet lemma_aux_1\n (#a:Type) (b:buffer a) (n:UInt32.t{v n < length b}) (z:a) (h0:mem) (tt:Type)\n :Lemma (requires (live h0 b))\n (ensures (live h0 b /\\\n\t (forall (bb:buffer tt). (live h0 bb /\\ disjoint b bb) ==>\n\t\t (let h1 = HS.upd h0 b.content (Seq.upd (sel h0 b) (idx b + v n) z) in\n\t\t as_seq h0 bb == as_seq h1 bb))))\n = let open FStar.Classical in\n forall_intro (move_requires (lemma_aux_0 b n z h0 tt))", "val read : #a:Type -> \n r:ref a -> \n\t ImmutableST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t\t\t\t x == sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val w (m: block_t) (b: w_t)\n : HST.Stack unit\n (requires (fun h -> B.live h m /\\ B.live h b /\\ B.disjoint m b))\n (ensures\n (fun h _ h' ->\n B.modifies (B.loc_buffer b) h h' /\\\n w_inv (Lib.ByteSequence.uints_from_bytes_be #U32\n #SEC\n #(block_word_length SHA1)\n (B.as_seq h m))\n b\n h'))\nlet w (m: block_t) (b: w_t) : HST.Stack unit\n (requires (fun h -> B.live h m /\\ B.live h b /\\ B.disjoint m b))\n (ensures (fun h _ h' -> B.modifies (B.loc_buffer b) h h' /\\ w_inv\n\t\t (Lib.ByteSequence.uints_from_bytes_be #U32 #SEC #(block_word_length SHA1) (B.as_seq h m)) b h'))\n= let h = HST.get () in\n C.Loops.for 0ul 80ul (w_loop_inv h m b) (fun i -> w_body h m b i)", "val witness: p:(heap -> Type){ST.stable p} ->\n ST unit\n (requires (fun h0 -> p h0))\n (ensures (fun h0 _ h1 -> h0==h1 /\\ witnessed p))\nlet witness p = gst_witness p", "val push: (#a: Type) -> (r: HS.rid) -> (n: G.erased (list a)) -> (pl: B.pointer (t a)) -> (x: a) ->\n ST unit\n (requires (fun h ->\n let l = B.deref h pl in\n B.live h pl /\\\n well_formed h l n /\\\n invariant h l n /\\\n ST.is_eternal_region r /\\\n B.(loc_includes (loc_region_only true r) (footprint h l n)) /\\\n B.(loc_disjoint (loc_buffer pl) (loc_region_only true r))\n ))\n (ensures (fun h0 _ h1 ->\n let n' = G.hide (x :: G.reveal n) in\n let l = B.deref h1 pl in\n // Style note: I don't repeat ``B.live pl`` in the post-condition since\n // ``B.modifies (loc_buffer pl) h0 h1`` implies that ``B.live h1 pl``.\n B.modifies (B.loc_buffer pl) h0 h1 /\\\n well_formed h1 l n' /\\\n invariant h1 l n' /\\\n B.(loc_includes (loc_region_only true r) (footprint h1 l n') /\\\n Cons? (cells h1 l n') /\\ List.Tot.tail (cells h1 l n') == cells h0 (B.deref h0 pl) n /\\\n B.fresh_loc (B.loc_addr_of_buffer (List.Tot.hd (cells h1 l n'))) h0 h1)\n ))\nlet push #a r n pl x =\n (**) let h0 = ST.get () in\n let l = !* pl in\n let c = { data = x; next = l } in\n\n let pc: B.pointer (cell a) = B.malloc r c 1ul in\n (**) let h1 = ST.get () in\n (**) B.(modifies_only_not_unused_in loc_none h0 h1);\n (**) assert B.(loc_disjoint (loc_buffer pc) (footprint h0 l n));\n\n pl *= pc;\n (**) let h2 = ST.get () in\n (**) let n' = G.hide (x :: G.reveal n) in\n (**) B.(modifies_trans loc_none h0 h1 (loc_buffer pl) h2);\n (**) assert (well_formed h2 (B.deref h2 pl) n');\n (**) assert (invariant h2 (B.deref h2 pl) n');\n (**) assert ((B.deref h2 (B.deref h2 pl)).next == l);\n\n ()", "val modifies_3 (#a #a' #a'': Type) (b: buffer a) (b': buffer a') (b'': buffer a'') (h0 h1: mem)\n : Type0\nlet modifies_3 (#a:Type) (#a':Type) (#a'':Type) (b:buffer a) (b':buffer a') (b'':buffer a'') (h0 h1:mem) :Type0 =\n HS.get_tip h0 == HS.get_tip h1 /\\\n (let rid = frameOf b in let rid' = frameOf b' in let rid'' = frameOf b'' in\n ((rid == rid' /\\ rid' == rid'' /\\ modifies_buf_3 rid b b' b'' h0 h1 /\\ modifies_one rid h0 h1)\n \\/ (rid == rid' /\\ rid' =!= rid'' /\\ modifies_buf_2 rid b b' h0 h1 /\\ modifies_buf_1 rid'' b'' h0 h1\n /\\ HS.modifies (Set.union (Set.singleton rid) (Set.singleton rid'')) h0 h1 )\n \\/ (rid =!= rid' /\\ rid' == rid'' /\\ modifies_buf_2 rid' b' b'' h0 h1 /\\ modifies_buf_1 rid b h0 h1\n /\\ HS.modifies (Set.union (Set.singleton rid) (Set.singleton rid'')) h0 h1 )\n \\/ (rid == rid'' /\\ rid' =!= rid'' /\\ modifies_buf_2 rid b b'' h0 h1 /\\ modifies_buf_1 rid' b' h0 h1\n /\\ HS.modifies (Set.union (Set.singleton rid) (Set.singleton rid')) h0 h1 )\n \\/ (rid =!= rid' /\\ rid' =!= rid'' /\\ rid =!= rid''\n /\\ HS.modifies (Set.union (Set.union (Set.singleton rid) (Set.singleton rid')) (Set.singleton rid'')) h0 h1\n /\\ modifies_buf_1 rid b h0 h1 /\\ modifies_buf_1 rid' b' h0 h1 /\\ modifies_buf_1 rid'' b'' h0 h1)))", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val lemma_aux: #a:Type -> b:buffer a -> n:UInt32.t{v n < length b} -> z:a\n -> h0:mem -> Lemma\n (requires (live h0 b))\n (ensures (live h0 b\n /\\ modifies_1 b h0 (HS.upd h0 b.content (Seq.upd (sel h0 b) (idx b + v n) z)) ))\n [SMTPat (HS.upd h0 b.content (Seq.upd (sel h0 b) (idx b + v n) z))]\nlet lemma_aux #a b n z h0 = lemma_aux_2 b n z h0", "val modifies_2_1 (#a: Type) (b: buffer a) (h0 h1: mem) : Type0\nlet modifies_2_1 (#a:Type) (b:buffer a) (h0 h1:mem) :Type0 =\n HS.get_tip h0 == HS.get_tip h1 /\\\n (let rid = frameOf b in\n ((rid == HS.get_tip h0 /\\ modifies_buf_1 rid b h0 h1 /\\ modifies_one rid h0 h1)\n \\/ (rid =!= HS.get_tip h0 /\\ HS.modifies (Set.union (Set.singleton rid) (Set.singleton (HS.get_tip h0))) h0 h1\n /\\ modifies_buf_1 rid b h0 h1 /\\ modifies_buf_0 (HS.get_tip h0) h0 h1 )))", "val lbuffer_or_unit_alloca (#a : Type0) (#len : size_t{size_v len > 0}) (#b : bool)\n (zero : a) :\n StackInline (type_or_unit (lbuffer a len) b)\n (requires (fun _ -> True))\n (ensures (fun h0 p h1 ->\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (lbuffer_or_unit_to_loc p) h0 h1 /\\\n B.(loc_includes (loc_region_only true (HS.get_tip h1)) (lbuffer_or_unit_to_loc p)) /\\\n B.live h1 (lbuffer_or_unit_to_buffer p)))\nlet lbuffer_or_unit_alloca #a #len #b zero =\n if b then B.alloca zero len else ()", "val fill: #t:Type\n -> b:buffer t\n -> z:t\n -> len:UInt32.t{v len <= length b}\n -> Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b /\\ modifies_1 b h0 h1\n /\\ Seq.slice (as_seq h1 b) 0 (v len) == Seq.create (v len) z\n /\\ Seq.slice (as_seq h1 b) (v len) (length b) ==\n Seq.slice (as_seq h0 b) (v len) (length b) ))\nlet rec fill #t b z len =\n let h0 = HST.get () in\n if len =^ 0ul then ()\n else\n begin\n let len' = len -^ 1ul in\n fill #t b z len';\n b.(len') <- z;\n let h = HST.get() in\n Seq.snoc_slice_index (as_seq h b) 0 (v len');\n Seq.lemma_tail_slice (as_seq h b) (v len') (length b)\n end;\n let h1 = HST.get() in\n Seq.lemma_eq_intro (Seq.slice (as_seq h1 b) 0 (v len)) (Seq.create (v len) z)", "val offset (#a: typ) (b: buffer a) (i: UInt32.t)\n : HST.Stack (buffer a)\n (requires (fun h0 -> live h0 b /\\ UInt32.v i <= length b))\n (ensures (fun h0 b' h1 -> h1 == h0 /\\ UInt32.v i <= length b /\\ b' == goffset b i))\nlet offset\n (#a:typ) \n (b:buffer a)\n (i:UInt32.t)\n: HST.Stack (buffer a)\n (requires (fun h0 ->\n live h0 b /\\\n UInt32.v i <= length b\n ))\n (ensures (fun h0 b' h1 ->\n h1 == h0 /\\\n UInt32.v i <= length b /\\\n b' == goffset b i\n ))\n= P.offset_buffer b i", "val liveness_preservation_intro (#a:Type0) (#rrel:srel a) (#rel:srel a)\n (h h':HS.mem) (b:mbuffer a rrel rel)\n (f: (\n (t':Type0) ->\n (pre: Preorder.preorder t') ->\n (r: HS.mreference t' pre) ->\n Lemma\n (requires (HS.frameOf r == frameOf b /\\ HS.as_addr r == as_addr b /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\n ))\n :Lemma (requires (live h b)) (ensures (live h' b))\nlet liveness_preservation_intro #_ #_ #_ _ _ b f =\n if Null? b\n then ()\n else f _ _ (Buffer?.content b)", "val ex1'' (#a: Type) (b: New.buffer nat {New.length b > 0}) (b1: New.buffer a)\n : HST.ST unit\n (requires\n (fun h ->\n New.live h b /\\ NewM.loc_disjoint (NewM.loc_buffer b) (NewM.loc_buffer b1) /\\\n New.live h b1))\n (ensures\n (fun h0 _ h1 ->\n New.get h1 b 0 == 0 /\\ Old.get h1 (new_to_old_ghost b) 0 == 0 /\\\n New.as_seq h0 b1 == New.as_seq h1 b1 /\\ NewM.modifies (NewM.loc_buffer b) h0 h1 /\\\n OldM.modifies (OldM.loc_buffer (new_to_old_ghost b)) h0 h1 /\\\n Old.modifies_1 (new_to_old_ghost b) h0 h1))\nlet ex1'' (#a:Type) (b:New.buffer nat{New.length b > 0}) (b1:New.buffer a)\n : HST.ST unit\n (requires (fun h -> New.live h b /\\ NewM.loc_disjoint (NewM.loc_buffer b) (NewM.loc_buffer b1) /\\ New.live h b1))\n (ensures (fun h0 _ h1 ->\n New.get h1 b 0 == 0 /\\\n Old.get h1 (new_to_old_ghost b) 0 == 0 /\\\n New.as_seq h0 b1 == New.as_seq h1 b1 /\\\n NewM.modifies (NewM.loc_buffer b) h0 h1 /\\\n OldM.modifies (OldM.loc_buffer (new_to_old_ghost b)) h0 h1 /\\\n Old.modifies_1 (new_to_old_ghost b) h0 h1)) =\n let old = new_to_old_st b in\n let old1 = new_to_old_st b1 in\n ex1' old old1", "val alloc (#a:Type0) (init:a)\n :ST (ref a)\n (fun _ -> True)\n (fun h0 r h1 -> fresh r h0 h1 /\\ modifies Set.empty h0 h1 /\\ sel h1 r == init)\nlet alloc #_ init = alloc init", "val extend\n (#r: rid)\n (#a: eqtype)\n (#b: (a -> Type))\n (#inv: (map' a b -> Type0))\n (m: t r a b inv)\n (x: a)\n (y: b x)\n : ST unit\n (requires\n (fun h ->\n let cur = HS.sel h m in\n inv (upd cur x y) /\\ sel cur x == None))\n (ensures\n (fun h0 u h1 ->\n let cur = HS.sel h0 m in\n let hsref = m in\n HS.contains h1 m /\\ modifies (Set.singleton r) h0 h1 /\\\n modifies_ref r (Set.singleton (HS.as_addr hsref)) h0 h1 /\\ HS.sel h1 m == upd cur x y /\\\n HST.witnessed (defined m x) /\\ HST.witnessed (contains m x y)))\nlet extend (#r:rid) (#a:eqtype) (#b:a -> Type) (#inv:(map' a b -> Type0)) (m:t r a b inv) (x:a) (y:b x)\n : ST unit\n (requires (fun h -> let cur = HS.sel h m in inv (upd cur x y) /\\ sel cur x == None))\n (ensures (fun h0 u h1 ->\n let cur = HS.sel h0 m in\n let hsref = m in\n HS.contains h1 m\n /\\ modifies (Set.singleton r) h0 h1\n /\\ modifies_ref r (Set.singleton (HS.as_addr hsref)) h0 h1\n /\\ HS.sel h1 m == upd cur x y\n /\\ HST.witnessed (defined m x)\n /\\ HST.witnessed (contains m x y)))\n = recall m;\n reveal_opaque (`%grows) (grows #a #b #inv);\n let cur = !m in\n m := upd cur x y;\n contains_stable m x y;\n mr_witness m (defined m x);\n mr_witness m (contains m x y)", "val footprint: #a:Type -> h:HS.mem -> ll: t a -> Ghost B.loc\n (requires invariant h ll)\n (ensures fun _ -> True)\nlet footprint #a h ll =\n let head = B.deref h ll.ptr in\n let v = B.deref h ll.v in\n B.(loc_addr_of_buffer ll.ptr `loc_union` loc_addr_of_buffer ll.v `loc_union` LL1.footprint h head v)", "val alloc : #a:Type -> \n x:a -> \n\t AllocST (ref a) (fun _ -> True)\n (fun h0 r h1 -> ~(contains r h0) /\\ \n\t\t\t\t\t fst (alloc_ref h0 a x) == r /\\ \n\t\t\t\t\t snd (alloc_ref h0 a x) == h1)\nlet alloc #a x = \n let h0 = ist_get () in\n let rh1 = alloc_ref h0 a x in \n ist_put (snd rh1); \n ist_witness (contains (fst rh1)); //witnessing that the current heap contains the generated reference\n fst rh1", "val ex1 (#a: Type) (b: New.buffer nat {New.length b > 0}) (b1: New.buffer a)\n : HST.ST unit\n (requires (fun h -> New.live h b /\\ New.disjoint b b1 /\\ New.live h b1))\n (ensures\n (fun h0 _ h1 ->\n New.get h1 b 0 == 0 /\\ Old.get h1 (new_to_old_ghost b) 0 == 0 /\\\n New.as_seq h0 b1 == New.as_seq h1 b1 /\\ NewM.modifies (NewM.loc_buffer b) h0 h1 /\\\n OldM.modifies (OldM.loc_buffer (new_to_old_ghost b)) h0 h1 /\\\n Old.modifies_1 (new_to_old_ghost b) h0 h1))\nlet ex1 (#a:Type) (b:New.buffer nat{New.length b > 0}) (b1:New.buffer a)\n : HST.ST unit\n (requires (fun h -> New.live h b /\\ New.disjoint b b1 /\\ New.live h b1))\n (ensures (fun h0 _ h1 ->\n New.get h1 b 0 == 0 /\\\n Old.get h1 (new_to_old_ghost b) 0 == 0 /\\\n New.as_seq h0 b1 == New.as_seq h1 b1 /\\\n NewM.modifies (NewM.loc_buffer b) h0 h1 /\\\n OldM.modifies (OldM.loc_buffer (new_to_old_ghost b)) h0 h1 /\\\n Old.modifies_1 (new_to_old_ghost b) h0 h1)) =\n let old = new_to_old_st b in\n Old.upd old 0ul 0", "val write_at_end (#a: Type) (#i: rid) (r: m_rref i (seq a) grows) (x: a)\n : ST unit\n (requires (fun h -> True))\n (ensures\n (fun h0 _ h1 ->\n contains h1 r /\\ modifies_one i h0 h1 /\\\n modifies_ref i (Set.singleton (HS.as_addr r)) h0 h1 /\\\n HS.sel h1 r == Seq.snoc (HS.sel h0 r) x /\\\n witnessed (at_least (Seq.length (HS.sel h0 r)) x r)))\nlet write_at_end (#a:Type) (#i:rid) (r:m_rref i (seq a) grows) (x:a)\n : ST unit\n (requires (fun h -> True))\n (ensures (fun h0 _ h1 ->\n\t contains h1 r\n\t\t /\\ modifies_one i h0 h1\n\t\t /\\ modifies_ref i (Set.singleton (HS.as_addr r)) h0 h1\n\t\t /\\ HS.sel h1 r == Seq.snoc (HS.sel h0 r) x\n\t\t /\\ witnessed (at_least (Seq.length (HS.sel h0 r)) x r)))\n =\n recall r;\n let s0 = !r in\n let n = Seq.length s0 in\n r := Seq.snoc s0 x;\n at_least_is_stable n x r;\n Seq.contains_snoc s0 x;\n mr_witness r (at_least n x r)" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.write" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.write" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.free" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.free" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.upd" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.upd" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.write" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.write" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.write" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.write" }, { "project_name": "FStar", "file_name": "ImmutableST.fst", "name": "ImmutableST.write" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.op_Array_Assignment" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.write" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.write" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.free" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.write" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.write" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.fill" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.op_Array_Assignment" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.write" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.live" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.free" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.write_ref" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fst", "name": "FStar.Monotonic.DependentMap.alloc" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.free" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.free" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.write" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.index" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.pop" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Blake2.Generic.fst", "name": "Hacl.Impl.Blake2.Generic.g2z" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.index" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.witness" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.precise_write" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.witness_value" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Buffer.Utils.fst", "name": "MiTLS.Buffer.Utils.memset" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.upd" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.createL" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.write" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_livenesses" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.recall" }, { "project_name": "FStar", "file_name": "LowStar.BufferCompat.fst", "name": "LowStar.BufferCompat.rfree" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.write" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.write" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.read_write" }, { "project_name": "FStar", "file_name": "LowStar.ImmutableBuffer.fst", "name": "LowStar.ImmutableBuffer.recall_contents" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.op_Array_Access" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.clear" }, { "project_name": "steel", "file_name": "Steel.ST.GhostPCMReference.fst", "name": "Steel.ST.GhostPCMReference.write" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.write_tag" }, { "project_name": "steel", "file_name": "Steel.ST.PCMReference.fst", "name": "Steel.ST.PCMReference.write" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.live" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.read" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.upd'" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.assignL" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.create" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_2" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.write_pt" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fst", "name": "FStar.Monotonic.DependentMap.extend" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.read" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.free" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_1" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.push" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.create" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.upd" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.recall" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.recall" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.assign" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.read" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fsti", "name": "Steel.ArrayRef.read" }, { "project_name": "FStar", "file_name": "LowStar.RVector.fst", "name": "LowStar.RVector.free" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.rfree" }, { "project_name": "FStar", "file_name": "LowStar.UninitializedBuffer.fst", "name": "LowStar.UninitializedBuffer.uupd" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.modifies_1" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.live" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_mreferences" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.lemma_aux_1" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.read" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Core.SHA1.fst", "name": "Hacl.Hash.Core.SHA1.w" }, { "project_name": "FStar", "file_name": "FStar.MRef.fst", "name": "FStar.MRef.witness" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.push" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_3" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.lemma_aux" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_2_1" }, { "project_name": "noise-star", "file_name": "Impl.Noise.TypeOrUnit.fst", "name": "Impl.Noise.TypeOrUnit.lbuffer_or_unit_alloca" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.fill" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.offset" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.liveness_preservation_intro" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.ex1''" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.alloc" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Map.fst", "name": "FStar.Monotonic.Map.extend" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.footprint" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.alloc" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.ex1" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Seq.fst", "name": "FStar.Monotonic.Seq.write_at_end" } ], "selected_premises": [ "FStar.Pointer.Base.loc_none", "FStar.Pointer.Base.loc", "FStar.Pointer.Base.cls", "FStar.Pointer.Base.loc_union", "FStar.UInt.size", "FStar.Pointer.Base.npointer", "FStar.Pointer.Base.otype_of_typ", "FStar.Pointer.Base.loc_disjoint", "FStar.Pointer.Base.singleton_buffer_of_pointer", "FStar.Pointer.Base.loc_includes", "FStar.Pointer.Base.aloc", "FStar.Pointer.Base.loc_pointer", "FStar.Pointer.Base.loc_buffer", "FStar.Pointer.Base.modifies_buffer_elim'", "FStar.Pointer.Base.modifies", "FStar.Pointer.Base.path_sel_none_ovalue", "FStar.Pointer.Base.step_typ_depth", "FStar.Pointer.Base.as_addr", "FStar.Pointer.Base.loc_regions", "FStar.Pointer.Base.loc_includes_trans", "FStar.Mul.op_Star", "FStar.Pointer.Base.read", "FStar.Pointer.Base.readable_struct_fields_readable_struct", "FStar.Pointer.Base.step_upd", "FStar.Pointer.Base.path_sel", "FStar.Pointer.Base.path_typ_depth", "FStar.Pointer.Base.ovalue_of_value", "FStar.Pointer.Base.ovalue_is_readable_ovalue_of_value", "FStar.Pointer.Base.buffer_as_seq", "FStar.Pointer.Base.buffer", "FStar.Pointer.Base.loc_aux_disjoint_sym", "FStar.Pointer.Base.none_ovalue", "FStar.Pointer.Base.loc_disjoint_includes", "FStar.Pointer.Base.g_is_null", "FStar.Pointer.Base.readable_struct_fields", "FStar.Pointer.Base.path_length", "FStar.Pointer.Base.buffer_root_length", "FStar.Pointer.Base.struct_sel", "FStar.Pointer.Base.dummy_val", "FStar.Pointer.Base.loc_disjoint_root", "FStar.Pointer.Base.gread", "FStar.Pointer.Base.cell", "FStar.Pointer.Base.otype_of_struct_field", "FStar.Pointer.Base.ovalue_is_readable_array_intro", "FStar.Pointer.Base.is_null", "FStar.Pointer.Base.loc_addresses", "FStar.Pointer.Base.not_an_array_cell", "FStar.Pointer.Base._field", "FStar.Pointer.Base.gcell", "FStar.Heap.trivial_preorder", "FStar.Pervasives.reveal_opaque", "FStar.Pointer.Base.step_sel", "FStar.Pointer.Base.modifies_loc_regions_intro", "FStar.Pointer.Base.offset_buffer", "FStar.Pointer.Base.loc_aux_in_addr", "FStar.Pointer.Base.nullptr", "FStar.Pointer.Base.loc_aux_disjoint_sym'", "FStar.Pointer.Base.value_of_ovalue_of_value", "FStar.Pointer.Base.loc_aux_includes_trans", "FStar.Pointer.Base.buffer_unused_in", "FStar.Pointer.Base.gsub_buffer", "FStar.Pointer.Base.loc_aux_disjoint_loc_aux_includes", "FStar.Pointer.Base.loc_aux_disjoint", "FStar.Pointer.Base.otype_of_typ_struct", "FStar.Pointer.Base.type_of_typ'_eq", "FStar.Pointer.Base.disjoint_sym''", "FStar.Pointer.Base.value_of_ovalue", "FStar.Pointer.Base.ovalue_is_readable", "FStar.Pointer.Base.buffer_of_array_pointer", "FStar.Pointer.Base.field", "FStar.Pointer.Base.readable_array", "FStar.Pointer.Base.frameOf", "FStar.Pointer.Base.struct_create_fun", "FStar.Pointer.Base.buffer_as_seq_gsingleton_buffer_of_pointer", "FStar.Pointer.Base.buffer_root_as_seq", "FStar.Pointer.Base.is_mm", "FStar.Pointer.Base.owrite", "FStar.Pointer.Base.gbuffer_of_array_pointer", "FStar.Monotonic.HyperStack.sel", "FStar.Pointer.Base.gsingleton_buffer_of_pointer", "FStar.Pointer.Base.union_get_value", "FStar.Pervasives.Native.fst", "FStar.Pointer.Base.loc_disjoint_gpointer_of_buffer_cell", "FStar.Pervasives.Native.snd", "FStar.Pointer.Base.loc_aux_disjoint_buffer", "FStar.Pointer.Base.path_upd", "FStar.Pointer.Base.loc_aux_includes_loc_aux_includes_pointer", "FStar.Pointer.Base.readable", "FStar.Pointer.Base._cell", "FStar.Pointer.Base.disjoint", "FStar.Pointer.Base.path_equal'", "FStar.Pointer.Base.includes", "FStar.Pointer.Base.gfield", "FStar.Pointer.Base.buffer_as_seq_gsub_buffer", "FStar.Pointer.Base.buffer_as_seq_gbuffer_of_array_pointer", "FStar.Pointer.Base.loc_aux_includes", "FStar.Pointer.Base.pointer_ref_contents", "FStar.Pointer.Base.buffer_as_addr", "FStar.Pointer.Base.loc_aux_includes_pointer_trans", "FStar.Pointer.Base.loc_aux_preserved" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Pointer.Base\n\nmodule DM = FStar.DependentMap\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\n(*** Definitions *)\n\n(** Pointers to data of type t.\n\n This defines two main types:\n - `npointer (t: typ)`, a pointer that may be \"NULL\";\n - `pointer (t: typ)`, a pointer that cannot be \"NULL\"\n (defined as a refinement of `npointer`).\n\n `nullptr #t` (of type `npointer t`) represents the \"NULL\" value.\n*)\n\n#set-options \"--initial_fuel 1 --initial_ifuel 1 --max_fuel 1 --max_ifuel 1\"\n\ntype step: (from: typ) -> (to: typ) -> Tot Type0 =\n | StepField:\n (l: struct_typ) ->\n (fd: struct_field l) ->\n step (TStruct l) (typ_of_struct_field l fd)\n | StepUField:\n (l: union_typ) ->\n (fd: struct_field l) ->\n step (TUnion l) (typ_of_struct_field l fd)\n | StepCell:\n (length: UInt32.t) ->\n (value: typ) ->\n (index: UInt32.t { UInt32.v index < UInt32.v length } ) ->\n step (TArray length value) value\n\ntype path (from: typ) : (to: typ) -> Tot Type0 =\n | PathBase:\n path from from\n | PathStep:\n (through: typ) ->\n (to: typ) ->\n (p: path from through) ->\n (s: step through to) ->\n path from to\n\nlet step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()\n\nlet rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s\n\n(*\nprivate\nlet not_cell\n (#from #to: typ)\n (p: path from to)\n: GTot bool\n= match p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nprivate type array_path (from: typ) (to_elem: typ) : (length: UInt32.t) -> Tot Type0 =\n| PSingleton:\n (p: path from to_elem { not_cell p } ) ->\n array_path from to_elem 1ul\n| PArray:\n length: UInt32.t ->\n path from (TArray length to_elem) ->\n array_path from to_elem length\n\nprivate let path' (from: typ) (to: typ) : Tot Type0 =\n if TArray? to\n then\n let length = TArray?.length to in\n (array_path from (TArray?.t to) length * (offset: UInt32.t & (length': UInt32.t {UInt32.v offset + UInt32.v length' <= UInt32.v length})))\n else path from to\n*)\n\nnoeq type _npointer (to : typ): Type0 =\n | Pointer:\n (from: typ) ->\n (contents: HS.aref) ->\n (p: path from to) ->\n _npointer to\n | NullPtr\n\nlet npointer (t: typ): Tot Type0 =\n _npointer t\n\n(** The null pointer *)\n\nlet nullptr (#t: typ): Tot (npointer t) = NullPtr\n\nlet g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false\n\nlet g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()\n\n(** Buffers *)\n\nlet not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nnoeq type buffer_root (t: typ) =\n| BufferRootSingleton:\n (p: pointer t { not_an_array_cell p } ) ->\n buffer_root t\n| BufferRootArray:\n (#max_length: array_length_t) ->\n (p: pointer (TArray max_length t)) ->\n buffer_root t\n\nlet buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len\n\nnoeq type _buffer (t: typ) =\n| Buffer:\n (broot: buffer_root t) ->\n (bidx: UInt32.t) ->\n (blength: UInt32.t { UInt32.v bidx + UInt32.v blength <= UInt32.v (buffer_root_length broot) } ) ->\n _buffer t\nlet buffer (t: typ): Tot Type0 = _buffer t\n\n(** Helper for the interpretation of unions.\n\n A C union is interpreted as a dependent pair of a key and a value (which\n depends on the key). The intent is for the key to be ghost, as it will not\n exist at runtime (C unions are untagged).\n\n Therefore,\n - `gtdata_get_key` (defined below) is in `GTot`, and\n - `gtdata_get_value` asks for the key `k` to read, and a proof that `k`\n matches the ghost key.\n*)\n\nlet gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )\n\nlet _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u\n\nlet gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u\n\nlet gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v\n\nlet gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)\n\nlet gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()\n\n(* Interprets a type code (`typ`) as a FStar type (`Type0`). *)\nlet rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\n\nlet rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()\n\n(** Interpretation of unions, as ghostly-tagged data\n (see `gtdata` for more information).\n*)\nlet _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v\n\nlet struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f\n\nlet struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v\n\nlet struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f\n\nlet struct_sel_struct_create_fun l f fd = ()\n\nlet union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v\n\nlet union_get_value #l v fd = gtdata_get_value v fd\n\nlet union_create l fd v = gtdata_create fd v\n\n(** For any `t: typ`, `dummy_val t` provides a default value of this type.\n\n This is useful to represent uninitialized data.\n*)\nlet rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul\n\n(** The interpretation of type codes (`typ`) defined previously (`type_of_typ`)\n maps codes to fully defined FStar types. In other words, a struct is\n interpreted as a dependent map where all fields have a well defined value.\n\n However, in practice, C structures (or any other type) can be uninitialized\n or partially-initialized.\n\n To account for that:\n\n - First, we define an alternative interpretation of type codes,\n `otype_of_typ`, which makes uninitialized data explicit (essentially\n wrapping all interpretations with `option`).\n\n This concrete interpretation is what is stored in the model of the heap,\n and what is manipulated internally. As it is quite verbose, it is not\n exposed to the user.\n\n - Then, interpretations with explicit uninitialized data (`otype_of_type t`)\n can be mapped to fully-initialized data (`type_of_type t`) by inserting\n dummy values. This is done by the `value_of_ovalue` function.\n\n - Finally, reading from a fully-initialized data is guarded by a `readable`\n predicate, which ensures that the dummy values cannot be accessed, and\n therefore that reading uninitialized data is actually forbidden.\n*)\n\nlet rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)\n\nlet otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ\n\nlet otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()\n\nlet otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()\n\nlet otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()\n\nlet ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))\n\nlet ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f\n\nlet ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)\n\nlet ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)\n\nlet otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)\n\nlet ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))\n\nlet ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)\n\nlet ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd\n\nlet ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)\n\nlet otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)\n\nlet struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true\n\nlet rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v\n\nlet ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)\n\nlet ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v\n\nlet ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in (\n Some? v /\\\n ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)\n )))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= let (v: ostruct l) = v in\n assert_norm (ovalue_is_readable (TStruct l) v == List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n assert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n assert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n\nlet ovalue_is_readable_array_elim\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n: Lemma\n (requires (ovalue_is_readable (TArray len t) v))\n (ensures (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n )))\n= ()\n\nlet ovalue_is_readable_array_intro\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n: Lemma\n (requires (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\ (\n forall (i: UInt32.t { UInt32.v i < UInt32.v len } ) .\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n ))))\n (ensures (ovalue_is_readable (TArray len t) v))\n= let (v: option (array len (otype_of_typ t))) = v in\n let (v: array len (otype_of_typ t)) = Some?.v v in\n let f\n (i: nat { i < UInt32.v len } )\n : Lemma\n (ovalue_is_readable t (Seq.index v i))\n = let (j : UInt32.t { UInt32.v j < UInt32.v len } ) = UInt32.uint_to_t i in\n assert (ovalue_is_readable t (Seq.index v (UInt32.v j)))\n in\n Classical.forall_intro f\n\nlet ostruct_field_of_struct_field\n (l: struct_typ)\n (ovalue_of_value: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Pure (otype_of_typ t)\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: struct l)\n (f: struct_field l)\n: Tot (otype_of_struct_field l f)\n= ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n\n(* TODO: move to Seq.Base *)\n\nlet seq_init_index\n (#a:Type) (len:nat) (contents:(i:nat { i < len } -> Tot a)) (i: nat)\n: Lemma\n (requires (i < len))\n (ensures (i < len /\\ Seq.index (Seq.init len contents) i == contents i))\n [SMTPat (Seq.index (Seq.init len contents) i)]\n= Seq.init_index len contents\n\nlet rec ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Tot (otype_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let oval\n (t' : typ)\n (v' : type_of_typ t')\n : Pure (otype_of_typ t')\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_of_value t' v'\n in\n ostruct_create l (ostruct_field_of_struct_field l oval v)\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n assert (UInt32.v len == Seq.length v);\n let f\n (i: nat {i < UInt32.v len})\n : Tot (otype_of_typ t)\n = ovalue_of_value t (Seq.index v i)\n in\n let (v': array len (otype_of_typ t)) = Seq.init (UInt32.v len) f in\n Some v'\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ounion_create l k (ovalue_of_value (typ_of_struct_field l k) (union_get_value v k))\n | _ -> Some v\n\nlet ovalue_is_readable_ostruct_field_of_struct_field\n (l: struct_typ)\n (ih: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n ))\n (v: struct l)\n (f: struct_field l)\n: Lemma\n (ovalue_is_readable (typ_of_struct_field l f) (ostruct_field_of_struct_field l ovalue_of_value v f))\n= ih (typ_of_struct_field l f) (struct_sel #l v f)\n\nlet rec ovalue_is_readable_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (requires True)\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n (decreases t)\n [SMTPat (ovalue_is_readable t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let (v: struct l) = v in\n let (v': ostruct l) = ovalue_of_value (TStruct l) v in\n let phi\n (t: typ)\n (v: type_of_typ t)\n : Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n = ovalue_is_readable_ovalue_of_value t v\n in\n Classical.forall_intro (ovalue_is_readable_ostruct_field_of_struct_field l phi v);\n ovalue_is_readable_struct_intro l v'\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n let (v': otype_of_typ (TArray len t)) = ovalue_of_value (TArray len t) v in\n let (v': array len (otype_of_typ t)) = Some?.v v' in\n let phi\n (i: nat { i < Seq.length v' } )\n : Lemma\n (ovalue_is_readable t (Seq.index v' i))\n = ovalue_is_readable_ovalue_of_value t (Seq.index v i)\n in\n Classical.forall_intro phi\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ovalue_is_readable_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()\n\nlet rec value_of_ovalue\n (t: typ)\n (v: otype_of_typ t)\n: Tot (type_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n if Some? v\n then\n let phi\n (f: struct_field l)\n : Tot (type_of_struct_field l f)\n = value_of_ovalue (typ_of_struct_field l f) (ostruct_sel v f)\n in\n struct_create_fun l phi\n else dummy_val t\n | TArray len t' ->\n let (v: option (array len (otype_of_typ t'))) = v in\n begin match v with\n | None -> dummy_val t\n | Some v ->\n let phi\n (i: nat { i < UInt32.v len } )\n : Tot (type_of_typ t')\n = value_of_ovalue t' (Seq.index v i)\n in\n Seq.init (UInt32.v len) phi\n end\n | TUnion l ->\n let (v: ounion l) = v in\n begin match v with\n | None -> dummy_val t\n | _ ->\n let k = ounion_get_key v in\n union_create l k (value_of_ovalue (typ_of_struct_field l k) (ounion_get_value v k))\n end\n | TBase b ->\n let (v: option (type_of_base_typ b)) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TPointer t' ->\n let (v: option (pointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TNPointer t' ->\n let (v: option (npointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TBuffer t' ->\n let (v: option (buffer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n\nlet ovalue_of_value_array_index\n (#len: array_length_t)\n (t' : typ)\n (v: array len (type_of_typ t'))\n (sv: array len (otype_of_typ t'))\n: Lemma\n (requires (ovalue_of_value (TArray len t') v == Some sv))\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index sv i == ovalue_of_value t' (Seq.index v i)))\n= ()\n\n\nlet value_of_ovalue_array_index\n (#len: array_length_t)\n (t': typ)\n (sv: array len (otype_of_typ t'))\n: Lemma\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index (value_of_ovalue (TArray len t') (Some sv)) i == value_of_ovalue t' (Seq.index sv i)))\n= ()\n\n#set-options \"--z3rlimit 16\"\n\nlet rec value_of_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (value_of_ovalue t (ovalue_of_value t v) == v)\n [SMTPat (value_of_ovalue t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let v : struct l = v in\n let v' : struct l = value_of_ovalue t (ovalue_of_value t v) in\n let phi\n (f: struct_field l)\n : Lemma\n (struct_sel #l v' f == struct_sel #l v f)\n = value_of_ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n in\n Classical.forall_intro phi;\n DM.equal_intro v' v;\n DM.equal_elim #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) v' v\n | TArray len t' ->\n let (v: array len (type_of_typ t')) = v in\n let ov : option (array len (otype_of_typ t')) = ovalue_of_value (TArray len t') v in\n assert (Some? ov);\n let sv : array len (otype_of_typ t') = Some?.v ov in\n assert (Seq.length sv == UInt32.v len);\n// assert (forall (i : nat { i < UInt32.v len } ) . Seq.index sv i == ovalue_of_value t' (Seq.index v i));\n ovalue_of_value_array_index t' v sv;\n let v' : array len (type_of_typ t') = value_of_ovalue t ov in\n assert (Seq.length v' == UInt32.v len);\n// assert (forall (i: nat { i < UInt32.v len } ) . Seq.index v' i == value_of_ovalue t' (Seq.index sv i));\n value_of_ovalue_array_index t' sv;\n let phi\n (i: nat { i < UInt32.v len } )\n : Lemma\n (value_of_ovalue t' (ovalue_of_value t' (Seq.index v i)) == Seq.index v i)\n = value_of_ovalue_of_value t' (Seq.index v i)\n in\n Classical.forall_intro phi;\n Seq.lemma_eq_intro v' v;\n Seq.lemma_eq_elim v' v\n | TUnion l ->\n let v : union l = v in\n let k = _union_get_key v in\n value_of_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()\n\nlet none_ovalue\n (t: typ)\n: Tot (otype_of_typ t)\n= match t with\n | TStruct l -> (None <: ostruct l)\n | TArray len t' -> (None <: option (array len (otype_of_typ t')))\n | TUnion l -> (None <: ounion l)\n | TBase b -> (None <: option (type_of_base_typ b))\n | TPointer t' -> (None <: option (pointer t'))\n | TNPointer t' -> (None <: option (npointer t'))\n | TBuffer t' -> (None <: option (buffer t'))\n\nlet not_ovalue_is_readable_none_ovalue\n (t: typ)\n: Lemma\n (ovalue_is_readable t (none_ovalue t) == false)\n= ()\n\n(*** Semantics of pointers *)\n\n(** Pointer paths *)\n\nlet step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n= match s with\n | StepField l fd ->\n let (m': ostruct l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ -> ostruct_sel m' fd\n end\n | StepUField l fd ->\n let (m' : ounion l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ ->\n if fd = ounion_get_key m'\n then ounion_get_value m' fd\n else none_ovalue to\n end\n | StepCell length value i ->\n let (m': option (array length (otype_of_typ to))) = m' in\n begin match m' with\n | None -> none_ovalue to\n | Some m' -> Seq.index m' (UInt32.v i)\n end\n\n(* TODO: we used to have this:\n<<<\nlet ovalue_is_readable_step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n: Lemma\n (requires (ovalue_is_readable from m'))\n (ensures (ovalue_is_readable to (step_sel m' s)))\n [SMTPat (ovalue_is_readable to (step_sel m' s))]\n= match s with\n | StepField l fd -> ovalue_is_readable_struct_elim l m' fd\n | _ -> ()\n>>>\nWhich is, of course, wrong with unions. So we have to specialize this rule for each step:\n*)\n\nlet ovalue_is_readable_step_sel_cell\n (#length: array_length_t)\n (#value: typ)\n (m': otype_of_typ (TArray length value))\n (index: UInt32.t { UInt32.v index < UInt32.v length } )\n: Lemma\n (requires (ovalue_is_readable (TArray length value) m'))\n (ensures (ovalue_is_readable value (step_sel m' (StepCell length value index))))\n [SMTPat (ovalue_is_readable value (step_sel m' (StepCell length value index)))]\n= ()\n\nlet ovalue_is_readable_step_sel_field\n (#l: struct_typ)\n (m: ostruct l)\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) m))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd)))]\n= ()\n\nlet ovalue_is_readable_step_sel_union_same\n (#l: union_typ)\n (m: ounion l)\n (fd: struct_field l)\n: Lemma\n (requires (\n ovalue_is_readable (TUnion l) m /\\\n ounion_get_key m == fd\n ))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepUField l fd))))\n= ()\n\nlet step_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (s: step from to)\n: Lemma\n (step_sel (none_ovalue from) s == none_ovalue to)\n= ()\n\nlet rec path_sel\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n: Tot (otype_of_typ to)\n (decreases p)\n= match p with\n | PathBase -> m\n | PathStep through' to' p' s ->\n let (m': otype_of_typ through') = path_sel m p' in\n step_sel m' s\n\nlet rec path_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_sel (none_ovalue from) p == none_ovalue to))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' s ->\n path_sel_none_ovalue p'\n\nlet step_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases s)\n= match s with\n | StepField l fd ->\n let (m: ostruct l) = m in\n begin match m with\n | None ->\n (* whole structure does not exist yet,\n so create one with only one field initialized,\n and all others uninitialized *)\n let phi\n (fd' : struct_field l)\n : Tot (otype_of_struct_field l fd')\n = if fd' = fd\n then v\n else none_ovalue (typ_of_struct_field l fd')\n in\n ostruct_create l phi\n | Some _ -> ostruct_upd m fd v\n end\n | StepCell len _ i ->\n let (m: option (array len (otype_of_typ to))) = m in\n begin match m with\n | None ->\n (* whole array does not exist yet,\n so create one with only one cell initialized,\n and all others uninitialized *)\n let phi\n (j: nat { j < UInt32.v len } )\n : Tot (otype_of_typ to)\n = if j = UInt32.v i\n then v\n else none_ovalue to\n in\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.init (UInt32.v len) phi)\n in\n m'\n | Some m ->\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.upd m (UInt32.v i) v)\n in\n m'\n end\n | StepUField l fd ->\n (* overwrite the whole union with the new field *)\n ounion_create l fd v\n\nlet step_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Lemma\n (step_sel (step_upd m s v) s == v)\n= ()\n\nlet rec path_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases p)\n= match p with\n | PathBase -> v\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n path_upd m p' (step_upd s st v)\n\nlet rec path_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_sel (path_upd m p v) p == v))\n (decreases p)\n [SMTPat (path_sel (path_upd m p v) p)]\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n step_sel_upd_same s st v;\n let s' = step_upd s st v in\n path_sel_upd_same m p' s'\n\nlet rec path_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Pure (path from to)\n (requires True)\n (ensures (fun _ -> True))\n (decreases q)\n= match q with\n | PathBase -> p\n | PathStep through' to' q' st -> PathStep through' to' (path_concat p q') st\n\nlet path_concat_base_r\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (ensures (path_concat p PathBase == p))\n= ()\n\nlet rec path_concat_base_l\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_concat PathBase p == p))\n (decreases p)\n [SMTPat (path_concat PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' _ -> path_concat_base_l p'\n\nlet rec path_concat_assoc\n (#t0 #t1 #t2 #t3: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n (p23: path t2 t3)\n: Lemma\n (requires True)\n (ensures (path_concat (path_concat p01 p12) p23 == path_concat p01 (path_concat p12 p23)))\n (decreases p23)\n= match p23 with\n | PathBase -> ()\n | PathStep _ _ p23' _ -> path_concat_assoc p01 p12 p23'\n\nlet rec path_sel_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_sel m (path_concat p q) == path_sel (path_sel m p) q))\n (decreases q)\n [SMTPat (path_sel m (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_sel_concat m p q'\n\nlet rec path_upd_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_upd m (path_concat p q) v == path_upd m p (path_upd (path_sel m p) q v)))\n (decreases q)\n [SMTPat (path_upd m (path_concat p q) v)]\n= match q with\n | PathBase -> ()\n | PathStep through' to' q' st ->\n let (s: otype_of_typ through') = path_sel m (path_concat p q') in\n let (s': otype_of_typ through') = step_upd s st v in\n path_upd_concat m p q' s'\n\n// TODO: rename as: prefix_of; use infix notation (p1 `prefix_of` p2)\nlet rec path_includes\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Ghost bool\n (requires True)\n (ensures (fun _ -> True))\n (decreases p2)\n= (to1 = to2 && p1 = p2) || (match p2 with\n | PathBase -> false\n | PathStep _ _ p2' _ ->\n path_includes p1 p2'\n )\n\nlet rec path_includes_base\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes (PathBase #from) p))\n (decreases p)\n [SMTPat (path_includes PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p2' _ -> path_includes_base p2'\n\nlet path_includes_refl\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes p p))\n [SMTPat (path_includes p p)]\n= ()\n\nlet path_includes_step_r\n (#from #through #to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (PathStep through to p s)))\n [SMTPat (path_includes p (PathStep through to p s))]\n= ()\n\nlet rec path_includes_trans\n (#from #to1 #to2 #to3: typ)\n (p1: path from to1)\n (p2: path from to2)\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3})\n: Lemma\n (requires True)\n (ensures (path_includes p1 p3))\n (decreases p3)\n= FStar.Classical.or_elim\n #(to2 == to3 /\\ p2 == p3)\n #(match p3 with\n | PathBase -> False\n | PathStep _ _ p3' _ ->\n\tpath_includes p2 p3')\n #(fun _ -> path_includes p1 p3)\n (fun _ -> ())\n (fun _ -> match p3 with\n | PathBase -> assert False\n | PathStep _ _ p3' _ ->\n\tpath_includes_trans p1 p2 p3'\n )\n\nlet rec path_includes_ind\n (#from: typ)\n (x:((#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2 {path_includes p1 p2} ) ->\n GTot Type0))\n (h_step:\n ((#through: typ) ->\n (#to: typ) ->\n (p: path from through) ->\n (s: step through to { path_includes p (PathStep through to p s) } ) ->\n Lemma (x p (PathStep through to p s))))\n (h_refl:\n ((#to: typ) ->\n (p: path from to {path_includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#to1: typ) ->\n (#to2: typ) ->\n (#to3: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3 /\\ path_includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (requires True)\n (ensures (x p1 p2))\n (decreases p2)\n= FStar.Classical.or_elim\n #(to1 == to2 /\\ p1 == p2)\n #(match p2 with\n | PathBase -> False\n | PathStep _ _ p' _ -> path_includes p1 p')\n #(fun _ -> x p1 p2)\n (fun _ -> h_refl p1)\n (fun _ -> match p2 with\n | PathBase -> assert False\n | PathStep _ _ p2' st ->\n let _ = path_includes_ind x h_step h_refl h_trans p1 p2' in\n let _ = path_includes_step_r p2' st in\n let _ = h_step p2' st in\n h_trans p1 p2' p2\n )\n\nlet rec path_length\n (#from #to: typ)\n (p: path from to)\n: Tot nat\n (decreases p)\n= match p with\n | PathBase -> 0\n | PathStep _ _ p' _ -> 1 + path_length p'\n\nlet path_includes_length\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (ensures (path_length p1 <= path_length p2))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_length p1_ <= path_length p2_)\n (fun #through #to p st -> ())\n (fun #to p -> ())\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> ())\n p1 p2\n\nlet path_includes_step_l\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (~ (path_includes (PathStep through to p s) p)))\n [SMTPat (path_includes (PathStep through to p s) p)]\n= assert (path_length (PathStep through to p s) > path_length p);\n FStar.Classical.forall_intro (path_includes_length #from #to #through (PathStep through to p s))\n\nlet rec path_includes_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (path_concat p q)))\n (decreases q)\n [SMTPat (path_includes p (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_includes_concat p q'\n\nlet path_includes_exists_concat\n (#from #through: typ)\n (p: path from through)\n (#to: typ)\n (q: path from to { path_includes p q } )\n: Lemma\n (ensures (exists (r: path through to) . q == path_concat p r))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> exists r . p2_ == path_concat p1_ r)\n (fun #through #to_ p s ->\n let r = PathStep through to_ PathBase s in\n assert_norm (PathStep through to_ p s == path_concat p r)\n )\n (fun #to p -> FStar.Classical.exists_intro (fun r -> p == path_concat p r) PathBase)\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ ->\n FStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r12 -> p2_ == path_concat p1_ r12) () (fun r12 ->\n\tFStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r23 -> p3_ == path_concat p2_ r23) () (fun r23 ->\n\t path_concat_assoc p1_ r12 r23;\n\t FStar.Classical.exists_intro (fun r -> p3_ == path_concat p1_ r) (path_concat r12 r23)\n\t)\n )\n )\n p q\n\nlet path_concat_includes\n (#from #through: typ)\n (p: path from through)\n (phi: (\n (#to: typ) ->\n (p': path from to) ->\n Ghost Type0\n (requires (path_includes p p'))\n (ensures (fun _ -> True))\n ))\n (f: (\n (to: typ) ->\n (p': path through to) ->\n Lemma\n (ensures (phi (path_concat p p')))\n ))\n (#to: typ)\n (q: path from to)\n: Lemma\n (requires (path_includes p q))\n (ensures (path_includes p q /\\ phi q))\n= Classical.forall_intro_2 f;\n path_includes_exists_concat p q\n\nlet step_disjoint\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: GTot bool\n= match s1 with\n | StepField _ fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 <> fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n UInt32.v i1 <> UInt32.v i2\n | StepUField _ _ ->\n (* two fields of the same union are never disjoint *)\n false\n\nlet step_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Tot (b: bool { b = true <==> to1 == to2 /\\ s1 == s2 } )\n= match s1 with\n | StepField l1 fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 = fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n i1 = i2\n | StepUField l1 fd1 ->\n let (StepUField _ fd2) = s2 in\n fd1 = fd2\n\nlet step_disjoint_not_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2 == true))\n (ensures (step_eq s1 s2 == false))\n= () (* Note: the converse is now wrong, due to unions *)\n\nlet step_disjoint_sym\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2))\n (ensures (step_disjoint s2 s1))\n= ()\n\nnoeq type path_disjoint_t (#from: typ):\n (#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n Type0\n= | PathDisjointStep:\n (#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)\n | PathDisjointIncludes:\n (#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (#to1': typ) ->\n (#to2': typ) ->\n (p1': path from to1' {path_includes p1 p1'}) ->\n (p2': path from to2' {path_includes p2 p2'}) ->\n path_disjoint_t p1 p2 ->\n path_disjoint_t p1' p2'\n\nlet rec path_disjoint_t_rect\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (h: path_disjoint_t p1 p2) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n (h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)) ->\n GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2'}) ->\n (h: path_disjoint_t p1 p2) ->\n (h': path_disjoint_t p1' p2') ->\n (ihx: x p1 p2 h) ->\n GTot (x p1' p2' h')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n: Ghost (x p1 p2 h)\n (requires True)\n (ensures (fun _ -> True))\n (decreases h)\n= match h with\n | PathDisjointStep p s1 s2 -> h_step p s1 s2 h\n | PathDisjointIncludes p1_ p2_ p1' p2' h_ -> h_includes p1_ p2_ p1' p2' h_ h (path_disjoint_t_rect x h_step h_includes p1_ p2_ h_)\n\nlet path_disjoint\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: GTot Type0\n= squash (path_disjoint_t p1 p2)\n\n#push-options \"--smtencoding.valid_intro true --smtencoding.valid_elim true\"\nlet path_disjoint_ind\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2 {path_disjoint p1 p2} ) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 /\\ path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) } ) ->\n Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2) )))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2 { path_disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun (h: path_disjoint_t p1 p2) ->\n path_disjoint_t_rect\n (fun #v1 #v2 p1 p2 h -> let _ = FStar.Squash.return_squash h in squash (x p1 p2))\n (fun #through #to1 #to2 p s1 s2 h -> let _ = FStar.Squash.return_squash h in h_step p s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' h h' hx ->\n let _ = FStar.Squash.return_squash h in\n let _ = FStar.Squash.return_squash h' in\n let _ = FStar.Squash.return_squash hx in\n h_includes p1 p2 p1' p2')\n p1 p2 h)\n#pop-options\n\nlet path_disjoint_step\n (#from: typ)\n (#through: typ)\n (#to1: typ)\n (#to2: typ)\n (p: path from through)\n (s1: step through to1)\n (s2: step through to2 { step_disjoint s1 s2 } )\n: Lemma\n (requires True)\n (ensures (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2)))\n [SMTPat (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2))]\n= FStar.Classical.give_witness (FStar.Squash.return_squash (PathDisjointStep p s1 s2))\n\n#push-options \"--smtencoding.valid_intro true --smtencoding.valid_elim true\"\nlet path_disjoint_includes\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (#to2': typ)\n (p1': path from to1')\n (p2': path from to2')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1' /\\ path_includes p2 p2'))\n (ensures (path_disjoint p1' p2'))\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun h -> FStar.Squash.return_squash (PathDisjointIncludes p1 p2 p1' p2' h))\n#pop-options\n\nlet path_disjoint_includes_l\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (p1': path from to1')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1'))\n (ensures (path_disjoint p1' p2))\n [SMTPatOr [\n [SMTPat (path_disjoint p1 p2); SMTPat (path_includes p1 p1')];\n [SMTPat (path_disjoint p1' p2); SMTPat (path_includes p1 p1')];\n ]]\n= path_disjoint_includes p1 p2 p1' p2\n\nlet path_disjoint_sym\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint p2 p1))\n [SMTPatOr [[SMTPat (path_disjoint p1 p2)]; [SMTPat (path_disjoint p2 p1)]]]\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint p2 p1)\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step p s2 s1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_includes p2 p1 p2' p1')\n p1 p2\n\nlet rec path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Tot (b: bool { b == true <==> (value1 == value2 /\\ p1 == p2) } )\n (decreases p1)\n= match p1 with\n | PathBase -> PathBase? p2\n | PathStep _ _ p1' s1 ->\n PathStep? p2 && (\n let (PathStep _ _ p2' s2) = p2 in (\n path_equal p1' p2' &&\n step_eq s1 s2\n ))\n\nlet rec path_length_concat\n (#t0 #t1 #t2: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n: Lemma\n (requires True)\n (ensures (path_length (path_concat p01 p12) == path_length p01 + path_length p12))\n (decreases p12)\n= match p12 with\n | PathBase -> ()\n | PathStep _ _ p' s' -> path_length_concat p01 p'\n\nlet rec path_concat_inj_l\n (#from #through1: typ)\n (p1_: path from through1)\n (#v1: typ)\n (p1: path through1 v1)\n (#through2 #v2: typ)\n (p2_: path from through2)\n (p2: path through2 v2)\n: Lemma\n (requires (path_equal (path_concat p1_ p1) (path_concat p2_ p2) == true /\\ path_length p1_ == path_length p2_))\n (ensures (path_equal p1_ p2_ == true /\\ path_equal p1 p2 == true))\n (decreases p1)\n= path_length_concat p1_ p1;\n path_length_concat p2_ p2;\n match p1 with\n | PathBase -> ()\n | PathStep _ _ p1' s1 ->\n let (PathStep _ _ p2' s2) = p2 in\n path_concat_inj_l p1_ p1' p2_ p2'\n\ntype path_disjoint_decomp_t\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Type\n= | PathDisjointDecomp:\n (d_through: typ) ->\n (d_p: path from d_through) ->\n (d_v1: typ) ->\n (d_s1: step d_through d_v1) ->\n (d_p1': path d_v1 value1) ->\n (d_v2: typ) ->\n (d_s2: step d_through d_v2) ->\n (d_p2': path d_v2 value2) ->\n squash (\n step_disjoint d_s1 d_s2 == true /\\\n p1 == path_concat (PathStep _ _ d_p d_s1) d_p1' /\\\n p2 == path_concat (PathStep _ _ d_p d_s2) d_p2'\n ) ->\n path_disjoint_decomp_t p1 p2\n\nlet path_disjoint_decomp_includes\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (#value1': typ)\n (#value2': typ)\n (p1': path from value1')\n (p2': path from value2')\n: Lemma\n (requires (\n path_includes p1 p1' /\\\n path_includes p2 p2' /\\ (\n exists (d : path_disjoint_decomp_t p1 p2) . True\n )))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n= let f\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n (requires (\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n = let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_assoc (PathStep _ _ p s1) p1_ q1;\n path_concat_assoc (PathStep _ _ p s2) p2_ q2;\n let d' : path_disjoint_decomp_t p1' p2' =\n PathDisjointDecomp _ p _ s1 (path_concat p1_ q1) _ s2 (path_concat p2_ q2) ()\n in\n Classical.exists_intro (fun _ -> True) d'\n in\n let g\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n ((\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ) ==> (\n exists (d: path_disjoint_decomp_t p1' p2') . True\n ))\n = Classical.move_requires (f q1 q2) d // FIXME: annoying to repeat those type annotations above. WHY WHY WHY can't I just use (fun q1 q2 d -> Classical.move_requires (f q1 q2) d) as an argument of Classical.forall_intro_3 below instead of this g???\n in\n path_includes_exists_concat p1 p1' ;\n path_includes_exists_concat p2 p2' ;\n let _ : squash (exists (d: path_disjoint_decomp_t p1' p2') . True) =\n Classical.forall_intro_3 g\n in\n ()\n\nlet path_disjoint_decomp\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (exists (d: path_disjoint_decomp_t p1 p2) . True))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> exists (d: path_disjoint_decomp_t #from #v1 #v2 p1 p2) . True)\n (fun #through #to1 #to2 p s1 s2 ->\n let d : path_disjoint_decomp_t (PathStep _ _ p s1) (PathStep _ _ p s2) =\n PathDisjointDecomp _ p _ s1 PathBase _ s2 PathBase ()\n in\n Classical.exists_intro (fun _ -> True) d\n )\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_decomp_includes p1 p2 p1' p2')\n p1 p2\n\nlet path_disjoint_not_path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_equal p1 p2 == false))\n= let f\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma (path_equal p1 p2 == false)\n = if path_equal p1 p2\n then\n let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_inj_l (PathStep _ _ p s1) p1_ (PathStep _ _ p s2) p2_\n else ()\n in\n path_disjoint_decomp p1 p2;\n Classical.forall_intro f\n\nlet rec path_destruct_l\n (#t0 #t2: typ)\n (p: path t0 t2)\n: Tot (\n x: option (t1: typ & (s: step t0 t1 & (p' : path t1 t2 { p == path_concat (PathStep _ _ PathBase s) p' /\\ path_length p' < path_length p } ) ) )\n { None? x <==> PathBase? p }\n )\n (decreases p)\n= match p with\n | PathBase -> None\n | PathStep _ _ p' s ->\n begin match path_destruct_l p' with\n | None -> Some (| _, (| s, PathBase |) |)\n | Some (| t_, (| s_, p_ |) |) ->\n Some (| t_, (| s_, PathStep _ _ p_ s |) |)\n end\n\nlet rec path_equal'\n (#from #to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Tot (b: bool { b == true <==> to1 == to2 /\\ p1 == p2 } )\n (decreases (path_length p1))\n= match path_destruct_l p1 with\n | None -> PathBase? p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> false\n | (Some (| t2, (| s2, p2' |) |) ) ->\n step_eq s1 s2 &&\n path_equal' p1' p2'\n end\n\nlet path_includes_concat_l\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_includes p1 p2))\n (ensures (path_includes (path_concat p0 p1) (path_concat p0 p2)))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_includes (path_concat p0 p1_) (path_concat p0 p2_))\n (fun #through #to p st -> ())\n (fun #to p -> path_includes_refl (path_concat p0 p))\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> path_includes_trans (path_concat p0 p1_) (path_concat p0 p2_) (path_concat p0 p3_))\n p1 p2\n\nlet path_disjoint_concat\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint (path_concat p0 p1) (path_concat p0 p2)))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint (path_concat p0 p1) (path_concat p0 p2))\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step (path_concat p0 p) s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n path_includes_concat_l p0 p1 p1';\n path_includes_concat_l p0 p2 p2';\n path_disjoint_includes (path_concat p0 p1) (path_concat p0 p2) (path_concat p0 p1') (path_concat p0 p2'))\n p1 p2\n\n(* TODO: the following is now wrong due to unions, but should still hold if we restrict ourselves to readable paths\nlet rec not_path_equal_path_disjoint_same_type\n (#from: typ)\n (#value: typ)\n (p1: path from value)\n (p2: path from value)\n: Lemma\n (requires (path_equal p1 p2 == false))\n (ensures (path_disjoint p1 p2))\n (decreases (path_length p1))\n= assert (path_equal p1 p2 == path_equal' p1 p2);\n match path_destruct_l p1 with\n | None -> path_typ_depth p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> path_typ_depth p1\n | Some (| t2, (| s2, p2' |) |) ->\n if step_eq s1 s2\n then begin\n\tnot_path_equal_path_disjoint_same_type p1' p2' ;\n\tpath_disjoint_concat (PathStep _ _ PathBase s1) p1' p2'\n end else begin\n path_disjoint_step PathBase s1 s2;\n\tpath_includes_concat (PathStep _ _ PathBase s1) p1';\n\tpath_includes_concat (PathStep _ _ PathBase s2) p2';\n\tpath_disjoint_includes (PathStep _ _ PathBase s1) (PathStep _ _ PathBase s2) p1 p2\n end\n end\n*)\n\nlet step_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2 {step_disjoint s1 s2})\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n: Lemma\n (step_sel (step_upd m s1 v) s2 == step_sel m s2)\n= match s1 with\n | StepField l1 fd1 ->\n let (m: ostruct l1) = m in\n let (StepField _ fd2) = s2 in\n begin match m with\n | None -> ()\n | Some m -> DM.sel_upd_other m fd1 v fd2\n end\n | StepCell length1 _ i1 ->\n let (m: option (array length1 (otype_of_typ to1))) = m in\n let (StepCell _ _ i2) = s2 in\n begin match m with\n | None -> ()\n | Some m ->\n Seq.lemma_index_upd2 m (UInt32.v i1) v (UInt32.v i2)\n end\n\nlet path_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_disjoint p1 p2})\n: Lemma\n (ensures (forall (m: otype_of_typ from) (v: otype_of_typ to1) . path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> forall (m: otype_of_typ from) (v: otype_of_typ v1) . path_sel (path_upd m p1_ v) p2_ == path_sel m p2_)\n (fun #through #to1_ #to2_ p s1 s2 ->\n FStar.Classical.forall_intro_sub #_ #(fun m -> forall (v: otype_of_typ to1_) . path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun m ->\n\t FStar.Classical.forall_intro_sub #_ #(fun v -> path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun v ->\n\t let m0 = path_sel m p in\n let m1 = step_sel m0 s1 in\n let m2 = step_sel m0 s2 in\n let m0' = step_upd m0 s1 v in\n path_sel_upd_same m p m0';\n step_sel_upd_other s1 s2 m0 v\n )))\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n let h1: squash (exists r1 . p1' == path_concat p1 r1) = path_includes_exists_concat p1 p1' in\n let h2: squash (exists r2 . p2' == path_concat p2 r2) = path_includes_exists_concat p2 p2' in\n FStar.Classical.forall_intro_sub #_ #(fun (m: otype_of_typ from) -> forall v . path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (m: otype_of_typ from) ->\n FStar.Classical.forall_intro_sub #_ #(fun (v: otype_of_typ v1') -> path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (v: otype_of_typ v1') ->\n FStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h1 (fun r1 ->\n\tFStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h2 (fun r2 ->\n\t path_upd_concat m p1 r1 v;\n\t path_sel_concat m p2 r2\n\t )))))\n p1 p2\n\nlet path_sel_upd_other'\n (#from: typ)\n (#to1: typ)\n (p1: path from to1)\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n (#to2: typ)\n (p2: path from to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_sel_upd_other p1 p2\n\n(** Operations on pointers *)\n\nlet equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_equal (Pointer?.p p1) (Pointer?.p p2)\n\nlet as_addr (#t: typ) (p: pointer t) =\n HS.aref_as_addr (Pointer?.contents p)\n\nlet _field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TStruct l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepField _ fd) in\n Pointer from contents p''\n\nlet _cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t {UInt32.v i < UInt32.v length})\n: Tot (pointer value)\n= let (Pointer from contents p') = p in\n let p' : path from (TArray length value) = p' in\n let p'' : path from value = PathStep _ _ p' (StepCell _ _ i) in\n Pointer from contents p''\n\nlet _ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TUnion l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepUField _ fd) in\n Pointer from contents p''\n\nlet unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0\n= let (Pointer from contents p') = p in\n HS.aref_unused_in contents h\n\nlet pointer_ref_contents : Type0 = (t: typ & otype_of_typ t)\n\nlet live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0\n= let rel = Heap.trivial_preorder pointer_ref_contents in\n let (Pointer from contents _) = p in (\n HS.aref_live_at h contents pointer_ref_contents rel /\\ (\n let untyped_contents = HS.greference_of contents pointer_ref_contents rel in (\n dfst (HS.sel h untyped_contents) == from\n )))\n\nlet nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0\n= if g_is_null p\n then True\n else live h p\n\nlet live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= ()\n\nlet g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n= ()\n\nlet greference_of\n (#value: typ)\n (p: pointer value)\n: Ghost (HS.reference pointer_ref_contents)\n (requires (exists h . live h p))\n (ensures (fun x -> (exists h . live h p) /\\ x == HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\ HS.aref_of x == Pointer?.contents p))\n= HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)\n\nlet unused_in_greference_of\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: Lemma\n (requires (exists h . live h p))\n (ensures ((exists h . live h p) /\\ (HS.unused_in (greference_of p) h <==> unused_in p h)))\n [SMTPatOr [\n [SMTPat (HS.unused_in (greference_of p) h)];\n [SMTPat (unused_in p h)];\n ]]\n= ()\n\nlet live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= let f () : Lemma\n (requires (live h p /\\ p `unused_in` h))\n (ensures False)\n = let r = greference_of p in\n HS.contains_aref_unused_in h r (Pointer?.contents p)\n in\n Classical.move_requires f ()\n\nlet gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)\n= if StrongExcludedMiddle.strong_excluded_middle (live h p)\n then\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n value_of_ovalue value (path_sel c (Pointer?.p p))\n else\n dummy_val value\n\nlet frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid\n= HS.frameOf_aref (Pointer?.contents p)\n\nlet live_region_frameOf #value h p =\n let content = greference_of p in\n assert (HS.contains h content)\n\nlet disjoint_roots_intro_pointer_vs_pointer\n (#value1 value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 =!= as_addr p2))\n= ()\n\nlet disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))\n= let r = greference_of p1 in\n assert (HS.contains h r)\n\nlet disjoint_roots_intro_reference_vs_pointer\n (#value1: Type)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ p2 `unused_in` h))\n (ensures (HS.frameOf p1 <> frameOf p2 \\/ HS.as_addr p1 =!= as_addr p2))\n= ()\n\nlet is_mm\n (#value: typ)\n (p: pointer value)\n: GTot bool\n= HS.aref_is_mm (Pointer?.contents p)\n\n(* // TODO: recover with addresses?\nlet recall\n (#value: Type)\n (p: pointer value {is_eternal_region (frameOf p) && not (is_mm p)})\n: HST.Stack unit\n (requires (fun m -> True))\n (ensures (fun m0 _ m1 -> m0 == m1 /\\ live m1 p))\n= HST.recall (Pointer?.content p)\n*)\n\nlet gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= _field p fd\n\nlet as_addr_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet unused_in_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n (h: HS.mem)\n= ()\n\nlet live_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet gread_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet frameOf_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet is_mm_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= _ufield p fd\n\nlet as_addr_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet unused_in_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (h: HS.mem)\n= ()\n\nlet live_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet gread_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet frameOf_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet is_mm_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= _cell p i\n\nlet as_addr_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet unused_in_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet live_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet gread_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet frameOf_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet is_mm_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_includes (Pointer?.p p1) (Pointer?.p p2)\n\nlet includes_refl\n (#value: typ)\n (p: pointer value)\n= ()\n\nlet includes_trans\n (#value1 #value2 #value3: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n (p3: pointer value3)\n= path_includes_trans (Pointer?.p p1) (Pointer?.p p2) (Pointer?.p p3)\n\nlet includes_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet includes_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet includes_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet includes_ind\n (x:((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 {includes p1 p2} ) ->\n GTot Type0))\n (h_field:\n ((l: struct_typ) ->\n (p: pointer (TStruct l)) ->\n (fd: struct_field l {includes p (gfield p fd)}) ->\n Lemma (x p (gfield p fd))))\n (h_ufield:\n ((l: union_typ) ->\n (p: pointer (TUnion l)) ->\n (fd: struct_field l {includes p (gufield p fd)}) ->\n Lemma (x p (gufield p fd))))\n (h_cell:\n ((#length: array_length_t) ->\n (#value: typ) ->\n (p: pointer (TArray length value)) ->\n (i: UInt32.t {UInt32.v i < UInt32.v length /\\ includes p (gcell p i)}) ->\n Lemma (x p (gcell p i))))\n (h_refl:\n ((#value: typ) ->\n (p: pointer value {includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#value1: typ) ->\n (#value2: typ) ->\n (#value3: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2) ->\n (p3: pointer value3 {includes p1 p2 /\\ includes p2 p3 /\\ includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 {includes p1 p2})\n: Lemma (x p1 p2)\n= let (Pointer from contents _) = p1 in\n path_includes_ind\n (fun #to1 #to2 p1_ p2_ -> x (Pointer from contents p1_) (Pointer from contents p2_))\n (fun #through #to p s ->\n match s with\n | StepField l fd -> let (pt: pointer (TStruct l)) = (Pointer from contents p) in h_field l pt fd\n | StepUField l fd -> let (pt: pointer (TUnion l)) = (Pointer from contents p) in h_ufield l pt fd\n | StepCell length value i -> let (pt: pointer (TArray length value)) = (Pointer from contents p) in h_cell pt i\n )\n (fun #to p -> h_refl (Pointer from contents p))\n (fun #to1 #to2 #to3 p1_ p2_ p3_ -> h_trans (Pointer from contents p1_) (Pointer from contents p2_) (Pointer from contents p3_))\n (Pointer?.p p1)\n (Pointer?.p p2)\n\n(*\nlet unused_in_includes\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (includes p1 p2))\n (unused_in p1 h <==> unused_in p2 h)\n [SMTPat (unused_in p2 h); SMTPat (includes p1 p2)]\n= includes_ind\n (fun #v1 #v2 p1 p2 -> unused_in p1 h <==> unused_in p2 h)\n (fun l p fd -> unused_in_gfield p fd h)\n (fun l p fd -> unused_in_gufield p fd h)\n (fun #length #value p i -> unused_in_gcell h p i)\n (fun #v p -> ())\n (fun #v1 #v2 #v3 p1 p2 p3 -> ())\n p1 p2\n\nlet live_includes\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (includes p1 p2))\n (ensures (live h p1 <==> live h p2))\n [SMTPat (live h p2); SMTPat (includes p1 p2)]\n= includes_ind\n (fun #v1 #v2 p1 p2 -> live h p1 <==> live h p2)\n (fun l p fd -> live_gfield h p fd)\n (fun l p fd -> live_gufield h p fd)\n (fun #length #value p i -> live_gcell h p i)\n (fun #v p -> ())\n (fun #v1 #v2 #v3 p1 p2 p3 -> ())\n p1 p2\n*)\n\n(** The readable permission.\n We choose to implement it only abstractly, instead of explicitly\n tracking the permission in the heap.\n*)\n\nlet readable\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: GTot Type0\n= let () = () in // necessary to somehow remove the `logic` qualifier\n live h b /\\ (\n let content = greference_of b in\n let (| _, c |) = HS.sel h content in\n ovalue_is_readable a (path_sel c (Pointer?.p b))\n )\n\nlet readable_live\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n= ()\n\nlet readable_gfield\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= ()\n\nlet readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))\n// [SMTPat (readable #(TStruct l) h p)] // TODO: dubious pattern, will probably trigger unreplayable hints\n= let dummy_field : struct_field l = fst (List.Tot.hd l.fields) in // struct is nonempty\n let dummy_field_ptr = gfield p dummy_field in\n assert (readable h dummy_field_ptr);\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let (v: otype_of_typ (TStruct l)) = path_sel c (Pointer?.p p) in\n let (v: ostruct l {Some? v}) = v in\n ovalue_is_readable_struct_intro l v\n\nlet readable_struct_forall_mem\n (#l: struct_typ)\n (p: pointer (TStruct l))\n: Lemma (forall\n (h: HS.mem)\n . (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ) ==>\n readable h p\n )\n= let f\n (h: HS.mem)\n : Lemma // FIXME: WHY WHY WHY do we need this explicit annotation?\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))\n = readable_struct h p\n in\n Classical.forall_intro (Classical.move_requires f)\n\nlet rec readable_struct_fields'\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: GTot Type0\n (decreases s)\n= match s with\n | [] -> True\n | f :: s' ->\n readable_struct_fields' h p s' /\\ (\n if List.Tot.mem f (List.Tot.map fst l.fields)\n then\n\tlet f : struct_field l = f in\n\treadable h (gfield p f)\n else\n\tTrue\n )\n\nlet readable_struct_fields #l h p s = readable_struct_fields' h p s\n\nlet readable_struct_fields_nil #l h p = ()\n\nlet readable_struct_fields_cons #l h p f q = ()\n\nlet rec readable_struct_fields_elim\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: Lemma\n (requires (readable_struct_fields h p s))\n (ensures (forall f . (List.Tot.mem f s /\\ List.Tot.mem f (List.Tot.map fst l.fields)) ==> (let f : struct_field l = f in readable h (gfield p f))))\n (decreases s)\n= match s with\n | [] -> ()\n | _ :: q -> readable_struct_fields_elim h p q\n\nlet readable_struct_fields_readable_struct #l h p =\n readable_struct_fields_elim h p (List.Tot.map fst l.fields);\n readable_struct h p\n\nlet readable_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n i\n= ()\n\nlet readable_array\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n= assert (readable h (gcell p 0ul)); // for Some?\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let (v0: otype_of_typ (TArray length value)) = path_sel c (Pointer?.p p) in\n ovalue_is_readable_array_intro v0\n\n(* TODO: improve on the following interface *)\nlet readable_gufield\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\n(** The active field of a union *)\n\nlet is_active_union_field\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot Type0\n= let () = () in // necessary to somehow remove the `logic` qualifier\n live h p /\\ (\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n let vu : otype_of_typ (TUnion l) = path_sel c (Pointer?.p p) in\n let vu : option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ)) = vu in\n Some? vu /\\ gtdata_get_key (Some?.v vu) == fd\n )\n\nlet is_active_union_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet is_active_union_field_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet is_active_union_field_eq\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd1 fd2: struct_field l)\n= ()\n\nlet is_active_union_field_get_key\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet is_active_union_field_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= ()\n\nlet is_active_union_field_includes_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (#t': typ)\n (p' : pointer t')\n= let content = greference_of p in\n let (| _ , c |) = HS.sel h content in\n let t = typ_of_struct_field l fd in\n let (Pointer from cts p0) = p in\n let pf = PathStep _ _ p0 (StepUField l fd) in\n let (v0 : otype_of_typ t) = path_sel c pf in\n let phi\n (#t': typ)\n (pt': path from t')\n : Ghost Type0\n (requires (path_includes pf pt'))\n (ensures (fun _ -> True))\n = (~ (path_sel c pt' == none_ovalue t')) ==> is_active_union_field h p fd\n in\n let f\n (t' : typ)\n (pt' : path t t')\n : Lemma\n (ensures (phi (path_concat pf pt')))\n = path_sel_concat c pf pt';\n path_sel_none_ovalue pf;\n path_sel_none_ovalue pt'\n in\n path_concat_includes pf phi f (Pointer?.p p')\n\n(*** Semantics of buffers *)\n\n(** Operations on buffers *)\n\n#push-options \"--ifuel 2\"\nlet _singleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Tot (buffer t)\n= let Pointer from contents pth = p in\n match pth with\n | PathStep _ _ pth' (StepCell ln ty i) ->\n (* reconstruct the buffer to the enclosing array *)\n Buffer (BufferRootArray #ty #ln (Pointer from contents pth')) i 1ul\n | _ ->\n Buffer (BufferRootSingleton p) 0ul 1ul\n#pop-options\n\nlet gsingleton_buffer_of_pointer #t p = _singleton_buffer_of_pointer p\n\nlet singleton_buffer_of_pointer #t p = _singleton_buffer_of_pointer p\n\nlet gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: GTot (buffer t)\n= Buffer (BufferRootArray p) 0ul length\n\nlet buffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gbuffer_of_array_pointer p))\n= Buffer (BufferRootArray p) 0ul length\n\nlet buffer_length\n (#t: typ)\n (b: buffer t)\n: GTot UInt32.t\n= Buffer?.blength b\n\nlet buffer_length_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_length (gsingleton_buffer_of_pointer p) == 1ul))\n [SMTPat (buffer_length (gsingleton_buffer_of_pointer p))]\n= ()\n\nlet buffer_length_gbuffer_of_array_pointer\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_length (gbuffer_of_array_pointer p) == len))\n [SMTPat (buffer_length (gbuffer_of_array_pointer p))]\n= ()\n\nlet buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= let () = () in ( // necessary to somehow remove the `logic` qualifier\n match b.broot with\n | BufferRootSingleton p -> live h p\n | BufferRootArray p -> live h p\n )\n\nlet buffer_live_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_live h (gsingleton_buffer_of_pointer p) <==> live h p ))\n [SMTPat (buffer_live h (gsingleton_buffer_of_pointer p))]\n= ()\n\nlet buffer_live_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_live h (gbuffer_of_array_pointer p) <==> live h p))\n [SMTPat (buffer_live h (gbuffer_of_array_pointer p))]\n= ()\n\nlet buffer_unused_in #t b h =\n match b.broot with\n | BufferRootSingleton p -> unused_in p h\n | BufferRootArray p -> unused_in p h\n\nlet buffer_live_not_unused_in #t b h = ()\n\nlet buffer_unused_in_gsingleton_buffer_of_pointer #t p h = ()\n\nlet buffer_unused_in_gbuffer_of_array_pointer #t #length p h = ()\n\nlet frameOf_buffer\n (#t: typ)\n (b: buffer t)\n: GTot HS.rid\n= match b.broot with\n | BufferRootSingleton p -> frameOf p\n | BufferRootArray p -> frameOf p\n\nlet frameOf_buffer_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n= ()\n\nlet frameOf_buffer_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n= ()\n\nlet live_region_frameOf_buffer #value h p = ()\n\nlet buffer_as_addr #t b =\n match b.broot with\n | BufferRootSingleton p -> as_addr p\n | BufferRootArray p -> as_addr p\n\nlet buffer_as_addr_gsingleton_buffer_of_pointer #t p = ()\n\nlet buffer_as_addr_gbuffer_of_array_pointer #t #length p = ()\n\nlet gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Buffer (Buffer?.broot b) FStar.UInt32.(Buffer?.bidx b +^ i) len\n\nlet frameOf_buffer_gsub_buffer #t b i len = ()\n\nlet buffer_as_addr_gsub_buffer #t b i len = ()\n\nlet sub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Buffer (Buffer?.broot b) FStar.UInt32.(Buffer?.bidx b +^ i) len\n\nlet offset_buffer #t b i =\n sub_buffer b i (UInt32.sub (Buffer?.blength b) i)\n\nlet buffer_length_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n= ()\n\nlet buffer_live_gsub_buffer_equiv\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n h\n= ()\n\nlet buffer_live_gsub_buffer_intro\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n len\n h\n= ()\n\nlet buffer_unused_in_gsub_buffer #t b i len h = ()\n\nlet gsub_buffer_gsub_buffer\n (#a: typ)\n (b: buffer a)\n (i1: UInt32.t)\n len1 i2 len2\n= ()\n\nlet gsub_buffer_zero_buffer_length\n (#a: typ)\n (b: buffer a)\n= ()\n\nlet buffer_root_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer_root t)\n: GTot (Seq.seq (type_of_typ t))\n= match b with\n | BufferRootSingleton p ->\n Seq.create 1 (gread h p)\n | BufferRootArray p ->\n gread h p\n\nlet length_buffer_root_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer_root t)\n: Lemma\n (requires True)\n (ensures (Seq.length (buffer_root_as_seq h b) == UInt32.v (buffer_root_length b)))\n [SMTPat (Seq.length (buffer_root_as_seq h b))]\n= ()\n\nlet buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot (Seq.seq (type_of_typ t))\n= let i = UInt32.v (Buffer?.bidx b) in\n Seq.slice (buffer_root_as_seq h (Buffer?.broot b)) i (i + UInt32.v (Buffer?.blength b))\n\nlet buffer_length_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()\n\n#push-options \"--ifuel 2 --z3rlimit_factor 4 --retry 4\"\nlet buffer_as_seq_gsingleton_buffer_of_pointer #t h p =\n let Pointer from contents pth = p in\n match pth with\n | PathStep through to pth' (StepCell ln ty i) ->\n assert (through == TArray ln ty);\n assert (to == ty);\n assert (t == ty);\n let p' : pointer (TArray ln ty) = Pointer from contents pth' in\n let s : array ln (type_of_typ t) = gread h p' in\n let s1 = Seq.slice s (UInt32.v i) (UInt32.v i + 1) in\n let v = gread h p in\n assert (v == Seq.index s (UInt32.v i));\n let s2 = Seq.create 1 v in\n assert (Seq.length s1 == 1);\n assert (Seq.length s2 == 1);\n assert (Seq.index s1 0 == v);\n assert (Seq.index s2 0 == v);\n assert (Seq.equal s1 s2)\n | _ ->\n Seq.slice_length (Seq.create 1 (gread h p))\n#pop-options\n\nlet buffer_as_seq_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray length t))\n= let s : array length (type_of_typ t) = gread h p in\n Seq.slice_length s\n\nlet buffer_as_seq_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Seq.slice_slice (buffer_root_as_seq h (Buffer?.broot b)) (UInt32.v (Buffer?.bidx b)) (UInt32.v (Buffer?.bidx b) + UInt32.v (Buffer?.blength b)) (UInt32.v i) (UInt32.v i + UInt32.v len)\n\nlet gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i\n= match Buffer?.broot b with\n | BufferRootSingleton p -> p\n | BufferRootArray p ->\n gcell p FStar.UInt32.(Buffer?.bidx b +^ i)\n\nlet pointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i\n= match Buffer?.broot b with\n | BufferRootSingleton p -> p\n | BufferRootArray p ->\n _cell p FStar.UInt32.(Buffer?.bidx b +^ i)\n\nlet gpointer_of_buffer_cell_gsub_buffer\n (#t: typ)\n (b: buffer t)\n i1 len i2\n= ()\n\nlet live_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n i h\n= ()\n\n#set-options \"--initial_ifuel 2 --max_ifuel 2\"\nlet gpointer_of_buffer_cell_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n i\n= ()\n\n#set-options \"--initial_ifuel 1 --max_ifuel 1\"\nlet gpointer_of_buffer_cell_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (p: pointer (TArray length t))\n i\n= ()\n\nlet frameOf_gpointer_of_buffer_cell #t b i = ()\n\nlet as_addr_gpointer_of_buffer_cell #t b i = ()\n\nlet gread_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()\n\nlet gread_gpointer_of_buffer_cell'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()\n\nlet index_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()\n\nlet gsingleton_buffer_of_pointer_gcell #t #len p i = ()\n\nlet gsingleton_buffer_of_pointer_gpointer_of_buffer_cell #t b i = ()\n\n(* The readable permission lifted to buffers. *)\n\nlet buffer_readable'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )\n\nlet buffer_readable\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0\n= buffer_readable' h b\n\nlet buffer_readable_buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()\n\nlet buffer_readable_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n= let phi () : Lemma\n (requires (buffer_readable h (gsingleton_buffer_of_pointer p)))\n (ensures (readable h p))\n = assert (readable h (gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) 0ul))\n in\n Classical.move_requires phi ()\n\nlet buffer_readable_gbuffer_of_array_pointer\n (#len: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray len t))\n= let phi ()\n : Lemma\n (requires (buffer_readable h (gbuffer_of_array_pointer p)))\n (ensures (readable h p))\n = let psi\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n : Lemma\n (readable h (gcell p i))\n = assert (readable h (gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i))\n in\n Classical.forall_intro psi;\n readable_array h p\n in\n Classical.move_requires phi ()\n\nlet buffer_readable_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n len\n= Classical.forall_intro (Classical.move_requires (gpointer_of_buffer_cell_gsub_buffer b i len))\n\nlet readable_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n i\n= ()\n\nlet buffer_readable_intro\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n= ()\n\nlet buffer_readable_elim #t h b = ()\n\n(*** Disjointness of pointers *)\n\nlet disjoint\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot Type0\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n Pointer?.from p1 == Pointer?.from p2 /\\\n Pointer?.contents p1 == Pointer?.contents p2 /\\\n path_disjoint (Pointer?.p p1) (Pointer?.p p2)\n else\n True\n\nlet disjoint_root\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))\n (ensures (disjoint p1 p2))\n= ()\n\nlet disjoint_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (fd1 <> fd2))\n (ensures (disjoint (gfield p fd1) (gfield p fd2)))\n [SMTPat (disjoint (gfield p fd1) (gfield p fd2))]\n= ()\n\nlet disjoint_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n UInt32.v i1 <> UInt32.v i2\n ))\n (ensures (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n disjoint (gcell p i1) (gcell p i2)\n ))\n [SMTPat (disjoint (gcell p i1) (gcell p i2))]\n= ()\n\nlet disjoint_includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n (#value1': typ)\n (#value2': typ)\n (p1': pointer value1')\n (p2': pointer value2')\n: Lemma\n (requires (includes p1 p1' /\\ includes p2 p2' /\\ disjoint p1 p2))\n (ensures (disjoint p1' p2'))\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n path_disjoint_includes (Pointer?.p p1) (Pointer?.p p2) (Pointer?.p p1') (Pointer?.p p2')\n else\n ()\n\nlet disjoint_ind\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 {disjoint p1 p2} ) ->\n GTot Type0))\n (h_root:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2 { frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2 } ) ->\n Lemma (x p1 p2)))\n (h_field:\n ((#l: struct_typ) ->\n (p: pointer (TStruct l)) ->\n (fd1: struct_field l) ->\n (fd2: struct_field l { fd1 <> fd2 /\\ disjoint (gfield p fd1) (gfield p fd2) } ) ->\n Lemma (x (gfield p fd1) (gfield p fd2))))\n (h_cell:\n ((#length: array_length_t) ->\n (#value: typ) ->\n (p: pointer (TArray length value)) ->\n (i1: UInt32.t {UInt32.v i1 < UInt32.v length}) ->\n (i2: UInt32.t {UInt32.v i2 < UInt32.v length /\\ UInt32.v i1 <> UInt32.v i2 /\\ disjoint (gcell p i1) (gcell p i2) }) ->\n Lemma (x (gcell p i1) (gcell p i2))\n ))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: pointer value1) ->\n (p2: pointer value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': pointer value1' {includes p1 p1'}) ->\n (p2': pointer value2' {includes p2 p2' /\\ disjoint p1 p2 /\\ disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2 { disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then\n let (Pointer from contents _) = p1 in\n path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> x (Pointer from contents p1_) (Pointer from contents p2_))\n (fun #through #to1 #to2 p s1 s2 ->\n match s1 with\n | StepField l fd1 ->\n let (StepField _ fd2) = s2 in\n h_field #l (Pointer from contents p) fd1 fd2\n | StepCell le va i1 ->\n let (StepCell _ _ i2) = s2 in\n h_cell #le #va (Pointer from contents p) i1 i2\n )\n (fun #v1 #v2 p1_ p2_ #v1' #v2' p1' p2' -> h_includes (Pointer from contents p1_) (Pointer from contents p2_) (Pointer from contents p1') (Pointer from contents p2'))\n (Pointer?.p p1)\n (Pointer?.p p2);\n assert (x p1 p2)\n else\n h_root p1 p2\n\nlet disjoint_sym\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (disjoint p1 p2))\n (ensures (disjoint p2 p1))\n= disjoint_ind\n (fun #v1 #v2 p1 p2 -> disjoint p2 p1)\n (fun #v1 #v2 p1 p2 -> disjoint_root p2 p1)\n (fun #l p fd1 fd2 -> disjoint_gfield p fd2 fd1)\n (fun #le #va p i1 i2 -> disjoint_gcell p i2 i1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> disjoint_includes p2 p1 p2' p1')\n p1 p2\n\nlet disjoint_sym'\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires True)\n (ensures (disjoint p1 p2 <==> disjoint p2 p1))\n [SMTPat (disjoint p1 p2)]\n= FStar.Classical.move_requires (disjoint_sym #value1 #value2 p1) p2;\n FStar.Classical.move_requires (disjoint_sym #value2 #value1 p2) p1\n\nlet disjoint_sym''\n (value1: typ)\n (value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (ensures (disjoint p1 p2 <==> disjoint p2 p1))\n= disjoint_sym' p1 p2\n\nlet disjoint_includes_l #a #es #a' (x: pointer a) (subx:pointer es) (y:pointer a') : Lemma\n (requires (includes x subx /\\ disjoint x y))\n (ensures (disjoint subx y))\n [SMTPat (disjoint subx y); SMTPat (includes x subx)]\n = disjoint_includes x y subx y\n\nlet disjoint_includes_l_swap #a #es #a' (x:pointer a) (subx:pointer es) (y:pointer a') : Lemma\n (requires (includes x subx /\\ disjoint x y))\n (ensures (disjoint y subx))\n [SMTPat (disjoint y subx); SMTPat (includes x subx)]\n = disjoint_includes_l x subx y;\n disjoint_sym subx y\n\nlet disjoint_includes_r\n #t1 #t2 #t3\n (p1: pointer t1)\n (p2: pointer t2)\n (p3: pointer t3)\n: Lemma\n (requires (disjoint p1 p2 /\\ includes p2 p3))\n (ensures (disjoint p1 p3))\n [SMTPat (disjoint p1 p2); SMTPat (includes p2 p3)]\n= disjoint_sym p1 p2;\n disjoint_includes_l_swap p2 p3 p1\n\n(* TODO: The following is now wrong, should be replaced with readable\n\nlet live_not_equal_disjoint\n (#t: typ)\n (h: HS.mem)\n (p1 p2: pointer t)\n: Lemma\n (requires (live h p1 /\\ live h p2 /\\ equal p1 p2 == false))\n (ensures (disjoint p1 p2))\n= if\n frameOf p1 = frameOf p2 &&\n as_addr p1 = as_addr p2\n then begin\n let c1 = greference_of p1 in\n let c2 = greference_of p2 in\n HS.lemma_same_addrs_same_types_same_refs h c1 c2;\n not_path_equal_path_disjoint_same_type p1.p p2.p\n end else\n disjoint_root p1 p2\n*)\n\n\n(*** The modifies clause *)\n\nnoeq\ntype loc_aux =\n | LocBuffer:\n (#t: typ) ->\n (b: buffer t) ->\n loc_aux\n | LocPointer:\n (#t: typ) ->\n (p: pointer t) ->\n loc_aux\n\n(* Necessary to handle `exists` *)\n\nlet buffer_includes_pointer\n (#t1 #t2: typ)\n (b: buffer t1)\n (p: pointer t2)\n: GTot Type0\n= exists (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p\n\nlet loc_aux_includes_pointer\n (s: loc_aux)\n (#t: typ)\n (p: pointer t)\n: GTot Type0\n= match s with\n | LocPointer p' ->\n p' `includes` p\n | LocBuffer b ->\n buffer_includes_pointer b p\n\nlet loc_aux_includes_pointer_trans\n (s: loc_aux)\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (loc_aux_includes_pointer s p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_includes_pointer s p2))\n= match s with\n | LocPointer p -> includes_trans p p1 p2\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p1))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p2))\n = includes_trans (gpointer_of_buffer_cell b i) p1 p2\n in\n Classical.forall_intro (Classical.move_requires f)\n\n(* Same problem *)\n\nlet loc_aux_includes_buffer\n (s: loc_aux)\n (#t: typ)\n (b: buffer t)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> loc_aux_includes_pointer s (gpointer_of_buffer_cell b i)\n\nlet loc_aux_includes\n (s: loc_aux)\n (s2: loc_aux)\n: GTot Type0\n (decreases s2)\n= match s2 with\n | LocPointer p ->\n loc_aux_includes_pointer s p\n | LocBuffer b ->\n loc_aux_includes_buffer s b\n\nlet loc_aux_includes_refl'\n (s: loc_aux)\n: Lemma\n (ensures (loc_aux_includes s s))\n= ()\n\n(* FIXME: WHY WHY WHY do I need to duplicate the lemma? Because Classical.forall_intro DOES NOT UNIFY/typecheck if there is a pattern *)\nlet loc_aux_includes_refl''\n (s: loc_aux)\n: Lemma\n (loc_aux_includes s s)\n [SMTPat (loc_aux_includes s s)]\n= loc_aux_includes_refl' s\n\nlet loc_aux_includes_loc_aux_includes_pointer\n (s1: loc_aux)\n (s2: loc_aux)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_pointer s2 p))\n (ensures (loc_aux_includes_pointer s1 p))\n= match s2 with\n | LocPointer p' ->\n loc_aux_includes_pointer_trans s1 p' p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p))\n (ensures (loc_aux_includes_pointer s1 p))\n = loc_aux_includes_pointer_trans s1 (gpointer_of_buffer_cell b i) p\n in\n Classical.forall_intro (Classical.move_requires f)\n\nlet loc_aux_includes_trans\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= match s3 with\n | LocPointer p ->\n loc_aux_includes_loc_aux_includes_pointer s1 s2 p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_aux_includes_pointer s1 (gpointer_of_buffer_cell b i)))\n = loc_aux_includes_loc_aux_includes_pointer s1 s2 (gpointer_of_buffer_cell b i)\n in\n Classical.forall_intro (Classical.move_requires f)\n\n(* the following is necessary because `decreases` messes up 2nd-order unification with `Classical.forall_intro_3` *)\n\nlet loc_aux_includes_trans'\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\n= Classical.move_requires (loc_aux_includes_trans s1 s2) s3\n\n\n(* Disjointness of two memory locations *)\n\nlet disjoint_buffer_vs_pointer\n (#t1 #t2: typ)\n (b: buffer t1)\n (p: pointer t2)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> disjoint (gpointer_of_buffer_cell b i) p\n\nlet loc_aux_disjoint_pointer\n (l: loc_aux)\n (#t: typ)\n (p: pointer t)\n: GTot Type0\n= match l with\n | LocPointer p' -> disjoint p' p\n | LocBuffer b -> disjoint_buffer_vs_pointer b p\n\nlet loc_aux_disjoint_buffer\n (l: loc_aux)\n (#t: typ)\n (b: buffer t)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> loc_aux_disjoint_pointer l (gpointer_of_buffer_cell b i)\n\nlet loc_aux_disjoint_buffer_sym\n (#t1 #t2: typ)\n (b1: buffer t1)\n (b2: buffer t2)\n: Lemma\n (loc_aux_disjoint_buffer (LocBuffer b1) b2 <==> loc_aux_disjoint_buffer (LocBuffer b2) b1)\n= Classical.forall_intro_2 (disjoint_sym'' t1 t2)\n\nlet loc_aux_disjoint_pointer_buffer_sym\n (#t1 #t2: typ)\n (b1: buffer t1)\n (p2: pointer t2)\n: Lemma\n (loc_aux_disjoint_pointer (LocBuffer b1) p2 <==> loc_aux_disjoint_buffer (LocPointer p2) b1)\n= Classical.forall_intro_2 (disjoint_sym'' t1 t2)\n\nlet loc_aux_disjoint\n (l1 l2: loc_aux)\n: GTot Type0\n (decreases l2)\n= match l2 with\n | LocPointer p ->\n loc_aux_disjoint_pointer l1 p\n | LocBuffer b ->\n loc_aux_disjoint_buffer l1 b\n\nlet loc_aux_disjoint_sym\n (l1 l2: loc_aux)\n: Lemma\n (ensures (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1))\n=\n begin match (l1, l2) with\n | (LocPointer p1, LocPointer p2) -> disjoint_sym' p1 p2\n | (LocPointer p1, LocBuffer b2) -> loc_aux_disjoint_pointer_buffer_sym b2 p1\n | (LocBuffer b1, LocPointer p2) -> loc_aux_disjoint_pointer_buffer_sym b1 p2\n | (LocBuffer b1, LocBuffer b2) -> loc_aux_disjoint_buffer_sym b1 b2\n end\n\n(* Same problem with decreases here *)\n\nlet loc_aux_disjoint_sym'\n (l1 l2: loc_aux)\n: Lemma\n (loc_aux_disjoint l1 l2 <==> loc_aux_disjoint l2 l1)\n= loc_aux_disjoint_sym l1 l2\n\nlet loc_aux_disjoint_pointer_includes\n (l: loc_aux)\n (#t1: typ)\n (p1: pointer t1)\n (#t2: typ)\n (p2: pointer t2)\n: Lemma\n (requires (loc_aux_disjoint_pointer l p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_disjoint_pointer l p2))\n= ()\n\nlet loc_aux_disjoint_loc_aux_includes_pointer\n (l1 l2: loc_aux)\n (#t3: typ)\n (p3: pointer t3)\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes_pointer l2 p3))\n (ensures (loc_aux_disjoint_pointer l1 p3))\n= match l2 with\n | LocPointer p2 ->\n loc_aux_disjoint_pointer_includes l1 p2 p3\n | LocBuffer b2 ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b2) /\\\n gpointer_of_buffer_cell b2 i `includes` p3\n ))\n (ensures (loc_aux_disjoint_pointer l1 p3))\n = loc_aux_disjoint_pointer_includes l1 (gpointer_of_buffer_cell b2 i) p3\n in\n Classical.forall_intro (Classical.move_requires f)\n\nlet loc_aux_disjoint_loc_aux_includes\n (l1 l2 l3: loc_aux)\n: Lemma\n (requires (loc_aux_disjoint l1 l2 /\\ loc_aux_includes l2 l3))\n (ensures (loc_aux_disjoint l1 l3))\n= match l3 with\n | LocPointer p3 ->\n loc_aux_disjoint_loc_aux_includes_pointer l1 l2 p3\n | LocBuffer b3 ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b3)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b3) /\\\n loc_aux_disjoint_pointer l1 (gpointer_of_buffer_cell b3 i)\n ))\n = loc_aux_disjoint_loc_aux_includes_pointer l1 l2 (gpointer_of_buffer_cell b3 i)\n in\n Classical.forall_intro (Classical.move_requires f)\n\nlet pointer_preserved\n (#t: typ)\n (p: pointer t)\n (h h' : HS.mem)\n: GTot Type0\n= equal_values h p h' p\n\nlet buffer_preserved\n (#t: typ)\n (b: buffer t)\n (h h' : HS.mem)\n: GTot Type0\n= forall (i: FStar.UInt32.t) . FStar.UInt32.v i < FStar.UInt32.v (buffer_length b) ==> pointer_preserved (gpointer_of_buffer_cell b i) h h'\n\nlet loc_aux_preserved (l: loc_aux) (h h' : HS.mem) : GTot Type0 =\n match l with\n | LocBuffer b -> buffer_preserved b h h'\n | LocPointer p -> pointer_preserved p h h'\n\nlet pointer_preserved_intro\n (#t: typ)\n (p: pointer t)\n (h1 h2 : HS.mem)\n (f: (\n (a' : Type0) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ frameOf p == HS.frameOf r' /\\ as_addr p == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (pointer_preserved p h1 h2)\n= let g () : Lemma\n (requires (live h1 p))\n (ensures (pointer_preserved p h1 h2))\n = f _ _ (greference_of p)\n in\n Classical.move_requires g ()\n\nlet buffer_preserved_intro\n (#t: typ)\n (p: buffer t)\n (h1 h2 : HS.mem)\n (f: (\n (a' : Type0) ->\n (pre: Preorder.preorder a') ->\n (r': HS.mreference a' pre) ->\n Lemma\n (requires (h1 `HS.contains` r' /\\ frameOf_buffer p == HS.frameOf r' /\\ buffer_as_addr p == HS.as_addr r'))\n (ensures (h2 `HS.contains` r' /\\ h1 `HS.sel` r' == h2 `HS.sel` r'))\n ))\n: Lemma\n (buffer_preserved p h1 h2)\n= let g\n (i: FStar.UInt32.t { FStar.UInt32.v i < FStar.UInt32.v (buffer_length p) } )\n : Lemma\n (ensures (pointer_preserved (gpointer_of_buffer_cell p i) h1 h2))\n = pointer_preserved_intro (gpointer_of_buffer_cell p i) h1 h2 f\n in\n Classical.forall_intro g\n\nlet disjoint_not_self\n (#t: typ)\n (p: pointer t)\n: Lemma\n (disjoint p p ==> False)\n= Classical.move_requires (path_disjoint_not_path_equal (Pointer?.p p)) (Pointer?.p p)\n\nlet loc_aux_in_addr\n (l: loc_aux)\n (r: HS.rid)\n (n: nat)\n: GTot Type0\n= match l with\n | LocBuffer b ->\n frameOf_buffer b == r /\\\n buffer_as_addr b == n\n | LocPointer p ->\n frameOf p == r /\\\n as_addr p == n\n\nlet aloc (r: HS.rid) (n: nat) : Tot Type0 =\n (l: loc_aux { loc_aux_in_addr l r n } )\n\nmodule MG = FStar.ModifiesGen\n\nlet cls : MG.cls aloc = MG.Cls #aloc\n (fun #r #a -> loc_aux_includes)\n (fun #r #a x -> ())\n (fun #r #a -> loc_aux_includes_trans)\n (fun #r #a -> loc_aux_disjoint)\n (fun #r #a -> loc_aux_disjoint_sym)\n (fun #r #a larger1 larger2 smaller1 smaller2 ->\n loc_aux_disjoint_loc_aux_includes larger1 larger2 smaller2;\n loc_aux_disjoint_sym larger1 smaller2;\n loc_aux_disjoint_loc_aux_includes smaller2 larger1 smaller1;\n loc_aux_disjoint_sym smaller2 smaller1\n )\n (fun #r #a -> loc_aux_preserved)\n (fun #r #a x h -> ())\n (fun #r #a x h1 h2 h3 -> ())\n (fun #r #a b h1 h2 f ->\n match b with\n | LocPointer p -> pointer_preserved_intro p h1 h2 f\n | LocBuffer p -> buffer_preserved_intro p h1 h2 f\n )\n\nlet loc = MG.loc cls\n\nlet loc_none = MG.loc_none\n\nlet loc_union = MG.loc_union\n\nlet loc_union_idem = MG.loc_union_idem\n\nlet loc_pointer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p)\n\nlet loc_buffer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf_buffer p) #(buffer_as_addr p) (LocBuffer p)\n\nlet loc_addresses = MG.loc_addresses #_ #cls false\n\nlet loc_regions = MG.loc_regions false\n\nlet loc_includes = MG.loc_includes\n\nlet loc_includes_refl = MG.loc_includes_refl\n\nlet loc_includes_trans = MG.loc_includes_trans\n\nlet loc_includes_union_r = MG.loc_includes_union_r\n\nlet loc_includes_union_l = MG.loc_includes_union_l\n\nlet loc_includes_none = MG.loc_includes_none\n\nlet loc_includes_pointer_pointer #t1 #t2 p1 p2 =\n MG.loc_includes_aloc #_ #cls #(frameOf p1) #(as_addr p1) (LocPointer p1) (LocPointer p2)\n\nlet loc_includes_gsingleton_buffer_of_pointer l #t p =\n MG.loc_includes_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p) (LocBuffer (gsingleton_buffer_of_pointer p));\n MG.loc_includes_trans l (loc_pointer p) (loc_buffer (gsingleton_buffer_of_pointer p))\n\nlet loc_includes_gbuffer_of_array_pointer l #len #t p =\n MG.loc_includes_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p) (LocBuffer (gbuffer_of_array_pointer p));\n MG.loc_includes_trans l (loc_pointer p) (loc_buffer (gbuffer_of_array_pointer p))\n\nlet loc_includes_gpointer_of_array_cell l #t b i =\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b) (LocPointer (gpointer_of_buffer_cell b i));\n MG.loc_includes_trans l (loc_buffer b) (loc_pointer (gpointer_of_buffer_cell b i))\n\nlet loc_includes_gsub_buffer_r l #t b i len =\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b) (LocBuffer (gsub_buffer b i len));\n MG.loc_includes_trans l (loc_buffer b) (loc_buffer (gsub_buffer b i len))\n\nlet loc_includes_gsub_buffer_l #t b i1 len1 i2 len2 =\n let b1 = gsub_buffer b i1 len1 in\n let b2 = gsub_buffer b1 (FStar.UInt32.sub i2 i1) len2 in\n MG.loc_includes_aloc #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b1) (LocBuffer b2)\n\nlet loc_includes_addresses_pointer #t r s p =\n MG.loc_includes_addresses_aloc #_ #cls false r s #(as_addr p) (LocPointer p)\n\nlet loc_includes_addresses_buffer #t r s p =\n MG.loc_includes_addresses_aloc #_ #cls false r s #(buffer_as_addr p) (LocBuffer p)\n\nlet loc_includes_region_pointer #t s p =\n MG.loc_includes_region_aloc #_ #cls false s #(frameOf p) #(as_addr p) (LocPointer p)\n\nlet loc_includes_region_buffer #t s b =\n MG.loc_includes_region_aloc #_ #cls false s #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer b)\n\nlet loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls false false\n\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls false false\n\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l false\n\nlet loc_disjoint = MG.loc_disjoint\n\nlet loc_disjoint_sym = MG.loc_disjoint_sym\n\nlet loc_disjoint_none_r = MG.loc_disjoint_none_r\n\nlet loc_disjoint_union_r = MG.loc_disjoint_union_r\n\nlet loc_disjoint_root #value1 #value2 p1 p2 =\n MG.loc_disjoint_addresses #_ #cls false false (frameOf p1) (frameOf p2) (Set.singleton (as_addr p1)) (Set.singleton (as_addr p2));\n loc_includes_addresses_pointer (frameOf p1) (Set.singleton (as_addr p1)) p1;\n loc_includes_addresses_pointer (frameOf p2) (Set.singleton (as_addr p2)) p2;\n MG.loc_disjoint_includes #_ #cls (loc_addresses (frameOf p1) (Set.singleton (as_addr p1))) (loc_addresses (frameOf p2) (Set.singleton (as_addr p2))) (loc_pointer p1) (loc_pointer p2)\n\nlet loc_disjoint_gfield #l p fd1 fd2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf p) #(as_addr p) #(frameOf p) #(as_addr p) (LocPointer (gfield p fd1)) (LocPointer (gfield p fd2))\n\nlet loc_disjoint_gcell #length #value p i1 i2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf p) #(as_addr p) #(frameOf p) #(as_addr p) (LocPointer (gcell p i1)) (LocPointer (gcell p i2))\n\nlet loc_disjoint_includes = MG.loc_disjoint_includes\n\nlet live_unused_in_disjoint_strong #value1 #value2 h p1 p2 = ()\n\nlet live_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_disjoint_root p1 p2\n\nlet pointer_live_reference_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_includes_addresses_pointer (frameOf p1) (Set.singleton (as_addr p1)) p1;\n loc_includes_refl (MG.loc_freed_mreference p2);\n disjoint_roots_intro_pointer_vs_reference h p1 p2;\n MG.loc_disjoint_addresses #_ #cls false false (frameOf p1) (HS.frameOf p2) (Set.singleton (as_addr p1)) (Set.singleton (HS.as_addr p2));\n MG.loc_disjoint_includes #_ #cls (loc_addresses (frameOf p1) (Set.singleton (as_addr p1))) (MG.loc_freed_mreference p2) (loc_pointer p1) (MG.loc_freed_mreference p2)\n\nlet reference_live_pointer_unused_in_disjoint #value1 #value2 h p1 p2 =\n loc_includes_addresses_pointer (frameOf p2) (Set.singleton (as_addr p2)) p2;\n loc_includes_refl (MG.loc_freed_mreference p1);\n disjoint_roots_intro_reference_vs_pointer h p1 p2;\n MG.loc_disjoint_addresses #_ #cls false false (HS.frameOf p1) (frameOf p2) (Set.singleton (HS.as_addr p1)) (Set.singleton (as_addr p2));\n MG.loc_disjoint_includes #_ #cls (MG.loc_freed_mreference p1) (loc_addresses (frameOf p2) (Set.singleton (as_addr p2))) (MG.loc_freed_mreference p1) (loc_pointer p2)\n\nlet loc_disjoint_gsub_buffer #t b i1 len1 i2 len2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) #(frameOf_buffer b) #(buffer_as_addr b) (LocBuffer (gsub_buffer b i1 len1)) (LocBuffer (gsub_buffer b i2 len2))\n\nlet loc_disjoint_gpointer_of_buffer_cell #t b i1 i2 =\n MG.loc_disjoint_aloc_intro #_ #cls #(frameOf_buffer b) #(buffer_as_addr b) #(frameOf_buffer b) #(buffer_as_addr b) (LocPointer (gpointer_of_buffer_cell b i1)) (LocPointer (gpointer_of_buffer_cell b i2))\n\nlet loc_disjoint_addresses = MG.loc_disjoint_addresses #_ #cls false false\n\nlet loc_disjoint_pointer_addresses #t p r n =\n loc_disjoint_includes (loc_addresses (frameOf p) (Set.singleton (as_addr p))) (loc_addresses r n) (loc_pointer p) (loc_addresses r n)\n\nlet loc_disjoint_buffer_addresses #t p r n =\n loc_disjoint_includes (loc_addresses (frameOf_buffer p) (Set.singleton (buffer_as_addr p))) (loc_addresses r n) (loc_buffer p) (loc_addresses r n)\n\nlet loc_disjoint_regions = MG.loc_disjoint_regions #_ #cls false false\n\nlet modifies = MG.modifies\n\nlet modifies_loc_regions_intro rs h1 h2 =\n MG.modifies_loc_regions_intro #_ #cls rs h1 h2;\n MG.loc_includes_region_region #_ #cls false true rs rs;\n MG.modifies_loc_includes (loc_regions rs) h1 h2 (MG.loc_regions true rs)\n\nlet modifies_pointer_elim s h1 h2 #a' p' =\n MG.modifies_aloc_elim #_ #_ #(frameOf p') #(as_addr p') (LocPointer p') s h1 h2\n\nval modifies_buffer_elim'\n (#t1: typ)\n (b: buffer t1)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_buffer b) p /\\\n buffer_live h b /\\\n UInt32.v (buffer_length b) > 0 /\\\n modifies p h h'\n ))\n (ensures (\n buffer_live h' b /\\ (\n buffer_readable h b ==> (\n\tbuffer_readable h' b /\\\n\tbuffer_as_seq h b == buffer_as_seq h' b\n ))))\n\nlet modifies_buffer_elim' #t1 b p h h' =\n Classical.forall_intro_2 HS.lemma_tip_top;\n loc_disjoint_sym (loc_buffer b) p;\n let n = UInt32.v (buffer_length b) in\n begin\n assert (n > 0);\n let pre\n (i: UInt32.t)\n : GTot Type0\n = UInt32.v i < n\n in\n let post\n (i: UInt32.t)\n : GTot Type0\n = pre i /\\ (\n\t let q = gpointer_of_buffer_cell b i in\n\t equal_values h q h' q\n )\n in\n let f\n (i: UInt32.t)\n : Lemma\n (requires (pre i))\n (ensures (post i))\n = modifies_pointer_elim p h h' (gpointer_of_buffer_cell b i)\n in\n f 0ul; // for the liveness of the whole buffer\n Classical.forall_intro (Classical.move_requires f);\n assert (buffer_readable h b ==> buffer_readable h' b);\n let g () : Lemma\n (requires (buffer_readable h b))\n (ensures (buffer_as_seq h b == buffer_as_seq h' b))\n = let s = buffer_as_seq h b in\n let s' = buffer_as_seq h' b in\n Seq.lemma_eq_intro s s';\n Seq.lemma_eq_elim s s'\n in\n Classical.move_requires g ()\n end\n\nlet modifies_buffer_elim #t1 b p h h' =\n if buffer_length b = 0ul\n then ()\n else modifies_buffer_elim' b p h h'\n\nlet modifies_reference_elim #t b p h h' =\n MG.loc_includes_addresses_addresses #_ cls false true (HS.frameOf b) (Set.singleton (HS.as_addr b)) (Set.singleton (HS.as_addr b));\n MG.loc_includes_refl p;\n MG.loc_disjoint_includes (MG.loc_freed_mreference b) p (MG.loc_mreference b) p;\n MG.modifies_mreference_elim b p h h'\n\nlet modifies_refl = MG.modifies_refl\n\nlet modifies_loc_includes = MG.modifies_loc_includes\n\nlet modifies_trans = MG.modifies_trans\n\n(** Concrete allocators, getters and setters *)\n\nlet screate\n (value:typ)\n (s: option (type_of_typ value))\n= let h0 = HST.get () in\n let s = match s with\n | Some s -> ovalue_of_value value s\n | _ -> none_ovalue value\n in\n let content: HS.reference pointer_ref_contents =\n HST.salloc (| value, s |)\n in\n let aref = HS.aref_of content in\n let p = Pointer value aref PathBase in\n let h1 = HST.get () in\n assert (HS.aref_live_at h1 aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents));\n let f () : Lemma (\n let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n HS.sel h1 gref == HS.sel h1 content\n )\n = let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n assert (HS.frameOf content == HS.frameOf gref);\n assert (HS.as_addr content == HS.as_addr gref);\n HS.lemma_sel_same_addr h1 content gref\n in\n f ();\n MG.modifies_intro loc_none h0 h1\n (fun _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n (fun r a b ->\n cls.MG.same_mreference_aloc_preserved b h0 h1 (fun _ _ _ -> ())\n )\n ;\n p\n\n// TODO: move to HyperStack?\nlet domain_upd (#a:Type) (h:HS.mem) (x:HS.reference a{HS.live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (HS.upd h x v))))\n = let m = (HS.get_hmap h) in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')\n\nlet ecreate\n (t:typ)\n (r:HS.rid)\n (s: option (type_of_typ t))\n= let h0 = HST.get () in\n let s0 = s in\n let s = match s with\n | Some s -> ovalue_of_value t s\n | _ -> none_ovalue t\n in\n let content: HS.ref pointer_ref_contents =\n HST.ralloc r (| t, s |)\n in\n domain_upd h0 content (| t, s |) ;\n let aref = HS.aref_of content in\n let p = Pointer t aref PathBase in\n let h1 = HST.get () in\n assert (HS.aref_live_at h1 aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents));\n let f () : Lemma (\n let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n HS.sel h1 gref == HS.sel h1 content\n )\n = let gref = HS.greference_of aref pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) in\n assert (HS.frameOf content == HS.frameOf gref);\n assert (HS.as_addr content == HS.as_addr gref);\n HS.lemma_sel_same_addr h1 content gref\n in\n f ();\n MG.modifies_intro loc_none h0 h1\n (fun _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n (fun r a b ->\n cls.MG.same_mreference_aloc_preserved b h0 h1 (fun _ _ _ -> ())\n )\n ;\n p\n\nlet field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n= _field p fd\n\nlet ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n= _ufield p fd\n\nlet cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n i\n= _cell p i\n\nlet reference_of\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Pure (HS.reference pointer_ref_contents)\n (requires (live h p))\n (ensures (fun x ->\n live h p /\\\n x == HS.reference_of h (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\\n HS.frameOf x == HS.frameOf (greference_of p) /\\\n HS.as_addr x == HS.as_addr (greference_of p) /\\\n (forall h' . h' `HS.contains` x <==> h' `HS.contains` (greference_of p)) /\\\n (forall h' . (h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.sel h' x == HS.sel h' (greference_of p))) /\\\n (forall h' z .\n (h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==>\n (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.upd h' x z == HS.upd h' (greference_of p) z)\n )))\n= let x =\n HS.reference_of h (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)\n in\n let f (h' : HS.mem) : Lemma\n ( (exists h' . live h' p) /\\ // necessary to typecheck Classical.forall_intro\n (h' `HS.contains` x <==> h' `HS.contains` (greference_of p)) /\\\n ((h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> HS.sel h' x == HS.sel h' (greference_of p)))\n = let y = greference_of p in\n Classical.move_requires (HS.lemma_sel_same_addr h' y) x;\n Classical.move_requires (HS.lemma_sel_same_addr h' x) y\n in\n let g (z: pointer_ref_contents) (h' : HS.mem) : Lemma (\n (exists h' . live h' p) /\\\n ((h' `HS.contains` x \\/ h' `HS.contains` (greference_of p)) ==> (h' `HS.contains` x /\\ h' `HS.contains` (greference_of p) /\\ HS.upd h' x z == HS.upd h' (greference_of p) z))\n )\n = let y = greference_of p in\n Classical.move_requires (HS.lemma_upd_same_addr h' y x) z;\n Classical.move_requires (HS.lemma_upd_same_addr h' x y) z\n in\n Classical.forall_intro f ;\n Classical.forall_intro_2 g;\n x\n\nlet read\n (#value: typ)\n (p: pointer value)\n= let h = HST.get () in\n let r = reference_of h p in\n HST.witness_region (HS.frameOf r);\n HST.witness_hsref r;\n let (| _ , c |) = !r in\n value_of_ovalue value (path_sel c (Pointer?.p p))\n\nlet is_null\n (#t: typ)\n (p: npointer t)\n= match p with\n | NullPtr -> true\n | _ -> false\n\nlet owrite\n (#a: typ)\n (b: pointer a)\n (z: otype_of_typ a)\n: HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 ->\n live h0 b /\\\n live h1 b /\\\n modifies_1 b h0 h1 /\\ (\n let g = greference_of b in\n let (| _, c1 |) = HS.sel h1 g in\n path_sel c1 (Pointer?.p b) == z\n )))\n= let h0 = HST.get () in\n let r = reference_of h0 b in\n HST.witness_region (HS.frameOf r);\n HST.witness_hsref r;\n let v0 = !r in\n let (| t , c0 |) = v0 in\n let c1 = path_upd c0 (Pointer?.p b) z in\n let v1 = (| t, c1 |) in\n r := v1;\n let h1 = HST.get () in\n let e () : Lemma (\n let gref = greference_of b in (\n HS.frameOf r == HS.frameOf gref /\\\n HS.as_addr r == HS.as_addr gref /\\\n HS.sel h0 gref == v0 /\\\n HS.sel h1 gref == v1\n ))\n = let gref = greference_of b in\n HS.lemma_sel_same_addr h0 r gref;\n HS.lemma_sel_same_addr h1 r gref\n in\n e ();\n let prf_alocs\n (r': HS.rid)\n (a': nat)\n (b' : aloc r' a')\n : Lemma\n (requires (MG.loc_disjoint (MG.loc_of_aloc b') (loc_pointer b)))\n (ensures (cls.MG.aloc_preserved b' h0 h1))\n =\n let f\n (t: typ)\n (p: pointer t)\n : Lemma\n (requires (\n live h0 p /\\\n disjoint b p\n ))\n (ensures (\n equal_values h0 p h1 p\n ))\n = let grefp = greference_of p in\n if frameOf p = frameOf b && as_addr p = as_addr b\n then begin\n HS.lemma_sel_same_addr h0 r grefp;\n HS.lemma_sel_same_addr h1 r grefp;\n path_sel_upd_other' (Pointer?.p b) c0 z (Pointer?.p p)\n end\n else ()\n in\n let f'\n (t: typ)\n (p: pointer t)\n : Lemma\n ( (\n live h0 p /\\\n disjoint b p\n ) ==> (\n equal_values h0 p h1 p\n ))\n = Classical.move_requires (f t) p\n in\n MG.loc_disjoint_aloc_elim #_ #cls #r' #a' #(frameOf b) #(as_addr b) b' (LocPointer b);\n Classical.forall_intro_2 f'\n in\n MG.modifies_intro (loc_pointer b) h0 h1\n (fun _ -> ())\n (fun t' pre' p' ->\n loc_disjoint_sym (MG.loc_mreference p') (loc_pointer b);\n MG.loc_disjoint_aloc_addresses_elim #_ #cls #(frameOf b) #(as_addr b) (LocPointer b) true (HS.frameOf p') (Set.singleton (HS.as_addr p'))\n )\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n prf_alocs\n", "sketch": [ "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates within the `HST.Stack` monad and ensures that the pointer `b` is live in the pre-state. After the operation, it guarantees that `b` remains live, the memory at `b` has been modified, `b` is still readable, and the value at `b` is equal to `z`.\n\nStep 1: The `write` function updates the value at the memory location pointed to by `b` to the new value `z`.\n\nStep 2: The `write` function takes the pointer `b` and the new value `z` as input. It checks if `b` is live in the pre-state, then updates the memory at `b` with the new value `z`. It ensures that `b` remains live, the memory at `b` has been modified, `b` is still readable, and the value at `b` is equal to `z`.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates within the `HST.Stack` monad and ensures that the pointer `b` is live in the pre-state. After the write operation, it guarantees that `b` remains live, the memory at `b` has been modified, `b` is still readable, and the value at `b` is now equal to `z`.\n\nStep 1: The `write` function updates the value at the memory location pointed to by `b` to the new value `z`.\n\nStep 2: The `write` function is implemented by first checking if the pointer `b` is live in the pre-state. Then it modifies the memory at the location pointed to by `b` to store the new value `z`. Finally, it ensures that the pointer `b` remains live, the memory at `b` has been modified, `b` is still readable, and the value at `b` is now equal to `z`.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates in the `HST.Stack` monad and requires that the pointer `b` is live in the current heap. After execution, it ensures that the heap is still live with the pointer `b`, the modification of the heap is restricted to the pointer `b`, the pointer `b` is still readable in the heap, and the value at the pointer `b` is now equal to `z`.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`, and updates the value at the memory location pointed to by `b` to be `z`. The function operates within the context of the heap and stack, ensuring that the memory location pointed to by `b` is live and that the modification is properly tracked.\n\nStep 1: The `write` function updates the value at the memory location pointed to by `b` to be `z`, while ensuring the memory location is live and tracking the modification.\n\nStep 2: We will implement the `write` function by updating the value at the memory location pointed to by `b` to be `z`, and then specifying the preconditions and postconditions to ensure the memory location is live, the modification is properly tracked, and the new value is readable.", "The definition is about a function `write` that takes a pointer `b` to a value of type `a` and a new value `z` of type `a`, and updates the value at the memory location pointed to by `b` to be `z`.\n\nThe implementation involves specifying the preconditions that the memory location pointed to by `b` must be live, and the postconditions that the memory location remains live, the modification is reflected in the heap, the memory location is still readable, and the value at the memory location is now `z`.", "The definition is about a function called \"write\" that takes a pointer to a value of type 'a' and a new value of type 'a', and updates the value at the memory location pointed to by the pointer.\n\nThe implementation involves specifying the preconditions that the memory location pointed to by the pointer must be live, and the postconditions that the memory location remains live, the pointer modifies the memory, the memory location is still readable, and the value at the memory location is equal to the new value.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates in the `HST.Stack` monad and requires that the pointer `b` is live in the heap. After execution, it ensures that the heap is still live at the pointer `b`, the heap has been modified at `b`, `b` is still readable, and the value at `b` is equal to `z`.\n\nStep 2: \nThe `write` function will first check if the pointer `b` is live in the heap. Then it will update the value at the memory location pointed to by `b` with the new value `z`. Finally, it will ensure that the necessary post-conditions are met.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates in the `HST.Stack` monad and ensures that the pointer `b` is live in the pre-state and post-state. It also guarantees that the modification of `b` is the only modification in the heap, and that the new value `z` is readable from the post-state.\n\nStep 1: The `write` function ensures that a pointer to a value can be updated with a new value while maintaining the integrity of the heap.\n\nStep 2: The `write` function will update the value pointed to by `b` with the new value `z`, ensuring that the pointer remains live and readable, and that it is the only modification in the heap.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates in the `HST.Stack` monad and requires that the pointer `b` is live in the current heap. After execution, it ensures that the heap is still live at `b`, the modification is reflected in the heap, the pointer `b` is readable, and the value at `b` is equal to `z`.\n\nStep 1: The `write` function updates the value at the memory location pointed to by `b` to the new value `z`.\nStep 2: The `write` function first checks if the pointer `b` is live in the current heap. Then it updates the value at the memory location pointed to by `b` to `z`, ensuring the necessary post-conditions.", "The `write` function takes a pointer `b` to a value of type `a` and a new value `z` of type `a`. It operates in the `HST.Stack` monad and requires that the pointer `b` is live in the current heap. After execution, it ensures that the heap is still live at the pointer `b`, the heap has been modified at `b`, `b` is still readable, and the value at `b` is equal to `z`.\n\nStep 2: \nThe `write` function will first check if the pointer `b` is live in the current heap. Then it will update the value at the memory location pointed to by `b` to be equal to `z`. It will ensure that the necessary post-conditions are met." ], "generated_solution": [ "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ...", "let write (a: typ) (b: pointer a) (z: type_of_typ a): HST.Stack unit\n (requires (fun h -> live h b))\n (ensures (fun h0 _ h1 -> live h0 b /\\ live h1 b\n /\\ modifies_1 b h0 h1\n /\\ readable h1 b\n /\\ gread h1 b == z )) = \n ..." ] }, { "file_name": "Pulse.Class.BoundedIntegers.fst", "name": "Pulse.Class.BoundedIntegers.nat_as_int", "opens_and_abbrevs": [ { "abbrev": "TC", "full_module": "FStar.Tactics.Typeclasses" }, { "open": "Pulse.Class" }, { "open": "Pulse.Class" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val nat_as_int (x: nat) : int", "source_definition": "let nat_as_int (x:nat) : int = x", "source_range": { "start_line": 152, "start_col": 0, "end_line": 152, "end_col": 32 }, "interleaved": false, "definition": "fun x -> x <: Prims.int", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.nat", "Prims.int" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": false, "type": "x: Prims.nat -> Prims.int", "prompt": "let nat_as_int (x: nat) : int =\n ", "expected_response": "x", "source": { "project_name": "FStar", "file_name": "examples/typeclasses/Pulse.Class.BoundedIntegers.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "Pulse.Class.BoundedIntegers.fst", "checked_file": "dataset/Pulse.Class.BoundedIntegers.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Tactics.Typeclasses.fsti.checked", "dataset/FStar.SizeT.fsti.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "let fits_t (fits:int -> prop) = x:int { fits x }", "bounded_int", "bounded_int", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "class bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x)) \n )\n (* ...todo, add other ops **)\n}", "fits", "fits", "v", "v", "u", "u", "+", "+", "op_Subtraction", "op_Subtraction", "<", "<", "<=", "<=", "%", "%", "properties", "properties", "instance bounded_int_int : bounded_int int = {\n fits = (fun _ -> True);\n v = id;\n u = id;\n ( + ) = (fun x y -> Prims.op_Addition x y);\n op_Subtraction = (fun x y -> Prims.op_Subtraction x y);\n ( < ) = (fun x y -> Prims.op_LessThan x y);\n ( <= ) = (fun x y -> Prims.op_LessThanOrEqual x y);\n ( % ) = (fun x y -> Prims.op_Modulus x y);\n properties = ()\n}", "bounded_unsigned", "bounded_unsigned", "class bounded_unsigned (t:eqtype) = {\n [@@@TC.no_method]\n base:bounded_int t;\n max_bound:t;\n [@@@TC.no_method] \n static_max_bound: bool;\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). v x >= 0 /\\ (static_max_bound ==> v x <= v max_bound)) /\\\n (forall (x:nat). x <= v max_bound ==> fits #t x)\n )\n}", "base", "base", "max_bound", "max_bound", "static_max_bound", "static_max_bound", "properties", "properties", "instance bounded_from_bounded_unsigned (t:eqtype) (c:bounded_unsigned t) : bounded_int t = c.base", "let safe_add (#t:eqtype) {| c: bounded_unsigned t |} (x y : t)\n : o:option t { Some? o ==> v (Some?.v o) == v x + v y } \n = if c.static_max_bound\n then (\n assert ( x <= max_bound);\n if (y <= max_bound - x) \n then Some (x + y)\n else None\n )\n else (\n if x <= max_bound\n then (\n assert (fits #t (v (max_bound #t) - v x));\n if (y <= max_bound - x)\n then Some (x + y)\n else None\n )\n else None\n )", "let safe_mod (#t:eqtype) {| c: bounded_unsigned t |} (x : t) (y : t)\n : Pure (option t)\n (requires v y > 0)\n (ensures fun o -> Some? o ==> v (Some?.v o) == v x % v y)\n = if c.static_max_bound\n then Some (x % y)\n else (\n if y <= max_bound\n then (\n assert (fits #t (v x % v y));\n Some (x % y)\n )\n else None\n )", "let ok (#t:eqtype) {| c:bounded_int t |} (op: int -> int -> int) (x y:t) =\n c.fits (op (v x) (v y))", "let add (#t:eqtype) {| bounded_int t |} (x:t) (y:t { ok (+) x y }) = x + y", "let add3 (#t:eqtype) {| bounded_int t |} (x:t) (y:t) (z:t { ok (+) x y /\\ ok (+) z (x + y)}) = x + y + z", "let add3_alt (#t:eqtype) {| bounded_int t |} (x:t) (y:t) (z:t { ok (+) x y /\\ ok (+) (x + y) z}) = x + y + z", "instance bounded_int_u32 : bounded_int FStar.UInt32.t = {\n fits = (fun x -> 0 <= x /\\ x < 4294967296);\n v = (fun x -> FStar.UInt32.v x);\n u = FStar.UInt32.uint_to_t;\n ( + ) = (fun x y -> FStar.UInt32.add x y);\n op_Subtraction = (fun x y -> FStar.UInt32.sub x y);\n ( < ) = FStar.UInt32.(fun x y -> x <^ y);\n ( <= ) = FStar.UInt32.(fun x y -> x <=^ y);\n ( % ) = FStar.UInt32.(fun x y -> x %^ y);\n properties = ()\n}", "instance bounded_unsigned_u32 : bounded_unsigned FStar.UInt32.t = {\n base = TC.solve;\n max_bound = 0xfffffffful;\n static_max_bound = true;\n properties = ()\n}", "instance bounded_int_u64 : bounded_int FStar.UInt64.t = {\n fits = (fun x -> 0 <= x /\\ x <= 0xffffffffffffffff);\n v = (fun x -> FStar.UInt64.v x);\n u = FStar.UInt64.uint_to_t;\n ( + ) = (fun x y -> FStar.UInt64.add x y);\n op_Subtraction = (fun x y -> FStar.UInt64.sub x y);\n ( < ) = FStar.UInt64.(fun x y -> x <^ y);\n ( <= ) = FStar.UInt64.(fun x y -> x <=^ y);\n ( % ) = FStar.UInt64.(fun x y -> x %^ y);\n properties = ()\n}", "instance bounded_unsigned_u64 : bounded_unsigned FStar.UInt64.t = {\n base = TC.solve;\n max_bound = 0xffffffffffffffffuL;\n static_max_bound = true;\n properties = ()\n}", "let test (t:eqtype) {| _ : bounded_unsigned t |} (x:t) = v x", "let add_u32 (x:FStar.UInt32.t) (y:FStar.UInt32.t { ok (+) x y }) = x + y", "let sub_u32 (x:FStar.UInt32.t) (y:FStar.UInt32.t { ok op_Subtraction x y}) = x - y", "let add_nat_1 (x:nat) = x + 1" ], "closest": [ "val nat_as_int (x: nat) : int\nlet nat_as_int (x:nat) : int = x", "val pos_as_int (x: pos) : int\nlet pos_as_int (x:pos) : int = x", "val nat_of (x: int) : nat\nlet nat_of (x:int) : nat = if x < 0 then 0 else x", "val word_to_nat32 (x:word) : nat32\nlet word_to_nat32 = vv", "val word_to_nat32 (x:word) : nat32\nlet word_to_nat32 = vv", "val nat32_to_word (x:nat32) : word\nlet nat32_to_word = to_uint32", "val nat32_to_word (x:nat32) : word\nlet nat32_to_word = to_uint32", "val nat_to_uint (t: ME.base_typ) (x: ME.base_typ_as_vale_type t) : base_typ_as_type t\nlet nat_to_uint (t:ME.base_typ) (x:ME.base_typ_as_vale_type t)\n : base_typ_as_type t\n = let open ME in\n match t with\n | TUInt8 -> UInt8.uint_to_t x\n | TUInt16 -> UInt16.uint_to_t x\n | TUInt32 -> UInt32.uint_to_t x\n | TUInt64 -> UInt64.uint_to_t x\n | TUInt128 -> x", "val two_to_nat32 (x: two nat32) : nat64\nlet two_to_nat32 (x:two nat32) : nat64 = two_to_nat 32 x", "val uint_to_nat (#n: nat) (x: uint_t n) : r: nat{r = x}\nlet uint_to_nat (#n:nat) (x:uint_t n) : r:nat{r = x} =\n assert (x < pow2 n);\n modulo_lemma x (pow2 n);\n x", "val embed_nat_int (n: nat) : int\nlet embed_nat_int (n:nat) : int = n", "val of_nat (x:nat) : poly\nlet rec of_nat x =\n if x = 0 then zero\n else\n let p = shift (of_nat (x / 2)) 1 in\n if x % 2 = 0 then p else p +. one", "val Pulse.Lib.BoundedIntegers.add_nat_1 = x: Prims.nat -> Prims.int\nlet add_nat_1 (x:nat) = x + 1", "val uint_to_nat (t: ME.base_typ) (x: base_typ_as_type t) : ME.base_typ_as_vale_type t\nlet uint_to_nat (t:ME.base_typ) (x:base_typ_as_type t)\n : ME.base_typ_as_vale_type t\n = let open ME in\n match t with\n | TUInt8 -> UInt8.v x\n | TUInt16 -> UInt16.v x\n | TUInt32 -> UInt32.v x\n | TUInt64 -> UInt64.v x\n | TUInt128 -> x", "val seq_uint8_to_seq_nat8 (x: seq UInt8.t) : seq nat8\nlet seq_uint8_to_seq_nat8 (x:seq UInt8.t) : seq nat8 =\n seq_map UInt8.v x", "val nat_to_word (a: alg) (x: size_nat) : word_t a\nlet nat_to_word (a:alg) (x:size_nat) : word_t a =\n match (wt a) with\n | U32 -> u32 x\n | U64 -> u64 x", "val point_x_as_nat (h: mem) (p: point) : GTot nat\nlet point_x_as_nat (h:mem) (p:point) : GTot nat =\n as_nat h (gsub p 0ul 4ul)", "val mul_nats (x y: nat) : nat\nlet mul_nats (x y:nat) : nat =\n let prod = x * y in\n Vale.Curve25519.Fast_lemmas_internal.lemma_mul_bounds_le 0 x 0 y;\n prod", "val pow (x: int) (n: nat) : Tot int\nlet rec pow (x:int) (n:nat) : Tot int =\n if n = 0 then 1\n else x * pow x (n - 1)", "val mk_nat5 (x: nat) : nat5\nlet mk_nat5 (x:nat) : nat5 = (x,x,x,x,x)", "val nat32_xor (x y: nat32) : nat32\nlet nat32_xor (x y:nat32) : nat32 = ixor x y", "val seq_nat8_to_seq_nat32_LE (x: seq nat8 {length x % 4 == 0}) : seq nat32\nlet seq_nat8_to_seq_nat32_LE (x:seq nat8{length x % 4 == 0}) : seq nat32 =\n seq_map (four_to_nat 8) (seq_to_seq_four_LE x)", "val int_to_t (x: int) : Pure t\n (requires (fits x))\n (ensures (fun y -> v y == x))\nlet int_to_t (x: int) : Pure t\n (requires (fits x))\n (ensures (fun y -> v y == x))\n = I64.int_to_t x", "val uint_to_t (x: nat) : Pure t\n (requires (fits x))\n (ensures (fun y -> v y == x))\nlet uint_to_t x =\n U64.uint_to_t x", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\nlet int_to_t x = Mk x", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\nlet int_to_t x = Mk x", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\nlet int_to_t x = Mk x", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\nlet int_to_t x = Mk x", "val int_to_t: x:int_t n -> Pure t\n (requires True)\n (ensures (fun y -> v y = x))\nlet int_to_t x = Mk x", "val factorial (x: nat) : nat\nlet rec factorial (x:nat) : nat =\n match x with\n | 0 -> 1\n | _ -> x + factorial (x - 1)", "val from_felem (x: felem) : nat\nlet from_felem (x:felem) : nat = x", "val seq_nat8_to_seq_uint8 (x: seq nat8) : seq UInt8.t\nlet seq_nat8_to_seq_uint8 (x:seq nat8) : seq UInt8.t =\n seq_map UInt8.uint_to_t x", "val nat_add (a b: nat) : nat\nlet nat_add (a b: nat): nat = a + b", "val f3 (x: nat) : nat\nlet f3 (x : nat) : nat =\n 2 * x", "val FStar.Integers.f_nat = x: FStar.Integers.nat -> y: FStar.Integers.nat\n -> FStar.Integers.int_t (FStar.Integers.Signed FStar.Integers.Winfinite)\nlet f_nat (x:nat) (y:nat) = x + y", "val va_mul_nat (x y: nat) : nat\nlet va_mul_nat (x y:nat) : nat =\n mul_nat_helper x y;\n x * y", "val va_mul_nat (x y: nat) : nat\nlet va_mul_nat (x y:nat) : nat =\n mul_nat_helper x y;\n x * y", "val min_int (n: nat) : Tot int\nlet min_int (n:nat) : Tot int = 0", "val max_int (n: nat) : Tot int\nlet max_int (n:nat) : Tot int = pow2 n - 1", "val seq_nat8_to_seq_nat32_BE (x: seq nat8 {length x % 4 == 0}) : seq nat32\nlet seq_nat8_to_seq_nat32_BE (x:seq nat8{length x % 4 == 0}) : seq nat32 =\n seq_map (four_to_nat 8) (seq_to_seq_four_BE x)", "val pow_int (a: int) (b: nat) : int\nlet rec pow_int (a:int) (b:nat) : int =\n if b = 0 then 1\n else a * pow_int a (b - 1)", "val as_nat5 (f: felem5) : nat\nlet as_nat5 (f:felem5) : nat =\n let (f0, f1, f2, f3, f4) = f in\n v f0 + v f1 * pow52 + v f2 * pow104 + v f3 * pow156 + v f4 * pow208", "val length (#a: Type) (x: t a) : nat\nlet length (#a:Type) (x:t a) : nat = U32.v (len x)", "val seq_nat32_to_seq_nat8_LE (x: seq nat32) : seq nat8\nlet seq_nat32_to_seq_nat8_LE (x:seq nat32) : seq nat8 =\n seq_four_to_seq_LE (seq_map (nat_to_four 8) x)", "val safepred (x: nat) : nat\nlet safepred (x:nat) : nat =\n match x with\n | Z -> Z\n | S x -> x", "val size (n: size_nat) : size_t\nlet size (n:size_nat) : size_t = uint #U32 #PUB n", "val as_nat (h: mem) (f: felem) : GTot nat\nlet as_nat (h:mem) (f:felem) : GTot nat = P.as_nat h f", "val Intro.suc = x: Prims.int -> Prims.int\nlet suc (x:int) = x + 1", "val test_add_1' (x: int) : int\nlet test_add_1' (x:int) : int =\n x + 1", "val seq_nat32_to_seq_nat8_BE (x: seq nat32) : seq nat8\nlet seq_nat32_to_seq_nat8_BE (x:seq nat32) : seq nat8 =\n seq_four_to_seq_BE (seq_map (nat_to_four 8) x)", "val powx : x:int -> n:nat -> Tot int\nlet rec powx x n =\n match n with\n | 0 -> 1\n | n -> x * powx x (n - 1)", "val nat_up_to (n: nat) : eqtype\nlet nat_up_to (n: nat) : eqtype = (i: nat { i <= n })", "val test_add_1 (x: int) : int\nlet test_add_1 (x:int) : int =\n _ by (exact (visit_tm incr_lits_by_1 (quote (x + 1))))", "val int_to_natN (n:pos) (i:int) : j:natN n{0 <= i /\\ i < n ==> i == j}\nlet int_to_natN n i = i % n", "val as_nat (h: mem) (e: qelemB) : GTot nat\nlet as_nat (h:mem) (e:qelemB) : GTot nat =\n let s = as_seq h e in\n as_nat5 (s.[0], s.[1], s.[2], s.[3], s.[4])", "val as_nat5: f:tup64_5 -> nat\nlet as_nat5 f =\n let (s0, s1, s2, s3, s4) = f in\n v s0 + v s1 * pow26 + v s2 * pow52 + v s3 * pow78 + v s4 * pow104", "val as_nat (h: mem) (e: felem) : GTot nat\nlet as_nat (h:mem) (e:felem) : GTot nat =\n BD.bn_v (as_seq h e)", "val as_nat (h: mem) (e: felem) : GTot nat\nlet as_nat (h:mem) (e:felem) : GTot nat =\n as_nat5 (as_felem5 h e)", "val as_nat (h: mem) (e: felem) : GTot nat\nlet as_nat (h:mem) (e:felem) : GTot nat =\n let s = as_seq h e in\n let s0 = s.[0] in\n let s1 = s.[1] in\n let s2 = s.[2] in\n let s3 = s.[3] in\n S.as_nat4 (s0, s1, s2, s3)", "val nat_t_of_nat (n: nat) : Type0\nlet rec nat_t_of_nat (n: nat): Type0 =\n match n with\n | 0 -> z\n | n -> s (nat_t_of_nat (n - 1))", "val nat_t_of_nat (n: nat) : Type0\nlet rec nat_t_of_nat (n: nat): Type0 =\n match n with\n | 0 -> z\n | n -> s (nat_t_of_nat (n - 1))", "val evar (x: var) : Tot (exp int)\nlet evar (x: var) : Tot (exp int) = fun _ -> read x", "val wide_as_nat (h: mem) (e: widefelem) : GTot nat\nlet wide_as_nat (h:mem) (e:widefelem) : GTot nat =\n BD.bn_v (as_seq h e)", "val Pulse.Lib.BoundedIntegers.add_nat = x: Prims.nat -> y: Prims.nat -> Prims.nat\nlet add_nat (x y:nat) = x + y", "val var_as_namedv (v: nat) : namedv\nlet var_as_namedv (v:nat) : namedv =\n pack_namedv {\n uniq = v;\n sort = sort_default;\n ppname = pp_name_default;\n }", "val h (x y: Prims.nat) : nat\nlet h (x:Prims.nat) (y:Prims.nat): nat = u x + u y", "val size (x: int) (n: nat) : Tot Type0\nlet size (x:int) (n:nat) : Tot Type0 = b2t(fits x n)", "val to_char (x: nat{x <= 255}) : char\nlet to_char (x : nat{x <= 255}) : char =\n (**) assert_norm(255 < pow2 21);\n Char.char_of_u32 (FStar.UInt32.uint_to_t x)", "val log_2: x:pos -> Tot nat\nlet rec log_2 x =\n if x >= 2 then 1 + log_2 (x / 2) else 0", "val aff_point_x_as_nat (h: mem) (p: aff_point) : GTot nat\nlet aff_point_x_as_nat (h:mem) (p:aff_point) : GTot nat =\n as_nat h (gsub p 0ul 4ul)", "val as_nat4: f:felem4 -> GTot nat\nlet as_nat4 f =\n let (s0, s1, s2, s3) = f in\n v s0 + v s1 * pow2 64 + v s2 * pow2 64 * pow2 64 +\n v s3 * pow2 64 * pow2 64 * pow2 64", "val v (x: t) : Pure nat\n (requires True)\n (ensures (fun y -> fits y))\nlet v x =\n U64.v x", "val two_to_nat (size: nat) (x: two (natN (pow2 size))) : natN (pow2 (2 * size))\nlet two_to_nat (size:nat) (x:two (natN (pow2 size))) : natN (pow2 (2 * size)) =\n two_to_nat_unfold size x", "val concrete_xkey_length (i: impl): Lib.IntTypes.size_nat\nlet concrete_xkey_length (i: impl): nat =\n match i with\n | Vale_AES128\n | Vale_AES256 ->\n vale_xkey_length (cipher_alg_of_impl i)\n | Hacl_CHACHA20 -> 32", "val st_var (x: var) (v: nstype int) : GTot sttype\nlet st_var\n (x: var)\n (v: nstype int)\n: GTot sttype\n= let f (s1 s2: heap) : GTot Type0 = holds v (sel s1 x) (sel s2 x) in\n Classical.forall_intro_2 (holds_equiv f);\n f", "val string_or_int (x: bool) : (if x then string else int)\nlet string_or_int (x:bool)\n : (if x then string else int)\n = if x then \"hello\" else 0", "val to_uint (#n: pos) (x: int_t n) : Tot (UInt.uint_t n)\nlet to_uint (#n:pos) (x:int_t n) : Tot (UInt.uint_t n) = \n if 0 <= x then x else x + pow2 n", "val point_y_as_nat (h: mem) (e: point) : GTot nat\nlet point_y_as_nat (h:mem) (e:point) : GTot nat =\n as_nat h (gsub e 4ul 4ul)", "val int_of_char (c: char) : nat\nlet int_of_char (c: char) : nat = U32.v (u32_of_char c)", "val as_nat (#s: field_spec) (h: mem) (e: felem s) : GTot nat\nlet as_nat (#s:field_spec) (h:mem) (e:felem s): GTot nat =\n match s with\n | M51 -> f51_as_nat h e\n | M64 -> f64_as_nat h e", "val max_int (n: pos) : Tot int\nlet max_int (n:pos) : Tot int = pow2 (n-1) - 1", "val put (#s: _) (x: s) : st s monoid_nat_plus 1 unit\nlet put #s (x:s) : st s monoid_nat_plus 1 unit = fun _ -> (), x", "val FStar.InteractiveHelpers.ParseTest.simpl_ex1 = x: Prims.nat -> Prims.int\nlet simpl_ex1 (x : nat) =\n let y = 4 in\n let 'x = 7 in\n let 'a = 4 in\n let 'd = \"hello world!\" in\n let '_u''x = 5 in\n let z = 3 in\n let w : w:nat{w >= 10} =\n if x > 3 then\n begin\n assert(y + x > 7);\n let x' = x + 1 in\n assert(y + x' > 8);\n let x'' = 2 * (y + x') in\n assert(x'' > 16);\n assert(x'' >= 10);\n 2 * x'\n end\n else 12\n in\n assert(\n x >= 0 /\\\n y >= 0);\n let w' = 2 * w + z in\n w'", "val testnat (n: nat) : Tac nat\nlet testnat (n:nat) : Tac nat = 42", "val height (#a: Type) (x: tree a) : nat\nlet rec height (#a: Type) (x: tree a) : nat =\n match x with\n | Leaf -> 0\n | Node data left right ->\n if height left > height right then (height left) + 1\n else (height right) + 1", "val FStar.Integers.j = x: Prims.int -> y: Prims.nat\n -> FStar.Integers.int_t (FStar.Integers.Signed FStar.Integers.Winfinite)\nlet j (x:Prims.int) (y:Prims.nat) = x - y", "val nat8_to_byte (b:nat8) : byte\nlet nat8_to_byte = UInt8.uint_to_t", "val wide_as_nat (h: mem) (e: qelem_wide) : GTot nat\nlet wide_as_nat (h:mem) (e:qelem_wide) : GTot nat =\n let s = as_seq h e in\n wide_as_nat5 (s.[0], s.[1], s.[2], s.[3], s.[4], s.[5], s.[6], s.[7], s.[8], s.[9])", "val nat32s_to_nat128 (v1 v2 v3 v4: nat32) : nat128\nlet nat32s_to_nat128 (v1 v2 v3 v4: nat32): nat128 =\n v1 + v2 * 0x100000000 + v3 * 0x1000000000000 + v4 * 0x1000000000000000000000000", "val point: #a:eqtype -> x:a -> y:option a -> nat\nlet point #a x = fun y -> if y = Some x then 1 else 0", "val point: #a:eqtype -> x:a -> y:option a -> nat\nlet point #a x = fun y -> if y = Some x then 1 else 0", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val count (n: nat) : I int\nlet rec count (n:nat) : I int\n = if n = 0 then 0 else count (n-1)", "val from_uint (#n: pos) (x: UInt.uint_t n) : Tot (int_t n)\nlet from_uint (#n:pos) (x:UInt.uint_t n) : Tot (int_t n) = \n if x <= max_int n then x else x - pow2 n", "val as_nat5: f:felem5 -> GTot nat\nlet as_nat5 f =\n let (s0, s1, s2, s3, s4) = f in\n uint_v s0 + (uint_v s1 * pow51) + (uint_v s2 * pow51 * pow51) +\n (uint_v s3 * pow51 * pow51 * pow51) + (uint_v s4 * pow51 * pow51 * pow51 * pow51)", "val where_aux (n: nat) (x: term) (xs: list term) : Tac (option nat)\nlet rec where_aux (n:nat) (x:term) (xs:list term) :\n Tac (option nat) =\n match xs with\n | [] -> None\n | x'::xs' -> if term_eq x x' then Some n else where_aux (n+1) x xs'", "val where_aux (n: nat) (x: term) (xs: list term) : Tac (option nat)\nlet rec where_aux (n:nat) (x:term) (xs:list term) :\n Tac (option nat) =\n match xs with\n | [] -> None\n | x'::xs' -> if term_eq_old x x' then Some n else where_aux (n+1) x xs'", "val where_aux (n: nat) (x: term) (xs: list term) : Tac (option nat)\nlet rec where_aux (n:nat) (x:term) (xs:list term) :\n Tac (option nat) =\n match xs with\n | [] -> None\n | x'::xs' -> if term_eq x x' then Some n else where_aux (n+1) x xs'", "val point_z_as_nat (h: mem) (e: point) : GTot nat\nlet point_z_as_nat (h:mem) (e:point) : GTot nat =\n as_nat h (gsub e 8ul 4ul)" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.BoundedIntegers.fst", "name": "Pulse.Lib.BoundedIntegers.nat_as_int" }, { "project_name": "steel", "file_name": "Pulse.Lib.BoundedIntegers.fst", "name": "Pulse.Lib.BoundedIntegers.pos_as_int" }, { "project_name": "FStar", "file_name": "IfcRecursiveHeapReify.fst", "name": "IfcRecursiveHeapReify.nat_of" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.word_to_nat32" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.word_to_nat32" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.nat32_to_word" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.nat32_to_word" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.LowStarSig.fst", "name": "Vale.AsLowStar.LowStarSig.nat_to_uint" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.Types.fsti", "name": "Vale.Arch.Types.two_to_nat32" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.Bitvectors.fst", "name": "Vale.Poly1305.Bitvectors.uint_to_nat" }, { "project_name": "FStar", "file_name": "FStar.Algebra.Monoid.fst", "name": "FStar.Algebra.Monoid.embed_nat_int" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Bits.fst", "name": "Vale.Math.Poly2.Bits.of_nat" }, { "project_name": "steel", "file_name": "Pulse.Lib.BoundedIntegers.fst", "name": "Pulse.Lib.BoundedIntegers.add_nat_1" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.LowStarSig.fst", "name": "Vale.AsLowStar.LowStarSig.uint_to_nat" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_uint8_to_seq_nat8" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Definitions.fst", "name": "Spec.Blake2.Definitions.nat_to_word" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_x_as_nat" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.Fast_defs.fst", "name": "Vale.Curve25519.Fast_defs.mul_nats" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fsti", "name": "Lib.NatMod.pow" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Definitions.fst", "name": "Hacl.Spec.K256.Field52.Definitions.mk_nat5" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Types_s.fst", "name": "Vale.Def.Types_s.nat32_xor" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_LE" }, { "project_name": "FStar", "file_name": "FStar.PtrdiffT.fst", "name": "FStar.PtrdiffT.int_to_t" }, { "project_name": "FStar", "file_name": "FStar.SizeT.fst", "name": "FStar.SizeT.uint_to_t" }, { "project_name": "FStar", "file_name": "FStar.Int128.fst", "name": "FStar.Int128.int_to_t" }, { "project_name": "FStar", "file_name": "FStar.Int64.fst", "name": "FStar.Int64.int_to_t" }, { "project_name": "FStar", "file_name": "FStar.Int32.fst", "name": "FStar.Int32.int_to_t" }, { "project_name": "FStar", "file_name": "FStar.Int8.fst", "name": "FStar.Int8.int_to_t" }, { "project_name": "FStar", "file_name": "FStar.Int16.fst", "name": "FStar.Int16.int_to_t" }, { "project_name": "FStar", "file_name": "ErrorMsg.fst", "name": "ErrorMsg.factorial" }, { "project_name": "hacl-star", "file_name": "Spec.Poly1305.fst", "name": "Spec.Poly1305.from_felem" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8" }, { "project_name": "zeta", "file_name": "Zeta.SSeq.fst", "name": "Zeta.SSeq.nat_add" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Tutorial.Definitions.fst", "name": "FStar.InteractiveHelpers.Tutorial.Definitions.f3" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.f_nat" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fsti", "name": "Vale.X64.Decls.va_mul_nat" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_mul_nat" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.min_int" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.max_int" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_nat8_to_seq_nat32_BE" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Defs.fsti", "name": "Vale.Bignum.Defs.pow_int" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Definitions.fst", "name": "Hacl.Spec.K256.Field52.Definitions.as_nat5" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.length" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.safepred" }, { "project_name": "hacl-star", "file_name": "Lib.IntTypes.fsti", "name": "Lib.IntTypes.size" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Field51.fst", "name": "Hacl.Impl.Ed25519.Field51.as_nat" }, { "project_name": "FStar", "file_name": "Intro.fst", "name": "Intro.suc" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.test_add_1'" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Seq_s.fsti", "name": "Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE" }, { "project_name": "FStar", "file_name": "FStar.Math.Lib.fst", "name": "FStar.Math.Lib.powx" }, { "project_name": "steel", "file_name": "CDDL.Spec.fsti", "name": "CDDL.Spec.nat_up_to" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.test_add_1" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words_s.fst", "name": "Vale.Def.Words_s.int_to_natN" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.BignumQ.Mul.fsti", "name": "Hacl.Impl.BignumQ.Mul.as_nat" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Poly1305.Field32xN.fst", "name": "Hacl.Spec.Poly1305.Field32xN.as_nat5" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fsti", "name": "Hacl.Impl.P256.Bignum.as_nat" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Field.fsti", "name": "Hacl.K256.Field.as_nat" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Field64.fst", "name": "Hacl.Impl.Curve25519.Field64.as_nat" }, { "project_name": "steel", "file_name": "Pulse.C.Typenat.fsti", "name": "Pulse.C.Typenat.nat_t_of_nat" }, { "project_name": "steel", "file_name": "Steel.C.Typenat.fsti", "name": "Steel.C.Typenat.nat_t_of_nat" }, { "project_name": "FStar", "file_name": "Benton2004.fst", "name": "Benton2004.evar" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fsti", "name": "Hacl.Impl.P256.Bignum.wide_as_nat" }, { "project_name": "steel", "file_name": "Pulse.Lib.BoundedIntegers.fst", "name": "Pulse.Lib.BoundedIntegers.add_nat" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.var_as_namedv" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.h" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.size" }, { "project_name": "noise-star", "file_name": "Impl.Noise.String.fst", "name": "Impl.Noise.String.to_char" }, { "project_name": "FStar", "file_name": "FStar.Math.Lib.fst", "name": "FStar.Math.Lib.log_2" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.aff_point_x_as_nat" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Field64.Definition.fst", "name": "Hacl.Spec.Curve25519.Field64.Definition.as_nat4" }, { "project_name": "FStar", "file_name": "FStar.SizeT.fst", "name": "FStar.SizeT.v" }, { "project_name": "hacl-star", "file_name": "Vale.Def.Words.Two_s.fsti", "name": "Vale.Def.Words.Two_s.two_to_nat" }, { "project_name": "hacl-star", "file_name": "Spec.Cipher.Expansion.fst", "name": "Spec.Cipher.Expansion.concrete_xkey_length" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fsti", "name": "Benton2004.DDCC.st_var" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.string_or_int" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.to_uint" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_y_as_nat" }, { "project_name": "FStar", "file_name": "FStar.Char.fsti", "name": "FStar.Char.int_of_char" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.as_nat" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.max_int" }, { "project_name": "FStar", "file_name": "GradedMonad.fst", "name": "GradedMonad.put" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.simpl_ex1" }, { "project_name": "FStar", "file_name": "UnitTests.fst", "name": "UnitTests.testnat" }, { "project_name": "steel", "file_name": "Trees.fst", "name": "Trees.height" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.j" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.nat8_to_byte" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.BignumQ.Mul.fsti", "name": "Hacl.Impl.BignumQ.Mul.wide_as_nat" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Views.fsti", "name": "Vale.Interop.Views.nat32s_to_nat128" }, { "project_name": "FStar", "file_name": "FStar.DM4F.OTP.Random.fst", "name": "FStar.DM4F.OTP.Random.point" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Random.fst", "name": "FStar.DM4F.Random.point" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.count" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.count" }, { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.count" }, { "project_name": "FStar", "file_name": "FStar.Int.fsti", "name": "FStar.Int.from_uint" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Field51.Definition.fst", "name": "Hacl.Spec.Curve25519.Field51.Definition.as_nat5" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.where_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.where_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.where_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_z_as_nat" } ], "selected_premises": [ "FStar.UInt.size", "FStar.Mul.op_Star", "Pulse.Class.BoundedIntegers.bounded_int_u64", "Pulse.Class.BoundedIntegers.add_nat_1", "Pulse.Class.BoundedIntegers.bounded_from_bounded_unsigned", "Pulse.Class.BoundedIntegers.safe_mod", "Pulse.Class.BoundedIntegers.bounded_int_int", "FStar.Pervasives.reveal_opaque", "Pulse.Class.BoundedIntegers.bounded_int_u32", "Pulse.Class.BoundedIntegers.bounded_unsigned_u32", "Pulse.Class.BoundedIntegers.bounded_unsigned_u64", "Pulse.Class.BoundedIntegers.test", "FStar.Math.Lemmas.pow2_plus", "Pulse.Class.BoundedIntegers.sub_u32", "FStar.Math.Lemmas.pow2_le_compat", "FStar.SizeT.mod_spec", "FStar.Math.Lemmas.pow2_lt_compat", "Pulse.Class.BoundedIntegers.fits_t", "Pulse.Class.BoundedIntegers.ok", "Pulse.Class.BoundedIntegers.add", "FStar.Tactics.Effect.raise", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Pervasives.Native.snd", "FStar.UInt.max_int", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Pervasives.Native.fst", "FStar.Math.Lemmas.lemma_div_lt", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "FStar.Math.Lemmas.lemma_mult_lt_sqr", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "Pulse.Class.BoundedIntegers.safe_add", "FStar.Math.Lemmas.distributivity_add_right", "FStar.UInt.to_vec", "FStar.Math.Lemmas.distributivity_sub_left", "FStar.UInt.fits", "FStar.Math.Lemmas.lemma_mod_mul_distr_l", "FStar.Math.Lemmas.lemma_mod_plus", "FStar.Math.Lemmas.lemma_div_lt_nat", "FStar.Tactics.Effect.tactic", "Pulse.Class.BoundedIntegers.add3_alt", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Math.Lemmas.distributivity_sub_right", "FStar.Tactics.Effect.get", "Pulse.Class.BoundedIntegers.add3", "FStar.UInt.to_uint_t", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "Pulse.Class.BoundedIntegers.add_u32", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1", "FStar.UInt.min_int", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Math.Lemmas.lemma_mod_sub", "FStar.UInt.mul_mod", "FStar.Math.Lemmas.multiple_modulo_lemma", "FStar.UInt32.lt", "FStar.UInt64.lt", "FStar.UInt16.lt", "FStar.UInt64.n", "FStar.Math.Lemmas.modulo_addition_lemma", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_2", "FStar.Math.Lemmas.lemma_mod_twice", "FStar.Math.Lemmas.lemma_div_le", "FStar.Math.Lemmas.modulo_distributivity", "FStar.Math.Lemmas.division_multiplication_lemma", "FStar.UInt.from_vec", "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_1", "FStar.Tactics.Types.issues", "FStar.Math.Lemmas.multiple_division_lemma", "FStar.Math.Lib.slash_decr_axiom", "FStar.UInt32.n", "FStar.Math.Lib.log_2", "FStar.Monotonic.Pure.is_monotonic", "FStar.Math.Lemmas.lemma_mod_spec2", "FStar.UInt.pow2_n", "FStar.UInt.mul_div", "FStar.BitVector.logand_vec", "FStar.BitVector.logor_vec", "FStar.UInt16.n", "FStar.Math.Lemmas.pow2_modulo_division_lemma_1", "FStar.Math.Lemmas.lemma_div_plus", "FStar.UInt32.op_Star_Hat", "FStar.UInt16.op_Star_Hat", "FStar.UInt64.op_Star_Hat", "FStar.UInt64.op_Plus_Hat", "FStar.UInt16.op_Plus_Hat", "FStar.UInt32.op_Plus_Hat", "FStar.Math.Lemmas.pow2_double_mult", "FStar.Math.Lemmas.pow2_minus", "FStar.BitVector.logxor_vec_definition", "FStar.Math.Lib.max", "FStar.Math.Lemmas.div_exact_r", "FStar.UInt64.op_Subtraction_Hat", "FStar.UInt32.op_Subtraction_Hat", "FStar.UInt16.op_Subtraction_Hat", "FStar.UInt64.gt", "FStar.UInt16.gt", "FStar.UInt32.gt", "FStar.Pervasives.ex_return", "FStar.Math.Lemmas.division_addition_lemma" ], "source_upto_this": "module Pulse.Class.BoundedIntegers\n\nmodule TC = FStar.Tactics.Typeclasses\n\nlet fits_t (fits:int -> prop) = x:int { fits x }\n\nclass bounded_int (t:eqtype) = {\n fits: int -> prop;\n v : t -> GTot int;\n u : fits_t fits -> GTot t;\n ( + ) : (x:t -> y:t -> Pure t (requires fits (v x + v y)) (ensures fun z -> v z == v x + v y));\n op_Subtraction : (x:t -> y:t -> Pure t (requires fits (v x - v y)) (ensures fun z -> v z == v x - v y));\n ( < ) : (x:t -> y:t -> b:bool { b = (v x < v y)});\n ( <= ) : (x:t -> y:t -> b:bool { b = (v x <= v y)});\n ( % ) : (x:t -> y:t -> Pure t (requires v y > 0 /\\ fits (v x % v y)) (ensures fun z -> v z == v x % v y));\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). {:pattern v x} fits (v x))\n )\n (* ...todo, add other ops **)\n}\n\n\n\ninstance bounded_int_int : bounded_int int = {\n fits = (fun _ -> True);\n v = id;\n u = id;\n ( + ) = (fun x y -> Prims.op_Addition x y);\n op_Subtraction = (fun x y -> Prims.op_Subtraction x y);\n ( < ) = (fun x y -> Prims.op_LessThan x y);\n ( <= ) = (fun x y -> Prims.op_LessThanOrEqual x y);\n ( % ) = (fun x y -> Prims.op_Modulus x y);\n properties = ()\n}\n\n\nclass bounded_unsigned (t:eqtype) = {\n [@@@TC.no_method]\n base:bounded_int t;\n max_bound:t;\n [@@@TC.no_method]\n static_max_bound: bool;\n [@@@TC.no_method]\n properties: squash (\n (forall (x:t). v x >= 0 /\\ (static_max_bound ==> v x <= v max_bound)) /\\\n (forall (x:nat). x <= v max_bound ==> fits #t x)\n )\n}\n\n\ninstance bounded_from_bounded_unsigned (t:eqtype) (c:bounded_unsigned t) : bounded_int t = c.base\n\nlet safe_add (#t:eqtype) {| c: bounded_unsigned t |} (x y : t)\n : o:option t { Some? o ==> v (Some?.v o) == v x + v y }\n = if c.static_max_bound\n then (\n assert ( x <= max_bound);\n if (y <= max_bound - x)\n then Some (x + y)\n else None\n )\n else (\n if x <= max_bound\n then (\n assert (fits #t (v (max_bound #t) - v x));\n if (y <= max_bound - x)\n then Some (x + y)\n else None\n )\n else None\n )\n\nlet safe_mod (#t:eqtype) {| c: bounded_unsigned t |} (x : t) (y : t)\n : Pure (option t)\n (requires v y > 0)\n (ensures fun o -> Some? o ==> v (Some?.v o) == v x % v y)\n = if c.static_max_bound\n then Some (x % y)\n else (\n if y <= max_bound\n then (\n assert (fits #t (v x % v y));\n Some (x % y)\n )\n else None\n )\n\nlet ok (#t:eqtype) {| c:bounded_int t |} (op: int -> int -> int) (x y:t) =\n c.fits (op (v x) (v y))\n\nlet add (#t:eqtype) {| bounded_int t |} (x:t) (y:t { ok (+) x y }) = x + y\n\nlet add3 (#t:eqtype) {| bounded_int t |} (x:t) (y:t) (z:t { ok (+) x y /\\ ok (+) z (x + y)}) = x + y + z\n\n//Writing the signature of bounded_int.(+) using Pure\n//allows this to work, since the type of (x+y) is not refined\nlet add3_alt (#t:eqtype) {| bounded_int t |} (x:t) (y:t) (z:t { ok (+) x y /\\ ok (+) (x + y) z}) = x + y + z\n\ninstance bounded_int_u32 : bounded_int FStar.UInt32.t = {\n fits = (fun x -> 0 <= x /\\ x < 4294967296);\n v = (fun x -> FStar.UInt32.v x);\n u = FStar.UInt32.uint_to_t;\n ( + ) = (fun x y -> FStar.UInt32.add x y);\n op_Subtraction = (fun x y -> FStar.UInt32.sub x y);\n ( < ) = FStar.UInt32.(fun x y -> x <^ y);\n ( <= ) = FStar.UInt32.(fun x y -> x <=^ y);\n ( % ) = FStar.UInt32.(fun x y -> x %^ y);\n properties = ()\n}\n\ninstance bounded_unsigned_u32 : bounded_unsigned FStar.UInt32.t = {\n base = TC.solve;\n max_bound = 0xfffffffful;\n static_max_bound = true;\n properties = ()\n}\n\ninstance bounded_int_u64 : bounded_int FStar.UInt64.t = {\n fits = (fun x -> 0 <= x /\\ x <= 0xffffffffffffffff);\n v = (fun x -> FStar.UInt64.v x);\n u = FStar.UInt64.uint_to_t;\n ( + ) = (fun x y -> FStar.UInt64.add x y);\n op_Subtraction = (fun x y -> FStar.UInt64.sub x y);\n ( < ) = FStar.UInt64.(fun x y -> x <^ y);\n ( <= ) = FStar.UInt64.(fun x y -> x <=^ y);\n ( % ) = FStar.UInt64.(fun x y -> x %^ y);\n properties = ()\n}\n\ninstance bounded_unsigned_u64 : bounded_unsigned FStar.UInt64.t = {\n base = TC.solve;\n max_bound = 0xffffffffffffffffuL;\n static_max_bound = true;\n properties = ()\n}\n\nlet test (t:eqtype) {| _ : bounded_unsigned t |} (x:t) = v x\n\nlet add_u32 (x:FStar.UInt32.t) (y:FStar.UInt32.t { ok (+) x y }) = x + y\n\n//Again, parser doesn't allow using (-)\nlet sub_u32 (x:FStar.UInt32.t) (y:FStar.UInt32.t { ok op_Subtraction x y}) = x - y\n\n//this work and resolved to int, because of the 1\nlet add_nat_1 (x:nat) = x + 1\n\n//But, to add two nats, this fails, since typeclass resolution doesn't consider subtyping\n[@@expect_failure]\nlet add_nat (x y:nat) = x + y\n", "sketch": [ "To implement the `nat_as_int` function, we simply need to use the built-in coercion function from F* to convert a natural number to an integer.", "The definition `nat_as_int` is about converting a natural number to an integer.\n\nStep 1: We want to define a function that takes a natural number and returns an integer.\n\nStep 2: To implement `nat_as_int`, we can simply use the built-in coercion function from `nat` to `int` provided by F*.", "The definition `nat_as_int` is about converting a natural number to an integer.\n\nStep 1: We want to define a function that takes a natural number `x` and returns an integer.\n\nStep 2: To implement `nat_as_int`, we can simply use the built-in coercion function from `nat` to `int` provided by F*.", "The implementation of `nat_as_int` involves simply returning the input natural number `x` as an integer.", "The definition `nat_as_int` is about converting a natural number to an integer.\n\nStep 1: We want to define a function that takes a natural number and returns an integer.\n\nStep 2: To implement `nat_as_int`, we can simply use the coercion function provided by F* to convert a natural number to an integer.", "To implement `nat_as_int`, we can simply use the built-in coercion function from `nat` to `int` in F*.", "The definition `nat_as_int` is a function that converts a natural number to an integer.\n\nStep 1: The `nat_as_int` function takes a natural number `x` and returns its equivalent integer value.\n\nStep 2: To implement the `nat_as_int` function, we can simply use the built-in coercion from natural numbers to integers in F*.", "The definition `nat_as_int` is about converting a natural number to an integer.\n\nStep 1: We want to define a function that takes a natural number and returns an integer.\n\nStep 2: To implement `nat_as_int`, we can simply use the built-in coercion from `nat` to `int` in F*.", "To implement `nat_as_int`, we can simply use the built-in coercion function from `nat` to `int` provided by F*.", "The definition `nat_as_int` is about converting a natural number to an integer.\n\nStep 1: We want to define a function that takes a natural number `x` and returns an integer.\n\nStep 2: To implement `nat_as_int`, we can simply use the built-in coercion function from F* to convert a natural number to an integer." ], "generated_solution": [ "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = x", "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = x", "let nat_as_int (x: nat) : int = x", "let nat_as_int (x: nat) : int = int x", "let nat_as_int (x: nat) : int = int x" ] }, { "file_name": "Lib.Exponentiation.Definition.fst", "name": "Lib.Exponentiation.Definition.lemma_pow_mul", "opens_and_abbrevs": [ { "abbrev": "Loops", "full_module": "Lib.LoopCombinators" }, { "open": "FStar.Mul" }, { "abbrev": "Loops", "full_module": "Lib.LoopCombinators" }, { "open": "FStar.Mul" }, { "open": "Lib.Exponentiation" }, { "open": "Lib.Exponentiation" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val lemma_pow_mul: #t:Type -> k:comm_monoid t -> x:t -> n:nat -> m:nat ->\n Lemma (pow k (pow k x n) m == pow k x (n * m))", "source_definition": "let rec lemma_pow_mul #t k x n m =\n if m = 0 then begin\n lemma_pow0 k (pow k x n);\n lemma_pow0 k x;\n () end\n else begin\n calc (==) {\n pow k (pow k x n) m;\n (==) { lemma_pow_unfold k (pow k x n) m }\n mul (pow k x n) (pow k (pow k x n) (m - 1));\n (==) { lemma_pow_mul k x n (m - 1) }\n mul (pow k x n) (pow k x (n * (m - 1)));\n (==) { lemma_pow_add k x n (n * (m - 1)) }\n pow k x (n * m);\n }; () end", "source_range": { "start_line": 122, "start_col": 0, "end_line": 136, "end_col": 13 }, "interleaved": false, "definition": "fun k x n m ->\n (match m = 0 with\n | true ->\n Lib.Exponentiation.Definition.lemma_pow0 k (Lib.Exponentiation.Definition.pow k x n);\n Lib.Exponentiation.Definition.lemma_pow0 k x;\n ()\n | _ ->\n calc ( == ) {\n Lib.Exponentiation.Definition.pow k (Lib.Exponentiation.Definition.pow k x n) m;\n ( == ) { Lib.Exponentiation.Definition.lemma_pow_unfold k\n (Lib.Exponentiation.Definition.pow k x n)\n m }\n Lib.Exponentiation.Definition.mul (Lib.Exponentiation.Definition.pow k x n)\n (Lib.Exponentiation.Definition.pow k (Lib.Exponentiation.Definition.pow k x n) (m - 1));\n ( == ) { Lib.Exponentiation.Definition.lemma_pow_mul k x n (m - 1) }\n Lib.Exponentiation.Definition.mul (Lib.Exponentiation.Definition.pow k x n)\n (Lib.Exponentiation.Definition.pow k x (n * (m - 1)));\n ( == ) { Lib.Exponentiation.Definition.lemma_pow_add k x n (n * (m - 1)) }\n Lib.Exponentiation.Definition.pow k x (n * m);\n };\n ())\n <:\n Prims.unit", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Lib.Exponentiation.Definition.comm_monoid", "Prims.nat", "Prims.op_Equality", "Prims.int", "Prims.unit", "Lib.Exponentiation.Definition.lemma_pow0", "Lib.Exponentiation.Definition.pow", "Prims.bool", "FStar.Calc.calc_finish", "Prims.eq2", "FStar.Mul.op_Star", "Prims.Cons", "FStar.Preorder.relation", "Prims.Nil", "FStar.Calc.calc_step", "Lib.Exponentiation.Definition.mul", "Prims.op_Subtraction", "FStar.Calc.calc_init", "FStar.Calc.calc_pack", "Lib.Exponentiation.Definition.lemma_pow_unfold", "Prims.squash", "Lib.Exponentiation.Definition.lemma_pow_mul", "Lib.Exponentiation.Definition.lemma_pow_add" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "k: Lib.Exponentiation.Definition.comm_monoid t -> x: t -> n: Prims.nat -> m: Prims.nat\n -> FStar.Pervasives.Lemma\n (ensures\n Lib.Exponentiation.Definition.pow k (Lib.Exponentiation.Definition.pow k x n) m ==\n Lib.Exponentiation.Definition.pow k x (n * m))", "prompt": "let rec lemma_pow_mul #t k x n m =\n ", "expected_response": "if m = 0\nthen\n (lemma_pow0 k (pow k x n);\n lemma_pow0 k x;\n ())\nelse\n (calc ( == ) {\n pow k (pow k x n) m;\n ( == ) { lemma_pow_unfold k (pow k x n) m }\n mul (pow k x n) (pow k (pow k x n) (m - 1));\n ( == ) { lemma_pow_mul k x n (m - 1) }\n mul (pow k x n) (pow k x (n * (m - 1)));\n ( == ) { lemma_pow_add k x n (n * (m - 1)) }\n pow k x (n * m);\n };\n ())", "source": { "project_name": "hacl-star", "file_name": "lib/Lib.Exponentiation.Definition.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Lib.Exponentiation.Definition.fst", "checked_file": "dataset/Lib.Exponentiation.Definition.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/Lib.LoopCombinators.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let lemma_inverse_one #t k =\n lemma_inverse k.cm.one;\n assert (k.cm.mul (inverse cm.one) cm.one == cm.one);\n k.cm.lemma_one (inverse cm.one);\n assert (inverse k.cm.one == cm.one)", "comm_monoid", "comm_monoid", "class comm_monoid (t:Type) = {\n one: t;\n mul: t -> t -> t;\n lemma_one: a:t -> Lemma (mul a one == a);\n lemma_mul_assoc: a:t -> b:t -> c:t -> Lemma (mul (mul a b) c == mul a (mul b c));\n lemma_mul_comm: a:t -> b:t -> Lemma (mul a b == mul b a)\n }", "class comm_monoid (t:Type) = {\n one: t;\n mul: t -> t -> t;\n lemma_one: a:t -> Lemma (mul a one == a);\n lemma_mul_assoc: a:t -> b:t -> c:t -> Lemma (mul (mul a b) c == mul a (mul b c));\n lemma_mul_comm: a:t -> b:t -> Lemma (mul a b == mul b a)\n }", "class comm_monoid (t:Type) = {\n one: t;\n mul: t -> t -> t;\n lemma_one: a:t -> Lemma (mul a one == a);\n lemma_mul_assoc: a:t -> b:t -> c:t -> Lemma (mul (mul a b) c == mul a (mul b c));\n lemma_mul_comm: a:t -> b:t -> Lemma (mul a b == mul b a)\n }", "class comm_monoid (t:Type) = {\n one: t;\n mul: t -> t -> t;\n lemma_one: a:t -> Lemma (mul a one == a);\n lemma_mul_assoc: a:t -> b:t -> c:t -> Lemma (mul (mul a b) c == mul a (mul b c));\n lemma_mul_comm: a:t -> b:t -> Lemma (mul a b == mul b a)\n }", "class comm_monoid (t:Type) = {\n one: t;\n mul: t -> t -> t;\n lemma_one: a:t -> Lemma (mul a one == a);\n lemma_mul_assoc: a:t -> b:t -> c:t -> Lemma (mul (mul a b) c == mul a (mul b c));\n lemma_mul_comm: a:t -> b:t -> Lemma (mul a b == mul b a)\n }", "one", "one", "mul", "mul", "lemma_one", "lemma_one", "lemma_mul_assoc", "lemma_mul_assoc", "val lemma_mul_cancel_inverse: #t:Type -> k:abelian_group t -> a:t -> b:t ->\n Lemma (cm.mul (inverse a) (cm.mul a b) == b)", "lemma_mul_comm", "lemma_mul_comm", "let lemma_mul_cancel_inverse #t k a b =\n calc (==) {\n cm.mul (inverse a) (cm.mul a b);\n (==) { cm.lemma_mul_assoc (inverse a) a b }\n cm.mul (cm.mul (inverse a) a) b;\n (==) { lemma_inverse a }\n cm.mul cm.one b;\n (==) { cm.lemma_mul_comm cm.one b }\n cm.mul b cm.one;\n (==) { cm.lemma_one b }\n b;\n }", "abelian_group", "abelian_group", "class abelian_group (t:Type) = {\n cm:comm_monoid t;\n inverse: t -> t;\n lemma_inverse: a:t -> Lemma (mul (inverse a) a == one)\n }", "class abelian_group (t:Type) = {\n cm:comm_monoid t;\n inverse: t -> t;\n lemma_inverse: a:t -> Lemma (mul (inverse a) a == one)\n }", "class abelian_group (t:Type) = {\n cm:comm_monoid t;\n inverse: t -> t;\n lemma_inverse: a:t -> Lemma (mul (inverse a) a == one)\n }", "cm", "cm", "inverse", "inverse", "lemma_inverse", "lemma_inverse", "let sqr (#t:Type) (k:comm_monoid t) (a:t) : t = mul a a", "let rec pow (#t:Type) (k:comm_monoid t) (x:t) (n:nat) : t =\n if n = 0 then one\n else mul x (pow k x (n - 1))", "val lemma_cancellation: #t:Type -> k:abelian_group t -> a:t -> b:t -> c:t -> Lemma\n (requires cm.mul a b == cm.mul a c)\n (ensures b == c)", "let pow_neg (#t:Type) (k:abelian_group t) (x:t) (n:int) : t =\n if n >= 0 then pow k.cm x n else k.inverse (pow k.cm x (- n))", "let lemma_cancellation #t k a b c =\n assert (cm.mul (inverse a) (cm.mul a b) == cm.mul (inverse a) (cm.mul a c));\n lemma_mul_cancel_inverse #t k a b;\n lemma_mul_cancel_inverse #t k a c", "val lemma_inverse_one: #t:Type -> k:abelian_group t ->\n Lemma (inverse k.cm.one == k.cm.one)", "let lemma_inverse_id #t k a =\n lemma_inverse a;\n lemma_inverse (inverse a);\n assert (cm.mul (inverse a) a == cm.one);\n assert (cm.mul (inverse (inverse a)) (inverse a) == cm.one);\n cm.lemma_mul_comm (inverse (inverse a)) (inverse a);\n lemma_cancellation k (inverse a) a (inverse (inverse a));\n assert (a == (inverse (inverse a)))", "val lemma_inverse_id: #t:Type -> k:abelian_group t -> a:t ->\n Lemma (inverse (inverse a) == a)", "val lemma_inverse_mul: #t:Type -> k:abelian_group t -> a:t -> b:t ->\n Lemma (inverse (cm.mul a b) == cm.mul (inverse a) (inverse b))", "let lemma_inverse_mul #t k a b =\n lemma_inverse (cm.mul a b);\n cm.lemma_mul_comm (inverse (cm.mul a b)) (cm.mul a b);\n assert (cm.mul (cm.mul a b) (inverse (cm.mul a b)) == cm.one);\n calc (==) {\n cm.mul (cm.mul a b) (cm.mul (inverse a) (inverse b));\n (==) { cm.lemma_mul_assoc (cm.mul a b) (inverse a) (inverse b) }\n cm.mul (cm.mul (cm.mul a b) (inverse a)) (inverse b);\n (==) { cm.lemma_mul_comm (cm.mul a b) (inverse a) }\n cm.mul (cm.mul (inverse a) (cm.mul a b)) (inverse b);\n (==) { lemma_mul_cancel_inverse k a b }\n cm.mul b (inverse b);\n (==) { cm.lemma_mul_comm b (inverse b) }\n cm.mul (inverse b) b;\n (==) { lemma_inverse b }\n cm.one;\n };\n\n assert (cm.mul (cm.mul a b) (inverse (cm.mul a b)) ==\n cm.mul (cm.mul a b) (cm.mul (inverse a) (inverse b)));\n lemma_cancellation k (cm.mul a b) (inverse (cm.mul a b))\n (cm.mul (inverse a) (inverse b))", "val lemma_pow0: #t:Type -> k:comm_monoid t -> x:t -> Lemma (pow k x 0 == one)", "val lemma_pow1: #t:Type -> k:comm_monoid t -> x:t -> Lemma (pow k x 1 == x)", "val lemma_pow_unfold: #t:Type -> k:comm_monoid t -> x:t -> n:pos ->\n Lemma (mul x (pow k x (n - 1)) == pow k x n)", "val lemma_pow_one: #t:Type -> k:comm_monoid t -> n:nat -> Lemma (pow k one n == one)", "val lemma_pow_add: #t:Type -> k:comm_monoid t -> x:t -> n:nat -> m:nat ->\n Lemma (mul (pow k x n) (pow k x m) == pow k x (n + m))", "val lemma_pow_mul: #t:Type -> k:comm_monoid t -> x:t -> n:nat -> m:nat ->\n Lemma (pow k (pow k x n) m == pow k x (n * m))", "val lemma_pow_mul_base: #t:Type -> k:comm_monoid t -> a:t -> b:t -> n:nat ->\n Lemma (mul (pow k a n) (pow k b n) == pow k (mul a b) n)", "val lemma_pow_double: #t:Type -> k:comm_monoid t -> x:t -> b:nat ->\n Lemma (pow k (mul x x) b == pow k x (b + b))", "val lemma_inverse_pow: #t:Type -> k:abelian_group t -> x:t -> n:nat ->\n Lemma (inverse (pow cm x n) == pow cm (inverse x) n)", "let lemma_pow0 #t k x = ()", "let lemma_pow1 #t k x = lemma_one x", "val lemma_pow_neg_one: #t:Type -> k:abelian_group t -> n:int ->\n Lemma (pow_neg k cm.one n == cm.one)", "let lemma_pow_unfold #t k x n = ()", "val lemma_pow_neg_add: #t:Type -> k:abelian_group t -> x:t -> n:int -> m:int ->\n Lemma (cm.mul (pow_neg k x n) (pow_neg k x m) == pow_neg k x (n + m))", "let rec lemma_pow_one #t k n =\n if n = 0 then\n lemma_pow0 k one\n else begin\n lemma_pow_unfold k one n;\n //assert (pow k one n == mul one (pow k one (n - 1)));\n lemma_pow_one k (n - 1);\n //assert (pow k one n == mul one one);\n lemma_one k.one;\n () end", "val lemma_pow_neg_mul: #t:Type -> k:abelian_group t -> x:t -> n:int -> m:int ->\n Lemma (pow_neg k (pow_neg k x n) m == pow_neg k x (n * m))", "val lemma_pow_neg_mul_base: #t:Type -> k:abelian_group t -> a:t -> b:t -> n:int ->\n Lemma (cm.mul (pow_neg k a n) (pow_neg k b n) == pow_neg k (cm.mul a b) n)", "val lemma_pow_neg_double: #t:Type -> k:abelian_group t -> x:t -> b:int ->\n Lemma (pow_neg k (cm.mul x x) b == pow_neg k x (b + b))", "let rec lemma_pow_add #t k x n m =\n if n = 0 then begin\n calc (==) {\n mul (pow k x n) (pow k x m);\n (==) { lemma_pow0 k x }\n mul one (pow k x m);\n (==) { lemma_mul_comm one (pow k x m) }\n mul (pow k x m) one;\n (==) { lemma_one (pow k x m) }\n pow k x m;\n }; () end\n else begin\n calc (==) {\n mul (pow k x n) (pow k x m);\n (==) { lemma_pow_unfold k x n }\n mul (mul x (pow k x (n - 1))) (pow k x m);\n (==) { lemma_mul_assoc x (pow k x (n - 1)) (pow k x m) }\n mul x (mul (pow k x (n - 1)) (pow k x m));\n (==) { lemma_pow_add #t k x (n - 1) m }\n mul x (pow k x (n - 1 + m));\n (==) { lemma_pow_unfold k x (n + m) }\n pow k x (n + m);\n }; () end" ], "closest": [ "val lemma_pow_mul: x:elem -> n:nat -> m:nat ->\n Lemma (pow (pow x n) m == pow x (n * m))\nlet lemma_pow_mul x n m =\n lemma_pow_mod_is_pow_cm x n;\n lemma_pow_mod_is_pow_cm (pow x n) m;\n LE.lemma_pow_mul cm_prime x n m;\n lemma_pow_mod_is_pow_cm x (n * m)", "val lemma_pow_mul: x:int -> n:nat -> m:nat -> Lemma (pow (pow x n) m = pow x (n * m))\nlet lemma_pow_mul x n m =\n let k = mk_nat_comm_monoid in\n LE.lemma_pow_mul k x n m;\n lemma_pow_nat_is_pow x n;\n lemma_pow_nat_is_pow (pow x n) m;\n lemma_pow_nat_is_pow x (n * m)", "val lemma_pow_add: x:elem -> n:nat -> m:nat ->\n Lemma (fmul (pow x n) (pow x m) == pow x (n + m))\nlet lemma_pow_add x n m =\n lemma_pow_mod_is_pow_cm x n;\n lemma_pow_mod_is_pow_cm x m;\n LE.lemma_pow_add cm_prime x n m;\n lemma_pow_mod_is_pow_cm x (n + m)", "val lemma_pow_add: x:int -> n:nat -> m:nat -> Lemma (pow x n * pow x m = pow x (n + m))\nlet lemma_pow_add x n m =\n let k = mk_nat_comm_monoid in\n LE.lemma_pow_add k x n m;\n lemma_pow_nat_is_pow x n;\n lemma_pow_nat_is_pow x m;\n lemma_pow_nat_is_pow x (n + m)", "val powx_lemma2: x:int -> n:nat -> m:nat -> Lemma\n (powx x n * powx x m = powx x (n + m))\nlet rec powx_lemma2 x n m =\n let ass (x y z : int) : Lemma ((x*y)*z == x*(y*z)) = () in\n match n with\n | 0 -> ()\n | _ -> powx_lemma2 x (n-1) m; ass x (powx x (n-1)) (powx x m)", "val lemma_pow_distr_mul: #t:Type -> k:comm_monoid t -> x:t -> a:t -> r1:nat -> r2:nat -> r3:nat ->\n Lemma (k.mul (k.mul x (pow k (pow k a r1) r3)) (pow k a r2) == k.mul (pow k a (r1 * r3 + r2)) x)\nlet lemma_pow_distr_mul #t k x a r1 r2 r3 =\n calc (==) {\n k.mul (k.mul x (pow k (pow k a r1) r3)) (pow k a r2);\n (==) { lemma_pow_mul k a r1 r3 }\n k.mul (k.mul x (pow k a (r1 * r3))) (pow k a r2);\n (==) { k.lemma_mul_assoc x (pow k a (r1 * r3)) (pow k a r2) }\n k.mul x (k.mul (pow k a (r1 * r3)) (pow k a r2));\n (==) { lemma_pow_add k a (r1 * r3) r2 }\n k.mul x (pow k a (r1 * r3 + r2));\n (==) { k.lemma_mul_comm x (pow k a (r1 * r3 + r2)) }\n k.mul (pow k a (r1 * r3 + r2)) x;\n }", "val lemma_pow_mul_base: a:int -> b:int -> n:nat -> Lemma (pow a n * pow b n == pow (a * b) n)\nlet lemma_pow_mul_base a b n =\n let k = mk_nat_comm_monoid in\n LE.lemma_pow_mul_base k a b n;\n lemma_pow_nat_is_pow a n;\n lemma_pow_nat_is_pow b n;\n lemma_pow_nat_is_pow (a * b) n", "val lemma_mul_monomials (m n:nat) : Lemma\n (monomial (m + n) == monomial m *. monomial n)\nlet lemma_mul_monomials m n =\n lemma_shift_is_mul (monomial m) n; // monomial m *. monomial n == shift (monomial m) n\n lemma_monomial_define m;\n lemma_monomial_define (m + n);\n lemma_shift_define (monomial m) n;\n lemma_equal (shift (monomial m) n) (monomial (m + n))", "val lemma_pow_mod: #m:pos{1 < m} -> a:nat_mod m -> b:nat -> Lemma (pow a b % m == pow_mod #m a b)\nlet lemma_pow_mod #n a b = lemma_pow_mod_ n a b", "val pow_lemma: #t:Type -> k:concrete_ops t -> a:t -> b:nat ->\n Lemma (k.to.refl (pow k a b) == S.pow k.to.comm_monoid (k.to.refl a) b)\nlet rec pow_lemma #t k a b =\n if b = 0 then ()\n else pow_lemma k a (b - 1)", "val lemma_pow_nat_mod_is_pow: #n:pos{1 < n} -> a:nat_mod n -> b:nat ->\n Lemma (pow a b % n == LE.pow (mk_nat_mod_comm_monoid n) a b)\nlet rec lemma_pow_nat_mod_is_pow #n a b =\n let k = mk_nat_mod_comm_monoid n in\n if b = 0 then begin\n lemma_pow0 a;\n LE.lemma_pow0 k a end\n else begin\n calc (==) {\n pow a b % n;\n (==) { lemma_pow_unfold a b }\n a * pow a (b - 1) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (pow a (b - 1)) n }\n a * (pow a (b - 1) % n) % n;\n (==) { lemma_pow_nat_mod_is_pow #n a (b - 1) }\n a * LE.pow k a (b - 1) % n;\n (==) { }\n k.LE.mul a (LE.pow k a (b - 1));\n (==) { LE.lemma_pow_unfold k a b }\n LE.pow k a b;\n }; () end", "val lemma_pow_nat_is_pow: a:int -> b:nat ->\n Lemma (pow a b == LE.pow mk_nat_comm_monoid a b)\nlet rec lemma_pow_nat_is_pow a b =\n let k = mk_nat_comm_monoid in\n if b = 0 then begin\n lemma_pow0 a;\n LE.lemma_pow0 k a end\n else begin\n lemma_pow_unfold a b;\n lemma_pow_nat_is_pow a (b - 1);\n LE.lemma_pow_unfold k a b;\n () end", "val mod_mul: n:nat -> k1:pos -> k2:pos ->\n Lemma ((n % k2) * k1 == (n * k1) % (k1*k2))\nlet mod_mul n k1 k2 =\n Math.modulo_scale_lemma n k1 k2", "val lemma_pow2_le (m n:nat) : Lemma (requires m <= n) (ensures pow2 m <= pow2 n)\nlet lemma_pow2_le m n = FStar.Math.Lemmas.pow2_le_compat n m", "val exp_pow2_lemma: #t:Type -> k:comm_monoid t -> a:t -> b:nat ->\n Lemma (exp_pow2 k a b == pow k a (pow2 b))\nlet exp_pow2_lemma #t k a b = exp_pow2_loop_lemma k a b b", "val lemma_pow_pow_mod: f:S.qelem -> a:nat -> b:nat ->\n Lemma (M.pow (M.pow f a % S.order) b % S.order == M.pow f (a * b) % S.order)\nlet lemma_pow_pow_mod f a b =\n calc (==) {\n M.pow (M.pow f a % S.order) b % S.order;\n (==) { M.lemma_pow_mod_base (M.pow f a) b S.order }\n M.pow (M.pow f a) b % S.order;\n (==) { M.lemma_pow_mul f a b }\n M.pow f (a * b) % S.order;\n }", "val pow_plus (a:int) (k m:nat): Lemma (pow a (k + m) == pow a k * pow a m)\nlet rec pow_plus a k m =\n match k with\n | 0 -> ()\n | _ ->\n calc (==) {\n pow a (k + m);\n == { }\n a * pow a ((k + m) - 1);\n == { pow_plus a (k - 1) m }\n a * (pow a (k - 1) * pow a m);\n == { }\n pow a k * pow a m;\n }", "val lemma_pow_pow_mod_mul: f:S.qelem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.qmul (M.pow (M.pow f a % S.q) b % S.q) (M.pow f c % S.q) == M.pow f (a * b + c) % S.q)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.qmul (M.pow (M.pow f a % S.q) b % S.q) (M.pow f c % S.q);\n (==) {\n M.lemma_pow_mod_base (M.pow f a) b S.q;\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow (M.pow f a) b) (M.pow f c % S.q) S.q;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow (M.pow f a) b) (M.pow f c) S.q }\n M.pow (M.pow f a) b * M.pow f c % S.q;\n (==) { M.lemma_pow_mul f a b }\n M.pow f (a * b) * M.pow f c % S.q;\n (==) { M.lemma_pow_add f (a * b) c }\n M.pow f (a * b + c) % S.q;\n }", "val lemma_pow_pow_mod: f:S.felem -> a:nat -> b:nat ->\n Lemma (M.pow (M.pow f a % S.prime) b % S.prime == M.pow f (a * b) % S.prime)\nlet lemma_pow_pow_mod f a b =\n calc (==) {\n M.pow (M.pow f a % S.prime) b % S.prime;\n (==) { M.lemma_pow_mod_base (M.pow f a) b S.prime }\n M.pow (M.pow f a) b % S.prime;\n (==) { M.lemma_pow_mul f a b }\n M.pow f (a * b) % S.prime;\n }", "val lemma_pow_pow_mod: f:S.felem -> a:nat -> b:nat ->\n Lemma (M.pow (M.pow f a % S.prime) b % S.prime == M.pow f (a * b) % S.prime)\nlet lemma_pow_pow_mod f a b =\n calc (==) {\n M.pow (M.pow f a % S.prime) b % S.prime;\n (==) { M.lemma_pow_mod_base (M.pow f a) b S.prime }\n M.pow (M.pow f a) b % S.prime;\n (==) { M.lemma_pow_mul f a b }\n M.pow f (a * b) % S.prime;\n }", "val lemma_pow_pow_mod_mul: f:S.qelem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.qmul (M.pow (M.pow f a % S.order) b % S.order) (M.pow f c % S.order) == M.pow f (a * b + c) % S.order)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.qmul (M.pow (M.pow f a % S.order) b % S.order) (M.pow f c % S.order);\n (==) { lemma_pow_pow_mod f a b }\n S.qmul (M.pow f (a * b) % S.order) (M.pow f c % S.order);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.order;\n }", "val lemma_pow_pow_mod_mul: f:S.felem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime) == M.pow f (a * b + c) % S.prime)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_pow_mod f a b }\n S.fmul (M.pow f (a * b) % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.prime;\n }", "val lemma_pow_pow_mod_mul: f:S.felem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime) == M.pow f (a * b + c) % S.prime)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_pow_mod f a b }\n S.fmul (M.pow f (a * b) % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.prime;\n }", "val lemma_pow_double: a:int -> b:nat -> Lemma (pow (a * a) b == pow a (b + b))\nlet lemma_pow_double a b =\n let k = mk_nat_comm_monoid in\n LE.lemma_pow_double k a b;\n lemma_pow_nat_is_pow (a * a) b;\n lemma_pow_nat_is_pow a (b + b)", "val lemma_pow_double: a:elem -> b:nat ->\n Lemma (pow (a *% a) b == pow a (b + b))\nlet lemma_pow_double a b =\n lemma_pow_mod_is_pow_cm (a *% a) b;\n LE.lemma_pow_double cm_prime a b;\n lemma_pow_mod_is_pow_cm a (b + b)", "val lemma_div_pow2_ge (a: int) (n m: nat)\n : Lemma (requires (m <= n /\\ pow2 n <= a)) (ensures (pow2 (n - m) <= a / pow2 m))\nlet lemma_div_pow2_ge (a: int) (n m: nat) : Lemma\n (requires (m <= n /\\ pow2 n <= a))\n (ensures (pow2 (n - m) <= a / pow2 m))\n= pow2_multiplication_division_lemma_1 1 m n;\n lemma_div_le (pow2 n) a (pow2 m)", "val lemma_mult_lt_sqr (n m: nat) (k: nat{n < k && m < k}) : Lemma (n * m < k * k)\nlet lemma_mult_lt_sqr (n:nat) (m:nat) (k:nat{n < k && m < k})\n : Lemma (n * m < k * k) =\n calc (<=) {\n n * m;\n <= { lemma_mult_le_left n m (k - 1) }\n n * (k - 1);\n <= { lemma_mult_le_right (k - 1) n (k - 1) }\n (k - 1) * (k - 1);\n <= {}\n k*k - 1;\n }", "val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c))\nlet lemma_mul_mod_assoc #m a b c =\n calc (==) {\n (a * b % m) * c % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c m }\n (a * b) * c % m;\n (==) { Math.Lemmas.paren_mul_right a b c }\n a * (b * c) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) m }\n a * (b * c % m) % m;\n }", "val lemma_add_lo_mul_right (#n:nat) (a b:natN n) (c:nat1) (m:int) : Lemma\n (add_lo a b c * m == (let x = a * m + b * m + c * m in if a + b + c < n then x else x - n * m))\nlet lemma_add_lo_mul_right #n a b c m =\n reveal_add_lo_all ()", "val lemma_pow_mod_: n:pos{1 < n} -> a:nat_mod n -> b:nat -> Lemma\n (ensures (pow_mod #n a b == pow a b % n))\n (decreases b)\nlet rec lemma_pow_mod_ n a b =\n if b = 0 then begin\n lemma_pow0 a;\n lemma_pow_mod0 a end\n else begin\n if b % 2 = 0 then begin\n calc (==) {\n\tpow_mod #n a b;\n\t(==) { lemma_pow_mod_unfold0 n a b }\n\tpow_mod #n (mul_mod #n a a) (b / 2);\n\t(==) { lemma_pow_mod_ n (mul_mod #n a a) (b / 2) }\n\tpow (mul_mod #n a a) (b / 2) % n;\n\t(==) { lemma_pow_mod_base (a * a) (b / 2) n }\n\tpow (a * a) (b / 2) % n;\n\t(==) { lemma_pow_double a (b / 2) }\n\tpow a b % n;\n };\n assert (pow_mod #n a b == pow a b % n) end\n else begin\n calc (==) {\n\tpow_mod #n a b;\n\t(==) { lemma_pow_mod_unfold1 n a b }\n\tmul_mod a (pow_mod (mul_mod #n a a) (b / 2));\n\t(==) { lemma_pow_mod_ n (mul_mod #n a a) (b / 2) }\n\tmul_mod a (pow (mul_mod #n a a) (b / 2) % n);\n\t(==) { lemma_pow_mod_base (a * a) (b / 2) n }\n\tmul_mod a (pow (a * a) (b / 2) % n);\n\t(==) { lemma_pow_double a (b / 2) }\n\tmul_mod a (pow a (b / 2 * 2) % n);\n\t(==) { Math.Lemmas.lemma_mod_mul_distr_r a (pow a (b / 2 * 2)) n }\n\ta * pow a (b / 2 * 2) % n;\n\t(==) { lemma_pow1 a }\n\tpow a 1 * pow a (b / 2 * 2) % n;\n\t(==) { lemma_pow_add a 1 (b / 2 * 2) }\n\tpow a (b / 2 * 2 + 1) % n;\n\t(==) { Math.Lemmas.euclidean_division_definition b 2 }\n\tpow a b % n;\n\t};\n assert (pow_mod #n a b == pow a b % n) end\n end", "val lemma_iand_pow2 (n:pos) (x:natN (pow2 n)) (i:nat{i < n}) : Lemma\n (pow2 i < pow2 n /\\ (iand x (pow2 i) == 0 \\/ iand x (pow2 i) == pow2 i))\nlet lemma_iand_pow2 (n:pos) (x:natN (pow2 n)) (i:nat{i < n}) : Lemma\n (pow2 i < pow2 n /\\ (iand x (pow2 i) == 0 \\/ iand x (pow2 i) == pow2 i))\n =\n let open FStar.UInt in\n FStar.Math.Lemmas.pow2_lt_compat n i;\n assert (pow2 i < pow2 n);\n let result = iand x (pow2 i) in\n\n if nth #n x (n - i - 1) then (\n let helper (j:nat{j < n}) : Lemma (nth #n result j = nth #n (pow2 i) j)\n =\n pow2_nth_lemma #n i j;\n lemma_iand_nth_i n x (pow2 i) j;\n assert (nth #n result j = (nth #n x j && nth #n (pow2 i) j));\n ()\n in\n FStar.Classical.forall_intro helper;\n nth_lemma #n result (pow2 i);\n assert(iand x (pow2 i) == pow2 i);\n ()\n ) else (\n let helper (j:nat{j < n}) : Lemma (nth #n result j = false)\n =\n pow2_nth_lemma #n i j;\n lemma_iand_nth_i n x (pow2 i) j;\n assert (nth #n result j = (nth #n x j && nth #n (pow2 i) j));\n ()\n in\n FStar.Classical.forall_intro helper;\n nth_lemma #n (zero n) result;\n assert(iand x (pow2 i) == 0);\n ()\n );\n ()", "val lemma_pow_mod_is_pow_cm : x:elem -> b:nat -> Lemma (pow x b = LE.pow cm_prime x b)\nlet lemma_pow_mod_is_pow_cm x b =\n M.lemma_pow_nat_mod_is_pow #prime x b;\n M.lemma_pow_mod #prime x b", "val lemma_div_pow2_le (a: int) (n m: nat)\n : Lemma (requires (m <= n /\\ a <= pow2 n))\n (ensures (m <= n /\\ a <= pow2 n /\\ a / pow2 m <= pow2 (n - m)))\nlet lemma_div_pow2_le (a: int) (n m: nat) : Lemma\n (requires (m <= n /\\ a <= pow2 n))\n (ensures (m <= n /\\ a <= pow2 n /\\ a / pow2 m <= pow2 (n - m)))\n= if a = pow2 n\n then pow2_multiplication_division_lemma_1 1 m n\n else lemma_div_lt a n m", "val pow_mod (p:pos) (a:int) (k:nat) : Lemma (pow a k % p == pow (a % p) k % p)\nlet rec pow_mod p a k =\n if k = 0 then ()\n else\n calc (==) {\n pow a k % p;\n == { }\n a * pow a (k - 1) % p;\n == { lemma_mod_mul_distr_r a (pow a (k - 1)) p }\n (a * (pow a (k - 1) % p)) % p;\n == { pow_mod p a (k - 1) }\n (a * (pow (a % p) (k - 1) % p)) % p;\n == { lemma_mod_mul_distr_r a (pow (a % p) (k - 1)) p }\n a * pow (a % p) (k - 1) % p;\n == { lemma_mod_mul_distr_l a (pow (a % p) (k - 1)) p }\n (a % p * pow (a % p) (k - 1)) % p;\n == { }\n pow (a % p) k % p;\n }", "val lemma_iand_nth (n:pos) (x y:natN (pow2 n)) : Lemma\n (forall (m:_{m==pow2_norm n}) (i:nat{i < n}).{:pattern (nth #n (iand #m x y) i)}\n nth #n (iand #m x y) i == (nth #n x i && nth #n y i))\nlet lemma_iand_nth n x y =\n FStar.Classical.forall_intro (lemma_iand_nth_i n x y)", "val exp_pow2_lemma: #t:Type -> k:concrete_ops t -> a:t -> b:nat ->\n Lemma (k.to.refl (exp_pow2 k a b) == S.exp_pow2 k.to.comm_monoid (k.to.refl a) b)\nlet exp_pow2_lemma #t k a b =\n exp_pow2_lemma_loop k a b b", "val lemma_pow_mod_base: a:int -> b:nat -> n:pos -> Lemma (pow a b % n == pow (a % n) b % n)\nlet rec lemma_pow_mod_base a b n =\n if b = 0 then begin\n lemma_pow0 a;\n lemma_pow0 (a % n) end\n else begin\n calc (==) {\n pow a b % n;\n (==) { lemma_pow_unfold a b }\n a * pow a (b - 1) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (pow a (b - 1)) n }\n a * (pow a (b - 1) % n) % n;\n (==) { lemma_pow_mod_base a (b - 1) n }\n a * (pow (a % n) (b - 1) % n) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (pow (a % n) (b - 1)) n }\n a * pow (a % n) (b - 1) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l a (pow (a % n) (b - 1)) n }\n a % n * pow (a % n) (b - 1) % n;\n (==) { lemma_pow_unfold (a % n) b }\n pow (a % n) b % n;\n };\n assert (pow a b % n == pow (a % n) b % n)\n end", "val lemma_pow_one: x:elem -> Lemma (x == pow x 1)\nlet lemma_pow_one x =\n lemma_pow_mod_is_pow_cm x 1;\n LE.lemma_pow1 cm_prime x", "val lemma_mod_pow2_sub: x:nat -> a:nat -> b:nat ->\n Lemma (x / pow2 a % pow2 b * pow2 a == x % pow2 (a + b) - x % pow2 a)\nlet lemma_mod_pow2_sub x a b =\n calc (==) {\n x / pow2 a % pow2 b * pow2 a;\n (==) { Math.Lemmas.pow2_modulo_division_lemma_1 x a (a + b) }\n x % pow2 (a + b) / pow2 a * pow2 a;\n (==) { Math.Lemmas.euclidean_division_definition (x % pow2 (a + b)) (pow2 a) }\n x % pow2 (a + b) - x % pow2 (a + b) % pow2 a;\n (==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 x a (a + b) }\n x % pow2 (a + b) - x % pow2 a;\n }", "val lemma_mod_pow2_sub: x:nat -> a:nat -> b:nat ->\n Lemma (x / pow2 a % pow2 b * pow2 a == x % pow2 (a + b) - x % pow2 a)\nlet lemma_mod_pow2_sub x a b =\n calc (==) {\n x / pow2 a % pow2 b * pow2 a;\n (==) { Math.Lemmas.pow2_modulo_division_lemma_1 x a (a + b) }\n x % pow2 (a + b) / pow2 a * pow2 a;\n (==) { Math.Lemmas.euclidean_division_definition (x % pow2 (a + b)) (pow2 a) }\n x % pow2 (a + b) - x % pow2 (a + b) % pow2 a;\n (==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 x a (a + b) }\n x % pow2 (a + b) - x % pow2 a;\n }", "val lemma_mod_pow2_sub: x:nat -> a:nat -> b:nat ->\n Lemma (x / pow2 a % pow2 b * pow2 a == x % pow2 (a + b) - x % pow2 a)\nlet lemma_mod_pow2_sub x a b =\n calc (==) {\n x / pow2 a % pow2 b * pow2 a;\n (==) { Math.Lemmas.pow2_modulo_division_lemma_1 x a (a + b) }\n x % pow2 (a + b) / pow2 a * pow2 a;\n (==) { Math.Lemmas.euclidean_division_definition (x % pow2 (a + b)) (pow2 a) }\n x % pow2 (a + b) - x % pow2 (a + b) % pow2 a;\n (==) { Math.Lemmas.pow2_modulo_modulo_lemma_1 x a (a + b) }\n x % pow2 (a + b) - x % pow2 a;\n }", "val lemma_pow_mod_mul: f:S.qelem -> a:nat -> b:nat ->\n Lemma (S.qmul (M.pow f a % S.q) (M.pow f b % S.q) == M.pow f (a + b) % S.q)\nlet lemma_pow_mod_mul f a b =\n calc (==) {\n S.qmul (M.pow f a % S.q) (M.pow f b % S.q);\n (==) {\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow f a) (M.pow f b % S.q) S.q;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow f a) (M.pow f b) S.q }\n M.pow f a * M.pow f b % S.q;\n (==) { M.lemma_pow_add f a b }\n M.pow f (a + b) % S.q;\n }", "val pow_nat_mont_is_pow: n:pos -> r:nat -> d:int{r * d % n = 1} -> aM:nat_mod n -> b:nat ->\n Lemma (pow (aM * d % n) b * r % n == LE.pow (mk_nat_mont_comm_monoid n r d) aM b)\nlet rec pow_nat_mont_is_pow n r d aM b =\n let k = mk_nat_mont_comm_monoid n r d in\n if b = 0 then begin\n calc (==) {\n pow (aM * d % n) b * r % n;\n (==) { lemma_pow0 (aM * d % n) }\n 1 * r % n;\n (==) { LE.lemma_pow0 k aM }\n LE.pow k aM b;\n }; () end\n else begin\n calc (==) {\n pow (aM * d % n) b * r % n;\n (==) { lemma_pow_unfold (aM * d % n) b }\n (aM * d % n) * pow (aM * d % n) (b - 1) * r % n;\n (==) {\n Math.Lemmas.paren_mul_right (aM * d % n) (pow (aM * d % n) (b - 1)) r;\n Math.Lemmas.lemma_mod_mul_distr_r (aM * d % n) (pow (aM * d % n) (b - 1) * r) n }\n (aM * d % n) * (pow (aM * d % n) (b - 1) * r % n) % n;\n (==) { pow_nat_mont_is_pow n r d aM (b - 1) }\n (aM * d % n) * LE.pow k aM (b - 1) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l (aM * d) (LE.pow k aM (b - 1)) n }\n aM * d * LE.pow k aM (b - 1) % n;\n (==) {\n Math.Lemmas.paren_mul_right aM d (LE.pow k aM (b - 1));\n Math.Lemmas.paren_mul_right aM (LE.pow k aM (b - 1)) d }\n aM * LE.pow k aM (b - 1) * d % n;\n (==) { LE.lemma_pow_unfold k aM b }\n LE.pow k aM b;\n }; () end", "val lemma_pow_mod_mul: f:S.felem -> a:nat -> b:nat ->\n Lemma (S.fmul (M.pow f a % S.prime) (M.pow f b % S.prime) == M.pow f (a + b) % S.prime)\nlet lemma_pow_mod_mul f a b =\n calc (==) {\n S.fmul (M.pow f a % S.prime) (M.pow f b % S.prime);\n (==) {\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow f a) (M.pow f b % S.prime) S.prime;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow f a) (M.pow f b) S.prime }\n M.pow f a * M.pow f b % S.prime;\n (==) { M.lemma_pow_add f a b }\n M.pow f (a + b) % S.prime;\n }", "val lemma_pow_mod_mul: f:S.felem -> a:nat -> b:nat ->\n Lemma (S.fmul (M.pow f a % S.prime) (M.pow f b % S.prime) == M.pow f (a + b) % S.prime)\nlet lemma_pow_mod_mul f a b =\n calc (==) {\n S.fmul (M.pow f a % S.prime) (M.pow f b % S.prime);\n (==) {\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow f a) (M.pow f b % S.prime) S.prime;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow f a) (M.pow f b) S.prime }\n M.pow f a * M.pow f b % S.prime;\n (==) { M.lemma_pow_add f a b }\n M.pow f (a + b) % S.prime;\n }", "val lemma_pow_mod_mul: f:S.qelem -> a:nat -> b:nat ->\n Lemma (S.qmul (M.pow f a % S.order) (M.pow f b % S.order) == M.pow f (a + b) % S.order)\nlet lemma_pow_mod_mul f a b =\n calc (==) {\n S.qmul (M.pow f a % S.order) (M.pow f b % S.order);\n (==) {\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow f a) (M.pow f b % S.order) S.order;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow f a) (M.pow f b) S.order }\n M.pow f a * M.pow f b % S.order;\n (==) { M.lemma_pow_add f a b }\n M.pow f (a + b) % S.order;\n }", "val a_pow2_128_lemma: #t:Type -> k:SE.concrete_ops t -> a:t ->\n Lemma (k.SE.to.SE.refl (a_pow2_128 k a) ==\n LE.pow k.SE.to.SE.comm_monoid (k.SE.to.SE.refl a) (pow2 128))\nlet a_pow2_128_lemma #t k a =\n let cm = k.SE.to.SE.comm_monoid in\n let refl = k.SE.to.SE.refl in\n calc (==) {\n refl (a_pow2_128 k a);\n (==) { }\n refl (SE.exp_pow2 k (a_pow2_64 k a) 64);\n (==) { a_pow2_64_lemma k (a_pow2_64 k a) }\n LE.pow cm (refl (a_pow2_64 k a)) (pow2 64);\n (==) { a_pow2_64_lemma k a }\n LE.pow cm (LE.pow cm (refl a) (pow2 64)) (pow2 64);\n (==) { LE.lemma_pow_mul cm (refl a) (pow2 64) (pow2 64) }\n LE.pow cm (refl a) (pow2 64 * pow2 64);\n (==) { Math.Lemmas.pow2_plus 64 64 }\n LE.pow cm (refl a) (pow2 128);\n }", "val lemma_mmul_pmul (a b m: poly) (n: nat)\n : Lemma (requires poly_length m > 0 /\\ n >= poly_length b)\n (ensures mod (mmul a b m n) m == mod (pmul a b) m)\nlet rec lemma_mmul_pmul (a b m:poly) (n:nat) : Lemma\n (requires poly_length m > 0 /\\ n >= poly_length b)\n (ensures mod (mmul a b m n) m == mod (pmul a b) m)\n =\n PL.lemma_index_all ();\n if n = poly_length b then lemma_mmul_pmul_rec a b m n\n else lemma_mmul_pmul a b m (n - 1)", "val pow_one (k:nat) : Lemma (pow 1 k == 1)\nlet rec pow_one = function\n | 0 -> ()\n | k -> pow_one (k - 1)", "val lemma_propagate_pow_mod (a b n: nat)\n : Lemma (requires b > 0)\n (ensures (let open FStar.Mul in (pow2 n * a) % (pow2 n * b) = pow2 n * (a % b)))\nlet rec lemma_propagate_pow_mod (a b n:nat) : Lemma\n (requires b > 0)\n (ensures (\n let open FStar.Mul in\n (pow2 n * a) % (pow2 n * b) = pow2 n * (a % b))) =\n let open FStar.Mul in\n let open FStar.Math.Lemmas in\n if n = 0 then ()\n else begin\n let res = (pow2 n * a) % (pow2 n * b) in\n lemma_propagate_mul_mod (pow2 (n-1) * a) (pow2 (n-1) * b);\n assert (res = 2 * ((pow2 (n-1) * a) % (pow2 (n-1) * b)));\n lemma_propagate_pow_mod a b (n-1);\n assert (res = 2 * (pow2 (n-1) * (a%b)));\n recompose_pow2_assoc n (a%b)\n end", "val pow_eq: a:nat -> n:nat -> Lemma (Fermat.pow a n == pow a n)\nlet rec pow_eq a n =\n if n = 0 then ()\n else pow_eq a (n - 1)", "val lemma_mmul_smul (a b m: poly) (n: nat)\n : Lemma (requires degree m >= 0 /\\ degree a < degree m) (ensures smul a b m n == mmul a b m n)\nlet lemma_mmul_smul (a b m:poly) (n:nat) : Lemma\n (requires degree m >= 0 /\\ degree a < degree m)\n (ensures smul a b m n == mmul a b m n)\n =\n lemma_mmul_smul_rec a b m n", "val lemma_aux_0 (a b n: nat)\n : Lemma\n (pow2 n * a + pow2 (n + 56) * b = pow2 n * (a % pow2 56) + pow2 (n + 56) * (b + a / pow2 56))\nlet lemma_aux_0 (a:nat) (b:nat) (n:nat) : Lemma\n (pow2 n * a + pow2 (n+56) * b = pow2 n * (a % pow2 56) + pow2 (n+56) * (b + a / pow2 56))\n = Math.Lemmas.lemma_div_mod a (pow2 56);\n Math.Lemmas.pow2_plus n 56;\n assert(a = pow2 56 * (a / pow2 56) + (a % pow2 56));\n Math.Lemmas.distributivity_add_right (pow2 n) (pow2 56 * (a / pow2 56)) (a % pow2 56);\n Math.Lemmas.paren_mul_right (pow2 n) (pow2 56) (a / pow2 56);\n Math.Lemmas.distributivity_add_right (pow2 (n+56)) b (a / pow2 56)", "val lemma_mmul_smul_rec (a b m: poly) (n: nat)\n : Lemma (requires degree m >= 0 /\\ degree a < degree m)\n (ensures\n smul_rec a b m n == (mmul a b m n, shift a n %. m, shift b (- n)) /\\\n mmul a b m n == mmul a b m n %. m)\nlet rec lemma_mmul_smul_rec (a b m:poly) (n:nat) : Lemma\n (requires degree m >= 0 /\\ degree a < degree m)\n (ensures\n smul_rec a b m n == (mmul a b m n, shift a n %. m, shift b (-n)) /\\\n mmul a b m n == mmul a b m n %. m\n )\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n PL.lemma_mod_small a m;\n PL.lemma_mod_small zero m;\n lemma_equal (shift a 0) a;\n let (p0, a0, b0) = smul_rec a b m n in\n if n > 0 then\n (\n let n1 = n - 1 in\n let (p1, a1, b1) = smul_rec a b m n1 in\n lemma_mmul_smul_rec a b m n1;\n PL.lemma_shift_shift b (-n1) (-1);\n PL.lemma_shift_shift a n1 1;\n PL.lemma_shift_mod (shift a n1) m 1;\n PL.lemma_mod_distribute p1 a1 m;\n PL.lemma_mod_mod (shift a n1) m;\n lemma_mod_bit1 (shift a1 1) m;\n //assert ((p1 +. a1) %. m == p1 %. m +. a1 %. m);\n //assert ((p1 +. a1) %. m == p1 %. m +. (shift a n1 %. m));\n //assert ((p1 +. a1) %. m == p1 +. (shift a n1 %. m));\n lemma_add_zero p1;\n ()\n );\n lemma_equal b0 (shift b (-n));\n ()", "val lemma_pow2_div (a b k: nat)\n : Lemma (requires a >= k /\\ b >= k)\n (ensures (pow2 a + pow2 b) / pow2 k == pow2 (a - k) + pow2 (b - k))\nlet lemma_pow2_div (a:nat) (b:nat) (k:nat)\n : Lemma (requires a >= k /\\ b >= k)\n (ensures (pow2 a + pow2 b) / pow2 k == pow2 (a - k) + pow2 (b - k))\n =\n let open FStar.Math.Lemmas in\n let open FStar.Mul in\n pow2_plus k (b - k);\n division_addition_lemma (pow2 a) (pow2 k) (pow2 (b-k));\n pow2_minus b k;\n pow2_minus a k", "val lemma_point_mul_base_precomp4: #t:Type -> k:LE.comm_monoid t -> a:t -> b:nat{b < pow2 256} ->\n Lemma (exp_as_exp_four_nat256_precomp k a b == LE.pow k a b)\nlet lemma_point_mul_base_precomp4 #t k a b =\n let (b0, b1, b2, b3) = decompose_nat256_as_four_u64 b in\n let a_pow2_64 = LE.pow k a (pow2 64) in\n let a_pow2_128 = LE.pow k a (pow2 128) in\n let a_pow2_192 = LE.pow k a (pow2 192) in\n let res = LE.exp_four_fw k a 64 b0 a_pow2_64 b1 a_pow2_128 b2 a_pow2_192 b3 4 in\n\n calc (==) {\n LE.exp_four_fw k a 64 b0 a_pow2_64 b1 a_pow2_128 b2 a_pow2_192 b3 4;\n (==) { LE.exp_four_fw_lemma k a 64 b0 a_pow2_64 b1 a_pow2_128 b2 a_pow2_192 b3 4 }\n k.LE.mul\n (k.LE.mul\n (k.LE.mul (LE.pow k a b0) (LE.pow k (LE.pow k a (pow2 64)) b1))\n (LE.pow k a_pow2_128 b2))\n (LE.pow k a_pow2_192 b3);\n (==) { LE.lemma_pow_mul k a (pow2 64) b1 }\n k.LE.mul\n (k.LE.mul\n (k.LE.mul (LE.pow k a b0) (LE.pow k a (b1 * pow2 64)))\n (LE.pow k a_pow2_128 b2))\n (LE.pow k a_pow2_192 b3);\n (==) { LE.lemma_pow_add k a b0 (b1 * pow2 64) }\n k.LE.mul\n (k.LE.mul\n (LE.pow k a (b0 + b1 * pow2 64))\n (LE.pow k (LE.pow k a (pow2 128)) b2))\n (LE.pow k a_pow2_192 b3);\n (==) { LE.lemma_pow_mul k a (pow2 128) b2 }\n k.LE.mul\n (k.LE.mul (LE.pow k a (b0 + b1 * pow2 64)) (LE.pow k a (b2 * pow2 128)))\n (LE.pow k a_pow2_192 b3);\n (==) { LE.lemma_pow_add k a (b0 + b1 * pow2 64) (b2 * pow2 128) }\n k.LE.mul\n (LE.pow k a (b0 + b1 * pow2 64 + b2 * pow2 128))\n (LE.pow k (LE.pow k a (pow2 192)) b3);\n (==) { LE.lemma_pow_mul k a (pow2 192) b3 }\n k.LE.mul\n (LE.pow k a (b0 + b1 * pow2 64 + b2 * pow2 128))\n (LE.pow k a (b3 * pow2 192));\n (==) { LE.lemma_pow_add k a (b0 + b1 * pow2 64 + b2 * pow2 128) (b3 * pow2 192) }\n LE.pow k a (b0 + b1 * pow2 64 + b2 * pow2 128 + b3 * pow2 192);\n (==) { lemma_decompose_nat256_as_four_u64 b }\n LE.pow k a b;\n }", "val lemma_pow_one: b:nat -> Lemma (pow 1 b = 1)\nlet lemma_pow_one b =\n let k = mk_nat_comm_monoid in\n LE.lemma_pow_one k b;\n lemma_pow_nat_is_pow 1 b", "val pow2_m_minus_one_eq (n m: nat)\n : Lemma (requires (m <= n)) (ensures ((pow2 n - 1) / pow2 m == pow2 (n - m) - 1))\nlet pow2_m_minus_one_eq\n (n: nat)\n (m: nat)\n: Lemma\n (requires (m <= n))\n (ensures (\n (pow2 n - 1) / pow2 m == pow2 (n - m) - 1 \n ))\n= M.pow2_le_compat n m;\n M.pow2_plus (n - m) m;\n M.division_definition (pow2 n - 1) (pow2 m) (pow2 (n - m) - 1)", "val lemma_iand_maybe_pow2 (n:pos) (x y:natN (pow2 n)) (i:nat{i < n}) : Lemma\n (requires (x == 0 \\/ x == pow2 i) /\\ (y == 0 \\/ y == pow2 i))\n (ensures not (iand x y = 0) <==> not (x = 0) /\\ not (y = 0))\nlet lemma_iand_maybe_pow2 (n:pos) (x y:natN (pow2 n)) (i:nat{i < n}) : Lemma\n (requires (x == 0 \\/ x == pow2 i) /\\ (y == 0 \\/ y == pow2 i))\n (ensures not (iand x y = 0) <==> not (x = 0) /\\ not (y = 0))\n =\n let open FStar.UInt in\n reveal_iand_all n;\n let result = iand x y in\n (* Prove ==> *)\n if not (iand x y = 0) then (\n if x = 0 then (\n assert (x = zero n);\n logand_commutative #n x y;\n logand_lemma_1 #n y;\n assert (iand x y = 0)\n ) else ()\n ;\n assert (not (x = 0));\n if y = 0 then (\n assert (y = zero n);\n logand_commutative #n x y;\n logand_lemma_1 #n x;\n assert (iand x y = 0)\n ) else ()\n ;\n assert (not (y = 0));\n ()\n ) else ()\n ;\n (* Prove <== *)\n if not (x = 0) && not (y = 0) then (\n assert (x = pow2 i /\\ y = pow2 i);\n logand_self #n (pow2 i);\n assert (result = pow2 i)\n ) else ()\n ;\n ()", "val pow_eq: a:nat -> n:nat -> Lemma (Fermat.pow a n == Lib.NatMod.pow a n)\nlet rec pow_eq a n =\n if n = 0 then ()\n else pow_eq a (n - 1)", "val mod_mul_pow2 : n:nat -> e1:nat -> e2:nat ->\n Lemma (n % pow2 e1 * pow2 e2 <= pow2 (e1+e2) - pow2 e2)\nlet mod_mul_pow2 n e1 e2 =\n Math.lemma_mod_lt n (pow2 e1);\n Math.lemma_mult_le_right (pow2 e2) (n % pow2 e1) (pow2 e1 - 1);\n assert (n % pow2 e1 * pow2 e2 <= pow2 e1 * pow2 e2 - pow2 e2);\n Math.pow2_plus e1 e2", "val lemma_mont_mul_assoc: n:pos -> d:int -> a:nat_mod n -> b:nat_mod n -> c:nat_mod n ->\n Lemma (mont_mul n d (mont_mul n d a b) c == mont_mul n d a (mont_mul n d b c))\nlet lemma_mont_mul_assoc n d a b c =\n calc (==) {\n mont_mul n d (mont_mul n d a b) c;\n (==) { }\n (a * b * d % n) * c * d % n;\n (==) { Math.Lemmas.paren_mul_right (a * b * d % n) c d }\n (a * b * d % n) * (c * d) % n;\n (==) { M.lemma_mod_mul_distr3 1 (a * b * d) (c * d) n }\n a * b * d * (c * d) % n;\n (==) { Math.Lemmas.paren_mul_right (a * b * d) c d }\n a * b * d * c * d % n;\n (==) { Math.Lemmas.paren_mul_right a b d; Math.Lemmas.paren_mul_right a (b * d) c }\n a * (b * d * c) * d % n;\n (==) { Math.Lemmas.paren_mul_right b d c; Math.Lemmas.paren_mul_right b c d }\n a * (b * c * d) * d % n;\n (==) { M.lemma_mod_mul_distr3 a (b * c * d) d n }\n mont_mul n d a (mont_mul n d b c);\n }", "val lemma_mod_mul_assoc (n:pos) (a b c:nat) : Lemma ((a * b % n) * c % n == (a * (b * c % n)) % n)\nlet lemma_mod_mul_assoc m a b c =\n calc (==) {\n (a * b % m) * c % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c m }\n (a * b) * c % m;\n (==) { Math.Lemmas.paren_mul_right a b c }\n a * (b * c) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) m }\n a * (b * c % m) % m;\n }", "val a_pow2_64_lemma: #t:Type -> k:SE.concrete_ops t -> a:t ->\n Lemma (k.SE.to.SE.refl (a_pow2_64 k a) ==\n LE.pow k.SE.to.SE.comm_monoid (k.SE.to.SE.refl a) (pow2 64))\nlet a_pow2_64_lemma #t k a =\n SE.exp_pow2_lemma k a 64;\n LE.exp_pow2_lemma k.SE.to.SE.comm_monoid (k.SE.to.SE.refl a) 64", "val lemma_mul_pow2_bound (b: nat{b > 1}) (x y: natN (pow2 b))\n : Lemma (x * y < pow2 (2 * b) - 1 /\\ x * y <= pow2 (2 * b) - 2 * pow2 (b) + 1)\nlet lemma_mul_pow2_bound (b:nat{b > 1}) (x y:natN (pow2 b))\n : Lemma (x * y < pow2 (2*b) - 1 /\\\n x * y <= pow2 (2*b) - 2*pow2(b) + 1)\n = lemma_mul_bounds_le x (pow2 b - 1) y (pow2 b -1);\n pow2_plus b b;\n assert ( (pow2 b - 1) * (pow2 b -1) = pow2 (2*b) - 2*pow2(b) + 1)", "val mod_then_mul_64 (n: nat) : Lemma ((n % pow2 64) * pow2 64 == n * pow2 64 % pow2 128)\nlet mod_then_mul_64 (n:nat) : Lemma (n % pow2 64 * pow2 64 == n * pow2 64 % pow2 128) =\n Math.pow2_plus 64 64;\n mod_mul n (pow2 64) (pow2 64)", "val lemma_iand_nth_all (n:pos) : Lemma\n (forall (m:_{m==pow2_norm n}) (x y:natN (pow2 n)).{:pattern (iand #m x y)}\n (forall (i:nat{i < n}).{:pattern (nth #n (iand #m x y) i)}\n nth #n (iand #m x y) i == (nth #n x i && nth #n y i)))\nlet lemma_iand_nth_all n =\n FStar.Classical.forall_intro_2 (lemma_iand_nth n)", "val lemma_mmul_pmul_rec (a b m: poly) (n: nat)\n : Lemma (requires poly_length m > 0) (ensures mod (mmul a b m n) m == mod (pmul_rec a b n) m)\nlet rec lemma_mmul_pmul_rec (a b m:poly) (n:nat) : Lemma\n (requires poly_length m > 0)\n (ensures mod (mmul a b m n) m == mod (pmul_rec a b n) m)\n =\n if n > 0 then\n (\n let n' = n - 1 in\n let mp = mmul a b m n' in\n let pp = pmul_rec a b n' in\n lemma_mmul_pmul_rec a b m (n - 1);\n assert (mod mp m == mod pp m);\n let s = shift a n' in\n PL.lemma_mod_distribute pp s m;\n PL.lemma_mod_distribute mp s m;\n PL.lemma_mod_distribute mp (s %. m) m;\n PL.lemma_mod_mod s m;\n //assert ((mp +. (s %. m)) %. m == (mp +. s) %. m);\n //assert ((mp +. s) %. m == (pp +. s) %. m);\n //assert (mod (add mp (mod s m)) m == mod (add pp s) m);\n //assert (mod (add mp (mod (shift a n') m)) m == mod (add pp (shift a n')) m);\n ()\n )", "val lemma_mul_mod_prime_zero: #m:prime -> a:nat_mod m -> b:nat_mod m ->\n Lemma (a * b % m == 0 <==> (a % m == 0 \\/ b % m == 0))\nlet lemma_mul_mod_prime_zero #m a b =\n Classical.move_requires_3 Euclid.euclid_prime m a b;\n Classical.move_requires_3 lemma_mul_mod_zero2 m a b", "val lemma_ishl_32 (x: nat32) (k: nat) : Lemma (ensures ishl #pow2_32 x k == x * pow2 k % pow2_32)\nlet lemma_ishl_32 (x:nat32) (k:nat) : Lemma\n (ensures ishl #pow2_32 x k == x * pow2 k % pow2_32)\n =\n Vale.Def.TypesNative_s.reveal_ishl 32 x k;\n FStar.UInt.shift_left_value_lemma #32 x k;\n ()", "val mod_spec_multiply : n:nat -> k:pos ->\n Lemma ((n - n%k) / k * k == n - n%k)\nlet mod_spec_multiply n k =\n Math.lemma_mod_spec2 n k", "val mod_mul_cancel (n: nat) (k: nat{k > 0}) : Lemma ((n * k) % k == 0)\nlet mod_mul_cancel (n:nat) (k:nat{k > 0}) :\n Lemma ((n * k) % k == 0) =\n mod_spec (n * k) k;\n mul_div_cancel n k;\n ()", "val pow2_multiplication_modulo_lemma_2: a:int -> b:nat -> c:nat{c <= b} ->\n Lemma ( (a * pow2 c) % pow2 b = (a % pow2 (b - c)) * pow2 c )\nlet pow2_multiplication_modulo_lemma_2 a b c =\n calc (==) {\n (a * pow2 c) % pow2 b;\n == {}\n (a * pow2 c) % pow2 (c + (b-c));\n == { pow2_plus c (b-c) }\n (a * pow2 c) % (pow2 c * pow2 (b-c));\n == { modulo_scale_lemma a (pow2 c) (pow2 (b-c)) }\n (a % pow2 (b - c)) * pow2 c;\n }", "val lemma_mul_element_rec (a b: poly) (k n: int)\n : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\nlet rec lemma_mul_element_rec (a b:poly) (k:int) (n:int) : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\n =\n reveal_defs ();\n if n > 0 then lemma_mul_element_rec a b k (n - 1)", "val lemma_mul_assoc4: #t:Type -> k:comm_monoid t -> a1:t -> a2:t -> a3:t -> a4:t ->\n Lemma (k.mul a1 (k.mul (k.mul a2 a3) a4) == k.mul (k.mul (k.mul a1 a2) a3) a4)\nlet lemma_mul_assoc4 #t k a1 a2 a3 a4 =\n calc (==) {\n k.mul a1 (k.mul (k.mul a2 a3) a4);\n (==) { k.lemma_mul_assoc a1 (k.mul a2 a3) a4 }\n k.mul (k.mul a1 (k.mul a2 a3)) a4;\n (==) { k.lemma_mul_assoc a1 a2 a3 }\n k.mul (k.mul (k.mul a1 a2) a3) a4;\n }", "val lemma_ixor_nth (n:pos) (x y:natN (pow2 n)) : Lemma\n (forall (m:_{m==pow2_norm n}) (i:nat{i < n}).{:pattern (nth #n (ixor #m x y) i)}\n nth #n (ixor #m x y) i == (nth #n x i <> nth #n y i))\nlet lemma_ixor_nth n x y =\n FStar.Classical.forall_intro (lemma_ixor_nth_i n x y)", "val lemma_mul_pmul_k_left (a b: poly) (k: int) (n: nat) (n': int)\n : Lemma (requires k + 1 <= n' /\\ n' <= n)\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases (n - n'))\nlet rec lemma_mul_pmul_k_left (a b:poly) (k:int) (n:nat) (n':int) : Lemma\n (requires k + 1 <= n' /\\ n' <= n)\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases (n - n'))\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n if n > n' then lemma_mul_pmul_k_left a b k n (n' + 1)\n else lemma_mul_pmul_k_base a b k n", "val lemma_div_lt_nat: a:int -> n:nat -> m:nat{m <= n} ->\n Lemma (requires (a < pow2 n))\n (ensures (a / pow2 m < pow2 (n-m)))\nlet lemma_div_lt_nat a n m =\n lemma_div_mod a (pow2 m);\n assert(a = pow2 m * (a / pow2 m) + a % pow2 m);\n pow2_plus m (n-m);\n assert(pow2 n = pow2 m * pow2 (n - m))", "val bn_mul_by_pow2: #t:limb_t -> len:size_nat -> n:lbignum t len -> b:lbignum t len -> k:nat -> Lemma\n (requires 0 < bn_v n /\\ bn_v b < bn_v n)\n (ensures bn_v (Loops.repeati k (bn_lshift1_mod_n n) b) == pow2 k * bn_v b % bn_v n)\nlet rec bn_mul_by_pow2 #t len n b k =\n if k = 0 then Loops.eq_repeati0 k (bn_lshift1_mod_n n) b\n else begin\n let res = Loops.repeati k (bn_lshift1_mod_n n) b in\n let res0 = Loops.repeati (k - 1) (bn_lshift1_mod_n n) b in\n bn_mul_by_pow2 len n b (k - 1);\n assert (bn_v res0 == pow2 (k - 1) * bn_v b % bn_v n);\n Loops.unfold_repeati k (bn_lshift1_mod_n n) b (k - 1);\n assert (res == bn_lshift1_mod_n n (k - 1) res0);\n bn_lshift1_mod_n_lemma n (k - 1) res0;\n assert (bn_v res == 2 * (pow2 (k - 1) * bn_v b % bn_v n) % bn_v n);\n Math.Lemmas.lemma_mod_mul_distr_r 2 (pow2 (k - 1) * bn_v b) (bn_v n);\n assert (bn_v res == 2 * pow2 (k - 1) * bn_v b % bn_v n);\n Math.Lemmas.pow2_plus 1 (k - 1) end", "val lemma_ishl_64 (x: nat64) (k: nat) : Lemma (ensures ishl #pow2_64 x k == x * pow2 k % pow2_64)\nlet lemma_ishl_64 (x:nat64) (k:nat) : Lemma\n (ensures ishl #pow2_64 x k == x * pow2 k % pow2_64)\n =\n Vale.Def.TypesNative_s.reveal_ishl 64 x k;\n FStar.UInt.shift_left_value_lemma #64 x k;\n ()", "val lemma_iand_nth_i (n:pos) (x y:natN (pow2 n)) (i:nat{i < n}) : Lemma\n (nth #n (iand x y) i == (nth #n x i && nth #n y i))\nlet lemma_iand_nth_i n x y i =\n reveal_iand n x y", "val lemma_shift_is_mul (a:poly) (n:nat) : Lemma (shift a n == a *. (monomial n))\nlet lemma_shift_is_mul a n = I.lemma_shift_is_mul (to_poly a) n", "val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) :\n Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e))\nlet lemma_distr_pow_pow a b c d e =\n calc (==) {\n (a * pow2 b + c * pow2 d) * pow2 e;\n (==) { lemma_distr_pow (a * pow2 b) c d e }\n a * pow2 b * pow2 e + c * pow2 (d + e);\n (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e }\n a * pow2 (b + e) + c * pow2 (d + e);\n }", "val lemma_mul_pmul_k_right (a b: poly) (k: int) (n n': nat)\n : Lemma (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases n')\nlet rec lemma_mul_pmul_k_right (a b:poly) (k:int) (n n':nat) : Lemma\n (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases n')\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n if n' > n then lemma_mul_pmul_k_right a b k n (n' - 1)\n else lemma_mul_pmul_k_base a b k n", "val lemma_mult_distr_3 (a b c n: nat)\n : Lemma ((a + b - c * pow2 56) * pow2 n == a * pow2 n + b * pow2 n - c * pow2 (n + 56))\nlet lemma_mult_distr_3 (a b c:nat) (n:nat) : Lemma\n ((a + b - c * pow2 56) * pow2 n == a * pow2 n + b * pow2 n - c * pow2 (n + 56))\n =\n Math.Lemmas.distributivity_sub_left (a + b) (c * pow2 56) (pow2 n);\n Math.Lemmas.distributivity_add_left a b (pow2 n);\n Math.Lemmas.pow2_plus 56 n", "val lemma_mul_pow256_add (x y: nat) : Lemma ((x + y * pow2_256) % prime == (x + y * 38) % prime)\nlet lemma_mul_pow256_add (x y:nat) :\n Lemma ((x + y * pow2_256) % prime == (x + y * 38) % prime)\n =\n assert_norm (pow2_256 % prime == 38);\n ()", "val lemma_mul_pow2_bound (b:nat{b > 1}) (x y:natN (pow2 b)) :\n Lemma (x * y < pow2 (2*b) - 1 /\\\n x * y <= pow2 (2*b) - 2*pow2(b) + 1)\nlet lemma_mul_pow2_bound (b:nat{b > 1}) (x y:natN (pow2 b)) :\n Lemma (x * y < pow2 (2*b) - 1 /\\\n x * y <= pow2 (2*b) - 2*pow2(b) + 1)\n =\n lemma_mul_bounds_le x (pow2 b - 1) y (pow2 b -1);\n pow2_plus b b;\n assert ( (pow2 b - 1) * (pow2 b -1) = pow2 (2*b) - 2*pow2(b) + 1);\n ()", "val pow2_multiplication_division_lemma_1: a:int -> b:nat -> c:nat{c >= b} ->\n Lemma ( (a * pow2 c) / pow2 b = a * pow2 (c - b))\nlet pow2_multiplication_division_lemma_1 a b c =\n pow2_plus (c - b) b;\n paren_mul_right a (pow2 (c - b)) (pow2 b);\n paren_mul_left a (pow2 (c - b)) (pow2 b);\n multiple_division_lemma (a * pow2 (c - b)) (pow2 b)", "val exp_pow2_loop_lemma: #t:Type -> k:comm_monoid t -> a:t -> b:nat -> i:nat{i <= b} ->\n Lemma (Loops.repeat i (sqr k) a == pow k a (pow2 i))\nlet rec exp_pow2_loop_lemma #t k a b i =\n if i = 0 then begin\n Loops.eq_repeat0 (sqr k) a;\n assert_norm (pow2 0 = 1);\n lemma_pow1 k a end\n else begin\n Loops.unfold_repeat b (sqr k) a (i - 1);\n exp_pow2_loop_lemma k a b (i - 1);\n lemma_pow_add k a (pow2 (i - 1)) (pow2 (i - 1));\n Math.Lemmas.pow2_double_sum (i - 1);\n () end", "val lemma_mul_pmul_k (a b: poly) (k: int) : Lemma ((mul_def a b).[ k ] == (pmul b a).[ k ])\nlet lemma_mul_pmul_k (a b:poly) (k:int) : Lemma\n ((mul_def a b).[k] == (pmul b a).[k])\n =\n PL.lemma_index_all ();\n let n = poly_length a in\n lemma_pmul_degree b a n;\n if n = k + 1 then lemma_mul_pmul_k_base a b k n\n else if n > k + 1 then lemma_mul_pmul_k_left a b k n (k + 1)\n else lemma_mul_pmul_k_right a b k n (k + 1)", "val lemma_shift_is_mul (a: poly) (n: nat) : Lemma (shift a n =. a *. (monomial n))\nlet lemma_shift_is_mul (a:poly) (n:nat) : Lemma (shift a n =. a *. (monomial n)) =\n let an = shift a n in\n let b = monomial n in\n let lem (k:nat) : Lemma (an.[k] == mul_element a b k) =\n if k < n then\n lemma_sum_of_zero 0 k (mul_element_fun a b k)\n else\n lemma_sum_extend 0 (k - n) (k - n + 1) (k + 1) (mul_element_fun a b k)\n in\n FStar.Classical.forall_intro lem", "val lemma_mul_pmul_k_base (a b: poly) (k: int) (n: nat)\n : Lemma (requires True)\n (ensures sum_of_bools 0 n (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases n)\nlet rec lemma_mul_pmul_k_base (a b:poly) (k:int) (n:nat) : Lemma\n (requires True)\n (ensures sum_of_bools 0 n (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases n)\n =\n PL.lemma_index_all ();\n PL.lemma_add_define_all ();\n PL.lemma_shift_define_all ();\n if n > 0 then lemma_mul_pmul_k_base a b k (n - 1)", "val mul_pow2_diff: a:nat -> n1:nat -> n2:nat{n2 <= n1} ->\n Lemma (a * pow2 (n1 - n2) == a * pow2 n1 / pow2 n2)\nlet mul_pow2_diff a n1 n2 =\n Math.paren_mul_right a (pow2 (n1-n2)) (pow2 n2);\n mul_div_cancel (a * pow2 (n1 - n2)) (pow2 n2);\n Math.pow2_plus (n1 - n2) n2", "val lemma_div_mod_eq_mul_mod: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma ((div_mod a b = c) == (a = mul_mod c b))\nlet lemma_div_mod_eq_mul_mod #m a b c =\n lemma_div_mod_eq_mul_mod1 a b c;\n lemma_div_mod_eq_mul_mod2 a b c", "val pow2_le_compat: n:nat -> m:nat -> Lemma\n (requires (m <= n))\n (ensures (pow2 m <= pow2 n))\nlet pow2_le_compat n m =\n if m < n then pow2_lt_compat n m", "val lemma_pow_mod_prime_zero: #m:prime -> a:nat_mod m -> b:pos ->\n Lemma (pow_mod #m a b = 0 <==> a = 0)\nlet lemma_pow_mod_prime_zero #m a b =\n lemma_pow_mod #m a b;\n Classical.move_requires_2 lemma_pow_mod_prime_zero_ a b;\n Classical.move_requires lemma_pow_zero b", "val pow2_multiplication_modulo_lemma_1: a:int -> b:nat -> c:nat{c >= b} ->\n Lemma ( (a * pow2 c) % pow2 b = 0 )\nlet pow2_multiplication_modulo_lemma_1 a b c =\n pow2_plus (c - b) b;\n paren_mul_right a (pow2 (c - b)) (pow2 b);\n paren_mul_left a (pow2 (c - b)) (pow2 b);\n multiple_modulo_lemma (a * pow2 (c - b)) (pow2 b)", "val lemma_div_lt (a:int) (n:nat) (m:nat) : Lemma\n (requires m <= n /\\ a < pow2 n)\n (ensures a / pow2 m < pow2 (n-m))\nlet lemma_div_lt a n m =\n if a >= 0 then FStar.Math.Lemmas.lemma_div_lt a n m\n else ()", "val lemma_inot_nth (n:pos) (x:natN (pow2 n)) : Lemma\n (forall (m:_{m==pow2_norm n}) (i:nat{i < n}).{:pattern (nth #n (inot #m x) i)}\n nth #n (inot #m x) i == not (nth #n x i))\nlet lemma_inot_nth n x =\n FStar.Classical.forall_intro (lemma_inot_nth_i n x)", "val a_pow2_192_lemma: #t:Type -> k:SE.concrete_ops t -> a:t ->\n Lemma (k.SE.to.SE.refl (a_pow2_192 k a) ==\n LE.pow k.SE.to.SE.comm_monoid (k.SE.to.SE.refl a) (pow2 192))\nlet a_pow2_192_lemma #t k a =\n let cm = k.SE.to.SE.comm_monoid in\n let refl = k.SE.to.SE.refl in\n calc (==) {\n refl (a_pow2_192 k a);\n (==) { }\n refl (SE.exp_pow2 k (a_pow2_128 k a) 64);\n (==) { a_pow2_64_lemma k (a_pow2_128 k a) }\n LE.pow cm (refl (a_pow2_128 k a)) (pow2 64);\n (==) { a_pow2_128_lemma k a }\n LE.pow cm (LE.pow cm (refl a) (pow2 128)) (pow2 64);\n (==) { LE.lemma_pow_mul cm (refl a) (pow2 128) (pow2 64) }\n LE.pow cm (refl a) (pow2 128 * pow2 64);\n (==) { Math.Lemmas.pow2_plus 128 64 }\n LE.pow cm (refl a) (pow2 192);\n }" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.lemma_pow_mul" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.lemma_pow_add" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_add" }, { "project_name": "FStar", "file_name": "FStar.Math.Lib.fst", "name": "FStar.Math.Lib.powx_lemma2" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.lemma_pow_distr_mul" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mul_base" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Lemmas.fst", "name": "Vale.Math.Poly2.Lemmas.lemma_mul_monomials" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mod" }, { "project_name": "hacl-star", "file_name": "Spec.Exponentiation.fst", "name": "Spec.Exponentiation.pow_lemma" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_nat_mod_is_pow" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_nat_is_pow" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mod_mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_pow2_le" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_pow2_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Qinv.fst", "name": "Hacl.Spec.P256.Qinv.lemma_pow_pow_mod" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.pow_plus" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Qinv.fst", "name": "Hacl.Spec.K256.Qinv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Finv.fst", "name": "Hacl.Spec.P256.Finv.lemma_pow_pow_mod" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Finv.fst", "name": "Hacl.Spec.K256.Finv.lemma_pow_pow_mod" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Qinv.fst", "name": "Hacl.Spec.P256.Qinv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Finv.fst", "name": "Hacl.Spec.P256.Finv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Finv.fst", "name": "Hacl.Spec.K256.Finv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_double" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.lemma_pow_double" }, { "project_name": "everparse", "file_name": "LowParse.Math.fst", "name": "LowParse.Math.lemma_div_pow2_ge" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mult_lt_sqr" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mul_mod_assoc" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Lemmas.fst", "name": "Vale.Bignum.Lemmas.lemma_add_lo_mul_right" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mod_" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_pow2" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.lemma_pow_mod_is_pow_cm" }, { "project_name": "everparse", "file_name": "LowParse.Math.fst", "name": "LowParse.Math.lemma_div_pow2_le" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.pow_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_nth" }, { "project_name": "hacl-star", "file_name": "Spec.Exponentiation.fst", "name": "Spec.Exponentiation.exp_pow2_lemma" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mod_base" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Finv.fst", "name": "Hacl.Spec.Curve25519.Finv.lemma_pow_one" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fst", "name": "Hacl.Spec.PrecompBaseTable256.lemma_mod_pow2_sub" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Ed25519.PrecompTable.fst", "name": "Hacl.Spec.Ed25519.PrecompTable.lemma_mod_pow2_sub" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fst", "name": "Hacl.Spec.K256.PrecompTable.lemma_mod_pow2_sub" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Qinv.fst", "name": "Hacl.Spec.K256.Qinv.lemma_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Exponentiation.Lemmas.fst", "name": "Hacl.Spec.Exponentiation.Lemmas.pow_nat_mont_is_pow" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Finv.fst", "name": "Hacl.Spec.P256.Finv.lemma_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Finv.fst", "name": "Hacl.Spec.K256.Finv.lemma_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Qinv.fst", "name": "Hacl.Spec.P256.Qinv.lemma_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fst", "name": "Hacl.Spec.PrecompBaseTable256.a_pow2_128_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_pmul" }, { "project_name": "FStar", "file_name": "FStar.Math.Fermat.fst", "name": "FStar.Math.Fermat.pow_one" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_propagate_pow_mod" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.pow_eq" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_smul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Lemmas.fst", "name": "Hacl.Spec.BignumQ.Lemmas.lemma_aux_0" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_smul_rec" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_pow2_div" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fst", "name": "Hacl.Spec.PrecompBaseTable256.lemma_point_mul_base_precomp4" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_one" }, { "project_name": "everparse", "file_name": "LowParse.BitFields.fst", "name": "LowParse.BitFields.pow2_m_minus_one_eq" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_maybe_pow2" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.ModInv.fst", "name": "Hacl.Spec.Bignum.ModInv.pow_eq" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mod_mul_pow2" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Exponentiation.Lemmas.fst", "name": "Hacl.Spec.Exponentiation.Lemmas.lemma_mont_mul_assoc" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Montgomery.fst", "name": "Hacl.Spec.P256.Montgomery.lemma_mod_mul_assoc" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fst", "name": "Hacl.Spec.PrecompBaseTable256.a_pow2_64_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.FastMul_helpers.fst", "name": "Vale.Curve25519.FastMul_helpers.lemma_mul_pow2_bound" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mod_then_mul_64" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_nth_all" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mmul_pmul_rec" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mul_mod_prime_zero" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GCTR.fst", "name": "Vale.AES.GCTR.lemma_ishl_32" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mod_spec_multiply" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mod_mul_cancel" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_2" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_element_rec" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.lemma_mul_assoc4" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_ixor_nth" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_left" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_div_lt_nat" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Montgomery.fst", "name": "Hacl.Spec.Bignum.Montgomery.bn_mul_by_pow2" }, { "project_name": "hacl-star", "file_name": "Vale.AES.Types_helpers.fsti", "name": "Vale.AES.Types_helpers.lemma_ishl_64" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_iand_nth_i" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_shift_is_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr_pow_pow" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_right" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Mul.fst", "name": "Hacl.Spec.BignumQ.Mul.lemma_mult_distr_3" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.FastHybrid_helpers.fsti", "name": "Vale.Curve25519.FastHybrid_helpers.lemma_mul_pow256_add" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.Fast_lemmas_internal.fst", "name": "Vale.Curve25519.Fast_lemmas_internal.lemma_mul_pow2_bound" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.pow2_multiplication_division_lemma_1" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_pow2_loop_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_shift_is_mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_base" }, { "project_name": "FStar", "file_name": "FStar.UInt128.fst", "name": "FStar.UInt128.mul_pow2_diff" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.pow2_le_compat" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_pow_mod_prime_zero" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.pow2_multiplication_modulo_lemma_1" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_div_lt" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fst", "name": "Vale.Arch.TypesNative.lemma_inot_nth" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fst", "name": "Hacl.Spec.PrecompBaseTable256.a_pow2_192_lemma" } ], "selected_premises": [ "Lib.Exponentiation.Definition.lemma_pow_one", "FStar.Mul.op_Star", "Lib.Exponentiation.Definition.lemma_pow1", "Lib.Exponentiation.Definition.lemma_pow_add", "FStar.Pervasives.reveal_opaque", "Lib.Exponentiation.Definition.lemma_inverse_one", "Lib.Exponentiation.Definition.lemma_mul_cancel_inverse", "Lib.Exponentiation.Definition.lemma_cancellation", "Lib.Exponentiation.Definition.lemma_inverse_mul", "Lib.Exponentiation.Definition.lemma_inverse_id", "Lib.LoopCombinators.fixed_a", "Lib.LoopCombinators.fixed_i", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Heap.trivial_preorder", "FStar.Pervasives.dsnd", "FStar.Pervasives.dfst", "FStar.ST.op_Bang", "Prims.pure_pre", "FStar.ST.lemma_functoriality", "FStar.Set.add", "FStar.Monotonic.Heap.modifies_t", "FStar.All.all_wp", "FStar.Set.remove", "FStar.Pervasives.ex_bind_wp", "FStar.ST.lift_gst_state", "Prims.pure_wp_monotonic", "FStar.Set.disjoint", "FStar.ST.st_pre", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.ex_return", "FStar.All.lift_exn_all", "FStar.Pervasives.all_bind_wp", "FStar.All.all_pre", "FStar.Set.as_set'", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.ex_trivial", "Prims.pow2", "FStar.Set.as_set", "FStar.ST.gst_wp", "FStar.Pervasives.pure_return", "FStar.Pervasives.ex_wp", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.all_ite_wp", "FStar.Monotonic.Heap.modifies", "FStar.Calc.calc_chain_compatible", "FStar.All.lift_state_all", "FStar.Pervasives.all_return", "Prims.op_Hat", "FStar.Pervasives.all_trivial", "FStar.Preorder.transitive", "FStar.Monotonic.Heap.op_Hat_Plus_Hat", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.st_return", "FStar.Calc.calc_chain_related", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.all_wp_h", "FStar.ST.stable", "FStar.Pervasives.ex_if_then_else", "FStar.TSet.as_set'", "FStar.Pervasives.all_stronger", "FStar.Monotonic.Heap.tset", "FStar.TSet.subset", "Prims.returnM", "FStar.Pervasives.ex_ite_wp", "FStar.All.all_post", "FStar.ST.lift_div_gst", "FStar.Pervasives.pure_close_wp", "FStar.All.all_post'", "FStar.Pervasives.st_bind_wp", "Prims.subtype_of", "FStar.ST.st_post", "FStar.Preorder.reflexive", "Prims.auto_squash", "FStar.ST.st_post'", "FStar.Pervasives.all_pre_h", "Prims.pure_wp'", "Prims.pure_wp", "Prims.pure_post", "Prims.as_requires", "FStar.Pervasives.st_post_h'", "FStar.ST.heap_rel", "FStar.Preorder.stable", "FStar.Pervasives.coerce_eq", "Prims.pure_trivial", "FStar.Pervasives.lift_div_exn", "FStar.Monotonic.Heap.op_Plus_Plus_Hat", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.st_pre_h", "Prims.pure_post'", "FStar.Pervasives.st_if_then_else", "FStar.Monotonic.Heap.set", "FStar.Monotonic.Heap.equal_dom", "FStar.ST.gst_post'", "FStar.Monotonic.Heap.op_Hat_Plus_Plus", "FStar.ST.gst_pre", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.all_post_h'", "FStar.ST.witnessed" ], "source_upto_this": "module Lib.Exponentiation.Definition\n\nopen FStar.Mul\n\nmodule Loops = Lib.LoopCombinators\n\n#set-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\nlet lemma_inverse_one #t k =\n lemma_inverse k.cm.one;\n assert (k.cm.mul (inverse cm.one) cm.one == cm.one);\n k.cm.lemma_one (inverse cm.one);\n assert (inverse k.cm.one == cm.one)\n\n\nval lemma_mul_cancel_inverse: #t:Type -> k:abelian_group t -> a:t -> b:t ->\n Lemma (cm.mul (inverse a) (cm.mul a b) == b)\n\nlet lemma_mul_cancel_inverse #t k a b =\n calc (==) {\n cm.mul (inverse a) (cm.mul a b);\n (==) { cm.lemma_mul_assoc (inverse a) a b }\n cm.mul (cm.mul (inverse a) a) b;\n (==) { lemma_inverse a }\n cm.mul cm.one b;\n (==) { cm.lemma_mul_comm cm.one b }\n cm.mul b cm.one;\n (==) { cm.lemma_one b }\n b;\n }\n\nval lemma_cancellation: #t:Type -> k:abelian_group t -> a:t -> b:t -> c:t -> Lemma\n (requires cm.mul a b == cm.mul a c)\n (ensures b == c)\n\nlet lemma_cancellation #t k a b c =\n assert (cm.mul (inverse a) (cm.mul a b) == cm.mul (inverse a) (cm.mul a c));\n lemma_mul_cancel_inverse #t k a b;\n lemma_mul_cancel_inverse #t k a c\n\n\nlet lemma_inverse_id #t k a =\n lemma_inverse a;\n lemma_inverse (inverse a);\n assert (cm.mul (inverse a) a == cm.one);\n assert (cm.mul (inverse (inverse a)) (inverse a) == cm.one);\n cm.lemma_mul_comm (inverse (inverse a)) (inverse a);\n lemma_cancellation k (inverse a) a (inverse (inverse a));\n assert (a == (inverse (inverse a)))\n\n\nlet lemma_inverse_mul #t k a b =\n lemma_inverse (cm.mul a b);\n cm.lemma_mul_comm (inverse (cm.mul a b)) (cm.mul a b);\n assert (cm.mul (cm.mul a b) (inverse (cm.mul a b)) == cm.one);\n calc (==) {\n cm.mul (cm.mul a b) (cm.mul (inverse a) (inverse b));\n (==) { cm.lemma_mul_assoc (cm.mul a b) (inverse a) (inverse b) }\n cm.mul (cm.mul (cm.mul a b) (inverse a)) (inverse b);\n (==) { cm.lemma_mul_comm (cm.mul a b) (inverse a) }\n cm.mul (cm.mul (inverse a) (cm.mul a b)) (inverse b);\n (==) { lemma_mul_cancel_inverse k a b }\n cm.mul b (inverse b);\n (==) { cm.lemma_mul_comm b (inverse b) }\n cm.mul (inverse b) b;\n (==) { lemma_inverse b }\n cm.one;\n };\n\n assert (cm.mul (cm.mul a b) (inverse (cm.mul a b)) ==\n cm.mul (cm.mul a b) (cm.mul (inverse a) (inverse b)));\n lemma_cancellation k (cm.mul a b) (inverse (cm.mul a b))\n (cm.mul (inverse a) (inverse b))\n\n//---------------------\n\n#push-options \"--fuel 2\"\nlet lemma_pow0 #t k x = ()\n\nlet lemma_pow1 #t k x = lemma_one x\n\nlet lemma_pow_unfold #t k x n = ()\n#pop-options\n\nlet rec lemma_pow_one #t k n =\n if n = 0 then\n lemma_pow0 k one\n else begin\n lemma_pow_unfold k one n;\n //assert (pow k one n == mul one (pow k one (n - 1)));\n lemma_pow_one k (n - 1);\n //assert (pow k one n == mul one one);\n lemma_one k.one;\n () end\n\n\nlet rec lemma_pow_add #t k x n m =\n if n = 0 then begin\n calc (==) {\n mul (pow k x n) (pow k x m);\n (==) { lemma_pow0 k x }\n mul one (pow k x m);\n (==) { lemma_mul_comm one (pow k x m) }\n mul (pow k x m) one;\n (==) { lemma_one (pow k x m) }\n pow k x m;\n }; () end\n else begin\n calc (==) {\n mul (pow k x n) (pow k x m);\n (==) { lemma_pow_unfold k x n }\n mul (mul x (pow k x (n - 1))) (pow k x m);\n (==) { lemma_mul_assoc x (pow k x (n - 1)) (pow k x m) }\n mul x (mul (pow k x (n - 1)) (pow k x m));\n (==) { lemma_pow_add #t k x (n - 1) m }\n mul x (pow k x (n - 1 + m));\n (==) { lemma_pow_unfold k x (n + m) }\n pow k x (n + m);\n }; () end\n\n", "sketch": [ "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case: When m = 0, we have pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0, which is true by lemma_pow0.\nStep 3: Inductive step: Assume the lemma holds for some arbitrary m, i.e., pow k (pow k x n) m == pow k x (n * m). We need to show that pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)). \nStep 4: Using the assumption and lemma_pow_add, we can rewrite pow k (pow k x n) (m + 1) as pow k (pow k x n) m * pow k x n. Then, using the induction hypothesis, we can simplify this to pow k x (n * m) * pow k x n. \nStep 5: Finally, using the associativity of multiplication and the induction hypothesis, we can show that pow k x (n * m) * pow k x n == pow k x (n * (m + 1)).", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case: When m = 0, we have pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0. This is true by the lemma_pow0.\nStep 3: Inductive step: Assume pow k (pow k x n) m == pow k x (n * m) for some m. We need to show that pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)). \nStep 4: Using the induction hypothesis, we have pow k (pow k x n) (m + 1) == pow k (pow k x n) m * pow k x n. By the induction hypothesis, this is equal to pow k x (n * m) * pow k x n. \nStep 5: By the lemma_pow_add, we know that pow k x (n * m) * pow k x n == pow k x (n * (m + 1)). \nStep 6: Therefore, pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)).", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case (m = 0): We will show that pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0. This is trivially true as pow k one 0 is equal to the identity element of the monoid, and pow k x 0 is also equal to the identity element of the monoid.\nStep 3: Inductive step: We assume that pow k (pow k x n) m == pow k x (n * m) holds for some arbitrary m. We will show that pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)). We can use the lemma_pow_add to rewrite pow k (pow k x n) (m + 1) as pow k x (n * m) * pow k x n, and then apply the inductive hypothesis to complete the proof.", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case: When m = 0, we have pow k (pow k x n) 0 = one and pow k x (n * 0) = one, which are equal.\nStep 3: Inductive step: Assume the lemma holds for some arbitrary m. We need to show that pow k (pow k x n) (m + 1) = pow k x (n * (m + 1)). We can use the lemma_pow_add to unfold the left-hand side and then apply the inductive hypothesis to complete the proof.", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case (m = 0): We will show that pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0. This is true by the lemma_pow0 definition.\nStep 3: Inductive step: We assume the lemma holds for m, i.e., pow k (pow k x n) m == pow k x (n * m). We need to show that pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)). We will use the lemma_pow_add definition to unfold the left-hand side and apply the inductive hypothesis to complete the proof.", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case: When m = 0, we have pow k (pow k x n) 0 = one and pow k x (n * 0) = one, which are equal.\nStep 3: Inductive step: Assume the lemma holds for some arbitrary m = p. We need to show that it holds for m = p + 1.\nStep 4: Using the induction hypothesis, we rewrite pow k (pow k x n) (p + 1) as pow k (pow k x n) p * pow k (pow k x n) 1.\nStep 5: Then we use the lemma_pow_add to rewrite pow k (pow k x n) p * pow k (pow k x n) 1 as pow k x (n * p) * pow k x n.\nStep 6: Finally, we use the property of natural number multiplication to rewrite pow k x (n * p) * pow k x n as pow k x (n * (p + 1)).", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case (m = 0): We will show that pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0. This is true by the lemma_pow0.\nStep 3: Inductive step: We assume the lemma holds for m, i.e., pow k (pow k x n) m == pow k x (n * m). We need to show that pow k (pow k x n) (m + 1) == pow k x (n * (m + 1)). We can use the lemma_pow_add to unfold the left-hand side and apply the inductive hypothesis to complete the proof.", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case (m = 0): We will show that pow k (pow k x n) 0 == pow k x (n * 0).\nStep 3: Inductive step: We will assume the lemma holds for m, and then show that it holds for m + 1.", "Step 1: We will use induction on m to prove the lemma. \nStep 2: Base case (m = 0): We will show that pow k (pow k x n) 0 == pow k x (n * 0), which simplifies to pow k one 0 == pow k x 0. \nStep 3: Inductive step: We assume the lemma holds for m, i.e., pow k (pow k x n) m == pow k x (n * m), and then show that it holds for m + 1. \nStep 4: We will use the lemma_pow_add to unfold the expression pow k (pow k x n) (m + 1) and show that it equals pow k x (n * (m + 1)).", "Step 1: We will use induction on m to prove the lemma. The base case m = 0 is trivial, as pow k (pow k x n) 0 simplifies to one, and pow k x (n * 0) also simplifies to one. \nStep 2: For the inductive step, assuming the lemma holds for some arbitrary m, we need to show that it holds for m + 1. We will use the lemma_pow_add to unfold the expression pow k (pow k x n) (m + 1) and then apply the inductive hypothesis to simplify the expression to pow k x (n * (m + 1))." ], "generated_solution": [ "let rec lemma_pow_mul #t k x n m =\n if m = 0 then\n lemma_pow0 k (pow k x n)\n else begin\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_add #t k (pow k x n) m 1 }\n mul (pow k (pow k x n) m) (pow k x n);\n (==) { lemma_pow_mul #t k x n m }\n mul (pow k x (n * m)) (pow k x n);\n (==) { cm.lemma_mul_assoc (pow k x (n * m)) (pow k x n) }\n pow k x (n * (m + 1));\n }; () end", "let rec lemma_pow_mul #t k x n m =\n if m = 0 then\n lemma_pow0 k (pow k x n)\n else begin\n calc (==) {\n pow k (pow k x n) m;\n (==) { lemma_pow_add #t k x n (m - 1) 1 }\n pow k x (n * (m - 1 + 1));\n (==) { lemma_mul_comm x (pow k x n) }\n pow k x (n * m);\n };\n lemma_pow_mul #t k x n (m - 1)\n end", "let lemma_pow_mul #t k x n m =\n induction_on m;\n // Base case: m = 0\n calc (==) {\n pow k (pow k x n) 0;\n (==) { lemma_pow0 k (pow k x n) }\n pow k one 0;\n (==) { lemma_pow0 k one }\n pow k x 0;\n };\n // Inductive step: m + 1\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_add #t k (pow k x n) m 1 }\n pow k x (n * m) * pow k x n;\n (==) { lemma_pow_mul #t k x n m }\n pow k x (n * m + n);\n }", "let rec lemma_pow_mul #t k x n m =\n if m = 0 then\n calc (==) {\n pow k (pow k x n) 0;\n (==) { lemma_pow0 k (pow k x n) }\n cm.one;\n (==) { cm.lemma_pow0 k x }\n pow k x (n * 0);\n }\n else\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_add #t k (pow k x n) m 1 }\n pow k x (n * (m + 1));\n }", "let lemma_pow_mul #t k x n m =\n induction_on m;\n simplify;\n lemma_pow0 k (pow k x n);\n induction_step m;\n lemma_pow_add #t k x n m;", "let rec lemma_pow_mul #t k x n m =\n if m = 0 then\n lemma_pow0 k (pow k x n)\n else begin\n calc (==) {\n pow k (pow k x n) m;\n (==) { lemma_pow_add #t k (pow k x n) n (m - 1) }\n pow k x (n * (m - 1) + n);\n (==) { lemma_mul_comm x (pow k x (n * (m - 1))) }\n pow k x (n * m);\n };\n () end", "let lemma_pow_mul #t k x n m =\n induction_on m;\n // Base case\n lemma_pow0 k (pow k x n);\n // Inductive step\n lemma_pow_add #t k x n m;", "let rec lemma_pow_mul #t k x n m =\n if m = 0 then\n calc (==) {\n pow k (pow k x n) 0;\n (==) { lemma_pow0 k (pow k x n) }\n pow k x (n * 0);\n }\n else begin\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_add #t k (pow k x n) m 1 }\n pow k x (n * m + n);\n (==) { lemma_mul_comm x (pow k x (n * m)) }\n pow k x (n * m + n);\n (==) { lemma_pow_unfold k x (n * m + n) }\n pow k x (n * (m + 1));\n }\n }", "let lemma_pow_mul #t k x n m =\n induction_on m;\n // Base case\n calc (==) {\n pow k (pow k x n) 0;\n (==) { lemma_pow0 k (pow k x n) }\n pow k x 0;\n (==) { lemma_pow0 k x }\n pow k x (n * 0);\n };\n // Inductive step\n intros m IH;\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_unfold k (pow k x n) (m + 1) }\n pow k x (n * (m + 1));\n };", "let lemma_pow_mul #t k x n m =\n if m = 0 then\n calc (==) {\n pow k (pow k x n) 0;\n (==) { lemma_pow0 k (pow k x n) }\n one;\n (==) { lemma_pow0 k x }\n pow k x (n * 0);\n }\n else\n calc (==) {\n pow k (pow k x n) (m + 1);\n (==) { lemma_pow_unfold k (pow k x n) (m + 1) }\n pow k x (n + (m * n));\n (==) { lemma_pow_add #t k x n (m * n) }\n pow k x (n * (m + 1));\n }" ] }, { "file_name": "Hacl.Spec.SHA2.EquivScalar.fst", "name": "Hacl.Spec.SHA2.EquivScalar.hash_agile_lemma", "opens_and_abbrevs": [ { "abbrev": "Loops", "full_module": "Lib.LoopCombinators" }, { "abbrev": "LSeqLemmas", "full_module": "Lib.Sequence.Lemmas" }, { "abbrev": "UpdLemmas", "full_module": "Lib.UpdateMulti.Lemmas" }, { "abbrev": "BSeq", "full_module": "Lib.ByteSequence" }, { "abbrev": "LSeq", "full_module": "Lib.Sequence" }, { "abbrev": "Spec", "full_module": "Spec.SHA2" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.LoopCombinators" }, { "open": "Lib.Sequence" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.Sequence" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Hacl.Spec.SHA2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 200, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "source_definition": "let hash_agile_lemma #a len b =\n let st0 = Spec.Agile.Hash.init a in\n let pad_s = Spec.Hash.MD.pad a len in\n let st_s = Spec.Agile.Hash.update_multi a st0 () (Seq.append b pad_s) in\n\n let blocksize = block_length a in\n let rem = len % blocksize in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n let last = Seq.slice b (len - rem) len in\n append_pad_last_length_lemma a len;\n load_last_pad_lemma a len fin;\n\n hash_is_repeat_blocks a len b st0;\n update_multi_is_repeat_blocks_multi a len b st0 pad_s;\n hash_is_repeat_blocks_multi a len b st0;\n finish_lemma a st_s", "source_range": { "start_line": 913, "start_col": 0, "end_line": 929, "end_col": 21 }, "interleaved": false, "definition": "fun len b ->\n let st0 = Spec.Agile.Hash.init a in\n let pad_s = Spec.Hash.MD.pad a len in\n let st_s = Spec.Agile.Hash.update_multi a st0 () (FStar.Seq.Base.append b pad_s) in\n let blocksize = Spec.Hash.Definitions.block_length a in\n let rem = len % blocksize in\n let blocks = Hacl.Spec.SHA2.padded_blocks a rem in\n let fin = blocks * Spec.Hash.Definitions.block_length a in\n let last = FStar.Seq.Base.slice b (len - rem) len in\n Hacl.Spec.SHA2.EquivScalar.append_pad_last_length_lemma a len;\n Hacl.Spec.SHA2.EquivScalar.load_last_pad_lemma a len fin;\n Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks a len b st0;\n Hacl.Spec.SHA2.EquivScalar.update_multi_is_repeat_blocks_multi a len b st0 pad_s;\n Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks_multi a len b st0;\n Hacl.Spec.SHA2.EquivScalar.finish_lemma a st_s", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.len_lt_max_a_t", "Lib.Sequence.seq", "Lib.IntTypes.uint8", "Prims.b2t", "Prims.op_Equality", "Prims.nat", "Lib.Sequence.length", "Hacl.Spec.SHA2.EquivScalar.finish_lemma", "Prims.unit", "Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks_multi", "Hacl.Spec.SHA2.EquivScalar.update_multi_is_repeat_blocks_multi", "Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks", "Hacl.Spec.SHA2.EquivScalar.load_last_pad_lemma", "Hacl.Spec.SHA2.EquivScalar.append_pad_last_length_lemma", "FStar.Seq.Base.seq", "Lib.IntTypes.int_t", "Lib.IntTypes.U8", "Lib.IntTypes.SEC", "FStar.Seq.Base.slice", "Prims.op_Subtraction", "Prims.int", "FStar.Mul.op_Star", "Spec.Hash.Definitions.block_length", "Prims.op_LessThanOrEqual", "Hacl.Spec.SHA2.padded_blocks", "Prims.op_Modulus", "Prims.nonzero", "Spec.Hash.Definitions.words_state", "Spec.Agile.Hash.update_multi", "FStar.Seq.Base.append", "Spec.Hash.Definitions.bytes", "Prims.op_Addition", "FStar.Seq.Base.length", "Spec.Hash.MD.pad", "Spec.Hash.Definitions.init_t", "Spec.Agile.Hash.init" ], "proof_features": [], "is_simple_lemma": true, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n len: Hacl.Spec.SHA2.len_lt_max_a_t a ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> FStar.Pervasives.Lemma (ensures Hacl.Spec.SHA2.hash len b == Spec.Agile.Hash.hash a b)", "prompt": "let hash_agile_lemma #a len b =\n ", "expected_response": "let st0 = Spec.Agile.Hash.init a in\nlet pad_s = Spec.Hash.MD.pad a len in\nlet st_s = Spec.Agile.Hash.update_multi a st0 () (Seq.append b pad_s) in\nlet blocksize = block_length a in\nlet rem = len % blocksize in\nlet blocks = padded_blocks a rem in\nlet fin = blocks * block_length a in\nlet last = Seq.slice b (len - rem) len in\nappend_pad_last_length_lemma a len;\nload_last_pad_lemma a len fin;\nhash_is_repeat_blocks a len b st0;\nupdate_multi_is_repeat_blocks_multi a len b st0 pad_s;\nhash_is_repeat_blocks_multi a len b st0;\nfinish_lemma a st_s", "source": { "project_name": "hacl-star", "file_name": "code/sha2-mb/Hacl.Spec.SHA2.EquivScalar.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.Spec.SHA2.EquivScalar.fst", "checked_file": "dataset/Hacl.Spec.SHA2.EquivScalar.fst.checked", "interface_file": true, "dependencies": [ "dataset/Spec.SHA2.fst.checked", "dataset/Spec.SHA2.fst.checked", "dataset/Spec.Hash.MD.fst.checked", "dataset/Spec.Hash.Definitions.fst.checked", "dataset/Spec.Agile.Hash.fst.checked", "dataset/prims.fst.checked", "dataset/Lib.Vec.Lemmas.fsti.checked", "dataset/Lib.UpdateMulti.Lemmas.fsti.checked", "dataset/Lib.Sequence.Lemmas.fsti.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.LoopCombinators.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.ByteSequence.fsti.checked", "dataset/Hacl.Spec.SHA2.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Math.Lemmas.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "val update_lemma: a:sha2_alg -> block:block_t a -> hash:words_state a ->\n Lemma (update a block hash == Spec.Agile.Hash.update a hash block)", "val finish_lemma: a:sha2_alg -> st:words_state a ->\n Lemma (finish a st == Spec.Agile.Hash.finish a st ())", "val update_nblocks_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma (update_nblocks a len b st0 ==\n repeat_blocks_multi (block_length a) (Seq.slice b 0 (Seq.length b - Seq.length b % block_length a)) (update a) st0)", "val ws_next_inductive: a:sha2_alg -> ws0:k_w a -> k:nat{k <= 16} ->\n Pure (k_w a)\n (requires True)\n (ensures fun res ->\n res == Loops.repeati k (ws_next_inner a) ws0 /\\\n (forall (i:nat{i < k}). index res i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index res i == index (Loops.repeati (k - 1) (ws_next_inner a) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index res i == index ws0 i))", "val hash_is_repeat_blocks:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let st = update_nblocks a len b st0 in\n let rem = len % block_length a in\n let mb = Seq.slice b (len - rem) len in\n update_last a len' rem mb st ==\n Lib.Sequence.repeat_blocks (block_length a) b (update a) (update_last a len') st0)", "let ws_next_inductive a ws0 k =\n Loops.eq_repeati0 k (ws_next_inner a) ws0;\n repeati_inductive #(k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (ws_next_inner a) ws0 /\\\n (forall (i0:nat{i0 < i}). index wsi i0 == index (ws_next_inner a i0 (Loops.repeati i0 (ws_next_inner a) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). index wsi i0 == index (Loops.repeati (i - 1) (ws_next_inner a) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < 16}). index wsi i0 == index ws0 i0))\n (fun i wsi ->\n let ws = ws_next_inner a i wsi in\n Loops.unfold_repeati (i + 1) (ws_next_inner a) ws0 i;\n ws)\n ws0", "val update_last_is_repeat_blocks_multi:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> len: size_nat { len <= block_length a }\n -> last:lseq uint8 len\n -> st1:words_state a ->\n Lemma\n (requires\n (let blocksize = block_length a in\n len % blocksize == totlen % blocksize))\n (ensures\n (let totlen' : len_t a = mk_len_t a totlen in\n let pad_s = Spec.Hash.MD.pad a totlen in\n let blocksize = block_length a in\n let blocks1 = Seq.append last pad_s in\n Seq.length blocks1 % blocksize == 0 /\\\n update_last a totlen' len last st1 ==\n repeat_blocks_multi blocksize blocks1 (update a) st1))", "val ws_next_lemma: a:sha2_alg -> ws0:k_w a -> k:pos{k <= 16} -> Lemma\n (let wsk : k_w a = Loops.repeati k (ws_next_inner a) ws0 in\n let wsk1 : k_w a = Loops.repeati (k - 1) (ws_next_inner a) ws0 in\n (forall (i:nat{i < k}). index wsk i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index wsk i == index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index wsk i == index ws0 i))", "let ws_next_lemma a ws0 k =\n let _ = ws_next_inductive a ws0 k in ()", "val ws_next_lemma_k: a:sha2_alg -> ws0:k_w a -> k:nat{k < 16} -> Lemma\n (let ws : k_w a = Loops.repeati 16 (ws_next_inner a) ws0 in\n let wsk : k_w a = Loops.repeati (k + 1) (ws_next_inner a) ws0 in\n Seq.index ws k == Seq.index wsk k)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "let ws_next_lemma_k a ws0 k =\n ws_next_lemma a ws0 (k + 1);\n ws_next_lemma a ws0 16", "val ws_pre_inductive: a:sha2_alg -> block:Spec.block_w a -> k:nat{k <= Spec.size_k_w a} ->\n Pure (Spec.k_w a)\n (requires True)\n (ensures fun res ->\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n res == Loops.repeati k (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i:nat{i < k}).\n Seq.index res i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}).\n Seq.index res i == Seq.index (Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index res i == Seq.index ws0 i)))", "let ws_pre_inductive a block k =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n Loops.eq_repeati0 k (Spec.ws_pre_inner a block) ws0;\n repeati_inductive #(Spec.k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i0:nat{i0 < i}).\n Seq.index wsi i0 ==\n Seq.index (Spec.ws_pre_inner a block i0 (Loops.repeati (i0 + 1) (Spec.ws_pre_inner a block) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). Seq.index wsi i0 == Seq.index (Loops.repeati (i - 1) (Spec.ws_pre_inner a block) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < Spec.size_k_w a}). Seq.index wsi i0 == Seq.index ws0 i0))\n (fun i wsi ->\n let ws = Spec.ws_pre_inner a block i wsi in\n Loops.unfold_repeati (i + 1) (Spec.ws_pre_inner a block) ws0 i;\n ws)\n ws0", "val ws_pre_lemma: a:sha2_alg -> block:Spec.block_w a -> k:pos{k <= Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let wsk : Spec.k_w a = Loops.repeati k (Spec.ws_pre_inner a block) ws0 in\n let wsk1 : Spec.k_w a = Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0 in\n (forall (i:nat{i < k}).\n Seq.index wsk i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). Seq.index wsk i == Seq.index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index wsk i == Seq.index ws0 i))", "let ws_pre_lemma a block k =\n let _ = ws_pre_inductive a block k in ()", "val ws_pre_lemma_k: a:sha2_alg -> block:Spec.block_w a -> k:nat{k < Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let wsk : Spec.k_w a = Loops.repeati (k + 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.index wsk k == Seq.index ws k)", "let ws_pre_lemma_k a block k =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma a block (Spec.size_k_w a)", "val ws_next_pre_lemma_j_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 j == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n1 j 16 == Seq.slice ws_n0 j 16))\n (ensures\n (let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j)))", "let ws_next_pre_lemma_j_step a block i j ws1 ws_n1 =\n let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n\n let s0_n = _sigma0 a ws_n1.[(j+1) % 16] in\n let s1_n = _sigma1 a ws_n1.[(j+14) % 16] in\n //assert (Seq.index ws_n j == s1_n +. ws_n1.[(j+9) % 16] +. s0_n +. ws_n1.[j]);\n\n let s0 = _sigma0 a ws1.[16 * i + 16 + j - 15] in\n let s1 = _sigma1 a ws1.[16 * i + 16 + j - 2] in\n //assert (Seq.index ws (16 * i + 16 + j) == s1 +. ws1.[16 * i + 16 + j - 7] +. s0 +. ws1.[16 * i + 16 + j - 16]);\n\n let ws_n1_index (k:nat{k < 16}) :\n Lemma (if k < j then ws_n1.[k] == ws1.[16 * i + 16 + k] else ws_n1.[k] == ws1.[16 * i + k]) =\n if k < j then Seq.lemma_index_slice ws_n1 0 j k\n else Seq.lemma_index_slice ws_n1 j 16 (k - j) in\n\n ws_n1_index ((j + 1) % 16);\n assert (ws_n1.[(j + 1) % 16] == ws1.[16 * i + j + 1]);\n ws_n1_index ((j + 14) % 16);\n assert (ws_n1.[(j + 14) % 16] == ws1.[16 * i + j + 14]);\n ws_n1_index ((j + 9) % 16);\n assert (ws_n1.[(j + 9) % 16] == ws1.[16 * i + j + 9]);\n ws_n1_index j;\n assert (ws_n1.[j] == ws1.[16 * i + j])", "val ws_next_pre_lemma_aux:\n a:sha2_alg\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a\n -> ws:Spec.k_w a\n -> ws_n:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) /\\\n (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k) /\\\n (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k) /\\\n Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1) /\\\n (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k)))\n (ensures\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16))", "let ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n =\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n\n let ws_n1_index1 (k:nat{k < j - 1}) : Lemma (Seq.index ws_n1 k == Seq.index ws1 (16 * i + 16 + k)) =\n Seq.lemma_index_slice ws_n1 0 (j - 1) k;\n Seq.lemma_index_slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) k in\n\n let ws_n_index1 (k:nat{k < j}) : Lemma (Seq.index ws_n k == Seq.index ws (16 * i + 16 + k)) =\n if k < j - 1 then ws_n1_index1 k else () in\n\n let ws_n_index2 (k:nat{j <= k /\\ k < 16}) : Lemma (Seq.index ws_n k == Seq.index ws_n0 k) =\n () in\n\n Classical.forall_intro ws_n_index1;\n Seq.lemma_eq_intro (Seq.slice ws_n 0 j) (Seq.slice ws (16 * i + 16) (16 * i + 16 + j));\n Classical.forall_intro ws_n_index2;\n Seq.lemma_eq_intro (Seq.slice ws_n j 16) (Seq.slice ws_n0 j 16)", "val ws_next_pre_lemma_init:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.slice ws1 (16 * i) (16 * i + 16) == Seq.slice ws (16 * i) (16 * i + 16))", "let ws_next_pre_lemma_init a block i j =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n\n let s : Spec.block_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let s1 : Spec.block_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index s k == Seq.index s1 k) =\n ws_pre_lemma a block (16 * i + 16 + j);\n ws_pre_lemma a block (16 * i + 16 + j - 1) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro s s1", "val ws_next_pre_lemma_j:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j (ws_next_inner a) ws_n0 in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16)", "let rec ws_next_pre_lemma_j a block i j =\n let ws_pre_f = Spec.ws_pre_inner a block in\n let ws_next_f = ws_next_inner a in\n\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) ws_pre_f ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j ws_next_f ws_n0 in\n\n if j = 0 then\n Loops.eq_repeati0 j ws_next_f ws_n0\n else begin\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) ws_pre_f ws0 in\n ws_next_pre_lemma_init a block i j;\n assert (Seq.slice ws1 (16 * i) (16 * i + 16) == ws_n0);\n let ws_n1 : k_w a = Loops.repeati (j - 1) ws_next_f ws_n0 in\n ws_next_pre_lemma_j a block i (j - 1);\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n assert (Seq.slice ws_n1 (j - 1) 16 == Seq.slice ws_n0 (j - 1) 16);\n\n ws_pre_lemma a block (16 * i + 16 + j);\n assert (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k);\n Loops.unfold_repeati (16 * i + 16 + j) ws_pre_f ws0 (16 * i + 16 + j - 1);\n //assert (ws == ws_pre_f (16 * i + 16 + j - 1) ws1);\n\n ws_next_lemma a ws_n0 j;\n assert (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k);\n assert (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k);\n Loops.unfold_repeati j ws_next_f ws_n0 (j - 1);\n //assert (ws_n == ws_next_f (j - 1) ws_n1);\n ws_next_pre_lemma_j_step a block i (j - 1) ws1 ws_n1;\n assert (Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1));\n ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n;\n () end", "val ws_next_pre_lemma:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16} -> Lemma\n (let ws : Spec.k_w a = Spec.ws_pre a block in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = ws_next a ws_n0 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j))", "let ws_next_pre_lemma a block i j =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati 16 (ws_next_inner a) ws_n0 in\n\n let wsj : Spec.k_w a = Loops.repeati (16 * i + 16 + j + 1) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0j : k_w a = Seq.slice wsj (16 * i) (16 * i + 16) in\n let ws_nj : k_w a = Loops.repeati (j + 1) (ws_next_inner a) ws_n0 in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws_n0 k == Seq.index ws_n0j k) =\n ws_pre_lemma a block (16 * i + 16 + j + 1);\n ws_pre_lemma a block (Spec.size_k_w a) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro ws_n0 ws_n0j;\n\n ws_next_pre_lemma_j a block i (j + 1);\n assert (Seq.slice ws_nj 0 (j + 1) == Seq.slice wsj (16 * i + 16) (16 * i + 16 + j + 1));\n Seq.lemma_index_slice ws_nj 0 (j + 1) j;\n assert (Seq.index ws_nj j == Seq.index wsj (16 * i + 16 + j));\n\n ws_pre_lemma_k a block (16 * i + 16 + j);\n assert (Seq.index wsj (16 * i + 16 + j) == Seq.index ws (16 * i + 16 + j));\n\n ws_next_lemma_k a ws_n0 j;\n assert (Seq.index ws_nj j == Seq.index ws_n j)", "val shuffle_core_pre_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state a ->\n Lemma (shuffle_core_pre a k_t ws_t hash == Spec.shuffle_core_pre a k_t ws_t hash)", "let shuffle_core_pre_lemma a k_t ws_t hash =\n reveal_opaque (`%Spec.shuffle_core_pre) Spec.shuffle_core_pre", "val shuffle_pre_inner: a:sha2_alg -> ws:Spec.k_w a -> i:nat{i < size_k_w a} -> st:words_state a -> words_state a", "let shuffle_pre_inner a ws i st =\n let k = k0 a in\n shuffle_core_pre a k.[i] ws.[i] st", "val shuffle_spec_lemma: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 == Spec.shuffle a st0 block)", "let shuffle_spec_lemma a st0 block =\n reveal_opaque (`%Spec.shuffle) Spec.shuffle;\n let ws = Spec.ws_pre a block in\n let k = Spec.k0 a in\n let aux (i:nat{i < Spec.size_k_w a}) (st:words_state a) :\n Lemma (shuffle_pre_inner a ws i st == Spec.shuffle_core_pre a k.[i] ws.[i] st) =\n let k = Spec.k0 a in\n shuffle_core_pre_lemma a k.[i] ws.[i] st in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality (Spec.size_k_w a)\n (shuffle_pre_inner a ws)\n (fun i h -> Spec.shuffle_core_pre a k.[i] ws.[i] h) st0", "val shuffle_pre_inner16:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> j:nat{j < 16}\n -> st:words_state a ->\n words_state a", "let shuffle_pre_inner16 a ws i j st =\n let k = k0 a in\n shuffle_core_pre a k.[16 * i + j] ws.[16 * i + j] st", "val shuffle_pre_inner_num_rounds:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a ->\n words_state a", "let shuffle_pre_inner_num_rounds a ws i st =\n Loops.repeati 16 (shuffle_pre_inner16 a ws i) st", "val shuffle_spec_lemma16_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a\n -> j:nat{j <= 16} ->\n Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati j (shuffle_pre_inner16 a ws i) st ==\n Loops.repeat_right (16 * i) (16 * i + j) (Loops.fixed_a (words_state a)) (shuffle_pre_inner a ws) st)", "let rec shuffle_spec_lemma16_step a block i st j =\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n //let lp = Loops.repeati j (shuffle_pre_inner16 a ws i) st in\n //let rp = Loops.repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st in\n if j = 0 then begin\n Loops.eq_repeati0 j (shuffle_pre_inner16 a ws i) st;\n Loops.eq_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st end\n else begin\n //let lp1 = Loops.repeati (j - 1) (shuffle_pre_inner16 a ws i) st in\n //let rp1 = Loops.repeat_right (16 * i) (16 * i + j - 1) a_fixed (shuffle_pre_inner a ws) st in\n Loops.unfold_repeati j (shuffle_pre_inner16 a ws i) st (j - 1);\n Loops.unfold_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st (16 * i + j - 1);\n //assert (lp == shuffle_pre_inner16 a ws i (j - 1) lp1);\n //assert (rp == shuffle_pre_inner a ws (16 * i + j - 1) rp1);\n shuffle_spec_lemma16_step a block i st (j - 1);\n () end", "val shuffle_spec_lemma16: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 ==\n Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws) st0)", "let shuffle_spec_lemma16 a st0 block =\n //w = 16, n = num_rounds16 a, normalize_v = id\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n let aux (i:nat{i < num_rounds16 a}) (st:words_state a) :\n Lemma (shuffle_pre_inner_num_rounds a ws i st ==\n Loops.repeat_right (16 * i) (16 * (i + 1)) a_fixed (shuffle_pre_inner a ws) st) =\n shuffle_spec_lemma16_step a block i st 16 in\n\n Classical.forall_intro_2 aux;\n Lib.Vec.Lemmas.lemma_repeati_vec 16 (num_rounds16 a) (fun x -> x)\n (shuffle_pre_inner a ws)\n (shuffle_pre_inner_num_rounds a ws)\n st0", "val ws_next_inner_lemma:\n a:sha2_alg\n -> block:k_w a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))", "let ws_next_inner_lemma a block i ws1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n\n if i < num_rounds16 a - 1 then begin\n let aux (k:nat{k < 16}) : Lemma (Seq.index (ws_next a ws1) k == Seq.index ws_s (16 * (i + 1) + k)) =\n ws_next_pre_lemma a block i k in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (ws_next a ws1) (Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)) end\n else ()", "val shuffle_lemma_i_step:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a\n -> st1:words_state a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s = Spec.ws_pre a block in\n let st_s = Loops.repeati 16 (shuffle_pre_inner16 a ws_s i) st1 in\n let st = Loops.repeati 16 (shuffle_inner a ws1 i) st1 in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n ws_next_inner_lemma a block i ws1;\n\n let aux_st (j:nat{j < 16}) (hash:words_state a) :\n Lemma (shuffle_pre_inner16 a ws_s i j hash == shuffle_inner a ws1 i j hash) =\n let k_t = Seq.index (k0 a) (16 * i + j) in\n let lp = shuffle_core_pre a k_t ws_s.[16 * i + j] st in\n let rp = shuffle_core_pre a k_t ws1.[j] hash in\n assert (ws1.[j] == ws_s.[16 * i + j]) in\n\n Classical.forall_intro_2 aux_st;\n LSeqLemmas.repeati_extensionality 16 (shuffle_pre_inner16 a ws_s i) (shuffle_inner a ws1 i) st1", "val ws_pre_init_lemma: a:sha2_alg -> block:k_w a -> Lemma\n (Seq.slice (Spec.ws_pre a block) 0 16 == block)", "let ws_pre_init_lemma a block =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws k == Seq.index block k) =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma_k a block k in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice (Spec.ws_pre a block) 0 16) block", "val shuffle_lemma_i:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i <= num_rounds16 a} ->\n Lemma\n (let ws_s = Spec.ws_pre a block in\n let (ws, st) : tuple2 (k_w a) (words_state a) =\n Loops.repeati i (shuffle_inner_loop a) (block, st0) in\n st == Loops.repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a)))", "let rec shuffle_lemma_i a block st0 i =\n let ws_s = Spec.ws_pre a block in\n let (ws, st) = Loops.repeati i (shuffle_inner_loop a) (block, st0) in\n let st_s = Loops.repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 in\n\n if i = 0 then begin\n Loops.eq_repeati0 i (shuffle_inner_loop a) (block, st0);\n Loops.eq_repeati0 i (shuffle_pre_inner_num_rounds a ws_s) st0;\n ws_pre_init_lemma a block;\n () end\n else begin\n let (ws1, st1) = Loops.repeati (i - 1) (shuffle_inner_loop a) (block, st0) in\n let st_s1 = Loops.repeati (i - 1) (shuffle_pre_inner_num_rounds a ws_s) st0 in\n Loops.unfold_repeati i (shuffle_inner_loop a) (block, st0) (i - 1);\n Loops.unfold_repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 (i - 1);\n assert (st_s == shuffle_pre_inner_num_rounds a ws_s (i - 1) st_s1);\n assert ((ws, st) == shuffle_inner_loop a (i - 1) (ws1, st1));\n shuffle_lemma_i a block st0 (i - 1);\n //assert (st1 == st_s1);\n assert (st_s == shuffle_pre_inner_num_rounds a ws_s (i - 1) st1);\n shuffle_lemma_i_step a block st0 (i - 1) ws1 st1 end", "val shuffle_lemma: a:sha2_alg -> block:k_w a -> st0:words_state a ->\n Lemma (shuffle a block st0 == Spec.shuffle a st0 block)", "let shuffle_lemma a block st0 =\n let ws_s = Spec.ws_pre a block in\n //let st_s = Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws_s) st0 in\n shuffle_spec_lemma a st0 block;\n shuffle_spec_lemma16 a st0 block;\n //assert (Spec.shuffle a st0 block == Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws_s) st0);\n //let (ws, st) = Loops.repeati (num_rounds16 a) (shuffle_inner_loop a) (block, st0) in\n shuffle_lemma_i a block st0 (num_rounds16 a)", "let update_lemma a block hash' =\n let hash = hash' in\n reveal_opaque (`%Spec.update) Spec.update;\n let block_w = BSeq.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in\n assert (block_w == words_of_bytes a #(block_word_length a) block);\n let hash_1 = shuffle a block_w hash in\n shuffle_lemma a block_w hash;\n assert (hash_1 == Spec.shuffle a hash block_w);\n\n let res = map2 #_ #_ #_ #8 ( +. ) hash_1 hash in\n let res_comm = map2 #_ #_ #_ #8 ( +. ) hash hash_1 in\n let aux (i:nat{i < 8}) : Lemma (res.[i] == res_comm.[i]) =\n assert (index res i == hash_1.[i] +. hash.[i]);\n assert (index res_comm i == hash.[i] +. hash_1.[i]);\n assert (v #(word_t a) #SEC (hash_1.[i] +. hash.[i]) == v #(word_t a) #SEC (hash.[i] +. hash_1.[i]));\n assert (index res i == index res_comm i) in\n\n Classical.forall_intro aux;\n eq_intro res res_comm;\n eq_intro #_ #8 (update a block hash') (Spec.update_pre a hash' block)", "let finish_lemma a st' =\n let st = st' in\n let hash_final_w = sub #_ #8 st 0 (hash_word_length a) in\n assert (Spec.Agile.Hash.finish a st' () == BSeq.uints_to_bytes_be #(word_t a) #SEC #(hash_word_length a) hash_final_w);\n assert (finish a st' == sub (BSeq.uints_to_bytes_be #(word_t a) #SEC #8 st) 0 (hash_length a));\n assert (hash_length a == word_length a * hash_word_length a);\n\n let aux (i:nat{i < hash_length a}) : Lemma ((finish a st').[i] == (Spec.Agile.Hash.finish a st' ()).[i]) =\n BSeq.index_uints_to_bytes_be #(word_t a) #SEC #(hash_word_length a) hash_final_w i;\n BSeq.index_uints_to_bytes_be #(word_t a) #SEC #8 st i in\n\n Classical.forall_intro aux;\n eq_intro #uint8 #(hash_length a) (finish a st') (Spec.Agile.Hash.finish a st' ())", "val update_multi_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a\n -> pad_s:lseq uint8 (pad_length a len) ->\n Lemma\n (let blocks = Seq.append b pad_s in\n Spec.Agile.Hash.update_multi a st0 () blocks ==\n LSeq.repeat_blocks_multi (block_length a) blocks (update a) st0)", "let update_multi_is_repeat_blocks_multi a len b st0 pad_s =\n let blocks = Seq.append b pad_s in\n assert ((pad_length a len + len) % block_length a = 0);\n\n let upd_last (st:words_state a) s = st in\n UpdLemmas.update_full_is_repeat_blocks #(words_state a) (block_length a)\n (Spec.Agile.Hash.update a) upd_last st0 blocks blocks;\n\n let repeat_f = UpdLemmas.repeat_f (block_length a) (Spec.Agile.Hash.update a) in\n let repeat_l = UpdLemmas.repeat_l (block_length a) upd_last blocks in\n //assert\n //(Spec.Agile.Hash.update_multi a st0 blocks ==\n // LSeq.repeat_blocks (block_length a) blocks repeat_f repeat_l st0);\n\n LSeqLemmas.lemma_repeat_blocks_via_multi (block_length a) blocks repeat_f repeat_l st0;\n // assert\n // (Spec.Agile.Hash.update_multi a st0 blocks ==\n // LSeq.repeat_blocks_multi (block_length a) blocks repeat_f st0);\n\n Classical.forall_intro_2 (update_lemma a);\n LSeqLemmas.repeat_blocks_multi_extensionality (block_length a) blocks repeat_f (update a) st0", "let update_nblocks_is_repeat_blocks_multi a len b st0 =\n let bs = block_length a in\n let nb = len / bs in\n let b' = Seq.slice b 0 (Seq.length b - Seq.length b % block_length a) in\n let acc = Loops.repeati nb (repeat_blocks_f bs b' (update a) nb) st0 in\n\n let aux (i:nat{i < nb}) (acc:words_state a) :\n Lemma (repeat_blocks_f bs b' (update a) nb i acc == update_block a len b i acc) = () in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality nb (repeat_blocks_f bs b' (update a) nb) (update_block a len b) st0;\n assert (acc == update_nblocks a len b st0);\n\n LSeq.lemma_repeat_blocks_multi bs b' (update a) st0", "let hash_is_repeat_blocks a len b st0 =\n let bs = block_length a in\n let nb = len / bs in\n let rem = len % bs in\n let acc = Loops.repeati nb (repeat_blocks_f bs b (update a) nb) st0 in\n\n let aux (i:nat{i < nb}) (acc:words_state a) :\n Lemma (repeat_blocks_f bs b (update a) nb i acc == update_block a len b i acc) = () in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality nb (repeat_blocks_f bs b (update a) nb) (update_block a len b) st0;\n assert (acc == update_nblocks a len b st0);\n\n let len' : len_t a = mk_len_t a len in\n LSeq.lemma_repeat_blocks bs b (update a) (update_last a len') st0;\n let last = Seq.slice b (nb * bs) len in\n assert (LSeq.repeat_blocks bs b (update a) (update_last a len') st0 == update_last a len' rem last acc)", "val append_pad_last_length_lemma: a:sha2_alg -> len:len_lt_max_a_t a ->\n Lemma\n (let blocksize = block_length a in\n let b_len = (blocksize - (len + len_length a + 1)) % blocksize + 1 + len_length a + len % blocksize in\n b_len = blocksize \\/ b_len = 2 * blocksize)", "let append_pad_last_length_lemma a len =\n let blocksize = block_length a in\n let x = 1 + len_length a + len % blocksize in\n let b_len = (blocksize - (len + len_length a + 1)) % blocksize + 1 + len_length a + len % blocksize in\n Math.Lemmas.lemma_mod_sub_distr (blocksize - len_length a - 1) len blocksize;\n assert (b_len == (blocksize - x) % blocksize + x)", "val load_last_lemma:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> totlen_seq:lseq uint8 (len_length a)\n -> len:size_nat { len <= block_length a /\\ len % block_length a == totlen % block_length a }\n -> b:bytes{length b = len} ->\n Lemma\n (let rem = len in\n let fin = padded_blocks a rem * block_length a in\n let last = create (2 * block_length a) (u8 0) in\n let last = update_sub last 0 rem b in\n let last = last.[rem] <- u8 0x80 in\n let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a totlen) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Seq.equal (Seq.slice last 0 fin) (Seq.append b pad))", "let load_last_lemma a totlen totlen_seq len b =\n //last = b @| firstbyte @| zeros @| pad\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a totlen) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n assert (length pad == pad_length a totlen);\n append_pad_last_length_lemma a totlen;\n let rem = len in\n let fin = padded_blocks a rem * block_length a in\n calc (==) {\n pad0_length a len <: int;\n (==) { }\n (block_length a - (len + len_length a + 1)) % block_length a;\n (==) {\n FStar.Math.Lemmas.lemma_mod_sub_distr (block_length a) (len + len_length a + 1) (block_length a);\n FStar.Math.Lemmas.lemma_mod_add_distr (len_length a + 1) len (block_length a)\n }\n (block_length a - (len % block_length a + len_length a + 1) % block_length a) % block_length a;\n (==) { assert (len % block_length a == totlen % block_length a) }\n (block_length a - (totlen % block_length a + len_length a + 1) % block_length a) % block_length a;\n (==) {\n FStar.Math.Lemmas.lemma_mod_sub_distr (block_length a) (totlen + len_length a + 1) (block_length a);\n FStar.Math.Lemmas.lemma_mod_add_distr (len_length a + 1) totlen (block_length a)\n }\n (block_length a - (totlen + len_length a + 1)) % block_length a;\n (==) { }\n pad0_length a totlen;\n };\n assert (fin - len_length a == rem + 1 + pad0_length a totlen);\n\n let last = create (2 * block_length a) (u8 0) in\n let last1 = update_sub last 0 rem b in\n Seq.lemma_eq_intro (Seq.slice last1 0 rem) b;\n let aux (i:nat{i < pad0_length a totlen}) : Lemma (last1.[rem + 1 + i] == zeros.[i]) =\n assert (index last1 (rem + 1 + i) == index zeros i) in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice last1 (rem + 1) (fin - len_length a)) zeros;\n\n let last2 = last1.[rem] <- u8 0x80 in\n Seq.lemma_eq_intro (Seq.slice last2 0 rem) b;\n Seq.lemma_eq_intro (Seq.slice last2 rem (rem + 1)) firstbyte;\n Seq.lemma_eq_intro (Seq.slice last2 (rem + 1) (fin - len_length a)) zeros;\n\n let last3 = update_sub last2 (fin - len_length a) (len_length a) totlen_seq in\n Seq.lemma_eq_intro (Seq.slice last3 (fin - len_length a) fin) totlen_seq;\n\n let aux (i:nat{i < fin - len_length a}) : Lemma (last3.[i] == last2.[i]) =\n assert (index last3 i == index last2 i) in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice last3 0 (fin - len_length a)) (Seq.slice last2 0 (fin - len_length a));\n Seq.lemma_eq_intro (Seq.slice last3 0 rem) b;\n Seq.lemma_eq_intro (Seq.slice last3 rem (rem + 1)) firstbyte;\n Seq.lemma_eq_intro (Seq.slice last3 (rem + 1) (fin - len_length a)) zeros;\n\n Seq.lemma_eq_intro (Seq.slice last3 0 fin) (Seq.append b pad)", "val lemma_len_lt_max_a_mul_by_8: a:sha2_alg -> len:len_lt_max_a_t a ->\n Lemma (let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n v total_len_bits == len * 8)", "let lemma_len_lt_max_a_mul_by_8 a len =\n match a with\n | SHA2_224 | SHA2_256 -> Math.Lemmas.pow2_plus 61 3\n | SHA2_384 | SHA2_512 -> Math.Lemmas.pow2_plus 125 3", "val load_last_pad_lemma:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> fin:nat{fin == block_length a \\/ fin == 2 * block_length a} ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a len) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Spec.Hash.MD.pad a len == pad)", "let load_last_pad_lemma a len fin =\n let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n lemma_len_lt_max_a_mul_by_8 a len;\n assert (v total_len_bits == len * 8);\n\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a len) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Seq.lemma_eq_intro (Spec.Hash.MD.pad a len) pad", "val update_last_lemma:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> len: size_nat { len <= block_length a /\\ len % block_length a == totlen % block_length a }\n -> b:lseq uint8 len ->\n Lemma\n (let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let blocksize = block_length a in\n let rem = len in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n let last = create (2 * block_length a) (u8 0) in\n let last = update_sub last 0 rem b in\n let last = last.[rem] <- u8 0x80 in\n let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in\n Seq.equal (Seq.slice last 0 fin) (Seq.append b (Spec.Hash.MD.pad a totlen)))", "let update_last_lemma a totlen len b =\n let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let blocksize = block_length a in\n let rem = len in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n load_last_lemma a totlen totlen_seq len b;\n load_last_pad_lemma a totlen fin", "let update_last_is_repeat_blocks_multi a totlen len last st1 =\n let pad_s = Spec.Hash.MD.pad a totlen in\n let blocksize = block_length a in\n let rem = len in\n let blocks1 = Seq.append last pad_s in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n append_pad_last_length_lemma a totlen;\n load_last_pad_lemma a totlen fin;\n assert (length blocks1 = blocksize \\/ length blocks1 = 2 * blocksize);\n assert (length blocks1 == padded_blocks a rem * blocksize);\n\n let nb = padded_blocks a rem in\n Math.Lemmas.cancel_mul_mod nb blocksize;\n let res = repeat_blocks_multi blocksize blocks1 (update a) st1 in\n LSeq.lemma_repeat_blocks_multi blocksize blocks1 (update a) st1;\n assert (res == Loops.repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1);\n\n let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let (b0, b1) = load_last a totlen_seq fin rem last in\n let st2 = update a b0 st1 in\n Loops.unfold_repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1 0;\n Loops.eq_repeati0 nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1;\n update_last_lemma a totlen len last;\n assert (st2 == repeat_blocks_f blocksize blocks1 (update a) nb 0 st1);\n\n if nb = 2 then begin\n let st3 = update a b1 st2 in\n Loops.unfold_repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1 1;\n assert (st3 == repeat_blocks_f blocksize blocks1 (update a) nb 1 st2) end", "val hash_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let pad_s = Spec.Hash.MD.pad a len in\n repeat_blocks (block_length a) b (update a) (update_last a len') st0 ==\n repeat_blocks_multi (block_length a) (Seq.append b pad_s) (update a) st0)", "let hash_is_repeat_blocks_multi a len b st0 =\n let pad_s = Spec.Hash.MD.pad a len in\n let blocks = Seq.append b pad_s in\n let blocksize = block_length a in\n let nb = len / blocksize in\n let rem = len % blocksize in\n let len0 = nb * blocksize in\n Math.Lemmas.cancel_mul_mod nb blocksize;\n\n let res = repeat_blocks_multi blocksize blocks (update a) st0 in\n let blocks1 = Seq.slice blocks len0 (length blocks) in\n let blocks0 = Seq.slice blocks 0 len0 in\n let st1 = repeat_blocks_multi blocksize blocks0 (update a) st0 in\n LSeqLemmas.split_len_lemma0 blocksize (length blocks / blocksize) len0;\n LSeqLemmas.repeat_blocks_multi_split blocksize len0 blocks (update a) st0;\n //assert (res == repeat_blocks_multi blocksize blocks1 (update a) st1);\n\n let len' : len_t a = mk_len_t a len in\n LSeqLemmas.lemma_repeat_blocks_via_multi blocksize b (update a) (update_last a len') st0;\n Seq.lemma_eq_intro (Seq.slice b 0 len0) blocks0;\n let last = Seq.slice b len0 len in\n //assert (repeat_blocks blocksize b (update a) (update_last a len') st0 == update_last a len' rem last st1);\n Seq.lemma_eq_intro blocks1 (Seq.append last pad_s);\n\n // Stabilizing nl arithmetic:\n // By def of pad_length\n assert ((pad_length a len + len) % blocksize == 0);\n // We derive the precondition of update_last_is_repeat_blocks_multi\n Math.Lemmas.lemma_mod_add_distr (pad_length a len) len blocksize;\n assert ((pad_length a len + len % blocksize) % blocksize = 0);\n update_last_is_repeat_blocks_multi a len rem last st1" ], "closest": [ "val hash_agile_lemma:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len ->\n Lemma (forall (l:nat{l < lanes a m}).\n (hash #a #m len b).(|l|) == Spec.Agile.Hash.hash a b.(|l|))\nlet hash_agile_lemma #a #m len b =\n Classical.forall_intro (hash_agile_lemma_l #a #m len b)", "val hash_agile_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len\n -> l:nat{l < lanes a m} ->\n Lemma ((hash #a #m len b).(|l|) == Spec.Agile.Hash.hash a b.(|l|))\nlet hash_agile_lemma_l #a #m len b l =\n hash_lemma_l #a #m len b l;\n Hacl.Spec.SHA2.EquivScalar.hash_agile_lemma #a len b.(|l|)", "val hash_lemma:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len ->\n Lemma (forall (l:nat{l < lanes a m}).\n (hash #a #m len b).(|l|) == Spec.hash len b.(|l|))\nlet hash_lemma #a #m len b =\n Classical.forall_intro (hash_lemma_l #a #m len b)", "val hash_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len\n -> l:nat{l < lanes a m} ->\n Lemma ((hash #a #m len b).(|l|) == Spec.hash len b.(|l|))\nlet hash_lemma_l #a #m len b l =\n let len' : len_t a = Spec.mk_len_t a len in\n let st0 = init a m in\n init_lemma_l a m l;\n let st1 = update_nblocks #a #m len b st0 in\n update_nblocks_lemma_l #a #m len b st0 l;\n let rem = len % block_length a in\n let mb = get_multilast_spec #a #m len b in\n let st = update_last len' rem mb st1 in\n update_last_lemma_l len' rem mb st1 l;\n finish_lemma_l st l", "val Hacl.Spec.SHA2.hash = \n len: Hacl.Spec.SHA2.len_lt_max_a_t a ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Lib.Sequence.lseq Lib.IntTypes.uint8 (Spec.Hash.Definitions.hash_length a)\nlet hash (#a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len}) =\n let len' : len_t a = mk_len_t a len in\n let st = init a in\n let st = update_nblocks a len b st in\n let rem = len % block_length a in\n let mb = Seq.slice b (len - rem) len in\n let st = update_last a len' rem mb st in\n finish a st", "val lemma_len_lt_max_a_fits_size_t: a:sha2_alg -> len:size_t ->\n Lemma (v len `less_than_max_input_length` a)\nlet lemma_len_lt_max_a_fits_size_t a len =\n match a with\n | SHA2_224 | SHA2_256 -> Math.Lemmas.pow2_lt_compat 61 32\n | SHA2_384 | SHA2_512 -> Math.Lemmas.pow2_lt_compat 125 32", "val hash_len (a: Hash.alg) : (x: UInt32.t{UInt32.v x == Spec.Agile.Hash.hash_length a})\nlet hash_len (a:Hash.alg) : (x:UInt32.t { UInt32.v x == Spec.Agile.Hash.hash_length a }) =\n match a with\n | MD5 -> md5_hash_len\n | SHA1 -> sha1_hash_len\n | SHA2_224 -> sha2_224_hash_len\n | SHA2_256 -> sha2_256_hash_len\n | SHA2_384 -> sha2_384_hash_len\n | SHA2_512 -> sha2_512_hash_len\n | SHA3_224 -> sha3_224_hash_len\n | SHA3_256 -> sha3_256_hash_len\n | SHA3_384 -> sha3_384_hash_len\n | SHA3_512 -> sha3_512_hash_len\n | Blake2S -> blake2s_hash_len\n | Blake2B -> blake2b_hash_len", "val Spec.Agile.Hash.hash = \n a: Spec.Hash.Definitions.fixed_len_alg ->\n input:\n Spec.Hash.Definitions.bytes\n {Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input) a}\n -> Lib.ByteSequence.lbytes (Spec.Hash.Definitions.hash_length' a ())\nlet hash (a:fixed_len_alg) (input:bytes{S.length input `less_than_max_input_length` a}) =\n hash' a input ()", "val hash:\n a:Hash.alg ->\n output:B.buffer Lib.IntTypes.uint8 {B.length output = hash_length a} ->\n input:B.buffer Lib.IntTypes.uint8 ->\n input_len:FStar.UInt32.t {B.length input = FStar.UInt32.v input_len /\\ FStar.UInt32.v input_len `less_than_max_input_length` a} ->\n Stack unit\n (requires fun h0 ->\n B.live h0 output /\\\n B.live h0 input /\\\n B.(loc_disjoint (loc_buffer input) (loc_buffer output)))\n (ensures fun h0 _ h1 ->\n B.(modifies (loc_buffer output) h0 h1) /\\\n B.as_seq h1 output == Spec.Agile.Hash.hash a (B.as_seq h0 input))\nlet hash a output input input_len =\n match a with\n | MD5 -> Hacl.Hash.MD5.hash_oneshot output input input_len\n | SHA1 -> Hacl.Hash.SHA1.hash_oneshot output input input_len\n | SHA2_224 -> hash_224 output input input_len\n | SHA2_256 -> hash_256 output input input_len\n | SHA2_384 -> Hacl.Streaming.SHA2.hash_384 output input input_len\n | SHA2_512 -> Hacl.Streaming.SHA2.hash_512 output input input_len\n | SHA3_224 -> Hacl.Hash.SHA3.hash SHA3_224 output input input_len\n | SHA3_256 -> Hacl.Hash.SHA3.hash SHA3_256 output input input_len\n | SHA3_384 -> Hacl.Hash.SHA3.hash SHA3_384 output input input_len\n | SHA3_512 -> Hacl.Hash.SHA3.hash SHA3_512 output input input_len\n | Blake2S ->\n if EverCrypt.TargetConfig.hacl_can_compile_vec128 then\n let vec128 = EverCrypt.AutoConfig2.has_vec128 () in\n if vec128 then\n Hacl.Hash.Blake2s_128.hash output input input_len\n else\n Hacl.Hash.Blake2s_32.hash output input input_len\n else\n Hacl.Hash.Blake2s_32.hash output input input_len\n | Blake2B ->\n if EverCrypt.TargetConfig.hacl_can_compile_vec256 then\n let vec256 = EverCrypt.AutoConfig2.has_vec256 () in\n if vec256 then\n Hacl.Hash.Blake2b_256.hash output input input_len\n else\n Hacl.Hash.Blake2b_32.hash output input input_len\n else\n Hacl.Hash.Blake2b_32.hash output input input_len", "val Hacl.Spec.SHA2.len_lt_max_a_t = a: Spec.Hash.Definitions.sha2_alg -> Type0\nlet len_lt_max_a_t (a:sha2_alg) = len:nat{len `less_than_max_input_length` a}", "val lemma_hash_lengths (a: ha)\n : Lemma\n (HD.hash_length a <= 64 /\\ HD.word_length a <= 8 /\\ HD.block_length a <= 128 /\\\n (if Some? (HD.max_input_length a)\n then Some?.v (HD.max_input_length a) >= pow2 61 - 1\n else True))\nlet lemma_hash_lengths (a:ha)\n : Lemma (HD.hash_length a <= 64 /\\ HD.word_length a <= 8 /\\\n HD.block_length a <= 128 /\\\n (if Some? (HD.max_input_length a) then Some?.v (HD.max_input_length a) >= pow2 61 - 1 else True))\n =\n assert_norm(pow2 61 < pow2 125)", "val Hacl.Spec.SHA2.sha256 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_256 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Lib.Sequence.lseq Lib.IntTypes.uint8\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_256)\nlet sha256 (len:len_lt_max_a_t SHA2_256) (b:seq uint8{length b = len}) =\n hash #SHA2_256 len b", "val Hacl.Spec.SHA2.sha512 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_512 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Lib.Sequence.lseq Lib.IntTypes.uint8\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_512)\nlet sha512 (len:len_lt_max_a_t SHA2_512) (b:seq uint8{length b = len}) =\n hash #SHA2_512 len b", "val Hacl.Spec.SHA2.Vec.hash = \n len: Hacl.Spec.SHA2.len_lt_max_a_t a ->\n b: Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes a m) len\n -> Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes a m)\n (Spec.Hash.Definitions.hash_length a)\nlet hash (#a:sha2_alg) (#m:m_spec{is_supported a m}) (len:Spec.len_lt_max_a_t a) (b:multiseq (lanes a m) len) =\n let len' : len_t a = Spec.mk_len_t a len in\n let st = init a m in\n let st = update_nblocks #a #m len b st in\n let rem = len % block_length a in\n let mb = get_multilast_spec #a #m len b in\n let st = update_last len' rem mb st in\n finish st", "val emit1_lemma\n (#a: sha2_alg)\n (#m: m_spec{lanes a m == 1})\n (hseq: LSeq.lseq uint8 (lanes a m * 8 * word_length a))\n : Lemma (emit1_spec #a #m hseq == SpecVec.emit #a #m hseq)\nlet emit1_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 1}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) :\n Lemma (emit1_spec #a #m hseq == SpecVec.emit #a #m hseq)\n =\n Lib.NTuple.eq_intro (emit1_spec #a #m hseq) (SpecVec.emit #a #m hseq)", "val hash_is_hash_incremental' (a: hash_alg) (input: bytes { S.length input `less_than_max_input_length` a })\n (l: output_length a):\n Lemma (S.equal (hash' a input l) (hash_incremental a input l))\nlet hash_is_hash_incremental' (a: hash_alg) (input: bytes { S.length input `less_than_max_input_length` a }) l =\n if is_blake a then\n Spec.Blake2.Incremental.blake2_is_hash_incremental a input\n else if is_keccak a then\n Spec.SHA3.Incremental.sha3_is_incremental a input l\n else\n Spec.MD.Incremental.md_is_hash_incremental a input (init a)", "val hash' (a:hash_alg) (input:bytes{S.length input `less_than_max_input_length` a}) (l: output_length a):\n Tot (Lib.ByteSequence.lbytes (Spec.Hash.Definitions.hash_length' a l))\nlet hash' a input l =\n if is_blake a then\n Spec.Blake2.blake2 (to_blake_alg a) input (Spec.Blake2.blake2_default_params (to_blake_alg a)) 0 Seq.empty (Spec.Blake2.max_output (to_blake_alg a))\n else if is_md a then\n (* As defined in the NIST standard; pad, then update, then finish. *)\n let padding = pad a (S.length input) in\n finish_md a (update_multi a (init a) () S.(input @| padding))\n else match a with\n | SHA3_224 -> Spec.SHA3.sha3_224 (Seq.length input) input\n | SHA3_256 -> Spec.SHA3.sha3_256 (Seq.length input) input\n | SHA3_384 -> Spec.SHA3.sha3_384 (Seq.length input) input\n | SHA3_512 -> Spec.SHA3.sha3_512 (Seq.length input) input\n | Shake128 -> Spec.SHA3.shake128 (Seq.length input) input l\n | Shake256 -> Spec.SHA3.shake256 (Seq.length input) input l", "val Hacl.Spec.SHA2.sha384 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_384 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Lib.Sequence.lseq Lib.IntTypes.uint8\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_384)\nlet sha384 (len:len_lt_max_a_t SHA2_384) (b:seq uint8{length b = len}) =\n hash #SHA2_384 len b", "val emit8_lemma\n (#a: sha2_alg)\n (#m: m_spec{lanes a m == 8})\n (hseq: LSeq.lseq uint8 (lanes a m * 8 * word_length a))\n : Lemma (emit8_spec #a #m hseq == SpecVec.emit #a #m hseq)\nlet emit8_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) :\n Lemma (emit8_spec #a #m hseq == SpecVec.emit #a #m hseq)\n =\n Lib.NTuple.eq_intro (emit8_spec #a #m hseq) (SpecVec.emit #a #m hseq)", "val hash_len: a:G.erased alg -> (\n let c = hacl_keccak a in\n let a = G.reveal a in\n let i = a in\n let t = sha3_state a in\n let t' = G.erased unit in\n s:state c i t t' ->\n Stack Lib.IntTypes.size_t\n (requires fun h0 ->\n not (is_shake_ a) /\\\n invariant c i h0 s)\n (ensures fun h0 r h1 ->\n B.(modifies loc_none h0 h1) /\\\n Lib.IntTypes.v r == Spec.Hash.Definitions.hash_length a))\nlet hash_len a s =\n let a = get_alg a s in\n Hacl.Hash.SHA3.hash_len a", "val shuffle_core_pre_create8_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state' a ->\n Lemma (Spec.shuffle_core_pre a k_t ws_t hash == shuffle_core_pre_create8 a k_t ws_t hash)\nlet shuffle_core_pre_create8_lemma a k_t ws_t hash =\n let a0 = Seq.index hash 0 in\n let b0 = Seq.index hash 1 in\n let c0 = Seq.index hash 2 in\n let d0 = Seq.index hash 3 in\n let e0 = Seq.index hash 4 in\n let f0 = Seq.index hash 5 in\n let g0 = Seq.index hash 6 in\n let h0 = Seq.index hash 7 in\n\n let t1 = h0 +. (Spec._Sigma1 a e0) +. (Spec._Ch a e0 f0 g0) +. k_t +. ws_t in\n let t2 = (Spec._Sigma0 a a0) +. (Spec._Maj a a0 b0 c0) in\n seq_of_list_is_create8 (t1 +. t2) a0 b0 c0 (d0 +. t1) e0 f0 g0", "val spec_is_incremental :\n a : alg ->\n kk: size_nat{kk <= max_key a} ->\n k: lbytes kk ->\n input:S.seq uint8 { if kk = 0 then S.length input <= max_input_length a else S.length input + (Spec.size_block a) <= max_input_length a } ->\n Lemma(\n blake2_hash_incremental_s a kk k input ==\n Spec.blake2 a input (Spec.blake2_default_params a) kk k (output_size a))\nlet spec_is_incremental a kk k input0 =\n let key_block = if kk > 0 then Spec.blake2_key_block a kk k else S.empty in\n let key_block_len = S.length key_block in\n let input = Seq.append key_block input0 in\n let n_blocks, l_last = Spec.split a (S.length input) in\n let blocks, last = Lib.UpdateMulti.split_at_last_lazy (U32.v (block_len a)) input in\n let s = init_s a kk in\n repeati_split_at_eq a s input;\n let f = Spec.blake2_update1 a 0 input in\n let g = Spec.blake2_update1 a 0 blocks in\n let s1 = Lib.LoopCombinators.repeati n_blocks f s in\n let s2 = Lib.LoopCombinators.repeati n_blocks g s in\n assert (s1 == s2);\n\n S.lemma_eq_intro (S.slice input (S.length input - l_last) (S.length input)) last;\n S.lemma_eq_intro (S.slice last (S.length last - l_last) (S.length last)) last;\n Spec.Blake2.Alternative.lemma_spec_equivalence_update a kk k input0 s;\n assert (U32.v (output_len a) = output_size a)", "val lemma_max_hash_len (ha: _)\n : Lemma\n (Spec.Hash.Definitions.hash_length ha <= 64 /\\\n (if Some? (Spec.Hash.Definitions.max_input_length ha)\n then Some?.v (Spec.Hash.Definitions.max_input_length ha) >= pow2 61 - 1\n else True) /\\ pow2 61 - 1 > 64) [SMTPat (Spec.Hash.Definitions.hash_length ha)]\nlet lemma_max_hash_len ha\n : Lemma (Spec.Hash.Definitions.hash_length ha <= 64 /\\\n (if Some? (Spec.Hash.Definitions.max_input_length ha) then\n Some?.v (Spec.Hash.Definitions.max_input_length ha) >= pow2 61 - 1\n else\n True) /\\\n pow2 61 - 1 > 64)\n [SMTPat (Spec.Hash.Definitions.hash_length ha)]\n =\n assert_norm (pow2 61 < pow2 125);\n assert_norm (pow2 61 - 1 > 64);\n assert_norm (pow2 64 > pow2 61);\n assert_norm (pow2 128 > pow2 64)", "val lemma_max_hash_len (ha: _)\n : Lemma\n (Spec.Hash.Definitions.hash_length ha <= 64 /\\\n (if Some? (Spec.Hash.Definitions.max_input_length ha)\n then Some?.v (Spec.Hash.Definitions.max_input_length ha) >= pow2 61 - 1\n else True) /\\ pow2 61 - 1 > 64) [SMTPat (Spec.Hash.Definitions.hash_length ha)]\nlet lemma_max_hash_len ha\n : Lemma (Spec.Hash.Definitions.hash_length ha <= 64 /\\\n (if Some? (Spec.Hash.Definitions.max_input_length ha) then\n Some?.v (Spec.Hash.Definitions.max_input_length ha) >= pow2 61 - 1\n else\n True) /\\\n pow2 61 - 1 > 64)\n [SMTPat (Spec.Hash.Definitions.hash_length ha)]\n =\n assert_norm (pow2 61 < pow2 125);\n assert_norm (pow2 61 - 1 > 64);\n assert_norm (pow2 64 > pow2 61);\n assert_norm (pow2 128 > pow2 64)", "val Hacl.Spec.SHA2.Vec.sha256 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_256 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes Spec.Hash.Definitions.SHA2_256\n Hacl.Spec.SHA2.Vec.M32)\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_256)\nlet sha256 (len:Spec.len_lt_max_a_t SHA2_256) (b:seq uint8{length b = len}) =\n hash #SHA2_256 #M32 len b", "val hash_block_length_fits (a: fixed_len_alg)\n : Lemma ((hash_length a + pow2 32 + block_length a) `less_strict_than_max_input_length` a)\nlet hash_block_length_fits (a:fixed_len_alg) :\n Lemma ((hash_length a + pow2 32 + block_length a) `less_strict_than_max_input_length` a)\n=\n let open FStar.Mul in\n assert_norm (8 * 16 + 8 * 8 + pow2 32 < pow2 61);\n assert_norm (pow2 61 < pow2 125)", "val emit4_lemma\n (#a: sha2_alg)\n (#m: m_spec{lanes a m == 4})\n (hseq: LSeq.lseq uint8 (lanes a m * 8 * word_length a))\n : Lemma (emit4_spec #a #m hseq == SpecVec.emit #a #m hseq)\nlet emit4_lemma (#a:sha2_alg) (#m:m_spec{lanes a m == 4}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) :\n Lemma (emit4_spec #a #m hseq == SpecVec.emit #a #m hseq)\n =\n Lib.NTuple.eq_intro (emit4_spec #a #m hseq) (SpecVec.emit #a #m hseq)", "val mk_len_t_from_size_t (a: sha2_alg) (len: size_t)\n : Pure (len_t a)\n (requires True)\n (ensures\n fun x ->\n (lemma_len_lt_max_a_fits_size_t a len;\n len_v a x = len_v a (Hacl.Spec.SHA2.mk_len_t a (v len))))\nlet mk_len_t_from_size_t (a:sha2_alg) (len:size_t) :\n Pure (len_t a)\n (requires True)\n (ensures fun x ->\n (lemma_len_lt_max_a_fits_size_t a len;\n len_v a x = len_v a (Hacl.Spec.SHA2.mk_len_t a (v len)))) =\n\n match a with\n | SHA2_224 | SHA2_256 ->\n (Math.Lemmas.pow2_lt_compat 64 32; Lib.IntTypes.cast #U32 #PUB U64 PUB len)\n | SHA2_384 | SHA2_512 ->\n (Math.Lemmas.pow2_lt_compat 128 32; Lib.IntTypes.cast #U32 #PUB U128 PUB len)", "val state_spec_v_extensionality\n (a: hash_alg{is_sha2 a})\n (acc1 acc2: Hacl.Spec.SHA2.Vec.(state_spec a M32))\n : Lemma\n (requires\n (let open Hacl.Spec.SHA2.Vec in\n Lib.Sequence.index (state_spec_v acc1) 0 == Lib.Sequence.index (state_spec_v acc2) 0))\n (ensures acc1 == acc2)\nlet state_spec_v_extensionality (a : hash_alg { is_sha2 a })\n (acc1: Hacl.Spec.SHA2.Vec.(state_spec a M32))\n (acc2: Hacl.Spec.SHA2.Vec.(state_spec a M32)) :\n Lemma\n (requires (let open Hacl.Spec.SHA2.Vec in\n Lib.Sequence.index (state_spec_v acc1) 0 ==\n Lib.Sequence.index (state_spec_v acc2) 0))\n (ensures acc1 == acc2) =\n\n let open Lib.Sequence in\n let open Lib.IntVector in\n let open Hacl.Spec.SHA2.Vec in\n allow_inversion hash_alg;\n let acc1_s = (state_spec_v acc1).[0] <: lseq (word a) 8 in\n let acc2_s = (state_spec_v acc2).[0] <: lseq (word a) 8 in\n\n let aux (i:nat{i < 8}) : Lemma (acc1.[i] == acc2.[i]) =\n assert (index (vec_v acc1.[i]) 0 == index #(word a) #8 acc1_s i);\n assert (index (vec_v acc2.[i]) 0 == index #(word a) #8 acc2_s i);\n assert (index (vec_v acc1.[i]) 0 == index (vec_v acc2.[i]) 0);\n eq_intro (vec_v acc1.[i]) (vec_v acc2.[i]);\n vecv_extensionality acc1.[i] acc2.[i] in\n\n Classical.forall_intro aux;\n eq_intro acc1 acc2", "val load_last_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> totlen_seq:lseq uint8 (len_length a)\n -> fin:nat{fin == block_length a \\/ fin == 2 * block_length a}\n -> len:nat{len <= block_length a}\n -> b:multiseq (lanes a m) len\n -> l:nat{l < lanes a m} ->\n Lemma\n (let (b0_v, b1_v) = load_last totlen_seq fin len b in\n let (b0, b1) = Spec.load_last a totlen_seq fin len b.(|l|) in\n b0_v.(|l|) == b0 /\\ b1_v.(|l|) == b1)\nlet load_last_lemma_l #a #m totlen_seq fin len b l =\n reveal_opaque (`%load_last) (load_last #a #m);\n allow_inversion sha2_alg;\n allow_inversion m_spec", "val Hacl.Spec.SHA2.sha224 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_224 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Lib.Sequence.lseq Lib.IntTypes.uint8\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_224)\nlet sha224 (len:len_lt_max_a_t SHA2_224) (b:seq uint8{length b = len}) =\n hash #SHA2_224 len b", "val hash_len (a: alg) : n: UInt32.t{UInt32.v n == hash_length a}\nlet hash_len (a:alg)\n : n:UInt32.t{UInt32.v n == hash_length a}\n = Hacl.Hash.Definitions.hash_len a", "val lemma_update1_shift:\n a:alg\n -> b:block_s a\n -> d:bytes{length d + (size_block a) <= max_limb a}\n -> i:nat{i < length d / size_block a /\\ (size_block a) + length d <= max_limb a}\n -> s:state a ->\n Lemma (\n blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s\n )\nlet lemma_update1_shift a b d i s =\n assert (get_blocki a (b `Seq.append` d) (i + 1) `Seq.equal` get_blocki a d i)", "val lemma_spec_update_last_vec_384_512\n (totlen: _)\n (len: size_t{v len <= block_length SHA2_512})\n (b0 st0: _)\n : Lemma\n (ensures\n (Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n SpecVec.update_last #SHA2_384 #M32 totlen (v len) b0 st0 ==\n SpecVec.update_last #SHA2_512 #M32 totlen (v len) b0 st0))\nlet lemma_spec_update_last_vec_384_512 totlen (len:size_t{v len <= block_length SHA2_512}) b0 st0 : Lemma (ensures (\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n SpecVec.update_last #SHA2_384 #M32 totlen (v len) b0 st0 ==\n SpecVec.update_last #SHA2_512 #M32 totlen (v len) b0 st0))\n = let open Lib.Sequence in\n let open Lib.MultiBuffer in\n let st1 = SpecVec.update_last #SHA2_512 #M32 totlen (v len) b0 st0 in\n let st0_m32 = (state_spec_v st0).[0] <: words_state SHA2_512 in\n let st1_m32 = (state_spec_v st1).[0] <: words_state SHA2_512 in\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n let hacl_spec_update_384_512 b st: Lemma (ensures\n Hacl.Spec.SHA2.update SHA2_512 b st ==\n Hacl.Spec.SHA2.update SHA2_384 b st)\n [ SMTPat (Hacl.Spec.SHA2.update SHA2_512 b st) ]\n =\n lemma_spec_update_384_512 b st\n in\n calc (==) {\n st1_m32;\n (==) {}\n (state_spec_v (SpecVec.update_last #SHA2_512 totlen (v len) b0 st0)).[0];\n (==) { Hacl.Spec.SHA2.Equiv.update_last_lemma_l #SHA2_512 #M32 totlen (v len) b0 st0 0 }\n Hacl.Spec.SHA2.update_last SHA2_512 totlen (v len) b0.(|0|) st0_m32;\n (==) { }\n Hacl.Spec.SHA2.update_last SHA2_384 totlen (v len) b0.(|0|) st0_m32;\n (==) { Hacl.Spec.SHA2.Equiv.update_last_lemma_l #SHA2_384 #M32 totlen (v len) b0 st0 0 }\n (state_spec_v (SpecVec.update_last #SHA2_384 #M32 totlen (v len) b0 st0)).[0];\n };\n state_spec_v_extensionality SHA2_512\n (SpecVec.update_last #SHA2_384 #M32 totlen (v len) b0 st0)\n (SpecVec.update_last #SHA2_512 #M32 totlen (v len) b0 st0)", "val state_spec_v_lemma (a:sha2_alg) (st:Vec.state_spec a Vec.M32) : Lemma\n (Lib.IntVector.reveal_vec_1 (word_t a);\n st `Seq.equal` Lib.Sequence.index (Vec.state_spec_v st) 0)\nlet state_spec_v_lemma a st =\n let open Lib.Sequence in\n let open Lib.IntVector in\n reveal_vec_v_1 st.[0];\n reveal_vec_v_1 st.[1];\n reveal_vec_v_1 st.[2];\n reveal_vec_v_1 st.[3];\n reveal_vec_v_1 st.[4];\n reveal_vec_v_1 st.[5];\n reveal_vec_v_1 st.[6];\n reveal_vec_v_1 st.[7];\n reveal_vec_1 (word_t a);\n eq_intro #(word a) #8 (Vec.state_spec_v st).[0] st", "val update_last_224_256:\n hash:words_state SHA2_256 ->\n prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_256 ->\n input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_256 /\\\n Seq.length input <= block_length SHA2_256 } ->\n Lemma\n (ensures Spec.Hash.Incremental.Definitions.update_last SHA2_256 hash prevlen input ==\n Spec.Hash.Incremental.Definitions.update_last SHA2_224 hash prevlen input)\nlet update_last_224_256 hash prevlen input =\n let update_multi_224_256 (hash:words_state SHA2_256) (blocks:bytes_blocks SHA2_256):\n Lemma\n (ensures (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks ==\n Spec.Agile.Hash.update_multi SHA2_224 hash () blocks))\n (decreases (Seq.length blocks))\n [ SMTPat (Spec.Agile.Hash.update_multi SHA2_256 hash () blocks) ]\n =\n update_multi_224_256 hash blocks\n in\n ()", "val Hacl.Spec.SHA2.Vec.sha512 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_512 ->\n b: Lib.Sequence.seq Lib.IntTypes.uint8 {Lib.Sequence.length b = len}\n -> Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes Spec.Hash.Definitions.SHA2_512\n Hacl.Spec.SHA2.Vec.M32)\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_512)\nlet sha512 (len:Spec.len_lt_max_a_t SHA2_512) (b:seq uint8{length b = len}) =\n hash #SHA2_512 #M32 len b", "val Hacl.Spec.SHA2.Vec.sha256_4 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_256 ->\n b: Hacl.Spec.SHA2.Vec.multiseq 4 len\n -> Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes Spec.Hash.Definitions.SHA2_256\n Hacl.Spec.SHA2.Vec.M128)\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_256)\nlet sha256_4 (len:Spec.len_lt_max_a_t SHA2_256) (b:multiseq 4 len) =\n hash #SHA2_256 #M128 len b", "val hash:\n a:Hash.hash_alg{S.hash_is_supported a}\n -> mHash:lbuffer uint8 (hash_len a)\n -> msgLen:size_t{v msgLen `less_than_max_input_length` a}\n -> msg:lbuffer uint8 msgLen ->\n Stack unit\n (requires fun h -> live h mHash /\\ live h msg /\\ disjoint msg mHash)\n (ensures fun h0 _ h1 -> modifies (loc mHash) h0 h1 /\\\n as_seq h1 mHash == Hash.hash a (as_seq h0 msg))\nlet hash a mHash msgLen msg =\n match a with\n | Hash.SHA2_256 -> Hacl.Streaming.SHA2.hash_256 mHash msg msgLen\n | Hash.SHA2_384 -> Hacl.Streaming.SHA2.hash_384 mHash msg msgLen\n | Hash.SHA2_512 -> Hacl.Streaming.SHA2.hash_512 mHash msg msgLen", "val lemma_spec_update_last_vec_224_256\n (totlen: _)\n (len: size_t{v len <= block_length SHA2_256})\n (b0 st0: _)\n : Lemma\n (ensures\n (Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_256 len;\n SpecVec.update_last #SHA2_224 #M32 totlen (v len) b0 st0 ==\n SpecVec.update_last #SHA2_256 #M32 totlen (v len) b0 st0))\nlet lemma_spec_update_last_vec_224_256 totlen (len:size_t{v len <= block_length SHA2_256}) b0 st0 : Lemma (ensures (\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_256 len;\n SpecVec.update_last #SHA2_224 #M32 totlen (v len) b0 st0 ==\n SpecVec.update_last #SHA2_256 #M32 totlen (v len) b0 st0))\n = let open Lib.Sequence in\n let open Lib.MultiBuffer in\n let st1 = SpecVec.update_last #SHA2_256 #M32 totlen (v len) b0 st0 in\n let st0_m32 = (state_spec_v st0).[0] <: words_state SHA2_256 in\n let st1_m32 = (state_spec_v st1).[0] <: words_state SHA2_256 in\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_256 len;\n let hacl_spec_update_224_256 b st: Lemma (ensures\n Hacl.Spec.SHA2.update SHA2_256 b st ==\n Hacl.Spec.SHA2.update SHA2_224 b st)\n [ SMTPat (Hacl.Spec.SHA2.update SHA2_256 b st) ]\n =\n lemma_spec_update_224_256 b st\n in\n calc (==) {\n st1_m32;\n (==) {}\n (state_spec_v (SpecVec.update_last #SHA2_256 totlen (v len) b0 st0)).[0];\n (==) { Hacl.Spec.SHA2.Equiv.update_last_lemma_l #SHA2_256 #M32 totlen (v len) b0 st0 0 }\n Hacl.Spec.SHA2.update_last SHA2_256 totlen (v len) b0.(|0|) st0_m32;\n (==) { }\n Hacl.Spec.SHA2.update_last SHA2_224 totlen (v len) b0.(|0|) st0_m32;\n (==) { Hacl.Spec.SHA2.Equiv.update_last_lemma_l #SHA2_224 #M32 totlen (v len) b0 st0 0 }\n (state_spec_v (SpecVec.update_last #SHA2_224 #M32 totlen (v len) b0 st0)).[0];\n };\n state_spec_v_extensionality SHA2_256\n (SpecVec.update_last #SHA2_224 #M32 totlen (v len) b0 st0)\n (SpecVec.update_last #SHA2_256 #M32 totlen (v len) b0 st0)", "val sha3_is_incremental\n (a: keccak_alg)\n (input: bytes)\n (l: output_length a): Lemma (hash_incremental a input l `S.equal` hash' a input l)\nlet sha3_is_incremental\n (a: keccak_alg)\n (input: bytes) (out_length: output_length a):\n Lemma (hash_incremental a input out_length `S.equal` hash' a input out_length)\n=\n calc (S.equal) {\n hash_incremental a input out_length;\n (S.equal) { sha3_is_incremental1 a input out_length } (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length);\n (S.equal) { sha3_is_incremental2 a input out_length }\n hash' a input out_length;\n }", "val hash_block_length_fits (a: hash_alg)\n : Lemma\n (if is_keccak a\n then True\n else hash_length a + pow2 32 + block_length a < Some?.v (max_input_length a))\nlet hash_block_length_fits (a:hash_alg) :\n Lemma (if is_keccak a then True else hash_length a + pow2 32 + block_length a < Some?.v(max_input_length a))\n=\n let open FStar.Mul in\n assert_norm (8 * 16 + 8 * 8 + pow2 32 < pow2 61);\n assert_norm (pow2 61 < pow2 125)", "val Spec.Agile.HMAC.keysized = a: Spec.Hash.Definitions.hash_alg -> l: Prims.nat -> Prims.logical\nlet keysized (a:hash_alg) (l:nat) =\n l `less_than_max_input_length` a /\\\n l + block_length a < pow2 32", "val blake2_is_hash_incremental\n (a : blake_alg)\n (input : bytes {S.length input `less_than_max_input_length` a}) :\n Lemma (\n S.equal (Spec.Blake2.blake2 (to_blake_alg a) input\n (Spec.Blake2.blake2_default_params (to_blake_alg a))\n 0 Seq.empty (Spec.Blake2.max_output (to_blake_alg a)))\n (hash_incremental a input ()))\nlet blake2_is_hash_incremental a input =\n let a' = to_blake_alg a in\n let n_blocks, l_last = Spec.Blake2.split a' (S.length input) in\n let blocks, last = Lib.UpdateMulti.split_at_last_lazy (block_length a) input in\n let s_i = Spec.Blake2.blake2_init_hash a' (Spec.Blake2.blake2_default_params a') 0 (Spec.Blake2.max_output (to_blake_alg a)) in\n let s_i': words_state a = init a in\n assert (s_i == s_i');\n\n blake2_update_incremental a input s_i'", "val lemma_shift_update_last:\n a:alg\n -> rem: nat\n -> b:block_s a\n -> d:bytes{length d + (size_block a) <= max_limb a /\\ rem <= length d /\\ rem <= size_block a}\n -> s:state a ->\n Lemma (\n blake2_update_last a 0 rem (b `Seq.append` d) s ==\n blake2_update_last a (size_block a) rem d s\n )\nlet lemma_shift_update_last a rem b d s =\n let m = b `Seq.append` d in\n assert (Seq.slice m (length m - rem) (length m) `Seq.equal` Seq.slice d (length d - rem) (length d));\n assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem)", "val update_last_384_512:\n hash:words_state SHA2_512 ->\n prevlen:Spec.Hash.Incremental.Definitions.prev_length_t SHA2_512 ->\n input:bytes{ (Seq.length input + prevlen) `less_than_max_input_length` SHA2_512 /\\\n Seq.length input <= block_length SHA2_512 } ->\n Lemma\n (ensures Spec.Hash.Incremental.Definitions.update_last SHA2_512 hash prevlen input ==\n Spec.Hash.Incremental.Definitions.update_last SHA2_384 hash prevlen input)\nlet update_last_384_512 hash prevlen input =\n let update_multi_384_512 (hash:words_state SHA2_512) (blocks:bytes_blocks SHA2_512):\n Lemma\n (ensures (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks ==\n Spec.Agile.Hash.update_multi SHA2_384 hash () blocks))\n (decreases (Seq.length blocks))\n [ SMTPat (Spec.Agile.Hash.update_multi SHA2_512 hash () blocks) ]\n =\n update_multi_384_512 hash blocks\n in\n ()", "val lemma_i2b_shl (#n:pos) (a:uint_t n) (b:uint_t n) : Lemma\n (b_i2b #n (shift_left #n a b) == b_shl #n (b_i2b a) b)\nlet lemma_i2b_shl #n a b =\n int2bv_shl #n #a #b #(bvshl #n (int2bv #n a) b) ();\n assert_norm (b_i2b #n (shift_left #n a b) == b_shl #n (b_i2b a) b)", "val lemma_i2b_and (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_and #n a b =\n int2bv_logand #n #a #b #(bvand #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (logand #n a b) == b_and #n (b_i2b a) (b_i2b b))", "val update_last_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> totlen:len_t a\n -> len:nat{len <= block_length a}\n -> b:multiseq (lanes a m) len\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma ((state_spec_v (update_last totlen len b st)).[l] ==\n Spec.update_last a totlen len b.(|l|) ((state_spec_v st).[l]))\nlet update_last_lemma_l #a #m totlen len b st0 l =\n let blocks = padded_blocks a len in\n let fin : nat = blocks * block_length a in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen 3ul) in\n let totlen_seq = Lib.ByteSequence.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let (b0,b1) = load_last #a #m totlen_seq fin len b in\n load_last_lemma_l #a #m totlen_seq fin len b l;\n let st = update b0 st0 in\n update_lemma_l b0 st0 l;\n update_lemma_l b1 st l", "val lemma_hash_append (h:quad32) (y_prev:quad32) (a b:ghash_plain_LE) : Lemma\n (ensures\n ghash_incremental h y_prev (append a b) ==\n (let y_a = ghash_incremental h y_prev a in ghash_incremental h y_a b))\n (decreases %[length b])\nlet rec lemma_hash_append (h:quad32) (y_prev:quad32) (a b:ghash_plain_LE)\n =\n ghash_incremental_reveal ();\n let ab = append a b in\n assert (last ab == last b);\n if length b = 1 then\n (lemma_slice_first_exactly_in_append a b;\n assert (all_but_last ab == a);\n ())\n else\n lemma_hash_append h y_prev a (all_but_last b);\n lemma_all_but_last_append a b;\n assert(all_but_last ab == append a (all_but_last b));\n ()", "val Hacl.Spec.SHA2.Vec.sha512_4 = \n len: Hacl.Spec.SHA2.len_lt_max_a_t Spec.Hash.Definitions.SHA2_512 ->\n b: Hacl.Spec.SHA2.Vec.multiseq 4 len\n -> Hacl.Spec.SHA2.Vec.multiseq (Hacl.Spec.SHA2.Vec.lanes Spec.Hash.Definitions.SHA2_512\n Hacl.Spec.SHA2.Vec.M256)\n (Spec.Hash.Definitions.hash_length Spec.Hash.Definitions.SHA2_512)\nlet sha512_4 (len:Spec.len_lt_max_a_t SHA2_512) (b:multiseq 4 len) =\n hash #SHA2_512 #M256 len b", "val Spec.SHA2.Lemmas.ws = \n a: Spec.Hash.Definitions.sha2_alg ->\n b: Spec.SHA2.block_w a ->\n t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}\n -> Spec.Hash.Definitions.word a\nlet ws = ws_aux", "val hash_len (a: keccak_alg { not (is_shake a) }): Lib.IntTypes.(n:size_t { v n = hash_length a })\nlet hash_len (a: keccak_alg { not (is_shake a) }): Lib.IntTypes.(n:size_t { v n = hash_length a }) =\n match a with\n | SHA3_224 -> 28ul\n | SHA3_256 -> 32ul\n | SHA3_384 -> 48ul\n | SHA3_512 -> 64ul", "val lemma_hash_append (h:quad32) (y_prev:quad32) (a b:ghash_plain_BE) : Lemma\n (ensures\n ghash_incremental h y_prev (append a b) ==\n (let y_a = ghash_incremental h y_prev a in ghash_incremental h y_a b))\n (decreases %[length b])\nlet rec lemma_hash_append (h:quad32) (y_prev:quad32) (a b:ghash_plain_BE)\n =\n ghash_incremental_reveal ();\n let ab = append a b in\n assert (last ab == last b);\n if length b = 1 then\n (lemma_slice_first_exactly_in_append a b;\n assert (all_but_last ab == a);\n ())\n else\n lemma_hash_append h y_prev a (all_but_last b);\n lemma_all_but_last_append a b;\n assert(all_but_last ab == append a (all_but_last b));\n ()", "val update_384_512: st:words_state SHA2_512 ->\n block:bytes{Seq.length block = block_length SHA2_512} ->\n Lemma\n (ensures (Spec.Agile.Hash.(update SHA2_512 st block == update SHA2_384 st block)))\nlet update_384_512 hash block =\n assert_norm (words_state SHA2_384 == words_state SHA2_512);\n let rec ws_384_512 (b: block_w SHA2_512) (t:counter{t < size_k_w SHA2_512}):\n Lemma\n (ensures (ws SHA2_384 b t == ws SHA2_512 b t))\n [ SMTPat (ws SHA2_512 b t) ]\n =\n reveal_opaque (`%ws) ws;\n assert_norm (block_w SHA2_512 == block_w SHA2_384);\n assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);\n\n (*\n * The code earlier was doing assert_norm (_sigma0 SHA2_512 == _sigma0 SHA2_384)\n *\n * This is a bit suboptimal, since assert_norm is a heavy hammer,\n * it also ends up unfolding `==`, which means the equality is not\n * reduced in F*, rather the query for proving equality of two\n * lambda terms reaches Z3 -- once that happens we are at the mercy of\n * hashconsing etc. to prove the equality\n *\n * Instead, if we do controlled normalization, we can prove the equality\n * within F*\n *)\n\n let steps = [iota; primops; simplify; delta_only [\n `%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;\n `%__proj__Mkops__item__e5; `%op384_512; `%__proj__Mkops__item__e3;\n `%__proj__Mkops__item__e4;\n `%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;\n `%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in\n\n assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));\n assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));\n\n norm_spec steps (_sigma0 SHA2_512);\n norm_spec steps (_sigma0 SHA2_384);\n norm_spec steps (_sigma1 SHA2_512);\n norm_spec steps (_sigma1 SHA2_384);\n\n // assert_norm (word_add_mod SHA2_512 == word_add_mod SHA2_384);\n if t < block_word_length SHA2_512 then\n ()\n else begin\n ws_384_512 b (t - 16);\n ws_384_512 b (t - 15);\n ws_384_512 b (t - 7);\n ws_384_512 b (t - 2)\n end\n in\n let shuffle_core_384_512 (block:block_w SHA2_512) (hash:words_state SHA2_512) (t:counter{t < size_k_w SHA2_512}):\n Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))\n [ SMTPat (shuffle_core SHA2_512 block hash t) ]\n =\n reveal_opaque (`%shuffle_core) shuffle_core\n in\n let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):\n Lemma\n (requires (forall x (i: nat { i < max }). {:pattern f x i \\/ g x i } f x i == g x i))\n (ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))\n (decreases (max - min))\n [ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]\n =\n if min = max then\n ()\n else\n repeat_range_f (min + 1) max f g (f x min)\n in\n let shuffle_384_512 (hash:words_state SHA2_512) (block:block_w SHA2_512):\n Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))\n [ SMTPat (shuffle SHA2_512 hash block) ]\n =\n shuffle_is_shuffle_pre SHA2_384 hash block;\n shuffle_is_shuffle_pre SHA2_512 hash block;\n reveal_opaque (`%shuffle) shuffle;\n assert_norm (words_state SHA2_384 == words_state SHA2_512)\n in\n let rec seq_map2_f\n (#a:Type) (#b:Type) (#c:Type)\n (f g:(a -> b -> Tot c))\n (s:S.seq a) (s':S.seq b{S.length s = S.length s'}):\n Lemma\n (requires (forall x y. {:pattern f x y \\/ g x y} f x y == g x y))\n (ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))\n (decreases (S.length s))\n [ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]\n =\n if S.length s = 0 then\n ()\n else\n seq_map2_f f g (S.tail s) (S.tail s')\n in\n assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) == words_of_bytes SHA2_384 #(block_word_length SHA2_384));\n reveal_opaque (`%shuffle) shuffle;\n reveal_opaque (`%update) update", "val Spec.Hash.Incremental.hash_is_hash_incremental = \n a: Spec.Hash.Definitions.fixed_len_alg ->\n input:\n Lib.ByteSequence.bytes\n {Spec.Hash.Definitions.less_than_max_input_length (FStar.Seq.Base.length input) a}\n -> Prims.unit\nlet hash_is_hash_incremental (a: fixed_len_alg) (input: bytes { S.length input `less_than_max_input_length` a }) =\n hash_is_hash_incremental' a input ()", "val block_length_smaller_than_max_input (a:hash_alg) :\n Lemma (block_length a `less_than_max_input_length` a)\nlet block_length_smaller_than_max_input (a:hash_alg) =\n normalize_term_spec(pow2 61 - 1);\n normalize_term_spec(pow2 125 - 1);\n normalize_term_spec(pow2 64 - 1)", "val mk_len_t (a: sha2_alg) (len: len_lt_max_a_t a) : len_t a\nlet mk_len_t (a:sha2_alg) (len:len_lt_max_a_t a) : len_t a =\n match a with\n | SHA2_224 | SHA2_256 ->\n (Math.Lemmas.pow2_lt_compat 64 61; uint #U64 #PUB len)\n | SHA2_384 | SHA2_512 ->\n (Math.Lemmas.pow2_lt_compat 128 125; uint #U128 #PUB len)", "val lemma_offset_sum (a_agg: nat) (a0 a1 a2 a3 a4: nat64) (b_agg: nat) (b0 b1 b2 b3 b4: nat64)\n : Lemma (requires a_agg = pow2_five a0 a1 a2 a3 a4 /\\ b_agg = pow2_five b0 b1 b2 b3 b4)\n (ensures a_agg + pow2_64 * b_agg = pow2_six a0 (a1 + b0) (a2 + b1) (a3 + b2) (a4 + b3) b4)\nlet lemma_offset_sum (a_agg:nat) (a0 a1 a2 a3 a4:nat64)\n (b_agg:nat) (b0 b1 b2 b3 b4:nat64)\n : Lemma\n (requires\n a_agg = pow2_five a0 a1 a2 a3 a4 /\\\n b_agg = pow2_five b0 b1 b2 b3 b4)\n (ensures\n a_agg + pow2_64 * b_agg =\n pow2_six a0 (a1 + b0) (a2 + b1) (a3 + b2) (a4 + b3) b4)\n = let lhs = a_agg + pow2_64 * b_agg in\n let rhs = pow2_six a0 (a1 + b0) (a2 + b1) (a3 + b2) (a4 + b3) b4 in\n assert_by_tactic (lhs == rhs) int_canon", "val nat_from_bytes_le_eq_lemma_: len:size_nat{len < 16} -> b:lseq uint8 len -> Lemma\n (let tmp = create 16 (u8 0) in\n nat_from_intseq_le b == nat_from_intseq_le (update_sub tmp 0 len b))\nlet nat_from_bytes_le_eq_lemma_ len b =\n let tmp = create 16 (u8 0) in\n let r = update_sub tmp 0 len b in\n assert (Seq.slice r 0 len == b);\n assert (forall (i:nat). len <= i /\\ i < 16 ==> r.[i] == u8 0);\n assert (forall (i:nat). i < 16 - len ==> Seq.index (Seq.slice r len 16) i == u8 0);\n nat_from_intseq_le_slice_lemma #U8 #SEC #16 r len;\n assert (nat_from_intseq_le r == nat_from_intseq_le (Seq.slice r 0 len) + pow2 (len * 8) * nat_from_intseq_le (Seq.slice r len 16));\n assert (nat_from_intseq_le r == nat_from_intseq_le b + pow2 (len * 8) * nat_from_intseq_le (Seq.slice r len 16));\n lemma_nat_from_bytes_le_zeroes (16 - len) (Seq.slice r len 16)", "val part1:\n a: fixed_len_alg ->\n m : D.m_spec a ->\n init: D.init_st (|a, m|) ->\n update_multi: D.update_multi_st (|a, m|) ->\n update_last: D.update_last_st (|a, m|) ->\n finish: D.finish_st (|a, m|) ->\n s: D.state (|a, m|) ->\n key: B.buffer uint8 { B.length key = block_length a } ->\n data: B.buffer uint8 ->\n len: UInt32.t { B.length data = v len } ->\n Stack unit\n (requires fun h0 ->\n B.disjoint s key /\\\n B.disjoint s data /\\\n MB.(all_live h0 [ buf s; buf key; buf data ]) /\\\n D.as_seq h0 s == Spec.Agile.Hash.init a\n )\n (ensures fun h0 _ h1 ->\n key_and_data_fits a;\n B.(modifies (loc_union (loc_buffer s) (loc_buffer key)) h0 h1) /\\\n S.slice (B.as_seq h1 key) 0 (hash_length a) `Seq.equal`\n Spec.Agile.Hash.hash a (S.append (B.as_seq h0 key) (B.as_seq h0 data)))\nlet part1 a m init update_multi update_last finish s key data len =\n let dst = B.sub key 0ul (D.hash_len a) in\n part2 a m init update_multi update_last finish s dst key data len", "val lemma_felem64_mod255: a:lseq uint64 4 ->\n Lemma (let r = a.[3] <- (a.[3] &. u64 0x7fffffffffffffff) in\n BSeq.nat_from_intseq_le r == BSeq.nat_from_intseq_le a % pow2 255)\nlet lemma_felem64_mod255 a =\n lemma_carry_pass_store_f3 a;\n let a3' = a.[3] &. u64 0x7fffffffffffffff in\n assert (v a3' = v a.[3] % pow2 63);\n\n let r = a.[3] <- a3' in\n SD.bn_upd_eval a a3' 3;\n assert (SD.bn_v r == SD.bn_v a - v a.[3] * pow2 192 + v a3' * pow2 192);\n\n calc (==) { //SD.bn_v a == SD.bn_v r + v a.[3] * pow2 192 - v a3' * pow2 192\n SD.bn_v r + v a.[3] * pow2 192 - v a3' * pow2 192;\n (==) { }\n SD.bn_v r + v a.[3] * pow2 192 - v a.[3] % pow2 63 * pow2 192;\n (==) { Math.Lemmas.distributivity_sub_left (v a.[3]) (v a.[3] % pow2 63) (pow2 192) }\n SD.bn_v r + (v a.[3] - v a.[3] % pow2 63) * pow2 192;\n (==) { Math.Lemmas.euclidean_division_definition (v a.[3]) (pow2 63) }\n SD.bn_v r + v a.[3] / pow2 63 * pow2 63 * pow2 192;\n (==) { Math.Lemmas.paren_mul_right (v a.[3] / pow2 63) (pow2 63) (pow2 192); Math.Lemmas.pow2_plus 63 192 }\n SD.bn_v r + v a.[3] / pow2 63 * pow2 255;\n };\n\n Math.Lemmas.modulo_addition_lemma (SD.bn_v r) (pow2 255) (v a.[3] / pow2 63);\n assert (SD.bn_v a % pow2 255 == SD.bn_v r % pow2 255);\n Math.Lemmas.small_mod (SD.bn_v r) (pow2 255);\n\n Hacl.Spec.Bignum.Convert.bn_v_is_nat_from_intseq_le_lemma 4 r;\n Hacl.Spec.Bignum.Convert.bn_v_is_nat_from_intseq_le_lemma 4 a;\n assert (BSeq.nat_from_intseq_le r == BSeq.nat_from_intseq_le a % pow2 255)", "val update_224_256: st:words_state SHA2_256 ->\n block:bytes{Seq.length block = block_length SHA2_256} ->\n Lemma\n (ensures (Spec.Agile.Hash.(update SHA2_256 st block == update SHA2_224 st block)))\nlet update_224_256 hash block =\n assert_norm (words_state SHA2_224 == words_state SHA2_256);\n let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):\n Lemma\n (ensures (ws SHA2_224 b t == ws SHA2_256 b t))\n [ SMTPat (ws SHA2_256 b t) ]\n =\n reveal_opaque (`%ws) ws;\n assert_norm (block_w SHA2_256 == block_w SHA2_224);\n assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);\n\n (*\n * The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)\n *\n * This is a bit suboptimal, since assert_norm is a heavy hammer,\n * it also ends up unfolding `==`, which means the equality is not\n * reduced in F*, rather the query for proving equality of two\n * lambda terms reaches Z3 -- once that happens we are at the mercy of\n * hashconsing etc. to prove the equality\n *\n * Instead, if we do controlled normalization, we can prove the equality\n * within F*\n *)\n\n let steps = [iota; primops; simplify; delta_only [\n `%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;\n `%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;\n `%__proj__Mkops__item__e4;\n `%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;\n `%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in\n\n assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));\n assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));\n\n norm_spec steps (_sigma0 SHA2_256);\n norm_spec steps (_sigma0 SHA2_224);\n norm_spec steps (_sigma1 SHA2_256);\n norm_spec steps (_sigma1 SHA2_224);\n\n // assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);\n if t < block_word_length SHA2_256 then\n ()\n else begin\n ws_224_256 b (t - 16);\n ws_224_256 b (t - 15);\n ws_224_256 b (t - 7);\n ws_224_256 b (t - 2)\n end\n in\n let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):\n Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))\n [ SMTPat (shuffle_core SHA2_256 block hash t) ]\n =\n reveal_opaque (`%shuffle_core) shuffle_core\n in\n let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):\n Lemma\n (requires (forall x (i: nat { i < max }). {:pattern f x i \\/ g x i } f x i == g x i))\n (ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))\n (decreases (max - min))\n [ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]\n =\n if min = max then\n ()\n else\n repeat_range_f (min + 1) max f g (f x min)\n in\n let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):\n Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))\n [ SMTPat (shuffle SHA2_256 hash block) ]\n =\n shuffle_is_shuffle_pre SHA2_224 hash block;\n shuffle_is_shuffle_pre SHA2_256 hash block;\n reveal_opaque (`%shuffle) shuffle;\n assert_norm (words_state SHA2_224 == words_state SHA2_256)\n in\n let rec seq_map2_f\n (#a:Type) (#b:Type) (#c:Type)\n (f g:(a -> b -> Tot c))\n (s:S.seq a) (s':S.seq b{S.length s = S.length s'}):\n Lemma\n (requires (forall x y. {:pattern f x y \\/ g x y} f x y == g x y))\n (ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))\n (decreases (S.length s))\n [ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]\n =\n if S.length s = 0 then\n ()\n else\n seq_map2_f f g (S.tail s) (S.tail s')\n in\n assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));\n reveal_opaque (`%shuffle) shuffle;\n reveal_opaque (`%update) update", "val sha3_is_incremental2 (a: keccak_alg) (input: bytes) (out_length: output_length a)\n : Lemma\n ((hash' a input out_length)\n `S.equal`\n (let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length))\nlet sha3_is_incremental2\n (a: keccak_alg)\n (input: bytes) (out_length: output_length a): Lemma (hash' a input out_length `S.equal` (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length))\n= let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let nb = S.length input / block_length a in\n let s = Lib.Sequence.create 25 (u64 0) in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n assert (S.length bs / block_length a == nb);\n let f = Spec.SHA3.absorb_inner rateInBytes in\n calc (==) {\n hash' a input out_length;\n (==) { } (\n let s = Spec.SHA3.absorb s rateInBytes (S.length input) input delimitedSuffix in\n Spec.SHA3.squeeze s rateInBytes (hash_length' a out_length)\n );\n (==) { Lib.Sequence.lemma_repeat_blocks (block_length a) input f (Spec.SHA3.absorb_last delimitedSuffix rateInBytes) s } (\n let s = Loops.repeati #(words_state a) nb (Lib.Sequence.repeat_blocks_f (block_length a) input f nb) s in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n Spec.SHA3.squeeze s rateInBytes (hash_length' a out_length));\n (==) {\n Lib.Sequence.Lemmas.repeati_extensionality #(words_state a) nb\n (Lib.Sequence.repeat_blocks_f (block_length a) input f nb)\n (Lib.Sequence.repeat_blocks_f (block_length a) bs f nb)\n s\n } (\n let s = Loops.repeati #(words_state a) nb (Lib.Sequence.repeat_blocks_f (block_length a) bs f nb) s in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n Spec.SHA3.squeeze s rateInBytes (hash_length' a out_length));\n (==) { Lib.Sequence.lemma_repeat_blocks_multi #_ #(words_state a) (block_length a) bs f s } (\n let s = Lib.Sequence.repeat_blocks_multi #_ #(words_state a) (block_length a) bs f s in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n Spec.SHA3.squeeze s rateInBytes (hash_length' a out_length));\n }", "val lemma_b_pow2_256_plus_a_modq_lseq: len:size_nat{4 <= len} -> a:lseq uint64 len ->\n Lemma (SD.bn_v a % S.q == (SD.bn_v (sub a 4 (len - 4)) * (pow2 256 - S.q) + SD.bn_v (sub a 0 4)) % S.q)\nlet lemma_b_pow2_256_plus_a_modq_lseq len a =\n lemma_b_pow2_256_plus_a_modq (SD.bn_v (sub a 0 4)) (SD.bn_v (sub a 4 (len - 4)));\n SD.bn_eval_split_i a 4", "val lemma_i2b_shr (#n:pos) (a:uint_t n) (b:uint_t n) : Lemma\n (b_i2b #n (shift_right #n a b) == b_shr #n (b_i2b a) b)\nlet lemma_i2b_shr #n a b =\n int2bv_shr #n #a #b #(bvshr #n (int2bv #n a) b) ();\n assert_norm (b_i2b #n (shift_right #n a b) == b_shr #n (b_i2b a) b)", "val update_block_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len\n -> i:nat{i < len / block_length a}\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma\n ((state_spec_v (update_block len b i st)).[l] ==\n Spec.update_block a len b.(|l|) i (state_spec_v st).[l])\nlet update_block_lemma_l #a #m len b i st l =\n let mb = get_multiblock_spec len b i in\n update_lemma_l mb st l", "val lemma_spec_update_384_512 (b st: _)\n : Lemma (ensures Hacl.Spec.SHA2.update SHA2_512 b st == Hacl.Spec.SHA2.update SHA2_384 b st)\nlet lemma_spec_update_384_512 b st: Lemma (ensures\n Hacl.Spec.SHA2.update SHA2_512 b st ==\n Hacl.Spec.SHA2.update SHA2_384 b st)\n=\n calc (==) {\n Hacl.Spec.SHA2.update SHA2_512 b st;\n (==) { Hacl.Spec.SHA2.EquivScalar.update_lemma SHA2_512 b st }\n Spec.Agile.Hash.update SHA2_512 st b;\n (==) { Spec.SHA2.Lemmas.update_384_512 st b }\n Spec.Agile.Hash.update SHA2_384 st b;\n (==) { Hacl.Spec.SHA2.EquivScalar.update_lemma SHA2_384 b st }\n Hacl.Spec.SHA2.update SHA2_384 b st;\n }", "val lemma_spec_equivalence_update:\n a:alg\n -> kk:size_nat{kk <= max_key a}\n -> k:lbytes kk\n -> d:bytes{if kk = 0 then length d <= max_limb a else length d + (size_block a) <= max_limb a}\n -> s:state a ->\n Lemma (blake2_update a kk k d s `Seq.equal` blake2_update' a kk k d s)\nlet lemma_spec_equivalence_update a kk k d s =\n let ll = length d in\n let key_block: bytes = if kk > 0 then blake2_key_block a kk k else Seq.empty in\n if kk = 0 then begin\n assert (key_block `Seq.equal` Seq.empty);\n assert ((key_block `Seq.append` d) `Seq.equal` d);\n ()\n end else if ll = 0 then\n let (nb,rem) = split a (length (blake2_key_block a kk k)) in\n // let s = repeati nb (blake2_update1 a prev (blake2_key_block a kk k)) s in\n calc (Seq.equal) {\n blake2_update a kk k d s;\n (Seq.equal) {}\n blake2_update_key a kk k ll s;\n (Seq.equal) {}\n blake2_update_block a true (size_block a) (blake2_key_block a kk k) s;\n (Seq.equal) { Lib.LoopCombinators.eq_repeati0 nb (blake2_update1 a 0 (blake2_key_block a kk k)) s }\n blake2_update_blocks a 0 (blake2_key_block a kk k) s;\n (Seq.equal) { Seq.append_empty_r (blake2_key_block a kk k) }\n blake2_update_blocks a 0 (blake2_key_block a kk k `Seq.append` Seq.empty) s;\n (Seq.equal) { Seq.lemma_empty d }\n blake2_update_blocks a 0 (blake2_key_block a kk k `Seq.append` d) s;\n (Seq.equal) { }\n blake2_update' a kk k d s;\n };\n ()\n else\n let (nb,rem) = split a (length (blake2_key_block a kk k `Seq.append` d)) in\n calc (Seq.equal) {\n blake2_update a kk k d s;\n (Seq.equal) {}\n blake2_update_blocks a (size_block a) d (blake2_update_key a kk k ll s);\n (Seq.equal) {}\n blake2_update_blocks a (size_block a) d (blake2_update_block a false (size_block a) (blake2_key_block a kk k) s);\n (Seq.equal) { lemma_unfold_update_blocks a (blake2_key_block a kk k) d s }\n blake2_update_blocks a 0 (blake2_key_block a kk k `Seq.append` d) s;\n }", "val lemma_spec_update_224_256 (b st: _)\n : Lemma (ensures Hacl.Spec.SHA2.update SHA2_256 b st == Hacl.Spec.SHA2.update SHA2_224 b st)\nlet lemma_spec_update_224_256 b st: Lemma (ensures\n Hacl.Spec.SHA2.update SHA2_256 b st ==\n Hacl.Spec.SHA2.update SHA2_224 b st)\n=\n calc (==) {\n Hacl.Spec.SHA2.update SHA2_256 b st;\n (==) { Hacl.Spec.SHA2.EquivScalar.update_lemma SHA2_256 b st }\n Spec.Agile.Hash.update SHA2_256 st b;\n (==) { Spec.SHA2.Lemmas.update_224_256 st b }\n Spec.Agile.Hash.update SHA2_224 st b;\n (==) { Hacl.Spec.SHA2.EquivScalar.update_lemma SHA2_224 b st }\n Hacl.Spec.SHA2.update SHA2_224 b st;\n }", "val Spec.Agile.HKDF.a_spec = a: Spec.Hash.Definitions.fixed_len_alg -> i: FStar.Integers.nat -> Type0\nlet a_spec (a:fixed_len_alg) (i:nat) =\n Seq.lseq uint8 (if i = 0 then 0 else hash_length a)", "val emit (#a: sha2_alg) (#m: m_spec) (hseq: lseq uint8 (lanes a m * 8 * word_length a))\n : multiseq (lanes a m) (hash_length a)\nlet emit (#a:sha2_alg) (#m:m_spec)\n (hseq:lseq uint8 (lanes a m * 8 * word_length a)):\n multiseq (lanes a m) (hash_length a) =\n Lib.NTuple.createi #(Seq.lseq uint8 (hash_length a)) (lanes a m)\n (fun i -> sub hseq (i * 8 * word_length a) (hash_length a))", "val blake2_hash_incremental_s :\n a : alg ->\n kk: size_nat{kk <= max_key a} ->\n k: lbytes kk ->\n input:S.seq uint8 { if kk = 0 then S.length input <= max_input_length a else S.length input + (Spec.size_block a) <= max_input_length a } ->\n output:S.seq uint8 { S.length output = output_size a }\nlet blake2_hash_incremental_s a kk k input0 =\n let key_block = if kk > 0 then Spec.blake2_key_block a kk k else S.empty in\n let key_block_len = S.length key_block in\n let input = Seq.append key_block input0 in\n assert (key_block_len = (if kk = 0 then 0 else Spec.size_block a));\n (**) Math.Lemmas.modulo_lemma 0 (U32.v (block_len a));\n let bs, l = Lib.UpdateMulti.split_at_last_lazy (U32.v (block_len a)) input in\n let acc1 = init_s a kk in\n let acc2 = update_multi_s #a acc1 0 bs in\n let acc3 = update_last_s #a acc2 (S.length bs) l in\n let acc4 = finish_s #a acc3 in\n acc4", "val hash_length (a: hash_alg{not (is_shake a)}) : Lib.IntTypes.(n: size_nat{n > 0})\nlet hash_length (a: hash_alg { not (is_shake a) }): Lib.IntTypes.(n:size_nat\u00a0{ n > 0 }) =\n let open FStar.Mul in\n if is_md a then\n word_length a * hash_word_length a\n else\n match a with\n | SHA3_224 -> 28\n | SHA3_256 -> 32\n | SHA3_384 -> 48\n | SHA3_512 -> 64\n | Blake2S -> 4 * 8\n | Blake2B -> 8 * 8", "val md_is_hash_incremental\n (a:hash_alg{is_md a})\n (input: bytes { S.length input `less_than_max_input_length` a })\n (s:words_state a)\n : Lemma (\n let blocks, rest = split_blocks a input in\n update_multi a s () (input `S.append` (pad a (S.length input))) ==\n update_last a (update_multi a s () blocks) (S.length blocks) rest)\nlet md_is_hash_incremental\n (a:hash_alg{is_md a})\n (input: bytes { S.length input `less_than_max_input_length` a })\n (s:words_state a)\n : Lemma (\n let blocks, rest = split_blocks a input in\n update_multi a s () (input `S.append` (pad a (S.length input))) ==\n update_last a (update_multi a s () blocks) (S.length blocks) rest)\n = let blocks, rest = split_blocks a input in\n assert (S.length input == S.length blocks + S.length rest);\n let padding = pad a (S.length input) in\n calc (==) {\n update_last a (update_multi a s () blocks) (S.length blocks) rest;\n (==) { }\n update_multi a (update_multi a s () blocks) () S.(rest @| padding);\n (==) { update_multi_associative a s blocks S.(rest @| padding) }\n update_multi a s () S.(blocks @| (rest @| padding));\n (==) { S.append_assoc blocks rest padding }\n update_multi a s () S.((blocks @| rest) @| padding);\n (==) { }\n update_multi a s () S.(input @| padding);\n }", "val emit (a: sha2_alg) (h: lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a))\nlet emit (a:sha2_alg) (h:lseq uint8 (8 * word_length a)) : Tot (lseq uint8 (hash_length a)) =\n sub h 0 (hash_length a)", "val nat_from_bytes_be_eq_lemma: len0:size_nat -> len:size_nat{len0 <= len} -> b:lseq uint8 len0 ->\n Lemma (let tmp = create len (u8 0) in\n nat_from_intseq_be b == nat_from_intseq_be (update_sub tmp (len - len0) len0 b))\nlet nat_from_bytes_be_eq_lemma len0 len b =\n let tmp = create len (u8 0) in\n let r = update_sub tmp (len - len0) len0 b in\n assert (slice r (len - len0) len == b);\n assert (forall (i:nat). i < len - len0 ==> r.[i] == u8 0);\n nat_from_intseq_be_slice_lemma #U8 #SEC #len r (len - len0);\n assert (nat_from_intseq_be r == nat_from_intseq_be (slice r (len - len0) len) + pow2 (len0 * 8) * nat_from_intseq_be (Seq.slice r 0 (len - len0)));\n assert (nat_from_intseq_be r == nat_from_intseq_be b + pow2 (len0 * 8) * nat_from_intseq_be (Seq.slice r 0 (len - len0)));\n lemma_nat_from_bytes_be_zeroes (len - len0) (Seq.slice r 0 (len - len0))", "val nat_from_bytes_le_eq_lemma: len:size_nat{len < 16} -> b:lseq uint8 len -> Lemma\n (let tmp = create 16 (u8 0) in\n nat_from_bytes_le b == nat_from_bytes_le (update_sub tmp 0 len b))\nlet nat_from_bytes_le_eq_lemma len b = nat_from_bytes_le_eq_lemma_ len b", "val Hacl.Hash.SHA3.spec_l = \n a: Spec.Hash.Definitions.keccak_alg ->\n len: Lib.IntTypes.size_nat{len < Spec.Hash.Definitions.block_length a} ->\n inp: Lib.Sequence.lseq Lib.IntTypes.uint8 len ->\n s: Lib.Sequence.lseq Lib.IntTypes.uint64 25\n -> Lib.Sequence.lseq (Lib.IntTypes.int_t Lib.IntTypes.U64 Lib.IntTypes.SEC) 25\nlet spec_l (a: keccak_alg)\n (len:size_nat{len < block_length a})\n (inp:Lib.Sequence.lseq uint8 len)\n (s:Lib.Sequence.lseq uint64 25) = s", "val max_input_size_len (a: hash_alg{is_md a})\n : Lemma (ensures FStar.Mul.(Some?.v (max_input_length a) * 8 + 8 = pow2 (len_length a * 8)))\nlet max_input_size_len (a: hash_alg{is_md a}): Lemma\n (ensures FStar.Mul.(Some ?.v (max_input_length a) * 8 + 8 = pow2 (len_length a * 8)))\n=\n let open FStar.Mul in\n assert_norm (Some?.v (max_input_length a) * 8 + 8 = pow2 (len_length a * 8))", "val generate_loop:\n a:supported_alg\n -> k:lbytes (hash_length a)\n -> max:nat\n -> i:nat{i < max}\n -> a_spec a i\n -> Pure (a_spec a (i + 1) & Lib.Sequence.lseq uint8 (hash_length a))\n (requires True)\n (ensures fun _ -> True)\nlet generate_loop a k max i vi =\n hmac_input_bound a;\n let v = hmac a k vi in v, v", "val lemma_sub_spec (#a: typ) (b: buffer a) (i len: UInt32.t) (h: HS.mem)\n : Lemma (requires (UInt32.v i + UInt32.v len <= length b /\\ live h b))\n (ensures\n (UInt32.v i + UInt32.v len <= length b /\\ live h (gsub b i len) /\\\n as_seq h (gsub b i len) == Seq.slice (as_seq h b) (UInt32.v i) (UInt32.v i + UInt32.v len)\n ))\n [SMTPatOr [[SMTPat (gsub b i len); SMTPat (live h b)]; [SMTPat (live h (gsub b i len))]]]\nlet lemma_sub_spec (#a:typ) (b:buffer a)\n (i:UInt32.t)\n (len:UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (\n UInt32.v i + UInt32.v len <= length b /\\\n live h b\n ))\n (ensures (\n UInt32.v i + UInt32.v len <= length b /\\\n live h (gsub b i len) /\\\n as_seq h (gsub b i len) == Seq.slice (as_seq h b) (UInt32.v i) (UInt32.v i + UInt32.v len)\n ))\n [SMTPatOr [\n [SMTPat (gsub b i len); SMTPat (live h b)];\n [SMTPat (live h (gsub b i len))]\n ]]\n = Seq.lemma_eq_intro (as_seq h (gsub b i len)) (Seq.slice (as_seq h b) (UInt32.v i) (UInt32.v i + UInt32.v len))", "val init_lemma_l: a:sha2_alg -> m:m_spec -> l:nat{l < lanes a m} ->\n Lemma ((state_spec_v (init a m)).[l] == Spec.init a)\nlet init_lemma_l a m l =\n eq_intro #(word a) #(state_word_length a)\n (state_spec_v (init a m)).[l] (Spec.init a)", "val emit8_spec\n (#a: sha2_alg)\n (#m: m_spec{lanes a m == 8})\n (hseq: LSeq.lseq uint8 (lanes a m * 8 * word_length a))\n : multiseq (lanes a m) (hash_length a)\nlet emit8_spec (#a:sha2_alg) (#m:m_spec{lanes a m == 8}) (hseq:LSeq.lseq uint8 (lanes a m * 8 * word_length a)) :\n multiseq (lanes a m) (hash_length a)\n =\n let open Lib.Sequence in\n let h0 = sub hseq 0 (hash_length a) in\n let h1 = sub hseq (8 * word_length a) (hash_length a) in\n let h2 = sub hseq (16 * word_length a) (hash_length a) in\n let h3 = sub hseq (24 * word_length a) (hash_length a) in\n let h4 = sub hseq (32 * word_length a) (hash_length a) in\n let h5 = sub hseq (40 * word_length a) (hash_length a) in\n let h6 = sub hseq (48 * word_length a) (hash_length a) in\n let h7 = sub hseq (56 * word_length a) (hash_length a) in\n let hsub : multiseq 8 (hash_length a) = ntup8 (h0,(h1,(h2,(h3,(h4,(h5,(h6,h7))))))) in\n hsub", "val nat_from_bytes_le_eq_lemma: len0:size_nat -> len:size_nat{len0 <= len} -> b:lseq uint8 len0 -> Lemma\n (let tmp = create len (u8 0) in\n nat_from_intseq_le b == nat_from_intseq_le (update_sub tmp 0 len0 b))\nlet nat_from_bytes_le_eq_lemma len0 len b =\n let tmp = create len (u8 0) in\n let r = update_sub tmp 0 len0 b in\n assert (slice r 0 len0 == b);\n assert (forall (i:nat). i < len - len0 ==> r.[len0 + i] == u8 0);\n nat_from_intseq_le_slice_lemma #U8 #SEC #len r len0;\n assert (nat_from_intseq_le r == nat_from_intseq_le (slice r 0 len0) + pow2 (len0 * 8) * nat_from_intseq_le (Seq.slice r len0 len));\n assert (nat_from_intseq_le r == nat_from_intseq_le b + pow2 (len0 * 8) * nat_from_intseq_le (Seq.slice r len0 len));\n lemma_nat_from_bytes_le_zeroes (len - len0) (Seq.slice r len0 len)", "val lemma_hash_to_bytes (s:seq quad32) : Lemma\n (requires length s == 2)\n (ensures make_ordered_hash s.[0] s.[1] == le_bytes_to_hash (le_seq_quad32_to_bytes s))\nlet lemma_hash_to_bytes (s:seq quad32) : Lemma\n (requires length s == 2)\n (ensures make_ordered_hash s.[0] s.[1] == le_bytes_to_hash (le_seq_quad32_to_bytes s))\n =\n lemma_le_bytes_to_hash_quads s;\n assert (equal (make_ordered_hash s.[0] s.[1]) (le_bytes_to_hash (le_seq_quad32_to_bytes s)));\n ()", "val lemma_hash_to_bytes (s:seq quad32) : Lemma\n (requires length s == 2)\n (ensures make_ordered_hash s.[0] s.[1] == le_bytes_to_hash (le_seq_quad32_to_bytes s))\nlet lemma_hash_to_bytes (s:seq quad32) : Lemma\n (requires length s == 2)\n (ensures make_ordered_hash s.[0] s.[1] == le_bytes_to_hash (le_seq_quad32_to_bytes s))\n =\n lemma_le_bytes_to_hash_quads s;\n assert (equal (make_ordered_hash s.[0] s.[1]) (le_bytes_to_hash (le_seq_quad32_to_bytes s)));\n ()", "val mod_lseq_lemma: a:lseq uint64 8 -> Lemma (SD.bn_v (mod_lseq a) == SD.bn_v a % S.q)\nlet mod_lseq_lemma a =\n let c0, r = mod_lseq_before_final a in\n mod_lseq_before_final_lemma a;\n assert ((v c0 * pow2 256 + SD.bn_v r) % S.q == SD.bn_v a % S.q);\n assert (v c0 * pow2 256 + SD.bn_v r < pow2 256 + pow2 133);\n\n let (t0,t1,t2,t3) = make_pow2_256_minus_order_k256 () in\n let tmp = create4 t0 t1 t2 t3 in\n qas_nat4_is_qas_nat tmp;\n assert (SD.bn_v tmp = pow2 256 - S.q);\n\n let c1, out = SB.bn_add r tmp in\n SB.bn_add_lemma r tmp;\n assert (v c1 * pow2 256 + SD.bn_v out = SD.bn_v r + pow2 256 - S.q);\n\n Math.Lemmas.small_mod (v c0 + v c1) (pow2 64);\n assert (v (c0 +. c1) == v c0 + v c1);\n let mask = u64 0 -. (c0 +. c1) in\n //let mask = u64 0 -. c1 in\n let res = map2 (BB.mask_select mask) out r in\n\n SD.bn_eval_bound r 4;\n SD.bn_eval_bound out 4;\n lemma_check_overflow (SD.bn_v r);\n lemma_get_carry_from_bn_add (SD.bn_v out) (v c1);\n assert (v c1 = (if SD.bn_v r < S.q then 0 else 1));\n\n if v c0 = 0 then begin\n assert (SD.bn_v r % S.q == SD.bn_v a % S.q);\n assert (res == mod_short_lseq r);\n mod_short_lseq_lemma r;\n assert (SD.bn_v res == SD.bn_v a % S.q) end\n else begin // v c0 = 1 ==> v c1 = 0\n assert ((pow2 256 + SD.bn_v r) % S.q == SD.bn_v a % S.q);\n assert (v c1 * pow2 256 + SD.bn_v out = SD.bn_v r + pow2 256 - S.q);\n assert (SD.bn_v r < pow2 133);\n assert_norm (pow2 256 - S.q < pow2 129);\n Math.Lemmas.pow2_lt_compat 133 129;\n Math.Lemmas.pow2_double_sum 133;\n assert (SD.bn_v r + pow2 256 - S.q < pow2 134);\n Math.Lemmas.pow2_lt_compat 256 134;\n carry_is_zero (v c1) 256 (SD.bn_v out) (SD.bn_v r + pow2 256 - S.q);\n assert (v c1 = 0);\n\n assert_norm (pow2 134 < S.q);\n assert (SD.bn_v r + pow2 256 - S.q < S.q);\n BB.lseq_mask_select_lemma out r mask;\n assert (SD.bn_v res == SD.bn_v r + pow2 256 - S.q);\n Math.Lemmas.lemma_mod_sub (pow2 256 + SD.bn_v r) S.q 1;\n assert (SD.bn_v res % S.q == SD.bn_v a % S.q);\n Math.Lemmas.small_mod (SD.bn_v res) S.q end", "val nat_from_intseq_be_slice_lemma: #t:inttype{unsigned t} -> #l:secrecy_level -> #len:size_nat\n -> b:lseq (uint_t t l) len -> i:nat{i <= len} ->\n Lemma (nat_from_intseq_be b == nat_from_intseq_be (slice b i len) + pow2 ((len - i) * bits t) * nat_from_intseq_be (slice b 0 i))\nlet nat_from_intseq_be_slice_lemma #t #l #len b i =\n nat_from_intseq_be_slice_lemma_ #t #l #len b i", "val hmac_input_bound: a:supported_alg -> Lemma\n ((hash_length a + pow2 32 + pow2 32\n + 1 + block_length a + block_length a) `less_than_max_input_length` a)\nlet hmac_input_bound = function\n | SHA1 ->\n let a = SHA1 in\n assert_norm ((hash_length a + pow2 32 + pow2 32 +1 + block_length a + block_length a) `less_than_max_input_length` a)\n | SHA2_256 ->\n let a = SHA2_256 in\n assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)\n | SHA2_384 ->\n let a = SHA2_384 in\n assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)\n | SHA2_512 ->\n let a = SHA2_512 in\n assert_norm ((hash_length a + pow2 32 + pow2 32 + 1 + block_length a + block_length a) `less_than_max_input_length` a)", "val Hacl.Hash.Definitions.hash_t = a: Spec.Hash.Definitions.fixed_len_alg -> Type0\nlet hash_t (a: fixed_len_alg) = b:B.buffer uint8 { B.length b = hash_length a }", "val lemma_le_bytes_to_seq_quad32_length (b: seq nat8)\n : Lemma (requires length b % 16 == 0)\n (ensures length (le_bytes_to_seq_quad32 b) == length b / 16)\nlet lemma_le_bytes_to_seq_quad32_length (b:seq nat8) : Lemma\n (requires length b % 16 == 0)\n (ensures length (le_bytes_to_seq_quad32 b) == length b / 16)\n =\n reveal_opaque (`%le_bytes_to_seq_quad32) le_bytes_to_seq_quad32;\n ()", "val lemma_nat_from_to_intseq_be_preserves_value: #t:inttype{unsigned t} -> #l:secrecy_level -> len:nat -> b:seq (uint_t t l){length b == len} ->\n Lemma (nat_to_intseq_be len (nat_from_intseq_be b) == b)\nlet lemma_nat_from_to_intseq_be_preserves_value #t #l len b =\n nat_from_intseq_be_inj (nat_to_intseq_be len (nat_from_intseq_be b)) b", "val sha3_is_incremental1\n (a: keccak_alg)\n (input: bytes) (out_length: output_length a): Lemma (hash_incremental a input out_length `S.equal` (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length))\nlet sha3_is_incremental1 a input out_length =\n calc (==) {\n hash_incremental a input out_length;\n (==) { }\n (let s = init a in\n let bs, l = split_blocks a input in\n let s = update_multi a s () bs in\n let s = update_last a s () l in\n finish a s out_length);\n (==) { }\n (let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a/8 in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n let s = update_multi a s () bs in\n let s = update_last a s () l in\n finish a s out_length);\n (==) { } (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_inner rateInBytes l s in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes 0 S.empty s in\n finish a s out_length\n else\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length\n );\n (==) { (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n let s = update_multi a s () bs in\n update_is_update_multi a l s\n else ()\n ) } (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n let s = update_multi a s () bs in\n let s = update_multi a s () l in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes 0 S.empty s in\n finish a s out_length\n else\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length\n );\n (==) { (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n Lib.Sequence.Lemmas.repeat_blocks_multi_split (block_length a) (S.length bs) (bs `S.append` l) (Spec.SHA3.absorb_inner rateInBytes) s\n else () ) } (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n let s = update_multi a s () (bs `S.append` l) in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes 0 S.empty s in\n finish a s out_length\n else\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length\n );\n };\n calc (S.equal) {\n (\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n if S.length l = rateInBytes then\n let s = update_multi a s () (bs `S.append` l) in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes 0 S.empty s in\n finish a s out_length\n else\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length\n );\n\n (S.equal) {\n let s = Lib.Sequence.create 25 (u64 0) in\n let rateInBytes = rate a / 8 in\n let bs, l = UpdateMulti.split_at_last_lazy rateInBytes input in\n let s = update_multi a s () bs in\n if S.length l = rateInBytes then begin\n let bs', l' = UpdateMulti.split_at_last rateInBytes input in\n // TODO: strengthen this... NL arith!\n assert (bs' `S.equal` (bs `S.append` l));\n assert (l' `S.equal` S.empty)\n end else\n ()\n } (\n let s = Lib.Sequence.create 25 (u64 0) in\n // Also the block size\n let rateInBytes = rate a / 8 in\n let delimitedSuffix = suffix a in\n let bs, l = UpdateMulti.split_at_last rateInBytes input in\n let s = update_multi a s () bs in\n let s = Spec.SHA3.absorb_last delimitedSuffix rateInBytes (S.length l) l s in\n finish a s out_length\n );\n }", "val u32_to_len (a: hash_alg{is_md a}) (l: U32.t) : l': len_t a {len_v a l' = U32.v l}\nlet u32_to_len (a: hash_alg{is_md a}) (l: U32.t): l':len_t a { len_v a l' = U32.v l } =\n match a with\n | SHA2_384 | SHA2_512 ->\n FStar.Int.Cast.Full.(uint64_to_uint128 (uint32_to_uint64 l))\n | _ -> FStar.Int.Cast.Full.uint32_to_uint64 l", "val nat_from_intseq_le_slice_lemma: #t:inttype{unsigned t} -> #l:secrecy_level -> #len:size_nat\n -> b:lseq (uint_t t l) len -> i:nat{i <= len} ->\n Lemma (nat_from_intseq_le b == nat_from_intseq_le (slice b 0 i) + pow2 (i * bits t) * nat_from_intseq_le (slice b i len))\nlet nat_from_intseq_le_slice_lemma #t #l #len b i =\n nat_from_intseq_le_slice_lemma_ b i", "val lemma_nat_from_to_intseq_le_preserves_value: #t:inttype{unsigned t} -> #l:secrecy_level -> len:nat -> b:seq (uint_t t l){length b == len} ->\n Lemma (nat_to_intseq_le len (nat_from_intseq_le b) == b)\nlet lemma_nat_from_to_intseq_le_preserves_value #t #l len b =\n nat_from_intseq_le_inj (nat_to_intseq_le len (nat_from_intseq_le b)) b", "val shuffle_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> ws:ws_spec a m\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma ((state_spec_v (shuffle ws st)).[l] ==\n Spec.shuffle a (ws_spec_v ws).[l] (state_spec_v st).[l])\nlet shuffle_lemma_l #a #m ws st l =\n shuffle_loop_lemma #a #m ws st l (Spec.num_rounds16 a)", "val lemma_i2b_add (#n:pos) (a b:uint_t n) : Lemma\n (b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b))\nlet lemma_i2b_add #n a b =\n int2bv_add #n #a #b #(bvadd #n (int2bv #n a) (int2bv #n b)) ();\n assert_norm (b_i2b #n (add_mod #n a b) == b_add #n (b_i2b a) (b_i2b b))", "val lemma_spec_update_nblocks_vec_384_512 (len: size_t) (b0 st0: _)\n : Lemma\n (ensures\n (Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n SpecVec.update_nblocks #SHA2_384 #M32 (v len) b0 st0 ==\n SpecVec.update_nblocks #SHA2_512 #M32 (v len) b0 st0))\nlet lemma_spec_update_nblocks_vec_384_512 (len:size_t) b0 st0 : Lemma (ensures (\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n SpecVec.update_nblocks #SHA2_384 #M32 (v len) b0 st0 ==\n SpecVec.update_nblocks #SHA2_512 #M32 (v len) b0 st0))\n = let open Lib.IntTypes in\n let open Lib.Sequence in\n let open Lib.MultiBuffer in\n Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t SHA2_512 len;\n let st1 = SpecVec.update_nblocks #SHA2_512 #M32 (v len) b0 st0 in\n let st0_m32 = (state_spec_v st0).[0] <: words_state SHA2_512 in\n let b0_m32' = Seq.slice b0.(|0|) 0 (Seq.length b0.(|0|) - Seq.length b0.(|0|) % block_length SHA2_512) in\n let st1_m32 = (state_spec_v st1).[0] <: words_state SHA2_512 in\n calc (==) {\n st1_m32;\n (==) {}\n (state_spec_v (SpecVec.update_nblocks #SHA2_512 (v len) b0 st0)).[0];\n (==) { Hacl.Spec.SHA2.Equiv.update_nblocks_lemma_l #SHA2_512 #M32 (v len) b0 st0 0 }\n Hacl.Spec.SHA2.update_nblocks SHA2_512 (v len) b0.(|0|) st0_m32;\n (==) { Hacl.Spec.SHA2.EquivScalar.update_nblocks_is_repeat_blocks_multi SHA2_512 (v len) b0.(|0|) st0_m32 }\n Lib.Sequence.repeat_blocks_multi (block_length SHA2_512) b0_m32' (Hacl.Spec.SHA2.update SHA2_512) st0_m32;\n (==) {\n FStar.Classical.forall_intro_2 lemma_spec_update_384_512;\n Lib.Sequence.Lemmas.repeat_blocks_multi_extensionality #uint8 #(words_state SHA2_512) (block_length SHA2_512) b0_m32'\n (Hacl.Spec.SHA2.update SHA2_512)\n (Hacl.Spec.SHA2.update SHA2_384)\n st0_m32\n }\n Lib.Sequence.repeat_blocks_multi #uint8 #(words_state SHA2_512) (block_length SHA2_512) b0_m32' (Hacl.Spec.SHA2.update SHA2_384) st0_m32;\n (==) { }\n Lib.Sequence.repeat_blocks_multi #uint8 #(words_state SHA2_384) (block_length SHA2_384) b0_m32' (Hacl.Spec.SHA2.update SHA2_384) (st0_m32 <: words_state SHA2_384);\n (==) { Hacl.Spec.SHA2.EquivScalar.update_nblocks_is_repeat_blocks_multi SHA2_384 (v len) b0.(|0|) st0_m32 }\n Hacl.Spec.SHA2.update_nblocks SHA2_384 (v len) b0.(|0|) st0_m32;\n (==) { Hacl.Spec.SHA2.Equiv.update_nblocks_lemma_l #SHA2_384 #M32 (v len) b0 st0 0 }\n (state_spec_v #SHA2_384 #M32 (SpecVec.update_nblocks #SHA2_384 (v len) b0 st0)).[0];\n };\n state_spec_v_extensionality SHA2_512\n (SpecVec.update_nblocks #SHA2_512 (v len) b0 st0)\n (SpecVec.update_nblocks #SHA2_384 #M32 (v len) b0 st0)" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.hash_agile_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.hash_agile_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.hash_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.hash_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.lemma_len_lt_max_a_fits_size_t" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.Incremental.fst", "name": "EverCrypt.Hash.Incremental.hash_len" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.Hash.fsti", "name": "Spec.Agile.Hash.hash" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.Incremental.fst", "name": "EverCrypt.Hash.Incremental.hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.len_lt_max_a_t" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Crypto.fst", "name": "QUIC.Spec.Crypto.lemma_hash_lengths" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.sha256" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.sha512" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.hash" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.emit1_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Incremental.fst", "name": "Spec.Hash.Incremental.hash_is_hash_incremental'" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.Hash.fst", "name": "Spec.Agile.Hash.hash'" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.sha384" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.emit8_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Keccak.fst", "name": "Hacl.Streaming.Keccak.hash_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_core_pre_create8_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.spec_is_incremental" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.lemma_max_hash_len" }, { "project_name": "everquic-crypto", "file_name": "Model.PNE.fsti", "name": "Model.PNE.lemma_max_hash_len" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.sha256" }, { "project_name": "hacl-star", "file_name": "Hacl.HKDF.fsti", "name": "Hacl.HKDF.hash_block_length_fits" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.emit4_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Generic.fst", "name": "Hacl.Impl.SHA2.Generic.mk_len_t_from_size_t" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.state_spec_v_extensionality" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.load_last_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.sha224" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Hashing.Spec.fst", "name": "MiTLS.Hashing.Spec.hash_len" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Alternative.fst", "name": "Spec.Blake2.Alternative.lemma_update1_shift" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.lemma_spec_update_last_vec_384_512" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.SHA2.fst", "name": "Hacl.Hash.SHA2.state_spec_v_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_last_224_256" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.sha512" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.sha256_4" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.RSAPSS.MGF.fst", "name": "Hacl.Impl.RSAPSS.MGF.hash" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.lemma_spec_update_last_vec_224_256" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.Incremental.fst", "name": "Spec.SHA3.Incremental.sha3_is_incremental" }, { "project_name": "hacl-star", "file_name": "EverCrypt.HKDF.fsti", "name": "EverCrypt.HKDF.hash_block_length_fits" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.HMAC.fsti", "name": "Spec.Agile.HMAC.keysized" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Incremental.fst", "name": "Spec.Blake2.Incremental.blake2_is_hash_incremental" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Alternative.fst", "name": "Spec.Blake2.Alternative.lemma_shift_update_last" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_last_384_512" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_shl" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_and" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.update_last_lemma_l" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash.fst", "name": "Vale.AES.GHash.lemma_hash_append" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.sha512_4" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.ws" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.SHA3.fst", "name": "Hacl.Hash.SHA3.hash_len" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fst", "name": "Vale.AES.GHash_BE.lemma_hash_append" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_384_512" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Incremental.fsti", "name": "Spec.Hash.Incremental.hash_is_hash_incremental" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Lemmas.fst", "name": "Spec.Hash.Lemmas.block_length_smaller_than_max_input" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.mk_len_t" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.FastMul_helpers.fst", "name": "Vale.Curve25519.FastMul_helpers.lemma_offset_sum" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Poly1305.Lemmas.fst", "name": "Hacl.Impl.Poly1305.Lemmas.nat_from_bytes_le_eq_lemma_" }, { "project_name": "hacl-star", "file_name": "Hacl.HMAC.fst", "name": "Hacl.HMAC.part1" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Field64.Lemmas.fst", "name": "Hacl.Spec.Curve25519.Field64.Lemmas.lemma_felem64_mod255" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_224_256" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.Incremental.fst", "name": "Spec.SHA3.Incremental.sha3_is_incremental2" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Scalar.Lemmas.fst", "name": "Hacl.Spec.K256.Scalar.Lemmas.lemma_b_pow2_256_plus_a_modq_lseq" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_shr" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.update_block_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.lemma_spec_update_384_512" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Alternative.fst", "name": "Spec.Blake2.Alternative.lemma_spec_equivalence_update" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.lemma_spec_update_224_256" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.HKDF.fst", "name": "Spec.Agile.HKDF.a_spec" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.emit" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Blake2.Common.fst", "name": "Hacl.Streaming.Blake2.Common.blake2_hash_incremental_s" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Definitions.fst", "name": "Spec.Hash.Definitions.hash_length" }, { "project_name": "hacl-star", "file_name": "Spec.MD.Incremental.fst", "name": "Spec.MD.Incremental.md_is_hash_incremental" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.emit" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Convert.fst", "name": "Hacl.Spec.Bignum.Convert.nat_from_bytes_be_eq_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Poly1305.Lemmas.fst", "name": "Hacl.Impl.Poly1305.Lemmas.nat_from_bytes_le_eq_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.SHA3.fst", "name": "Hacl.Hash.SHA3.spec_l" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.MD.fst", "name": "Spec.Hash.MD.max_input_size_len" }, { "project_name": "hacl-star", "file_name": "Spec.HMAC_DRBG.fst", "name": "Spec.HMAC_DRBG.generate_loop" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.lemma_sub_spec" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.init_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.emit8_spec" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Convert.fst", "name": "Hacl.Spec.Bignum.Convert.nat_from_bytes_le_eq_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_hash_to_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.lemma_hash_to_bytes" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Scalar.Lemmas.fst", "name": "Hacl.Spec.K256.Scalar.Lemmas.mod_lseq_lemma" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.nat_from_intseq_be_slice_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.HMAC_DRBG.fst", "name": "Spec.HMAC_DRBG.hmac_input_bound" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.Definitions.fst", "name": "Hacl.Hash.Definitions.hash_t" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_le_bytes_to_seq_quad32_length" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.lemma_nat_from_to_intseq_be_preserves_value" }, { "project_name": "hacl-star", "file_name": "Spec.SHA3.Incremental.fst", "name": "Spec.SHA3.Incremental.sha3_is_incremental1" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.MD.fst", "name": "Hacl.Hash.MD.u32_to_len" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.nat_from_intseq_le_slice_lemma" }, { "project_name": "hacl-star", "file_name": "Lib.ByteSequence.fst", "name": "Lib.ByteSequence.lemma_nat_from_to_intseq_le_preserves_value" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_lemma_l" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Bits.fst", "name": "Vale.Math.Bits.lemma_i2b_add" }, { "project_name": "hacl-star", "file_name": "Hacl.SHA2.Scalar32.Lemmas.fst", "name": "Hacl.SHA2.Scalar32.Lemmas.lemma_spec_update_nblocks_vec_384_512" } ], "selected_premises": [ "Hacl.Spec.SHA2.k0", "Spec.SHA2.k0", "Spec.Hash.MD.max_input_size_len", "Spec.SHA2._Sigma1", "Hacl.Spec.SHA2._Sigma1", "Hacl.Spec.SHA2._sigma1", "Spec.SHA2._sigma1", "Spec.SHA2.ws_pre_", "Hacl.Spec.SHA2._sigma0", "Spec.SHA2._sigma0", "Spec.Hash.Definitions.word_t", "Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks_multi", "Spec.SHA2._Sigma0", "Hacl.Spec.SHA2._Sigma0", "Hacl.Spec.SHA2.ws_next", "Spec.Hash.Definitions.hash_length", "Lib.Sequence.to_seq", "Hacl.Spec.SHA2.num_rounds16", "Spec.SHA2.op0", "Hacl.Spec.SHA2.op0", "Lib.Sequence.op_String_Access", "Lib.Sequence.length", "FStar.Mul.op_Star", "Lib.Sequence.op_String_Assignment", "Lib.IntTypes.uint_t", "FStar.UInt.size", "Lib.Sequence.lseq", "Spec.Hash.Definitions.word", "Lib.IntTypes.int_t", "Lib.IntTypes.bits", "Hacl.Spec.SHA2.EquivScalar.finish_lemma", "Lib.Sequence.slice", "Spec.Hash.Definitions.len_length", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.EquivScalar.update_multi_is_repeat_blocks_multi", "Hacl.Spec.SHA2.op_Plus_Dot", "Spec.SHA2.op_Plus_Dot", "Lib.IntTypes.range", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_j", "Hacl.Spec.SHA2.ws_next_inner", "Hacl.Spec.SHA2.EquivScalar.hash_is_repeat_blocks", "Hacl.Spec.SHA2.op_Hat_Dot", "Spec.SHA2.op_Hat_Dot", "Hacl.Spec.SHA2.EquivScalar.ws_pre_init_lemma", "Hacl.Spec.SHA2.EquivScalar.ws_next_lemma_k", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma", "Hacl.Spec.SHA2.to_word", "Spec.SHA2.to_word", "Hacl.Spec.SHA2.op_Amp_Dot", "Spec.SHA2.op_Amp_Dot", "Spec.SHA2.v'", "Hacl.Spec.SHA2.EquivScalar.lemma_len_lt_max_a_mul_by_8", "Spec.Hash.Definitions.words_state", "Hacl.Spec.SHA2.op_Tilde_Dot", "Spec.SHA2.op_Tilde_Dot", "FStar.Pervasives.reveal_opaque", "Hacl.Spec.SHA2._Ch", "Spec.SHA2._Ch", "Spec.SHA2.k_w", "Lib.Sequence.seq", "Hacl.Spec.SHA2.mk_len_t", "Hacl.Spec.SHA2.EquivScalar.ws_next_inner_lemma", "Spec.SHA2.counter", "Hacl.Spec.SHA2.size_k_w", "Spec.SHA2.size_k_w", "Lib.IntTypes.numbytes", "Lib.IntTypes.size", "Hacl.Spec.SHA2.EquivScalar.load_last_pad_lemma", "Lib.IntTypes.v", "Spec.SHA2.op_Greater_Greater_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Dot", "Spec.SHA2.Constants.k384_512", "Hacl.Spec.SHA2.emit", "Spec.SHA3.keccak", "Hacl.Spec.SHA2.EquivScalar.ws_pre_lemma", "Hacl.Spec.SHA2.EquivScalar.ws_pre_inductive", "Spec.Hash.Definitions.rate", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_init", "Lib.ByteSequence.nat_from_bytes_le", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_aux", "Hacl.Spec.SHA2.EquivScalar.shuffle_core_pre_lemma", "Hacl.Spec.SHA2.EquivScalar.ws_next_inductive", "Spec.Hash.Definitions.is_keccak", "Hacl.Spec.SHA2.EquivScalar.shuffle_lemma_i", "Spec.Agile.Hash.update_multi", "Hacl.Spec.SHA2.h0", "Spec.SHA2.h0", "Lib.IntTypes.uint_v", "Hacl.Spec.SHA2.EquivScalar.ws_next_lemma", "Spec.SHA2.ws0_pre_inner", "Lib.IntTypes.u64", "Spec.SHA2.Constants.k224_256", "Lib.IntTypes.uint", "Spec.SHA2._Maj", "Hacl.Spec.SHA2._Maj", "Lib.UpdateMulti.uint8", "Lib.UpdateMulti.Lemmas.uint8", "Lib.IntTypes.op_Plus_Bang", "Hacl.Spec.SHA2.EquivScalar.shuffle_lemma_i_step" ], "source_upto_this": "module Hacl.Spec.SHA2.EquivScalar\n\nopen FStar.Mul\nopen Lib.IntTypes\nopen Lib.Sequence\nopen Lib.LoopCombinators\n\nopen Spec.Hash.Definitions\nopen Hacl.Spec.SHA2\n\nmodule Spec = Spec.SHA2\nmodule LSeq = Lib.Sequence\nmodule BSeq = Lib.ByteSequence\nmodule UpdLemmas = Lib.UpdateMulti.Lemmas\nmodule LSeqLemmas = Lib.Sequence.Lemmas\nmodule Loops = Lib.LoopCombinators\n\nfriend Spec.SHA2\nfriend Spec.Agile.Hash\n\n#set-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\nval ws_next_inductive: a:sha2_alg -> ws0:k_w a -> k:nat{k <= 16} ->\n Pure (k_w a)\n (requires True)\n (ensures fun res ->\n res == Loops.repeati k (ws_next_inner a) ws0 /\\\n (forall (i:nat{i < k}). index res i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index res i == index (Loops.repeati (k - 1) (ws_next_inner a) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index res i == index ws0 i))\n\nlet ws_next_inductive a ws0 k =\n Loops.eq_repeati0 k (ws_next_inner a) ws0;\n repeati_inductive #(k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (ws_next_inner a) ws0 /\\\n (forall (i0:nat{i0 < i}). index wsi i0 == index (ws_next_inner a i0 (Loops.repeati i0 (ws_next_inner a) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). index wsi i0 == index (Loops.repeati (i - 1) (ws_next_inner a) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < 16}). index wsi i0 == index ws0 i0))\n (fun i wsi ->\n let ws = ws_next_inner a i wsi in\n Loops.unfold_repeati (i + 1) (ws_next_inner a) ws0 i;\n ws)\n ws0\n\n\nval ws_next_lemma: a:sha2_alg -> ws0:k_w a -> k:pos{k <= 16} -> Lemma\n (let wsk : k_w a = Loops.repeati k (ws_next_inner a) ws0 in\n let wsk1 : k_w a = Loops.repeati (k - 1) (ws_next_inner a) ws0 in\n (forall (i:nat{i < k}). index wsk i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index wsk i == index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index wsk i == index ws0 i))\n\nlet ws_next_lemma a ws0 k =\n let _ = ws_next_inductive a ws0 k in ()\n\n\nval ws_next_lemma_k: a:sha2_alg -> ws0:k_w a -> k:nat{k < 16} -> Lemma\n (let ws : k_w a = Loops.repeati 16 (ws_next_inner a) ws0 in\n let wsk : k_w a = Loops.repeati (k + 1) (ws_next_inner a) ws0 in\n Seq.index ws k == Seq.index wsk k)\n\nlet ws_next_lemma_k a ws0 k =\n ws_next_lemma a ws0 (k + 1);\n ws_next_lemma a ws0 16\n\n\nval ws_pre_inductive: a:sha2_alg -> block:Spec.block_w a -> k:nat{k <= Spec.size_k_w a} ->\n Pure (Spec.k_w a)\n (requires True)\n (ensures fun res ->\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n res == Loops.repeati k (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i:nat{i < k}).\n Seq.index res i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}).\n Seq.index res i == Seq.index (Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index res i == Seq.index ws0 i)))\n\nlet ws_pre_inductive a block k =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n Loops.eq_repeati0 k (Spec.ws_pre_inner a block) ws0;\n repeati_inductive #(Spec.k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i0:nat{i0 < i}).\n Seq.index wsi i0 ==\n Seq.index (Spec.ws_pre_inner a block i0 (Loops.repeati (i0 + 1) (Spec.ws_pre_inner a block) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). Seq.index wsi i0 == Seq.index (Loops.repeati (i - 1) (Spec.ws_pre_inner a block) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < Spec.size_k_w a}). Seq.index wsi i0 == Seq.index ws0 i0))\n (fun i wsi ->\n let ws = Spec.ws_pre_inner a block i wsi in\n Loops.unfold_repeati (i + 1) (Spec.ws_pre_inner a block) ws0 i;\n ws)\n ws0\n\n\nval ws_pre_lemma: a:sha2_alg -> block:Spec.block_w a -> k:pos{k <= Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let wsk : Spec.k_w a = Loops.repeati k (Spec.ws_pre_inner a block) ws0 in\n let wsk1 : Spec.k_w a = Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0 in\n (forall (i:nat{i < k}).\n Seq.index wsk i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). Seq.index wsk i == Seq.index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index wsk i == Seq.index ws0 i))\n\nlet ws_pre_lemma a block k =\n let _ = ws_pre_inductive a block k in ()\n\n\nval ws_pre_lemma_k: a:sha2_alg -> block:Spec.block_w a -> k:nat{k < Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let wsk : Spec.k_w a = Loops.repeati (k + 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.index wsk k == Seq.index ws k)\n\nlet ws_pre_lemma_k a block k =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma a block (Spec.size_k_w a)\n\n\nval ws_next_pre_lemma_j_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 j == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n1 j 16 == Seq.slice ws_n0 j 16))\n (ensures\n (let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j)))\n\nlet ws_next_pre_lemma_j_step a block i j ws1 ws_n1 =\n let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n\n let s0_n = _sigma0 a ws_n1.[(j+1) % 16] in\n let s1_n = _sigma1 a ws_n1.[(j+14) % 16] in\n //assert (Seq.index ws_n j == s1_n +. ws_n1.[(j+9) % 16] +. s0_n +. ws_n1.[j]);\n\n let s0 = _sigma0 a ws1.[16 * i + 16 + j - 15] in\n let s1 = _sigma1 a ws1.[16 * i + 16 + j - 2] in\n //assert (Seq.index ws (16 * i + 16 + j) == s1 +. ws1.[16 * i + 16 + j - 7] +. s0 +. ws1.[16 * i + 16 + j - 16]);\n\n let ws_n1_index (k:nat{k < 16}) :\n Lemma (if k < j then ws_n1.[k] == ws1.[16 * i + 16 + k] else ws_n1.[k] == ws1.[16 * i + k]) =\n if k < j then Seq.lemma_index_slice ws_n1 0 j k\n else Seq.lemma_index_slice ws_n1 j 16 (k - j) in\n\n ws_n1_index ((j + 1) % 16);\n assert (ws_n1.[(j + 1) % 16] == ws1.[16 * i + j + 1]);\n ws_n1_index ((j + 14) % 16);\n assert (ws_n1.[(j + 14) % 16] == ws1.[16 * i + j + 14]);\n ws_n1_index ((j + 9) % 16);\n assert (ws_n1.[(j + 9) % 16] == ws1.[16 * i + j + 9]);\n ws_n1_index j;\n assert (ws_n1.[j] == ws1.[16 * i + j])\n\n\nval ws_next_pre_lemma_aux:\n a:sha2_alg\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a\n -> ws:Spec.k_w a\n -> ws_n:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) /\\\n (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k) /\\\n (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k) /\\\n Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1) /\\\n (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k)))\n (ensures\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16))\n\nlet ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n =\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n\n let ws_n1_index1 (k:nat{k < j - 1}) : Lemma (Seq.index ws_n1 k == Seq.index ws1 (16 * i + 16 + k)) =\n Seq.lemma_index_slice ws_n1 0 (j - 1) k;\n Seq.lemma_index_slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) k in\n\n let ws_n_index1 (k:nat{k < j}) : Lemma (Seq.index ws_n k == Seq.index ws (16 * i + 16 + k)) =\n if k < j - 1 then ws_n1_index1 k else () in\n\n let ws_n_index2 (k:nat{j <= k /\\ k < 16}) : Lemma (Seq.index ws_n k == Seq.index ws_n0 k) =\n () in\n\n Classical.forall_intro ws_n_index1;\n Seq.lemma_eq_intro (Seq.slice ws_n 0 j) (Seq.slice ws (16 * i + 16) (16 * i + 16 + j));\n Classical.forall_intro ws_n_index2;\n Seq.lemma_eq_intro (Seq.slice ws_n j 16) (Seq.slice ws_n0 j 16)\n\n\nval ws_next_pre_lemma_init:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.slice ws1 (16 * i) (16 * i + 16) == Seq.slice ws (16 * i) (16 * i + 16))\n\nlet ws_next_pre_lemma_init a block i j =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n\n let s : Spec.block_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let s1 : Spec.block_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index s k == Seq.index s1 k) =\n ws_pre_lemma a block (16 * i + 16 + j);\n ws_pre_lemma a block (16 * i + 16 + j - 1) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro s s1\n\n\nval ws_next_pre_lemma_j:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j (ws_next_inner a) ws_n0 in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16)\n\nlet rec ws_next_pre_lemma_j a block i j =\n let ws_pre_f = Spec.ws_pre_inner a block in\n let ws_next_f = ws_next_inner a in\n\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) ws_pre_f ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j ws_next_f ws_n0 in\n\n if j = 0 then\n Loops.eq_repeati0 j ws_next_f ws_n0\n else begin\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) ws_pre_f ws0 in\n ws_next_pre_lemma_init a block i j;\n assert (Seq.slice ws1 (16 * i) (16 * i + 16) == ws_n0);\n let ws_n1 : k_w a = Loops.repeati (j - 1) ws_next_f ws_n0 in\n ws_next_pre_lemma_j a block i (j - 1);\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n assert (Seq.slice ws_n1 (j - 1) 16 == Seq.slice ws_n0 (j - 1) 16);\n\n ws_pre_lemma a block (16 * i + 16 + j);\n assert (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k);\n Loops.unfold_repeati (16 * i + 16 + j) ws_pre_f ws0 (16 * i + 16 + j - 1);\n //assert (ws == ws_pre_f (16 * i + 16 + j - 1) ws1);\n\n ws_next_lemma a ws_n0 j;\n assert (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k);\n assert (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k);\n Loops.unfold_repeati j ws_next_f ws_n0 (j - 1);\n //assert (ws_n == ws_next_f (j - 1) ws_n1);\n ws_next_pre_lemma_j_step a block i (j - 1) ws1 ws_n1;\n assert (Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1));\n ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n;\n () end\n\n\nval ws_next_pre_lemma:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16} -> Lemma\n (let ws : Spec.k_w a = Spec.ws_pre a block in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = ws_next a ws_n0 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j))\n\nlet ws_next_pre_lemma a block i j =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati 16 (ws_next_inner a) ws_n0 in\n\n let wsj : Spec.k_w a = Loops.repeati (16 * i + 16 + j + 1) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0j : k_w a = Seq.slice wsj (16 * i) (16 * i + 16) in\n let ws_nj : k_w a = Loops.repeati (j + 1) (ws_next_inner a) ws_n0 in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws_n0 k == Seq.index ws_n0j k) =\n ws_pre_lemma a block (16 * i + 16 + j + 1);\n ws_pre_lemma a block (Spec.size_k_w a) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro ws_n0 ws_n0j;\n\n ws_next_pre_lemma_j a block i (j + 1);\n assert (Seq.slice ws_nj 0 (j + 1) == Seq.slice wsj (16 * i + 16) (16 * i + 16 + j + 1));\n Seq.lemma_index_slice ws_nj 0 (j + 1) j;\n assert (Seq.index ws_nj j == Seq.index wsj (16 * i + 16 + j));\n\n ws_pre_lemma_k a block (16 * i + 16 + j);\n assert (Seq.index wsj (16 * i + 16 + j) == Seq.index ws (16 * i + 16 + j));\n\n ws_next_lemma_k a ws_n0 j;\n assert (Seq.index ws_nj j == Seq.index ws_n j)\n\n\nval shuffle_core_pre_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state a ->\n Lemma (shuffle_core_pre a k_t ws_t hash == Spec.shuffle_core_pre a k_t ws_t hash)\nlet shuffle_core_pre_lemma a k_t ws_t hash =\n reveal_opaque (`%Spec.shuffle_core_pre) Spec.shuffle_core_pre\n\n\nnoextract\nval shuffle_pre_inner: a:sha2_alg -> ws:Spec.k_w a -> i:nat{i < size_k_w a} -> st:words_state a -> words_state a\nlet shuffle_pre_inner a ws i st =\n let k = k0 a in\n shuffle_core_pre a k.[i] ws.[i] st\n\n\nval shuffle_spec_lemma: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 == Spec.shuffle a st0 block)\n\nlet shuffle_spec_lemma a st0 block =\n reveal_opaque (`%Spec.shuffle) Spec.shuffle;\n let ws = Spec.ws_pre a block in\n let k = Spec.k0 a in\n let aux (i:nat{i < Spec.size_k_w a}) (st:words_state a) :\n Lemma (shuffle_pre_inner a ws i st == Spec.shuffle_core_pre a k.[i] ws.[i] st) =\n let k = Spec.k0 a in\n shuffle_core_pre_lemma a k.[i] ws.[i] st in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality (Spec.size_k_w a)\n (shuffle_pre_inner a ws)\n (fun i h -> Spec.shuffle_core_pre a k.[i] ws.[i] h) st0\n\n\nnoextract\nval shuffle_pre_inner16:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> j:nat{j < 16}\n -> st:words_state a ->\n words_state a\n\nlet shuffle_pre_inner16 a ws i j st =\n let k = k0 a in\n shuffle_core_pre a k.[16 * i + j] ws.[16 * i + j] st\n\n\nnoextract\nval shuffle_pre_inner_num_rounds:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a ->\n words_state a\n\nlet shuffle_pre_inner_num_rounds a ws i st =\n Loops.repeati 16 (shuffle_pre_inner16 a ws i) st\n\n\nval shuffle_spec_lemma16_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a\n -> j:nat{j <= 16} ->\n Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati j (shuffle_pre_inner16 a ws i) st ==\n Loops.repeat_right (16 * i) (16 * i + j) (Loops.fixed_a (words_state a)) (shuffle_pre_inner a ws) st)\n\nlet rec shuffle_spec_lemma16_step a block i st j =\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n //let lp = Loops.repeati j (shuffle_pre_inner16 a ws i) st in\n //let rp = Loops.repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st in\n if j = 0 then begin\n Loops.eq_repeati0 j (shuffle_pre_inner16 a ws i) st;\n Loops.eq_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st end\n else begin\n //let lp1 = Loops.repeati (j - 1) (shuffle_pre_inner16 a ws i) st in\n //let rp1 = Loops.repeat_right (16 * i) (16 * i + j - 1) a_fixed (shuffle_pre_inner a ws) st in\n Loops.unfold_repeati j (shuffle_pre_inner16 a ws i) st (j - 1);\n Loops.unfold_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st (16 * i + j - 1);\n //assert (lp == shuffle_pre_inner16 a ws i (j - 1) lp1);\n //assert (rp == shuffle_pre_inner a ws (16 * i + j - 1) rp1);\n shuffle_spec_lemma16_step a block i st (j - 1);\n () end\n\n\nval shuffle_spec_lemma16: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 ==\n Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws) st0)\n\nlet shuffle_spec_lemma16 a st0 block =\n //w = 16, n = num_rounds16 a, normalize_v = id\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n let aux (i:nat{i < num_rounds16 a}) (st:words_state a) :\n Lemma (shuffle_pre_inner_num_rounds a ws i st ==\n Loops.repeat_right (16 * i) (16 * (i + 1)) a_fixed (shuffle_pre_inner a ws) st) =\n shuffle_spec_lemma16_step a block i st 16 in\n\n Classical.forall_intro_2 aux;\n Lib.Vec.Lemmas.lemma_repeati_vec 16 (num_rounds16 a) (fun x -> x)\n (shuffle_pre_inner a ws)\n (shuffle_pre_inner_num_rounds a ws)\n st0\n\n\nval ws_next_inner_lemma:\n a:sha2_alg\n -> block:k_w a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n\nlet ws_next_inner_lemma a block i ws1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n\n if i < num_rounds16 a - 1 then begin\n let aux (k:nat{k < 16}) : Lemma (Seq.index (ws_next a ws1) k == Seq.index ws_s (16 * (i + 1) + k)) =\n ws_next_pre_lemma a block i k in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (ws_next a ws1) (Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)) end\n else ()\n\n\nval shuffle_lemma_i_step:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a\n -> st1:words_state a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n\nlet shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s = Spec.ws_pre a block in\n let st_s = Loops.repeati 16 (shuffle_pre_inner16 a ws_s i) st1 in\n let st = Loops.repeati 16 (shuffle_inner a ws1 i) st1 in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n ws_next_inner_lemma a block i ws1;\n\n let aux_st (j:nat{j < 16}) (hash:words_state a) :\n Lemma (shuffle_pre_inner16 a ws_s i j hash == shuffle_inner a ws1 i j hash) =\n let k_t = Seq.index (k0 a) (16 * i + j) in\n let lp = shuffle_core_pre a k_t ws_s.[16 * i + j] st in\n let rp = shuffle_core_pre a k_t ws1.[j] hash in\n assert (ws1.[j] == ws_s.[16 * i + j]) in\n\n Classical.forall_intro_2 aux_st;\n LSeqLemmas.repeati_extensionality 16 (shuffle_pre_inner16 a ws_s i) (shuffle_inner a ws1 i) st1\n\n\nval ws_pre_init_lemma: a:sha2_alg -> block:k_w a -> Lemma\n (Seq.slice (Spec.ws_pre a block) 0 16 == block)\n\nlet ws_pre_init_lemma a block =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws k == Seq.index block k) =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma_k a block k in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice (Spec.ws_pre a block) 0 16) block\n\n\nval shuffle_lemma_i:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i <= num_rounds16 a} ->\n Lemma\n (let ws_s = Spec.ws_pre a block in\n let (ws, st) : tuple2 (k_w a) (words_state a) =\n Loops.repeati i (shuffle_inner_loop a) (block, st0) in\n st == Loops.repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a)))\n\nlet rec shuffle_lemma_i a block st0 i =\n let ws_s = Spec.ws_pre a block in\n let (ws, st) = Loops.repeati i (shuffle_inner_loop a) (block, st0) in\n let st_s = Loops.repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 in\n\n if i = 0 then begin\n Loops.eq_repeati0 i (shuffle_inner_loop a) (block, st0);\n Loops.eq_repeati0 i (shuffle_pre_inner_num_rounds a ws_s) st0;\n ws_pre_init_lemma a block;\n () end\n else begin\n let (ws1, st1) = Loops.repeati (i - 1) (shuffle_inner_loop a) (block, st0) in\n let st_s1 = Loops.repeati (i - 1) (shuffle_pre_inner_num_rounds a ws_s) st0 in\n Loops.unfold_repeati i (shuffle_inner_loop a) (block, st0) (i - 1);\n Loops.unfold_repeati i (shuffle_pre_inner_num_rounds a ws_s) st0 (i - 1);\n assert (st_s == shuffle_pre_inner_num_rounds a ws_s (i - 1) st_s1);\n assert ((ws, st) == shuffle_inner_loop a (i - 1) (ws1, st1));\n shuffle_lemma_i a block st0 (i - 1);\n //assert (st1 == st_s1);\n assert (st_s == shuffle_pre_inner_num_rounds a ws_s (i - 1) st1);\n shuffle_lemma_i_step a block st0 (i - 1) ws1 st1 end\n\n\nval shuffle_lemma: a:sha2_alg -> block:k_w a -> st0:words_state a ->\n Lemma (shuffle a block st0 == Spec.shuffle a st0 block)\nlet shuffle_lemma a block st0 =\n let ws_s = Spec.ws_pre a block in\n //let st_s = Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws_s) st0 in\n shuffle_spec_lemma a st0 block;\n shuffle_spec_lemma16 a st0 block;\n //assert (Spec.shuffle a st0 block == Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws_s) st0);\n //let (ws, st) = Loops.repeati (num_rounds16 a) (shuffle_inner_loop a) (block, st0) in\n shuffle_lemma_i a block st0 (num_rounds16 a)\n\n\nlet update_lemma a block hash' =\n let hash = hash' in\n reveal_opaque (`%Spec.update) Spec.update;\n let block_w = BSeq.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) block in\n assert (block_w == words_of_bytes a #(block_word_length a) block);\n let hash_1 = shuffle a block_w hash in\n shuffle_lemma a block_w hash;\n assert (hash_1 == Spec.shuffle a hash block_w);\n\n let res = map2 #_ #_ #_ #8 ( +. ) hash_1 hash in\n let res_comm = map2 #_ #_ #_ #8 ( +. ) hash hash_1 in\n let aux (i:nat{i < 8}) : Lemma (res.[i] == res_comm.[i]) =\n assert (index res i == hash_1.[i] +. hash.[i]);\n assert (index res_comm i == hash.[i] +. hash_1.[i]);\n assert (v #(word_t a) #SEC (hash_1.[i] +. hash.[i]) == v #(word_t a) #SEC (hash.[i] +. hash_1.[i]));\n assert (index res i == index res_comm i) in\n\n Classical.forall_intro aux;\n eq_intro res res_comm;\n eq_intro #_ #8 (update a block hash') (Spec.update_pre a hash' block)\n\n\nlet finish_lemma a st' =\n let st = st' in\n let hash_final_w = sub #_ #8 st 0 (hash_word_length a) in\n assert (Spec.Agile.Hash.finish a st' () == BSeq.uints_to_bytes_be #(word_t a) #SEC #(hash_word_length a) hash_final_w);\n assert (finish a st' == sub (BSeq.uints_to_bytes_be #(word_t a) #SEC #8 st) 0 (hash_length a));\n assert (hash_length a == word_length a * hash_word_length a);\n\n let aux (i:nat{i < hash_length a}) : Lemma ((finish a st').[i] == (Spec.Agile.Hash.finish a st' ()).[i]) =\n BSeq.index_uints_to_bytes_be #(word_t a) #SEC #(hash_word_length a) hash_final_w i;\n BSeq.index_uints_to_bytes_be #(word_t a) #SEC #8 st i in\n\n Classical.forall_intro aux;\n eq_intro #uint8 #(hash_length a) (finish a st') (Spec.Agile.Hash.finish a st' ())\n\n//TODO: move to Lib.Sequence.Lemmas\n\n\nval update_multi_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a\n -> pad_s:lseq uint8 (pad_length a len) ->\n Lemma\n (let blocks = Seq.append b pad_s in\n Spec.Agile.Hash.update_multi a st0 () blocks ==\n LSeq.repeat_blocks_multi (block_length a) blocks (update a) st0)\n\nlet update_multi_is_repeat_blocks_multi a len b st0 pad_s =\n let blocks = Seq.append b pad_s in\n assert ((pad_length a len + len) % block_length a = 0);\n\n let upd_last (st:words_state a) s = st in\n UpdLemmas.update_full_is_repeat_blocks #(words_state a) (block_length a)\n (Spec.Agile.Hash.update a) upd_last st0 blocks blocks;\n\n let repeat_f = UpdLemmas.repeat_f (block_length a) (Spec.Agile.Hash.update a) in\n let repeat_l = UpdLemmas.repeat_l (block_length a) upd_last blocks in\n //assert\n //(Spec.Agile.Hash.update_multi a st0 blocks ==\n // LSeq.repeat_blocks (block_length a) blocks repeat_f repeat_l st0);\n\n LSeqLemmas.lemma_repeat_blocks_via_multi (block_length a) blocks repeat_f repeat_l st0;\n // assert\n // (Spec.Agile.Hash.update_multi a st0 blocks ==\n // LSeq.repeat_blocks_multi (block_length a) blocks repeat_f st0);\n\n Classical.forall_intro_2 (update_lemma a);\n LSeqLemmas.repeat_blocks_multi_extensionality (block_length a) blocks repeat_f (update a) st0\n\nlet update_nblocks_is_repeat_blocks_multi a len b st0 =\n let bs = block_length a in\n let nb = len / bs in\n let b' = Seq.slice b 0 (Seq.length b - Seq.length b % block_length a) in\n let acc = Loops.repeati nb (repeat_blocks_f bs b' (update a) nb) st0 in\n\n let aux (i:nat{i < nb}) (acc:words_state a) :\n Lemma (repeat_blocks_f bs b' (update a) nb i acc == update_block a len b i acc) = () in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality nb (repeat_blocks_f bs b' (update a) nb) (update_block a len b) st0;\n assert (acc == update_nblocks a len b st0);\n\n LSeq.lemma_repeat_blocks_multi bs b' (update a) st0\n\n\nlet hash_is_repeat_blocks a len b st0 =\n let bs = block_length a in\n let nb = len / bs in\n let rem = len % bs in\n let acc = Loops.repeati nb (repeat_blocks_f bs b (update a) nb) st0 in\n\n let aux (i:nat{i < nb}) (acc:words_state a) :\n Lemma (repeat_blocks_f bs b (update a) nb i acc == update_block a len b i acc) = () in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality nb (repeat_blocks_f bs b (update a) nb) (update_block a len b) st0;\n assert (acc == update_nblocks a len b st0);\n\n let len' : len_t a = mk_len_t a len in\n LSeq.lemma_repeat_blocks bs b (update a) (update_last a len') st0;\n let last = Seq.slice b (nb * bs) len in\n assert (LSeq.repeat_blocks bs b (update a) (update_last a len') st0 == update_last a len' rem last acc)\n\n\nval append_pad_last_length_lemma: a:sha2_alg -> len:len_lt_max_a_t a ->\n Lemma\n (let blocksize = block_length a in\n let b_len = (blocksize - (len + len_length a + 1)) % blocksize + 1 + len_length a + len % blocksize in\n b_len = blocksize \\/ b_len = 2 * blocksize)\n\nlet append_pad_last_length_lemma a len =\n let blocksize = block_length a in\n let x = 1 + len_length a + len % blocksize in\n let b_len = (blocksize - (len + len_length a + 1)) % blocksize + 1 + len_length a + len % blocksize in\n Math.Lemmas.lemma_mod_sub_distr (blocksize - len_length a - 1) len blocksize;\n assert (b_len == (blocksize - x) % blocksize + x)\n //if x < blocksize then b_len = blocksize else b_len = 2 * blocksize\n\n#push-options \"--z3rlimit 200\"\nval load_last_lemma:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> totlen_seq:lseq uint8 (len_length a)\n -> len:size_nat { len <= block_length a /\\ len % block_length a == totlen % block_length a }\n -> b:bytes{length b = len} ->\n Lemma\n (let rem = len in\n let fin = padded_blocks a rem * block_length a in\n let last = create (2 * block_length a) (u8 0) in\n let last = update_sub last 0 rem b in\n let last = last.[rem] <- u8 0x80 in\n let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a totlen) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Seq.equal (Seq.slice last 0 fin) (Seq.append b pad))\n\nlet load_last_lemma a totlen totlen_seq len b =\n //last = b @| firstbyte @| zeros @| pad\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a totlen) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n assert (length pad == pad_length a totlen);\n append_pad_last_length_lemma a totlen;\n let rem = len in\n let fin = padded_blocks a rem * block_length a in\n calc (==) {\n pad0_length a len <: int;\n (==) { }\n (block_length a - (len + len_length a + 1)) % block_length a;\n (==) {\n FStar.Math.Lemmas.lemma_mod_sub_distr (block_length a) (len + len_length a + 1) (block_length a);\n FStar.Math.Lemmas.lemma_mod_add_distr (len_length a + 1) len (block_length a)\n }\n (block_length a - (len % block_length a + len_length a + 1) % block_length a) % block_length a;\n (==) { assert (len % block_length a == totlen % block_length a) }\n (block_length a - (totlen % block_length a + len_length a + 1) % block_length a) % block_length a;\n (==) {\n FStar.Math.Lemmas.lemma_mod_sub_distr (block_length a) (totlen + len_length a + 1) (block_length a);\n FStar.Math.Lemmas.lemma_mod_add_distr (len_length a + 1) totlen (block_length a)\n }\n (block_length a - (totlen + len_length a + 1)) % block_length a;\n (==) { }\n pad0_length a totlen;\n };\n assert (fin - len_length a == rem + 1 + pad0_length a totlen);\n\n let last = create (2 * block_length a) (u8 0) in\n let last1 = update_sub last 0 rem b in\n Seq.lemma_eq_intro (Seq.slice last1 0 rem) b;\n let aux (i:nat{i < pad0_length a totlen}) : Lemma (last1.[rem + 1 + i] == zeros.[i]) =\n assert (index last1 (rem + 1 + i) == index zeros i) in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice last1 (rem + 1) (fin - len_length a)) zeros;\n\n let last2 = last1.[rem] <- u8 0x80 in\n Seq.lemma_eq_intro (Seq.slice last2 0 rem) b;\n Seq.lemma_eq_intro (Seq.slice last2 rem (rem + 1)) firstbyte;\n Seq.lemma_eq_intro (Seq.slice last2 (rem + 1) (fin - len_length a)) zeros;\n\n let last3 = update_sub last2 (fin - len_length a) (len_length a) totlen_seq in\n Seq.lemma_eq_intro (Seq.slice last3 (fin - len_length a) fin) totlen_seq;\n\n let aux (i:nat{i < fin - len_length a}) : Lemma (last3.[i] == last2.[i]) =\n assert (index last3 i == index last2 i) in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (Seq.slice last3 0 (fin - len_length a)) (Seq.slice last2 0 (fin - len_length a));\n Seq.lemma_eq_intro (Seq.slice last3 0 rem) b;\n Seq.lemma_eq_intro (Seq.slice last3 rem (rem + 1)) firstbyte;\n Seq.lemma_eq_intro (Seq.slice last3 (rem + 1) (fin - len_length a)) zeros;\n\n Seq.lemma_eq_intro (Seq.slice last3 0 fin) (Seq.append b pad)\n\nval lemma_len_lt_max_a_mul_by_8: a:sha2_alg -> len:len_lt_max_a_t a ->\n Lemma (let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n v total_len_bits == len * 8)\n\nlet lemma_len_lt_max_a_mul_by_8 a len =\n match a with\n | SHA2_224 | SHA2_256 -> Math.Lemmas.pow2_plus 61 3\n | SHA2_384 | SHA2_512 -> Math.Lemmas.pow2_plus 125 3\n\n\nval load_last_pad_lemma:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> fin:nat{fin == block_length a \\/ fin == 2 * block_length a} ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a len) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Spec.Hash.MD.pad a len == pad)\n\nlet load_last_pad_lemma a len fin =\n let len' : len_t a = mk_len_t a len in\n let total_len_bits = secret (shift_left #(len_int_type a) len' 3ul) in\n lemma_len_lt_max_a_mul_by_8 a len;\n assert (v total_len_bits == len * 8);\n\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let firstbyte = create 1 (u8 0x80) in\n let zeros = create (pad0_length a len) (u8 0) in\n let pad = Seq.append (Seq.append firstbyte zeros) totlen_seq in\n Seq.lemma_eq_intro (Spec.Hash.MD.pad a len) pad\n\nval update_last_lemma:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> len: size_nat { len <= block_length a /\\ len % block_length a == totlen % block_length a }\n -> b:lseq uint8 len ->\n Lemma\n (let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let blocksize = block_length a in\n let rem = len in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n let last = create (2 * block_length a) (u8 0) in\n let last = update_sub last 0 rem b in\n let last = last.[rem] <- u8 0x80 in\n let last = update_sub last (fin - len_length a) (len_length a) totlen_seq in\n Seq.equal (Seq.slice last 0 fin) (Seq.append b (Spec.Hash.MD.pad a totlen)))\n\nlet update_last_lemma a totlen len b =\n let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let blocksize = block_length a in\n let rem = len in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n load_last_lemma a totlen totlen_seq len b;\n load_last_pad_lemma a totlen fin\n\nlet update_last_is_repeat_blocks_multi a totlen len last st1 =\n let pad_s = Spec.Hash.MD.pad a totlen in\n let blocksize = block_length a in\n let rem = len in\n let blocks1 = Seq.append last pad_s in\n let blocks = padded_blocks a rem in\n let fin = blocks * block_length a in\n\n append_pad_last_length_lemma a totlen;\n load_last_pad_lemma a totlen fin;\n assert (length blocks1 = blocksize \\/ length blocks1 = 2 * blocksize);\n assert (length blocks1 == padded_blocks a rem * blocksize);\n\n let nb = padded_blocks a rem in\n Math.Lemmas.cancel_mul_mod nb blocksize;\n let res = repeat_blocks_multi blocksize blocks1 (update a) st1 in\n LSeq.lemma_repeat_blocks_multi blocksize blocks1 (update a) st1;\n assert (res == Loops.repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1);\n\n let totlen' : len_t a = mk_len_t a totlen in\n let total_len_bits = secret (shift_left #(len_int_type a) totlen' 3ul) in\n let totlen_seq = BSeq.uint_to_bytes_be #(len_int_type a) total_len_bits in\n let (b0, b1) = load_last a totlen_seq fin rem last in\n let st2 = update a b0 st1 in\n Loops.unfold_repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1 0;\n Loops.eq_repeati0 nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1;\n update_last_lemma a totlen len last;\n assert (st2 == repeat_blocks_f blocksize blocks1 (update a) nb 0 st1);\n\n if nb = 2 then begin\n let st3 = update a b1 st2 in\n Loops.unfold_repeati nb (repeat_blocks_f blocksize blocks1 (update a) nb) st1 1;\n assert (st3 == repeat_blocks_f blocksize blocks1 (update a) nb 1 st2) end\n\n#push-options \"--z3rlimit 450\"\nval hash_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let pad_s = Spec.Hash.MD.pad a len in\n repeat_blocks (block_length a) b (update a) (update_last a len') st0 ==\n repeat_blocks_multi (block_length a) (Seq.append b pad_s) (update a) st0)\n\nlet hash_is_repeat_blocks_multi a len b st0 =\n let pad_s = Spec.Hash.MD.pad a len in\n let blocks = Seq.append b pad_s in\n let blocksize = block_length a in\n let nb = len / blocksize in\n let rem = len % blocksize in\n let len0 = nb * blocksize in\n Math.Lemmas.cancel_mul_mod nb blocksize;\n\n let res = repeat_blocks_multi blocksize blocks (update a) st0 in\n let blocks1 = Seq.slice blocks len0 (length blocks) in\n let blocks0 = Seq.slice blocks 0 len0 in\n let st1 = repeat_blocks_multi blocksize blocks0 (update a) st0 in\n LSeqLemmas.split_len_lemma0 blocksize (length blocks / blocksize) len0;\n LSeqLemmas.repeat_blocks_multi_split blocksize len0 blocks (update a) st0;\n //assert (res == repeat_blocks_multi blocksize blocks1 (update a) st1);\n\n let len' : len_t a = mk_len_t a len in\n LSeqLemmas.lemma_repeat_blocks_via_multi blocksize b (update a) (update_last a len') st0;\n Seq.lemma_eq_intro (Seq.slice b 0 len0) blocks0;\n let last = Seq.slice b len0 len in\n //assert (repeat_blocks blocksize b (update a) (update_last a len') st0 == update_last a len' rem last st1);\n Seq.lemma_eq_intro blocks1 (Seq.append last pad_s);\n\n // Stabilizing nl arithmetic:\n // By def of pad_length\n assert ((pad_length a len + len) % blocksize == 0);\n // We derive the precondition of update_last_is_repeat_blocks_multi\n Math.Lemmas.lemma_mod_add_distr (pad_length a len) len blocksize;\n assert ((pad_length a len + len % blocksize) % blocksize = 0);\n update_last_is_repeat_blocks_multi a len rem last st1\n#pop-options\n\n", "sketch": [ "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input length and byte sequence. We will use the properties and lemmas established in the previous proofs to show that the two functions produce the same result.", "Step 1: We will first prove that the `hash` function applied to a message `b` of length `len` is equal to the `Spec.Agile.Hash.hash` function applied to the same message `b` for a given SHA-2 algorithm `a`.", "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input `b` of length `len`. This will involve showing that the `hash` function produces the same output as the `Spec.Agile.Hash.hash` function for the given input.\n\nStep 2: We will then proceed to write the F* code to complete the proof by showing that the `hash` function is indeed equivalent to the `Spec.Agile.Hash.hash` function for the given input `b` of length `len`.", "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input length and byte sequence. We will use the properties of the `hash` function and the `Spec.Agile.Hash.hash` function to establish this equivalence.\n\nStep 2: We will then use the properties of the `hash` function and the `Spec.Agile.Hash.hash` function to show that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input length and byte sequence.", "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input `b` of length `len`. We will use the `update_multi_is_repeat_blocks_multi` lemma to show that the `hash` function is equivalent to the repeated application of the `update` function on the input `b`.", "Step 1: We will first prove that the `hash` function in F* is equivalent to the `Spec.Agile.Hash.hash` function for the given input length `len` and byte sequence `b`.", "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input length and byte sequence. We will use the properties and lemmas established in the previous code to show that the `hash` function produces the same result as the `Spec.Agile.Hash.hash` function.", "Step 1: We will first prove that the `hash` function is equivalent to `Spec.Agile.Hash.hash` for the given input length and byte sequence. We will use the properties and lemmas established in the previous proofs to show that the `hash` function behaves exactly as expected according to the specification.", "Step 1: We will first prove that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function for the given input `b` of length `len`.\nStep 2: We will use the lemmas `update_multi_is_repeat_blocks_multi` and `hash_is_repeat_blocks_multi` to show that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function.\nStep 3: We will use the `update_lemma` to show that the `hash` function is equivalent to the `Spec.Agile.Hash.hash` function.", "Step 1: We will first show that the `hash` function applied to the input `b` is equivalent to the `Spec.Agile.Hash.hash` function applied to the same input `b`.\nStep 2: We will use the `update_multi_is_repeat_blocks_multi` lemma to show that the `hash` function applied to the input `b` is equivalent to the `Spec.Agile.Hash.hash` function applied to the same input `b`. This lemma establishes the equivalence between the `update_multi` function and the `LSeq.repeat_blocks_multi` function.\nStep 3: We will use the `update_nblocks_is_repeat_blocks_multi` lemma to show that the `hash` function applied to the input `b` is equivalent to the `Spec.Agile.Hash.hash` function applied to the same input `b`. This lemma establishes the equivalence between the `update_nblocks` function and the `LSeq.repeat_blocks_multi` function.\nStep 4: We will use the `hash_is_repeat_blocks` lemma to show that the `hash` function applied to the input `b` is equivalent to the `Spec.Agile.Hash.hash` function applied to the same input `b`. This lemma establishes the equivalence between the `repeat_blocks` function and the `Spec.Agile.Hash.hash` function.\nStep 5: We will use the `hash_is_repeat_blocks_multi` lemma to show that the `hash` function applied to the input `b` is equivalent to the `Spec.Agile.Hash.hash` function applied to the same input `b`. This lemma establishes the equivalence between the `repeat_blocks_multi` function and the `Spec.Agile.Hash.hash` function." ], "generated_solution": [ "let hash_agile_lemma a len b =\n // Use the properties and lemmas established in the previous proofs to show that hash a len b == Spec.Agile.Hash.hash a b\n // Your F* code here. You should only generate the completion of the proof. Do not include the lemma definition.", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "val hash_agile_lemma a len b =\n (* Your F* code here. You should only generate the completion of the proof. Do not include the lemma definition. *)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)\nlet hash_agile_lemma a len b =\n update_multi_is_repeat_blocks_multi a len b", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)\nproof\n // Step 1\n assert (hash a len b == Spec.Agile.Hash.hash a b);\n // Step 2\n update_multi_is_repeat_blocks_multi a len b st0 pad_s;\n hash_is_repeat_blocks_multi a len b st0;\n // Step 3\n update_lemma a b hash';\n // Additional steps if needed\n // ...\n ()", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)" ] }, { "file_name": "Hacl.Spec.Ed25519.PrecompTable.fsti", "name": "Hacl.Spec.Ed25519.PrecompTable.point_inv_list", "opens_and_abbrevs": [ { "abbrev": "FL", "full_module": "FStar.List.Tot" }, { "abbrev": "SC", "full_module": "Spec.Curve25519" }, { "abbrev": "S", "full_module": "Spec.Ed25519" }, { "abbrev": "SF51", "full_module": "Hacl.Spec.Curve25519.Field51.Definition" }, { "abbrev": "F51", "full_module": "Hacl.Impl.Ed25519.Field51" }, { "open": "Lib.Sequence" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl.Spec.Ed25519" }, { "open": "Hacl.Spec.Ed25519" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "", "source_definition": "let point_inv_list (p:point_list) =\n let x = Seq.seq_of_list p <: lseq uint64 20 in\n //F51.inv_ext_point x\n F51.linv x", "source_range": { "start_line": 72, "start_col": 0, "end_line": 75, "end_col": 12 }, "interleaved": false, "definition": "fun p ->\n let x = FStar.Seq.Base.seq_of_list p <: Lib.Sequence.lseq Lib.IntTypes.uint64 20 in\n Hacl.Impl.Ed25519.Field51.linv x", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Hacl.Spec.Ed25519.PrecompTable.point_list", "Hacl.Impl.Ed25519.Field51.linv", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Lib.IntTypes.U64", "Lib.IntTypes.SEC", "FStar.Seq.Base.seq_of_list", "Lib.IntTypes.uint64" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0", "prompt": "let point_inv_list (p: point_list) =\n ", "expected_response": "let x = Seq.seq_of_list p <: lseq uint64 20 in\nF51.linv x", "source": { "project_name": "hacl-star", "file_name": "code/ed25519/Hacl.Spec.Ed25519.PrecompTable.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.Spec.Ed25519.PrecompTable.fsti", "checked_file": "dataset/Hacl.Spec.Ed25519.PrecompTable.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Spec.Ed25519.fst.checked", "dataset/Spec.Curve25519.fst.checked", "dataset/prims.fst.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Hacl.Spec.Curve25519.Field51.Definition.fst.checked", "dataset/Hacl.Impl.Ed25519.Field51.fst.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Math.Lemmas.fst.checked", "dataset/FStar.List.Tot.fst.checked" ] }, "definitions_in_context": [ "let create5 (x0 x1 x2 x3 x4:uint64) : list uint64 = [x0; x1; x2; x3; x4]", "let felem_list = x:list uint64{FL.length x == 5}", "let point_list = x:list uint64{FL.length x == 20}", "let pow51 = SF51.pow51", "let pow102: (pow102:pos{pow2 102 == pow102 /\\ pow102 = pow51 * pow51}) =\n let pow102:pos = normalize_term (pow2 102) in\n normalize_term_spec (pow2 102);\n Math.Lemmas.pow2_plus 51 51;\n pow102", "let pow153: (pow153:pos{pow2 153 == pow153 /\\ pow153 = pow51 * pow51 * pow51}) =\n let pow153:pos = normalize_term (pow2 153) in\n normalize_term_spec (pow2 153);\n Math.Lemmas.pow2_plus 51 51;\n Math.Lemmas.pow2_plus 102 51;\n pow153", "let pow204: (pow204:pos{pow2 204 == pow204 /\\ pow204 = pow51 * pow51 * pow51 * pow51}) =\n let pow204:pos = normalize_term (pow2 204) in\n normalize_term_spec (pow2 204);\n Math.Lemmas.pow2_plus 51 51;\n Math.Lemmas.pow2_plus 102 51;\n Math.Lemmas.pow2_plus 153 51;\n pow204", "let felem_to_list (x:SC.elem) : felem_list =\n [@inline_let] let x0 = x % pow51 in\n [@inline_let] let x1 = x / pow51 % pow51 in\n [@inline_let] let x2 = x / pow102 % pow51 in\n [@inline_let] let x3 = x / pow153 % pow51 in\n [@inline_let] let x4 = x / pow204 in\n Math.Lemmas.lemma_div_lt_nat x 255 204;\n [@inline_let] let r = create5 (u64 x0) (u64 x1) (u64 x2) (u64 x3) (u64 x4) in\n assert_norm (FL.length r = 5);\n r", "let ext_point_to_list (p:S.ext_point) : point_list =\n [@inline_let] let (px, py, pz, pt) = p in\n FL.(felem_to_list px @ felem_to_list py @ felem_to_list pz @ felem_to_list pt)" ], "closest": [ "val Hacl.Spec.P256.PrecompTable.point_inv_list = p: Hacl.Spec.P256.PrecompTable.point_list -> Prims.logical\nlet point_inv_list (p:point_list) =\n let x = Seq.seq_of_list p <: lseq uint64 12 in\n point_inv_seq x", "val Hacl.Spec.K256.PrecompTable.point_inv_list = p: Hacl.Spec.K256.PrecompTable.point_list -> Prims.logical\nlet point_inv_list (p:point_list) =\n let x = Seq.seq_of_list p <: lseq uint64 15 in\n point_inv_lseq x", "val Hacl.Spec.P256.PrecompTable.point_eval_list = p: Hacl.Spec.P256.PrecompTable.point_list -> Spec.P256.PointOps.proj_point\nlet point_eval_list (p:point_list) =\n let x = Seq.seq_of_list p <: lseq uint64 12 in\n from_mont_point (as_point_nat_seq x)", "val Hacl.Spec.P256.PrecompTable.point_list = Type0\nlet point_list = x:list uint64{FL.length x == 12}", "val Hacl.Spec.K256.PrecompTable.point_list = Type0\nlet point_list = x:list uint64{FL.length x == 15}", "val Hacl.Ed25519.PrecompTable.pow_point = k: Prims.nat -> p: Spec.Ed25519.aff_point_c -> Spec.Ed25519.aff_point_c\nlet pow_point (k:nat) (p:S.aff_point_c) =\n LE.pow S.mk_ed25519_comm_monoid p k", "val Hacl.Impl.P256.Point.point_inv_seq = p: Hacl.Impl.P256.Point.point_seq -> Prims.logical\nlet point_inv_seq (p:point_seq) =\n let x, y, z = as_point_nat_seq p in\n x < S.prime /\\ y < S.prime /\\ z < S.prime", "val Spec.Ed25519.PointOps.point_inv = p: Spec.Ed25519.PointOps.ext_point -> Prims.logical\nlet point_inv (p:ext_point) =\n is_ext p /\\ is_on_curve (to_aff_point p)", "val Hacl.Ed25519.PrecompTable.precomp_table_acc_inv = \n p: Spec.Ed25519.aff_point_c ->\n table_len: Prims.nat{table_len * 20 <= Lib.IntTypes.max_size_t} ->\n table: Lib.Sequence.lseq Lib.IntTypes.uint64 (table_len * 20) ->\n j: Prims.nat{j < table_len}\n -> Prims.logical\nlet precomp_table_acc_inv\n (p:S.aff_point_c)\n (table_len:nat{table_len * 20 <= max_size_t})\n (table:LSeq.lseq uint64 (table_len * 20))\n (j:nat{j < table_len})\n=\n Math.Lemmas.lemma_mult_lt_right 20 j table_len;\n Math.Lemmas.lemma_mult_le_right 20 (j + 1) table_len;\n let bj = LSeq.sub table (j * 20) 20 in\n F51.linv bj /\\ refl bj == pow_point j p", "val Hacl.K256.PrecompTable.pow_point = k: Prims.nat -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point\nlet pow_point (k:nat) (p:S.aff_point) =\n LE.pow S.mk_k256_comm_monoid p k", "val Hacl.Impl.K256.Point.point_inv_lseq = p: Lib.Sequence.lseq Lib.IntTypes.uint64 15 -> Prims.logical\nlet point_inv_lseq (p:LSeq.lseq uint64 15) =\n inv_lazy_reduced2_5 (as_felem5_lseq (LSeq.sub p 0 5)) /\\\n inv_lazy_reduced2_5 (as_felem5_lseq (LSeq.sub p 5 5)) /\\\n inv_lazy_reduced2_5 (as_felem5_lseq (LSeq.sub p 10 5))", "val Hacl.K256.PrecompTable.precomp_table_acc_inv = \n p: Spec.K256.PointOps.aff_point ->\n table_len: Prims.nat{table_len * 15 <= Lib.IntTypes.max_size_t} ->\n table: Lib.Sequence.lseq Lib.IntTypes.uint64 (table_len * 15) ->\n j: Prims.nat{j < table_len}\n -> Prims.logical\nlet precomp_table_acc_inv\n (p:S.aff_point)\n (table_len:nat{table_len * 15 <= max_size_t})\n (table:LSeq.lseq uint64 (table_len * 15))\n (j:nat{j < table_len})\n=\n Math.Lemmas.lemma_mult_lt_right 15 j table_len;\n Math.Lemmas.lemma_mult_le_right 15 (j + 1) table_len;\n let bj = LSeq.sub table (j * 15) 15 in\n point_inv_lseq bj /\\ S.to_aff_point (point_eval_lseq bj) == pow_point j p", "val Hacl.Impl.P256.Point.aff_point_inv_seq = p: Hacl.Impl.P256.Point.aff_point_seq -> Prims.logical\nlet aff_point_inv_seq (p:aff_point_seq) =\n let x, y = as_aff_point_nat_seq p in\n x < S.prime /\\ y < S.prime", "val Hacl.P256.PrecompTable.precomp_table_acc_inv = \n p: Spec.P256.PointOps.aff_point ->\n table_len: Prims.nat{table_len * 12 <= Lib.IntTypes.max_size_t} ->\n table: Lib.Sequence.lseq Lib.IntTypes.uint64 (table_len * 12) ->\n j: Prims.nat{j < table_len}\n -> Prims.logical\nlet precomp_table_acc_inv\n (p:S.aff_point)\n (table_len:nat{table_len * 12 <= max_size_t})\n (table:LSeq.lseq uint64 (table_len * 12))\n (j:nat{j < table_len})\n=\n Math.Lemmas.lemma_mult_lt_right 12 j table_len;\n Math.Lemmas.lemma_mult_le_right 12 (j + 1) table_len;\n let bj = LSeq.sub table (j * 12) 12 in\n point_inv_seq bj /\\ S.to_aff_point (from_mont_point (as_point_nat_seq bj)) == pow_point j p", "val Hacl.P256.PrecompTable.pow_point = k: Prims.nat -> p: Spec.P256.PointOps.aff_point -> Spec.P256.PointOps.aff_point\nlet pow_point (k:nat) (p:S.aff_point) =\n LE.pow S.mk_p256_comm_monoid p k", "val Hacl.Impl.K256.Point.aff_point_inv_seq = p: Hacl.Impl.K256.Point.aff_point_seq -> Prims.logical\nlet aff_point_inv_seq (p:aff_point_seq) =\n inv_fully_reduced5 (as_felem5_lseq (LSeq.sub p 0 5)) /\\\n inv_fully_reduced5 (as_felem5_lseq (LSeq.sub p 5 5))", "val Hacl.Spec.P256.PrecompTable.felem_list = Type0\nlet felem_list = x:list uint64{FL.length x == 4}", "val Hacl.Impl.K256.Point.point_inv = h: FStar.Monotonic.HyperStack.mem -> p: Hacl.Impl.K256.Point.point -> Prims.logical\nlet point_inv (h:mem) (p:point) =\n inv_lazy_reduced2 h (gsub p 0ul 5ul) /\\\n inv_lazy_reduced2 h (gsub p 5ul 5ul) /\\\n inv_lazy_reduced2 h (gsub p 10ul 5ul)", "val Hacl.Impl.P256.Point.point_inv = h: FStar.Monotonic.HyperStack.mem -> p: Hacl.Impl.P256.Point.point -> Prims.logical\nlet point_inv (h:mem) (p:point) =\n point_inv_seq (as_seq h p)", "val Hacl.Impl.Ed25519.Verify.point_inv_full_t = h: FStar.Monotonic.HyperStack.mem -> p: Hacl.Bignum25519.point -> Prims.logical\nlet point_inv_full_t (h:mem) (p:point) =\n F51.point_inv_t h p /\\ F51.inv_ext_point (as_seq h p)", "val ext_point_to_list_lemma: p:S.ext_point{Spec.Ed25519.point_inv p} ->\n Lemma (point_inv_list (ext_point_to_list p) /\\ point_eval_list (ext_point_to_list p) == p)\nlet ext_point_to_list_lemma p =\n ext_point_to_list_eval p;\n let (px, py, pz, pt) = p in\n ext_point_to_list_sub p;\n felem_to_list_lemma_fits px;\n felem_to_list_lemma_fits py;\n felem_to_list_lemma_fits pz;\n felem_to_list_lemma_fits pt", "val Hacl.Spec.K256.PrecompTable.felem_list = Type0\nlet felem_list = x:list uint64{FL.length x == 5}", "val point_inv_t (h: mem) (p: point) : GTot Type0\nlet point_inv_t (h:mem) (p:point) : GTot Type0 =\n mul_inv_t h (gsub p 0ul 5ul) /\\\n mul_inv_t h (gsub p 5ul 5ul) /\\\n mul_inv_t h (gsub p 10ul 5ul) /\\\n mul_inv_t h (gsub p 15ul 5ul)", "val Hacl.Impl.P256.Point.aff_point_inv = h: FStar.Monotonic.HyperStack.mem -> p: Hacl.Impl.P256.Point.aff_point -> Prims.logical\nlet aff_point_inv (h:mem) (p:aff_point) =\n aff_point_inv_seq (as_seq h p)", "val Hacl.Bignum.ModInv.bn_mod_inv_prime_precomp_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_mod_inv_prime_precomp_st (t:limb_t) (len:BN.meta_len t) =\n n:lbignum t len\n -> mu:limb t\n -> r2:lbignum t len\n -> a:lbignum t len\n -> res:lbignum t len ->\n Stack unit\n (requires fun h ->\n live h n /\\ live h r2 /\\ live h a /\\ live h res /\\\n disjoint res n /\\ disjoint res a /\\ disjoint n a /\\\n disjoint res r2 /\\ disjoint a r2 /\\ disjoint n r2 /\\\n\n S.bn_mod_inv_prime_pre (as_seq h n) (as_seq h a) /\\\n bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n /\\\n (1 + bn_v h n * v mu) % pow2 (bits t) == 0)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n bn_v h1 res * bn_v h0 a % bn_v h0 n = 1)", "val Hacl.Impl.Curve25519.Generic.secret_to_public_st = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet secret_to_public_st (s: field_spec) (p: Type0) =\n o:lbuffer uint8 32ul\n -> i:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h0 ->\n p /\\\n live h0 o /\\ live h0 i /\\ disjoint o i)\n (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\\\n as_seq h1 o == S.secret_to_public (as_seq h0 i))", "val Spec.Ed25519.ext_point_c = Type0\nlet ext_point_c = p:ext_point{point_inv p}", "val Hacl.Impl.P256.Point.as_point_nat_seq = p: Hacl.Impl.P256.Point.point_seq -> (Prims.nat * Prims.nat) * Prims.nat\nlet as_point_nat_seq (p:point_seq) =\n BD.bn_v (LSeq.sub p 0 4),\n BD.bn_v (LSeq.sub p 4 4),\n BD.bn_v (LSeq.sub p 8 4)", "val Hacl.Impl.P256.Point.point_seq = Type0\nlet point_seq = LSeq.lseq uint64 12", "val Hacl.Impl.K256.Point.aff_point_inv = h: FStar.Monotonic.HyperStack.mem -> p: Hacl.Impl.K256.Point.aff_point -> Prims.logical\nlet aff_point_inv (h:mem) (p:aff_point) =\n aff_point_inv_seq (as_seq h p)", "val Hacl.Impl.P256.Point.point = Type0\nlet point = lbuffer uint64 12ul", "val Hacl.Spec.PrecompBaseTable.precomp_base_table_inv = \n k: Hacl.Spec.PrecompBaseTable.mk_precomp_base_table t a_t len ctx_len ->\n g: t ->\n n: Hacl.Spec.PrecompBaseTable.max_table_len_t len ->\n _: Hacl.Spec.PrecompBaseTable.g_i_acc_t t a_t len ctx_len n\n -> Prims.logical\nlet precomp_base_table_inv\n (#t:Type) (#a_t:BE.inttype_a) (#len:size_t{v len > 0}) (#ctx_len:size_t)\n (k:mk_precomp_base_table t a_t len ctx_len) (g:t)\n (n:max_table_len_t len) ((g_i, acc_i):g_i_acc_t t a_t len ctx_len n) =\n k.concr_ops.SE.to.SE.refl g_i == pow_base k g (n + 1) /\\\n (forall (i:nat{i < n + 1}). precomp_base_table_acc_inv k g (n + 1) (Seq.seq_of_list acc_i) i)", "val Hacl.Spec.K256.GLV.Lemmas.point_mul_def = a: Prims.nat -> p: Spec.K256.PointOps.proj_point -> Spec.K256.PointOps.proj_point\nlet point_mul_def a p = SE.pow S.mk_k256_concrete_ops p a", "val Hacl.Bignum25519.point = Type0\nlet point = lbuffer uint64 20ul", "val Hacl.Impl.Curve25519.Generic.ecdh_st = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet ecdh_st (s:field_spec) (p: Type0) =\n o:lbuffer uint8 32ul\n -> k:lbuffer uint8 32ul\n -> i:lbuffer uint8 32ul\n -> Stack bool\n (requires fun h0 ->\n p /\\\n live h0 o /\\ live h0 k /\\ live h0 i /\\\n disjoint o i /\\ disjoint o k)\n (ensures fun h0 r h1 -> modifies (loc o) h0 h1 /\\\n as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i)\n /\\ (not r == Lib.ByteSequence.lbytes_eq #32 (as_seq h1 o) (Lib.Sequence.create 32 (u8 0))))", "val Hacl.Impl.Curve25519.Generic.scalarmult_st = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet scalarmult_st (s:field_spec) (p: Type0) =\n o:lbuffer uint8 32ul\n -> k:lbuffer uint8 32ul\n -> i:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h0 ->\n p /\\\n live h0 o /\\ live h0 k /\\ live h0 i /\\\n disjoint o i /\\ disjoint o k)\n (ensures fun h0 _ h1 -> modifies (loc o) h0 h1 /\\\n as_seq h1 o == S.scalarmult (as_seq h0 k) (as_seq h0 i))", "val Hacl.Bignum.ModInvLimb.mod_inv_limb_st = t: Hacl.Bignum.Definitions.limb_t -> Type0\nlet mod_inv_limb_st (t:limb_t) =\n n0:limb t ->\n Stack (limb t)\n (requires fun h -> True)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == S.mod_inv_limb n0)", "val Spec.P256.PointOps.aff_point = Type0\nlet aff_point = p:tuple2 nat nat{let (px, py) = p in px < prime /\\ py < prime}", "val Spec.Ed25519.aff_point_c = Type0\nlet aff_point_c = p:aff_point{is_on_curve p}", "val Hacl.Spec.PrecompBaseTable.precomp_base_table_acc_inv = \n k: Hacl.Spec.PrecompBaseTable.mk_precomp_base_table t a_t len ctx_len ->\n g: t ->\n table_len: Prims.nat{table_len * Lib.IntTypes.v len <= Lib.IntTypes.max_size_t} ->\n table:\n Lib.Sequence.lseq (Lib.IntTypes.uint_t a_t Lib.IntTypes.SEC) (table_len * Lib.IntTypes.v len) ->\n j: Prims.nat{j < table_len}\n -> Prims.logical\nlet precomp_base_table_acc_inv\n (#t:Type) (#a_t:BE.inttype_a) (#len:size_t{v len > 0}) (#ctx_len:size_t)\n (k:mk_precomp_base_table t a_t len ctx_len) (g:t)\n (table_len:nat{table_len * v len <= max_size_t})\n (table:LSeq.lseq (uint_t a_t SEC) (table_len * v len))\n (j:nat{j < table_len})\n=\n Math.Lemmas.lemma_mult_lt_right (v len) j table_len;\n Math.Lemmas.lemma_mult_le_right (v len) (j + 1) table_len;\n let bj = LSeq.sub table (j * v len) (v len) in\n k.to_cm.BE.linv bj /\\ k.to_cm.BE.refl bj == pow_base k g j", "val Hacl.Impl.Ed25519.Field51.point = Type0\nlet point = lbuffer uint64 20ul", "val Hacl.Impl.P256.Point.aff_point_seq = Type0\nlet aff_point_seq = LSeq.lseq uint64 8", "val Hacl.Impl.P256.Point.aff_point = Type0\nlet aff_point = lbuffer uint64 8ul", "val Hacl.Spec.K256.GLV.aff_point_mul = a: Prims.nat -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point\nlet aff_point_mul = S.aff_point_mul", "val Hacl.Curve25519_64.finv = Hacl.Meta.Curve25519.finv_finv_higher_t Hacl.Impl.Curve25519.Field64.Vale.p\nlet finv = finv_finv_higher #M64 C.p C.fmul fsquare_times", "val Hacl.Impl.Curve25519.AddAndDouble.point = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> Type0\nlet point (s:field_spec) = lbuffer (limb s) (nlimb s +! nlimb s)", "val Hacl.Spec.K256.ECSM.Lemmas.aff_point_mul = a: Prims.nat -> p: Spec.K256.PointOps.aff_point -> Spec.K256.PointOps.aff_point\nlet aff_point_mul = S.aff_point_mul", "val point_compress_:\n tmp:lbuffer uint64 15ul\n -> p:point ->\n Stack unit\n (requires fun h -> live h tmp /\\ live h p /\\ disjoint tmp p /\\ F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc tmp) h0 h1 /\\ (\n let zinv = Spec.Curve25519.finv (F51.fevalh h0 (gsub p 10ul 5ul)) in\n let x = Spec.Curve25519.fmul (F51.fevalh h0 (gsub p 0ul 5ul)) zinv in\n let y = Spec.Curve25519.fmul (F51.fevalh h0 (gsub p 5ul 5ul)) zinv in\n F51.mul_inv_t h1 (gsub tmp 10ul 5ul) /\\\n F51.fevalh h1 (gsub tmp 10ul 5ul) == y /\\\n F51.as_nat h1 (gsub tmp 5ul 5ul) == x)\n )\nlet point_compress_ tmp p =\n let zinv = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let out = sub tmp 10ul 5ul in\n let px = getx p in\n let py = gety p in\n let pz = getz p in\n\n inverse zinv pz;\n fmul x px zinv;\n reduce x;\n fmul out py zinv;\n reduce_513 out", "val Spec.Ed25519.PointOps.is_ext = p: Spec.Ed25519.PointOps.ext_point -> Prims.logical\nlet is_ext (p:ext_point) =\n let _X, _Y, _Z, _T = p in\n _T == _X *% _Y /% _Z /\\ _Z <> zero", "val refl (p: LSeq.lseq uint64 15 {point_inv_lseq p}) : GTot S.aff_point\nlet refl (p:LSeq.lseq uint64 15{point_inv_lseq p}) : GTot S.aff_point =\n S.to_aff_point (point_eval_lseq p)", "val Hacl.Impl.K256.Point.point = Type0\nlet point = lbuffer uint64 15ul", "val Hacl.Bignum.ModInv.bn_mod_inv_prime_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_mod_inv_prime_st (t:limb_t) (len:BN.meta_len t) =\n nBits:size_t\n -> n:lbignum t len\n -> a:lbignum t len\n -> res:lbignum t len ->\n Stack unit\n (requires fun h ->\n live h n /\\ live h a /\\ live h res /\\\n disjoint res n /\\ disjoint res a /\\ disjoint n a /\\\n\n v nBits / bits t < v len /\\ pow2 (v nBits) < bn_v h n /\\\n S.bn_mod_inv_prime_pre (as_seq h n) (as_seq h a))\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n bn_v h1 res * bn_v h0 a % bn_v h0 n = 1)", "val Hacl.Spec.Curve25519.Field51.mul_inv_t = f: Hacl.Spec.Curve25519.Field51.Definition.felem5 -> Prims.logical\nlet mul_inv_t (f:felem5) =\n let (o0, o1, o2, o3, o4) = f in\n if v o1 >= pow2 51 then\n felem_fits5 f (1, 2, 1, 1, 1) /\\ v o1 % pow2 51 < 8192\n else felem_fits5 f (1, 1, 1, 1, 1)", "val Spec.Ed25519.PointOps.is_on_curve = p: Spec.Ed25519.PointOps.aff_point -> Prims.logical\nlet is_on_curve (p:aff_point) =\n let (x, y) = p in\n y *% y -% x *% x == 1 +% d *% (x *% x) *% (y *% y)", "val Spec.P256.PointOps.proj_point = Type0\nlet proj_point = p:tuple3 nat nat nat{let (px, py, pz) = p in px < prime /\\ py < prime /\\ pz < prime}", "val Hacl.Curve25519_64.encode_point = Hacl.Meta.Curve25519.generic_encode_point_higher_t Hacl.Impl.Curve25519.Field64.Vale.p\nlet encode_point = generic_encode_point_higher #M64 C.p store_felem C.fmul finv", "val refl (p: LSeq.lseq uint64 12 {point_inv_seq p}) : GTot S.aff_point\nlet refl (p:LSeq.lseq uint64 12{point_inv_seq p}) : GTot S.aff_point =\n S.to_aff_point (from_mont_point (as_point_nat_seq p))", "val Hacl.Impl.Curve25519.Fields.Core.cswap2_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet cswap2_t (s:field_spec) (p: Type0) =\n bit:uint64{v bit <= 1}\n -> p1:felem2 s\n -> p2:felem2 s\n -> Stack unit\n (requires fun h0 ->\n p /\\\n live h0 p1 /\\ live h0 p2 /\\\n (disjoint p1 p2 \\/ p1 == p2))\n (ensures fun h0 _ h1 ->\n modifies (loc p1 |+| loc p2) h0 h1 /\\\n (v bit == 1 ==> as_seq h1 p1 == as_seq h0 p2 /\\ as_seq h1 p2 == as_seq h0 p1) /\\\n (v bit == 0 ==> as_seq h1 p1 == as_seq h0 p1 /\\ as_seq h1 p2 == as_seq h0 p2))", "val Hacl.Impl.K256.Point.aff_point_seq = Type0\nlet aff_point_seq = LSeq.lseq uint64 10", "val Hacl.Impl.Curve25519.Fields.Core.add1_t = p: Type0 -> Type0\nlet add1_t (p: Type0) = out:felem M64 -> f1:felem M64 -> f2:uint64\n -> Stack (Ghost.erased uint64)\n (requires fun h ->\n p /\\\n live h f1 /\\ live h out /\\\n (disjoint out f1 \\/ out == f1))\n (ensures fun h0 c h1 ->\n modifies (loc out) h0 h1 /\\\n as_nat h1 out + v c * pow2 256 == as_nat h0 f1 + v f2)", "val proj_point_to_list: p:S.proj_point\n -> x:list uint64{FStar.List.Tot.length x = 15 /\\\n mk_to_k256_comm_monoid.BE.linv (Seq.seq_of_list x)}\nlet proj_point_to_list p =\n SPTK.proj_point_to_list_lemma p;\n SPTK.proj_point_to_list p", "val proj_point_to_list: p:S.proj_point\n -> x:list uint64{FStar.List.Tot.length x = 12 /\\\n mk_to_p256_comm_monoid.BE.linv (Seq.seq_of_list x)}\nlet proj_point_to_list p =\n SPTK.proj_point_to_list_lemma p;\n SPTK.proj_point_to_list p", "val Hacl.Bignum.MontArithmetic.bn_field_inv_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_field_inv_st (t:limb_t) (len:BN.meta_len t) =\n k:pbn_mont_ctx t\n -> aM:lbignum t len\n -> aInvM:lbignum t len ->\n Stack unit\n (requires fun h ->\n (B.deref h k).len == len /\\\n pbn_mont_ctx_inv h k /\\\n Euclid.is_prime (bn_v_n h k) /\\\n 0 < bn_v h aM /\\ bn_v h aM < bn_v_n h k /\\\n\n live h aM /\\ live h aInvM /\\ disjoint aM aInvM /\\\n B.(loc_disjoint (footprint h k) (loc_buffer (aM <: buffer (limb t)))) /\\\n B.(loc_disjoint (footprint h k) (loc_buffer (aInvM <: buffer (limb t)))))\n (ensures fun h0 _ h1 -> modifies (loc aInvM) h0 h1 /\\\n bn_v h1 aInvM < bn_v_n h0 k /\\\n as_seq h1 aInvM == S.bn_field_inv (as_pctx h0 k) (as_seq h0 aM))", "val Hacl.Impl.K256.Point.aff_point = Type0\nlet aff_point = lbuffer uint64 10ul", "val Spec.P256.PointOps.qelem = Type0\nlet qelem = x:nat{x < order}", "val Hacl.Impl.Curve25519.Fields.Core.fsqr_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fsqr_t (s:field_spec) (p: Type0) =\n out:felem s\n -> f1:felem s\n -> tmp:felem_wide s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\ live h tmp /\\\n fsqr_disjoint out f1 tmp /\\\n fsqr_pre h f1)\n (ensures fun h0 _ h1 ->\n modifies (loc out |+| loc tmp) h0 h1 /\\\n state_inv_t h1 out /\\\n feval h1 out == P.fmul (feval h0 f1) (feval h0 f1))", "val Hacl.Impl.P256.Point.as_aff_point_nat_seq = p: Hacl.Impl.P256.Point.aff_point_seq -> Prims.nat * Prims.nat\nlet as_aff_point_nat_seq (p:aff_point_seq) =\n BD.bn_v (LSeq.sub p 0 4),\n BD.bn_v (LSeq.sub p 4 4)", "val Hacl.Impl.Curve25519.Fields.Core.fsub_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fsub_t (s:field_spec) (p: Type0) =\n out:felem s\n -> f1:felem s\n -> f2:felem s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\ live h f2 /\\\n (disjoint out f1 \\/ out == f1) /\\\n (disjoint out f2 \\/ out == f2) /\\\n (disjoint f1 f2 \\/ f1 == f2) /\\\n fadd_fsub_pre h f1 f2)\n (ensures fun h0 _ h1 ->\n modifies (loc out) h0 h1 /\\ fsub_post h1 out /\\\n feval h1 out == P.fsub (feval h0 f1) (feval h0 f2))", "val Hacl.Bignum.Montgomery.bn_mont_precomp_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_mont_precomp_st (t:limb_t) (len:BN.meta_len t) =\n nBits:size_t\n -> n:lbignum t len\n -> r2:lbignum t len ->\n Stack (limb t)\n (requires fun h ->\n live h n /\\ live h r2 /\\ disjoint n r2 /\\\n\n 1 < bn_v h n /\\ bn_v h n % 2 = 1 /\\\n pow2 (v nBits) < bn_v h n /\\ v nBits / bits t < v len)\n (ensures fun h0 mu h1 -> modifies (loc r2) h0 h1 /\\\n (as_seq h1 r2, mu) == S.bn_mont_precomp (v nBits) (as_seq h0 n))", "val proj_point_to_list_lemma: p:S.proj_point ->\n Lemma (point_inv_list (proj_point_to_list p) /\\ point_eval_list (proj_point_to_list p) == p)\nlet proj_point_to_list_lemma p =\n proj_point_to_list_fits p;\n proj_point_to_list_eval p", "val proj_point_to_list_lemma: p:S.proj_point ->\n Lemma (point_inv_list (proj_point_to_list p) /\\ point_eval_list (proj_point_to_list p) == p)\nlet proj_point_to_list_lemma p =\n proj_point_to_list_fits p;\n proj_point_to_list_eval p", "val mk_ed25519_precomp_base_table:SPT.mk_precomp_base_table S.ext_point_c U64 20ul 0ul\nlet mk_ed25519_precomp_base_table: SPT.mk_precomp_base_table S.ext_point_c U64 20ul 0ul = {\n SPT.concr_ops = S.mk_ed25519_concrete_ops;\n SPT.to_cm = mk_to_ed25519_comm_monoid;\n SPT.to_list = ext_point_to_list;\n SPT.lemma_refl = lemma_refl;\n}", "val point_compress:\n out:lbuffer uint8 32ul\n -> p:point ->\n Stack unit\n (requires fun h -> live h out /\\ live h p /\\ F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == Spec.Ed25519.point_compress (F51.point_eval h0 p)\n )\nlet point_compress z p =\n push_frame();\n let tmp = create 15ul (u64 0) in\n let zinv = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let out = sub tmp 10ul 5ul in\n\n point_compress_ tmp p;\n let b = x_mod_2 x in\n store_51 z out;\n add_sign z b;\n\n (**) let h3 = ST.get() in\n (**) lemma_nat_from_to_bytes_le_preserves_value (as_seq h3 z) 32;\n (**) lemma_nat_to_from_bytes_le_preserves_value (as_seq h3 z) 32 (F51.fevalh h3 out);\n\n pop_frame()", "val table_neg_inv_precomp (q: LSeq.lseq uint64 15) (is_negate: bool) : BE.table_inv_t U64 15ul 32ul\nlet table_neg_inv_precomp\n (q:LSeq.lseq uint64 15) (is_negate:bool) : BE.table_inv_t U64 15ul 32ul =\n fun a table ->\n point_eval_lseq a == SG.point_negate_cond (point_eval_lseq q) is_negate /\\\n (forall (j:nat{j < 32}).\n PT.precomp_table_inv 15ul 0ul mk_k256_concrete_ops q 32ul table j)", "val Hacl.Spec.Bignum.ModInvLimb.mod_inv_limb_t = t: Hacl.Spec.Bignum.Definitions.limb_t -> i: Prims.nat{i <= Lib.IntTypes.bits t} -> Type0\nlet mod_inv_limb_t (t:limb_t) (i:nat{i <= bits t}) = tuple2 (limb t) (limb t)", "val Hacl.Spec.Poly1305.Vec.pfelem = Type0\nlet pfelem = Scalar.felem", "val Hacl.Impl.Curve25519.Fields.Core.fmul1_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fmul1_t (s:field_spec) (p: Type0) =\n out:felem s\n -> f1:felem s\n -> f2:uint64\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\\n (disjoint out f1 \\/ out == f1) /\\\n fmul1_pre h f1 f2)\n (ensures fun h0 _ h1 ->\n modifies (loc out) h0 h1 /\\ state_inv_t h1 out /\\\n feval h1 out == P.fmul (feval h0 f1) (v f2))", "val Hacl.Impl.Curve25519.Fields.Core.fsqr2_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fsqr2_t (s:field_spec) (p: Type0) =\n out:felem2 s\n -> f:felem2 s\n -> tmp:felem_wide2 s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f /\\ live h tmp /\\\n (disjoint out f \\/ out == f) /\\\n (disjoint out tmp) /\\\n disjoint tmp f /\\\n fsqr2_pre h f)\n (ensures fun h0 _ h1 ->\n modifies (loc out |+| loc tmp) h0 h1 /\\ fmul2_fsqr2_post h1 out /\\\n (let out1 = gsub out 0ul (nlimb s) in\n let out2 = gsub out (nlimb s) (nlimb s) in\n let f1 = gsub f 0ul (nlimb s) in\n let f2 = gsub f (nlimb s) (nlimb s) in\n feval h1 out1 == P.fmul (feval h0 f1) (feval h0 f1) /\\\n feval h1 out2 == P.fmul (feval h0 f2) (feval h0 f2)))", "val Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_mod_exp_precomp_st (t:limb_t) (len:BN.meta_len t) =\n n:lbignum t len\n -> mu:limb t\n -> r2:lbignum t len\n -> a:lbignum t len\n -> bBits:size_t\n -> b:lbignum t (blocks0 bBits (size (bits t)))\n -> res:lbignum t len ->\n Stack unit\n (requires fun h ->\n live h n /\\ live h a /\\ live h b /\\ live h res /\\ live h r2 /\\\n disjoint res a /\\ disjoint res b /\\ disjoint res n /\\ disjoint n a /\\\n disjoint res r2 /\\ disjoint a r2 /\\ disjoint n r2 /\\\n\n S.bn_mod_exp_pre (as_seq h n) (as_seq h a) (v bBits) (as_seq h b) /\\\n bn_v h r2 == pow2 (2 * bits t * v len) % bn_v h n /\\\n (1 + bn_v h n * v mu) % pow2 (bits t) == 0)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n S.bn_mod_exp_post (as_seq h0 n) (as_seq h0 a) (v bBits) (as_seq h0 b) (as_seq h1 res))", "val Hacl.Spec.PrecompBaseTable256.a_pow2_128 = k: Spec.Exponentiation.concrete_ops t -> a: t -> t\nlet a_pow2_128 (#t:Type) (k:SE.concrete_ops t) (a:t) =\n SE.exp_pow2 k (a_pow2_64 k a) 64", "val Hacl.Bignum.ModInv.bn_check_mod_inv_prime_st = t: Hacl.Bignum.Definitions.limb_t -> len: Hacl.Bignum.meta_len t -> Type0\nlet bn_check_mod_inv_prime_st (t:limb_t) (len:BN.meta_len t) =\n n:lbignum t len\n -> a:lbignum t len ->\n Stack (limb t)\n (requires fun h -> live h n /\\ live h a /\\ disjoint n a)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n r == S.bn_check_mod_inv_prime (as_seq h0 n) (as_seq h0 a))", "val Hacl.Impl.Blake2.Core.row_p = a: Spec.Blake2.Definitions.alg -> m: Hacl.Impl.Blake2.Core.m_spec -> Type0\nlet row_p (a:Spec.alg) (m:m_spec) =\n lbuffer (element_t a m) (row_len a m)", "val Hacl.Spec.Bignum.Exponentiation.bn_mod_exp_precomp_st = t: Hacl.Spec.Bignum.Definitions.limb_t -> len: Hacl.Spec.Bignum.bn_len t -> Type0\nlet bn_mod_exp_precomp_st (t:limb_t) (len:BN.bn_len t) =\n n:lbignum t len\n -> mu:limb t\n -> r2:lbignum t len\n -> a:lbignum t len\n -> bBits:size_nat\n -> b:lbignum t (blocks0 bBits (bits t)) ->\n Pure (lbignum t len)\n (requires\n bn_mod_exp_pre n a bBits b /\\\n bn_v r2 == pow2 (2 * bits t * len) % bn_v n /\\\n (1 + bn_v n * v mu) % pow2 (bits t) == 0)\n (ensures fun res ->\n bn_mod_exp_post n a bBits b res)", "val Hacl.Impl.Exponentiation.table_inv_t = \n a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a ->\n len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} ->\n table_len: Hacl.Impl.Exponentiation.table_len_t len\n -> Type\nlet table_inv_t (a_t:inttype_a) (len:size_t{v len > 0}) (table_len:table_len_t len) =\n a:LSeq.lseq (uint_t a_t SEC) (v len)\n -> table:LSeq.lseq (uint_t a_t SEC) (v (table_len *! len)) -> GTot Type0", "val Hacl.Impl.Ed25519.Group.a_spec = Type0\nlet a_spec = S.aff_point_c", "val Hacl.Impl.Curve25519.Fields.Core.fmul_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fmul_t (s:field_spec) (p: Type0) =\n out:felem s\n -> f1:felem s\n -> f2:felem s\n -> tmp:felem_wide2 s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\ live h f2 /\\ live h tmp /\\\n fmul_disjoint out f1 f2 tmp /\\\n fmul_pre h f1 f2)\n (ensures fun h0 _ h1 ->\n modifies (loc out |+| loc tmp) h0 h1 /\\ state_inv_t h1 out /\\\n feval h1 out == P.fmul (feval h0 f1) (feval h0 f2))", "val pre_inv : Type0\nlet pre_inv = i:erased iname & witnessed_name_is_ok i", "val pre_inv : Type0\nlet pre_inv = i:erased iname & witnessed_name_is_ok i", "val point_negate: p:F51.point -> out:F51.point ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ disjoint out p /\\\n F51.point_inv_t h p /\\ F51.inv_ext_point (as_seq h p))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out) /\\\n F51.point_eval h1 out == Spec.Ed25519.point_negate (F51.point_eval h0 p))\nlet point_negate p out =\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.to_aff_point_negate (F51.refl_ext_point (as_seq h0 p));\n Hacl.Impl.Ed25519.PointNegate.point_negate p out", "val Hacl.HPKE.Interface.DH.secret_to_public_st = a: Spec.Agile.DH.algorithm -> p: Type0 -> Type0\nlet secret_to_public_st (a: DH.algorithm) (p:Type0) =\n o:lbuffer uint8 (nsize_public a)\n -> i:lbuffer uint8 (nsize_key a)\n -> Stack UInt32.t\n (requires fun h0 ->\n p /\\\n live h0 o /\\ live h0 i /\\ disjoint o i)\n (ensures fun h0 result h1 -> modifies (loc o) h0 h1 /\\\n (let output = DH.secret_to_public a (as_seq h0 i) in\n match result with\n | 0ul -> Some? output /\\ as_seq h1 o `Seq.equal` Some?.v output\n | 1ul -> None? output\n | _ -> False))", "val Hacl.Impl.Curve25519.Fields.Core.fmul2_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fmul2_t (s:field_spec) (p: Type0) =\n out:felem2 s\n -> f1:felem2 s\n -> f2:felem2 s\n -> tmp:felem_wide2 s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\ live h f2 /\\ live h tmp /\\\n (disjoint out f1 \\/ out == f1) /\\\n (disjoint out f2 \\/ out == f2) /\\\n (disjoint out tmp) /\\\n (disjoint f1 f2 \\/ f1 == f2) /\\\n disjoint f1 tmp /\\\n disjoint f2 tmp /\\\n fmul2_pre h f1 f2)\n (ensures fun h0 _ h1 ->\n modifies (loc out |+| loc tmp) h0 h1 /\\ fmul2_fsqr2_post h1 out /\\\n (let out0 = gsub out 0ul (nlimb s) in\n let out1 = gsub out (nlimb s) (nlimb s) in\n let f10 = gsub f1 0ul (nlimb s) in\n let f11 = gsub f1 (nlimb s) (nlimb s) in\n let f20 = gsub f2 0ul (nlimb s) in\n let f21 = gsub f2 (nlimb s) (nlimb s) in\n feval h1 out0 == P.fmul (feval h0 f10) (feval h0 f20) /\\\n feval h1 out1 == P.fmul (feval h0 f11) (feval h0 f21)))", "val precomp_basepoint_table_list_w5:x: list uint64 {FStar.List.Tot.length x = 384}\nlet precomp_basepoint_table_list_w5: x:list uint64{FStar.List.Tot.length x = 384} =\n normalize_term (SPT.precomp_base_table_list mk_p256_precomp_base_table S.base_point 31)", "val Spec.K256.PointOps.aff_point = Type0\nlet aff_point = felem & felem", "val proj_point_to_list_fits: p:S.proj_point ->\n Lemma (point_inv_list (proj_point_to_list p))\nlet proj_point_to_list_fits p =\n let (px, py, pz) = p in\n let pxM = SM.to_mont px in\n let pyM = SM.to_mont py in\n let pzM = SM.to_mont pz in\n\n proj_point_to_list_sub p;\n felem_to_list_lemma_eval pxM;\n felem_to_list_lemma_eval pyM;\n felem_to_list_lemma_eval pzM", "val proj_point_to_list_fits: p:S.proj_point ->\n Lemma (point_inv_list (proj_point_to_list p))\nlet proj_point_to_list_fits p =\n let (px, py, pz) = p in\n proj_point_to_list_sub p;\n felem_to_list_lemma_fits px;\n felem_to_list_lemma_fits py;\n felem_to_list_lemma_fits pz", "val Hacl.Impl.Curve25519.Fields.Core.fadd_t = s: Hacl.Impl.Curve25519.Fields.Core.field_spec -> p: Type0 -> Type0\nlet fadd_t (s:field_spec) (p: Type0) =\n out:felem s\n -> f1:felem s\n -> f2:felem s\n -> Stack unit\n (requires fun h ->\n p /\\\n live h out /\\ live h f1 /\\ live h f2 /\\\n (disjoint out f1 \\/ out == f1) /\\\n (disjoint out f2 \\/ out == f2) /\\\n (disjoint f1 f2 \\/ f1 == f2) /\\\n fadd_fsub_pre h f1 f2)\n (ensures fun h0 _ h1 ->\n modifies (loc out) h0 h1 /\\ fadd_post h1 out /\\\n feval h1 out == P.fadd (feval h0 f1) (feval h0 f2))", "val Hacl.Impl.HPKE.serialized_point_dh = cs: Spec.Agile.HPKE.ciphersuite -> Type0\nlet serialized_point_dh (cs:S.ciphersuite) = lbuffer uint8 (size (S.size_dh_serialized cs))", "val Spec.Ed25519.PointOps.point_equal = p: Spec.Ed25519.PointOps.ext_point -> q: Spec.Ed25519.PointOps.ext_point -> Prims.bool\nlet point_equal (p:ext_point) (q:ext_point) =\n let px, py, pz, pt = p in\n let qx, qy, qz, qt = q in\n if ((px *% qz) <> (qx *% pz)) then false\n else if ((py *% qz) <> (qy *% pz)) then false\n else true", "val Hacl.Impl.Exponentiation.table_len_t = len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} -> Type0\nlet table_len_t (len:size_t{v len > 0}) =\n table_len:size_t{v table_len * v len <= max_size_t}", "val Hacl.Spec.PrecompBaseTable.g_i_acc_t = \n t: Type ->\n a_t: Hacl.Impl.Exponentiation.Definitions.inttype_a ->\n len: Lib.IntTypes.size_t{Lib.IntTypes.v len > 0} ->\n ctx_len: Lib.IntTypes.size_t ->\n i: Prims.nat\n -> Type\nlet g_i_acc_t (t:Type) (a_t:BE.inttype_a) (len:size_t{v len > 0}) (ctx_len:size_t) (i:nat) =\n t & acc:list (uint_t a_t SEC){FL.length acc == (i + 1) * v len}" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fsti", "name": "Hacl.Spec.P256.PrecompTable.point_inv_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fsti", "name": "Hacl.Spec.K256.PrecompTable.point_inv_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fsti", "name": "Hacl.Spec.P256.PrecompTable.point_eval_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fsti", "name": "Hacl.Spec.P256.PrecompTable.point_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fsti", "name": "Hacl.Spec.K256.PrecompTable.point_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fsti", "name": "Hacl.Ed25519.PrecompTable.pow_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_inv_seq" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.PointOps.fst", "name": "Spec.Ed25519.PointOps.point_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fsti", "name": "Hacl.Ed25519.PrecompTable.precomp_table_acc_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fsti", "name": "Hacl.K256.PrecompTable.pow_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.point_inv_lseq" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fsti", "name": "Hacl.K256.PrecompTable.precomp_table_acc_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.aff_point_inv_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fsti", "name": "Hacl.P256.PrecompTable.precomp_table_acc_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fsti", "name": "Hacl.P256.PrecompTable.pow_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.aff_point_inv_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fsti", "name": "Hacl.Spec.P256.PrecompTable.felem_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.point_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.point_inv_full_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Ed25519.PrecompTable.fst", "name": "Hacl.Spec.Ed25519.PrecompTable.ext_point_to_list_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fsti", "name": "Hacl.Spec.K256.PrecompTable.felem_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Field51.fst", "name": "Hacl.Impl.Ed25519.Field51.point_inv_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.aff_point_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.ModInv.fst", "name": "Hacl.Bignum.ModInv.bn_mod_inv_prime_precomp_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Generic.fsti", "name": "Hacl.Impl.Curve25519.Generic.secret_to_public_st" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.fst", "name": "Spec.Ed25519.ext_point_c" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.as_point_nat_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.aff_point_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.point" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable.fst", "name": "Hacl.Spec.PrecompBaseTable.precomp_base_table_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.GLV.Lemmas.fst", "name": "Hacl.Spec.K256.GLV.Lemmas.point_mul_def" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum25519.fsti", "name": "Hacl.Bignum25519.point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Generic.fsti", "name": "Hacl.Impl.Curve25519.Generic.ecdh_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Generic.fsti", "name": "Hacl.Impl.Curve25519.Generic.scalarmult_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.ModInvLimb.fsti", "name": "Hacl.Bignum.ModInvLimb.mod_inv_limb_st" }, { "project_name": "hacl-star", "file_name": "Spec.P256.PointOps.fst", "name": "Spec.P256.PointOps.aff_point" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.fst", "name": "Spec.Ed25519.aff_point_c" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable.fsti", "name": "Hacl.Spec.PrecompBaseTable.precomp_base_table_acc_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Field51.fst", "name": "Hacl.Impl.Ed25519.Field51.point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.aff_point_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.aff_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.GLV.fst", "name": "Hacl.Spec.K256.GLV.aff_point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Curve25519_64.fst", "name": "Hacl.Curve25519_64.finv" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.AddAndDouble.fst", "name": "Hacl.Impl.Curve25519.AddAndDouble.point" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.ECSM.Lemmas.fst", "name": "Hacl.Spec.K256.ECSM.Lemmas.aff_point_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointCompress.fst", "name": "Hacl.Impl.Ed25519.PointCompress.point_compress_" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.PointOps.fst", "name": "Spec.Ed25519.PointOps.is_ext" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Group.fst", "name": "Hacl.Impl.K256.Group.refl" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.point" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.ModInv.fst", "name": "Hacl.Bignum.ModInv.bn_mod_inv_prime_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Curve25519.Field51.fst", "name": "Hacl.Spec.Curve25519.Field51.mul_inv_t" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.PointOps.fst", "name": "Spec.Ed25519.PointOps.is_on_curve" }, { "project_name": "hacl-star", "file_name": "Spec.P256.PointOps.fst", "name": "Spec.P256.PointOps.proj_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Curve25519_64.fst", "name": "Hacl.Curve25519_64.encode_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Group.fst", "name": "Hacl.Impl.P256.Group.refl" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.cswap2_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.aff_point_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.add1_t" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fst", "name": "Hacl.K256.PrecompTable.proj_point_to_list" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fst", "name": "Hacl.P256.PrecompTable.proj_point_to_list" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.MontArithmetic.fsti", "name": "Hacl.Bignum.MontArithmetic.bn_field_inv_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fsti", "name": "Hacl.Impl.K256.Point.aff_point" }, { "project_name": "hacl-star", "file_name": "Spec.P256.PointOps.fst", "name": "Spec.P256.PointOps.qelem" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fsqr_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fsti", "name": "Hacl.Impl.P256.Point.as_aff_point_nat_seq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fsub_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.Montgomery.fsti", "name": "Hacl.Bignum.Montgomery.bn_mont_precomp_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fst", "name": "Hacl.Spec.K256.PrecompTable.proj_point_to_list_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fst", "name": "Hacl.Spec.P256.PrecompTable.proj_point_to_list_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fsti", "name": "Hacl.Ed25519.PrecompTable.mk_ed25519_precomp_base_table" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointCompress.fst", "name": "Hacl.Impl.Ed25519.PointCompress.point_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.GLV.fst", "name": "Hacl.Impl.K256.GLV.table_neg_inv_precomp" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.ModInvLimb.fst", "name": "Hacl.Spec.Bignum.ModInvLimb.mod_inv_limb_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Poly1305.Vec.fst", "name": "Hacl.Spec.Poly1305.Vec.pfelem" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fmul1_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fsqr2_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.Exponentiation.fsti", "name": "Hacl.Bignum.Exponentiation.bn_mod_exp_precomp_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable256.fsti", "name": "Hacl.Spec.PrecompBaseTable256.a_pow2_128" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum.ModInv.fst", "name": "Hacl.Bignum.ModInv.bn_check_mod_inv_prime_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Blake2.Core.fsti", "name": "Hacl.Impl.Blake2.Core.row_p" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Exponentiation.fsti", "name": "Hacl.Spec.Bignum.Exponentiation.bn_mod_exp_precomp_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Exponentiation.fsti", "name": "Hacl.Impl.Exponentiation.table_inv_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Group.fst", "name": "Hacl.Impl.Ed25519.Group.a_spec" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fmul_t" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.pre_inv" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.pre_inv" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_negate" }, { "project_name": "hacl-star", "file_name": "Hacl.HPKE.Interface.DH.fst", "name": "Hacl.HPKE.Interface.DH.secret_to_public_st" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fmul2_t" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fst", "name": "Hacl.P256.PrecompTable.precomp_basepoint_table_list_w5" }, { "project_name": "hacl-star", "file_name": "Spec.K256.PointOps.fst", "name": "Spec.K256.PointOps.aff_point" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.PrecompTable.fst", "name": "Hacl.Spec.P256.PrecompTable.proj_point_to_list_fits" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.PrecompTable.fst", "name": "Hacl.Spec.K256.PrecompTable.proj_point_to_list_fits" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Curve25519.Fields.Core.fsti", "name": "Hacl.Impl.Curve25519.Fields.Core.fadd_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.HPKE.fsti", "name": "Hacl.Impl.HPKE.serialized_point_dh" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.PointOps.fst", "name": "Spec.Ed25519.PointOps.point_equal" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Exponentiation.fsti", "name": "Hacl.Impl.Exponentiation.table_len_t" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.PrecompBaseTable.fsti", "name": "Hacl.Spec.PrecompBaseTable.g_i_acc_t" } ], "selected_premises": [ "Hacl.Impl.Ed25519.Field51.linv", "Hacl.Spec.Ed25519.PrecompTable.felem_list", "Spec.Ed25519.PointOps.g", "Hacl.Spec.Bignum.Definitions.blocks", "Hacl.Impl.Ed25519.Field51.refl_ext_point", "Hacl.Spec.Ed25519.PrecompTable.point_list", "Lib.Buffer.lbuffer", "Hacl.Impl.Ed25519.Field51.inv_ext_point", "Hacl.Impl.Ed25519.Field51.lseq_as_felem", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.Buffer.lbuffer_t", "Hacl.Impl.Curve25519.Fields.Core.f51_felem_fits", "Hacl.Impl.Ed25519.Field51.felem", "Hacl.Impl.Curve25519.Field51.felem", "Hacl.Impl.Curve25519.Fields.Core.nwide", "Lib.Buffer.as_seq", "FStar.List.Tot.Base.length", "Hacl.Impl.Curve25519.Fields.Core.nlimb", "LowStar.Buffer.trivial_preorder", "Hacl.Impl.Curve25519.Fields.Core.felem", "FStar.Tactics.Canon.canon", "Hacl.Impl.Curve25519.Field51.felem2", "Spec.Curve25519.op_Slash_Percent", "Hacl.Spec.Bignum.Definitions.lbignum", "FStar.List.Tot.Base.map", "Hacl.Spec.Ed25519.PrecompTable.felem_to_list", "Spec.Curve25519.prime", "Spec.Ed25519.ext_point_c", "Lib.Sequence.lseq", "Spec.Ed25519.size_signature", "Spec.Ed25519.PointOps.point_at_infinity", "Lib.IntTypes.int_t", "LowStar.Buffer.gcmalloc_of_list", "Hacl.Impl.Curve25519.Fields.Core.f51_as_nat", "Lib.Buffer.gsub", "Hacl.Impl.Curve25519.Fields.Core.limb", "Hacl.Impl.Ed25519.Field51.as_nat", "Lib.IntTypes.uint_t", "Spec.Ed25519.PointOps.d", "Hacl.Impl.Curve25519.Field51.felem_wide", "Lib.IntTypes.size", "Hacl.Impl.Ed25519.Field51.point_inv_t", "Hacl.Impl.Curve25519.Field51.create_felem", "Hacl.Impl.Curve25519.Fields.Core.f51_as_felem", "Hacl.Impl.Curve25519.Fields.Core.f51_mul_inv_t", "Hacl.Impl.Curve25519.Field51.fmul", "LowStar.Monotonic.Buffer.length", "Spec.Curve25519.one", "Lib.IntTypes.range", "Hacl.Impl.Ed25519.Field51.fevalh", "Spec.Ed25519.q", "Spec.Curve25519.zero", "Hacl.Impl.Curve25519.Field51.as_felem", "Hacl.Impl.Curve25519.Fields.Core.as_nat", "Hacl.Spec.Curve25519.Field51.Definition.felem5", "Hacl.Impl.Curve25519.Field51.as_nat", "Hacl.Impl.Ed25519.Field51.point", "Lib.Sequence.to_seq", "Hacl.Impl.Curve25519.Field51.fsqr2", "Hacl.Impl.Ed25519.Field51.as_felem", "Hacl.Spec.Ed25519.PrecompTable.pow51", "Hacl.Impl.Ed25519.Field51.felem_fits", "Hacl.Spec.Curve25519.Field51.Definition.max51", "Lib.IntTypes.u64", "Spec.Ed25519.point_at_inifinity_c", "Hacl.Impl.Ed25519.Field51.mul_inv_t", "Lib.Sequence.op_String_Access", "Hacl.Impl.Curve25519.Field51.fmul1", "Spec.Curve25519.fmul", "Hacl.Impl.Ed25519.Field51.point_eval", "Lib.IntTypes.u8", "Spec.Ed25519.PointOps.g_x", "Hacl.Impl.Curve25519.Fields.Core.felem2", "Spec.Ed25519.mk_ed25519_comm_monoid", "Hacl.Impl.Curve25519.Field51.fadd", "Hacl.Impl.Curve25519.Fields.Core.wide", "Spec.Ed25519.PointOps.to_aff_point", "Hacl.Impl.Curve25519.Field51.felem_fits", "Spec.Ed25519.point_mul_g", "Hacl.Impl.Curve25519.Field51.fsqr", "Spec.Ed25519.PointOps.point_inv", "Spec.Curve25519.finv", "Hacl.Spec.Curve25519.Field51.Definition.as_nat5", "Hacl.Spec.Ed25519.PrecompTable.ext_point_to_list", "Hacl.Impl.Curve25519.Fields.Core.f51_felem_fits1", "Lib.Buffer.disjoint", "Hacl.Spec.Bignum.Definitions.limb", "Spec.Curve25519.fpow", "Hacl.Impl.Curve25519.Field51.copy_felem", "FStar.UInt.size", "Lib.Buffer.op_Array_Assignment", "Spec.Hash.Definitions.hash_length", "Lib.Buffer.op_Array_Access", "Hacl.Impl.Curve25519.Fields.Core.feval", "Hacl.Spec.Bignum.Definitions.bn_v", "Hacl.Spec.Curve25519.Field51.Definition.pow51", "Lib.Sequence.length", "Hacl.Spec.Curve25519.Field51.Definition.felem_fits5", "Lib.UpdateMulti.uint8", "Hacl.Spec.Curve25519.Field64.Definition.bn_v_is_as_nat" ], "source_upto_this": "module Hacl.Spec.Ed25519.PrecompTable\n\nopen FStar.Mul\nopen Lib.IntTypes\nopen Lib.Sequence\n\nmodule F51 = Hacl.Impl.Ed25519.Field51\nmodule SF51 = Hacl.Spec.Curve25519.Field51.Definition\n\nmodule S = Spec.Ed25519\nmodule SC = Spec.Curve25519\nmodule FL = FStar.List.Tot\n\n#set-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\nunfold\nlet create5 (x0 x1 x2 x3 x4:uint64) : list uint64 = [x0; x1; x2; x3; x4]\n\ninline_for_extraction noextract\nlet felem_list = x:list uint64{FL.length x == 5}\ninline_for_extraction noextract\nlet point_list = x:list uint64{FL.length x == 20}\n\ninline_for_extraction noextract\nlet pow51 = SF51.pow51\n\n[@\"opaque_to_smt\"]\nlet pow102: (pow102:pos{pow2 102 == pow102 /\\ pow102 = pow51 * pow51}) =\n let pow102:pos = normalize_term (pow2 102) in\n normalize_term_spec (pow2 102);\n Math.Lemmas.pow2_plus 51 51;\n pow102\n\n[@\"opaque_to_smt\"]\nlet pow153: (pow153:pos{pow2 153 == pow153 /\\ pow153 = pow51 * pow51 * pow51}) =\n let pow153:pos = normalize_term (pow2 153) in\n normalize_term_spec (pow2 153);\n Math.Lemmas.pow2_plus 51 51;\n Math.Lemmas.pow2_plus 102 51;\n pow153\n\n[@\"opaque_to_smt\"]\nlet pow204: (pow204:pos{pow2 204 == pow204 /\\ pow204 = pow51 * pow51 * pow51 * pow51}) =\n let pow204:pos = normalize_term (pow2 204) in\n normalize_term_spec (pow2 204);\n Math.Lemmas.pow2_plus 51 51;\n Math.Lemmas.pow2_plus 102 51;\n Math.Lemmas.pow2_plus 153 51;\n pow204\n\n\ninline_for_extraction noextract\nlet felem_to_list (x:SC.elem) : felem_list =\n [@inline_let] let x0 = x % pow51 in\n [@inline_let] let x1 = x / pow51 % pow51 in\n [@inline_let] let x2 = x / pow102 % pow51 in\n [@inline_let] let x3 = x / pow153 % pow51 in\n [@inline_let] let x4 = x / pow204 in\n Math.Lemmas.lemma_div_lt_nat x 255 204;\n [@inline_let] let r = create5 (u64 x0) (u64 x1) (u64 x2) (u64 x3) (u64 x4) in\n assert_norm (FL.length r = 5);\n r\n\n\ninline_for_extraction noextract\nlet ext_point_to_list (p:S.ext_point) : point_list =\n [@inline_let] let (px, py, pz, pt) = p in\n FL.(felem_to_list px @ felem_to_list py @ felem_to_list pz @ felem_to_list pt)\n\n\ninline_for_extraction noextract", "sketch": [ "The point_inv_list function takes a point_list representing a point on the Ed25519 curve and returns a Type0 value.\n\nThe point_inv_list function computes the inverse of the input point_list and returns a Type0 value representing the inverse point.", "The `point_inv_list` function takes a point list representing an extended point on the Ed25519 curve and returns the type of the inverse of the point.\n\nStep 1: We need to define a function that takes a point list and returns the type of the inverse of the point.\n\nStep 2: To implement this, we will use the inverse operation defined for the extended point type in the Ed25519 curve and return the type of the result.", "The point_inv_list function takes a point_list representing a point on the Ed25519 curve and returns a Type0 value.\n\nThe point_inv_list function computes the inverse of the input point_list and returns a Type0 value.", "To implement the `point_inv_list` function, we will extract the y-coordinate from the point list, negate it, and then construct a new point list with the negated y-coordinate and the other coordinates unchanged.", "The `point_inv_list` function takes a `point_list` representing a point on the Ed25519 curve and returns a type.\n\nStep 1: We need to define a type that represents the inverse of the point represented by the `point_list`.\n\nStep 2: We will implement the `point_inv_list` function by defining a new type that represents the inverse of the point and returning this type.", "To implement the `point_inv_list` function, we can simply swap the x and y coordinates of the point and negate the t coordinate. The z coordinate remains unchanged.", "The `point_inv_list` function takes a point list representing an extended point on the Ed25519 curve and returns a type.\n\nStep 1: We need to define the type that represents the inverse of the point list.\n\nStep 2: We can implement the `point_inv_list` function by defining a new type that represents the inverse of the point list.", "To implement the `point_inv_list` function, we can first split the input `point_list` into four `felem_list` representing the x, y, z, and t coordinates of the extended point. Then we can negate the y-coordinate and construct a new `point_list` with the x, -y, z, and t coordinates.", "The `point_inv_list` function takes a point list representing an extended point on the Ed25519 curve and returns a type.\n\nStep 1: We need to define the type that represents the inverse of the point list.\n\nStep 2: We can implement the `point_inv_list` function by defining a new type that represents the inverse of the point list.", "The point_inv_list function takes a point_list as input and returns a type representing the inverse of the points in the list.\n\nStep 1: The point_inv_list function takes a list of 20 uint64 values representing points and returns a type representing the inverse of these points.\n\nStep 2: To implement point_inv_list, we will define a new type representing the inverse of the points in the input list. We will then return this type based on the input list." ], "generated_solution": [ "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list (p: Hacl.Spec.Ed25519.PrecompTable.point_list) : Type0 =\n // Implementation goes here\n // Compute the inverse of the input point_list and return a Type0 value\n // Use appropriate F* functions and lemmas to ensure correctness\n // Implementation details depend on the specific algorithm for computing the inverse\n // Return the computed inverse as a Type0 value", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list p = S.ext_point", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list (p: Hacl.Spec.Ed25519.PrecompTable.point_list) : Type0 =\n // Implementation goes here\n // Compute the inverse of the input point_list\n // Return the result as Type0\n // Example: some_implementation_here", "let point_inv_list (p: Hacl.Spec.Ed25519.PrecompTable.point_list) : Type0 =\n let (px, py, pz, pt) = p in\n let neg_py = FStar.Mul.neg py in\n (px, neg_py, pz, pt)", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list p = ...", "let point_inv_list (p: point_list) : Type0 =\n let (px, py, pz, pt) = p in\n (py, px, pz, FStar.Mul.neg pt)", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list p = ...", "let point_inv_list (p: Hacl.Spec.Ed25519.PrecompTable.point_list) : Type0 =\n let (px, py, pz, pt) = FL.split_at 5 p in\n let neg_py = FL.map (fun x -> if x = 0 then 0 else pow51 - x) py in\n FL.append px (FL.append neg_py (FL.append pz pt))", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list p = ...", "val point_inv_list : p: Hacl.Spec.Ed25519.PrecompTable.point_list -> Type0\nlet point_inv_list (p: Hacl.Spec.Ed25519.PrecompTable.point_list) : Type0 = \n // Implementation of the type representing the inverse of the points in the input list\n // Return the type representing the inverse of the points\n // Your implementation here" ] }, { "file_name": "Vale.Stdcalls.X64.Cpuid.fsti", "name": "Vale.Stdcalls.X64.Cpuid.movbe_lemma'", "opens_and_abbrevs": [ { "open": "Vale.X64.State" }, { "open": "Vale.X64.Machine_s" }, { "abbrev": "VC", "full_module": "Vale.Lib.X64.Cpuidstdcall" }, { "open": "Vale.X64.MemoryAdapters" }, { "abbrev": "W", "full_module": "Vale.AsLowStar.Wrapper" }, { "abbrev": "IA", "full_module": "Vale.Interop.Assumptions" }, { "abbrev": "V", "full_module": "Vale.X64.Decls" }, { "abbrev": "LSig", "full_module": "Vale.AsLowStar.LowStarSig" }, { "abbrev": "VSig", "full_module": "Vale.AsLowStar.ValeSig" }, { "abbrev": "IX64", "full_module": "Vale.Interop.X64" }, { "open": "Vale.Interop.Base" }, { "open": "FStar.Mul" }, { "open": "Vale.Stdcalls.X64" }, { "open": "Vale.Stdcalls.X64" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f))", "source_definition": "let movbe_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n movbe_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "source_range": { "start_line": 289, "start_col": 0, "end_line": 300, "end_col": 52 }, "interleaved": false, "definition": "fun code _ va_s0 ->\n Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_movbe_stdcall code va_s0 Vale.Interop.Assumptions.win\n <:\n Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel)", "effect": "Prims.Ghost", "effect_flags": [], "mutual_with": [], "premises": [ "Vale.X64.Decls.va_code", "Prims.bool", "Vale.X64.Decls.va_state", "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_movbe_stdcall", "Vale.Interop.Assumptions.win", "FStar.Pervasives.Native.tuple2", "Vale.X64.Decls.va_fuel", "Vale.Stdcalls.X64.Cpuid.movbe_pre", "Prims.l_and", "Vale.X64.Decls.eval_code", "Vale.AsLowStar.ValeSig.vale_calling_conventions_stdcall", "Vale.Stdcalls.X64.Cpuid.movbe_post" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "code: Vale.X64.Decls.va_code -> _win: Prims.bool -> va_s0: Vale.X64.Decls.va_state\n -> Prims.Ghost (Vale.X64.Decls.va_state * Vale.X64.Decls.va_fuel)", "prompt": "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) =\n ", "expected_response": "VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "source": { "project_name": "hacl-star", "file_name": "vale/code/arch/x64/interop/Vale.Stdcalls.X64.Cpuid.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.Stdcalls.X64.Cpuid.fsti", "checked_file": "dataset/Vale.Stdcalls.X64.Cpuid.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Vale.X64.State.fsti.checked", "dataset/Vale.X64.MemoryAdapters.fsti.checked", "dataset/Vale.X64.Machine_s.fst.checked", "dataset/Vale.X64.Decls.fsti.checked", "dataset/Vale.Lib.X64.Cpuidstdcall.fsti.checked", "dataset/Vale.Interop.X64.fsti.checked", "dataset/Vale.Interop.Base.fst.checked", "dataset/Vale.Interop.Assumptions.fst.checked", "dataset/Vale.AsLowStar.Wrapper.fsti.checked", "dataset/Vale.AsLowStar.ValeSig.fst.checked", "dataset/Vale.AsLowStar.LowStarSig.fst.checked", "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked" ] }, "definitions_in_context": [ "let as_t (#a:Type) (x:normal a) : a = x", "let as_normal_t (#a:Type) (x:a) : normal a = x", "let dom: IX64.arity_ok_stdcall td = []", "let aesni_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_aesni_stdcall c va_s0 IA.win", "let aesni_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f", "let aesni_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n aesni_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n aesni_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win", "let aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'", "let code_aesni = VC.va_code_Check_aesni_stdcall IA.win", "let lowstar_aesni_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_aesni\n dom\n []\n _\n _\n (W.mk_prediction code_aesni dom [] (aesni_lemma code_aesni IA.win))", "let sha_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_sha_stdcall c va_s0 IA.win", "let sha_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_sha_stdcall c va_s0 IA.win va_s1 f", "let sha_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n sha_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_sha_stdcall code va_s0 IA.win", "let sha_lemma = as_t #(VSig.vale_sig_stdcall sha_pre sha_post) sha_lemma'", "let code_sha = VC.va_code_Check_sha_stdcall IA.win", "let lowstar_sha_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_sha\n dom\n []\n _\n _\n (W.mk_prediction code_sha dom [] (sha_lemma code_sha IA.win))", "let adx_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_adx_bmi2_stdcall c va_s0 IA.win", "let adx_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_adx_bmi2_stdcall c va_s0 IA.win va_s1 f", "let adx_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n adx_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n adx_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_adx_bmi2_stdcall code va_s0 IA.win", "let adx_lemma = as_t #(VSig.vale_sig_stdcall adx_pre adx_post) adx_lemma'", "let code_adx = VC.va_code_Check_adx_bmi2_stdcall IA.win", "let lowstar_adx_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_adx\n dom\n []\n _\n _\n (W.mk_prediction code_adx dom [] (adx_lemma code_adx IA.win))", "let avx_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_avx_stdcall c va_s0 IA.win", "let avx_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_avx_stdcall c va_s0 IA.win va_s1 f", "let avx_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n avx_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n avx_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_avx_stdcall code va_s0 IA.win", "let avx_lemma = as_t #(VSig.vale_sig_stdcall avx_pre avx_post) avx_lemma'", "let code_avx = VC.va_code_Check_avx_stdcall IA.win", "let lowstar_avx_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_avx\n dom\n []\n _\n _\n (W.mk_prediction code_avx dom [] (avx_lemma code_avx IA.win))", "let avx2_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_avx2_stdcall c va_s0 IA.win", "let avx2_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_avx2_stdcall c va_s0 IA.win va_s1 f", "let avx2_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n avx2_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n avx2_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_avx2_stdcall code va_s0 IA.win", "let avx2_lemma = as_t #(VSig.vale_sig_stdcall avx2_pre avx2_post) avx2_lemma'", "let code_avx2 = VC.va_code_Check_avx2_stdcall IA.win", "let lowstar_avx2_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_avx2\n dom\n []\n _\n _\n (W.mk_prediction code_avx2 dom [] (avx2_lemma code_avx2 IA.win))", "let movbe_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_movbe_stdcall c va_s0 IA.win", "let movbe_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_movbe_stdcall c va_s0 IA.win va_s1 f" ], "closest": [ "val aesni_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires aesni_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n aesni_post code va_s0 va_s1 f))\nlet aesni_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n aesni_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n aesni_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win", "val va_lemma_Check_movbe_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_movbe_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_movbe_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_movbe_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_movbe_stdcall win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 97 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 104 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 105 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val vm_lemma' (code: V.va_code) (_win: bool) (dst: b64) (src: ib64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires vm_pre code dst src va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n vm_post code dst src va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\\\n ME.buffer_writeable (as_vale_buffer dst) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet vm_lemma'\n (code:V.va_code)\n (_win:bool)\n (dst:b64)\n (src:ib64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n vm_pre code dst src va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n vm_post code dst src va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer src) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer dst) /\\\n ME.buffer_writeable (as_vale_buffer dst) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer dst))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n ))\n = \n let va_s1, f = VM.va_lemma_Memcpy code va_s0 IA.win (as_vale_buffer dst) (as_vale_immbuffer src) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 dst;\n (va_s1, f)", "val va_wpProof_Check_movbe_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_movbe_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_stdcall win)\n ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_movbe_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_movbe_stdcall (va_code_Check_movbe_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val ta_lemma'\n (code: V.va_code)\n (_win: bool)\n (arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: ib64)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\\\n ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))\nlet ta_lemma'\n (code:V.va_code)\n (_win:bool)\n (arg0:ib64)\n (arg1:ib64)\n (arg2:ib64)\n (arg3:ib64)\n (arg4:ib64)\n (arg5:ib64)\n (arg6:ib64)\n (arg7:ib64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n ta_pre code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n ta_post code arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg0) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg3) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg4) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg5) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg6) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_immbuffer arg7) /\\\n ME.modifies ME.loc_none (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)))\n =\n let va_s1, f = TA.va_lemma_Test code va_s0 IA.win\n (as_vale_immbuffer arg0)\n (as_vale_immbuffer arg1)\n (as_vale_immbuffer arg2)\n (as_vale_immbuffer arg3)\n (as_vale_immbuffer arg4)\n (as_vale_immbuffer arg5)\n (as_vale_immbuffer arg6)\n (as_vale_immbuffer arg7)\n in\n va_s1, f", "val key256_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires key256_pre code input_b output_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key256_post code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)))\nlet key256_lemma'\n (code:V.va_code)\n (_win:bool)\n (input_b:b128)\n (output_b:b128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n key256_pre code input_b output_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key256_post code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)\n )) =\n let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_256\n (as_vale_buffer input_b) (as_vale_buffer output_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;\n (va_s1, f)", "val lemma_movbe_elim :\n orig:va_code ->\n transformed:va_code ->\n va_s0:va_state -> va_sM:va_state -> va_fM:va_fuel ->\n Ghost (va_state & va_fuel)\n (requires (\n (va_require_total transformed (movbe_elim orig).result va_s0) /\\\n (va_get_ok va_s0) /\\\n (va_ensure_total orig va_s0 va_sM va_fM) /\\\n (va_get_ok va_sM)))\n (ensures (fun (va_sM', va_fM') ->\n (va_fM' == va_fM) /\\\n (equiv_states va_sM va_sM') /\\\n (va_ensure_total transformed va_s0 va_sM' va_fM') /\\\n (va_get_ok va_sM')))\nlet lemma_movbe_elim =\n PH.lemma_peephole_transform ME.movbe_elim_ph", "val fsub_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsub_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsub_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsub_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsub_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsub_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fsub_stdcall code va_s0 IA.win (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n (va_s1, f)", "val poly_lemma'\n (code: V.va_code)\n (_win: bool)\n (ctx_b inp_b: b64)\n (len finish: uint64)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires poly_pre code ctx_b inp_b len finish va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n poly_post code ctx_b inp_b len finish va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\ ME.buffer_writeable (as_vale_buffer inp_b)\n ))\nlet poly_lemma'\n (code:V.va_code)\n (_win:bool)\n (ctx_b:b64)\n (inp_b:b64)\n (len:uint64)\n (finish:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n poly_pre code ctx_b inp_b len finish va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n poly_post code ctx_b inp_b len finish va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\\n ME.buffer_writeable (as_vale_buffer inp_b)\n )) =\n let va_s1, f = PO.va_lemma_Poly1305 code va_s0 IA.win (as_vale_buffer ctx_b) (as_vale_buffer inp_b) (UInt64.v len) (UInt64.v finish) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 ctx_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt64 inp_b;\n va_s1, f", "val sha_lemma'\n (code: V.va_code)\n (_win: bool)\n (ctx_b: b128)\n (in_b: b8_128)\n (num_val: uint64)\n (k_b: ib128)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires sha_pre code ctx_b in_b num_val k_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code ctx_b in_b num_val k_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\ ME.buffer_writeable (as_vale_buffer in_b))\n )\nlet sha_lemma'\n (code:V.va_code)\n (_win:bool)\n (ctx_b:b128)\n (in_b:b8_128)\n (num_val:uint64)\n (k_b:ib128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n sha_pre code ctx_b in_b num_val k_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code ctx_b in_b num_val k_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\\n ME.buffer_writeable (as_vale_buffer in_b)\n )) =\n let va_s1, f = SH.va_lemma_Sha_update_bytes_stdcall code va_s0 IA.win (as_vale_buffer ctx_b) (as_vale_buffer in_b) (UInt64.v num_val) (as_vale_immbuffer k_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt32 ME.TUInt128 ctx_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;\n (va_s1, f)", "val fsub_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsub_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\\\n fsub_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsub_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsub_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsub_regs_modified fsub_xmms_modified /\\\n fsub_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fsub code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n (va_s1, f)", "val cswap_lemma' (code: V.va_code) (_win: bool) (bit: uint64) (p0 p1: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires cswap_pre code bit p0 p1 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n cswap_post code bit p0 p1 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p0) /\\\n ME.buffer_writeable (as_vale_buffer p0) /\\ ME.buffer_writeable (as_vale_buffer p1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer p0))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer p1)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet cswap_lemma'\n (code:V.va_code)\n (_win:bool)\n (bit:uint64)\n (p0:b64)\n (p1:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n cswap_pre code bit p0 p1 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n cswap_post code bit p0 p1 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p0) /\\\n ME.buffer_writeable (as_vale_buffer p0) /\\\n ME.buffer_writeable (as_vale_buffer p1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer p0))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer p1))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FU.va_lemma_Cswap2_stdcall code va_s0 IA.win (UInt64.v bit) (as_vale_buffer p0) (as_vale_buffer p1) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 p0;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 p1;\n (va_s1, f)", "val fmul_lemma' (code: V.va_code) (_win: bool) (tmp f1 out f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul_pre code tmp f1 out f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul_post code tmp f1 out f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\ ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul_lemma'\n (code:V.va_code)\n (_win:bool)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul_pre code tmp f1 out f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul_post code tmp f1 out f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fmul_stdcall code va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val key128_lemma' (code: V.va_code) (_win: bool) (input_b output_b: b128) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires key128_pre code input_b output_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key128_post code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)))\nlet key128_lemma'\n (code:V.va_code)\n (_win:bool)\n (input_b:b128)\n (output_b:b128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n key128_pre code input_b output_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key128_post code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)\n )) =\n let va_s1, f = AE.va_lemma_KeyExpansionStdcall code va_s0 IA.win AES_128\n (as_vale_buffer input_b) (as_vale_buffer output_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;\n (va_s1, f)", "val fsqr_lemma' (code: V.va_code) (_win: bool) (tmp f1 out: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsqr_pre code tmp f1 out va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsqr_post code tmp f1 out va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsqr_lemma'\n (code:V.va_code)\n (_win:bool)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsqr_pre code tmp f1 out va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsqr_post code tmp f1 out va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fsqr_stdcall code va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val va_lemma_Check_movbe_support : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_movbe_support ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_movbe_support va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_movbe_support va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_movbe_support ()) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 169 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.Lib.X64.Cpuid.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 174 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.Lib.X64.Cpuid.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 175 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.Lib.X64.Cpuid.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val fadd_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fadd_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fadd_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fadd_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fadd_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fadd_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fadd_stdcall code va_s0 IA.win (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n (va_s1, f)", "val fsqr_lemma' (code: V.va_code) (_win: bool) (out f1 tmp: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsqr_pre code out f1 tmp va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsqr_regs_modified fsqr_xmms_modified /\\\n fsqr_post code out f1 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsqr_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsqr_pre code out f1 tmp va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsqr_regs_modified fsqr_xmms_modified /\\\n fsqr_post code out f1 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fsqr code va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val cswap_lemma' (code: V.va_code) (_win: bool) (bit: uint64) (p0 p1: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires cswap_pre code bit p0 p1 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 cswap_regs_modified cswap_xmms_modified /\\\n cswap_post code bit p0 p1 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p0) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p1) /\\\n ME.buffer_writeable (as_vale_buffer p0) /\\ ME.buffer_writeable (as_vale_buffer p1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer p0))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer p1)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet cswap_lemma'\n (code:V.va_code)\n (_win:bool)\n (bit:uint64)\n (p0:b64)\n (p1:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n cswap_pre code bit p0 p1 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 cswap_regs_modified cswap_xmms_modified /\\\n cswap_post code bit p0 p1 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p0) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer p1) /\\\n ME.buffer_writeable (as_vale_buffer p0) /\\\n ME.buffer_writeable (as_vale_buffer p1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer p0))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer p1))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FU.va_lemma_Cswap2 code va_s0 (UInt64.v bit) (as_vale_buffer p0) (as_vale_buffer p1) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 p0;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 p1;\n (va_s1, f)", "val add1_lemma' (code: V.va_code) (_win: bool) (out f1: b64) (f2: uint64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires add1_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n add1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet add1_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n add1_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n add1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FU.va_lemma_Fast_add1_stdcall code va_s0 IA.win (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n assert (VSig.vale_calling_conventions_stdcall va_s0 va_s1);\n (va_s1, f)", "val lemma_mov_mov_elim :\n orig:va_code ->\n transformed:va_code ->\n va_s0:va_state -> va_sM:va_state -> va_fM:va_fuel ->\n Ghost (va_state & va_fuel)\n (requires (\n (va_require_total transformed (mov_mov_elim orig).result va_s0) /\\\n (va_get_ok va_s0) /\\\n (va_ensure_total orig va_s0 va_sM va_fM) /\\\n (va_get_ok va_sM)))\n (ensures (fun (va_sM', va_fM') ->\n (va_fM' == va_fM) /\\\n (equiv_states va_sM va_sM') /\\\n (va_ensure_total transformed va_s0 va_sM' va_fM') /\\\n (va_get_ok va_sM')))\nlet lemma_mov_mov_elim =\n PH.lemma_peephole_transform Vale.Transformers.MovMovElim.mov_mov_elim_ph", "val key256_lemma'\n (s: Ghost.erased (Seq.seq nat32))\n (code: V.va_code)\n (_win: bool)\n (input_b output_b: b128)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires key256_pre s code input_b output_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key256_post s code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)))\nlet key256_lemma'\n (s:Ghost.erased (Seq.seq nat32))\n (code:V.va_code)\n (_win:bool)\n (input_b:b128)\n (output_b:b128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n key256_pre s code input_b output_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key256_post s code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)\n )) =\n let va_s1, f = GF.va_lemma_Keyhash_init code va_s0 IA.win AES_256 (Ghost.reveal s)\n (as_vale_buffer input_b) (as_vale_buffer output_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;\n (va_s1, f)", "val fsqr2_lemma' (code: V.va_code) (_win: bool) (tmp f1 out: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsqr2_pre code tmp f1 out va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsqr2_post code tmp f1 out va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsqr2_lemma'\n (code:V.va_code)\n (_win:bool)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsqr2_pre code tmp f1 out va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fsqr2_post code tmp f1 out va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fsqr2_stdcall code va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val fadd_lemma' (code: V.va_code) (_win: bool) (out f1 f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fadd_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\\\n fadd_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fadd_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fadd_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fadd_regs_modified fadd_xmms_modified /\\\n fadd_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fadd code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n (va_s1, f)", "val va_lemma_Cpuid_Movbe : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Cpuid_Movbe ()) va_s0 /\\ va_get_ok va_s0 /\\\n va_get_reg64 rRax va_s0 = 1))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRcx va_sM) 4194304 > 0 == movbe_enabled /\\ va_state_eq\n va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))\nlet va_lemma_Cpuid_Movbe va_b0 va_s0 =\n va_reveal_opaque (`%va_code_Cpuid_Movbe) (va_code_Cpuid_Movbe ());\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_Cpuid))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_Cpuid))) va_s0 in\n Vale.X64.CPU_Features_s.cpuid_features ();\n (va_sM, va_fM)", "val fsqr2_lemma' (code: V.va_code) (_win: bool) (out f1 tmp: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fsqr2_pre code out f1 tmp va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsqr_regs_modified fsqr_xmms_modified /\\\n fsqr2_post code out f1 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fsqr2_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fsqr2_pre code out f1 tmp va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fsqr_regs_modified fsqr_xmms_modified /\\\n fsqr2_post code out f1 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fsqr2 code va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val add1_lemma' (code: V.va_code) (_win: bool) (out f1: b64) (f2: uint64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires add1_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 add1_regs_modified add1_xmms_modified /\\\n add1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet add1_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n add1_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 add1_regs_modified add1_xmms_modified /\\\n add1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FU.va_lemma_Fast_add1 code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n (va_s1, f)", "val fmul_lemma' (code: V.va_code) (_win: bool) (out f1 f2 tmp: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul_pre code out f1 f2 tmp va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul_regs_modified fmul_xmms_modified /\\\n fmul_post code out f1 f2 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\ ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul_pre code out f1 f2 tmp va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul_regs_modified fmul_xmms_modified /\\\n fmul_post code out f1 f2 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fmul code va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val va_wpProof_Check_movbe_support : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_movbe_support va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_movbe_support ())\n ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_movbe_support va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_movbe_support (va_code_Check_movbe_support ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Mov128 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_xmm -> src:va_operand_xmm\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Mov128 dst src) va_s0 /\\ va_is_dst_xmm dst va_s0 /\\\n va_is_src_xmm src va_s0 /\\ va_get_ok va_s0 /\\ sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_eval_xmm va_sM dst == va_eval_xmm va_s0 src /\\ va_state_eq va_sM (va_update_ok va_sM\n (va_update_operand_xmm dst va_sM va_s0))))\nlet va_lemma_Mov128 va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Mov128) (va_code_Mov128 dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_Movdqu) (OReg dst) (OReg src))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_Movdqu) (OReg dst) (OReg src))) va_s0\n in\n (va_sM, va_fM)", "val va_wpProof_Cpuid_Movbe : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Cpuid_Movbe va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Cpuid_Movbe ()) ([va_Mod_reg64 rRdx;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Cpuid_Movbe va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Cpuid_Movbe (va_code_Cpuid_Movbe ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))));\n va_lemma_norm_mods ([va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])\n va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Mov64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->\n src:va_operand_opr64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Mov64 dst src) va_s0 /\\ va_is_dst_dst_opr64 dst va_s0\n /\\ va_is_src_opr64 src va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_eval_dst_opr64 va_sM dst == va_eval_opr64 va_s0 src /\\ va_state_eq va_sM (va_update_ok va_sM\n (va_update_operand_dst_opr64 dst va_sM va_s0))))\nlet va_lemma_Mov64 va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Mov64) (va_code_Mov64 dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Mov64) (S.AnnotateMov64 ()) dst src)) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Mov64) (S.AnnotateMov64 ())\n dst src)) va_s0 in\n (va_sM, va_fM)", "val va_lemma_Move : va_b0:va_code -> va_s0:va_state -> dst:va_operand_reg_opr ->\n src:va_operand_reg_opr\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Move dst src) va_s0 /\\ va_is_dst_reg_opr dst va_s0 /\\\n va_is_src_reg_opr src va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_eval_reg_opr va_sM dst == va_eval_reg_opr va_s0 src /\\ va_state_eq va_sM (va_update_ok va_sM\n (va_update_operand_reg_opr dst va_sM va_s0))))\nlet va_lemma_Move va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Move) (va_code_Move dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (Ins (S.Move dst src)) va_s0;\n let (va_sM, va_fM) = va_eval_ins (Ins (S.Move dst src)) va_s0 in\n (va_sM, va_fM)", "val fmul2_lemma' (code: V.va_code) (_win: bool) (tmp f1 out f2: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul2_pre code tmp f1 out f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul2_post code tmp f1 out f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\ ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul2_lemma'\n (code:V.va_code)\n (_win:bool)\n (tmp:b64)\n (f1:b64)\n (out:b64)\n (f2:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul2_pre code tmp f1 out f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul2_post code tmp f1 out f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fmul2_stdcall code va_s0 IA.win (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))\nlet va_lemma_Mod_cr0 va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in\n let va_qc = va_qcode_Mod_cr0 va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 165 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****\"\n (va_get_ok va_sM)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))\nlet va_lemma_Mod_cr0 va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in\n let va_qc = va_qcode_Mod_cr0 va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 165 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Loop.vaf *****\"\n (va_get_ok va_sM)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Mod_cr0 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Mod_cr0 ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_cr0 va_sM (va_update_ok va_sM va_s0))))\nlet va_lemma_Mod_cr0 va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_cr0; va_Mod_ok] in\n let va_qc = va_qcode_Mod_cr0 va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Mod_cr0 ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 511 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GHash.vaf *****\"\n (va_get_ok va_sM)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_cr0; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Check_sse_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_sse_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64\n rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_sse_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_sse_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_sse_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 110 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 117 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 118 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_ens_Check_movbe_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_movbe_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_movbe_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ va_get_reg64 rRbx va_sM\n == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9\n va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_lemma_Check_avx2_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_avx2_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_avx2_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_avx2_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_avx2_stdcall win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 84 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 91 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 92 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val key128_lemma'\n (s: Ghost.erased (Seq.seq nat32))\n (code: V.va_code)\n (_win: bool)\n (input_b output_b: b128)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires key128_pre s code input_b output_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key128_post s code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)))\nlet key128_lemma'\n (s:Ghost.erased (Seq.seq nat32))\n (code:V.va_code)\n (_win:bool)\n (input_b:b128)\n (output_b:b128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n key128_pre s code input_b output_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n key128_post s code input_b output_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer input_b) /\\\n ME.buffer_writeable (as_vale_buffer output_b)\n )) =\n let va_s1, f = GF.va_lemma_Keyhash_init code va_s0 IA.win AES_128 (Ghost.reveal s)\n (as_vale_buffer input_b) (as_vale_buffer output_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 input_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 output_b;\n (va_s1, f)", "val fmul1_lemma' (code: V.va_code) (_win: bool) (out f1: b64) (f2: uint64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul1_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul1_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul1_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n fmul1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fmul1_stdcall code va_s0 IA.win (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\nlet s0 = va_s0 in\nlet s1 = va_s1 in\nlet regs_modified = IX64.regs_modified_stdcall in\nlet xmms_modified = IX64.xmms_modified_stdcall in\nlet open MS in\nlet open Vale.AsLowStar.ValeSig in\nassert (forall (r:MS.reg_64).{:pattern vale_save_reg r s0 s1} not (regs_modified r) ==> vale_save_reg r s0 s1);\nassert (forall (x:MS.reg_xmm).{:pattern vale_save_xmm x s0 s1} not (xmms_modified x) ==> vale_save_xmm x s0 s1);\n (va_s1, f)", "val va_lemma_NoNewline : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_NoNewline ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_NoNewline va_b0 va_s0 =\n va_reveal_opaque (`%va_code_NoNewline) (va_code_NoNewline ());\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Space 0) (S.AnnotateSpace 0))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Space 0) (S.AnnotateSpace\n 0))) va_s0 in\n (va_sM, va_fM)", "val va_lemma_load_one_msb : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_load_one_msb ()) va_s0 /\\ va_get_ok va_s0 /\\\n sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM\n (va_update_ok va_sM va_s0))))))\nlet va_lemma_load_one_msb va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok] in\n let va_qc = va_qcode_load_one_msb va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_load_one_msb ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 576 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 581 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****\"\n (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Cmovc64 : va_b0:va_code -> va_s0:va_state -> dst:va_operand_dst_opr64 ->\n src:va_operand_opr64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Cmovc64 dst src) va_s0 /\\ va_is_dst_dst_opr64 dst\n va_s0 /\\ va_is_src_opr64 src va_s0 /\\ va_get_ok va_s0 /\\ Vale.X64.Decls.valid_cf (va_get_flags\n va_s0)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (if\n Vale.X64.Decls.cf (va_get_flags va_sM) then (va_eval_dst_opr64 va_sM dst = va_eval_opr64 va_s0\n src) else (va_eval_dst_opr64 va_sM dst = va_eval_dst_opr64 va_s0 dst)) /\\ va_state_eq va_sM\n (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0))))\nlet va_lemma_Cmovc64 va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Cmovc64) (va_code_Cmovc64 dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_Cmovc64) dst src)) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_Cmovc64) dst src)) va_s0 in\n (va_sM, va_fM)", "val va_lemma_Check_avx_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_avx_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_avx_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_avx_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_avx_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 71 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 78 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 79 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Newline : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Newline ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_Newline va_b0 va_s0 =\n va_reveal_opaque (`%va_code_Newline) (va_code_Newline ());\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Newline) (S.AnnotateNewline ()))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Newline) (S.AnnotateNewline\n ()))) va_s0 in\n (va_sM, va_fM)", "val va_lemma_Space : va_b0:va_code -> va_s0:va_state -> n:nat\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Space n) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_Space va_b0 va_s0 n =\n va_reveal_opaque (`%va_code_Space) (va_code_Space n);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Space n) (S.AnnotateSpace n))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Space n) (S.AnnotateSpace\n n))) va_s0 in\n (va_sM, va_fM)", "val fmul1_lemma' (code: V.va_code) (_win: bool) (out f1: b64) (f2: uint64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul1_pre code out f1 f2 va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul1_regs_modified fmul1_xmms_modified /\\\n fmul1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out)) ME.loc_none)\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul1_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul1_pre code out f1 f2 va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul1_regs_modified fmul1_xmms_modified /\\\n fmul1_post code out f1 f2 va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n ME.loc_none) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FH.va_lemma_Fmul1 code va_s0 (as_vale_buffer out) (as_vale_buffer f1) (UInt64.v f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n (va_s1, f)", "val va_lemma_mod_6 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_mod_6 ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_reg 26 va_sM == va_get_reg 6 va_sM `op_Modulus` 6 /\\ va_state_eq va_sM (va_update_reg 10\n va_sM (va_update_reg 26 va_sM (va_update_ok va_sM va_s0)))))\nlet va_lemma_mod_6 va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_reg 10; va_Mod_reg 26; va_Mod_ok] in\n let va_qc = va_qcode_mod_6 va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_mod_6 ()) va_qc va_s0 (fun va_s0 va_sM\n va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 554 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 563 column 26 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/ppc64le/Vale.AES.PPC64LE.GCTR.vaf *****\"\n (va_get_reg 26 va_sM == va_get_reg 6 va_sM `op_Modulus` 6)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_reg 10; va_Mod_reg 26; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Compute_Y0 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Compute_Y0 ()) va_s0 /\\ va_get_ok va_s0 /\\\n sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0 /\\ va_state_eq\n va_sM (va_update_flags va_sM (va_update_xmm 1 va_sM (va_update_ok va_sM va_s0)))))\nlet va_lemma_Compute_Y0 va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 1; va_Mod_ok] in\n let va_qc = va_qcode_Compute_Y0 va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Compute_Y0 ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 77 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GHash.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 81 column 39 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GHash.vaf *****\"\n (va_get_xmm 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 1; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Xgetbv_Avx : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Xgetbv_Avx ()) va_s0 /\\ va_get_ok va_s0 /\\\n osxsave_enabled /\\ va_get_reg64 rRcx va_s0 = 0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 2 > 0 == sse_xcr0_enabled /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 4 > 0 == avx_xcr0_enabled /\\ va_state_eq va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))\nlet va_lemma_Xgetbv_Avx va_b0 va_s0 =\n va_reveal_opaque (`%va_code_Xgetbv_Avx) (va_code_Xgetbv_Avx ());\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_Xgetbv))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_Xgetbv))) va_s0 in\n Vale.X64.CPU_Features_s.xgetbv_features ();\n (va_sM, va_fM)", "val va_lemma_Stack_lemma : va_b0:va_code -> va_s0:va_state -> base:operand64 -> offset:int ->\n t:taint\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Stack_lemma ()) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_Stack_lemma va_b0 va_s0 base offset t =\n va_reveal_opaque (`%va_code_Stack_lemma) (va_code_Stack_lemma ());\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let (va_sM, va_fM) = va_lemma_empty_total va_s0 va_b1 in\n (va_sM, va_fM)", "val va_lemma_Check_avx512_xcr0_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_avx512_xcr0_stdcall win) va_s0 /\\ va_get_ok\n va_s0 /\\ osxsave_enabled /\\ avx_xcr0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0)))))))\nlet va_lemma_Check_avx512_xcr0_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax;\n va_Mod_ok] in\n let va_qc = va_qcode_Check_avx512_xcr0_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_avx512_xcr0_stdcall win) va_qc\n va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 176 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 186 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax;\n va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Callee_save_registers : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Callee_save_registers win) va_s0 /\\ va_get_ok va_s0 /\\\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (forall i . Vale.X64.Stack_i.valid_src_stack64 i (va_get_stack va_s0) /\\ va_get_reg64 rRsp\n va_sM + (if win then 224 else 64) <= i ==> Vale.X64.Stack_i.load_stack64 i (va_get_stack va_sM)\n == Vale.X64.Stack_i.load_stack64 i (va_get_stack va_s0)) /\\ va_get_reg64 rRbx va_sM ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM) (va_get_stack va_sM) /\\ va_get_reg64\n rRbp va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8) (va_get_stack va_sM)\n /\\ va_get_reg64 rRdi va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 16)\n (va_get_stack va_sM) /\\ va_get_reg64 rRsi va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64\n rRsp va_sM + 24) (va_get_stack va_sM) /\\ va_get_reg64 rR12 va_sM ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 32) (va_get_stack va_sM) /\\\n va_get_reg64 rR13 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40)\n (va_get_stack va_sM) /\\ va_get_reg64 rR14 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64\n rRsp va_sM + 48) (va_get_stack va_sM) /\\ va_get_reg64 rR15 va_sM ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56) (va_get_stack va_sM) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 6 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 64) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 6 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 72) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 7 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 80) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 7 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 88) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 8 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 96) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 8 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 104) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 9 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 112) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 9 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 120) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 10 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 128) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 10 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 136) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 11 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 144) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 11 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 152) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 12 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 160) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 12 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 168) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 13 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 176) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 13 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 184) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 14 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 192) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 14 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 200) (va_get_stack va_sM)) /\\ (win ==>\n Vale.Arch.Types.hi64 (va_get_xmm 15 va_sM) == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp\n va_sM + 208) (va_get_stack va_sM)) /\\ (win ==> Vale.Arch.Types.lo64 (va_get_xmm 15 va_sM) ==\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 216) (va_get_stack va_sM)) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_reg64 rRax va_sM (va_update_reg64 rRsp\n va_sM (va_update_stack va_sM (va_update_ok va_sM va_s0)))))))\nlet va_lemma_Callee_save_registers va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_reg64 rRax; va_Mod_reg64 rRsp; va_Mod_stack;\n va_Mod_ok] in\n let va_qc = va_qcode_Callee_save_registers va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Callee_save_registers win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 31 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 41 column 152 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (forall i . Vale.X64.Stack_i.valid_src_stack64 i (va_get_stack va_s0) /\\ va_get_reg64 rRsp\n va_sM + va_if win (fun _ -> 224) (fun _ -> 64) <= i ==> Vale.X64.Stack_i.load_stack64 i\n (va_get_stack va_sM) == Vale.X64.Stack_i.load_stack64 i (va_get_stack va_s0)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 43 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rRbx va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 44 column 44 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rRbp va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 45 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rRdi va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 16)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 46 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rRsi va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 24)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 47 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rR12 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 32)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 48 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rR13 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 49 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rR14 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 48)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 50 column 45 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (va_get_reg64 rR15 va_sM == Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56)\n (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 52 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 6 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 64) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 53 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 6 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 72) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 54 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 7 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 80) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 55 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 7 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 88) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 56 column 60 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 8 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 96) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 57 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 8 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 104) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 58 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 9 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 112) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 59 column 61 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 9 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 120) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 60 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 10 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 128) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 61 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 10 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 136) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 62 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 11 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 144) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 63 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 11 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 152) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 64 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 12 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 160) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 65 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 12 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 168) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 66 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 13 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 176) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 67 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 13 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 184) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 68 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 14 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 192) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 69 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 14 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 200) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 70 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.hi64 (va_get_xmm 15 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 208) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 71 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/Vale.X64.Stack.vaf *****\"\n (win ==> Vale.Arch.Types.lo64 (va_get_xmm 15 va_sM) == Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 216) (va_get_stack va_sM))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_reg64 rRax; va_Mod_reg64 rRsp; va_Mod_stack;\n va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Handle_ctr32 : va_b0:va_code -> va_s0:va_state -> ctr_BE:quad32\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Handle_ctr32 ()) va_s0 /\\ va_get_ok va_s0 /\\\n (avx_enabled /\\ sse_enabled /\\ va_get_xmm 1 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32\n ctr_BE)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM, va_get_xmm\n 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15 va_sM) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM\n (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 6 va_sM\n (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM\n (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0)))))))))))))))\nlet va_lemma_Handle_ctr32 va_b0 va_s0 ctr_BE =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm\n 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;\n va_Mod_reg64 rR11; va_Mod_ok] in\n let va_qc = va_qcode_Handle_ctr32 va_mods ctr_BE in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Handle_ctr32 ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 234 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 254 column 107 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESopt.vaf *****\"\n ((va_get_xmm 10 va_sM, va_get_xmm 11 va_sM, va_get_xmm 12 va_sM, va_get_xmm 13 va_sM,\n va_get_xmm 14 va_sM, va_get_xmm 1 va_sM) == xor_reverse_inc32lite_6 2 1 ctr_BE (va_get_xmm 15\n va_sM))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;\n va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;\n va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Check_avx512_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_avx512_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0)))))))))))\nlet va_lemma_Check_avx512_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;\n va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_avx512_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_avx512_stdcall win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 136 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 143 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 144 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;\n va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM\n va_s0;\n (va_sM, va_fM)", "val eval_code_rel (c: BS.code) (va_s0 va_s1: V.va_state) (f: V.va_fuel)\n : Lemma (requires (V.eval_code c va_s0 f va_s1))\n (ensures (eval_code_ts c (SL.state_to_S va_s0) (coerce f) (SL.state_to_S va_s1)))\nlet eval_code_rel (c:BS.code)\n (va_s0 va_s1:V.va_state) (f:V.va_fuel)\n : Lemma\n (requires (V.eval_code c va_s0 f va_s1))\n (ensures (eval_code_ts c (SL.state_to_S va_s0) (coerce f) (SL.state_to_S va_s1)))\n = Vale.AsLowStar.MemoryHelpers.decls_eval_code_reveal c va_s0 va_s1 f", "val va_lemma_Init_ctr : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Init_ctr ()) va_s0 /\\ va_get_ok va_s0 /\\ sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_xmm 4 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0 /\\ va_state_eq\n va_sM (va_update_reg64 rR12 va_sM (va_update_flags va_sM (va_update_xmm 4 va_sM (va_update_ok\n va_sM va_s0))))))\nlet va_lemma_Init_ctr va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_reg64 rR12; va_Mod_flags; va_Mod_xmm 4; va_Mod_ok] in\n let va_qc = va_qcode_Init_ctr va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Init_ctr ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 64 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCTR.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 69 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCTR.vaf *****\"\n (va_get_xmm 4 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 1 0 0 0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_reg64 rR12; va_Mod_flags; va_Mod_xmm 4; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Check_sha_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_sha_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\\ va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64\n rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_sha_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_sha_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_sha_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 52 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 53 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val gctr256_lemma'\n (s: Ghost.erased (Seq.seq nat32))\n (code: V.va_code)\n (_win: bool)\n (in_b: b128)\n (num_bytes: uint64)\n (out_b inout_b keys_b ctr_b: b128)\n (num_blocks: uint64)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires gctr256_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n gctr256_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer in_b) /\\ ME.buffer_writeable (as_vale_buffer keys_b) /\\\n ME.buffer_writeable (as_vale_buffer ctr_b) /\\\n ME.buffer_writeable (as_vale_buffer inout_b) /\\\n ME.buffer_writeable (as_vale_buffer out_b)))\nlet gctr256_lemma'\n (s:Ghost.erased (Seq.seq nat32))\n (code:V.va_code)\n (_win:bool)\n (in_b:b128)\n (num_bytes:uint64)\n (out_b:b128)\n (inout_b:b128)\n (keys_b:b128)\n (ctr_b:b128)\n (num_blocks:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n gctr256_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n gctr256_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer in_b) /\\\n ME.buffer_writeable (as_vale_buffer keys_b) /\\\n ME.buffer_writeable (as_vale_buffer ctr_b) /\\\n ME.buffer_writeable (as_vale_buffer inout_b) /\\\n ME.buffer_writeable (as_vale_buffer out_b)\n )) =\n let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_256\n (as_vale_buffer in_b) (UInt64.v num_bytes)\n (as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)\n (as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;\n (va_s1, f)", "val va_lemma_Vmr : va_b0:va_code -> va_s0:va_state -> dst:va_operand_vec_opr ->\n src:va_operand_vec_opr\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Vmr dst src) va_s0 /\\ va_is_dst_vec_opr dst va_s0 /\\\n va_is_src_vec_opr src va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_eval_vec_opr va_sM dst == va_eval_vec_opr va_sM src /\\ va_state_eq va_sM (va_update_ok va_sM\n (va_update_operand_vec_opr dst va_sM va_s0))))\nlet va_lemma_Vmr va_b0 va_s0 dst src =\n va_reveal_opaque (`%va_code_Vmr) (va_code_Vmr dst src);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (Ins (S.Vmr dst src)) va_s0;\n let (va_sM, va_fM) = va_eval_ins (Ins (S.Vmr dst src)) va_s0 in\n (va_sM, va_fM)", "val va_lemma_Save_registers : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Save_registers win) va_s0 /\\ va_get_ok va_s0 /\\\n sse_enabled /\\ va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 - 8 `op_Multiply` (8 + (if win then (10\n `op_Multiply` 2) else 0)) /\\ Vale.X64.Stack_i.init_rsp (va_get_stack va_sM) ==\n Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Stack_i.valid_stack_slot64s\n (va_get_reg64 rRsp va_sM) (8 + (if win then (10 `op_Multiply` 2) else 0)) (va_get_stack va_sM)\n Secret (va_get_stackTaint va_sM) /\\ Vale.X64.Stack_i.modifies_stack (va_get_reg64 rRsp va_sM)\n (va_get_reg64 rRsp va_s0) (va_get_stack va_s0) (va_get_stack va_sM) /\\\n Vale.X64.Stack_i.modifies_stacktaint (va_get_reg64 rRsp va_sM) (va_get_reg64 rRsp va_s0)\n (va_get_stackTaint va_s0) (va_get_stackTaint va_sM) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 0) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 6\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 6 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 16) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 7\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 24) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 7 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 32) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 8\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 8 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 48) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 9\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 9 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 64) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 10\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 72) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 10 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 80) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 11\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 88) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 11 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 96) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 12\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 104) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 12 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 112) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 13\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 120) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 13 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 128) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 14\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 136) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 14 va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 144) (va_get_stack va_sM) == Vale.Arch.Types.hi64 (va_get_xmm 15\n va_sM)) /\\ (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 152) (va_get_stack\n va_sM) == Vale.Arch.Types.lo64 (va_get_xmm 15 va_sM)) /\\ Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 0 + (if win then 160 else 0)) (va_get_stack va_sM) == va_get_reg64\n rRbx va_sM /\\ Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8 + (if win then 160\n else 0)) (va_get_stack va_sM) == va_get_reg64 rRbp va_sM /\\ Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 16 + (if win then 160 else 0)) (va_get_stack va_sM) == va_get_reg64\n rRdi va_sM /\\ Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 24 + (if win then 160\n else 0)) (va_get_stack va_sM) == va_get_reg64 rRsi va_sM /\\ Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 32 + (if win then 160 else 0)) (va_get_stack va_sM) == va_get_reg64\n rR12 va_sM /\\ Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40 + (if win then 160\n else 0)) (va_get_stack va_sM) == va_get_reg64 rR13 va_sM /\\ Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_sM + 48 + (if win then 160 else 0)) (va_get_stack va_sM) == va_get_reg64\n rR14 va_sM /\\ Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56 + (if win then 160\n else 0)) (va_get_stack va_sM) == va_get_reg64 rR15 va_sM /\\ va_state_eq va_sM\n (va_update_stackTaint va_sM (va_update_flags va_sM (va_update_stack va_sM (va_update_reg64 rRsp\n va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))\nlet va_lemma_Save_registers va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_flags; va_Mod_stack; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Save_registers va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Save_registers win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1397 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1410 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 - 8 `op_Multiply` (8 + va_if win (fun _ ->\n 10 `op_Multiply` 2) (fun _ -> 0))) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1411 column 48 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.init_rsp (va_get_stack va_sM) == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1412 column 91 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.valid_stack_slot64s (va_get_reg64 rRsp va_sM) (8 + va_if win (fun _ -> 10\n `op_Multiply` 2) (fun _ -> 0)) (va_get_stack va_sM) Secret (va_get_stackTaint va_sM)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 1414 column 57 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.modifies_stack (va_get_reg64 rRsp va_sM) (va_get_reg64 rRsp va_s0)\n (va_get_stack va_s0) (va_get_stack va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1415 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.modifies_stacktaint (va_get_reg64 rRsp va_sM) (va_get_reg64 rRsp va_s0)\n (va_get_stackTaint va_s0) (va_get_stackTaint va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1417 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 0) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 6 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1418 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 6 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1419 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 16) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 7 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1420 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 24) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 7 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1421 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 32) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 8 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1422 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 8 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1423 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 48) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 9 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1424 column 62 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 9 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1425 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 64) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 10 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1426 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 72) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 10 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1427 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 80) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 11 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1428 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 88) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 11 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1429 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 96) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 12 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1430 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 104) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 12 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1431 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 112) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 13 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1432 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 120) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 13 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1433 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 128) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 14 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1434 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 136) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 14 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1435 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 144) (va_get_stack va_sM) ==\n Vale.Arch.Types.hi64 (va_get_xmm 15 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1436 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (win ==> Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 152) (va_get_stack va_sM) ==\n Vale.Arch.Types.lo64 (va_get_xmm 15 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1438 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 0 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rRbx va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1439 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 8 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rRbp va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1440 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 16 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rRdi va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1441 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 24 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rRsi va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1442 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 32 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rR12 va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1443 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 40 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rR13 va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1444 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 48 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rR14 va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1445 column 75 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/crypto/aes/x64/Vale.AES.X64.GCMencryptOpt.vaf *****\"\n (Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_sM + 56 + va_if win (fun _ -> 160) (fun _\n -> 0)) (va_get_stack va_sM) == va_get_reg64 rR15 va_sM)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_flags; va_Mod_stack; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Load_one_msb : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Load_one_msb ()) va_s0 /\\ va_get_ok va_s0 /\\\n sse_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216 /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11 va_sM\n (va_update_ok va_sM va_s0))))))\nlet va_lemma_Load_one_msb va_b0 va_s0 =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok] in\n let va_qc = va_qcode_Load_one_msb va_mods in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Load_one_msb ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 143 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 2 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 16777216)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Check_avx_xcr0_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_avx_xcr0_stdcall win) va_s0 /\\ va_get_ok va_s0\n /\\ osxsave_enabled))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0)))))))\nlet va_lemma_Check_avx_xcr0_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax;\n va_Mod_ok] in\n let va_qc = va_qcode_Check_avx_xcr0_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_avx_xcr0_stdcall win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 162 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 171 column 30 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRax;\n va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val fmul2_lemma' (code: V.va_code) (_win: bool) (out f1 f2 tmp: b64) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires fmul2_pre code out f1 f2 tmp va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul_regs_modified fmul_xmms_modified /\\\n fmul2_post code out f1 f2 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\ ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\ ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp)) ME.loc_none))\n (VS.vs_get_vale_heap va_s0)\n (VS.vs_get_vale_heap va_s1)))\nlet fmul2_lemma'\n (code:V.va_code)\n (_win:bool)\n (out:b64)\n (f1:b64)\n (f2:b64)\n (tmp:b64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n fmul2_pre code out f1 f2 tmp va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions va_s0 va_s1 fmul_regs_modified fmul_xmms_modified /\\\n fmul2_post code out f1 f2 tmp va_s0 va_s1 f /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer out) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f1) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer f2) /\\\n ME.buffer_readable (VS.vs_get_vale_heap va_s1) (as_vale_buffer tmp) /\\\n ME.buffer_writeable (as_vale_buffer out) /\\\n ME.buffer_writeable (as_vale_buffer f1) /\\\n ME.buffer_writeable (as_vale_buffer f2) /\\\n ME.buffer_writeable (as_vale_buffer tmp) /\\\n ME.modifies (ME.loc_union (ME.loc_buffer (as_vale_buffer out))\n (ME.loc_union (ME.loc_buffer (as_vale_buffer tmp))\n ME.loc_none)) (VS.vs_get_vale_heap va_s0) (VS.vs_get_vale_heap va_s1)\n )) =\n let va_s1, f = FW.va_lemma_Fmul2 code va_s0 (as_vale_buffer tmp) (as_vale_buffer f1) (as_vale_buffer out) (as_vale_buffer f2) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 out;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f1;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 f2;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt64 ME.TUInt64 tmp;\n (va_s1, f)", "val va_lemma_Memcpy : va_b0:va_code -> va_s0:va_state -> win:bool -> dst:buffer64 -> src:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Memcpy win) va_s0 /\\ va_get_ok va_s0 /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst;\n Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 src]) /\\ Vale.X64.Decls.validSrcAddrs64\n (va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) src 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (if win\n then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) dst 2 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 src == 2 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint64 dst == 2))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==\n Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\\\n Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM\n (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))\nlet va_lemma_Memcpy va_b0 va_s0 win dst src =\n let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Memcpy va_mods win dst src in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Memcpy win) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 45 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 63 column 59 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==\n Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 65 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Vale_memcpy.vaf *****\"\n (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)\n (va_get_mem va_s0) (va_get_mem va_sM))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_mem_heaplet 1; va_Mod_mem_layout; va_Mod_reg64 rR9; va_Mod_reg64\n rRcx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\\ va_get_ok va_s0 /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let dcba = Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let hgfe\n = Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (l_and\n (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo0 dcba) ((va_get_vec 17 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo1 dcba)) ((va_get_vec 18 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi2 dcba)) ((va_get_vec 19 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi3 dcba)) ((va_get_vec 20 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo0 hgfe)) ((va_get_vec 21 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo1 hgfe)) ((va_get_vec 22 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi2 hgfe)) ((va_get_vec 23 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi3 hgfe))\n (Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17\n va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)\n (va_get_vec 22 va_sM) (va_get_vec 23 va_sM) == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash\n dcba hgfe)) /\\ va_state_eq va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM (va_update_vec\n 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec\n 17 va_sM (va_update_vec 16 va_sM (va_update_reg 10 va_sM (va_update_ok va_sM va_s0))))))))))))\nlet va_lemma_Preamble va_b0 va_s0 ctx_b =\n let (va_mods:va_mods_t) = [va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec\n 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 10; va_Mod_ok] in\n let va_qc = va_qcode_Preamble va_mods ctx_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 56 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 79 column 124 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let dcba = Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let hgfe\n = Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (l_and\n (l_and (l_and (l_and (l_and (l_and ((va_get_vec 16 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo0 dcba) ((va_get_vec 17 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo1 dcba)) ((va_get_vec 18 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi2 dcba)) ((va_get_vec 19 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi3 dcba)) ((va_get_vec 20 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo0 hgfe)) ((va_get_vec 21 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__lo1 hgfe)) ((va_get_vec 22 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi2 hgfe)) ((va_get_vec 23 va_sM).hi3 ==\n Vale.Def.Words_s.__proj__Mkfour__item__hi3 hgfe))\n (Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_sM) (va_get_vec 17\n va_sM) (va_get_vec 18 va_sM) (va_get_vec 19 va_sM) (va_get_vec 20 va_sM) (va_get_vec 21 va_sM)\n (va_get_vec 22 va_sM) (va_get_vec 23 va_sM) == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash\n dcba hgfe))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19;\n va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_reg 10; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Fmul_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> tmp_b:buffer64 ->\n inA_b:buffer64 -> dst_b:buffer64 -> inB_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fmul_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (adx_enabled /\\ bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b ==\n inA_b) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.buffers_disjoint tmp_b inB_b /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in\n tmp_b 8 (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == va_mul_nat a b `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64\n rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi\n va_s0) /\\ (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64\n rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0))))))))))))))))))))))))\nlet va_lemma_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fmul_stdcall va_mods win tmp_b inA_b dst_b inB_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 138 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_ok va_sM) /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64\n rRcx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 172 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 173 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 174 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 175 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 177 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 178 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 179 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 182 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 183 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 184 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 185 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 187 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 188 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 189 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 191 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 197 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 199 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 200 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 201 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 202 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 203 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 204 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 205 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 206 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 207 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 208 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 209 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 210 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 211 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 213 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Comment : va_b0:va_code -> va_s0:va_state -> c:string\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Comment c) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_Comment va_b0 va_s0 c =\n va_reveal_opaque (`%va_code_Comment) (va_code_Comment c);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Comment c) (S.AnnotateComment c))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Comment c)\n (S.AnnotateComment c))) va_s0 in\n (va_sM, va_fM)", "val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel\n (requires\n Cons? b0 /\\\n eval_code (Cons?.hd b0) s0 f0 sM /\\\n eval_code (va_Block (Cons?.tl b0)) sM fM sN\n )\n (ensures (fun fN ->\n fN == va_compute_merge_total f0 fM /\\\n eval_code (va_Block b0) s0 fN sN\n ))\nlet va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM", "val va_lemma_merge_total (b0:va_codes) (s0:va_state) (f0:va_fuel) (sM:va_state) (fM:va_fuel) (sN:va_state) : Ghost va_fuel\n (requires\n Cons? b0 /\\\n eval_code (Cons?.hd b0) s0 f0 sM /\\\n eval_code (va_Block (Cons?.tl b0)) sM fM sN\n )\n (ensures (fun fN ->\n fN == va_compute_merge_total f0 fM /\\\n eval_code (va_Block b0) s0 fN sN\n ))\nlet va_lemma_merge_total b0 s0 f0 sM fM sN = Lemmas.lemma_merge_total b0 s0 f0 sM fM sN; Lemmas.compute_merge_total f0 fM", "val va_lemma_Xgetbv_Avx512 : va_b0:va_code -> va_s0:va_state\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Xgetbv_Avx512 ()) va_s0 /\\ va_get_ok va_s0 /\\\n osxsave_enabled /\\ va_get_reg64 rRcx va_s0 = 0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 32 > 0 == opmask_xcr0_enabled /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 64 > 0 == zmm_hi256_xcr0_enabled /\\\n Vale.Arch.Types.iand64 (va_get_reg64 rRax va_sM) 128 > 0 == hi16_zmm_xcr0_enabled /\\\n va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM\n va_s0)))))\nlet va_lemma_Xgetbv_Avx512 va_b0 va_s0 =\n va_reveal_opaque (`%va_code_Xgetbv_Avx512) (va_code_Xgetbv_Avx512 ());\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr (I.ins_Xgetbv))) va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr (I.ins_Xgetbv))) va_s0 in\n Vale.X64.CPU_Features_s.xgetbv_features ();\n (va_sM, va_fM)", "val va_lemma_Preamble : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Preamble ()) va_s0 /\\ va_get_ok va_s0 /\\ (sse_enabled\n /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b\n 2 (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_xmm 7 va_sM == va_get_xmm 8 va_sM /\\ va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour\n #Vale.Def.Types_s.nat32 66051 67438087 134810123 202182159 /\\ (let abcd =\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm\n 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32\n (Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0\n efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)\n (Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==\n Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3\n efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)\n (Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2\n abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==\n Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh))) /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM\n (va_update_xmm 0 va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))\nlet va_lemma_Preamble va_b0 va_s0 ctx_b =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;\n va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Preamble va_mods ctx_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Preamble ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 57 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 74 column 25 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 7 va_sM == va_get_xmm 8 va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 75 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 8 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 66051 67438087 134810123\n 202182159) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 80 column 63 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in l_and (l_and (va_get_xmm\n 1 va_sM == Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32\n (Vale.Def.Words_s.__proj__Mkfour__item__lo1 efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo0\n efgh) (Vale.Def.Words_s.__proj__Mkfour__item__lo1 abcd)\n (Vale.Def.Words_s.__proj__Mkfour__item__lo0 abcd)) (va_get_xmm 2 va_sM ==\n Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 (Vale.Def.Words_s.__proj__Mkfour__item__hi3\n efgh) (Vale.Def.Words_s.__proj__Mkfour__item__hi2 efgh)\n (Vale.Def.Words_s.__proj__Mkfour__item__hi3 abcd) (Vale.Def.Words_s.__proj__Mkfour__item__hi2\n abcd))) (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==\n Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm 1;\n va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val gctr128_lemma'\n (s: Ghost.erased (Seq.seq nat32))\n (code: V.va_code)\n (_win: bool)\n (in_b: b128)\n (num_bytes: uint64)\n (out_b inout_b keys_b ctr_b: b128)\n (num_blocks: uint64)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer in_b) /\\ ME.buffer_writeable (as_vale_buffer keys_b) /\\\n ME.buffer_writeable (as_vale_buffer ctr_b) /\\\n ME.buffer_writeable (as_vale_buffer inout_b) /\\\n ME.buffer_writeable (as_vale_buffer out_b)))\nlet gctr128_lemma'\n (s:Ghost.erased (Seq.seq nat32))\n (code:V.va_code)\n (_win:bool)\n (in_b:b128)\n (num_bytes:uint64)\n (out_b:b128)\n (inout_b:b128)\n (keys_b:b128)\n (ctr_b:b128)\n (num_blocks:uint64)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n gctr128_pre s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n gctr128_post s code in_b num_bytes out_b inout_b keys_b ctr_b num_blocks va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer in_b) /\\\n ME.buffer_writeable (as_vale_buffer keys_b) /\\\n ME.buffer_writeable (as_vale_buffer ctr_b) /\\\n ME.buffer_writeable (as_vale_buffer inout_b) /\\\n ME.buffer_writeable (as_vale_buffer out_b)\n )) =\n let va_s1, f = GC.va_lemma_Gctr_bytes_stdcall code va_s0 IA.win AES_128\n (as_vale_buffer in_b) (UInt64.v num_bytes)\n (as_vale_buffer out_b) (as_vale_buffer inout_b) (as_vale_buffer keys_b)\n (as_vale_buffer ctr_b) (UInt64.v num_blocks) (Ghost.reveal s) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 out_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 inout_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 keys_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 ctr_b;\n (va_s1, f)", "val va_lemma_Fsqr_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> tmp_b:buffer64 ->\n inA_b:buffer64 -> dst_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fsqr_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\\n bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem\n va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64\n (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in tmp_b 8 (va_get_mem_layout va_s0)\n Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d = Vale.Curve25519.Fast_defs.pow2_four\n d0 d1 d2 d3 in d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))\nlet va_lemma_Fsqr_stdcall va_b0 va_s0 win tmp_b inA_b dst_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;\n va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fsqr_stdcall va_mods win tmp_b inA_b dst_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fsqr_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 561 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_ok va_sM) /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 590 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 591 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 592 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 593 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 595 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 596 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 597 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 598 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 600 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 601 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 603 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 609 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 612 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 613 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 614 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 615 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 616 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 617 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 618 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 619 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 620 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 621 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 622 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 623 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 624 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 625 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 626 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 628 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;\n va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_Check_sse_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_sse_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_sse_stdcall win) ([va_Mod_flags;\n va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_sse_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_sse_stdcall (va_code_Check_sse_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)\n (requires True)\n (ensures (fun (sM, fM) ->\n s0 == sM /\\\n eval_code (va_Block []) s0 fM sM\n ))\nlet va_lemma_empty_total = Lemmas.lemma_empty_total", "val va_lemma_empty_total (s0:va_state) (bN:va_codes) : Ghost (va_state & va_fuel)\n (requires True)\n (ensures (fun (sM, fM) ->\n s0 == sM /\\\n eval_code (va_Block []) s0 fM sM\n ))\nlet va_lemma_empty_total = Lemmas.lemma_empty_total", "val va_wpProof_Check_avx2_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_avx2_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx2_stdcall win)\n ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_avx2_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_avx2_stdcall (va_code_Check_avx2_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Check_avx512_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_avx512_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx512_stdcall win)\n ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rRdx;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_avx512_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_avx512_stdcall (va_code_Check_avx512_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR11 va_sM (va_update_reg64\n rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9;\n va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Check_aesni_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Check_aesni_stdcall win) va_s0 /\\ va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\\ pclmulqdq_enabled) /\\ va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64\n rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0)))))))))\nlet va_lemma_Check_aesni_stdcall va_b0 va_s0 win =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok] in\n let va_qc = va_qcode_Check_aesni_stdcall va_mods win in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Check_aesni_stdcall win) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 29 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 38 column 56 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\\ pclmulqdq_enabled) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 39 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/lib/util/x64/stdcalls/Vale.Lib.X64.Cpuidstdcall.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_load_one_msb : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_load_one_msb va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_load_one_msb ()) ([va_Mod_flags;\n va_Mod_xmm 2; va_Mod_reg64 rR11]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_load_one_msb va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_load_one_msb (va_code_load_one_msb ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 2 va_sM (va_update_reg64 rR11\n va_sM (va_update_ok va_sM va_s0)))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 2; va_Mod_reg64 rR11]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Test : va_b0:va_code -> va_s0:va_state -> win:bool -> arg0:buffer64 -> arg1:buffer64\n -> arg2:buffer64 -> arg3:buffer64 -> arg4:buffer64 -> arg5:buffer64 -> arg6:buffer64 ->\n arg7:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Test win) va_s0 /\\ va_get_ok va_s0 /\\ va_get_reg64\n rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0)) /\\ (win ==>\n Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0))\n /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 16)\n (va_get_stack va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 24) (va_get_stack va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_src_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) /\\ (~win ==>\n Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) arg0 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else\n va_get_reg64 rRsi va_s0) arg1 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) arg2 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) arg3 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else va_get_reg64 rR8 va_s0) arg4 0\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0)\n else va_get_reg64 rR9 va_s0) arg5 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 16) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) arg6 0 (va_get_mem_layout va_s0) Secret\n /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 24) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) arg7 0 (va_get_mem_layout va_s0)\n Secret))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\ va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0 /\\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\\ va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0 /\\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\\ va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0 /\\ va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0 /\\\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi\n va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\ (win\n ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==> va_get_xmm 8 va_sM == va_get_xmm 8\n va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ (win ==> va_get_xmm 10 va_sM ==\n va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ (win ==>\n va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==> va_get_xmm 13 va_sM == va_get_xmm 13\n va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ (win ==> va_get_xmm 15 va_sM\n == va_get_xmm 15 va_s0) /\\ Vale.X64.Decls.modifies_mem loc_none (va_get_mem va_s0) (va_get_mem\n va_sM) /\\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM\n (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM\n (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM\n (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM\n (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64\n rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0)))))))))))))))))))))))))))))))))))))))\nlet va_lemma_Test va_b0 va_s0 win arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 =\n let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_xmm 15;\n va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;\n va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm\n 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13;\n va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;\n va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Test va_mods win arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Test win) va_qc va_s0 (fun va_s0 va_sM\n va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 21 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 58 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 59 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 60 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 61 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 62 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 63 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 64 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 65 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 66 column 32 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 67 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 68 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 69 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 70 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 71 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 72 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 73 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 74 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 75 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 76 column 36 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 77 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/test/Vale.Test.X64.Args.vaf *****\"\n (Vale.X64.Decls.modifies_mem loc_none (va_get_mem va_s0) (va_get_mem va_sM))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_xmm 15;\n va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9;\n va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm\n 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13;\n va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8;\n va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx;\n va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Fsub_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> dst_b:buffer64 ->\n inA_b:buffer64 -> inB_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fsub_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\\n bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 4\n (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == (a - b) `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM ==\n va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13\n va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0))))))))))))))))))))))))\nlet va_lemma_Fsub_stdcall va_b0 va_s0 win dst_b inA_b inB_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fsub_stdcall va_mods win dst_b inA_b inB_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fsub_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1009 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (va_get_ok va_sM) /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1036 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1037 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1038 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1039 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1041 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1042 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1043 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1044 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1046 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1047 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1048 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1049 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1051 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1052 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1053 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 1055 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (d `op_Modulus` prime == (a - b) `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1061 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1063 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1064 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1065 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1066 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1067 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1068 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1069 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1070 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1071 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1072 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1073 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1074 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1075 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 1077 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_Mov64 : dst:va_operand_dst_opr64 -> src:va_operand_opr64 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mov64 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov64 dst src) ([va_mod_dst_opr64\n dst]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mov64 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mov64 (va_code_Mov64 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_dst_opr64 dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_dst_opr64 dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Epilogue : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Epilogue ()) va_s0 /\\ va_get_ok va_s0 /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n ((let dcba = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_vec 16 va_s0).hi3)\n ((va_get_vec 17 va_s0).hi3) ((va_get_vec 18 va_s0).hi3) ((va_get_vec 19 va_s0).hi3) in let hgfe\n = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_vec 20 va_s0).hi3) ((va_get_vec 21\n va_s0).hi3) ((va_get_vec 22 va_s0).hi3) ((va_get_vec 23 va_s0).hi3) in l_and (l_and (dcba ==\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM)) (hgfe ==\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM)))\n (Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_s0) (va_get_vec 17\n va_s0) (va_get_vec 18 va_s0) (va_get_vec 19 va_s0) (va_get_vec 20 va_s0) (va_get_vec 21 va_s0)\n (va_get_vec 22 va_s0) (va_get_vec 23 va_s0) == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash\n dcba hgfe)) /\\ Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0)\n (va_get_mem_heaplet 0 va_sM)) /\\ va_state_eq va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_vec 22 va_sM (va_update_vec 20 va_sM (va_update_vec 18 va_sM (va_update_vec 16 va_sM\n (va_update_reg 10 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))\nlet va_lemma_Epilogue va_b0 va_s0 ctx_b =\n let (va_mods:va_mods_t) = [va_Mod_mem_heaplet 0; va_Mod_vec 22; va_Mod_vec 20; va_Mod_vec 18;\n va_Mod_vec 16; va_Mod_reg 10; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Epilogue va_mods ctx_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Epilogue ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 106 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 123 column 129 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let dcba = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_vec 16 va_s0).hi3)\n ((va_get_vec 17 va_s0).hi3) ((va_get_vec 18 va_s0).hi3) ((va_get_vec 19 va_s0).hi3) in let hgfe\n = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_vec 20 va_s0).hi3) ((va_get_vec 21\n va_s0).hi3) ((va_get_vec 22 va_s0).hi3) ((va_get_vec 23 va_s0).hi3) in l_and (l_and (dcba ==\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM)) (hgfe ==\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM)))\n (Vale.SHA.PPC64LE.SHA_helpers.make_seperated_hash_quad32 (va_get_vec 16 va_s0) (va_get_vec 17\n va_s0) (va_get_vec 18 va_s0) (va_get_vec 19 va_s0) (va_get_vec 20 va_s0) (va_get_vec 21 va_s0)\n (va_get_vec 22 va_s0) (va_get_vec 23 va_s0) == Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash\n dcba hgfe)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 125 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_mem_heaplet 0; va_Mod_vec 22; va_Mod_vec 20; va_Mod_vec 18;\n va_Mod_vec 16; va_Mod_reg 10; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Handle_ctr32_2 : va_b0:va_code -> va_s0:va_state -> ctr_BE:quad32\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Handle_ctr32_2 ()) va_s0 /\\ va_get_ok va_s0 /\\\n (avx_enabled /\\ sse_enabled /\\ va_get_xmm 0 va_s0 == Vale.Def.Words_s.Mkfour\n #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\\ va_get_xmm 1 va_s0 ==\n Vale.Def.Types_s.reverse_bytes_quad32 ctr_BE)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_xmm 10 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 1)) (va_get_xmm 4 va_sM) /\\ va_get_xmm 11 va_sM ==\n Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite\n ctr_BE 2)) (va_get_xmm 4 va_sM) /\\ va_get_xmm 12 va_sM == Vale.Def.Types_s.quad32_xor\n (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE 3)) (va_get_xmm 4 va_sM)\n /\\ va_get_xmm 13 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 4)) (va_get_xmm 4 va_sM) /\\ va_get_xmm 14 va_sM ==\n Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite\n ctr_BE 5)) (va_get_xmm 4 va_sM) /\\ va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 6)) /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm\n 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm\n 10 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1\n va_sM (va_update_reg64 rR11 va_sM (va_update_ok va_sM va_s0))))))))))))))\nlet va_lemma_Handle_ctr32_2 va_b0 va_s0 ctr_BE =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm\n 11; va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR11;\n va_Mod_ok] in\n let va_qc = va_qcode_Handle_ctr32_2 va_mods ctr_BE in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Handle_ctr32_2 ()) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 224 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 246 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 10 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 1)) (va_get_xmm 4 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 247 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 11 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 2)) (va_get_xmm 4 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 248 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 12 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 3)) (va_get_xmm 4 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 249 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 13 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 4)) (va_get_xmm 4 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 250 column 77 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 14 va_sM == Vale.Def.Types_s.quad32_xor (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.AES.GCTR.inc32lite ctr_BE 5)) (va_get_xmm 4 va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 251 column 72 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/aes/Vale.AES.X64.AESGCM.vaf *****\"\n (va_get_xmm 1 va_sM == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GCTR.inc32lite ctr_BE\n 6)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;\n va_Mod_xmm 10; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_reg64 rR11;\n va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_Check_avx_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_avx_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_avx_stdcall win) ([va_Mod_flags;\n va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_avx_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_avx_stdcall (va_code_Check_avx_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Fadd_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> dst_b:buffer64 ->\n inA_b:buffer64 -> inB_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fadd_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\\n bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 4\n (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == (a + b) `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM ==\n va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13\n va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0))))))))))))))))))))))))\nlet va_lemma_Fadd_stdcall va_b0 va_s0 win dst_b inA_b inB_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fadd_stdcall va_mods win dst_b inA_b inB_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fadd_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 852 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (va_get_ok va_sM) /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 879 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 880 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 881 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 882 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 884 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 885 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 886 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 887 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 889 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 890 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 891 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 892 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 894 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 895 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 896 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 898 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (d `op_Modulus` prime == (a + b) `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 904 column 46 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 906 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 907 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 908 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 909 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 910 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 911 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 912 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 913 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 914 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 915 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 916 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 917 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 918 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 920 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastHybrid.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0)))))))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_Mov128 : dst:va_operand_xmm -> src:va_operand_xmm -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Mov128 dst src va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Mov128 dst src) ([va_mod_xmm dst])\n va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Mov128 dst src va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Mov128 (va_code_Mov128 dst src) va_s0 dst src in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_ok va_sM (va_update_operand_xmm dst va_sM va_s0)));\n va_lemma_norm_mods ([va_mod_xmm dst]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Epilogue : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Epilogue ()) va_s0 /\\ va_get_ok va_s0 /\\ (sse_enabled\n /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b\n 2 (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n ((let abcd = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_xmm 1 va_s0).hi3)\n ((va_get_xmm 1 va_s0).hi2) ((va_get_xmm 2 va_s0).hi3) ((va_get_xmm 2 va_s0).hi2) in let efgh =\n Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_xmm 1 va_s0).lo1) ((va_get_xmm 1\n va_s0).lo0) ((va_get_xmm 2 va_s0).lo1) ((va_get_xmm 2 va_s0).lo0) in l_and (l_and (abcd ==\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM)) (efgh ==\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM)))\n (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==\n Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) /\\ Vale.X64.Decls.modifies_buffer128 ctx_b\n (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0 va_sM)) /\\ va_state_eq va_sM\n (va_update_flags va_sM (va_update_mem_heaplet 0 va_sM (va_update_xmm 7 va_sM (va_update_xmm 2\n va_sM (va_update_xmm 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))\nlet va_lemma_Epilogue va_b0 va_s0 ctx_b =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 7; va_Mod_xmm 2;\n va_Mod_xmm 1; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Epilogue va_mods ctx_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Epilogue ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 583 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 603 column 73 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let abcd = Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_xmm 1 va_s0).hi3)\n ((va_get_xmm 1 va_s0).hi2) ((va_get_xmm 2 va_s0).hi3) ((va_get_xmm 2 va_s0).hi2) in let efgh =\n Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 ((va_get_xmm 1 va_s0).lo1) ((va_get_xmm 1\n va_s0).lo0) ((va_get_xmm 2 va_s0).lo1) ((va_get_xmm 2 va_s0).lo0) in l_and (l_and (abcd ==\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM)) (efgh ==\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM)))\n (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==\n Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 606 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 7; va_Mod_xmm 2; va_Mod_xmm\n 1; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_wpProof_Xgetbv_Avx : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Xgetbv_Avx va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx ()) ([va_Mod_reg64 rRdx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Xgetbv_Avx va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Xgetbv_Avx (va_code_Xgetbv_Avx ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Check_aesni_stdcall : win:bool -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Check_aesni_stdcall win va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Check_aesni_stdcall win)\n ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Check_aesni_stdcall win va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Check_aesni_stdcall (va_code_Check_aesni_stdcall win) va_s0 win in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx\n va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM va_s0))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_reg64 rR9; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Fsqr2_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> tmp_b:buffer64 ->\n inA_b:buffer64 -> dst_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fsqr2_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\\n bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem\n va_s0) dst_in dst_b 8 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64\n (va_get_mem va_s0) inA_in inA_b 8 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in tmp_b 16 (va_get_mem_layout va_s0)\n Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let a0' =\n Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let a1' =\n Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d0' =\n Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in let d1' =\n Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in let d2' =\n Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let a' = Vale.Curve25519.Fast_defs.pow2_four\n a0' a1' a2' a3' in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a a\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' a' `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))\nlet va_lemma_Fsqr2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;\n va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fsqr2_stdcall va_mods win tmp_b inA_b dst_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fsqr2_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 748 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_ok va_sM) /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 777 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 778 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 779 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 780 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 781 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 782 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 783 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 784 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 786 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 787 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 788 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 789 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 790 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 791 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 792 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 793 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 795 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 796 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1\n \"***** POSTCONDITION NOT MET AT line 797 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 798 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1\n \"***** POSTCONDITION NOT MET AT line 800 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 801 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d' `op_Modulus` prime == va_mul_nat a' a' `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 807 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 810 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 811 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 812 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 813 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 814 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 815 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 816 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 817 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 818 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 819 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 820 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 821 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 822 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 823 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 824 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 826 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12;\n va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp;\n va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx;\n va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_req_Check_movbe_stdcall (va_b0: va_code) (va_s0: va_state) (win: bool) : prop\nlet va_req_Check_movbe_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) : prop =\n (va_require_total va_b0 (va_code_Check_movbe_stdcall win) va_s0 /\\ va_get_ok va_s0)", "val va_wpProof_mod_6 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_mod_6 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_mod_6 ()) ([va_Mod_reg 10; va_Mod_reg\n 26]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_mod_6 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_mod_6 (va_code_mod_6 ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg 10 va_sM (va_update_reg 26 va_sM (va_update_ok va_sM\n va_s0))));\n va_lemma_norm_mods ([va_Mod_reg 10; va_Mod_reg 26]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_lemma_Fmul2_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool -> tmp_b:buffer64 ->\n inA_b:buffer64 -> dst_b:buffer64 -> inB_b:buffer64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Fmul2_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (adx_enabled /\\ bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b ==\n inA_b) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.buffers_disjoint tmp_b inB_b /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 8 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 8 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 8\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in\n tmp_b 16 (va_get_mem_layout va_s0) Secret)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let\n a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let b0' =\n Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in let b1' =\n Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in let b2' =\n Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in let b3' =\n Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in let a' =\n Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in let b' =\n Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in let d0 = Vale.X64.Decls.buffer64_read\n dst_b 0 (va_get_mem va_sM) in let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM)\n in let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d0' = Vale.X64.Decls.buffer64_read dst_b\n (0 + 4) (va_get_mem va_sM) in let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem\n va_sM) in let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a b\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==>\n va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM ==\n va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\\n va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ va_state_eq va_sM (va_update_stackTaint\n va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64\n rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))\nlet va_lemma_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Fmul2_stdcall va_mods win tmp_b inA_b dst_b inB_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Fmul2_stdcall win) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 356 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_ok va_sM) /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (dst_in:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64\n rRcx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 390 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 391 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 392 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 393 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3 = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 395 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b0 = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 396 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b1 = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 397 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b2 = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 398 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b3 = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 400 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 401 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 403 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 404 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 405 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a2' = Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 406 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a3' = Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 408 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b0' = Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 409 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b1' = Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 410 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b2' = Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 411 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b3' = Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 413 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let a' = Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in label va_range1\n \"***** POSTCONDITION NOT MET AT line 414 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let b' = Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in label va_range1\n \"***** POSTCONDITION NOT MET AT line 416 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 417 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 418 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 419 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3 = Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 421 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in label va_range1\n \"***** POSTCONDITION NOT MET AT line 423 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d0' = Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 424 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 425 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 426 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d3' = Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 428 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (let d' = Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in label va_range1\n \"***** POSTCONDITION NOT MET AT line 430 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d `op_Modulus` prime == va_mul_nat a b `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 431 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 437 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 439 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 440 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 441 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 442 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 443 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 444 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 445 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 446 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 447 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 448 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 449 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 450 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 451 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 453 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/rfc7748/curve25519/x64/Vale.Curve25519.X64.FastWide.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0))))))))))))))))))))))))))))))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR11;\n va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp;\n va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx;\n va_Mod_reg64 rRax; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Prefetchnta : va_b0:va_code -> va_s0:va_state -> v:va_operand_opr64\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Prefetchnta v) va_s0 /\\ va_is_src_opr64 v va_s0 /\\\n va_get_ok va_s0))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n va_state_eq va_sM (va_update_ok va_sM va_s0)))\nlet va_lemma_Prefetchnta va_b0 va_s0 v =\n va_reveal_opaque (`%va_code_Prefetchnta) (va_code_Prefetchnta v);\n let (va_old_s:va_state) = va_s0 in\n va_ins_lemma (mk_ins (make_instr_annotate (I.ins_Prefetchnta) (S.AnnotatePrefetchnta ()) v))\n va_s0;\n let (va_sM, va_fM) = va_eval_ins (mk_ins (make_instr_annotate (I.ins_Prefetchnta)\n (S.AnnotatePrefetchnta ()) v)) va_s0 in\n (va_sM, va_fM)", "val va_wpProof_Xgetbv_Avx512 : va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Xgetbv_Avx512 va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Xgetbv_Avx512 ()) ([va_Mod_reg64 rRdx;\n va_Mod_reg64 rRax]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Xgetbv_Avx512 va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Xgetbv_Avx512 (va_code_Xgetbv_Avx512 ()) va_s0 in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRax va_sM (va_update_ok\n va_sM va_s0))));\n va_lemma_norm_mods ([va_Mod_reg64 rRdx; va_Mod_reg64 rRax]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.aesni_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_movbe_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.vm_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_movbe_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Test.fst", "name": "Vale.AsLowStar.Test.ta_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Aes.fsti", "name": "Vale.Stdcalls.X64.Aes.key256_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.Transform.fst", "name": "Vale.Transformers.Transform.lemma_movbe_elim" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsub.fsti", "name": "Vale.Stdcalls.X64.Fsub.fsub_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Poly.fsti", "name": "Vale.Stdcalls.X64.Poly.poly_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.sha_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.fsub_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fswap.fsti", "name": "Vale.Stdcalls.X64.Fswap.cswap_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Aes.fsti", "name": "Vale.Stdcalls.X64.Aes.key128_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.fsqr_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuid.fst", "name": "Vale.Lib.X64.Cpuid.va_lemma_Check_movbe_support" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.fadd_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.fsqr_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fswap_inline.fst", "name": "Vale.Inline.X64.Fswap_inline.cswap_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fadd.fsti", "name": "Vale.Stdcalls.X64.Fadd.add1_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.Transform.fst", "name": "Vale.Transformers.Transform.lemma_mov_mov_elim" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.key256_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fsqr.fsti", "name": "Vale.Stdcalls.X64.Fsqr.fsqr2_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.fadd_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Cpuid_Movbe" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fsqr_inline.fst", "name": "Vale.Inline.X64.Fsqr_inline.fsqr2_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fadd_inline.fst", "name": "Vale.Inline.X64.Fadd_inline.add1_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuid.fst", "name": "Vale.Lib.X64.Cpuid.va_wpProof_Check_movbe_support" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_lemma_Mov128" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Cpuid_Movbe" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Mov64" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsBasic.fst", "name": "Vale.PPC64LE.InsBasic.va_lemma_Move" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul2_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCTR.fst", "name": "Vale.AES.PPC64LE.GCTR.va_lemma_Mod_cr0" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.Loop.fst", "name": "Vale.SHA.PPC64LE.Loop.va_lemma_Mod_cr0" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GHash.fst", "name": "Vale.AES.PPC64LE.GHash.va_lemma_Mod_cr0" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_sse_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_movbe_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_avx2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.key128_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Fmul.fsti", "name": "Vale.Stdcalls.X64.Fmul.fmul1_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_NoNewline" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_lemma_load_one_msb" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Cmovc64" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_avx_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Newline" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Space" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul1_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCTR.fst", "name": "Vale.AES.PPC64LE.GCTR.va_lemma_mod_6" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GHash.fst", "name": "Vale.AES.X64.GHash.va_lemma_Compute_Y0" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Xgetbv_Avx" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsStack.fst", "name": "Vale.X64.InsStack.va_lemma_Stack_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_avx512_xcr0_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Stack.fst", "name": "Vale.X64.Stack.va_lemma_Callee_save_registers" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_lemma_Handle_ctr32" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_avx512_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AsLowStar.Wrapper.fst", "name": "Vale.AsLowStar.Wrapper.eval_code_rel" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCTR.fst", "name": "Vale.AES.X64.GCTR.va_lemma_Init_ctr" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_sha_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.gctr256_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.InsVector.fst", "name": "Vale.PPC64LE.InsVector.va_lemma_Vmr" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fst", "name": "Vale.AES.X64.GCMencryptOpt.va_lemma_Save_registers" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESGCM.fst", "name": "Vale.AES.X64.AESGCM.va_lemma_Load_one_msb" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_avx_xcr0_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Inline.X64.Fmul_inline.fst", "name": "Vale.Inline.X64.Fmul_inline.fmul2_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fst", "name": "Vale.Test.X64.Vale_memcpy.va_lemma_Memcpy" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_lemma_Preamble" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fst", "name": "Vale.Curve25519.X64.FastWide.va_lemma_Fmul_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Comment" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fst", "name": "Vale.PPC64LE.Decls.va_lemma_merge_total" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fst", "name": "Vale.X64.Decls.va_lemma_merge_total" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Xgetbv_Avx512" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Preamble" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.gctr128_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fst", "name": "Vale.Curve25519.X64.FastWide.va_lemma_Fsqr_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_sse_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Decls.fst", "name": "Vale.X64.Decls.va_lemma_empty_total" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fst", "name": "Vale.PPC64LE.Decls.va_lemma_empty_total" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_avx2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_avx512_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_lemma_Check_aesni_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESopt.fst", "name": "Vale.AES.X64.AESopt.va_wpProof_load_one_msb" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Args.fst", "name": "Vale.Test.X64.Args.va_lemma_Test" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fst", "name": "Vale.Curve25519.X64.FastHybrid.va_lemma_Fsub_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Mov64" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_lemma_Epilogue" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AESGCM.fst", "name": "Vale.AES.X64.AESGCM.va_lemma_Handle_ctr32_2" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_avx_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fst", "name": "Vale.Curve25519.X64.FastHybrid.va_lemma_Fadd_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsVector.fst", "name": "Vale.X64.InsVector.va_wpProof_Mov128" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Epilogue" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Xgetbv_Avx" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fst", "name": "Vale.Lib.X64.Cpuidstdcall.va_wpProof_Check_aesni_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fst", "name": "Vale.Curve25519.X64.FastWide.va_lemma_Fsqr2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_req_Check_movbe_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCTR.fst", "name": "Vale.AES.PPC64LE.GCTR.va_wpProof_mod_6" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fst", "name": "Vale.Curve25519.X64.FastWide.va_lemma_Fmul2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_lemma_Prefetchnta" }, { "project_name": "hacl-star", "file_name": "Vale.X64.InsBasic.fst", "name": "Vale.X64.InsBasic.va_wpProof_Xgetbv_Avx512" } ], "selected_premises": [ "Vale.Stdcalls.X64.Cpuid.sha_lemma'", "Vale.X64.QuickCode.va_Mod_flags", "Vale.X64.QuickCode.va_Mod_stack", "Vale.X64.QuickCode.va_Mod_mem_layout", "Vale.X64.QuickCode.va_Mod_mem", "Vale.Stdcalls.X64.Cpuid.avx_lemma'", "Vale.Stdcalls.X64.Cpuid.adx_lemma'", "Vale.X64.QuickCode.va_Mod_reg64", "Vale.X64.QuickCode.va_Mod_xmm", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_sha_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_adx_bmi2_stdcall", "Vale.X64.QuickCode.va_Mod_mem_heaplet", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_movbe_stdcall", "Vale.Stdcalls.X64.Cpuid.avx2_lemma'", "Vale.X64.QuickCode.va_Mod_stackTaint", "Vale.Stdcalls.X64.Cpuid.aesni_lemma'", "Vale.X64.QuickCode.va_Mod_ok", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_osxsave_stdcall", "Vale.X64.Decls.va_state_eq", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx2_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx_xcr0_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_rdrand_stdcall", "Vale.X64.Decls.va_update_reg64", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx512_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_aesni_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_sse_stdcall", "Vale.X64.QuickCode.va_QProc", "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx512_xcr0_stdcall", "Vale.X64.Decls.va_update_xmm", "Vale.X64.Decls.va_reveal_opaque", "Vale.X64.Decls.va_update_mem_heaplet", "Vale.AsLowStar.ValeSig.vale_sig_nil", "Vale.X64.QuickCode.va_mod_heaplet", "Vale.X64.Decls.va_update_ok", "Vale.X64.Decls.va_update_mem_layout", "Vale.X64.QuickCode.va_mod_reg_opr64", "Vale.X64.Decls.va_update_flags", "Vale.X64.QuickCode.va_mod_xmm", "Vale.X64.Decls.va_update_stack", "Vale.X64.Decls.va_update_mem", "Vale.X64.QuickCode.va_mods_t", "Vale.X64.QuickCodes.va_range1", "Vale.X64.Decls.va_update_operand_xmm", "Vale.X64.Machine_s.rR15", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR9", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_sha_stdcall", "Vale.X64.Decls.va_tl", "Vale.X64.Machine_s.rR10", "Vale.X64.Machine_s.rR13", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rR11", "Vale.X64.Decls.va_op_heaplet_mem_heaplet", "Vale.X64.InsBasic.va_wp_Newline", "Vale.X64.Machine_s.rR12", "Vale.X64.Machine_s.rRax", "Vale.X64.Machine_s.rRcx", "Vale.Stdcalls.X64.Cpuid.movbe_post", "Vale.X64.Machine_s.rRbx", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_movbe_stdcall", "Vale.X64.Machine_s.rRdx", "Vale.X64.Machine_s.rRsi", "Vale.Lib.X64.Cpuidstdcall.va_req_Check_movbe_stdcall", "Vale.X64.Machine_s.rRbp", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_sse_stdcall", "Vale.X64.Decls.va_update_stackTaint", "Vale.X64.Machine_s.rRsp", "Vale.X64.Machine_s.rRdi", "Vale.X64.Decls.va_op_xmm_xmm", "Vale.Stdcalls.X64.Cpuid.avx_post", "Vale.Stdcalls.X64.Cpuid.movbe_pre", "Vale.X64.Decls.va_op_reg_opr64_reg64", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_osxsave_stdcall", "Vale.X64.Decls.update_register", "Vale.X64.QuickCode.va_Mod_None", "Vale.Lib.X64.Cpuidstdcall.va_req_Check_sha_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_rdrand_stdcall", "Vale.X64.Decls.va_CNil", "Vale.Stdcalls.X64.Cpuid.avx2_post", "Vale.X64.Instruction_s.out", "Vale.X64.Decls.va_update_operand_heaplet", "Vale.X64.Instruction_s.opFlagsCf", "Vale.Stdcalls.X64.Cpuid.sha_post", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_adx_bmi2_stdcall", "Vale.X64.QuickCode.va_quickCode", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_aesni_stdcall", "Vale.X64.Instruction_s.inOut", "Vale.Stdcalls.X64.Cpuid.adx_post", "Vale.Stdcalls.X64.Cpuid.aesni_post", "Vale.X64.Decls.va_coerce_reg_opr64_to_dst_opr64", "Vale.X64.InsBasic.va_wp_Space", "Vale.X64.Decls.va_op_dst_opr64_reg64", "Vale.X64.Decls.va_ensure_total", "Vale.X64.Decls.va_coerce_reg_opr64_to_opr64", "Vale.Lib.X64.Cpuidstdcall.va_req_Check_rdrand_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_req_Check_avx_xcr0_stdcall", "Vale.Lib.X64.Cpuidstdcall.va_wp_Check_avx2_stdcall", "Vale.X64.Decls.va_update_operand_dst_opr64", "Vale.X64.QuickCodes.label" ], "source_upto_this": "module Vale.Stdcalls.X64.Cpuid\n\nopen FStar.Mul\nopen Vale.Interop.Base\nmodule IX64 = Vale.Interop.X64\nmodule VSig = Vale.AsLowStar.ValeSig\nmodule LSig = Vale.AsLowStar.LowStarSig\nmodule V = Vale.X64.Decls\nmodule IA = Vale.Interop.Assumptions\nmodule W = Vale.AsLowStar.Wrapper\nopen Vale.X64.MemoryAdapters\n\nmodule VC = Vale.Lib.X64.Cpuidstdcall\n\n(* A little utility to trigger normalization in types *)\nnoextract\nlet as_t (#a:Type) (x:normal a) : a = x\nnoextract\nlet as_normal_t (#a:Type) (x:a) : normal a = x\n\n[@__reduce__] noextract\nlet dom: IX64.arity_ok_stdcall td = []\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet aesni_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_aesni_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet aesni_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_aesni_stdcall c va_s0 IA.win va_s1 f\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract\nlet aesni_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n aesni_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n aesni_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_aesni_stdcall code va_s0 IA.win\n\n(* Prove that vm_lemma' has the required type *)\nnoextract\nlet aesni_lemma = as_t #(VSig.vale_sig_stdcall aesni_pre aesni_post) aesni_lemma'\nnoextract\nlet code_aesni = VC.va_code_Check_aesni_stdcall IA.win\n\n(* Here's the type expected for the check_aesni wrapper *)\n[@__reduce__] noextract\nlet lowstar_aesni_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_aesni\n dom\n []\n _\n _\n (W.mk_prediction code_aesni dom [] (aesni_lemma code_aesni IA.win))\n\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet sha_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_sha_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet sha_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_sha_stdcall c va_s0 IA.win va_s1 f\n\nopen Vale.X64.Machine_s\nopen Vale.X64.State\n\n#set-options \"--z3rlimit 20\"\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract\nlet sha_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n sha_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_sha_stdcall code va_s0 IA.win\n\n(* Prove that vm_lemma' has the required type *)\nnoextract\nlet sha_lemma = as_t #(VSig.vale_sig_stdcall sha_pre sha_post) sha_lemma'\nnoextract\nlet code_sha = VC.va_code_Check_sha_stdcall IA.win\n\n(* Here's the type expected for the check_aesni wrapper *)\n[@__reduce__] noextract\nlet lowstar_sha_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_sha\n dom\n []\n _\n _\n (W.mk_prediction code_sha dom [] (sha_lemma code_sha IA.win))\n\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet adx_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_adx_bmi2_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet adx_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_adx_bmi2_stdcall c va_s0 IA.win va_s1 f\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract\nlet adx_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n adx_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n adx_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_adx_bmi2_stdcall code va_s0 IA.win\n\n(* Prove that vm_lemma' has the required type *)\nnoextract\nlet adx_lemma = as_t #(VSig.vale_sig_stdcall adx_pre adx_post) adx_lemma'\nnoextract\nlet code_adx = VC.va_code_Check_adx_bmi2_stdcall IA.win\n\n(* Here's the type expected for the check_adx wrapper *)\n[@__reduce__] noextract\nlet lowstar_adx_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_adx\n dom\n []\n _\n _\n (W.mk_prediction code_adx dom [] (adx_lemma code_adx IA.win))\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet avx_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_avx_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet avx_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_avx_stdcall c va_s0 IA.win va_s1 f\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract\nlet avx_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n avx_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n avx_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_avx_stdcall code va_s0 IA.win\n\n(* Prove that vm_lemma' has the required type *)\nnoextract\nlet avx_lemma = as_t #(VSig.vale_sig_stdcall avx_pre avx_post) avx_lemma'\nnoextract\nlet code_avx = VC.va_code_Check_avx_stdcall IA.win\n\n(* Here's the type expected for the check_avx wrapper *)\n[@__reduce__] noextract\nlet lowstar_avx_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_avx\n dom\n []\n _\n _\n (W.mk_prediction code_avx dom [] (avx_lemma code_avx IA.win))\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet avx2_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_avx2_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet avx2_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_avx2_stdcall c va_s0 IA.win va_s1 f\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract\nlet avx2_lemma'\n (code:V.va_code)\n (_win:bool)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n avx2_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n avx2_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_avx2_stdcall code va_s0 IA.win\n\n(* Prove that vm_lemma' has the required type *)\nnoextract\nlet avx2_lemma = as_t #(VSig.vale_sig_stdcall avx2_pre avx2_post) avx2_lemma'\nnoextract\nlet code_avx2 = VC.va_code_Check_avx2_stdcall IA.win\n\n(* Here's the type expected for the check_avx wrapper *)\n[@__reduce__] noextract\nlet lowstar_avx2_t =\n IX64.as_lowstar_sig_t_weak_stdcall\n code_avx2\n dom\n []\n _\n _\n (W.mk_prediction code_avx2 dom [] (avx2_lemma code_avx2 IA.win))\n\n(* Need to rearrange the order of arguments *)\n[@__reduce__] noextract\nlet movbe_pre : VSig.vale_pre dom =\n fun (c:V.va_code)\n (va_s0:V.va_state) ->\n VC.va_req_Check_movbe_stdcall c va_s0 IA.win\n\n[@__reduce__] noextract\nlet movbe_post : VSig.vale_post dom =\n fun (c:V.va_code)\n (va_s0:V.va_state)\n (va_s1:V.va_state)\n (f:V.va_fuel) ->\n VC.va_ens_Check_movbe_stdcall c va_s0 IA.win va_s1 f\n\n(* The vale lemma doesn't quite suffice to prove the modifies clause\n expected of the interop layer *)\n[@__reduce__] noextract", "sketch": [ "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as input. It is a ghost function that specifies the pre- and post-conditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the execution of the `movbe` instruction.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function that takes in the VA code, boolean value, and VA state as input. It specifies the pre-condition that must be satisfied before the execution of the `movbe` instruction and the post-condition that must hold after the execution.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as arguments. It is a ghost function that specifies preconditions and postconditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the execution of the `movbe` instruction.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function that takes in the VA code, boolean value, and VA state as arguments. It specifies the preconditions and postconditions for the `movbe` instruction, ensuring that the evaluation of the code results in the expected state and fuel, and that the calling conventions for the `movbe` instruction are satisfied.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as arguments. It is a ghost function that specifies the preconditions and postconditions for the `movbe` operation.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the `movbe` operation is executed.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function with preconditions and postconditions that ensure the correct execution and calling conventions of the `movbe` operation.", "The `movbe_lemma'` function is implemented as a ghost function that takes in the VA code, a boolean value, and a VA state. It requires a precondition `movbe_pre` and ensures a postcondition that checks the evaluation of the code, calling conventions, and the postcondition `movbe_post`.", "The definition `movbe_lemma'` is a lemma that specifies the behavior of a MOVBE instruction in the x64 architecture. It takes a VA code, a boolean indicating the Windows platform, and a VA state as input, and ensures that the MOVBE instruction behaves as expected.\n\nStep 1: The `movbe_lemma'` lemma specifies the preconditions and postconditions for the MOVBE instruction in the x64 architecture.\n\nStep 2: The `movbe_lemma'` implementation will take the VA code, the Windows platform indicator, and the VA state as input, and ensure that the MOVBE instruction behaves as expected by evaluating the code, checking calling conventions, and verifying the postconditions.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as input. It is a ghost function that specifies preconditions and postconditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions required before executing the `movbe` instruction and the expected results after its execution.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function with preconditions and postconditions that ensure the proper execution and behavior of the `movbe` instruction.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as arguments. It is a ghost function that specifies preconditions and postconditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the execution of the `movbe` instruction.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function that takes the VA code, a boolean value, and the VA state as arguments. It specifies the preconditions and postconditions for the `movbe` instruction, ensuring that the `movbe` instruction is executed correctly and follows the calling conventions.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as arguments. It is a ghost function that specifies preconditions and postconditions for the `movbe` operation.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the `movbe` operation is executed.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function with preconditions and postconditions that ensure the correct execution and calling conventions of the `movbe` operation.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as arguments. It is a ghost function that specifies preconditions and postconditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the execution of the `movbe` instruction.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function that takes in the VA code, a boolean value, and a VA state as arguments. It specifies the preconditions and postconditions for the `movbe` instruction, ensuring that the `movbe` instruction is executed correctly and follows the calling conventions.", "The `movbe_lemma'` function takes in a VA code, a boolean value, and a VA state as input. It is a ghost function that specifies preconditions and postconditions for the `movbe` instruction.\n\nStep 1: The `movbe_lemma'` function specifies the conditions that must be satisfied before and after the execution of the `movbe` instruction.\n\nStep 2: The `movbe_lemma'` function is implemented as a ghost function with preconditions and postconditions that ensure the correct execution and calling conventions of the `movbe` instruction." ], "generated_solution": [ "let movbe_lemma'\n (code: V.va_code)\n (_win: bool)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n movbe_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma'\n (code: V.va_code)\n (_win: bool)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n movbe_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f))\n = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma'\n (code: V.va_code)\n (_win: bool)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n movbe_pre code va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f))", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win", "let movbe_lemma' (code: V.va_code) (_win: bool) (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires movbe_pre code va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n movbe_post code va_s0 va_s1 f)) = VC.va_lemma_Check_movbe_stdcall code va_s0 IA.win" ] }, { "file_name": "ID1.fst", "name": "ID1.pmap", "opens_and_abbrevs": [ { "open": "FStar.List.Tot" }, { "open": "FStar.Tactics.V2" }, { "open": "FStar.Monotonic.Pure" }, { "open": "FStar.Ghost" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val pmap (#a #b pre: _) (f: (x: a -> Id b (requires (pre x)) (ensures (fun _ -> True)))) (l: list a)\n : Id (list b) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True)) (decreases l)", "source_definition": "let rec pmap #a #b pre\n (f : (x:a -> Id b (requires (pre x)) (ensures (fun _ -> True))))\n (l : list a)\n : Id (list b)\n (requires (forall x. memP x l ==> pre x))\n (ensures (fun _ -> True))\n (decreases l)\n = match l with\n | [] -> []\n | x::xs -> f x :: (pmap pre f xs)", "source_range": { "start_line": 127, "start_col": 0, "end_line": 136, "end_col": 37 }, "interleaved": false, "definition": "fun pre f l ->\n (match l with\n | Prims.Nil #_ -> []\n | Prims.Cons #_ x xs ->\n let _ = f x in\n let _ = ID1.pmap pre f xs in\n _ :: _)\n <:\n ID1.Id (Prims.list b)", "effect": "ID1.Id", "effect_flags": [ "" ], "mutual_with": [], "premises": [ "Prims.l_True", "Prims.list", "Prims.Nil", "Prims.Cons", "ID1.pmap", "Prims.l_Forall", "Prims.l_imp", "FStar.List.Tot.Base.memP" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "pre: (_: a -> Type0) -> f: (x: a -> ID1.Id b) -> l: Prims.list a -> ID1.Id (Prims.list b)", "prompt": "let rec pmap #a #b pre (f: (x: a -> Id b (requires (pre x)) (ensures (fun _ -> True)))) (l: list a)\n : Id (list b) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True)) (decreases l) =\n ", "expected_response": "match l with\n| [] -> []\n| x :: xs -> f x :: (pmap pre f xs)", "source": { "project_name": "FStar", "file_name": "examples/layeredeffects/ID1.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "ID1.fst", "checked_file": "dataset/ID1.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Pure.fst.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Ghost.fsti.checked" ] }, "definitions_in_context": [ "val wp (a : Type u#a) : Type u#(max 1 a)", "let wp a = pure_wp a", "let repr (a : Type u#aa) (w : wp a) : Type u#(max 1 aa) =\n // Hmmm, the explicit post bumps the universe level\n p:erased (a -> Type0) -> squash (w p) -> v:a{reveal p v}", "let return_wp #a (x:a) : wp a =\n as_pure_wp (fun p -> p x)", "let return (a : Type) (x : a) : repr a (return_wp x) =\n // Fun fact: using () instead of _ below makes us\n // lose the refinement and then this proof fails.\n // Keep that in mind all ye who enter here.\n fun p _ -> x", "let bind_wp #a #b\n (wp_v : wp a)\n (wp_f : (x:a -> wp b))\n : wp b\n = elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))", "let bind (a b : Type) (wp_v : wp a) (wp_f: a -> wp b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= fun p _ -> let x = v (fun x -> wp_f x p) () in\n f x p ()", "let subcomp (a:Type u#uu) (w1 w2:wp a)\n (f : repr a w1)\n: Pure (repr a w2)\n (requires (forall p. w2 p ==> w1 p))\n (ensures fun _ -> True)\n= f", "let ite_wp #a (wp1 wp2 : wp a) (b : bool) : wp a =\n elim_pure_wp_monotonicity_forall ();\n (as_pure_wp (fun (p:a -> Type) -> (b ==> wp1 p) /\\ ((~b) ==> wp2 p)))", "let if_then_else (a : Type) (wp1 wp2 : wp a) (f : repr a wp1) (g : repr a wp2) (p : bool) : Type =\n repr a (ite_wp wp1 wp2 p)", "let default_if_then_else (a:Type) (wp:wp a) (f:repr a wp) (g:repr a wp) (p:bool)\n: Type\n= repr a wp", "let elim_pure #a #wp ($f : unit -> PURE a wp) p\n : Pure a (requires (wp p)) (ensures (fun r -> p r))\n = FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();\n f ()", "let lift_pure_nd (a:Type) (wp:wp a) (f:unit -> PURE a wp) :\n Pure (repr a wp) (requires True)\n (ensures (fun _ -> True))\n = fun p _ -> elim_pure f p", "let iassert (q:Type0) : ID unit (as_pure_wp (fun p -> q /\\ (q ==> p ()))) = ()", "val iassume (q:Type0) : ID unit (as_pure_wp (fun p -> q ==> p ()))", "val test_f : unit -> ID int (as_pure_wp (fun p -> p 5 /\\ p 3))", "let test_f () = 3", "let l () : int = reify (test_f ()) (fun _ -> True) ()" ], "closest": [ "val map (#a #b #pre: _) (f: (x: a -> Id b (requires (pre x)) (ensures (fun _ -> True)))) (l: list a)\n : Id (list b) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True))\nlet rec map #a #b #pre\n (f : (x:a -> Id b (requires (pre x)) (ensures (fun _ -> True))))\n (l : list a)\n : Id (list b)\n (requires (forall x. memP x l ==> pre x))\n (ensures (fun _ -> True))\n = match l with\n | [] -> []\n | x::xs -> f x :: map #_ #_ #pre f xs", "val pmap\n (#a #b #pre: _)\n (#post: (b -> Type0))\n (f: (x: a -> Pure b (requires (pre x)) (ensures post)))\n (l: list a)\n : Pure (list (v: b{post v})) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True))\nlet rec pmap #a #b #pre (#post:b->Type0)\n (f : (x:a -> Pure b (requires (pre x)) (ensures post)))\n (l : list a)\n : Pure (list (v:b{post v}))\n (requires (forall x. memP x l ==> pre x))\n (ensures (fun _ -> True))\n = match l with\n | [] -> []\n | x::xs -> f x :: pmap #_ #_ #pre #post f xs", "val memP_map_intro (#a #b: Type) (f: (a -> Tot b)) (x: a) (l: list a)\n : Lemma (requires True) (ensures (memP x l ==> memP (f x) (map f l))) (decreases l)\nlet rec memP_map_intro\n (#a #b: Type)\n (f: a -> Tot b)\n (x: a)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP x l ==> memP (f x) (map f l)))\n (decreases l)\n= match l with\n | [] -> ()\n | _ :: q -> memP_map_intro f x q", "val memP_map_elim (#a #b: Type) (f: (a -> Tot b)) (y: b) (l: list a)\n : Lemma (requires True)\n (ensures (memP y (map f l) ==> (exists (x: a). memP x l /\\ f x == y)))\n (decreases l)\nlet rec memP_map_elim\n (#a #b: Type)\n (f: a -> Tot b)\n (y: b)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP y (map f l) ==> (exists (x : a) . memP x l /\\ f x == y)))\n (decreases l)\n= match l with\n | [] -> ()\n | _ :: q -> memP_map_elim f y q", "val map (#a #b: _) (f: (a -> b)) (l: list a) : list b\nlet rec map #a #b (f: a -> b) (l:list a) \n : list b \n = match l with\n | [] -> []\n | hd :: tl -> f hd :: map f tl", "val map_dec (#a #b: _) (l: list a) (f: (x: a{x << l} -> b)) : Tot (list b) (decreases l)\nlet rec map_dec #a #b\n (l : list a)\n (f : (x:a{x << l}) -> b)\n : Tot (list b) (decreases l)\n =\n match l with\n | [] -> []\n | x::xs -> f x :: map_dec xs f", "val map2 (#a1 #a2 #b: Type)\n (f: a1 -> a2 -> b)\n (l1:list a1)\n (l2:list a2)\n : Pure (list b)\n (requires (length l1 == length l2))\n (ensures (fun _ -> True))\n (decreases l1)\nlet rec map2 #a1 #a2 #b f l1 l2 =\n match l1, l2 with\n | [], [] -> []\n | x1::xs1, x2::xs2 -> f x1 x2 :: map2 f xs1 xs2", "val unref (#a #p: _) (l: list (v: a{p v})) : l: (list a){forall x. memP x l ==> p x}\nlet rec unref #a #p (l : list (v:a{p v})) : l:(list a){forall x. memP x l ==> p x} =\n match l with\n | [] -> []\n | x :: xs -> x :: unref xs", "val memP_concatMap_intro (#a #b: _) (x: a) (y: b) (f: (a -> list b)) (l: list a)\n : Lemma (List.memP x l ==> List.memP y (f x) ==> List.memP y (List.Tot.concatMap f l))\nlet memP_concatMap_intro #a #b (x: a) (y: b) (f:a -> list b) (l: list a) :\n Lemma (List.memP x l ==>\n List.memP y (f x) ==>\n List.memP y (List.Tot.concatMap f l)) =\n concatMap_flatten_map f l;\n memP_map_intro f x l;\n memP_flatten_intro y (f x) (List.Tot.map f l)", "val memP_precedes (#a: Type) (x: a) (l: list a)\n : Lemma (requires True) (ensures (memP x l ==> x << l)) (decreases l)\nlet rec memP_precedes\n (#a: Type)\n (x: a)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP x l ==> x << l))\n (decreases l)\n= match l with\n | [] -> ()\n | y :: q ->\n FStar.Classical.or_elim\n #(x == y)\n #(memP x q)\n #(fun _ -> x << l)\n (fun _ -> ())\n (fun _ -> memP_precedes x q)", "val map3 (#a1 #a2 #a3 #b: Type)\n (f: a1 -> a2 -> a3 -> b)\n (l1:list a1)\n (l2:list a2)\n (l3:list a3)\n : Pure (list b)\n (requires (let n = length l1 in\n (n == length l2 /\\\n n == length l3)))\n (ensures (fun _ -> True))\n (decreases l1)\nlet rec map3 #a1 #a2 #a3 #b f l1 l2 l3 =\n match l1, l2, l3 with\n | [], [], [] -> []\n | x1::xs1, x2::xs2, x3::xs3 -> f x1 x2 x3 :: map3 f xs1 xs2 xs3", "val list_map (#a #b: Type) (f: (a -> Tot b)) (l: list a) : Tot (l': list b {l' == L.map f l})\nlet rec list_map\n (#a #b: Type)\n (f: (a -> Tot b))\n (l: list a)\n: Tot (l' : list b { l' == L.map f l } )\n= match l with\n | [] -> []\n | a :: q -> f a :: list_map f q", "val concatmaplemma : (#a:Type) -> (#b:Type) -> l:list a -> (f:(a -> list b)) -> x:b ->\n Lemma (memP x (concatMap f l) <==> (exists a. memP a l /\\ memP x (f a)))\n [SMTPat (memP x (concatMap f l))]\nlet rec concatmaplemma #a #b l f x =\n match l with\n | [] -> ()\n | h::t ->\n concatlemma (f h) (concatMap f t) x;\n concatmaplemma t f x", "val r_map (#i #a #b: _) (f: (a -> m b i)) (xs: list a) : m (list b) i\nlet rec r_map #i #a #b (f : a -> m b i) (xs : list a) : m (list b) i =\n match xs with\n | [] -> return _ [] _\n | x::xs ->\n bind _ _ _ (f x) (fun y ->\n bind _ _ _ (r_map f xs) (fun ys ->\n return _ (y::ys) _))", "val assoc_memP_none (#a: eqtype) (#b: Type) (x: a) (l: list (a * b))\n : Lemma (requires (assoc x l == None)) (ensures (forall y. ~(memP (x, y) l))) (decreases l)\nlet rec assoc_memP_none\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l: list (a * b))\n: Lemma\n (requires (assoc x l == None))\n (ensures (forall y . ~ (memP (x, y) l)))\n (decreases l)\n= match l with\n | [] -> ()\n | (x', _) :: q -> if x = x' then assert False else assoc_memP_none x q", "val list_memP_map_forall (#t1 #t2: Type) (f: (t1 -> t2)) (l: list t1)\n : Lemma\n (forall y. List.Tot.memP y (List.Tot.map f l) <==> (exists x. List.Tot.memP x l /\\ y == f x))\nlet list_memP_map_forall\n (#t1 #t2: Type)\n (f: t1 -> t2)\n (l: list t1)\n: Lemma\n (forall y . List.Tot.memP y (List.Tot.map f l) <==> (exists x . List.Tot.memP x l /\\ y == f x))\n= Classical.forall_intro (fun y -> List.Tot.memP_map_elim f y l);\n Classical.forall_intro (fun x -> List.Tot.memP_map_intro f x l)", "val map_append (#a #b: Type) (f: (a -> Tot b)) (l1 l2: list a)\n : Lemma (ensures map f (l1 @ l2) == map f l1 @ map f l2)\nlet rec map_append\n (#a #b: Type)\n (f: a -> Tot b)\n (l1 l2: list a)\n:\n Lemma\n (ensures map f (l1 @ l2) == map f l1 @ map f l2)\n=\n match l1 with\n | [] -> ()\n | x :: q -> map_append f q l2", "val maplast (f: ('a -> 'a)) (l: list 'a) : list 'a\nlet rec maplast (f : 'a -> 'a) (l : list 'a) : list 'a =\n match l with\n | [] -> []\n | [x] -> [f x]\n | x::xs -> x :: (maplast f xs)", "val memP_dec (#a: _) (x: a) (l: list a)\n : Lemma (requires L.memP x l) (ensures x << l) [SMTPat (L.memP x l)]\nlet rec memP_dec #a (x : a) (l : list a)\n : Lemma (requires L.memP x l)\n (ensures x << l)\n [SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_dec x ys", "val assoc_memP_some (#a: eqtype) (#b: Type) (x: a) (y: b) (l: list (a * b))\n : Lemma (requires (assoc x l == Some y)) (ensures (memP (x, y) l)) (decreases l)\nlet rec assoc_memP_some\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (y: b)\n (l: list (a * b))\n: Lemma\n (requires (assoc x l == Some y))\n (ensures (memP (x, y) l))\n (decreases l)\n= match l with\n | [] -> ()\n | (x', _) :: q -> if x = x' then () else assoc_memP_some x y q", "val mapi (#a #b: _) (s: seq a) (f: (seq_index s -> b))\n : t: seq b {Seq.length s == Seq.length t /\\ (forall (i: seq_index s). Seq.index t i == f i)}\nlet mapi (#a #b:_) (s:seq a) (f:(seq_index s -> b))\n : t:seq b{\n Seq.length s == Seq.length t /\\\n (forall (i:seq_index s). Seq.index t i == f i)\n }\n = Seq.init (Seq.length s) f", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "val map (#a #b: _) (f: (a -> b)) (#n: _) (v: vector a n) : vector b n\nlet rec map #a #b (f:a -> b) #n (v:vector a n)\n : vector b n\n = match v with\n | VNil -> VNil\n | VCons hd tl -> VCons (f hd) (map f tl)", "val map (#a #b: _) (f: (a -> b)) (#n: _) (v: vector a n) : vector b n\nlet rec map #a #b (f:a -> b) #n (v:vector a n)\n : vector b n\n = match v with\n | VNil -> VNil\n | VCons hd tl -> VCons (f hd) (map f tl)", "val list_rec_of_function_is_map_1\n (#a #b: _)\n (f: (a -> b))\n (l1: list a)\n (l2: list b)\n (p: list_param _ _ (rel_of_fun f) l1 l2)\n : Lemma (l2 == List.Tot.map f l1)\nlet rec list_rec_of_function_is_map_1 #a #b (f : a -> b) (l1 : list a) (l2 : list b)\n (p : list_param _ _ (rel_of_fun f) l1 l2)\n : Lemma (l2 == List.Tot.map f l1)\n = match p with\n | Nil_param -> ()\n | Cons_param _ _ _ _ _ t -> list_rec_of_function_is_map_1 _ _ _ t", "val memP_allP (#a #b: _) (top: b) (pred: (x: a{x << top} -> Type)) (x: a) (l: list a {l << top})\n : Lemma (requires allP top pred l /\\ L.memP x l)\n (ensures x << top /\\ pred x)\n [SMTPat (allP top pred l); SMTPat (L.memP x l)]\nlet rec memP_allP #a #b (top:b) (pred : (x:a{x << top}) -> Type) (x : a) (l : list a{l << top})\n : Lemma (requires allP top pred l /\\ L.memP x l)\n (ensures x << top /\\ pred x)\n [SMTPat (allP top pred l); SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_allP top pred x ys", "val memP_append (#a: _) (x: a) (l: list a)\n : Lemma\n (ensures\n (List.memP x l ==> (exists (l12: (list a * list a)). l == (fst l12) @ (x :: (snd l12)))))\nlet memP_append #a (x: a) (l: list a) :\n Lemma\n (ensures (List.memP x l ==>\n (exists (l12: (list a * list a)). l == (fst l12) @ (x :: (snd l12))))) =\n FStar.Classical.move_requires (memP_append_aux x) l", "val mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (ensures (mem x l <==> memP x l)) [SMTPat (mem x l); SMTPat (memP x l)]\nlet rec mem_memP\n (#a: eqtype)\n (x: a)\n (l: list a)\n: Lemma (ensures (mem x l <==> memP x l))\n [SMTPat (mem x l); SMTPat (memP x l)]\n= match l with\n | [] -> ()\n | a :: q -> mem_memP x q", "val mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (ensures (mem x l <==> memP x l)) [SMTPat (memP x l); SMTPat (mem x l)]\nlet mem_memP\n (#a: eqtype)\n (x: a)\n (l: list a)\n: Lemma (ensures (mem x l <==> memP x l))\n [SMTPat (memP x l); SMTPat (mem x l)]\n= FStar.List.Tot.Properties.mem_memP x l", "val fold_left_invar (#a #b: Type) (f: (a -> b -> Tot a)) (l: list b) (p: (a -> Tot Type0))\n : Lemma (requires forall (x: a) (y: b). p x ==> memP y l ==> p (f x y))\n (ensures forall (x: a). p x ==> p (fold_left f x l))\nlet rec fold_left_invar\n (#a #b: Type)\n (f: (a -> b -> Tot a))\n (l: list b)\n (p: (a -> Tot Type0))\n : Lemma\n (requires forall (x: a) (y: b) . p x ==> memP y l ==> p (f x y) )\n (ensures forall (x: a) . p x ==> p (fold_left f x l))\n=\n match l with\n | [] -> ()\n | y :: q -> fold_left_invar f q p", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val memP_append_aux (#a: _) (x: a) (l: list a)\n : Lemma (requires (List.memP x l))\n (ensures (exists (l12: (list a * list a)). l == fst l12 @ x :: snd l12))\nlet rec memP_append_aux #a (x: a) (l: list a) :\n Lemma\n (requires (List.memP x l))\n (ensures (exists (l12: (list a * list a)). l == fst l12 @ x :: snd l12))\n = let goal = exists l12. l == fst l12 @ x :: snd l12 in\n let x : squash goal =\n match l with\n | [] -> ()\n | h :: t ->\n let pf : squash (x == h \\/ List.memP x t) = () in\n p <-- FStar.Squash.join_squash pf ;\n match p with \n | Prims.Left x_eq_h -> \n let l12 = [], t in\n assert (l == (fst l12) @ (x :: snd l12)) //trigger\n | Prims.Right mem_x_t -> \n FStar.Classical.exists_elim \n goal\n (pure_as_squash (memP_append_aux x) t)\n (fun l12' -> \n let l12 = h::fst l12', snd l12' in\n assert (l == (fst l12) @ (x :: snd l12))) //trigger\n in\n FStar.Squash.give_proof x", "val for_all_map\n (#a #b: Type)\n (f: (a -> GTot b))\n (p1: (b -> GTot bool))\n (p2: (a -> GTot bool))\n (l: list a)\n : Lemma (requires p2 == (fun x -> p1 (f x)))\n (ensures for_all_ghost p1 (map_ghost f l) = for_all_ghost p2 l)\nlet rec for_all_map (#a: Type) (#b: Type) (f: a -> GTot b) (p1: b -> GTot bool) (p2: a -> GTot bool) (l: list a)\n : Lemma\n (requires p2 == (fun x -> p1 (f x)))\n (ensures for_all_ghost p1 (map_ghost f l) = for_all_ghost p2 l) =\n match l with\n | [] -> ()\n | hd :: tl -> for_all_map f p1 p2 tl", "val filter : #a: Type -> f:(a -> Tot bool) -> l: list a -> Tot (m:list a{forall x. memP x m ==> f x})\nlet rec filter #a f = function\n | [] -> []\n | hd::tl -> if f hd then hd::filter f tl else filter f tl", "val if_list_is_map_of_list_then_mapped_element_in_list\n (#a #b: Type)\n (map_fun: (a -> GTot b))\n (l1: list a)\n (l2: list b)\n (x: a)\n : Lemma (requires contains_ubool x l1 /\\ list_is_map_of_list map_fun l1 l2)\n (ensures contains_ubool (map_fun x) l2)\nlet rec if_list_is_map_of_list_then_mapped_element_in_list\n (#a: Type)\n (#b: Type)\n (map_fun: a -> GTot b)\n (l1: list a)\n (l2: list b)\n (x: a)\n : Lemma (requires contains_ubool x l1 /\\ list_is_map_of_list map_fun l1 l2)\n (ensures contains_ubool (map_fun x) l2) =\n match l1 with\n | [] -> assert False\n | hd1 :: tl1 ->\n match l2 with\n | [] -> assert False\n | hd2 :: tl2 ->\n eliminate x == hd1 \\/ ~(x == hd1)\n returns contains_ubool (map_fun x) l2\n with case_eq_hd1. assert (hd2 == map_fun x)\n and case_ne_hd1. if_list_is_map_of_list_then_mapped_element_in_list map_fun tl1 tl2 x", "val list_rec_of_function_is_map_2 (#a #b: _) (f: (a -> b)) (l1: list a) (l2: list b)\n : Pure (list_param _ _ (rel_of_fun f) l1 l2)\n (requires (l2 == List.Tot.map f l1))\n (ensures (fun _ -> True))\nlet rec list_rec_of_function_is_map_2 #a #b (f : a -> b) (l1 : list a) (l2 : list b)\n : Pure (list_param _ _ (rel_of_fun f) l1 l2)\n (requires (l2 == List.Tot.map f l1))\n (ensures (fun _ -> True))\n = match l1, l2 with\n | Nil, Nil -> Nil_param\n | Cons h1 t1, Cons h2 t2 ->\n Cons_param h1 h2 () _ _ (list_rec_of_function_is_map_2 f t1 t2)", "val map_preserves_lists_correspond\n (#a #b #c: Type)\n (correspondence1: (a -> b -> GTot bool))\n (correspondence2: (a -> c -> GTot bool))\n (f: (b -> GTot c))\n (l1: list a)\n (l2: list b)\n : Lemma\n (requires\n lists_correspond correspondence1 l1 l2 /\\\n (forall x y. correspondence1 x y ==> correspondence2 x (f y)))\n (ensures lists_correspond correspondence2 l1 (map_ghost f l2))\nlet rec map_preserves_lists_correspond\n (#a: Type)\n (#b: Type)\n (#c: Type)\n (correspondence1: a -> b -> GTot bool)\n (correspondence2: a -> c -> GTot bool)\n (f: b -> GTot c)\n (l1: list a)\n (l2: list b)\n : Lemma (requires lists_correspond correspondence1 l1 l2\n /\\ (forall x y. correspondence1 x y ==> correspondence2 x (f y)))\n (ensures lists_correspond correspondence2 l1 (map_ghost f l2)) =\n match l1, l2 with\n | [], [] -> ()\n | hd1 :: tl1, hd2 :: tl2 ->\n map_preserves_lists_correspond correspondence1 correspondence2 f tl1 tl2", "val map (#a #b: _) (f: (a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))) (xs: list a)\n : RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)\nlet rec map #a #b\n (f : a -> RWI b RO (fun _ -> True) (fun _ _ _ -> True))\n (xs : list a)\n : RWI (list b) RO (fun _ -> True) (fun _ _ _ -> True)\n = match xs with\n | [] -> []\n | x::xs -> (f x)::(map f xs)", "val assoc_mem (#a: eqtype) (#b: Type) (x: a) (l: list (a * b))\n : Lemma (ensures (mem x (map fst l) <==> (exists y. assoc x l == Some y)))\nlet assoc_mem\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l: list (a * b))\n: Lemma\n (ensures (mem x (map fst l) <==> (exists y . assoc x l == Some y)))\n= match assoc x l with\n | None ->\n assoc_memP_none x l;\n mem_memP x (map fst l);\n memP_map_elim fst x l\n | Some y ->\n assoc_memP_some x y l;\n memP_map_intro fst (x, y) l;\n mem_memP x (map fst l)", "val memP_allP0 (#a: _) (pred: (a -> Type)) (x: a) (l: list a)\n : Lemma (requires allP0 pred l /\\ L.memP x l)\n (ensures pred x)\n [SMTPat (allP0 pred l); SMTPat (L.memP x l)]\nlet rec memP_allP0 #a (pred : a -> Type) (x : a) (l : list a)\n : Lemma (requires allP0 pred l /\\ L.memP x l)\n (ensures pred x)\n [SMTPat (allP0 pred l); SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_allP0 pred x ys", "val listmap (#a #b #labs: _) (f: (a -> Alg b labs)) (l: list a) : Alg (list b) labs\nlet rec listmap #a #b #labs\n (f : a -> Alg b labs) (l : list a) : Alg (list b) labs =\n match l with\n | [] -> []\n | x::xs -> f x :: listmap #_ #_ #labs f xs", "val pairwise_and'_forall (#a: Type) (f: (a -> a -> Type)) (l: list a)\n : Lemma (requires symmetric f /\\ reflexive f)\n (ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\\ L.memP y l ==> f x y)))\nlet rec pairwise_and'_forall (#a:Type) (f: a -> a -> Type) (l:list a)\n = match l with\n | [] -> pairwise_and'_nil f\n | hd::tl ->\n pairwise_and'_cons f hd tl;\n pairwise_and'_forall f tl;\n big_and'_forall (f hd) tl", "val list_mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (FStar.List.Tot.mem x l <==> FStar.List.Tot.memP x l)\nlet rec list_mem_memP (#a:eqtype) (x:a) (l:list a)\n: Lemma (FStar.List.Tot.mem x l <==> FStar.List.Tot.memP x l)\n= match l with\n | [] -> ()\n | hd::tl -> if hd = x then () else list_mem_memP x tl", "val assoc_append_elim_l (#a: eqtype) (#b: Type) (x: a) (l1 l2: list (a * b))\n : Lemma (requires (assoc x l1 == None))\n (ensures (assoc x (l1 @ l2) == assoc x l2))\n (decreases l1)\nlet rec assoc_append_elim_l\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l1 l2: list (a * b))\n: Lemma\n (requires (assoc x l1 == None))\n (ensures (assoc x (l1 @ l2) == assoc x l2))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | (x', _) :: q -> if x = x' then assert False else assoc_append_elim_l x q l2", "val mapi (#a:Type) (#b:Type) (#len:flen) (f:(i:nat{i < len} -> a -> b)) (s:ntuple a len) : ntuple b len\nlet mapi #a #b #len f s =\n normalize_term (createi len (fun i -> f i (index s i)))", "val map_aux (#a #b: Type) (f: (a -> b)) (s: seq a)\n : Tot (s': seq b {length s' = length s}) (decreases (length s))\nlet rec map_aux (#a #b:Type) (f:a -> b) (s:seq a):\n Tot (s':seq b{length s' = length s})\n (decreases (length s))\n =\n let n = length s in\n if n = 0 then empty\n else\n let ps = prefix s (n - 1) in\n let e = index s (n - 1) in\n append (map_aux f ps) (create 1 (f e))", "val concatMap_flatten_map (#a #b: _) (f: (a -> list b)) (l: _)\n : Lemma (List.Tot.concatMap f l == List.Tot.flatten (List.Tot.map f l))\nlet rec concatMap_flatten_map #a #b (f:a -> list b) l :\n Lemma (List.Tot.concatMap f l == List.Tot.flatten (List.Tot.map f l)) =\n match l with\n | [] -> ()\n | h :: t -> concatMap_flatten_map f t", "val list_map_list_flatten_map\n (#a #b: Type)\n (f: a -> Tot b)\n (l: list a)\n: Lemma\n (L.map f l == L.flatten (L.map (fun x -> [f x]) l))\nlet rec list_map_list_flatten_map\n (#a #b: Type)\n (f: a -> Tot b)\n (l: list a)\n: Lemma\n (L.map f l == L.flatten (L.map (fun x -> [f x]) l))\n= match l with\n | [] -> ()\n | a :: q -> list_map_list_flatten_map f q", "val filter_map (f: ('a -> ML (option 'b))) (l: list 'a) : ML (list 'b)\nlet filter_map (f:'a -> ML (option 'b)) (l:list 'a) : ML (list 'b) =\n let rec filter_map_acc (acc:list 'b) (l:list 'a) : ML (list 'b) =\n match l with\n | [] ->\n rev acc\n | hd :: tl ->\n match f hd with\n | Some hd ->\n filter_map_acc (hd :: acc) tl\n | None ->\n filter_map_acc acc tl\n in\n filter_map_acc [] l", "val for_all_mem (#a: Type) (f: (a -> Tot bool)) (l: list a)\n : Lemma (for_all f l <==> (forall x. memP x l ==> f x))\nlet rec for_all_mem\n (#a: Type)\n (f: (a -> Tot bool))\n (l: list a)\n: Lemma\n (for_all f l <==> (forall x . memP x l ==> f x))\n= match l with\n | [] -> ()\n | _ :: q -> for_all_mem f q", "val assoc_append_elim_r (#a: eqtype) (#b: Type) (x: a) (l1 l2: list (a * b))\n : Lemma (requires (assoc x l2 == None \\/ ~(assoc x l1 == None)))\n (ensures (assoc x (l1 @ l2) == assoc x l1))\n (decreases l1)\nlet rec assoc_append_elim_r\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l1 l2: list (a * b))\n: Lemma\n (requires (assoc x l2 == None \\/ ~ (assoc x l1 == None)))\n (ensures (assoc x (l1 @ l2) == assoc x l1))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | (x', _) :: q -> if x = x' then () else assoc_append_elim_r x q l2", "val append_memP (#a: Type) (l1 l2: list a) (x: a)\n : Lemma (L.memP x (l1 @ l2) <==> (L.memP x l1 \\/ L.memP x l2)) [SMTPat (L.memP x (l1 @ l2))]\nlet rec append_memP (#a:Type) (l1 l2:list a) (x:a)\n : Lemma (L.memP x (l1 @ l2) <==> (L.memP x l1 \\/ L.memP x l2))\n [SMTPat (L.memP x (l1 @ l2))] =\n match l1 with\n | [] -> ()\n | _::tl -> append_memP tl l2 x", "val map_ghost_preserves_length (#a #b: Type) (f: (a -> GTot b)) (l: list a)\n : Lemma (ensures length (map_ghost f l) = length l)\nlet rec map_ghost_preserves_length\n (#a: Type)\n (#b: Type)\n (f: a -> GTot b)\n (l: list a)\n : Lemma (ensures length (map_ghost f l) = length l) =\n match l with\n | [] -> ()\n | hd :: tl -> map_ghost_preserves_length f tl", "val allP (#a #b: _) (top: b) (pred: (x: a{x << top} -> Type0)) (l: list a {l << top \\/ l === top})\n : Type0\nlet rec allP #a #b (top:b) (pred : (x:a{x << top}) -> Type0) (l : list a{l << top \\/ l === top}) : Type0 =\n match l with\n | [] -> True\n | x::xs -> pred x /\\ allP top pred xs", "val memP (#a: Type) (x: a) (l: list a) : Tot Type0\nlet rec memP (#a: Type) (x: a) (l: list a) : Tot Type0 =\n match l with\n | [] -> False\n | y :: q -> x == y \\/ memP x q", "val pairwise_and'_forall_no_repeats (#a: Type) (f: (a -> a -> Type)) (l: list a)\n : Lemma (requires symmetric f /\\ L.no_repeats_p l)\n (ensures (pairwise_and' f l <==> (forall x y. L.memP x l /\\ L.memP y l /\\ x =!= y ==> f x y)))\nlet rec pairwise_and'_forall_no_repeats (#a:Type) (f: a -> a -> Type) (l:list a)\n = match l with\n | [] -> pairwise_and'_nil f\n | hd::tl ->\n pairwise_and'_cons f hd tl;\n pairwise_and'_forall_no_repeats f tl;\n big_and'_forall (f hd) tl", "val append_memP: #t:Type -> l1:list t\n -> l2:list t\n -> a:t\n -> Lemma (requires True)\n (ensures (memP a (l1@l2) <==> (memP a l1 \\/ memP a l2)))\nlet rec append_memP #t l1 l2 a = match l1 with\n | [] -> ()\n | hd::tl -> append_memP tl l2 a", "val memP_existsb: #a: Type -> f:(a -> Tot bool) -> xs:list a ->\n Lemma(ensures (existsb f xs <==> (exists (x:a). (f x = true /\\ memP x xs))))\nlet rec memP_existsb #a f xs =\n match xs with\n | [] -> ()\n | hd::tl -> memP_existsb f tl", "val append_memP (#a: _) (x: a) (l0 l1: list a)\n : Lemma (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1))\nlet rec append_memP #a (x:a) (l0 l1:list a)\n : Lemma (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1))\n = match l0 with\n | [] -> ()\n | hd::tl -> append_memP x tl l1", "val map_dec (top: 'a) (l: list 'b {l << top}) (f: (x: 'b{x << l} -> 'c)) : list 'c\nlet rec map_dec (top:'a) (l : list 'b{l << top}) (f : (x:'b{x << l} -> 'c)) : list 'c =\n match l with\n | [] -> []\n | x::xs -> f x :: map_dec top xs f", "val map (#a #b #i: _) (f: (a -> GTD b i)) (xs: list a) : GTD (list b) i\nlet rec map #a #b #i (f : a -> GTD b i) (xs : list a) : GTD (list b) i =\n match xs with\n | [] -> []\n | x::xs -> (f x)::(map f xs)", "val append_memP_forall: #a:Type -> l1:list a\n -> l2:list a\n -> Lemma (requires True)\n (ensures (forall a. memP a (l1 `append` l2) <==> (memP a l1 \\/ memP a l2)))\nlet rec append_memP_forall #a l1 l2 = match l1 with\n | [] -> ()\n | hd::tl -> append_memP_forall tl l2", "val list_ref : (#a:Type) -> (#p:(a -> Type)) -> (l:list a) ->\n Pure (list (x:a{p x}))\n (requires (forallP p l))\n (ensures (fun _ -> True))\nlet rec list_ref #a #p l =\n match l with\n | [] -> []\n | x::xs -> x :: list_ref #a #p xs", "val list_ref : (#a:Type) -> (#p:(a -> Type)) -> (l:list a) ->\n Pure (list (x:a{p x}))\n (requires (forallP p l))\n (ensures (fun _ -> True))\nlet rec list_ref #a #p l =\n match l with\n | [] -> []\n | x::xs -> x :: list_ref #a #p xs", "val rev_memP : #a:Type -> l:list a -> x:a ->\n Lemma (requires True)\n (ensures (memP x (rev l) <==> memP x l))\nlet rev_memP #a l x = rev_acc_memP l [] x", "val mapi: (int -> 'a -> ML 'b) -> list 'a -> ML (list 'b)\nlet mapi f l = mapi_init f l 0", "val map_f (#a:eqtype) (#b #c:a -> Type)\n (#inv:DM.t a (opt b) -> Type) (#inv':DM.t a (opt c) -> Type)\n\t (#r #r':HST.erid)\n (m:t r a b inv) (f: (x:a) -> b x -> c x)\n\t :ST (t r' a c inv')\n\t (requires (fun h0 -> inv' (DM.map (f_opt f) (repr (HS.sel h0 m))) /\\ witnessed (region_contains_pred r')))\n\t (ensures (fun h0 m' h1 ->\n\t inv' (DM.map (f_opt f) (repr (HS.sel h0 m))) /\\ //AR: surprised that even after the fix for #57, we need this repetition from the requires clause\n\t ralloc_post r' (mmap_f (HS.sel h0 m) f) h0 m' h1))\nlet map_f #a #b #c #inv #inv' #r #r' t f\n = let m = !t in\n ralloc r' (mmap_f m f)", "val bind_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (#b: Type)\n (#post_b: post_t st b)\n (lpost_b: (x: a -> l_post (post_a x) post_b))\n : l_post pre post_b\nlet bind_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (#b:Type)\n (#post_b:post_t st b)\n (lpost_b:(x:a -> l_post (post_a x) post_b))\n : l_post pre post_b\n =\n fun h0 y h2 -> lpre_a h0 /\\ (exists x h1. lpost_a h0 x h1 /\\ (lpost_b x) h1 y h2)", "val concat_map_opt (#a #b: _) (f: (a -> option (list b))) (l: list a) : option (list b)\nlet rec concat_map_opt #a #b (f : a -> option (list b)) (l : list a) : option (list b) =\n match l with\n | [] -> Some []\n | x::xs ->\n let? y = f x in\n let? ys = concat_map_opt f xs in\n Some (y@ys)", "val seq_map (#t1 #t2: Type) (f: (t1 -> Tot t2)) (x: seq t1)\n : Tot (lseq t2 (length x)) (decreases (length x))\nlet rec seq_map\n (#t1 #t2: Type)\n (f: (t1 -> Tot t2))\n (x: seq t1)\n: Tot (lseq t2 (length x))\n (decreases (length x))\n= if length x = 0\n then empty\n else cons (f (head x)) (seq_map f (tail x))", "val lemma_map_dec_len (#a #b #z: _) (top: z) (f: (x: a{x << top} -> b)) (xs: list a {xs << top})\n : Lemma (ensures (L.length (map_dec top xs f) == L.length xs)) [SMTPat (map_dec top xs f)]\nlet rec lemma_map_dec_len #a #b #z (top:z) (f : (x:a{x << top}) -> b) (xs : list a{xs << top})\n : Lemma (ensures (L.length (map_dec top xs f) == L.length xs))\n [SMTPat (map_dec top xs f)]\n = match xs with\n | [] -> ()\n | x::xs -> lemma_map_dec_len top f xs", "val map: ('a -> ML 'b) -> list 'a -> ML (list 'b)\nlet rec map f x = match x with\n | [] -> []\n | a::tl -> f a::map f tl", "val map: ('a -> ML 'b) -> list 'a -> ML (list 'b)\nlet rec map f x = match x with\n | [] -> []\n | a::tl -> f a::map f tl", "val map (a:eqtype) (b:Type u#a) : Type u#a\nlet map = map'", "val memP_gfilter :\n #a: Type\n -> f: (a -> GTot bool)\n -> x: a\n -> l: list a ->\n Lemma (requires (memP x l /\\ f x))\n (ensures (memP x (gfilter f l)))\nlet rec memP_gfilter #a f x l =\n match l with\n | [] -> ()\n | hd::tl ->\n if FStar.IndefiniteDescription.strong_excluded_middle (x == hd) then ()\n else memP_gfilter f x tl", "val big_and'_forall (#a: Type) (f: (a -> Type)) (l: list a)\n : Lemma (big_and' f l <==> (forall x. L.memP x l ==> f x))\nlet rec big_and'_forall (#a:Type) (f:a -> Type) (l:list a)\n = match l with\n | [] -> big_and'_nil f; ()\n | hd::tl -> big_and'_cons f hd tl; big_and'_forall f tl", "val fold_left_map\n (#a #b #c: Type)\n (f_aba: (a -> b -> Tot a))\n (f_bc: (b -> Tot c))\n (f_aca: (a -> c -> Tot a))\n (l: list b)\n : Lemma (requires forall (x: a) (y: b). f_aba x y == f_aca x (f_bc y))\n (ensures forall (x: a). fold_left f_aba x l == fold_left f_aca x (map f_bc l))\nlet rec fold_left_map\n (#a #b #c: Type)\n (f_aba: a -> b -> Tot a)\n (f_bc: b -> Tot c)\n (f_aca: a -> c -> Tot a)\n (l: list b)\n : Lemma\n (requires forall (x: a) (y: b) . f_aba x y == f_aca x (f_bc y) )\n (ensures forall (x : a) . fold_left f_aba x l == fold_left f_aca x (map f_bc l) )\n =\n match l with\n | [] -> ()\n | y :: q -> fold_left_map f_aba f_bc f_aca q", "val partition_mem_forall: #a:eqtype -> f:(a -> Tot bool)\n -> l:list a\n -> Lemma (requires True)\n (ensures (let l1, l2 = partition f l in\n (forall x. mem x l = (mem x l1 || mem x l2))))\nlet rec partition_mem_forall #a f l = match l with\n | [] -> ()\n | hd::tl -> partition_mem_forall f tl", "val mapi:#a:Type -> #b:Type -> #len:size_nat\n -> f:(i:nat{i < len} -> a -> Tot b)\n -> s1:lseq a len ->\n Tot (s2:lseq b len{(forall (i:nat).\n {:pattern (index s2 i)} i < len ==> index s2 i == f i s1.[i])})\nlet mapi #a #b #len f s =\n createi #b len (mapi_inner #a #b #len f s)", "val pairwise_or'_exists (#a: Type) (f: (a -> a -> Type)) (l: list a)\n : Lemma (requires symmetric f /\\ anti_reflexive f)\n (ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\\ L.memP y l /\\ f x y)))\nlet rec pairwise_or'_exists (#a:Type) (f: a -> a -> Type) (l:list a)\n = match l with\n | [] -> pairwise_or'_nil f\n | hd::tl ->\n pairwise_or'_cons f hd tl;\n pairwise_or'_exists f tl;\n big_or'_exists (f hd) tl", "val assoc_precedes (#a: eqtype) (#b: Type) (x: a) (l: list (a * b)) (y: b)\n : Lemma (requires (assoc x l == Some y)) (ensures (x << l /\\ y << l))\nlet assoc_precedes\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l: list (a * b))\n (y: b)\n: Lemma\n (requires (assoc x l == Some y))\n (ensures (x << l /\\ y << l))\n= assoc_memP_some x y l;\n memP_precedes (x, y) l", "val map_ghost_maps_last (#a #b: Type) (f: (a -> GTot b)) (l: list a)\n : Lemma (requires Cons? l) (ensures last (map_ghost f l) == f (last l))\nlet rec map_ghost_maps_last (#a: Type) (#b: Type) (f: a -> GTot b) (l: list a)\n : Lemma (requires Cons? l)\n (ensures last (map_ghost f l) == f (last l)) =\n match l with\n | [last_element] -> ()\n | first_element :: remaining_elements -> map_ghost_maps_last f remaining_elements", "val partition_mem_p_forall: #a:eqtype -> p:(a -> Tot bool)\n -> l:list a\n -> Lemma (requires True)\n (ensures (let l1, l2 = partition p l in\n (forall x. mem x l1 ==> p x) /\\ (forall x. mem x l2 ==> not (p x))))\nlet rec partition_mem_p_forall #a p l = match l with\n | [] -> ()\n | hd::tl -> partition_mem_p_forall p tl", "val partition_mem: #a:eqtype -> f:(a -> Tot bool)\n -> l:list a\n -> x:a\n -> Lemma (requires True)\n (ensures (let l1, l2 = partition f l in\n mem x l = (mem x l1 || mem x l2)))\nlet rec partition_mem #a f l x = match l with\n | [] -> ()\n | hd::tl -> partition_mem f tl x", "val lemma_map_index_aux (#a #b: Type) (f: (a -> b)) (s: seq a) (i: seq_index s)\n : Lemma (requires (True)) (ensures (f (index s i) == index (map f s) i)) (decreases (length s))\nlet rec lemma_map_index_aux (#a #b: Type) (f:a -> b) (s:seq a) (i:seq_index s):\n Lemma (requires (True))\n (ensures (f (index s i) == index (map f s) i))\n (decreases (length s)) =\n let n = length s in\n if n = 0 then ()\n else if i = n - 1 then ()\n else\n let s' = prefix s (n - 1) in\n let e = index s (n - 1) in\n lemma_map_index_aux f s' i;\n lemma_prefix_index s (n - 1) i;\n lemma_index_app1 (map f s') (create 1 (f e)) i", "val flatten_mem_lem (#a: _) (l: list (list a)) (x: a)\n : Lemma (memP x (flatten l) <==> (exists l0. memP l0 l /\\ memP x l0))\n [SMTPat (memP x (flatten l))]\nlet rec flatten_mem_lem #a (l : list (list a)) (x:a)\n : Lemma (memP x (flatten l) <==> (exists l0. memP l0 l /\\ memP x l0))\n [SMTPat (memP x (flatten l))]\n = match l with\n | [] -> ()\n | l1::ls -> (append_memP l1 (flatten ls) x; flatten_mem_lem ls x)", "val map (#a #b #i: _) (f: (a -> Gtd b i)) (xs: list a) : Gtd (list b) i\nlet rec map #a #b #i (f : a -> Gtd b i) (xs : list a) : Gtd (list b) i (* by (explode (); dump \"\") *) =\n match xs with\n | [] -> []\n | x::xs -> (f x)::(map f xs)", "val list_forallp_mem (#t: eqtype) (p: (t -> GTot Type0)) (l: list t)\n : Lemma (list_forallp p l <==> (forall x. L.mem x l ==> p x))\nlet rec list_forallp_mem (#t: eqtype) (p: t -> GTot Type0) (l: list t) : Lemma\n (list_forallp p l <==> (forall x . L.mem x l ==> p x))\n= match l with\n | [] -> ()\n | _ :: q -> list_forallp_mem p q", "val composable_maps_assoc_l (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)\n : Lemma (requires composable_maps p m1 m2 /\\ composable_maps p m0 (compose_maps p m1 m2))\n (ensures\n composable_maps p m0 m1 /\\ composable_maps p (compose_maps p m0 m1) m2 /\\\n compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2))\nlet composable_maps_assoc_l #k #a\n (p:pcm a)\n (m0 m1 m2: map k a)\n : Lemma\n (requires\n composable_maps p m1 m2 /\\\n composable_maps p m0 (compose_maps p m1 m2))\n (ensures\n composable_maps p m0 m1 /\\\n composable_maps p (compose_maps p m0 m1) m2 /\\\n compose_maps p (compose_maps p m0 m1) m2 ==\n compose_maps p m0 (compose_maps p m1 m2))\n = introduce forall key.\n composable p (Map.sel m0 key) (Map.sel m1 key)\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n let m01 = compose_maps p m0 m1 in\n introduce forall key.\n composable p (Map.sel m01 key) (Map.sel m2 key)\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n let m012 = compose_maps p m01 m2 in\n let m012' = compose_maps p m0 (compose_maps p m1 m2) in\n introduce forall key.\n Map.sel m012 key == Map.sel m012' key\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n assert (Map.equal\n (compose_maps p (compose_maps p m0 m1) m2)\n (compose_maps p m0 (compose_maps p m1 m2)))", "val composable_maps_assoc_l (#k #a: _) (p: pcm a) (m0 m1 m2: map k a)\n : Lemma (requires composable_maps p m1 m2 /\\ composable_maps p m0 (compose_maps p m1 m2))\n (ensures\n composable_maps p m0 m1 /\\ composable_maps p (compose_maps p m0 m1) m2 /\\\n compose_maps p (compose_maps p m0 m1) m2 == compose_maps p m0 (compose_maps p m1 m2))\nlet composable_maps_assoc_l #k #a\n (p:pcm a)\n (m0 m1 m2: map k a)\n : Lemma\n (requires\n composable_maps p m1 m2 /\\\n composable_maps p m0 (compose_maps p m1 m2))\n (ensures\n composable_maps p m0 m1 /\\\n composable_maps p (compose_maps p m0 m1) m2 /\\\n compose_maps p (compose_maps p m0 m1) m2 ==\n compose_maps p m0 (compose_maps p m1 m2))\n = introduce forall key.\n composable p (Map.sel m0 key) (Map.sel m1 key)\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n let m01 = compose_maps p m0 m1 in\n introduce forall key.\n composable p (Map.sel m01 key) (Map.sel m2 key)\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n let m012 = compose_maps p m01 m2 in\n let m012' = compose_maps p m0 (compose_maps p m1 m2) in\n introduce forall key.\n Map.sel m012 key == Map.sel m012' key\n with ( p.assoc (Map.sel m0 key) (Map.sel m1 key) (Map.sel m2 key) );\n assert (Map.equal\n (compose_maps p (compose_maps p m0 m1) m2)\n (compose_maps p m0 (compose_maps p m1 m2)))", "val assoc_mem_snd (#a #b: eqtype) (l: list (a * b)) (x: a) (y: b)\n : Lemma (requires (L.assoc x l == Some y))\n (ensures (list_mem y (list_map snd l) == true))\n (decreases l)\nlet rec assoc_mem_snd\n (#a #b: eqtype)\n (l: list (a * b))\n (x: a)\n (y: b)\n: Lemma\n (requires (L.assoc x l == Some y))\n (ensures (list_mem y (list_map snd l) == true))\n (decreases l)\n= let ((x', y') :: l') = l in\n if x' = x\n then ()\n else assoc_mem_snd l' x y", "val map_lemma: f:('a -> Tot 'b)\n -> l:(list 'a)\n -> Lemma (requires True)\n (ensures (length (map f l)) = length l)\n [SMTPat (map f l)]\nlet rec map_lemma f l =\n match l with\n | [] -> ()\n | h::t -> map_lemma f t", "val map_preserves_lists_correspond_ubool\n (#a #b #c: Type)\n (correspondence1: (a -> b -> GTot ubool))\n (correspondence2: (a -> c -> GTot ubool))\n (f: (b -> GTot c))\n (l1: list a)\n (l2: list b)\n : Lemma\n (requires\n lists_correspond_ubool correspondence1 l1 l2 /\\\n (forall x y. correspondence1 x y ==> correspondence2 x (f y)))\n (ensures lists_correspond_ubool correspondence2 l1 (map_ghost f l2))\nlet rec map_preserves_lists_correspond_ubool\n (#a: Type)\n (#b: Type)\n (#c: Type)\n (correspondence1: a -> b -> GTot ubool)\n (correspondence2: a -> c -> GTot ubool)\n (f: b -> GTot c)\n (l1: list a)\n (l2: list b)\n : Lemma (requires lists_correspond_ubool correspondence1 l1 l2\n /\\ (forall x y. correspondence1 x y ==> correspondence2 x (f y)))\n (ensures lists_correspond_ubool correspondence2 l1 (map_ghost f l2)) =\n match l1, l2 with\n | [], [] -> ()\n | hd1 :: tl1, hd2 :: tl2 ->\n map_preserves_lists_correspond_ubool correspondence1 correspondence2 f tl1 tl2", "val bind\n (a b: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (#pre_g: (a -> pre_t))\n (#post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val fold_left_dec (#a #b: _) (acc: a) (l: list b) (f: (a -> x: b{x << l} -> a))\n : Tot a (decreases l)\nlet rec fold_left_dec #a #b\n (acc : a)\n (l : list b)\n (f : a -> (x:b{x << l}) -> a)\n : Tot a (decreases l)\n =\n match l with\n | [] -> acc\n | x::xs -> fold_left_dec (f acc x) xs f", "val find_map (f: ('a -> option 'b)) (l: list 'a) : option 'b\nlet rec find_map (f: 'a -> option 'b) (l:list 'a) : option 'b =\n match l with\n | [] -> None\n | hd::tl -> let x = f hd in if Some? x then x else find_map f tl", "val map_ghost (#a #b: Type) (f: (a -> GTot b)) (l: list a) : GTot (list b)\nlet rec map_ghost (#a: Type) (#b: Type) (f: a -> GTot b) (l: list a) : GTot (list b) =\n match l with\n | [] -> []\n | hd :: tl -> (f hd) :: map_ghost f tl", "val map (#a:Type) (#b:Type) (f:a -> Tot b) (s:set a) : Tot (set b)\nlet map #_ #b f s = F.on_dom b (exists_y_in_s s f)" ], "closest_src": [ { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.map" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.pmap" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_map_intro" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_map_elim" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.map" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.map_dec" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Base.fst", "name": "FStar.List.Pure.Base.map2" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.unref" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_concatMap_intro" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_precedes" }, { "project_name": "FStar", "file_name": "FStar.List.Pure.Base.fst", "name": "FStar.List.Pure.Base.map3" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Enum.fst", "name": "LowParse.Spec.Enum.list_map" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.concatmaplemma" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.r_map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_memP_none" }, { "project_name": "steel", "file_name": "CBOR.Spec.Map.fst", "name": "CBOR.Spec.Map.list_memP_map_forall" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.map_append" }, { "project_name": "FStar", "file_name": "Printers.fst", "name": "Printers.maplast" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_dec" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_memP_some" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fsti", "name": "Zeta.SeqAux.mapi" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.memP_append_or" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.memP_append_or" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.memP_append_or" }, { "project_name": "FStar", "file_name": "OPLSS2021.Demo1.fst", "name": "OPLSS2021.Demo1.map" }, { "project_name": "FStar", "file_name": "OPLSS2021.Vector.fst", "name": "OPLSS2021.Vector.map" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.list_rec_of_function_is_map_1" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_allP" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.mem_memP" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.mem_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.fold_left_invar" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_append_aux" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.for_all_map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.filter" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.if_list_is_map_of_list_then_mapped_element_in_list" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.list_rec_of_function_is_map_2" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.map_preserves_lists_correspond" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_mem" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_allP0" }, { "project_name": "FStar", "file_name": "Alg.fst", "name": "Alg.listmap" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.pairwise_and'_forall" }, { "project_name": "dice-star", "file_name": "ASN1.Spec.Value.OID.fst", "name": "ASN1.Spec.Value.OID.list_mem_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_append_elim_l" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.mapi" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.map_aux" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.concatMap_flatten_map" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fst", "name": "LowParse.Low.Base.Spec.list_map_list_flatten_map" }, { "project_name": "FStar", "file_name": "FStar.List.fst", "name": "FStar.List.filter_map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.for_all_mem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_append_elim_r" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.append_memP" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.map_ghost_preserves_length" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.allP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.memP" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.pairwise_and'_forall_no_repeats" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.append_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_existsb" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.append_memP" }, { "project_name": "steel", "file_name": "Pulse.Common.fst", "name": "Pulse.Common.map_dec" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_memP_forall" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Derived.Lemmas.fst", "name": "FStar.Reflection.V2.Derived.Lemmas.list_ref" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.Lemmas.fst", "name": "FStar.Reflection.V1.Derived.Lemmas.list_ref" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.rev_memP" }, { "project_name": "FStar", "file_name": "FStar.List.fst", "name": "FStar.List.mapi" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fst", "name": "FStar.Monotonic.DependentMap.map_f" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpost" }, { "project_name": "steel", "file_name": "Pulse.Common.fst", "name": "Pulse.Common.concat_map_opt" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Secret.Seq.fst", "name": "QUIC.Secret.Seq.seq_map" }, { "project_name": "steel", "file_name": "Pulse.Common.fst", "name": "Pulse.Common.lemma_map_dec_len" }, { "project_name": "FStar", "file_name": "FStar.List.fst", "name": "FStar.List.map" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.FFI.fst", "name": "MiTLS.FFI.map" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.MapTree.fst", "name": "Vale.Lib.MapTree.map" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.memP_gfilter" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.big_and'_forall" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.fold_left_map" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.partition_mem_forall" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.mapi" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.pairwise_or'_exists" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_precedes" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.map_ghost_maps_last" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.partition_mem_p_forall" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.partition_mem" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_map_index_aux" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.flatten_mem_lem" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.map" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Enum.fst", "name": "LowParse.Spec.Enum.list_forallp_mem" }, { "project_name": "steel", "file_name": "Pulse.Lib.PCM.Map.fst", "name": "Pulse.Lib.PCM.Map.composable_maps_assoc_l" }, { "project_name": "steel", "file_name": "Steel.PCMMap.fst", "name": "Steel.PCMMap.composable_maps_assoc_l" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Enum.fst", "name": "LowParse.Spec.Enum.assoc_mem_snd" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.map_lemma" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.map_preserves_lists_correspond_ubool" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.fold_left_dec" }, { "project_name": "steel", "file_name": "Pulse.Extract.Main.fst", "name": "Pulse.Extract.Main.find_map" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.map_ghost" }, { "project_name": "FStar", "file_name": "FStar.TSet.fst", "name": "FStar.TSet.map" } ], "selected_premises": [ "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "ID1.l", "ID1.wp", "FStar.Pervasives.dfst", "FStar.Pervasives.id", "FStar.Ghost.return", "ID1.subcomp", "FStar.Pervasives.st_post_h", "FStar.Pervasives.dsnd", "FStar.Pervasives.st_stronger", "FStar.Ghost.op_let_At", "FStar.Ghost.elift2_pq", "FStar.Ghost.bind", "FStar.Pervasives.pure_close_wp", "FStar.Ghost.elift1_pq", "FStar.Ghost.elift1", "FStar.Pervasives.st_close_wp", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Pervasives.st_trivial", "FStar.Pervasives.all_close_wp", "FStar.Ghost.elift2", "ID1.repr", "FStar.Ghost.elift1_p", "ID1.return", "ID1.bind_wp", "Prims.__cache_version_number__", "ID1.test_f", "FStar.Ghost.push_refinement", "FStar.Ghost.elift2_p", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.trivial_pure_post", "FStar.Pervasives.st_post_h'", "FStar.Ghost.tot_to_gtot", "FStar.Pervasives.reveal_opaque", "FStar.Ghost.elift3", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.all_stronger", "FStar.Pervasives.st_return", "ID1.bind", "FStar.Pervasives.ex_close_wp", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.st_wp_h", "Prims.subtype_of", "FStar.Pervasives.ex_stronger", "Prims.purewp_id", "FStar.Pervasives.all_trivial", "FStar.Pervasives.pure_ite_wp", "Prims.pure_wp", "FStar.Pervasives.all_if_then_else", "ID1.ite_wp", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.all_return", "Prims.pure_post'", "Prims.pure_post", "FStar.Pervasives.ex_bind_wp", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Pervasives.ex_post", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.ex_if_then_else", "Prims.abs", "FStar.Pervasives.ex_post'", "Prims.pure_wp_monotonic0", "Prims.pure_trivial", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.ex_pre", "Prims.pure_stronger", "Prims.as_requires", "Prims.min", "FStar.Monotonic.Pure.elim_pure", "ID1.lift_pure_nd", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.ex_wp", "ID1.return_wp", "FStar.Pervasives.coerce_eq", "Prims.pure_wp_monotonic", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.pure_return", "FStar.Monotonic.Pure.is_monotonic", "FStar.Pervasives.ex_ite_wp", "Prims.as_ensures", "FStar.Pervasives.all_post_h'", "ID1.elim_pure", "Prims.pure_wp'", "FStar.Pervasives.all_post_h", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.lift_div_exn", "Prims.returnM", "Prims.pow2", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.ex_return", "Prims.pure_pre", "Prims.auto_squash", "Prims.l_True", "Prims.l_False", "Prims.op_Hat" ], "source_upto_this": "module ID1\n\nopen FStar.Ghost\n\nval wp (a : Type u#a) : Type u#(max 1 a)\nlet wp a = pure_wp a\n\nopen FStar.Monotonic.Pure\n\nlet repr (a : Type u#aa) (w : wp a) : Type u#(max 1 aa) =\n // Hmmm, the explicit post bumps the universe level\n p:erased (a -> Type0) -> squash (w p) -> v:a{reveal p v}\n\nunfold\nlet return_wp #a (x:a) : wp a =\n as_pure_wp (fun p -> p x)\n\nlet return (a : Type) (x : a) : repr a (return_wp x) =\n // Fun fact: using () instead of _ below makes us\n // lose the refinement and then this proof fails.\n // Keep that in mind all ye who enter here.\n fun p _ -> x\n\nunfold\nlet bind_wp #a #b\n (wp_v : wp a)\n (wp_f : (x:a -> wp b))\n : wp b\n = elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))\n\nlet bind (a b : Type) (wp_v : wp a) (wp_f: a -> wp b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= fun p _ -> let x = v (fun x -> wp_f x p) () in\n f x p ()\n\nlet subcomp (a:Type u#uu) (w1 w2:wp a)\n (f : repr a w1)\n: Pure (repr a w2)\n (requires (forall p. w2 p ==> w1 p))\n (ensures fun _ -> True)\n= f\n\n// useful?\n//let subcomp (a b:Type u#uu) (w1:wp a) (w2: wp b)\n// (f : repr a w1)\n//: Pure (repr b w2)\n// (requires a `subtype_of` b /\\ (forall (p:b->Type0). w2 p ==> w1 (fun x -> p x)))\n// (ensures fun _ -> True)\n//= fun p pf -> f (hide (fun x -> reveal p x)) ()\n\nunfold\nlet ite_wp #a (wp1 wp2 : wp a) (b : bool) : wp a =\n elim_pure_wp_monotonicity_forall ();\n (as_pure_wp (fun (p:a -> Type) -> (b ==> wp1 p) /\\ ((~b) ==> wp2 p)))\n\nlet if_then_else (a : Type) (wp1 wp2 : wp a) (f : repr a wp1) (g : repr a wp2) (p : bool) : Type =\n repr a (ite_wp wp1 wp2 p)\n\nlet default_if_then_else (a:Type) (wp:wp a) (f:repr a wp) (g:repr a wp) (p:bool)\n: Type\n= repr a wp\n\n// AR: 05/19: commenting this code, see ID5.fst that contains these functions too\n\n// let strengthen #a #w (p:Type0) (f : squash p -> repr a w) : repr a (fun post -> p /\\ w post) =\n// fun post _ -> f () post ()\n\n// let weaken #a #w (p:Type0) (f : repr a w) : Pure (repr a (fun post -> p ==> w post))\n// (requires p)\n// (ensures (fun _ -> True))\n// = fun post _ -> f post ()\n\n// let cut #a #w (p:Type0) (f : repr a w) : repr a (fun post -> p /\\ (p ==> w post)) =\n// strengthen p (fun _ -> weaken p f)\n\n\n// requires to prove that\n// p ==> f <: (if_then_else p f g)\n// ~p ==> g <: (if_then_else p f g)\n// if the effect definition fails, add lemmas for the\n// above with smtpats\ntotal\nreifiable\nreflectable\neffect {\n ID (a:Type) (_:wp a)\n with {repr; return; bind; subcomp; if_then_else}\n}\n\neffect Id (a:Type) (pre:Type0) (post:a->Type0) =\n ID a (as_pure_wp (fun p -> pre /\\ (forall x. post x ==> p x)))\n\neffect I (a:Type) = Id a True (fun _ -> True)\n\nopen FStar.Tactics.V2\n\nlet elim_pure #a #wp ($f : unit -> PURE a wp) p\n : Pure a (requires (wp p)) (ensures (fun r -> p r))\n = FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();\n f ()\n\nlet lift_pure_nd (a:Type) (wp:wp a) (f:unit -> PURE a wp) :\n Pure (repr a wp) (requires True)\n (ensures (fun _ -> True))\n = fun p _ -> elim_pure f p\n\nsub_effect PURE ~> ID = lift_pure_nd\n\nlet iassert (q:Type0) : ID unit (as_pure_wp (fun p -> q /\\ (q ==> p ()))) = ()\n\nassume\nval iassume (q:Type0) : ID unit (as_pure_wp (fun p -> q ==> p ()))\n\n(* Checking that it's kind of usable *)\n\nval test_f : unit -> ID int (as_pure_wp (fun p -> p 5 /\\ p 3))\nlet test_f () = 3\n\nlet l () : int = reify (test_f ()) (fun _ -> True) ()\n\n\nopen FStar.List.Tot\n", "sketch": [ "To implement pmap, we will iterate through the input list and apply the function to each element, collecting the results in a new list. We will ensure that the pre-condition holds for each element of the input list and that the post-condition holds for the resulting list.", "To implement the pmap function, we will use a recursive approach to apply the function f to each element of the list l, while ensuring that the predicate pre holds for each element. We will use the bind operation of the Id effect to sequence the computations and ensure that the predicate holds for each element.\n\n```fstar\nlet rec pmap #a #b (pre: a -> Type0) (f: (x: a -> Id b (requires (pre x)) (ensures (fun _ -> True)))) (l: list a)\n : Id (list b) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True)) (decreases l) =\n match l with\n | [] -> return []\n | x::xs -> bind (list b) (list b) (f x) (fun y -> bind (list b) (list b) (pmap pre f xs) (fun ys -> return (y :: ys)))\n```" ], "generated_solution": [ "val pmap (#a #b pre: _) (f: (x: a -> Id b (requires (pre x)) (ensures (fun _ -> True)))) (l: list a)\n : Id (list b) (requires (forall x. memP x l ==> pre x)) (ensures (fun _ -> True)) (decreases l)" ] }, { "file_name": "Pulse.Lib.HashTable.fst", "name": "Pulse.Lib.HashTable.mk_used_cell", "opens_and_abbrevs": [ { "open": "Pulse.Lib.HashTable.Type" }, { "open": "Pulse.Lib.HashTable.Spec" }, { "abbrev": "PHT", "full_module": "Pulse.Lib.HashTable.Spec" }, { "abbrev": "SZ", "full_module": "FStar.SizeT" }, { "abbrev": "R", "full_module": "Pulse.Lib.Reference" }, { "abbrev": "V", "full_module": "Pulse.Lib.Vec" }, { "open": "Pulse.Lib.Pervasives" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val mk_used_cell (#a: eqtype) (#b: _) (k: a) (v: b) : cell a b", "source_definition": "let mk_used_cell (#a:eqtype) #b (k:a) (v:b) : cell a b = Used k v", "source_range": { "start_line": 31, "start_col": 0, "end_line": 31, "end_col": 65 }, "interleaved": false, "definition": "fun k v -> Pulse.Lib.HashTable.Spec.Used k v <: Pulse.Lib.HashTable.Spec.cell a b", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.eqtype", "Pulse.Lib.HashTable.Spec.Used", "Pulse.Lib.HashTable.Spec.cell" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "k: a -> v: b -> Pulse.Lib.HashTable.Spec.cell a b", "prompt": "let mk_used_cell (#a: eqtype) #b (k: a) (v: b) : cell a b =\n ", "expected_response": "Used k v", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.HashTable.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.HashTable.fst", "checked_file": "dataset/Pulse.Lib.HashTable.fst.checked", "interface_file": false, "dependencies": [ "dataset/Pulse.Lib.Vec.fsti.checked", "dataset/Pulse.Lib.Reference.fsti.checked", "dataset/Pulse.Lib.Pervasives.fst.checked", "dataset/Pulse.Lib.HashTable.Type.fsti.checked", "dataset/Pulse.Lib.HashTable.Spec.fst.checked", "dataset/prims.fst.checked", "dataset/FStar.SizeT.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [], "closest": [ "val mk_cell (#a:Type0) (n: t a) (d:a)\n : Pure (cell a)\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\nlet mk_cell #a (n: t a) (d:a) = {\n tail_fuel = Ghost.hide 0;\n next = n;\n data = d\n}", "val mk_cell (#a:Type0) (n: t a) (d:a)\n : Pure (cell a)\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\nlet mk_cell #a (n: t a) (d:a) = {\n next = n;\n data = d\n}", "val mk_cell (#a:Type0) (n: t a) (d:a)\n : Pure (cell a)\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\nlet mk_cell #a (n: t a) (d:a) = {\n tail_fuel = Ghost.hide 0;\n next = n;\n data = d\n}", "val mk_cell (#a:Type0) (n: t a) (d:ref a)\n : Pure (cell a)\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\nlet mk_cell #a (n: t a) (d:ref a) = {\n next = n;\n data = d\n}", "val mk_cell (n: t) (d: a) : Pure cell (requires True) (ensures fun c -> next c == n /\\ data c == d)\nlet mk_cell (n: t) (d:a)\n : Pure cell\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\n= LL.mk_cell n d", "val mk_cell (n: t) (d: a) : Pure cell (requires True) (ensures fun c -> next c == n /\\ data c == d)\nlet mk_cell (n: t) (d:a)\n : Pure cell\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\n= LL.mk_cell n d", "val mk_cell (n: t 'a) (d:'a)\n : Pure (cell 'a)\n (requires True)\n (ensures fun c ->\n next c == n /\\\n data c == d)\nlet mk_cell (n: t 'a) (d:'a) = {\n next = n;\n data = d\n}", "val insert (#a: eqtype) (#b: Type u#b) (k: a) (v: b) (m: map a b)\n : map a b\nlet insert (#a: eqtype) (#b: Type u#b) (k: a) (v: b) (m: map a b) : map a b =\n let keys' = FSet.insert k (domain m) in\n let f' = on_domain a (fun key -> if key = k then Some v else (elements m) key) in\n (| keys', f' |)", "val mkNode (#a: eqtype) (#b: Type) (key: a) (value: b) (l r: tree a b) : tree a b\nlet mkNode (#a:eqtype) (#b:Type) (key:a) (value:b) (l r:tree a b) : tree a b =\n let hl = height l in\n let hr = height r in\n let h = if hl > hr then hl else hr in\n Node key value (h + 1) l r", "val v_cell\n (#a: Type0)\n (#p: vprop)\n (r: t a)\n (h: rmem p {FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_cell r) /\\ True)}\n )\n : GTot (list (cell a))\nlet v_cell (#a:Type0) (#p:vprop) (r:t a)\n (h:rmem p{FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_cell r) /\\ True)}) : GTot (list (cell a))\n = h (llist_cell r)", "val v_cell\n (#a: Type0)\n (#p: vprop)\n (r: t a)\n (h: rmem p {FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_cell r) /\\ True)}\n )\n : GTot (list (cell a * a))\nlet v_cell (#a:Type0) (#p:vprop) (r:t a)\n (h:rmem p{FStar.Tactics.with_tactic selector_tactic (can_be_split p (llist_cell r) /\\ True)}) : GTot (list (cell a * a))\n = h (llist_cell r)", "val lemma_used_upd\n (#kt #vt #sz spec: _)\n (repr: repr_t_sz kt vt sz)\n (off: nat{off < sz})\n (k: _)\n (v v': vt)\n : Lemma\n (requires\n pht_models spec repr /\\ Some? (lookup_repr repr k) /\\\n repr @@ (canonical_index k repr + off) % sz == Used k v' /\\\n all_used_not_by repr (canonical_index k repr) off k)\n (ensures pht_models (spec ++ (k, v)) (upd_ repr ((canonical_index k repr + off) % sz) k v))\nlet lemma_used_upd #kt #vt #sz spec (repr : repr_t_sz kt vt sz) (off:nat{off < sz}) k (v v' : vt) \n : Lemma\n (requires pht_models spec repr\n /\\ Some? (lookup_repr repr k)\n /\\ repr @@ (canonical_index k repr + off)%sz == Used k v'\n /\\ all_used_not_by repr (canonical_index k repr) off k)\n (ensures pht_models (spec ++ (k,v)) (upd_ repr ((canonical_index k repr + off)%sz) k v))\n = let spec' = spec ++ (k,v) in\n let idx = (canonical_index k repr + off) % sz in\n let repr' = upd_ repr idx k v in\n let aux1 (k':kt) : Lemma (requires (Some? (lookup_spec spec' k')))\n (ensures (lookup_repr repr' k' == lookup_spec spec' k'))\n = if k' = k then\n lemma_walk_from_canonical_all_used repr' off k v\n else\n lemma_used_upd_lookup_walk spec spec' repr repr' idx k k' v v' \n in\n let aux2 (k':kt) : Lemma (requires (Some? (lookup_repr repr' k')))\n (ensures (lookup_repr repr' k' == lookup_spec spec' k'))\n = if k' = k then\n lemma_walk_from_canonical_all_used repr' off k v\n else\n lemma_used_upd_lookup_walk spec spec' repr repr' idx k k' v v'\n in\n let aux3 (i':nat{i' SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop\nlet token (#k:eqtype) (#v:Type0)\n (r:ref (ht_t k v))\n (r_sz:ref pos_us)\n (r_hashf:ref (k -> SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop =\n exists* ht. pts_to r ht", "val equal (#k:eqtype) (#v:Type) (m1 m2:t k v) : prop\nlet equal m1 m2 = feq m1 m2 /\\ True", "val exploded_vp\n (#k: eqtype)\n (#v: Type0)\n (r: ref (ht_t k v))\n (ht: ht_t k v)\n (r_sz: ref pos_us)\n (r_hashf: ref (k -> SZ.t))\n (r_contents: ref (V.vec (cell k v)))\n : vprop\nlet exploded_vp (#k:eqtype) (#v:Type0)\n (r:ref (ht_t k v))\n (ht:ht_t k v)\n (r_sz:ref pos_us)\n (r_hashf:ref (k -> SZ.t))\n (r_contents:ref (V.vec (cell k v))) : vprop = \n pts_to r_sz ht.sz **\n pts_to r_hashf ht.hashf **\n pts_to r_contents ht.contents **\n token r r_sz r_hashf r_contents", "val next (#a:Type0) (c:cell a) : t a\nlet next #a (c:cell a) : t a = c.next", "val next (#a:Type0) (c:cell a) : t a\nlet next #a (c:cell a) : t a = c.next", "val next (#a:Type0) (c:cell a) : t a\nlet next #a (c:cell a) : t a = c.next", "val next (#a:Type0) (c:cell a) : t a\nlet next #a (c:cell a) : t a = c.next", "val mk_eq : eq_kind -> term -> term -> Tot term\nlet mk_eq k t1 t2 =\n match k with\n | Eq_Dec ty ->\n mk_app (`Prims.op_Equality) [(ty, Q_Implicit); (t1, Q_Explicit); (t2, Q_Explicit)]\n | Eq_Undec ty ->\n mk_app (`Prims.eq2) [(ty, Q_Implicit); (t1, Q_Explicit); (t2, Q_Explicit)]\n | Eq_Hetero ty1 ty2 ->\n mk_app Prims.(`( === )) [(ty1, Q_Implicit); (ty2, Q_Implicit);\n (t1, Q_Explicit); (t2, Q_Explicit)]", "val reveal_non_empty_cell (#a:Type0) (ptr:t a)\n : Steel unit (llist_cell ptr) (fun _ -> llist_cell ptr)\n (requires fun _ -> ptr =!= null_llist)\n (ensures fun h0 _ h1 -> v_cell ptr h0 == v_cell ptr h1 /\\ Cons? (v_cell ptr h0))\nlet reveal_non_empty_cell #a ptr =\n let h = get () in\n let l = hide (v_cell ptr h) in\n extract_info (llist_cell ptr) l (is_cons l) (reveal_non_empty_lemma ptr l)", "val map (a:eqtype) (b:Type u#a) : Type u#a\nlet map = map'", "val map (#a #b: _) (f: (a -> b)) (#n: _) (v: vector a n) : vector b n\nlet rec map #a #b (f:a -> b) #n (v:vector a n)\n : vector b n\n = match v with\n | VNil -> VNil\n | VCons hd tl -> VCons (f hd) (map f tl)", "val map (#a #b: _) (f: (a -> b)) (#n: _) (v: vector a n) : vector b n\nlet rec map #a #b (f:a -> b) #n (v:vector a n)\n : vector b n\n = match v with\n | VNil -> VNil\n | VCons hd tl -> VCons (f hd) (map f tl)", "val find (#t_k: eqtype) (#t_v: Type0) (ll: t t_k t_v) (k: t_k):\n Stack (option t_v)\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 x h1 ->\n let m: map t_k t_v = v h0 ll in\n h0 == h1 /\\\n x == M.sel m k)\nlet find #_ #_ ll k =\n find_ !*ll.LL2.ptr !*ll.LL2.v k", "val ccell' (#a: Type0) (c: ccell_ptrvalue a) : GTot vprop'\nlet ccell'\n (#a: Type0)\n (c: ccell_ptrvalue a)\n: GTot vprop'\n= {\n hp = ccell_hp c;\n t = vcell a;\n sel = ccell_sel c;\n}", "val find_ (#t_k: eqtype) (#t_v: Type0) (hd: LL1.t (t_k & t_v)) (l: G.erased (list (t_k & t_v))) (k: t_k):\n Stack (option t_v)\n (requires fun h0 ->\n LL1.well_formed h0 hd l /\\\n LL1.invariant h0 hd l)\n (ensures fun h0 x h1 ->\n let m: map t_k t_v = v_ l in\n h0 == h1 /\\\n x == M.sel m k)\nlet rec find_ #_ #_ hd l k =\n if B.is_null hd then\n None\n else\n let cell = !* hd in\n if fst cell.LL1.data = k then\n Some (snd cell.LL1.data)\n else\n find_ cell.LL1.next (List.Tot.tl l) k", "val empty (k:eqtype) (v:Type) : t k v\nlet empty _ _ = on_dom _ (fun _ -> None)", "val ccell1 (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop\nlet ccell1\n (#a: Type0)\n (c: ccell_ptrvalue a)\n: Tot vprop\n= ccell_is_lvalue c `vdep` ccell0 a `vrewrite` ccell_rewrite c", "val const (#k: eqtype) (#v: Type) (value: v) : t k v\nlet const (#k: eqtype) (#v: Type) (value: v) : t k v = FStar.FunctionalExtensionality.on k (fun (_: k) -> value)", "val data (#a:Type0) (c:cell a) : a\nlet data #a (c:cell a) : a = c.data", "val data (#a:Type0) (c:cell a) : a\nlet data #a (c:cell a) : a = c.data", "val data (#a:Type0) (c:cell a) : a\nlet data #a (c:cell a) : a = c.data", "val elim_ccell\n (#opened: _)\n (#a: Type0)\n (c: ccell_ptrvalue a)\n: SteelAtomic (ccell_lvalue a) opened\n (ccell c)\n (fun c' -> vptr (ccell_data c') `star` vptr (ccell_next c'))\n (fun _ -> True)\n (fun h c' h' ->\n ccell_ptrvalue_is_null c == false /\\\n (c' <: ccell_ptrvalue a) == c /\\\n h (ccell c) == { vcell_data = h' (vptr (ccell_data c')); vcell_next = h' (vptr (ccell_next c')) }\n )\nlet elim_ccell\n #opened #a c\n=\n let c2 = elim_ccell_ghost c in\n let c : ccell_lvalue a = c in\n change_equal_slprop (vptr (ccell_data c2)) (vptr (ccell_data c));\n change_equal_slprop (vptr (ccell_next c2)) (vptr (ccell_next c));\n return c", "val sel (#a:eqtype) (#b:Type) (m:map a b) (key:a) : b\nlet sel #a #b (Map is_le t d _) key =\n match get is_le t key with Some v -> v | None -> d", "val v: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> GTot (map t_k t_v)\nlet v #_ #_ h ll =\n let l = LL2.v h ll in\n v_ l", "val v_: #t_k:eqtype -> #t_v:Type0 -> l:list (t_k & t_v) -> Tot (map t_k t_v)\nlet v_ #_ #t_v l =\n List.Tot.fold_right (fun (k, v) m -> M.upd m k (Some v)) l (M.const (None #t_v))", "val literal (#k:eqtype) (#v:Type) (f:k -> option v) : t k v\nlet literal f = on_dom _ (fun x -> f x)", "val balance (#a: eqtype) (#b: Type) (t: tree a b) : tree a b\nlet balance (#a:eqtype) (#b:Type) (t:tree a b) : tree a b =\n match t with\n | Node _ _ _ l r ->\n let hl = height l in\n let hr = height r in\n if hl >= hr + 2 then rotate_r t else\n if hr >= hl + 2 then rotate_l t else\n t\n | _ -> t", "val ccell (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop\nlet ccell (#a: Type0) (c: ccell_ptrvalue a) : Tot vprop =\n VUnit (ccell' c)", "val mk_ref (a: R.term) : R.term\nlet mk_ref (a:R.term) : R.term =\n let open R in\n let t = pack_ln (Tv_FVar (pack_fv ref_lid)) in\n pack_ln (Tv_App t (a, Q_Explicit))", "val push (#a:Type) (ptr:t a) (l:list (cell a)) (v:a)\n : Steel (t a & list (cell a))\n (llist ptr l)\n (fun pc -> llist (fst pc) (snd pc))\n (requires fun _ -> True)\n (ensures fun _ pc _ -> datas (snd pc) == v::datas l)\nlet push #a ptr l v =\n let cell = mk_cell ptr v in\n let p = alloc_pt cell in\n rewrite_slprop (llist ptr l) (llist (next cell) l) (fun _ -> ());\n intro_llist_cons p cell l;\n let pc = p, (cell::l) in\n pc", "val llist (#a:Type) (ptr:t a) (l:list (cell a)) : vprop\nlet llist = llist'", "val lemma_walk_from_canonical_all_used\n (#kt #kv: _)\n (repr: repr_t kt kv)\n (off: nat{off < repr.sz})\n (k v: _)\n : Lemma\n (requires\n all_used_not_by repr (canonical_index k repr) off k /\\\n repr @@ ((canonical_index k repr + off) % repr.sz) == Used k v)\n (ensures lookup_repr repr k == Some v)\nlet lemma_walk_from_canonical_all_used #kt #kv (repr : repr_t kt kv) (off : nat{off < repr.sz}) k v \n : Lemma (requires all_used_not_by repr (canonical_index k repr) off k\n /\\ repr @@ ((canonical_index k repr + off) % repr.sz) == Used k v)\n (ensures lookup_repr repr k == Some v)\n= let sz = repr.sz in\n let cidx = canonical_index k repr in\n let rec aux (off':nat{off' <= off}) (_ : squash (all_used_not_by repr ((cidx+off')%sz) (off-off') k))\n : Lemma (ensures walk repr cidx k off' == Some v)\n (decreases off - off')\n = if off' = off then () else begin\n Math.Lemmas.modulo_distributivity (cidx+off') 1 sz;\n assert (sz >= 2); // Note: we can only be here if off>0, which means sz>1\n Math.Lemmas.modulo_lemma 1 sz;\n assert (1 % sz == 1);\n assert (((cidx + off') % sz + 1) % sz == (cidx+off'+1) % sz);\n aunb_shrink repr ((cidx+off')%sz) (off-off') k;\n aux (off'+1) ()\n end\n in\n Math.Lemmas.modulo_lemma cidx sz;\n assert (cidx % sz == cidx); // hint for z3\n aux 0 ();\n assert (lookup_repr repr k == walk repr cidx k 0);\n assert (lookup_repr repr k == Some v);\n ()", "val data (#a:Type0) (c:cell a) : ref a\nlet data #a (c:cell a) : ref a = c.data", "val const (k: eqtype) (#v: Type) (y: v) : t k v\nlet const (k:eqtype) (#v:Type) (y:v) : t k v =\n literal (fun x -> Some y)", "val from_list_cell (#a:Type0) (ptr:t a)\n : Steel unit (llist_cell ptr) (fun _ -> llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 _ h1 -> v_llist ptr h1 == datas (v_cell ptr h0))\nlet from_list_cell ptr =\n change_slprop_rel (llist_cell ptr) (llist ptr) (fun x y -> datas x == y) (fun _ -> ())", "val assoc (#a: eqtype) (#b: _) (x: a) (l: list (a & b)) : Tac b\nlet assoc (#a: eqtype) #b (x: a) (l: list (a & b)): Tac b =\n match List.Tot.assoc x l with\n | Some x -> x\n | None -> fail \"failure: assoc\"", "val map_vec (#a #b: _) (f: (a -> b)) (#n: _) (v: vector a n) : vector b n\nlet rec map_vec #a #b (f:a -> b) #n (v:vector a n)\n : vector b n\n = match v with\n | VNil -> VNil\n | VCons hd tl -> VCons (f hd) (map_vec f tl)", "val tail_cell_lemma (#a: Type0) (r: t a) (l: list (cell a)) (m: mem)\n : Lemma (requires Cons? l /\\ interp (llist_sl r) m /\\ llist_sel_cell r m == l)\n (ensures\n (let x = L.hd l in\n interp ((ptr r) `Mem.star` (llist_sl (next x))) m /\\ sel_of (vptr r) m == x /\\\n sel_of (llist_cell (next x)) m == L.tl l))\nlet tail_cell_lemma (#a:Type0) (r:t a) (l:list (cell a)) (m:mem) : Lemma\n (requires Cons? l /\\ interp (llist_sl r) m /\\ llist_sel_cell r m == l)\n (ensures (let x = L.hd l in\n interp (ptr r `Mem.star` llist_sl (next x)) m /\\\n sel_of (vptr r) m == x /\\\n sel_of (llist_cell (next x)) m == L.tl l))\n = llist_sel_interp r l m;\n assert (interp (llist_sl' r l) m);\n let x = L.hd l in\n let tl = L.tl l in\n let sl = pts_to_sl r full_perm x `Mem.star` llist_sl' (next x) tl in\n pure_star_interp sl (r =!= null_llist) m;\n emp_unit sl;\n assert (interp sl m);\n let aux (m:mem) (ml mr:mem) : Lemma\n (requires disjoint ml mr /\\ m == join ml mr /\\\n interp (pts_to_sl r full_perm x) ml /\\ interp (llist_sl' (next x) tl) mr)\n (ensures interp (ptr r `Mem.star` llist_sl (next x)) m /\\\n sel_of (vptr r) m == x /\\\n sel_of (llist_cell (next x)) m == tl)\n = intro_ptr_interp r (hide x) ml;\n llist_sel_interp (next x) tl mr;\n intro_star (ptr r) (llist_sl (next x)) ml mr;\n ptr_sel_interp r ml;\n pts_to_witinv r full_perm;\n join_commutative ml mr\n in\n elim_star (pts_to_sl r full_perm x) (llist_sl' (next x) tl) m;\n Classical.forall_intro_2 (Classical.move_requires_2 (aux m))", "val all_used_not_by\n (#kt #kv: _)\n (repr: repr_t kt kv)\n (idx: (n: nat{n < repr.sz}))\n (len: nat)\n (k: kt)\n : prop\nlet all_used_not_by #kt #kv (repr : repr_t kt kv) (idx : (n:nat{n < repr.sz})) (len : nat) (k : kt) : prop =\n forall (i:nat{i < len}). used_not_by repr k ((idx+i) % repr.sz)", "val create_v\n (#k:eqtype)\n (#v:Type0)\n (#contents:Type)\n (vp:vp_t k v contents)\n (h:hash_fn k)\n (n:us{US.v n > 0})\n (c:G.erased contents)\n : STT (tbl vp h)\n emp\n (fun a -> tperm a (Map.const k (G.reveal c)) (Map.empty k v))\nlet create_v #k #v #contents vp h n c =\n let store = A.alloc #(option (k & v)) None n in\n let arr : tbl #k #v #contents vp h = {\n store_len = n;\n store = store;\n store_len_pf = () } in\n\n //\n //rewrite in terms of projections from the arr record\n //\n rewrite (A.pts_to store _ (Seq.create #(option (k & v)) (US.v n) None))\n (A.pts_to arr.store _ (Seq.create #(option (k & v)) (US.v n) None));\n\n //\n //The value vprops at this point are all emp\n //\n //A lemma that tells us that folding a monoid over a sequence of units\n // is monoid-equivalent to the unit\n //\n SeqPerm.foldm_snoc_unit_seq\n vprop_monoid\n (value_vprops_seq vp (Seq.create (US.v n) None)\n (Map.const k (G.reveal c))\n (Map.empty k v));\n rewrite_equiv emp (value_vprops vp (Seq.create (US.v n) None)\n (Map.const k (G.reveal c))\n (Map.empty k v));\n\n pack_tperm (Seq.create (US.v n) None)\n (Map.const k (G.reveal c))\n (Map.empty k v)\n arr;\n\n return arr", "val lookup (#a: eqtype) (#b: Type u#b) (key: a) (m: map a b {mem key m}) : b\nlet lookup (#a: eqtype) (#b: Type u#b) (key: a) (m: map a b{mem key m})\n : b =\n Some?.v ((elements m) key)", "val strong_used_not_by (#kt #kv: _) (repr: repr_t kt kv) (k: kt) (i: nat{i < repr.sz}) : prop\nlet strong_used_not_by #kt #kv (repr : repr_t kt kv) (k : kt) (i : nat{i < repr.sz}): prop =\n (Used? (repr @@ i) /\\ Used?.k (repr @@ i) <> k)", "val sel (#k:eqtype) (#v:Type) (m:t k v) (x:k) : option v\nlet sel m x = m x", "val contains (#k: eqtype) (#v: Type) (m: t k v) (x: k) : bool\nlet contains (#k:eqtype) (#v:Type) (m:t k v) (x:k) : bool =\n Some? (sel m x)", "val alloc_cell\n (#a: Type0)\n (data: a)\n (next: ccell_ptrvalue a)\n: Steel (ccell_lvalue a)\n emp\n (fun res -> ccell res)\n (requires (fun _ -> True))\n (ensures (fun _ res h' ->\n h' (ccell res) == ({ vcell_data = data; vcell_next = next; })\n ))\nlet alloc_cell\n #a data next\n=\n let rdata = ralloc data in\n let rnext = ralloc next in\n let res : ccell_lvalue a = ({ data = rdata; next = rnext; all_or_none_null = () }) in\n change_equal_slprop (vptr rdata) (vptr (ccell_data res));\n change_equal_slprop (vptr rnext) (vptr (ccell_next res));\n intro_ccell res;\n return res", "val Spec.Map.t = k: Prims.eqtype -> v: Type -> Type\nlet t (k: eqtype) (v: Type) = k ^-> v", "val reclaim (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : STT unit\r\n (perm a init m b)\r\n (fun _ -> perm a init m (PartialMap.remove b i))\nlet reclaim #v #c #vp #init #m #b a i =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n let _ = ETbl.remove a.etbl i in\r\n intro_pure (high_epoch_id_prop (G.reveal init) m (PartialMap.remove b i) w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m (PartialMap.remove b i) a.high)", "val add (#t_k: eqtype) (#t_v: Type0) (ll: t t_k t_v) (k: t_k) (x: t_v):\n ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.modifies (region_of ll) h0 h1 /\\\n invariant h1 ll /\\\n v h1 ll == M.upd (v h0 ll) k (Some x))\nlet add #_ #_ ll k x =\n LL2.push ll (k, x)", "val free_cell\n (#a: Type0)\n (c: ccell_ptrvalue a) // could be ccell_lvalue, but ccell gives the right refinement\n: SteelT unit\n (ccell c)\n (fun _ -> emp)\nlet free_cell\n #a c\n=\n let c = elim_ccell c in\n free (ccell_data c);\n free (ccell_next c)", "val write (#a: Type) (#rel: preorder a) (r: mref a rel) (v: a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 ->\n rel (sel h0 r) v /\\ h0 `contains` r /\\ modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\ sel h1 r == v)\nlet write (#a:Type) (#rel:preorder a) (r:mref a rel) (v:a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 -> rel (sel h0 r) v /\\ h0 `contains` r /\\\n modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\\n sel h1 r == v)\n = let h0 = gst_get () in\n gst_recall (contains_pred r);\n let h1 = upd_tot h0 r v in\n Heap.lemma_distinct_addrs_distinct_preorders ();\n Heap.lemma_distinct_addrs_distinct_mm ();\n Heap.lemma_upd_equals_upd_tot_for_contained_refs h0 r v;\n gst_put h1", "val elim_cons_cell_lemma (#a: Type0) (r: t a) (l: list (cell a * a)) (m: mem)\n : Lemma (requires Cons? l /\\ interp (llist_ptr_sl r) m /\\ llist_ptr_sel_cell r m == l)\n (ensures\n (let x = fst (L.hd l) in\n interp (((ptr r) `Mem.star` (llist_ptr_sl (next x))) `Mem.star` (ptr (data x))) m /\\\n sel_of (vptr r) m == x /\\ sel_of (vptr (data x)) m == snd (L.hd l) /\\\n sel_of (llist_cell (next x)) m == L.tl l))\nlet elim_cons_cell_lemma (#a:Type0) (r:t a) (l:list (cell a * a)) (m:mem) : Lemma\n (requires Cons? l /\\ interp (llist_ptr_sl r) m /\\ llist_ptr_sel_cell r m == l)\n (ensures (let x = fst (L.hd l) in\n interp (ptr r `Mem.star` llist_ptr_sl (next x) `Mem.star` ptr (data x)) m /\\\n sel_of (vptr r) m == x /\\\n sel_of (vptr (data x)) m == snd (L.hd l) /\\\n sel_of (llist_cell (next x)) m == L.tl l))\n = llist_sel_interp r l m;\n assert (interp (llist_ptr_sl' r l) m);\n let x = fst (L.hd l) in\n let v = snd (L.hd l) in\n let tl = L.tl l in\n let sl = pts_to_sl r full_perm x `Mem.star` llist_ptr_sl' (next x) tl `Mem.star` pts_to_sl (data x) full_perm v in\n pure_star_interp sl (r =!= null_llist) m;\n emp_unit sl;\n assert (interp sl m);\n let aux (m:mem) (ml1 ml2 mr:mem) : Lemma\n (requires disjoint ml1 ml2 /\\ disjoint (join ml1 ml2) mr /\\ m == join (join ml1 ml2) mr /\\\n interp (pts_to_sl r full_perm x) ml1 /\\\n interp (llist_ptr_sl' (next x) tl) ml2 /\\\n interp (pts_to_sl (data x) full_perm v) mr)\n (ensures interp (ptr r `Mem.star` llist_ptr_sl (next x) `Mem.star` ptr (data x)) m /\\\n sel_of (vptr r) m == x /\\\n sel_of (llist_cell (next x)) m == tl /\\\n sel_of (vptr (data x)) m == v)\n = intro_ptr_interp r (hide x) ml1;\n llist_sel_interp (next x) tl ml2;\n intro_star (ptr r) (llist_ptr_sl (next x)) ml1 ml2;\n ptr_sel_interp r ml1;\n pts_to_witinv r full_perm;\n join_commutative ml1 ml2;\n let ml = join ml1 ml2 in\n assert (interp (ptr r `Mem.star` llist_ptr_sl (next x)) ml);\n intro_ptr_interp (data x) (hide v) mr;\n intro_star (ptr r `Mem.star` llist_ptr_sl (next x)) (ptr (data x)) ml mr;\n ptr_sel_interp (data x) mr;\n pts_to_witinv (data x) full_perm;\n join_commutative ml mr\n in\n elim_star\n (pts_to_sl r full_perm x `Mem.star` llist_ptr_sl' (next x) tl)\n (pts_to_sl (data x) full_perm v) m;\n Classical.forall_intro (Classical.move_requires\n (elim_star (pts_to_sl r full_perm x) (llist_ptr_sl' (next x) tl)));\n Classical.forall_intro_3 (Classical.move_requires_3 (aux m))", "val equal (#k:eqtype) (#v:Type) (#f:cmp k) (m1:ordmap k v f) (m2:ordmap k v f) : prop\nlet equal (#k:eqtype) (#v:Type) (#f:cmp k) (m1:ordmap k v f) (m2:ordmap k v f) =\n forall x. select #k #v #f x m1 == select #k #v #f x m2", "val intro_ccell\n (#opened: _)\n (#a: Type0)\n (c: ccell_lvalue a)\n: SteelGhost unit opened\n (vptr (ccell_data c) `star` vptr (ccell_next c))\n (fun _ -> ccell c)\n (fun _ -> True)\n (fun h res h' ->\n h' (ccell c) == ({ vcell_data = h (vptr (ccell_data c)); vcell_next = h (vptr (ccell_next c))})\n )\nlet intro_ccell\n #opened #a c\n=\n intro_ccell_is_lvalue c;\n reveal_star (vptr (ccell_data c)) (vptr (ccell_next c));\n intro_vdep\n (ccell_is_lvalue c)\n (vptr (ccell_data c) `star` vptr (ccell_next c))\n (ccell0 a);\n intro_vrewrite\n (ccell_is_lvalue c `vdep` ccell0 a)\n (ccell_rewrite c);\n change_slprop_rel\n (ccell1 c)\n (ccell c)\n (fun x y -> x == y)\n (fun m ->\n assert_norm (hp_of (ccell1 c) == ccell_hp c);\n assert_norm (sel_of (ccell1 c) m === sel_of (ccell c) m)\n )", "val mk_ref (t: term) : term\nlet mk_ref (t:term) : term = tm_pureapp (tm_fvar (as_fv ref_lid)) None t", "val next (c: cell) : t\nlet next (c:cell) : t = LL.next c", "val next (c: cell) : t\nlet next (c:cell) : t = LL.next c", "val elim_cons_cell (#a: Type0) (ptr: t a)\n : Steel (cell a)\n (llist_cell ptr)\n (fun c -> ((vptr ptr) `star` (vptr (data c))) `star` (llist_cell (next c)))\n (requires fun _ -> ptr =!= null_llist)\n (ensures\n fun h0 c h1 ->\n Cons? (v_cell ptr h0) /\\ c == sel ptr h1 /\\ sel ptr h1 == fst (L.hd (v_cell ptr h0)) /\\\n sel (data c) h1 == snd (L.hd (v_cell ptr h0)) /\\\n v_cell (next c) h1 == L.tl (v_cell ptr h0))\nlet elim_cons_cell (#a:Type0) (ptr:t a)\n : Steel (cell a) (llist_cell ptr)\n (fun c -> vptr ptr `star` vptr (data c) `star` llist_cell (next c))\n (requires fun _ -> ptr =!= null_llist)\n (ensures fun h0 c h1 ->\n Cons? (v_cell ptr h0) /\\\n c == sel ptr h1 /\\\n sel ptr h1 == fst (L.hd (v_cell ptr h0)) /\\\n sel (data c) h1 == snd (L.hd (v_cell ptr h0)) /\\\n v_cell (next c) h1 == L.tl (v_cell ptr h0))\n = let h = get () in\n let l = hide (v_cell ptr h) in\n reveal_non_empty_cell ptr;\n let gc = hide (fst (L.hd l)) in\n change_slprop\n (llist_cell ptr)\n (vptr ptr `star` llist_cell (next gc) `star` vptr (data gc))\n l ((reveal gc, L.tl l), snd (L.hd l)) (fun m -> elim_cons_cell_lemma ptr l m);\n let c = read ptr in\n change_slprop (llist_cell (next gc)) (llist_cell (next c)) (L.tl l) (L.tl l) (fun _ -> ());\n change_slprop (vptr (data gc)) (vptr (data c)) (snd (L.hd l)) (snd (L.hd l)) (fun _ -> ());\n return c", "val mk_eq2 (u: R.universe) (ty e1 e2: R.term) : R.term\nlet mk_eq2 (u:R.universe) (ty e1 e2:R.term) : R.term =\n let open R in\n let t = pack_ln (Tv_UInst (pack_fv R.eq2_qn) [u]) in\n let t = pack_ln (Tv_App t (ty, Q_Implicit)) in\n let t = pack_ln (Tv_App t (e1, Q_Explicit)) in\n pack_ln (Tv_App t (e2, Q_Explicit))", "val cells (#a: _) (h: HS.mem) (c: t a) (l: list a)\n : Ghost (list (B.pointer (cell a)))\n (requires well_formed h c l)\n (ensures fun _ -> True)\n (decreases l)\nlet rec cells #a (h: HS.mem) (c: t a) (l: list a): Ghost (list (B.pointer (cell a)))\n (requires well_formed h c l)\n (ensures fun _ -> True)\n (decreases l)\n=\n if B.g_is_null c then\n []\n else\n c :: cells h (B.deref h c).next (List.Tot.tl l)", "val bind (a b: Type) (v: repr a) (f: (a -> repr b)) : repr b\nlet bind (a b : Type) (v : repr a) (f : (a -> repr b)) : repr b =\n fun () -> f (v ()) ()", "val to_list_cell (#a:Type0) (ptr:t a)\n : Steel unit (llist ptr) (fun _ -> llist_cell ptr)\n (requires fun _ -> True)\n (ensures fun h0 _ h1 -> v_llist ptr h0 == datas (v_cell ptr h1))\nlet to_list_cell ptr =\n change_slprop_rel (llist ptr) (llist_cell ptr) (fun x y -> x == datas y) (fun _ -> ())", "val tail_cell (#a:Type0) (ptr:t a)\n : Steel (t a) (llist_cell ptr)\n (fun n -> vptr ptr `star` llist_cell n)\n (requires fun _ -> ptr =!= null_llist)\n (ensures fun h0 n h1 ->\n Cons? (v_cell ptr h0) /\\\n n == next (sel ptr h1) /\\\n sel ptr h1 == L.hd (v_cell ptr h0) /\\\n v_cell n h1 == L.tl (v_cell ptr h0))\nlet tail_cell #a ptr =\n let h = get () in\n let l = hide (v_cell ptr h) in\n reveal_non_empty_cell ptr;\n let x = hide (L.hd l) in\n change_slprop (llist_cell ptr) (vptr ptr `star` llist_cell (next x)) l (reveal x, L.tl l)\n (fun m -> tail_cell_lemma ptr l m);\n reveal_star (vptr ptr) (llist_cell (next x));\n let v = read ptr in\n change_slprop (llist_cell (next x)) (llist_cell (next v)) (L.tl l) (L.tl l) (fun _ -> ());\n return (next v)", "val coerce_eq2 (a: (nat -> Type0)) (b: (nat -> Type0)) (v: a 0)\n : Pure (b 0) (requires a == b) (ensures fun _ -> True)\nlet coerce_eq2 (a:nat -> Type0) (b: (nat -> Type0)) (v:a 0) : Pure (b 0)\n (requires a == b) (ensures fun _ -> True) = v", "val upd (#k:eqtype) (#v:Type) (m:t k v) (x:k) (y:v) : t k v\nlet upd m x y = on_dom _ (fun x1 -> if x1 = x then Some y else m x1)", "val mk_eq2 (u: universe) (t e0 e1: term) : term\nlet mk_eq2 (u:universe)\n (t:term)\n (e0 e1:term) \n : term\n = tm_pureapp\n (tm_pureapp (tm_pureapp (tm_uinst (as_fv R.eq2_qn) [u]) (Some Implicit) t)\n None e0) None e1", "val free (#t_k: eqtype)\n (#t_v: Type0)\n (ll: t t_k t_v):\n ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.modifies (region_of ll) h0 h1)\nlet free #_ #_ ll =\n LL2.free ll", "val pop: #a:Type -> ll: t a -> ST a\n (requires fun h0 ->\n invariant h0 ll /\\\n Cons? (v h0 ll))\n (ensures fun h0 x h1 ->\n let hd :: tl = v h0 ll in\n invariant h1 ll /\\\n B.(modifies (footprint h0 ll) h0 h1) /\\\n // B.(modifies (loc_buffer ll.ptr `loc_union` loc_buffer ll.v) h0 h1) /\\\n v h1 ll == tl /\\\n cells h1 ll == List.Tot.tl (cells h0 ll) /\\\n x == hd)\nlet pop #a ll =\n let r = LL1.pop ll.spine_rid (!* ll.v) ll.ptr in\n let v = !* ll.v in\n ll.v *= G.hide (List.Tot.tl v);\n r", "val alloc (#a: eqtype) (#b #inv: _) (r: erid)\n : ST (MDM.t r a b inv)\n (requires\n (fun h -> inv (MDM.empty_partial_dependent_map #a #b) /\\ witnessed (region_contains_pred r))\n )\n (ensures\n (fun h0 x h1 ->\n inv (MDM.empty_partial_dependent_map #a #b) /\\ ralloc_post r (MDM.empty #a #b) h0 x h1))\nlet alloc (#a:eqtype) #b #inv (r: erid):\n ST (MDM.t r a b inv)\n (requires (fun h -> \n inv (MDM.empty_partial_dependent_map #a #b) /\\ \n witnessed (region_contains_pred r) ))\n (ensures (fun h0 x h1 ->\n inv (MDM.empty_partial_dependent_map #a #b) /\\\n ralloc_post r (MDM.empty #a #b) h0 x h1))\n = MDM.alloc #a #b #inv #r ()", "val member (#a: eqtype) (ptr: t a) (v: a)\n : Steel bool (linked_tree ptr) (fun _ -> linked_tree ptr)\n (requires fun _ -> True)\n (ensures fun h0 b h1 ->\n v_linked_tree ptr h0 == v_linked_tree ptr h1 /\\\n (Spec.mem (v_linked_tree ptr h0) v <==> b))\nlet rec member ptr v =\n if is_null_t ptr then (\n (**) elim_linked_tree_leaf ptr;\n false\n ) else (\n (**) let node = unpack_tree ptr in\n if v = get_data node then (\n (**) pack_tree ptr (get_left node) (get_right node);\n true\n ) else (\n let mleft = member (get_left node) v in\n let mright = member (get_right node) v in\n (**) pack_tree ptr (get_left node) (get_right node);\n mleft || mright\n )\n )", "val bind_map_get (#a: Type) (m: bind_map a) (b: bv) : Tot (option a)\nlet rec bind_map_get (#a:Type) (m:bind_map a) (b:bv) : Tot (option a) =\n match m with\n | [] -> None\n | (b', x)::m' ->\n if compare_bv b b' = Order.Eq then Some x else bind_map_get m' b", "val pow (#t: Type) (k: concrete_ops t) (a: t) (b: nat) : t\nlet rec pow (#t:Type) (k:concrete_ops t) (a:t) (b:nat) : t =\n if b = 0 then k.one ()\n else k.mul a (pow k a (b - 1))", "val lemma_used_upd_lookup_walk\n (#kt #vt #sz: _)\n (spec1 spec2: spec_t kt vt)\n (repr1 repr2: repr_t_sz kt vt sz)\n (idx k: _)\n (k': _{k =!= k'})\n (v v': vt)\n : Lemma\n (requires\n repr_related repr1 repr2 /\\\n (forall i. i < repr1.sz /\\ i <> idx ==> repr1 @@ i == repr2 @@ i) /\\ pht_models spec1 repr1 /\\\n repr1 @@ idx == Used k v' /\\ repr2 @@ idx == Used k v /\\ repr2 == upd_ repr1 idx k v /\\\n spec2 == spec1 ++ (k, v)) (ensures lookup_repr repr1 k' == lookup_repr repr2 k')\nlet lemma_used_upd_lookup_walk #kt #vt #sz\n (spec1 spec2 : spec_t kt vt)\n (repr1 repr2 : repr_t_sz kt vt sz)\n idx k (k':_{k =!= k'})\n (v v' : vt)\n : Lemma (requires\n repr_related repr1 repr2\n /\\ (forall i. i < repr1.sz /\\ i <> idx ==> repr1 @@ i == repr2 @@ i)\n /\\ pht_models spec1 repr1\n /\\ repr1 @@ idx == Used k v'\n /\\ repr2 @@ idx == Used k v\n /\\ repr2 == upd_ repr1 idx k v\n /\\ spec2 == spec1 ++ (k,v))\n (ensures lookup_repr repr1 k' == lookup_repr repr2 k')\n= let idx' = canonical_index k' repr1 in\n let rec aux (off:nat{off <= sz}) : Lemma\n (requires walk repr1 idx' k' off == lookup_repr repr1 k'\n /\\ walk repr2 idx' k' off == lookup_repr repr2 k')\n (ensures walk repr1 idx' k' off == walk repr2 idx' k' off)\n (decreases sz - off) \n = if off = repr1.sz then ()\n else if (idx' + off) % sz = idx then\n match repr1 @@ idx with\n | Used k'' _ ->\n if k' = k'' then ()\n else aux (off+1)\n else begin\n match repr1 @@ ((idx' + off) % repr1.sz) with\n | Clean -> ()\n | Used k'' v'' ->\n if k' = k'' then ()\n else aux (off+1)\n | Zombie ->\n aux (off+1)\n end\n in\n aux 0", "val deref_cells_is_v (#a: _) (h: HS.mem) (ll: t a) (l: list a)\n : Lemma (requires well_formed h ll l /\\ invariant h ll l)\n (ensures gmap (deref_data h) (cells h ll l) == l)\n (decreases l)\n [SMTPat (well_formed h ll l)]\nlet rec deref_cells_is_v #a (h: HS.mem) (ll: t a) (l: list a): Lemma\n (requires\n well_formed h ll l /\\\n invariant h ll l)\n (ensures\n gmap (deref_data h) (cells h ll l) == l)\n (decreases l)\n [ SMTPat (well_formed h ll l) ]\n=\n if B.g_is_null ll then\n ()\n else\n deref_cells_is_v h (B.deref h ll).next (List.Tot.tl l)", "val ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop\nlet ccell0 (a: Type0) (c: ccell_lvalue a) : Tot vprop =\n (vptr (ccell_data c) `star` vptr (ccell_next c))", "val ( := ) (#a: Type) (#rel: preorder a) (r: mref a rel) (v: a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 ->\n rel (sel h0 r) v /\\ h0 `contains` r /\\ modifies (Set.singleton (addr_of r)) h0 h1 /\\\n equal_dom h0 h1 /\\ sel h1 r == v)\nlet op_Colon_Equals (#a:Type) (#rel:preorder a) (r:mref a rel) (v:a)\n : ST unit\n (fun h -> rel (sel h r) v)\n (fun h0 x h1 -> rel (sel h0 r) v /\\ h0 `contains` r /\\\n modifies (Set.singleton (addr_of r)) h0 h1 /\\ equal_dom h0 h1 /\\\n sel h1 r == v)\n= write #a #rel r v", "val bind (ans a b: Type) (m: cont ans a) (f: (a -> Tot (cont ans b))) (k: (b -> M ans)) : M ans\nlet bind (ans:Type) (a:Type) (b:Type) (m : cont ans a) (f : a -> Tot (cont ans b)) (k: b -> M ans) : M ans =\n m (fun (x:a) -> let fx = f x in fx k)", "val ccell_rewrite\n (#a: Type0)\n (c: ccell_ptrvalue a)\n (x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))\n : GTot (vcell a)\nlet ccell_rewrite\n (#a: Type0)\n (c: ccell_ptrvalue a)\n (x: dtuple2 (ccell_lvalue a) (vdep_payload (ccell_is_lvalue c) (ccell0 a)))\n: GTot (vcell a)\n= let p =\n dsnd #(ccell_lvalue a) #(vdep_payload (ccell_is_lvalue c) (ccell0 a)) x\n in\n {\n vcell_data = fst p;\n vcell_next = snd p;\n }", "val mk_binder (bv: bv) (sort: typ) : binder\nlet mk_binder (bv : bv) (sort : typ) : binder =\n pack_binder {\n binder_bv=bv;\n binder_qual=Q_Explicit;\n binder_attrs=[];\n binder_sort = sort;\n }", "val my_override : #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b\nlet my_override #a #b f k x k' = if k = k' then x else f k'", "val put (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n (x:v)\r\n (content:Ghost.erased c)\r\n : STT unit\r\n (perm a init m b `star` vp i x content)\r\n (fun _ -> perm a init (Map.upd m i content) (PartialMap.remove b i))\nlet put #v #c #vp #init #m #b a i x content =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n ETbl.put a.etbl i x content;\r\n assert (PartialMap.equal (PartialMap.upd (repr_to_eht_repr m) i content)\r\n (repr_to_eht_repr (Map.upd m i content)));\r\n rewrite (ETbl.tperm _ _ _)\r\n (ETbl.tperm a.etbl\r\n (repr_to_eht_repr (Map.upd m i content))\r\n (PartialMap.remove b i));\r\n let high = R.read a.high in\r\n let r = above_high_water_mark high i in\r\n if r\r\n then begin\r\n R.write a.high (Some i);\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n (Some i));\r\n intro_exists (Some i) (high_epoch_id_pred (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n a.high)\r\n end\r\n else begin\r\n intro_pure (high_epoch_id_prop (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n w);\r\n intro_exists (G.reveal w) (high_epoch_id_pred (G.reveal init)\r\n (Map.upd m i content)\r\n (PartialMap.remove b i)\r\n a.high)\r\n end", "val intro_cons_lemma (#a: Type0) (ptr1: t a) (x: cell a) (v: a) (l: list a) (m: mem)\n : Lemma\n (requires\n interp (((ptr ptr1) `Mem.star` (llist_ptr_sl (next x))) `Mem.star` (ptr (data x))) m /\\\n sel_of (vptr ptr1) m == x /\\ sel_of (llist_ptr (next x)) m == l /\\\n sel_of (vptr (data x)) m == v)\n (ensures interp (llist_ptr_sl ptr1) m /\\ llist_ptr_sel ptr1 m == v :: l)\nlet intro_cons_lemma (#a:Type0) (ptr1:t a)\n (x: cell a) (v:a) (l:list a) (m:mem) : Lemma\n (requires interp (ptr ptr1 `Mem.star` llist_ptr_sl (next x) `Mem.star` ptr (data x)) m /\\\n sel_of (vptr ptr1) m == x /\\\n sel_of (llist_ptr (next x)) m == l /\\\n sel_of (vptr (data x)) m == v)\n (ensures interp (llist_ptr_sl ptr1) m /\\ llist_ptr_sel ptr1 m == v :: l)\n = let l' = id_elim_exists (llist_ptr_sl' (next x)) m in\n assert (interp (llist_ptr_sl' (next x) l') m);\n let aux (m:mem) (ml1 ml2 mr:mem) : Lemma\n (requires disjoint ml1 ml2 /\\ disjoint (join ml1 ml2) mr /\\ m == join (join ml1 ml2) mr /\\\n interp (ptr ptr1) ml1 /\\ interp (llist_ptr_sl (next x)) ml2 /\\ interp (ptr (data x)) mr /\\\n interp (ptr (data x)) m /\\ ptr_sel (data x) m == v /\\\n interp (llist_ptr_sl' (next x) l') m /\\\n ptr_sel ptr1 ml1 == x\n )\n (ensures interp\n (pts_to_sl ptr1 full_perm x `Mem.star`\n llist_ptr_sl' (next x) l' `Mem.star`\n pts_to_sl (data x) full_perm v) m)\n = ptr_sel_interp ptr1 ml1;\n let l2 = id_elim_exists (llist_ptr_sl' (next x)) ml2 in\n join_commutative ml1 ml2;\n assert (interp (llist_ptr_sl' (next x) l2) m);\n llist_ptr_sl'_witinv (next x);\n assert (l2 == l');\n assert (interp (llist_ptr_sl' (next x) l') ml2);\n ptr_sel_interp (data x) mr;\n join_commutative (join ml1 ml2) mr;\n assert (ptr_sel (data x) mr == v);\n assert (interp (pts_to_sl (data x) full_perm v) mr);\n intro_star (pts_to_sl ptr1 full_perm x) (llist_ptr_sl' (next x) l') ml1 ml2;\n intro_star\n (pts_to_sl ptr1 full_perm x `Mem.star` llist_ptr_sl' (next x) l')\n (pts_to_sl (data x) full_perm v)\n (join ml1 ml2) mr\n in\n elim_star\n (ptr ptr1 `Mem.star` llist_ptr_sl (next x))\n (ptr (data x)) m;\n Classical.forall_intro (Classical.move_requires\n (elim_star (ptr ptr1) (llist_ptr_sl (next x))));\n Classical.forall_intro_3 (Classical.move_requires_3 (aux m));\n intro_cons_lemma_aux ptr1 x v l' m;\n assert (interp (llist_ptr_sl' ptr1 ((x,v)::l')) m);\n intro_h_exists ((x,v)::l') (llist_ptr_sl' ptr1) m;\n llist_sel_interp ptr1 ((x,v)::l') m", "val notin (#a: eqtype) (#b: Type u#b) (key: a) (m: map a b) : bool\nlet notin (#a: eqtype) (#b: Type u#b) (key: a) (m: map a b)\n : bool =\n not (mem key m)", "val map\n (a:eqtype)\n (b:(a -> Type u#b))\n : Type u#b\nlet map a b = list (x:a & b x)", "val mk_array (a: term) : term\nlet mk_array (a:term) : term =\n tm_pureapp (tm_fvar (as_fv array_lid)) None a", "val invariant: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> Type0\nlet invariant #_ #_ h ll =\n LL2.invariant h ll", "val clear (#t_k: eqtype)\n (#t_v: Type0)\n (ll: t t_k t_v):\n ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.modifies (region_of ll) h0 h1 /\\\n invariant h1 ll /\\\n v h1 ll == M.const None)\nlet clear #_ #_ ll =\n LL2.clear ll", "val intro_llist_cons\n (#opened: _)\n (p1: ref cell)\n (#v1: Ghost.erased (typeof cell))\n (p2: ptr cell)\n (a: U32.t)\n (q: Ghost.erased (list U32.t))\n : STGhost unit\n opened\n (((pts_to p1 v1) `star` (llist p2 q)) `star` (freeable p1))\n (fun _ -> llist p1 (a :: q))\n (Ghost.reveal v1 == ({ hd = mk_scalar a; tl = mk_scalar p2 }))\n (fun _ -> True)\nlet intro_llist_cons\n (#opened: _)\n (p1: ref cell) (#v1: Ghost.erased (typeof cell)) (p2: ptr cell) (a: U32.t) (q: Ghost.erased (list U32.t))\n: STGhost unit opened\n (pts_to p1 v1 `star`\n llist p2 q `star`\n freeable p1\n )\n (fun _ -> llist p1 (a :: q))\n (Ghost.reveal v1 == ({ hd = mk_scalar a; tl = mk_scalar p2 }))\n (fun _ -> True)\n= noop ();\n rewrite_with_tactic (llist_cons p1 a q llist) (llist p1 (a :: q))", "val live (#a: _) (h: mem) (b: buffer a) : GTot Type0\nlet live #a (h:mem) (b:buffer a) : GTot Type0 = HS.contains h b.content" ], "closest_src": [ { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.mk_cell" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.mk_cell" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.mk_cell" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.mk_cell" }, { "project_name": "steel", "file_name": "SelectorsLList2Example.fst", "name": "SelectorsLList2Example.mk_cell" }, { "project_name": "steel", "file_name": "SelectorsLList3Example.fst", "name": "SelectorsLList3Example.mk_cell" }, { "project_name": "steel", "file_name": "LList.Invariant.fst", "name": "LList.Invariant.mk_cell" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fst", "name": "FStar.FiniteMap.Base.insert" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.MapTree.fst", "name": "Vale.Lib.MapTree.mkNode" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.v_cell" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.v_cell" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Spec.fst", "name": "Pulse.Lib.HashTable.Spec.lemma_used_upd" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Type.fst", "name": "Pulse.Lib.HashTable.Type.token" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.equal" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Type.fsti", "name": "Pulse.Lib.HashTable.Type.exploded_vp" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.next" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.next" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.next" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.next" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.PostProcess.fst", "name": "FStar.InteractiveHelpers.PostProcess.mk_eq" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.reveal_non_empty_cell" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.MapTree.fst", "name": "Vale.Lib.MapTree.map" }, { "project_name": "FStar", "file_name": "OPLSS2021.Vector.fst", "name": "OPLSS2021.Vector.map" }, { "project_name": "FStar", "file_name": "OPLSS2021.Demo1.fst", "name": "OPLSS2021.Demo1.map" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.find" }, { "project_name": "steel", "file_name": "CQueue.Cell.fsti", "name": "CQueue.Cell.ccell'" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.find_" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.empty" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.ccell1" }, { "project_name": "Armada", "file_name": "Spec.Map.fst", "name": "Spec.Map.const" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.data" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.data" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.data" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.elim_ccell" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.MapTree.fst", "name": "Vale.Lib.MapTree.sel" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.v" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.v_" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.literal" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.MapTree.fst", "name": "Vale.Lib.MapTree.balance" }, { "project_name": "steel", "file_name": "CQueue.Cell.fsti", "name": "CQueue.Cell.ccell" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_ref" }, { "project_name": "steel", "file_name": "LList.fst", "name": "LList.push" }, { "project_name": "steel", "file_name": "LList.Invariant.fst", "name": "LList.Invariant.llist" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Spec.fst", "name": "Pulse.Lib.HashTable.Spec.lemma_walk_from_canonical_all_used" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.data" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fsti", "name": "FStar.PartialMap.const" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.from_list_cell" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.assoc" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.map_vec" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.tail_cell_lemma" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Spec.fst", "name": "Pulse.Lib.HashTable.Spec.all_used_not_by" }, { "project_name": "steel", "file_name": "Steel.ST.EphemeralHashtbl.fst", "name": "Steel.ST.EphemeralHashtbl.create_v" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.lookup" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Spec.fst", "name": "Pulse.Lib.HashTable.Spec.strong_used_not_by" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.sel" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fsti", "name": "FStar.PartialMap.contains" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.alloc_cell" }, { "project_name": "Armada", "file_name": "Spec.Map.fst", "name": "Spec.Map.t" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.reclaim" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.add" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.free_cell" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.write" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.elim_cons_cell_lemma" }, { "project_name": "FStar", "file_name": "FStar.OrdMap.fst", "name": "FStar.OrdMap.equal" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.intro_ccell" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.mk_ref" }, { "project_name": "steel", "file_name": "SelectorsLList2Example.fst", "name": "SelectorsLList2Example.next" }, { "project_name": "steel", "file_name": "SelectorsLList3Example.fst", "name": "SelectorsLList3Example.next" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.elim_cons_cell" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_eq2" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.cells" }, { "project_name": "FStar", "file_name": "DivAction.fst", "name": "DivAction.bind" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.to_list_cell" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.tail_cell" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Token.UF1CMA.fsti", "name": "MiTLS.Token.UF1CMA.coerce_eq2" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.upd" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.mk_eq2" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.free" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.pop" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.KDF.fst", "name": "MiTLS.KDF.alloc" }, { "project_name": "steel", "file_name": "Selectors.Tree.fst", "name": "Selectors.Tree.member" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.Base.fst", "name": "FStar.InteractiveHelpers.Base.bind_map_get" }, { "project_name": "hacl-star", "file_name": "Spec.Exponentiation.fsti", "name": "Spec.Exponentiation.pow" }, { "project_name": "steel", "file_name": "Pulse.Lib.HashTable.Spec.fst", "name": "Pulse.Lib.HashTable.Spec.lemma_used_upd_lookup_walk" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.deref_cells_is_v" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.ccell0" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.op_Colon_Equals" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Continuations.fst", "name": "FStar.DM4F.Continuations.bind" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.ccell_rewrite" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V1.Derived.fst", "name": "FStar.Reflection.V1.Derived.mk_binder" }, { "project_name": "FStar", "file_name": "SfPoly.fst", "name": "SfPoly.my_override" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.put" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.intro_cons_lemma" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.notin" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fst", "name": "FStar.Monotonic.DependentMap.map" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.mk_array" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.invariant" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.clear" }, { "project_name": "steel", "file_name": "LList2.fst", "name": "LList2.intro_llist_cons" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.live" } ], "selected_premises": [ "FStar.Real.one", "FStar.Real.two", "PulseCore.FractionalPermission.sum_perm", "FStar.UInt.size", "Pulse.Lib.Core.one_half", "PulseCore.FractionalPermission.full_perm", "FStar.PCM.compatible", "Pulse.Lib.Core.inames", "Pulse.Lib.HashTable.Spec.lookup_spec", "Pulse.Lib.Pervasives.perform", "FStar.PCM.composable", "Pulse.Lib.HashTable.Spec.lookup", "FStar.PCM.op", "Pulse.Lib.Core.all_inames", "PulseCore.FractionalPermission.comp_perm", "Pulse.Lib.HashTable.Spec.canonical_index", "Pulse.Lib.HashTable.Spec.lookup_index", "Pulse.Lib.HashTable.Spec.upd_pht", "Pulse.Lib.HashTable.Spec.delete", "Pulse.Lib.HashTable.Spec.used_not_by", "Pulse.Lib.HashTable.Spec.lookup_index_us", "Pulse.Lib.HashTable.Spec.full_not_full", "Pulse.Lib.HashTable.Spec.not_full", "Pulse.Lib.HashTable.Spec.lemma_del", "Pulse.Lib.HashTable.Spec.walk_get_idx_upd", "FStar.Pervasives.Native.fst", "Pulse.Lib.HashTable.Spec.walk", "FStar.Mul.op_Star", "Pulse.Lib.HashTable.Spec.lookup_repr", "Pulse.Lib.HashTable.Spec.lemma_used_upd", "Pulse.Lib.Core.emp_inames", "FStar.Pervasives.Native.snd", "Pulse.Lib.HashTable.Spec.strong_all_used_not_by", "Pulse.Lib.Pervasives.tfst", "Pulse.Lib.HashTable.Spec.repr_related", "Pulse.Lib.HashTable.Spec.repr_t_sz", "Pulse.Lib.Reference.cond", "Pulse.Lib.HashTable.Type.exploded_vp", "Pulse.Lib.HashTable.Spec.lookup_repr_index", "Pulse.Lib.HashTable.Spec.walk_get_idx", "Pulse.Lib.HashTable.Spec.strong_used_not_by", "Pulse.Lib.HashTable.Spec.lemma_clean_upd", "Pulse.Lib.HashTable.Spec.lemma_zombie_upd_lookup_walk", "Pulse.Lib.HashTable.Spec.lemma_walk_from_canonical_all_used", "Pulse.Lib.Pervasives.vprop_equiv_norm", "Pulse.Lib.HashTable.Spec.lemma_del_lookup_walk", "Pulse.Lib.HashTable.Spec.delete_repr_walk", "Pulse.Lib.HashTable.Spec.aunb_shrink", "Pulse.Lib.HashTable.Spec.eliminate_strong_all_used_not_by", "Pulse.Lib.Core.join_inames", "FStar.Pervasives.reveal_opaque", "PulseCore.FractionalPermission.half_perm", "FStar.Real.zero", "Pulse.Lib.HashTable.Spec.all_used_not_by", "PulseCore.FractionalPermission.lesser_perm", "Pulse.Lib.Pervasives.inames_join_self", "Pulse.Lib.HashTable.Spec.lemma_used_upd_lookup_walk", "Pulse.Lib.HashTable.Spec.lemma_zombie_upd", "Pulse.Lib.Core.add_iname", "Pulse.Lib.Pervasives.default_arg", "Pulse.Lib.Pervasives.tsnd", "Pulse.Lib.Pervasives.tthd", "Pulse.Lib.Core.inames_subset", "Pulse.Lib.Core.unit_non_informative", "Pulse.Lib.Core.prop_non_informative", "Pulse.Lib.Core.squash_non_informative", "FStar.Pervasives.dfst", "Pulse.Lib.HashTable.Spec.lemma_clean_upd_lookup_walk", "PulseCore.FractionalPermission.lesser_equal_perm", "PulseCore.FractionalPermission.writeable", "FStar.Pervasives.dsnd", "PulseCore.Observability.at_most_one_observable", "Pulse.Lib.Core.mem_iname", "Pulse.Lib.Core.erased_non_informative", "Pulse.Lib.HashTable.Spec.delete_repr", "Pulse.Lib.Pervasives.inames_ext", "PulseCore.Observability.join_obs", "FStar.UInt32.n", "FStar.UInt64.n", "FStar.PCM.lem_commutative", "FStar.Math.Lemmas.pow2_plus", "FStar.UInt.max_int", "FStar.UInt16.n", "Pulse.Lib.Pervasives.perform_ghost", "FStar.UInt16.lt", "FStar.UInt64.lt", "FStar.UInt32.lt", "FStar.UInt.fits", "FStar.UInt.to_vec", "FStar.SizeT.mod_spec", "FStar.Real.test_add_eq'", "FStar.Classical.Sugar.implies_elim", "FStar.PCM.compatible_trans", "FStar.UInt.xor", "FStar.UInt64.eq", "FStar.UInt16.eq", "FStar.UInt32.eq", "FStar.PCM.lem_assoc_l", "FStar.Real.mul_dist", "FStar.PCM.compatible_elim" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.HashTable\nopen Pulse.Lib.Pervasives\nmodule V = Pulse.Lib.Vec\nmodule R = Pulse.Lib.Reference\nmodule SZ = FStar.SizeT\nmodule PHT = Pulse.Lib.HashTable.Spec\n\nopen Pulse.Lib.HashTable.Spec\nopen Pulse.Lib.HashTable.Type\n\n#push-options \"--using_facts_from '* -FStar.Tactics -FStar.Reflection'\"\n\n[@@ Rust_generics_bounds [[\"Copy\"; \"PartialEq\"; \"Clone\"];\n [\"Clone\"]]]", "sketch": [ "The definition `mk_used_cell` is a function that takes two type parameters `a` and `b`, and two arguments `k` and `v` of types `a` and `b` respectively. It returns a value of type `cell a b`.\n\nThe function `mk_used_cell` is used to create a new cell in a hash table with the given key `k` and value `v`.", "To implement the `mk_used_cell` function, we simply create a new cell with the provided key and value, and mark it as used.", "The definition `mk_used_cell` is a function that takes in a key of type `a` and a value of type `b`, and returns a cell of type `cell a b`. This function is used to create a new cell in a hash table with the given key and value.\n\nStep 1: We need to define a function that takes a key and a value, and returns a cell.\n\nStep 2: The function implementation will create a new cell with the given key and value, and return it.", "The definition `mk_used_cell` is about creating a new cell in a hash table with a given key and value.\n\nStep 1: We need to define a function that takes the key and value as input and returns a new cell in the hash table.\n\nStep 2: The implementation of `mk_used_cell` involves creating a new cell with the provided key and value, and setting the `used` flag to true.", "The definition `mk_used_cell` is a function that takes in a key of type `a` and a value of type `b`, and returns a cell of type `cell a b`. This function is used to create a new cell in a hash table with the given key and value.\n\nStep 1: We need to define a new cell with the given key and value.\nStep 2: Create a new cell using the input key and value, and return it.", "To implement the `mk_used_cell` function, we simply create a new cell with the provided key and value, and set the status of the cell to indicate that it is used.", "To implement the `mk_used_cell` function, we simply create a new cell with the provided key and value, and mark it as used.", "The definition `mk_used_cell` is a function that takes two type parameters `a` and `b`, and two values `k` and `v` of types `a` and `b` respectively. It returns a value of type `cell a b`.\n\nThe function `mk_used_cell` is used to create a new cell in a hash table with the given key `k` and value `v`.", "The definition `mk_used_cell` is a function that takes in a key of type `a` and a value of type `b`, and constructs a cell of type `cell a b` to represent a used cell in a hash table.\n\nStep 1: We need to define a function that constructs a used cell for a hash table.\n\nStep 2: The function `mk_used_cell` takes in a key of type `a` and a value of type `b`, and returns a cell of type `cell a b` with the provided key and value.", "The definition `mk_used_cell` is about creating a new cell in a hash table with a given key and value.\n\nStep 1: We need to define a function that takes a key of type `a` and a value of type `b` and returns a cell of type `cell a b`.\n\nStep 2: To implement the definition, we will create a function `mk_used_cell` that takes the key `k` and value `v` as input and constructs a new cell with the provided key and value." ], "generated_solution": [ "let mk_used_cell (a: eqtype) (b: _) (k: a) (v: b) : cell a b = \n { key = k; value = v; next = None }", "let mk_used_cell {a:Type} {b:Type} (k:a) (v:b) : cell a b =\n { key = k; value = v; state = Used }", "let mk_used_cell (k: a) (v: b) : cell a b =\n { key = k; value = v; next = None }", "let mk_used_cell (k: a) (v: b) : cell a b =\n { key = k; value = v; used = true }", "let mk_used_cell (k: a) (v: b) : cell a b =\n { key = k; value = v; next = None }", "let mk_used_cell (k: a) (v: b) : cell a b =\n { key = k; value = v; status = Used }", "let mk_used_cell {a:eqtype} {b:_} (k: a) (v: b) : cell a b =\n { key = k; value = v; state = Used }", "let mk_used_cell (k: a) (v: b) : cell a b = {\n key = k;\n value = v;\n next = None;\n}", "let mk_used_cell (k: a) (v: b) : cell a b = \n { key = k; value = v; next = None }", "let mk_used_cell (k: a) (v: b) : cell a b =\n { key = k; value = v; next = None }" ] }, { "file_name": "OPLSS.AE.fsti", "name": "OPLSS.AE.log_entry", "opens_and_abbrevs": [ { "abbrev": "B", "full_module": "LowStar.Monotonic.Buffer" }, { "open": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar.Seq" }, { "open": "OPLSS" }, { "open": "OPLSS" }, { "open": "OPLSS" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let log_entry = Plain.plain & ae_cipher", "source_range": { "start_line": 49, "start_col": 0, "end_line": 49, "end_col": 39 }, "interleaved": false, "definition": "OPLSS.Plain.plain * OPLSS.AE.ae_cipher", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Pervasives.Native.tuple2", "OPLSS.Plain.plain", "OPLSS.AE.ae_cipher" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "Type0", "prompt": "let log_entry =\n ", "expected_response": "Plain.plain & ae_cipher", "source": { "project_name": "FStar", "file_name": "examples/crypto/OPLSS.AE.fsti", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS.AE.fsti", "checked_file": "dataset/OPLSS.AE.fsti.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/OPLSS.Plain.fsti.checked", "dataset/OPLSS.Log.fst.checked", "dataset/OPLSS.Ideal.fsti.checked", "dataset/OPLSS.Flag.fsti.checked", "dataset/OPLSS.fst.checked", "dataset/LowStar.Monotonic.Buffer.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked" ] }, "definitions_in_context": [ "val key : Type u#0", "val ae_cipher : eqtype", "val footprint (k:key) : GTot B.loc", "val invariant : key -> HS.mem -> prop" ], "closest": [ "val EtM.AE.log_entry = Type0\nlet log_entry = Plain.plain * cipher", "val OPLSS.AES.key = Type0\nlet key = lbytes keysize", "val Zeta.Steel.Rel.s_log_entry = Type0\nlet s_log_entry = T.log_entry", "val OPLSS.AES.plain = Type0\nlet plain = lbytes keysize", "val OPLSS.bytes = Type0\nlet bytes = Seq.seq UInt8.t", "val OPLSS.AES.cipher = Type0\nlet cipher = lbytes cipher_size", "val EtM.MAC.log_entry = Type0\nlet log_entry = msg * tag", "val OPLSS2021.IFC.lref = Type0\nlet lref = ref low", "val OPLSS2021.IFC.label = Type0\nlet label = Set.set loc", "val OPLSS.AES.iv = Type0\nlet iv = lbytes ivsize", "val OPLSS2021.IFC.flow = Type0\nlet flow = label & label", "val OPLSS2021.Basic.nat = Type0\nlet nat = x:int{ x >= 0 }", "val OPLSS2021.IFC.flows = Type0\nlet flows = list flow", "val OPLSS.AE.ae_as_mac = c: OPLSS.AE.ae_cipher -> OPLSS.MAC.log_entry\nlet ae_as_mac (c:ae_cipher) = MAC.Entry (fst c) (snd c)", "val OPLSS2021.IFC.store = Type0\nlet store = m:Map.t loc int{forall l. contains m l}", "val OPLSS.HMACSHA1.msg = Type0\nlet msg = bytes", "val OPLSS2021.IFC.triple = Type0\nlet triple = label & label & flows", "val OPLSS.AES.iv_cipher = Type0\nlet iv_cipher = lbytes (ivsize + cipher_size)", "val OPLSS2021.ParTot.tape = Type0\nlet tape = nat -> bool", "val OPLSS2021.IFC.href = Type0\nlet href = ref high", "val Zeta.Steel.Rel.i_log = Type0\nlet i_log = IL.logS i_vcfg", "val OPLSS2021.STLC.env = Type0\nlet env = int -> option ty", "val Zeta.Steel.Rel.s_log = Type0\nlet s_log = TSM.log", "val OPLSS2021.NDS.tape = Type0\nlet tape = nat -> bool", "val log: Type0\nlet log = HS.ref state", "val OPLSS2021.IFC.ref = l: OPLSS2021.IFC.label -> Type0\nlet ref (l:label) = r:loc {r `Set.mem` l}", "val Zeta.Steel.Rel.s_store_entry = Type0\nlet s_store_entry = TSM.store_entry", "val Zeta.Steel.Rel.i_store_entry = Type0\nlet i_store_entry = Zeta.Intermediate.Store.vstore_entry i_vcfg", "val Zeta.Steel.LogEntry.Types.record = Type0\nlet record = (r: (key & value) { is_value_of (fst r) (snd r) })", "val OPLSS2021.ValeVC.t_pre = Type\nlet t_pre = state -> prop", "val OPLSS2021.ValeVC.t_wp = Type\nlet t_wp = t_post -> t_pre", "val Zeta.Steel.GlobalRel.i_verifiable_logs = Type0\nlet i_verifiable_logs = Zeta.Intermediate.Global.verifiable_log i_vcfg", "val OPLSS2021.ValeVC.t_post = Type\nlet t_post = state -> prop", "val OPLSS.AE.mac_cpa_related = mac: OPLSS.MAC.log_entry -> enc: OPLSS.CPA.log_entry -> Prims.logical\nlet mac_cpa_related (mac:MAC.log_entry) (enc:CPA.log_entry) =\n mac.MAC.msg == enc.CPA.c", "val Zeta.EAC.nevict_vlog_entry = app: Zeta.App.app_params -> Type0\nlet nevict_vlog_entry (app: app_params) = e:(vlog_entry app) {not (is_evict e)}", "val Model.AEAD.alg = Type0\nlet alg = I.ea", "val OPLSS.Log.t = a: Prims.eqtype -> Type0\nlet t (a:eqtype) = HST.mref (seq a) grows", "val Zeta.Steel.LogEntry.Types.hash_value = Type0\nlet hash_value = KU.u256", "val OPLSS.CPA.iv_of_entry = _: OPLSS.CPA.log_entry -> OPLSS.AES.iv\nlet iv_of_entry (Entry _ c) : AES.iv = fst (Seq.split c AES.ivsize)", "val IEXN.exns = Type0\nlet exns = FStar.GSet.set exn", "val Model.AEAD.safe_id = Type0\nlet safe_id =\n i:id{is_safe i}", "val Spec.Agile.AEAD.supported_alg = Type0\nlet supported_alg = a:alg { is_supported_alg a }", "val Zeta.Steel.ThreadRel.i_verifiable_log = Type0\nlet i_verifiable_log = Zeta.Intermediate.Thread.verifiable_log i_vcfg", "val Zeta.EAC.evict_vlog_entry = app: Zeta.App.app_params -> Type0\nlet evict_vlog_entry (app: app_params) = e:(vlog_entry app) {is_evict e}", "val OPLSS2021.ValeVCNoProp.t_pre = Type\nlet t_pre = state -> Type0", "val Zeta.Steel.Rel.i_log_entry = Prims.eqtype\nlet i_log_entry = IV.logS_entry i_vcfg", "val Spec.MD5.abcd_t = Type0\nlet abcd_t = Seq.lseq uint32 4", "val OPLSS2021.ValeVCNoProp.t_post = Type\nlet t_post = state -> Type0", "val Zeta.Steel.GlobalRel.verifiable_logs = Type0\nlet verifiable_logs = l: all_logs {verifiable l}", "val word:Type0\nlet word = Lib.IntTypes.uint32", "val word:Type0\nlet word = Lib.IntTypes.uint32", "val Zeta.Steel.ThreadStateModel.all_logs = Type0\nlet all_logs = Seq.lseq log (U32.v n_threads)", "val EtM.CPA.aes_key = Type0\nlet aes_key = lbytes keysize", "val AlgWP.rwops = Type0\nlet rwops = labs:ops{sublist labs [Read; Write]}", "val Zeta.Steel.ApplicationTypes.app_result_entry = Type0\nlet app_result_entry =\r\n (fid:A.appfn_id aprm &\r\n app_args fid &\r\n app_records fid &\r\n app_result fid)", "val Zeta.Steel.Rel.i_timestamp = Type0\nlet i_timestamp = Zeta.Time.timestamp", "val Zeta.Steel.Thread.tlog = Type0\nlet tlog = AT.tid & log", "val OPLSS.Ideal.auth = OPLSS.Flag.flag\nlet auth = uf_cma", "val ce: Type0\nlet ce: Type0 = unit", "val ce: Type0\nlet ce: Type0 = unit", "val Zeta.Steel.Main.tid_log_map = Type0\nlet tid_log_map = \r\n x:Map.t tid (option M.log) { \r\n Map.domain x `Set.equal` Set.complement Set.empty \r\n }", "val Spec.MD5.abcd_idx = Type0\nlet abcd_idx = (n: nat { n < 4 } )", "val for_you:Type0\nlet for_you : Type0 = synth_by_tactic (fun () -> big_phi 8)", "val Zeta.EAC.eac_log = app: Zeta.App.app_params -> Type0\nlet eac_log app = l:vlog_ext app{eac l}", "val OPLSS2021.Basic.test0 = Prims.unit\nlet test0 = assert (map (fun x -> x + 1) [1;2;3] == [2;3;4])", "val OPLSS2021.ValeVCNoProp.t_wp = Type\nlet t_wp = t_post -> t_pre", "val Sec2.HIFC.lref = Type0\nlet lref = ref low", "val Zeta.Steel.Thread.verifiable_log = Type0\nlet verifiable_log = tl: tlog {verifiable tl}", "val Zeta.Steel.Rel.s_timestamp = Type0\nlet s_timestamp = T.timestamp", "val cv: Type0\nlet cv: Type0 = unit", "val cv: Type0\nlet cv: Type0 = unit", "val L0.Base.bytes_sec = Type0\nlet bytes_sec = Seq.seq byte_sec", "val Zeta.Steel.Rel.i_record = Type0\nlet i_record = Zeta.Record.record app", "val Zeta.Steel.Rel.s_val = Type0\nlet s_val = T.value", "val L0.Base.byte_sec = Type0\nlet byte_sec = uint8", "val Zeta.Steel.ThreadLogMap.log = Type0\nlet log = Seq.seq log_entry", "val Zeta.Steel.ThreadLogMap.aval = Type0\nlet aval = FAP.knowledge anchors", "val Spec.AES.elem = Type0\nlet elem = felem gf8", "val Zeta.Steel.Rel.s_record = Type0\nlet s_record = T.record", "val Zeta.Steel.AggregateEpochHashes.log = Type0\nlet log = Seq.seq log_entry", "val Zeta.Steel.Rel.i_val = Type0\nlet i_val = Zeta.Record.value app", "val EtM.CPA.iv = Type0\nlet iv = lbytes ivsize", "val Zeta.Steel.Rel.i_key = Type0\nlet i_key = GK.key app", "val Sec2.IFC.lref = Type0\nlet lref = ref low", "val LowParse.Low.ErrorCode.error_code = Type0\nlet error_code = (c: U64.t { 0 < U64.v c /\\ U64.v c < 65536 })", "val L0.X509.FWID.fwid_payload_t' = Type0\nlet fwid_payload_t'\n= (OID_DIGEST_SHA256) `envelop_OID_with_t`\n (parse_filter_refine filter_fwid_payload_string)", "val Zeta.Steel.Rel.s_mval = Type0\nlet s_mval = T.mval_value", "val Sec2.IFC.flows = Type0\nlet flows = list flow", "val OPLSS.CPA.raw_cipher = _: OPLSS.CPA.log_entry -> OPLSS.bytes\nlet raw_cipher (Entry _ c) : bytes = snd (Seq.split c AES.ivsize)", "val Zeta.Steel.Rel.i_mval = Type0\nlet i_mval = M.value", "val OPLSS2021.IFC.label_equiv = s0: OPLSS2021.IFC.label -> s1: OPLSS2021.IFC.label -> Type0\nlet label_equiv (s0 s1:label) = Set.equal s0 s1", "val Zeta.Steel.Rel.i_dval = Type0\nlet i_dval = app_value_nullable app.adm", "val L0.Base.l0_hash_alg = Type0\nlet l0_hash_alg = a:hash_alg{a == SHA2_256}", "val Zeta.Steel.Rel.i_desc_hash = Type0\nlet i_desc_hash = M.desc_hash_t", "val Spec.MD5.t_idx = Type0\nlet t_idx = (n: nat { 1 <= n /\\ n <= 64 } )", "val Model.AEAD.unsafe_id = Type0\nlet unsafe_id =\n i:id{~ (is_safe i)}", "val Sec2.HIFC.flows = Type0\nlet flows = list flow", "val Zeta.Steel.Rel.s_base_key = Type0\nlet s_base_key = T.base_key", "val LowParse.Low.ErrorCode.pos_t = Type0\nlet pos_t = (pos: U64.t {is_success pos})", "val Vale.PPC64LE.QuickCodes.codes = Type0\nlet codes = va_codes" ], "closest_src": [ { "project_name": "FStar", "file_name": "EtM.AE.fst", "name": "EtM.AE.log_entry" }, { "project_name": "FStar", "file_name": "OPLSS.AES.fst", "name": "OPLSS.AES.key" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_log_entry" }, { "project_name": "FStar", "file_name": "OPLSS.AES.fst", "name": "OPLSS.AES.plain" }, { "project_name": "FStar", "file_name": "OPLSS.fst", "name": "OPLSS.bytes" }, { "project_name": "FStar", "file_name": "OPLSS.AES.fst", "name": "OPLSS.AES.cipher" }, { "project_name": "FStar", "file_name": "EtM.MAC.fst", "name": "EtM.MAC.log_entry" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.lref" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.label" }, { "project_name": "FStar", "file_name": "OPLSS.AES.fst", "name": "OPLSS.AES.iv" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.flow" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.nat" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.flows" }, { "project_name": "FStar", "file_name": "OPLSS.AE.fst", "name": "OPLSS.AE.ae_as_mac" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.store" }, { "project_name": "FStar", "file_name": "OPLSS.HMACSHA1.fst", "name": "OPLSS.HMACSHA1.msg" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.triple" }, { "project_name": "FStar", "file_name": "OPLSS.AES.fst", "name": "OPLSS.AES.iv_cipher" }, { "project_name": "FStar", "file_name": "OPLSS2021.ParTot.fst", "name": "OPLSS2021.ParTot.tape" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.href" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_log" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.env" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_log" }, { "project_name": "FStar", "file_name": "OPLSS2021.NDS.fst", "name": "OPLSS2021.NDS.tape" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.HandshakeLog.fst", "name": "MiTLS.HandshakeLog.log" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.ref" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_store_entry" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_store_entry" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Types.fst", "name": "Zeta.Steel.LogEntry.Types.record" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVC.fst", "name": "OPLSS2021.ValeVC.t_pre" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVC.fst", "name": "OPLSS2021.ValeVC.t_wp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.GlobalRel.fsti", "name": "Zeta.Steel.GlobalRel.i_verifiable_logs" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVC.fst", "name": "OPLSS2021.ValeVC.t_post" }, { "project_name": "FStar", "file_name": "OPLSS.AE.fst", "name": "OPLSS.AE.mac_cpa_related" }, { "project_name": "zeta", "file_name": "Zeta.EAC.fsti", "name": "Zeta.EAC.nevict_vlog_entry" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.alg" }, { "project_name": "FStar", "file_name": "OPLSS.Log.fst", "name": "OPLSS.Log.t" }, { "project_name": "zeta", "file_name": "Zeta.Steel.LogEntry.Types.fst", "name": "Zeta.Steel.LogEntry.Types.hash_value" }, { "project_name": "FStar", "file_name": "OPLSS.CPA.fst", "name": "OPLSS.CPA.iv_of_entry" }, { "project_name": "FStar", "file_name": "IEXN.fst", "name": "IEXN.exns" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.safe_id" }, { "project_name": "hacl-star", "file_name": "Spec.Agile.AEAD.fsti", "name": "Spec.Agile.AEAD.supported_alg" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadRel.fsti", "name": "Zeta.Steel.ThreadRel.i_verifiable_log" }, { "project_name": "zeta", "file_name": "Zeta.EAC.fsti", "name": "Zeta.EAC.evict_vlog_entry" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVCNoProp.fst", "name": "OPLSS2021.ValeVCNoProp.t_pre" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_log_entry" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.abcd_t" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVCNoProp.fst", "name": "OPLSS2021.ValeVCNoProp.t_post" }, { "project_name": "zeta", "file_name": "Zeta.Steel.GlobalRel.fsti", "name": "Zeta.Steel.GlobalRel.verifiable_logs" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.word" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.word" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadStateModel.fst", "name": "Zeta.Steel.ThreadStateModel.all_logs" }, { "project_name": "FStar", "file_name": "EtM.CPA.fst", "name": "EtM.CPA.aes_key" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.rwops" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ApplicationTypes.fsti", "name": "Zeta.Steel.ApplicationTypes.app_result_entry" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_timestamp" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Thread.fsti", "name": "Zeta.Steel.Thread.tlog" }, { "project_name": "FStar", "file_name": "OPLSS.Ideal.fsti", "name": "OPLSS.Ideal.auth" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.ce" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.ce" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Main.fsti", "name": "Zeta.Steel.Main.tid_log_map" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.abcd_idx" }, { "project_name": "FStar", "file_name": "Bane.Lib.fst", "name": "Bane.Lib.for_you" }, { "project_name": "zeta", "file_name": "Zeta.EAC.fsti", "name": "Zeta.EAC.eac_log" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.test0" }, { "project_name": "FStar", "file_name": "OPLSS2021.ValeVCNoProp.fst", "name": "OPLSS2021.ValeVCNoProp.t_wp" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.lref" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Thread.fsti", "name": "Zeta.Steel.Thread.verifiable_log" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_timestamp" }, { "project_name": "steel", "file_name": "Steel.C.Typestring.fst", "name": "Steel.C.Typestring.cv" }, { "project_name": "steel", "file_name": "Pulse.C.Typestring.fst", "name": "Pulse.C.Typestring.cv" }, { "project_name": "dice-star", "file_name": "L0.Base.fst", "name": "L0.Base.bytes_sec" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_record" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_val" }, { "project_name": "dice-star", "file_name": "L0.Base.fst", "name": "L0.Base.byte_sec" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadLogMap.fsti", "name": "Zeta.Steel.ThreadLogMap.log" }, { "project_name": "zeta", "file_name": "Zeta.Steel.ThreadLogMap.fst", "name": "Zeta.Steel.ThreadLogMap.aval" }, { "project_name": "hacl-star", "file_name": "Spec.AES.fst", "name": "Spec.AES.elem" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_record" }, { "project_name": "zeta", "file_name": "Zeta.Steel.AggregateEpochHashes.fsti", "name": "Zeta.Steel.AggregateEpochHashes.log" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_val" }, { "project_name": "FStar", "file_name": "EtM.CPA.fst", "name": "EtM.CPA.iv" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_key" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.lref" }, { "project_name": "everparse", "file_name": "LowParse.Low.ErrorCode.fst", "name": "LowParse.Low.ErrorCode.error_code" }, { "project_name": "dice-star", "file_name": "L0.X509.FWID.fst", "name": "L0.X509.FWID.fwid_payload_t'" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_mval" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.flows" }, { "project_name": "FStar", "file_name": "OPLSS.CPA.fst", "name": "OPLSS.CPA.raw_cipher" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_mval" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.label_equiv" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_dval" }, { "project_name": "dice-star", "file_name": "L0.Base.fst", "name": "L0.Base.l0_hash_alg" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.i_desc_hash" }, { "project_name": "hacl-star", "file_name": "Spec.MD5.fst", "name": "Spec.MD5.t_idx" }, { "project_name": "everquic-crypto", "file_name": "Model.AEAD.fsti", "name": "Model.AEAD.unsafe_id" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.flows" }, { "project_name": "zeta", "file_name": "Zeta.Steel.Rel.fsti", "name": "Zeta.Steel.Rel.s_base_key" }, { "project_name": "everparse", "file_name": "LowParse.Low.ErrorCode.fst", "name": "LowParse.Low.ErrorCode.pos_t" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.QuickCodes.fsti", "name": "Vale.PPC64LE.QuickCodes.codes" } ], "selected_premises": [ "LowStar.Monotonic.Buffer.length", "FStar.Monotonic.Seq.at_most_log_len", "OPLSS.Log.intro_contains_h", "OPLSS.Log.grows", "LowStar.Monotonic.Buffer.srel", "FStar.Monotonic.Seq.map", "FStar.Monotonic.Seq.grows_aux", "FStar.Monotonic.Seq.grows", "FStar.Monotonic.Seq.increment_seqn", "OPLSS.bytes", "FStar.Monotonic.Seq.grows_p", "FStar.Heap.trivial_preorder", "FStar.Monotonic.Seq.at_most_log_len_stable", "OPLSS.Log.contains", "OPLSS.Log.find", "FStar.Monotonic.Seq.snoc", "OPLSS.Log.fp", "FStar.UInt.size", "FStar.Monotonic.Seq.at_least_is_stable", "OPLSS.Ideal.conf", "FStar.Monotonic.Seq.increases", "OPLSS.Ideal.auth", "FStar.Monotonic.HyperStack.sel", "FStar.Monotonic.Seq.un_snoc", "FStar.Monotonic.Seq.at_least", "FStar.Monotonic.HyperStack.live_region", "FStar.Monotonic.Seq.i_at_least", "FStar.Monotonic.Seq.op_At", "LowStar.Monotonic.Buffer.deref", "FStar.Pervasives.Native.fst", "LowStar.Monotonic.Buffer.get", "FStar.Monotonic.Seq.map_append", "FStar.Monotonic.Seq.map_snoc", "FStar.Pervasives.Native.snd", "FStar.Mul.op_Star", "LowStar.Monotonic.Buffer.loc_addr_of_buffer", "OPLSS.Log.entries", "FStar.HyperStack.ST.is_eternal_region", "LowStar.Monotonic.Buffer.loc_all_regions_from", "FStar.Monotonic.Seq.map_has_at_index_stable", "LowStar.Monotonic.Buffer.loc_region_only", "FStar.Monotonic.Seq.test0", "LowStar.Monotonic.Buffer.upd", "OPLSS.Log.new_log", "LowStar.Monotonic.Buffer.fresh_loc", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.HyperStack.mreference", "FStar.Monotonic.Seq.map_grows", "OPLSS.Log.t", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Monotonic.Seq.collect", "LowStar.Monotonic.Buffer.lmbuffer", "FStar.Monotonic.Seq.new_seqn", "FStar.Monotonic.HyperStack.frameOf", "FStar.Monotonic.HyperStack.as_addr", "OPLSS.lbytes", "FStar.Monotonic.Seq.write_at_end", "FStar.Monotonic.Seq.map_index", "OPLSS.Log.contains_now_e", "FStar.Monotonic.Seq.i_at_least_is_stable", "FStar.Monotonic.Seq.test", "LowStar.Monotonic.Buffer.disjoint", "FStar.Monotonic.Seq.collect_grows", "FStar.Monotonic.Seq.map_prefix", "FStar.Pervasives.dfst", "FStar.Monotonic.Seq.invariant", "FStar.Pervasives.dsnd", "OPLSS.Log.contains_now", "FStar.Monotonic.Seq.i_sel", "FStar.Monotonic.Seq.map_length", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Monotonic.Seq.map_prefix_stable", "FStar.Monotonic.Seq.i_read", "OPLSS.Log.add", "FStar.Monotonic.Seq.map_has_at_index", "OPLSS.Log.index_mem", "FStar.Monotonic.Seq.collect_prefix", "FStar.Monotonic.HyperStack.contains", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.Seq.itest", "FStar.Monotonic.HyperStack.modifies_one", "OPLSS.Log.has", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Monotonic.Seq.i_contains", "FStar.Monotonic.Seq.testify_seqn", "FStar.UInt32.op_Hat_Hat", "FStar.UInt8.op_Hat_Hat", "FStar.Monotonic.HyperStack.is_eternal_region_hs", "FStar.Monotonic.HyperStack.is_in", "FStar.Monotonic.Seq.collect_snoc", "FStar.UInt32.minus", "FStar.UInt8.minus", "FStar.HyperStack.ST.contains_region", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.Seq.i_seq", "FStar.Monotonic.Seq.alloc_mref_seq", "FStar.Monotonic.Heap.mref", "FStar.UInt8.lt", "FStar.UInt32.lt", "FStar.UInt8.gte_mask" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule OPLSS.AE\n(* This is the interface for authenticated encryption (AE)\n\n It provides an ideal view of AE in terms of a log associating\n plain and ciphertexts.\n\n However, this ideal interface is implemented without any loss in\n security by composing secure interfaces for MACs (based on the\n UF-CMA hypothesis) and Encryption (based on IND-CPA).\n*)\nopen OPLSS //some basic definitions for this demo\nopen FStar.Seq //F* library of sequences\nmodule HS = FStar.HyperStack //The memory model\nopen FStar.HyperStack.ST //The State effect over that memory model\nmodule B = LowStar.Monotonic.Buffer //Arrays, abstract locations, framing etc.\n\n/// `key`: An abstract type of AE keys\nval key : Type u#0\n\n/// `ae_cipher`: An abstract type of AE ciphers\nval ae_cipher : eqtype\n\n/// The abstract memory footprint of key is just an abstract\n/// \"location\", i.e., `B.loc`\n///\n/// The function has effect `GTot`, meaning it is \"Ghost\" or\n/// computationally irrelevant, i.e., for specification only\nval footprint (k:key) : GTot B.loc\n\n/// We have an abstract invariant relating keys to memorys\nval invariant : key -> HS.mem -> prop\n\n/// Each element in the ae log associates a plain and a cipher text", "sketch": [ "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: `plain` of type `FStar.Seq.seq FStar.UInt8.t` representing the plaintext, and `cipher` of type `ae_cipher` representing the corresponding ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: The `log_entry` definition represents a pair of plaintext and ciphertext.\n\nStep 2: The `log_entry` is implemented as a simple F* record type with two fields: one for the plaintext and one for the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, which associates a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: one for the plaintext and one for the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: `plain` of type `seq byte` representing the plaintext, and `cipher` of type `seq byte` representing the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: `plain` of type `seq byte` representing the plaintext, and `cipher` of type `seq byte` representing the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: `plain` of type `FStar.Seq.seq FStar.UInt8.t` representing the plaintext, and `cipher` of type `ae_cipher` representing the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, which associates a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: one for the plaintext and one for the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext message with its corresponding ciphertext.\n\nStep 1: We define the `log_entry` type to represent an entry in the AE log, which consists of a plaintext message and its corresponding ciphertext.\n\nStep 2: The `log_entry` type is implemented as a record with two fields: `plain` of type `FStar.Seq.byte` representing the plaintext message, and `cipher` of type `ae_cipher` representing the ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, associating a plaintext with its corresponding ciphertext.\n\nStep 1: We define a type `log_entry` to represent an entry in the AE log.\n\nStep 2: The `log_entry` type will consist of two fields: `plain` of type `FStar.Seq.seq FStar.UInt8.t` representing the plaintext, and `cipher` of type `ae_cipher` representing the corresponding ciphertext.", "The definition `log_entry` represents an entry in the authenticated encryption (AE) log, which associates a plaintext with its corresponding ciphertext.\n\nStep 1: We define the `log_entry` type to represent an entry in the AE log.\nStep 2: The `log_entry` type consists of two fields: `plain` of type `seq byte` representing the plaintext and `cipher` of type `seq byte` representing the ciphertext." ], "generated_solution": [ "type log_entry = {\n plain: FStar.Seq.seq FStar.UInt8.t;\n cipher: ae_cipher;\n}", "type log_entry = {\n plain: FStar.Seq.byte;\n cipher: FStar.Seq.byte\n}", "type log_entry = {\n plain: FStar.Seq.byte;\n cipher: FStar.Seq.byte;\n}", "type log_entry = {\n plain: seq byte;\n cipher: seq byte;\n}", "type log_entry = {\n plain: seq byte;\n cipher: seq byte;\n}", "type log_entry = {\n plain: FStar.Seq.seq FStar.UInt8.t;\n cipher: ae_cipher;\n}", "type log_entry = {\n plain: FStar.Seq.byte;\n cipher: FStar.Seq.byte;\n}", "type log_entry = {\n plain: FStar.Seq.byte;\n cipher: ae_cipher;\n}", "type log_entry = {\n plain: FStar.Seq.seq FStar.UInt8.t;\n cipher: ae_cipher;\n}", "type log_entry = {\n plain: seq byte;\n cipher: seq byte;\n}" ] }, { "file_name": "PulseCore.Memory.fst", "name": "PulseCore.Memory.core_ref_is_null", "opens_and_abbrevs": [ { "abbrev": "PP", "full_module": "PulseCore.Preorder" }, { "abbrev": "H", "full_module": "PulseCore.Heap" }, { "open": "FStar.FunctionalExtensionality" }, { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "M_", "full_module": "PulseCore.NondeterministicMonotonicStateMonad" }, { "open": "FStar.PCM" }, { "open": "FStar.Ghost" }, { "abbrev": "PP", "full_module": "PulseCore.Preorder" }, { "abbrev": "M_", "full_module": "PulseCore.NondeterministicMonotonicStateMonad" }, { "open": "FStar.PCM" }, { "open": "FStar.Ghost" }, { "open": "PulseCore" }, { "open": "PulseCore" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val core_ref_is_null (r:core_ref) : b:bool { b <==> r == core_ref_null }", "source_definition": "let core_ref_is_null r = H.core_ref_is_null r", "source_range": { "start_line": 141, "start_col": 0, "end_line": 141, "end_col": 45 }, "interleaved": false, "definition": "fun r -> PulseCore.Heap.core_ref_is_null r", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "PulseCore.Memory.core_ref", "PulseCore.Heap.core_ref_is_null", "Prims.bool", "Prims.l_iff", "Prims.b2t", "Prims.eq2", "PulseCore.Memory.core_ref_null" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "r: PulseCore.Memory.core_ref -> b: Prims.bool{b <==> r == PulseCore.Memory.core_ref_null}", "prompt": "let core_ref_is_null r =\n ", "expected_response": "H.core_ref_is_null r", "source": { "project_name": "steel", "file_name": "lib/pulse_core/PulseCore.Memory.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "PulseCore.Memory.fst", "checked_file": "dataset/PulseCore.Memory.fst.checked", "interface_file": true, "dependencies": [ "dataset/PulseCore.Preorder.fst.checked", "dataset/PulseCore.NondeterministicMonotonicStateMonad.fsti.checked", "dataset/PulseCore.Heap.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Witnessed.Core.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked", "dataset/FStar.MSTTotal.fst.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.IndefiniteDescription.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "lock_state", "Invariant", "Invariant", "Invariant", "inv", "inv", "val mem : Type u#(a + 1)", "let lock_store : Type u#(a+1) = list (lock_state u#a)", "mem", "mem", "ctr", "ctr", "heap", "heap", "locks", "locks", "val core_mem (m:mem u#a) : mem u#a", "let heap_of_mem (x:mem) : H.heap = x.heap", "let mem_of_heap (h:H.heap) : mem = {\n ctr = 0;\n heap = h;\n locks = []\n}", "val slprop : Type u#(a + 1)", "val interp (p:slprop u#a) (m:mem u#a) : prop", "let mem_set_heap (m:mem) (h:H.heap) : mem = {\n ctr = m.ctr;\n heap = h;\n locks = m.locks;\n}", "val equiv (p1 p2:slprop u#a) : prop", "let core_mem (m:mem) : mem = mem_of_heap (heap_of_mem m)", "val core_mem_invol (m: mem u#a) : Lemma\n (core_mem (core_mem m) == core_mem m)\n [SMTPat (core_mem (core_mem m))]", "val slprop_extensionality (p q:slprop)\n : Lemma\n (requires p `equiv` q)\n (ensures p == q)", "let core_mem_invol m = ()", "val slprop_equiv_refl (p:slprop)\n : Lemma (p `equiv` p)\n [SMTPat (equiv p p)]", "let disjoint (m0 m1:mem u#h)\n : prop\n = m0.ctr == m1.ctr /\\\n H.disjoint m0.heap m1.heap /\\\n m0.locks == m1.locks", "val core_ref : Type u#0", "let ref (a:Type u#a) (pcm:pcm a) : Type u#0 = core_ref", "let disjoint_sym (m0 m1:mem u#h)\n : Lemma (disjoint m0 m1 <==> disjoint m1 m0)\n [SMTPat (disjoint m0 m1)]\n = ()", "val core_ref_null : core_ref", "let join (m0:mem u#h) (m1:mem u#h{disjoint m0 m1}) : mem u#h\n= {\n ctr = m0.ctr;\n heap = H.join m0.heap m1.heap;\n locks = m0.locks\n }", "let null (#a:Type u#a) (#pcm:pcm a) : ref a pcm = core_ref_null", "val core_ref_is_null (r:core_ref) : b:bool { b <==> r == core_ref_null }", "let is_null (#a:Type u#a) (#pcm:pcm a) (r:ref a pcm) : (b:bool{b <==> r == null}) = core_ref_is_null r", "let join_commutative (m0 m1:mem)\n : Lemma\n (requires\n disjoint m0 m1)\n (ensures\n (disjoint m0 m1 /\\\n disjoint m1 m0 /\\\n join m0 m1 == join m1 m0))\n = H.join_commutative m0.heap m1.heap", "val emp : slprop u#a", "val pure (p:prop) : slprop u#a", "val pts_to (#a:Type u#a) (#pcm:_) (r:ref a pcm) (v:a) : slprop u#a", "val star (p1 p2:slprop u#a) : slprop u#a", "val h_exists (#a:Type u#b) (f: (a -> slprop u#a)) : slprop u#a", "val equiv_symmetric (p1 p2:slprop)\n : squash (p1 `equiv` p2 ==> p2 `equiv` p1)", "let disjoint_join (m0 m1 m2:mem)\n : Lemma (disjoint m1 m2 /\\\n disjoint m0 (join m1 m2) ==>\n disjoint m0 m1 /\\\n disjoint m0 m2 /\\\n disjoint (join m0 m1) m2 /\\\n disjoint (join m0 m2) m1)\n = H.disjoint_join m0.heap m1.heap m2.heap", "val equiv_extensional_on_star (p1 p2 p3:slprop)\n : squash (p1 `equiv` p2 ==> (p1 `star` p3) `equiv` (p2 `star` p3))", "val emp_unit (p:slprop)\n : Lemma (p `equiv` (p `star` emp))", "let join_associative (m0 m1 m2:mem)\n : Lemma\n (requires\n disjoint m1 m2 /\\\n disjoint m0 (join m1 m2))\n (ensures\n (disjoint_join m0 m1 m2;\n join m0 (join m1 m2) == join (join m0 m1) m2))\n = H.join_associative m0.heap m1.heap m2.heap", "val pure_equiv (p q:prop)\n : Lemma ((p <==> q) ==> (pure p `equiv` pure q))", "val pure_true_emp (_:unit)\n : Lemma (pure True `equiv` emp)", "val star_commutative (p1 p2:slprop)\n : Lemma ((p1 `star` p2) `equiv` (p2 `star` p1))", "let slprop = H.slprop", "let interp p m = H.interp p m.heap", "val star_associative (p1 p2 p3:slprop)\n : Lemma ((p1 `star` (p2 `star` p3))\n `equiv`\n ((p1 `star` p2) `star` p3))", "let equiv p1 p2 = forall m. interp p1 m <==> interp p2 m", "let slprop_extensionality p q =\n assert (forall m. interp p m <==> interp q m);\n let aux (h:H.heap)\n : Lemma (H.interp p h <==> H.interp q h)\n [SMTPat (H.interp p h)]\n = let m : mem = { ctr = 0; heap = h; locks = [] } in\n assert (interp p m <==> interp q m)\n in\n assert (forall h. H.interp p h <==> H.interp q h);\n H.slprop_extensionality p q", "val star_congruence (p1 p2 p3 p4:slprop)\n : Lemma (requires p1 `equiv` p3 /\\ p2 `equiv` p4)\n (ensures (p1 `star` p2) `equiv` (p3 `star` p4))", "val iname : eqtype", "val reveal_equiv (p1 p2:slprop u#a) : Lemma\n (ensures (forall m. interp p1 m <==> interp p2 m) <==> p1 `equiv` p2)\n [SMTPat (p1 `equiv` p2)]", "let inames = erased (S.set iname)", "let reveal_equiv p1 p2 = ()", "val inames_ok (e:inames) (m:mem) : prop", "let slprop_equiv_refl p = ()", "val inames_ok_empty (m:mem)\n : Lemma (ensures inames_ok Set.empty m)\n [SMTPat (inames_ok Set.empty m)]", "let core_ref = H.core_ref", "let core_ref_null = H.core_ref_null" ], "closest": [ "val core_ref_is_null (r:core_ref) : b:bool { b <==> r == core_ref_null }\nlet core_ref_is_null r = H.core_ref_is_null r", "val core_ref_is_null (r:core_ref) : b:bool { b <==> r == core_ref_null }\nlet core_ref_is_null (r:core_ref) = Null? r", "val core_ref_is_null (r:core_ref) : b:bool { b <==> r == core_ref_null }\nlet core_ref_is_null (r:core_ref) = Null? r", "val is_null (#a:Type) (r:ref a)\n : b:bool{b <==> r == null}\nlet is_null (#a:Type) (r:ref a)\n : b:bool{b <==> r == null}\n = R.is_null r", "val is_null (#a:Type0) (r:ref a)\n : b:bool{b <==> r == null}\nlet is_null (#a:Type0) (r:ref a)\n : b:bool{b <==> r == null}\n = R.is_null r", "val is_null (#a:Type0) (r:ref a) : (b:bool{b <==> r == null})\nlet is_null #a r = H.is_null #(U.raise_t a) r", "val is_null (#a:Type0) (r:ref a) : (b:bool{b <==> r == null})\nlet is_null r = A.is_null r", "val is_null (#a:Type u#1) (r:ref a) : (b:bool{b <==> r == null})\nlet is_null #a r = Mem.is_null #(fractional a) #pcm_frac r", "val core_ref_null : core_ref\nlet core_ref_null = H.core_ref_null", "val core_ref_null : core_ref\nlet core_ref_null = Null", "val core_ref_null : core_ref\nlet core_ref_null = Null", "val is_ref_null (#a:Type) (#p:FStar.PCM.pcm a) (r:ref a p)\r\n: b:bool { b <==> r == ref_null p }\nlet is_ref_null (#a:Type u#a) (#p:pcm a) (r:ref a p) = core_ref_is_null r", "val is_null_t (#a: Type0) (r: t a) : (b:bool{b <==> r == null_t})\nlet is_null_t #a ptr = is_null ptr", "val is_pcm_ref_null\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:pcm_ref p)\n: b:bool { b <==> r == pcm_ref_null p }\nlet is_pcm_ref_null #a #p r = PulseCore.Action.is_ref_null #a #p r", "val is_null (#a:Type) (ptr:t a) : (b:bool{b <==> ptr == null_llist})\nlet is_null #a ptr = is_null ptr", "val is_null (#a:Type) (ptr:t a) : (b:bool{b <==> ptr == null_llist})\nlet is_null #a ptr = is_null ptr", "val is_null (#a:Type) (ptr:t a) : (b:bool{b <==> ptr == null_llist})\nlet is_null #a ptr = is_null ptr", "val is_null (#a:Type) (ptr:t a) : (b:bool{b <==> ptr == null_llist})\nlet is_null #a ptr = is_null ptr", "val is_null (ptr: t) : (b: bool{b <==> ptr == null_llist ()})\nlet is_null (ptr:t) : (b:bool{b <==> ptr == null_llist ()})\n= LL.is_null ptr", "val is_null (ptr: t) : (b: bool{b <==> ptr == null_llist ()})\nlet is_null (ptr:t) : (b:bool{b <==> ptr == null_llist ()})\n= LL.is_null ptr", "val is_null (#a: Type u#a) (#pcm: pcm a) (r: ref a pcm) : (b: bool{b <==> r == null})\nlet is_null (#a:Type u#a) (#pcm:pcm a) (r:ref a pcm) : (b:bool{b <==> r == null}) = core_ref_is_null r", "val is_null (#a: Type u#a) (#pcm: pcm a) (r: ref a pcm) : (b: bool{b <==> r == null})\nlet is_null (#a:Type u#a) (#pcm:pcm a) (r:ref a pcm) : (b:bool{b <==> r == null}) = core_ref_is_null r", "val is_null (#a: Type u#a) (#pcm: pcm a) (r: ref a pcm) : (b: bool{b <==> r == null})\nlet is_null (#a:Type u#a) (#pcm:pcm a) (r:ref a pcm) : (b:bool{b <==> r == null}) = core_ref_is_null r", "val is_null (#a: Type u#a) (#pcm: pcm a) (r: ref a pcm) : (b: bool{b <==> r == null})\nlet is_null (#a:Type u#a) (#pcm:pcm a) (r:ref a pcm) : (b:bool{b <==> r == null}) = core_ref_is_null r", "val g_is_null (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) :GTot bool\nlet g_is_null #_ #_ #_ b = Null? b", "val mnull (#a:Type0) (#rrel #rel:srel a) :Tot (b:mbuffer a rrel rel {g_is_null b})\nlet mnull #_ #_ #_ = Null", "val core_ref : Type u#0\nlet core_ref = H.core_ref", "val is_null_ptr (#elt: Type u#a) (p: ptr elt)\n : Pure bool (requires True) (ensures (fun res -> res == true <==> p == null_ptr elt))\nlet is_null_ptr (#elt: Type u#a) (p: ptr elt)\n: Pure bool\n (requires True)\n (ensures (fun res -> res == true <==> p == null_ptr elt))\n= is_pcm_ref_null p.base", "val is_null (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel)\n :HST.Stack bool (requires (fun h -> live h b))\n (ensures (fun h y h' -> h == h' /\\ y == g_is_null b))\nlet is_null #_ #_ #_ b = Null? b", "val is_null_ptr (#elt: Type u#a) (p: ptr elt) : Pure bool\n (requires True)\n (ensures (fun res -> res == true <==> p == null_ptr elt))\nlet is_null_ptr p = is_null p.base", "val is_null_ptr (#elt: Type0) (p: ptr elt) : Pure bool\n (requires True)\n (ensures (fun res -> res == true <==> p == null_ptr elt))\nlet is_null_ptr p = H.is_null_ptr p", "val live_is_null (#a: Type0) (#rrel #rel: srel a) (h: HS.mem) (b: mbuffer a rrel rel)\n : Lemma (requires (g_is_null b == true)) (ensures (live h b)) [SMTPat (live h b)]\nlet live_is_null (#a:Type0) (#rrel #rel:srel a) (h:HS.mem) (b:mbuffer a rrel rel)\n :Lemma (requires (g_is_null b == true))\n (ensures (live h b))\n [SMTPat (live h b)]\n = null_unique b;\n live_null a rrel rel h", "val array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n : STAtomicBase bool\n false\n opened\n Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\nlet array_is_null\n (#t: Type)\n (#opened: _)\n (#td: typedef t)\n (#v: Ghost.erased (Seq.seq t))\n (r: array_or_null td)\n: STAtomicBase bool false opened Unobservable\n (array_pts_to_or_null r v)\n (fun _ -> array_pts_to_or_null r v)\n (True)\n (fun b -> b == g_array_is_null r)\n= let a = array_ptr_of r in\n let len : array_len_t a = dsnd r in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null (| a, len |) v);\n let res = array_ptr_is_null a len in\n rewrite (array_pts_to_or_null _ _) (array_pts_to_or_null r v);\n return res", "val vptr_not_null (#opened: _) (#a: Type) (r: ref a)\n : SteelGhost unit\n opened\n (vptr r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> sel r h0 == sel r h1 /\\ is_null r == false)\nlet vptr_not_null (#opened: _)\n (#a: Type)\n (r: ref a)\n: SteelGhost unit opened\n (vptr r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 ->\n sel r h0 == sel r h1 /\\\n is_null r == false\n )\n= vptrp_not_null r full_perm", "val vptr_not_null (#opened: _) (#a: Type) (r: ref a)\n : SteelGhost unit\n opened\n (vptr r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 -> sel r h0 == sel r h1 /\\ is_null r == false)\nlet vptr_not_null (#opened: _)\n (#a: Type)\n (r: ref a)\n: SteelGhost unit opened\n (vptr r)\n (fun _ -> vptr r)\n (fun _ -> True)\n (fun h0 _ h1 ->\n sel r h0 == sel r h1 /\\\n is_null r == false\n )\n= vptrp_not_null r full_perm", "val g_is_null (#t: typ) (p: npointer t) : GTot bool\nlet g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false", "val g_is_null (#t: buftype) (#a: Type0) (b: buffer_t t a) : GTot bool\nlet g_is_null (#t : buftype) (#a : Type0) (b : buffer_t t a) : GTot bool =\n match t with\n | IMMUT -> IB.g_is_null (b <: ibuffer a)\n | MUT -> B.g_is_null (b <: buffer a)\n | CONST -> B.g_is_null (CB.as_mbuf (b <: cbuffer a))", "val copy_ref (r: ref U32.t)\n : Steel (ref U32.t)\n (vptr r)\n (fun r' -> (vptr r) `star` (vptr r'))\n (requires fun _ -> True)\n (ensures fun h0 r' h1 -> sel r h0 == sel r h1 /\\ sel r' h1 == sel r h1)\nlet copy_ref (r:ref U32.t) : Steel (ref U32.t)\n (vptr r)\n // We allocated a new reference r', which is the return value\n (fun r' -> vptr r `star` vptr r')\n (requires fun _ -> True)\n (ensures fun h0 r' h1 ->\n // reference r was not modified\n sel r h0 == sel r h1 /\\\n // After copying, reference r' contains the same value as reference r\n sel r' h1 == sel r h1)\n\n = let x = read r in\n let r' = malloc x in\n r'", "val is_nil (#a:Type0) (ptr:t a)\n : Steel bool (llist ptr) (fun _ -> llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 res h1 ->\n (res == true <==> ptr == null_llist #a) /\\\n v_llist ptr h0 == v_llist ptr h1 /\\\n res == Nil? (v_llist ptr h1))\nlet is_nil\n #a ptr\n= is_nil' ptr;\n return (is_null ptr)", "val is_nil (#a:Type0) (ptr:t a)\n : Steel bool (llist ptr) (fun _ -> llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 res h1 ->\n (res == true <==> ptr == null_llist #a) /\\\n v_llist ptr h0 == v_llist ptr h1 /\\\n res == Nil? (v_llist ptr h1))\nlet is_nil\n #a ptr\n= is_nil' ptr;\n return (is_null ptr)", "val is_null (#a: Type0) (p: array a)\n : Pure bool (requires True) (ensures (fun res -> res == true <==> p == null))\nlet is_null (#a: Type0) (p: array a) : Pure bool\n (requires True)\n (ensures (fun res -> res == true <==> p == null))\n= is_null_ptr (ptr_of p)", "val test_if8 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if8 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0);\n write r2 0", "val test_if8 (b: bool) (r1 r2: ref)\n : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if8 (b:bool) (r1 r2: ref) : SteelT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0);\n write r2 0", "val is_null (#a: Type u#a) (p: array a)\n : Pure bool (requires True) (ensures (fun res -> res == true <==> p == null))\nlet is_null (#a: Type u#a) (p: array a) : Pure bool\n (requires True)\n (ensures (fun res -> res == true <==> p == null))\n= is_null_ptr (ptr_of p)", "val is_null (#t: buftype) (#a: Type0) (b: buffer_t t a)\n : Stack bool\n (requires (fun h -> live h b))\n (ensures (fun h y h' -> h == h' /\\ y == g_is_null b))\nlet is_null (#t : buftype) (#a : Type0) (b : buffer_t t a) :\n Stack bool\n (requires (fun h -> live h b))\n (ensures (fun h y h' -> h == h' /\\ y == g_is_null b)) =\n match t with\n | IMMUT -> IB.is_null (b <: ibuffer a)\n | MUT -> B.is_null (b <: buffer a)\n | CONST -> CB.is_null (b <: cbuffer a)", "val g_is_null (#ty: buftype) (#a: Type0) (b: buffer_t ty a) : GTot bool\nlet g_is_null (#ty : buftype) (#a : Type0) (b : buffer_t ty a) : GTot bool =\n match ty with\n | IMMUT -> LowStar.Buffer.g_is_null #a #(LowStar.ImmutableBuffer.immutable_preorder a)\n #(LowStar.ImmutableBuffer.immutable_preorder a)\n b\n | MUT -> LowStar.Buffer.g_is_null #a #(LowStar.Buffer.trivial_preorder a)\n #(LowStar.Buffer.trivial_preorder a)\n b\n | CONST -> LowStar.Buffer.g_is_null #a (LowStar.ConstBuffer.as_mbuf b)", "val null (#a:Type) \n : ref a\nlet null (#a:Type)\n : ref a\n = R.null #a", "val is_nil (ptr: t)\n : Steel bool\n (LL.llist ptr)\n (fun _ -> LL.llist ptr)\n (requires fun _ -> True)\n (ensures\n fun h0 res h1 ->\n (res == true <==> ptr == null_llist ()) /\\ LL.v_llist ptr h0 == LL.v_llist ptr h1 /\\\n res == Nil? (LL.v_llist ptr h1))\nlet is_nil (ptr:t)\n : Steel bool (LL.llist ptr) (fun _ -> LL.llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 res h1 ->\n (res == true <==> ptr == null_llist ()) /\\\n LL.v_llist ptr h0 == LL.v_llist ptr h1 /\\\n res == Nil? (LL.v_llist ptr h1))\n= LL.is_nil ptr", "val is_nil (ptr: t)\n : Steel bool\n (LL.llist ptr)\n (fun _ -> LL.llist ptr)\n (requires fun _ -> True)\n (ensures\n fun h0 res h1 ->\n (res == true <==> ptr == null_llist ()) /\\ LL.v_llist ptr h0 == LL.v_llist ptr h1 /\\\n res == Nil? (LL.v_llist ptr h1))\nlet is_nil (ptr:t)\n : Steel bool (LL.llist ptr) (fun _ -> LL.llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 res h1 ->\n (res == true <==> ptr == null_llist ()) /\\\n LL.v_llist ptr h0 == LL.v_llist ptr h1 /\\\n res == Nil? (LL.v_llist ptr h1))\n= LL.is_nil ptr", "val cons_is_not_null (#a:Type0) (ptr:t a)\n : Steel unit (llist ptr) (fun _ -> llist ptr)\n (requires fun h -> Cons? (v_llist ptr h))\n (ensures fun h0 _ h1 ->\n v_llist ptr h0 == v_llist ptr h1 /\\\n ptr =!= null_llist)\nlet cons_is_not_null #a ptr =\n let h = get () in\n let l = hide (v_llist ptr h) in\n extract_info (llist ptr) l (ptr =!= null_llist) (lemma_cons_not_null ptr l)", "val is_null (#ty : buftype) (#a : Type0) (b : buffer_t ty a) :\n Stack bool (requires (fun h -> live h b))\n (ensures (fun h y h' -> h == h' /\\ y == g_is_null b))\nlet is_null #ty #a b =\n match ty with\n | IMMUT -> LowStar.Buffer.is_null #a #(LowStar.ImmutableBuffer.immutable_preorder a)\n #(LowStar.ImmutableBuffer.immutable_preorder a) b\n | MUT -> LowStar.Buffer.is_null #a #(LowStar.Buffer.trivial_preorder a)\n #(LowStar.Buffer.trivial_preorder a) b\n | CONST -> LowStar.Buffer.is_null #a (LowStar.ConstBuffer.cast b)", "val is_reflexive (#a:Type) (r: binary_relation a) : Type0\nlet is_reflexive #a r = forall (x:a). x `r` x", "val null (#a:Type0) \n : ref a\nlet null (#a:Type0)\n : ref a\n = R.null #a", "val copy_ref (#a: Type0) (r: ref a)\n : Steel (ref a)\n (vptr r)\n (fun r' -> (vptr r) `star` (vptr r'))\n (requires fun _ -> True)\n (ensures fun h0 r' h1 -> sel r h0 == sel r h1 /\\ sel r' h1 == sel r h1)\nlet copy_ref (#a:Type0) (r:ref a) : Steel (ref a)\n (vptr r)\n // We allocated a new reference r', which is the return value\n (fun r' -> vptr r `star` vptr r')\n (requires fun _ -> True)\n (ensures fun h0 r' h1 ->\n // reference r was not modified\n sel r h0 == sel r h1 /\\\n // After copying, reference r' contains the same value as reference r\n sel r' h1 == sel r h1)\n\n = let x = read r in\n let r' = malloc x in\n r'", "val null (#a:Type u#1) : ref a\nlet null #a = Mem.null #(fractional a) #pcm_frac", "val good_raw_key_impl (r:raw_key)\r\n : b:bool { b <==> good_raw_key r }\nlet good_raw_key_impl (r:raw_key)\r\n : b:bool { b <==> good_raw_key r }\r\n = let r' = truncate_key r r.significant_digits in\r\n truncate_key_ith_bit r r.significant_digits;\r\n FStar.Classical.forall_intro (FStar.Classical.move_requires (ith_bit_extensional r));\r\n r' = r", "val ccell_ptrvalue_is_null (#a: Type0) (c: ccell_ptrvalue a) : Pure bool\n (requires True)\n (ensures (fun b -> b == true <==> c == ccell_ptrvalue_null a))\nlet ccell_ptrvalue_is_null #a x = is_null x.data", "val null (#a:Type0) : ref a\nlet null #a = A.null #a", "val null (#a:Type0) : ref a\nlet null #a = H.null #(U.raise_t a)", "val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\\ x == sel h1 r)\nlet op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST a\n (fun _ -> True)\n (fun h0 x h1 ->\n h0 == h1 /\\\n x == sel h1 r)\n= HoareST?.reflect (fun _ -> read r)", "val ( ! ) (#a: Type) (#rel: P.preorder a) (r: mref a rel)\n : HoareST a (fun _ -> True) (fun h0 x h1 -> h0 == h1 /\\ x == sel h1 r)\nlet op_Bang (#a:Type) (#rel:P.preorder a) (r:mref a rel)\n: HoareST a\n (fun _ -> True)\n (fun h0 x h1 ->\n h0 == h1 /\\\n x == sel h1 r)\n= HoareST?.reflect (fun _ -> read r)", "val test_if7 (b: bool) (r1 r2: ref)\n : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if7 (b:bool) (r1 r2: ref) : SteelT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val test_if7 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if7 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val Setoids.refl = r: Setoids.rel s -> Prims.logical\nlet refl #s (r: rel s) =\n forall x. x `r` x", "val read : #a:Type -> \n r:ref a -> \n\t ImmutableST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t\t\t\t x == sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val test1 (r: ref int)\n : Steel unit\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> sel r h1 == 0)\nlet test1 (r:ref int) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun _ _ h1 -> sel r h1 == 0)\n = write r 1;\n write r 0", "val cons_is_not_null (#a:Type0) (ptr:t a)\n : Steel unit (llist_ptr ptr) (fun _ -> llist_ptr ptr)\n (requires fun h -> Cons? (v_ptrlist ptr h))\n (ensures fun h0 _ h1 ->\n v_ptrlist ptr h0 == v_ptrlist ptr h1 /\\\n ptr =!= null_llist)\nlet cons_is_not_null #a ptr =\n let h = get #(llist_ptr ptr) () in\n let l = hide (v_ptrlist ptr h) in\n extract_info (llist_ptr ptr) l (ptr =!= null_llist) (lemma_cons_not_null ptr l)", "val test0 (r: ref int)\n : Steel unit\n (vptr r)\n (fun _ -> vptr r)\n (requires fun h -> sel r h == 0)\n (ensures fun _ _ h1 -> sel r h1 == 1)\nlet test0 (r:ref int) : Steel unit\n (vptr r) (fun _ -> vptr r)\n (requires fun h -> sel r h == 0)\n (ensures fun _ _ h1 -> sel r h1 == 1)\n = let x = gget (vptr r) in\n assert (x == Ghost.hide 0);\n write r 1;\n let x = gget (vptr r) in\n assert (x == Ghost.hide 1);\n write r 1", "val test_if10 (b: bool) (r1 r2 r3: ref)\n : SteelT unit\n (((ptr r1) `star` (ptr r2)) `star` (ptr r3))\n (fun _ -> ((ptr r1) `star` (ptr r2)) `star` (ptr r3))\nlet test_if10 (b:bool) (r1 r2 r3: ref) : SteelT unit\n (ptr r1 `star` ptr r2 `star` ptr r3)\n (fun _ -> ptr r1 `star` ptr r2 `star` ptr r3)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val log_ref (r: rgn) (i: id) : Tot Type0\nlet log_ref (r:rgn) (i:id): Tot Type0 =\n if authId i then ideal_log r i else unit", "val ref_null (#a:Type u#a) (p:pcm a) : ref a p\nlet ref_null (#a:Type u#a) (p:pcm a) = core_ref_null", "val cllist_ptrvalue_is_null (#a: Type0) (c: cllist_ptrvalue a) : Pure bool\n (requires True)\n (ensures (fun b -> b == true <==> c == cllist_ptrvalue_null a))\nlet cllist_ptrvalue_is_null #a x = is_null x.head", "val test_if10 (b: bool) (r1 r2 r3: ref)\n : STT unit\n (((ptr r1) `star` (ptr r2)) `star` (ptr r3))\n (fun _ -> ((ptr r1) `star` (ptr r2)) `star` (ptr r3))\nlet test_if10 (b:bool) (r1 r2 r3: ref) : STT unit\n (ptr r1 `star` ptr r2 `star` ptr r3)\n (fun _ -> ptr r1 `star` ptr r2 `star` ptr r3)\n = if b then (write r1 0; write r2 0) else (write r2 0; write r1 0);\n write r2 0", "val not (b: bool) : bool\nlet not (b:bool) : bool = if b then false else true", "val test_if2 (b: bool) (r: ref) : STT unit (ptr r) (fun _ -> ptr r)\nlet test_if2 (b:bool) (r: ref) : STT unit (ptr r) (fun _ -> ptr r)\n = if b then write r 0 else write r 1", "val read : #a:Type -> \n r:ref a -> \n\t AllocST a (fun h0 -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t contains r h1 /\\ \n\t\t\t\t sel h1 r == x)\nlet read #a r =\n let h = ist_get () in\n ist_recall (contains r); //recalling that the current heap must contain the given reference\n sel h r", "val test2 (r1 r2: ref int)\n : Steel unit\n ((vptr r1) `star` (vptr r2))\n (fun _ -> (vptr r1) `star` (vptr r2))\n (requires fun h -> sel r1 h == 1)\n (ensures fun h0 _ h1 -> sel r1 h1 == 0 /\\ sel r2 h0 == sel r2 h1)\nlet test2 (r1 r2:ref int) : Steel unit\n (vptr r1 `star` vptr r2) (fun _ -> vptr r1 `star` vptr r2)\n (requires fun h -> sel r1 h == 1)\n (ensures fun h0 _ h1 -> sel r1 h1 == 0 /\\ sel r2 h0 == sel r2 h1)\n = write r1 0;\n write r1 0", "val read : #a:Type -> \n r:ref a -> \n\t AllocST a (fun _ -> True) \n (fun h0 x h1 -> h0 == h1 /\\ \n\t\t x == FStar.Heap.sel h1 r)\nlet read #a r = \n let h = ist_get () in\n sel h r", "val closed (e: src_exp) : b: bool{b <==> (freevars e) `Set.equal` Set.empty}\nlet rec closed (e:src_exp) \n : b:bool{ b <==> freevars e `Set.equal` Set.empty }\n = match e with\n | EVar v -> \n assert (v `Set.mem` freevars e);\n false\n | EBool _\n | EBVar _ -> true\n | EIf b e1 e2 -> closed b && closed e1 && closed e2\n | ELam t e -> closed_ty t && closed e\n | EApp e1 e2 -> closed e1 && closed e2\nand closed_ty (t:src_ty)\n : b:bool{ b <==> freevars_ty t `Set.equal` Set.empty }\n = match t with\n | TBool -> true\n | TRefineBool e -> closed e\n | TArrow t1 t2 -> closed_ty t1 && closed_ty t2", "val vptrp_not_null (#opened: _)\n (#a: Type)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (vptrp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h0 _ h1 ->\n h0 (vptrp r p) == h1 (vptrp r p) /\\\n is_null r == false\n )\nlet vptrp_not_null\n #opened #a r\n p\n= change_slprop_rel\n (vptrp r p)\n (vptrp r p)\n (fun x y -> x == y /\\ is_null r == false)\n (fun m -> pts_to_not_null r p (ptrp_sel r p m) m)", "val vptrp_not_null (#opened: _)\n (#a: Type)\n (r: ref a)\n (p: perm)\n: SteelGhost unit opened\n (vptrp r p)\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h0 _ h1 ->\n h0 (vptrp r p) == h1 (vptrp r p) /\\\n is_null r == false\n )\nlet vptrp_not_null\n r p\n= elim_vptrp r p;\n A.varrayp_not_null r p;\n intro_vptrp' r p", "val test_if3 (b: bool) (r: ref) : STT unit (ptr r) (fun _ -> ptr r)\nlet test_if3 (b:bool) (r:ref) : STT unit (ptr r) (fun _ -> ptr r)\n = if b then noop () else noop ()", "val test_if2 (b: bool) (r: ref) : SteelT unit (ptr r) (fun _ -> ptr r)\nlet test_if2 (b:bool) (r: ref) : SteelT unit (ptr r) (fun _ -> ptr r)\n = if b then write r 0 else write r 1", "val closed (s: src_exp) : b: bool{b <==> ((freevars s) `Set.equal` Set.empty)}\nlet rec closed (s:src_exp) \n : b:bool { b <==> (freevars s `Set.equal` Set.empty) }\n = match s with\n | EBool _\n | EBVar _ -> true\n | EVar m -> assert (m `Set.mem` freevars s); false\n | EIf b e1 e2 -> closed b && closed e1 && closed e2\n | ELam t e -> closed_ty t && closed e\n | EApp e1 e2 -> closed e1 && closed e2\n\nand closed_ty (t:src_ty)\n : b:bool { b <==> (freevars_ty t `Set.equal` Set.empty) }\n = match t with\n | TBool -> true\n | TRefineBool e -> closed e\n | TArrow t1 t2 -> closed_ty t1 && closed_ty t2", "val debug:ref bool\nlet debug : ref bool = alloc false", "val lockinv (p: vprop) (r: ref bool) : vprop\nlet lockinv (p:vprop) (r:ref bool) : vprop =\n h_exists (fun b -> pts_to r full_perm b `star` (if b then emp else p))", "val test_if3 (b: bool) (r: ref) : SteelT unit (ptr r) (fun _ -> ptr r)\nlet test_if3 (b:bool) (r:ref) : SteelT unit (ptr r) (fun _ -> ptr r)\n = if b then noop () else noop ()", "val test_if9 (b: bool) (r1 r2: ref)\n : SteelT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if9 (b:bool) (r1 r2: ref) : SteelT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = write r1 0;\n if b then (write r1 0) else (write r2 0);\n write r2 0;\n if b then (write r1 0) else (write r2 0);\n write r1 0", "val is_null\n (#t: typ)\n (p: npointer t)\n: HST.Stack bool\n (requires (fun h -> nlive h p))\n (ensures (fun h b h' -> h' == h /\\ b == g_is_null p))\nlet is_null\n (#t: typ)\n (p: npointer t)\n= match p with\n | NullPtr -> true\n | _ -> false", "val test0 (b1 b2 b3: ref)\n : STT int\n (((ptr b1) `star` (ptr b2)) `star` (ptr b3))\n (fun _ -> ((ptr b1) `star` (ptr b2)) `star` (ptr b3))\nlet test0 (b1 b2 b3: ref) : STT int\n (ptr b1 `star` ptr b2 `star` ptr b3)\n (fun _ -> ptr b1 `star` ptr b2 `star` ptr b3)\n =\n let x = read b1 in\n x", "val closed_ty (t: src_ty) : b: bool{b <==> ((freevars_ty t) `Set.equal` Set.empty)}\nlet rec closed (s:src_exp) \n : b:bool { b <==> (freevars s `Set.equal` Set.empty) }\n = match s with\n | EBool _\n | EBVar _ -> true\n | EVar m -> assert (m `Set.mem` freevars s); false\n | EIf b e1 e2 -> closed b && closed e1 && closed e2\n | ELam t e -> closed_ty t && closed e\n | EApp e1 e2 -> closed e1 && closed e2\n\nand closed_ty (t:src_ty)\n : b:bool { b <==> (freevars_ty t `Set.equal` Set.empty) }\n = match t with\n | TBool -> true\n | TRefineBool e -> closed e\n | TArrow t1 t2 -> closed_ty t1 && closed_ty t2", "val test_if9 (b: bool) (r1 r2: ref)\n : STT unit ((ptr r1) `star` (ptr r2)) (fun _ -> (ptr r1) `star` (ptr r2))\nlet test_if9 (b:bool) (r1 r2: ref) : STT unit\n (ptr r1 `star` ptr r2)\n (fun _ -> ptr r1 `star` ptr r2)\n = write r1 0;\n if b then (write r1 0) else (write r2 0);\n write r2 0;\n if b then (write r1 0) else (write r2 0);\n write r1 0", "val read_ref (#a:Type0) (r:R.ref (vec a))\n (i:SZ.t)\n (#v:erased (vec a))\n (#s:erased (Seq.seq a) { SZ.v i < Seq.length s})\n : stt a\n (requires R.pts_to r v ** pts_to v s)\n (ensures fun res -> R.pts_to r v ** pts_to v s ** pure (res == Seq.index s (SZ.v i)))\nlet read_ref = read_ref'", "val closed_ty (t: src_ty) : b: bool{b <==> (freevars_ty t) `Set.equal` Set.empty}\nlet rec closed (e:src_exp) \n : b:bool{ b <==> freevars e `Set.equal` Set.empty }\n = match e with\n | EVar v -> \n assert (v `Set.mem` freevars e);\n false\n | EBool _\n | EBVar _ -> true\n | EIf b e1 e2 -> closed b && closed e1 && closed e2\n | ELam t e -> closed_ty t && closed e\n | EApp e1 e2 -> closed e1 && closed e2\nand closed_ty (t:src_ty)\n : b:bool{ b <==> freevars_ty t `Set.equal` Set.empty }\n = match t with\n | TBool -> true\n | TRefineBool e -> closed e\n | TArrow t1 t2 -> closed_ty t1 && closed_ty t2", "val LowStar.ConstBuffer.g_is_null = c: LowStar.ConstBuffer.const_buffer 'a -> Prims.GTot Prims.bool\nlet g_is_null (c:const_buffer 'a) = B.g_is_null (as_mbuf c)", "val g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool\nlet g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool =\n g_array_ptr_is_null (array_ptr_of a)", "val g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool\nlet g_array_is_null (#t: Type) (#td: typedef t) (a: array_or_null td) : GTot bool =\n g_array_ptr_is_null (array_ptr_of a)", "val read (#a: Type0) (r: ref a)\n : Steel a\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\nlet read (#a:Type0) (r:ref a) : Steel a\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\n= readp r full_perm", "val read (#a: Type0) (r: ref a)\n : Steel a\n (vptr r)\n (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\nlet read (#a:Type0) (r:ref a) : Steel a\n (vptr r) (fun _ -> vptr r)\n (requires fun _ -> True)\n (ensures fun h0 x h1 -> sel r h0 == sel r h1 /\\ x == sel r h1)\n= readp r full_perm", "val is_nil' (#opened: _) (#a: Type0) (ptr: t a)\n : SteelGhost unit\n opened\n (llist ptr)\n (fun _ -> llist ptr)\n (requires fun _ -> True)\n (ensures\n fun h0 _ h1 ->\n let res = is_null ptr in\n (res == true <==> ptr == null_llist #a) /\\ v_llist ptr h0 == v_llist ptr h1 /\\\n res == Nil? (v_llist ptr h1))\nlet is_nil' (#opened: _) (#a:Type0) (ptr:t a)\n : SteelGhost unit opened (llist ptr) (fun _ -> llist ptr)\n (requires fun _ -> True)\n (ensures fun h0 _ h1 ->\n let res = is_null ptr in\n (res == true <==> ptr == null_llist #a) /\\\n v_llist ptr h0 == v_llist ptr h1 /\\\n res == Nil? (v_llist ptr h1))\n=\n let res = is_null ptr in\n llist0_of_llist ptr;\n if res\n then begin\n change_equal_slprop\n (llist0 ptr)\n (emp `vrewrite` v_null_rewrite a);\n elim_vrewrite emp (v_null_rewrite a);\n intro_vrewrite emp (v_null_rewrite a);\n change_equal_slprop\n (emp `vrewrite` v_null_rewrite a)\n (llist0 ptr)\n end else begin\n change_equal_slprop\n (llist0 ptr)\n ((vptr ptr `vdep` llist_vdep ptr) `vrewrite` llist_vrewrite ptr);\n elim_vrewrite (vptr ptr `vdep` llist_vdep ptr) (llist_vrewrite ptr);\n intro_vrewrite (vptr ptr `vdep` llist_vdep ptr) (llist_vrewrite ptr);\n change_equal_slprop\n ((vptr ptr `vdep` llist_vdep ptr) `vrewrite` llist_vrewrite ptr)\n (llist0 ptr)\n end;\n llist_of_llist0 ptr" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.core_ref_is_null" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.core_ref_is_null" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.core_ref_is_null" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.is_null" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.is_null" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.is_null" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.is_null" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.is_null" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.core_ref_null" }, { "project_name": "steel", "file_name": "Steel.Heap.fst", "name": "Steel.Heap.core_ref_null" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fst", "name": "PulseCore.Heap.core_ref_null" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.is_ref_null" }, { "project_name": "steel", "file_name": "Selectors.Tree.Core.fst", "name": "Selectors.Tree.Core.is_null_t" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.is_pcm_ref_null" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.is_null" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.is_null" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.is_null" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.is_null" }, { "project_name": "steel", "file_name": "SelectorsLList3Example.fst", "name": "SelectorsLList3Example.is_null" }, { "project_name": "steel", "file_name": "SelectorsLList2Example.fst", "name": "SelectorsLList2Example.is_null" }, { "project_name": "steel", "file_name": "Steel.Memory.fsti", "name": "Steel.Memory.is_null" }, { "project_name": "steel", "file_name": "PulseCore.Heap.fsti", "name": "PulseCore.Heap.is_null" }, { "project_name": "steel", "file_name": "Steel.Heap.fsti", "name": "Steel.Heap.is_null" }, { "project_name": "steel", "file_name": "PulseCore.Memory.fsti", "name": "PulseCore.Memory.is_null" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.g_is_null" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.mnull" }, { "project_name": "steel", "file_name": "Steel.Memory.fst", "name": "Steel.Memory.core_ref" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.is_null_ptr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.is_null" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.is_null_ptr" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.is_null_ptr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.live_is_null" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_is_null" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fsti", "name": "Steel.ArrayRef.vptr_not_null" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.vptr_not_null" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.g_is_null" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.g_is_null" }, { "project_name": "steel", "file_name": "ExtractRefs.fst", "name": "ExtractRefs.copy_ref" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.is_nil" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.is_nil" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fsti", "name": "Steel.ST.Array.is_null" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if8" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if8" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.is_null" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.is_null" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.g_is_null" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.null" }, { "project_name": "steel", "file_name": "SelectorsLList2Example.fst", "name": "SelectorsLList2Example.is_nil" }, { "project_name": "steel", "file_name": "SelectorsLList3Example.fst", "name": "SelectorsLList3Example.is_nil" }, { "project_name": "steel", "file_name": "Selectors.LList.fst", "name": "Selectors.LList.cons_is_not_null" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Types.fst", "name": "Impl.Noise.Types.is_null" }, { "project_name": "FStar", "file_name": "FStar.Fin.fst", "name": "FStar.Fin.is_reflexive" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.null" }, { "project_name": "steel", "file_name": "References.fst", "name": "References.copy_ref" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.null" }, { "project_name": "zeta", "file_name": "Zeta.Steel.KeyUtils.fst", "name": "Zeta.Steel.KeyUtils.good_raw_key_impl" }, { "project_name": "steel", "file_name": "CQueue.Cell.fst", "name": "CQueue.Cell.ccell_ptrvalue_is_null" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.null" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.null" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.op_Bang" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.op_Bang" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if7" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if7" }, { "project_name": "FStar", "file_name": "Setoids.fst", "name": "Setoids.refl" }, { "project_name": "FStar", "file_name": "ImmutableSTwHeaps.fst", "name": "ImmutableSTwHeaps.read" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test1" }, { "project_name": "steel", "file_name": "Selectors.PtrLList.fst", "name": "Selectors.PtrLList.cons_is_not_null" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test0" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if10" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD_GCM.fst", "name": "MiTLS.AEAD_GCM.log_ref" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.ref_null" }, { "project_name": "steel", "file_name": "CQueue.LList.fst", "name": "CQueue.LList.cllist_ptrvalue_is_null" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if10" }, { "project_name": "hacl-star", "file_name": "Vale.Arch.TypesNative.fsti", "name": "Vale.Arch.TypesNative.not" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if2" }, { "project_name": "FStar", "file_name": "AllocST.fst", "name": "AllocST.read" }, { "project_name": "steel", "file_name": "Selectors.Examples.fst", "name": "Selectors.Examples.test2" }, { "project_name": "FStar", "file_name": "AllocSTwHeaps.fst", "name": "AllocSTwHeaps.read" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.closed" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.vptrp_not_null" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.vptrp_not_null" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if3" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if2" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.closed" }, { "project_name": "everparse", "file_name": "Options.fst", "name": "Options.debug" }, { "project_name": "steel", "file_name": "Steel.SpinLock.fst", "name": "Steel.SpinLock.lockinv" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if3" }, { "project_name": "steel", "file_name": "SteelFramingTestSuite.fst", "name": "SteelFramingTestSuite.test_if9" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.is_null" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test0" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.closed_ty" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_if9" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.read_ref" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.closed_ty" }, { "project_name": "FStar", "file_name": "LowStar.ConstBuffer.fsti", "name": "LowStar.ConstBuffer.g_is_null" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.g_array_is_null" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.g_array_is_null" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.read" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fsti", "name": "Steel.ArrayRef.read" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.is_nil'" } ], "selected_premises": [ "PulseCore.Memory.core_ref", "PulseCore.Memory.core_mem", "PulseCore.Preorder.pcm_history", "PulseCore.Preorder.history_val", "PulseCore.Memory.core_ref_null", "PulseCore.Memory.interp", "PulseCore.Heap.full_heap", "PulseCore.Heap.full_hheap", "FStar.Real.one", "FStar.PCM.compatible", "PulseCore.Memory.slprop", "FStar.PCM.composable", "PulseCore.Memory.join", "PulseCore.FractionalPermission.full_perm", "FStar.FunctionalExtensionality.feq", "FStar.PCM.op", "PulseCore.Heap.hheap", "PulseCore.Memory.slprop_extensionality", "FStar.Real.two", "PulseCore.Preorder.p_op", "PulseCore.Heap.pure", "PulseCore.Memory.equiv", "PulseCore.FractionalPermission.sum_perm", "PulseCore.Memory.lock_store", "PulseCore.FractionalPermission.comp_perm", "PulseCore.Memory.disjoint", "PulseCore.Preorder.vhist", "PulseCore.Preorder.induces_preorder", "FStar.FunctionalExtensionality.on_dom", "PulseCore.Preorder.comm_op", "PulseCore.Preorder.history_compose", "PulseCore.Heap.stronger", "PulseCore.Heap.a_heap_prop", "PulseCore.Heap.equiv", "PulseCore.Preorder.history_composable", "PulseCore.Preorder.curval", "PulseCore.Heap.action_related_heaps", "PulseCore.Preorder.extends", "PulseCore.Heap.ptr", "PulseCore.Preorder.p_composable", "PulseCore.Preorder.preorder_of_pcm", "PulseCore.Preorder.extends'", "PulseCore.Heap.action_with_frame", "PulseCore.Preorder.hval", "PulseCore.FractionalPermission.writeable", "PulseCore.Memory.join_associative", "FStar.Pervasives.Native.fst", "PulseCore.Memory.disjoint_join", "FStar.Pervasives.Native.snd", "PulseCore.Memory.join_commutative", "PulseCore.Heap.pre_action", "FStar.Pervasives.reveal_opaque", "FStar.Real.zero", "PulseCore.Preorder.unit_history", "FStar.MSTTotal.return", "PulseCore.Preorder.p", "PulseCore.Heap.witnessed_ref", "PulseCore.Preorder.lift_fact", "PulseCore.Preorder.pcm_of_preorder", "PulseCore.Preorder.property", "PulseCore.Heap.hprop", "PulseCore.Preorder.pcm_history_preorder", "PulseCore.Heap.heap_prop_is_affine", "PulseCore.Heap.frame_related_heaps", "PulseCore.Preorder.hperm", "PulseCore.Heap.ref", "FStar.Preorder.preorder_rel", "PulseCore.Heap.is_frame_preserving", "PulseCore.Preorder.hist", "PulseCore.Preorder.lem_is_unit", "PulseCore.Preorder.fact_valid_compat", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.Preorder.hval_tot", "PulseCore.Preorder.flip", "PulseCore.Preorder.qhistory", "FStar.MSTTotal.bind", "PulseCore.Heap.is_witness_invariant", "PulseCore.Heap.action", "PulseCore.Preorder.extend_history'", "FStar.MSTTotal.get", "PulseCore.Preorder.extend_history", "PulseCore.FractionalPermission.half_perm", "PulseCore.Preorder.extends_length_eq", "FStar.FunctionalExtensionality.on", "PulseCore.Preorder.stable_property", "FStar.Witnessed.Core.s_predicate", "PulseCore.Preorder.lift_fact_is_stable", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Pervasives.dfst", "PulseCore.Preorder.pcm_history_induces_preorder", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "PulseCore.Heap.null", "FStar.Pervasives.dsnd", "FStar.MSTTotal.put", "FStar.Preorder.stable", "PulseCore.Heap.is_frame_monotonic", "FStar.PCM.frame_compatible", "FStar.MSTTotal.subcomp", "FStar.Preorder.reflexive", "PulseCore.Preorder.stable_compatiblity" ], "source_upto_this": "(*\n Copyright 2020 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule PulseCore.Memory\nopen FStar.Ghost\nopen FStar.PCM\nmodule M_ = PulseCore.NondeterministicMonotonicStateMonad\nmodule F = FStar.FunctionalExtensionality\nopen FStar.FunctionalExtensionality\nmodule H = PulseCore.Heap\nmodule PP = PulseCore.Preorder\n\n\nnoeq\ntype lock_state : Type u#(a + 1) =\n | Invariant : inv:H.slprop u#a -> lock_state\n\nlet lock_store : Type u#(a+1) = list (lock_state u#a)\n\nnoeq\ntype mem : Type u#(a + 1) =\n {\n ctr: nat;\n heap: H.heap u#a;\n locks: lock_store u#a;\n }\n\nlet heap_of_mem (x:mem) : H.heap = x.heap\n\nlet mem_of_heap (h:H.heap) : mem = {\n ctr = 0;\n heap = h;\n locks = []\n}\n\nlet mem_set_heap (m:mem) (h:H.heap) : mem = {\n ctr = m.ctr;\n heap = h;\n locks = m.locks;\n}\n\nlet core_mem (m:mem) : mem = mem_of_heap (heap_of_mem m)\n\nval core_mem_invol (m: mem u#a) : Lemma\n (core_mem (core_mem m) == core_mem m)\n [SMTPat (core_mem (core_mem m))]\nlet core_mem_invol m = ()\n\n(** A predicate describing non-overlapping memories. Based on [Steel.Heap.disjoint] *)\nlet disjoint (m0 m1:mem u#h)\n : prop\n = m0.ctr == m1.ctr /\\\n H.disjoint m0.heap m1.heap /\\\n m0.locks == m1.locks\n\n(** Disjointness is symmetric *)\nlet disjoint_sym (m0 m1:mem u#h)\n : Lemma (disjoint m0 m1 <==> disjoint m1 m0)\n [SMTPat (disjoint m0 m1)]\n = ()\n\n(** Disjoint memories can be combined. Based on [Steel.Heap.join] *)\nlet join (m0:mem u#h) (m1:mem u#h{disjoint m0 m1}) : mem u#h\n= {\n ctr = m0.ctr;\n heap = H.join m0.heap m1.heap;\n locks = m0.locks\n }\n\n(** Join is commutative *)\nlet join_commutative (m0 m1:mem)\n : Lemma\n (requires\n disjoint m0 m1)\n (ensures\n (disjoint m0 m1 /\\\n disjoint m1 m0 /\\\n join m0 m1 == join m1 m0))\n = H.join_commutative m0.heap m1.heap\n\n(** Disjointness distributes over join *)\nlet disjoint_join (m0 m1 m2:mem)\n : Lemma (disjoint m1 m2 /\\\n disjoint m0 (join m1 m2) ==>\n disjoint m0 m1 /\\\n disjoint m0 m2 /\\\n disjoint (join m0 m1) m2 /\\\n disjoint (join m0 m2) m1)\n = H.disjoint_join m0.heap m1.heap m2.heap\n\n(** Join is associative *)\nlet join_associative (m0 m1 m2:mem)\n : Lemma\n (requires\n disjoint m1 m2 /\\\n disjoint m0 (join m1 m2))\n (ensures\n (disjoint_join m0 m1 m2;\n join m0 (join m1 m2) == join (join m0 m1) m2))\n = H.join_associative m0.heap m1.heap m2.heap\n\nlet slprop = H.slprop\n\nlet interp p m = H.interp p m.heap\n\nlet equiv p1 p2 = forall m. interp p1 m <==> interp p2 m\n\n\nlet slprop_extensionality p q =\n assert (forall m. interp p m <==> interp q m);\n let aux (h:H.heap)\n : Lemma (H.interp p h <==> H.interp q h)\n [SMTPat (H.interp p h)]\n = let m : mem = { ctr = 0; heap = h; locks = [] } in\n assert (interp p m <==> interp q m)\n in\n assert (forall h. H.interp p h <==> H.interp q h);\n H.slprop_extensionality p q\n\nval reveal_equiv (p1 p2:slprop u#a) : Lemma\n (ensures (forall m. interp p1 m <==> interp p2 m) <==> p1 `equiv` p2)\n [SMTPat (p1 `equiv` p2)]\nlet reveal_equiv p1 p2 = ()\n\nlet slprop_equiv_refl p = ()\n\nlet core_ref = H.core_ref\nlet core_ref_null = H.core_ref_null", "sketch": [ "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns a boolean indicating whether they are equal.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns true if they are equal, and false otherwise.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns a boolean indicating whether they are equal.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns the result as a boolean.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns the result as a boolean.", "The implementation of `core_ref_is_null` simply compares the input `core_ref` with `core_ref_null` and returns a boolean indicating whether they are equal.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns the result as a boolean.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns the result as a boolean.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns the result as a boolean.", "The implementation of `core_ref_is_null` simply compares the given `core_ref` with `core_ref_null` and returns a boolean indicating whether they are equal." ], "generated_solution": [ "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null", "let core_ref_is_null (r:core_ref) : b:bool = r == core_ref_null" ] }, { "file_name": "Vale.Math.Poly2.Lemmas.fst", "name": "Vale.Math.Poly2.Lemmas.lemma_mul_distribute_right", "opens_and_abbrevs": [ { "open": "FStar.Mul" }, { "abbrev": "List", "full_module": "FStar.List.Tot" }, { "open": "FStar.Seq" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2_s" }, { "open": "FStar.Mul" }, { "open": "Vale.Math.Poly2" }, { "open": "Vale.Math.Poly2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val lemma_mul_distribute_right (a b c:poly) : Lemma (a *. (b +. c) == (a *. b) +. (a *. c))", "source_definition": "let lemma_mul_distribute_right a b c = lemma_mul_distribute a b c", "source_range": { "start_line": 240, "start_col": 0, "end_line": 240, "end_col": 65 }, "interleaved": false, "definition": "fun a b c -> Vale.Math.Poly2.lemma_mul_distribute a b c", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Vale.Math.Poly2_s.poly", "Vale.Math.Poly2.lemma_mul_distribute", "Prims.unit" ], "proof_features": [], "is_simple_lemma": true, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "a: Vale.Math.Poly2_s.poly -> b: Vale.Math.Poly2_s.poly -> c: Vale.Math.Poly2_s.poly\n -> FStar.Pervasives.Lemma (ensures a *. (b +. c) == a *. b +. a *. c)", "prompt": "let lemma_mul_distribute_right a b c =\n ", "expected_response": "lemma_mul_distribute a b c", "source": { "project_name": "hacl-star", "file_name": "vale/code/lib/math/Vale.Math.Poly2.Lemmas.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.Math.Poly2.Lemmas.fst", "checked_file": "dataset/Vale.Math.Poly2.Lemmas.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Math.Lib.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let lemma_pointwise_equal a b pf =\n FStar.Classical.forall_intro pf;\n lemma_equal a b", "let lemma_index a =\n FStar.Classical.forall_intro (lemma_index_i a)", "val lemma_pointwise_equal (a b:poly) (pf:(i:int -> Lemma (a.[i] == b.[i]))) : Lemma\n (a == b)", "let lemma_index_all () =\n FStar.Classical.forall_intro_2 lemma_index_i", "val lemma_index (a:poly) : Lemma (forall (i:int).{:pattern a.[i]} a.[i] ==> 0 <= i /\\ i <= degree a)", "val lemma_index_all (_:unit) : Lemma\n (forall (a:poly) (i:int).{:pattern a.[i]} a.[i] ==> 0 <= i /\\ i <= degree a)", "let lemma_zero_define () =\n FStar.Classical.forall_intro lemma_zero_define_i", "val lemma_zero_define (_:unit) : Lemma (forall (i:int).{:pattern zero.[i]} not zero.[i])", "let lemma_one_define () =\n FStar.Classical.forall_intro lemma_one_define_i", "val lemma_one_define (_:unit) : Lemma (forall (i:int).{:pattern one.[i]} one.[i] == (i = 0))", "val lemma_monomial_define (n:nat) : Lemma\n (forall (i:int).{:pattern (monomial n).[i]} (monomial n).[i] == (i = n))", "let lemma_monomial_define n =\n FStar.Classical.forall_intro (lemma_monomial_define_i n)", "val lemma_monomial_define_all (_:unit) : Lemma\n (forall (n:nat) (i:int).{:pattern (monomial n).[i]} (monomial n).[i] == (i = n))", "let lemma_monomial_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> monomial n) lemma_monomial_define", "val lemma_ones_define (n:nat) : Lemma\n (forall (i:int).{:pattern (ones n).[i]} (ones n).[i] == (0 <= i && i < n))", "val lemma_ones_define_all (_:unit) : Lemma\n (forall (n:nat) (i:int).{:pattern (ones n).[i]} (ones n).[i] == (0 <= i && i < n))", "let lemma_ones_define n =\n FStar.Classical.forall_intro (lemma_ones_define_i n)", "val lemma_shift_define (p:poly) (n:int) : Lemma\n (forall (i:int).{:pattern (shift p n).[i]} (shift p n).[i] == (p.[i - n] && i >= 0))", "let lemma_ones_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> ones n) lemma_ones_define", "val lemma_shift_define_forward (p:poly) (n:int) : Lemma\n (forall (i:int).{:pattern p.[i]} (shift p n).[i + n] == (p.[i] && i + n >= 0))", "val lemma_shift_define_all (_:unit) : Lemma\n (forall (p:poly) (n:int) (i:int).{:pattern (shift p n).[i]} (shift p n).[i] == (p.[i - n] && i >= 0))", "let lemma_shift_define p n =\n FStar.Classical.forall_intro (lemma_shift_define_i p n)", "val lemma_and_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]} (poly_and a b).[i] == (a.[i] && b.[i]))", "let lemma_shift_define_forward p n =\n lemma_shift_define p n", "val lemma_and_define_all (_:unit) : Lemma\n (forall (a b:poly).{:pattern (poly_and a b)}\n forall (i:int).{:pattern (poly_and a b).[i] \\/ a.[i] \\/ b.[i]} (poly_and a b).[i] == (a.[i] && b.[i]))", "let lemma_shift_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> shift p n) lemma_shift_define", "val lemma_or_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (poly_or a b).[i] \\/ a.[i] \\/ b.[i]} (poly_or a b).[i] == (a.[i] || b.[i]))", "val lemma_or_define_all (_:unit) : Lemma\n (forall (a b:poly).{:pattern (poly_or a b)}\n forall (i:int).{:pattern (poly_or a b).[i] \\/ a.[i] \\/ b.[i]} (poly_or a b).[i] == (a.[i] || b.[i]))", "let lemma_and_define a b =\n FStar.Classical.forall_intro (lemma_and_define_i a b)", "val lemma_mask_define (p:poly) (n:nat) : Lemma\n (forall (i:int).{:pattern p.[i] \\/ (mask p n).[i]} (mask p n).[i] == (p.[i] && i < n))", "let lemma_and_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> poly_and a b) lemma_and_define", "val lemma_mask_define_all (_:unit) : Lemma\n (forall (p:poly) (n:nat) (i:int).{:pattern (mask p n).[i]} (mask p n).[i] == (p.[i] && i < n))", "let lemma_or_define a b =\n FStar.Classical.forall_intro (lemma_or_define_i a b)", "val lemma_reverse_define (a:poly) (n:nat) : Lemma\n (forall (i:int).{:pattern (reverse a n).[i]} (reverse a n).[i] == (a.[n - i] && i >= 0))", "val lemma_reverse_define_all (_:unit) : Lemma\n (forall (a:poly) (n:nat).{:pattern (reverse a n)}\n (forall (i:int).{:pattern (reverse a n).[i]} (reverse a n).[i] == (a.[n - i] && i >= 0)))", "let lemma_or_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> poly_or a b) lemma_or_define", "let lemma_mask_define p n =\n FStar.Classical.forall_intro (lemma_mask_define_i p n);\n ()", "val lemma_degree_negative (a:poly) : Lemma (requires degree a < 0) (ensures a == zero)", "val lemma_degree_is (a:poly) (n:int) : Lemma\n (requires (n >= 0 ==> a.[n]) /\\ (forall (i:int).{:pattern a.[i]} i > n ==> not a.[i]))\n (ensures degree a == (if n < 0 then -1 else n))", "let lemma_mask_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> mask p n) lemma_mask_define", "val lemma_zero_degree : (_:unit{degree zero == -1})", "let lemma_reverse_define p n =\n FStar.Classical.forall_intro (lemma_reverse_define_i p n)", "val lemma_one_degree : (_:unit{degree one == 0})", "val lemma_monomial_degree (n:nat) : Lemma\n (degree (monomial n) == n)\n [SMTPat (degree (monomial n))]", "let lemma_reverse_define_all () =\n FStar.Classical.forall_intro_2 lemma_reverse_define", "let lemma_degree_negative a =\n let f (i:int) : Lemma (not a.[i]) =\n lemma_index_i a i\n in\n FStar.Classical.forall_intro f;\n lemma_zero_define ();\n lemma_equal a zero", "val lemma_ones_degree (n:nat) : Lemma\n (degree (ones n) == n - 1)\n [SMTPat (degree (ones n))]", "val lemma_shift_degree (a:poly) (n:int) : Lemma\n (degree (shift a n) == (if degree a < 0 || degree a + n < 0 then -1 else degree a + n))\n [SMTPat (degree (shift a n))]", "let lemma_degree_is a n =\n lemma_index a;\n lemma_index_i a n;\n lemma_degree a", "val lemma_and_degree (a b:poly) : Lemma\n (degree (poly_and a b) <= degree a /\\ degree (poly_and a b) <= degree b)\n [SMTPat (degree (poly_and a b))]", "val lemma_or_degree (a b:poly) : Lemma\n (ensures (\n let d = degree (poly_or a b) in\n d >= degree a /\\\n d >= degree b /\\\n (d == degree a \\/ d == degree b)\n ))\n [SMTPat (degree (poly_or a b))]", "let lemma_zero_degree =\n lemma_degree zero;\n lemma_zero_define ()", "let lemma_one_degree =\n lemma_one_define ();\n lemma_degree_is one 0", "let lemma_monomial_degree n =\n lemma_monomial_define n;\n lemma_degree_is (monomial n) n", "val lemma_mask_degree (a:poly) (n:nat) : Lemma\n (degree (mask a n) < n)\n [SMTPat (degree (mask a n))]", "let lemma_ones_degree n =\n lemma_ones_define n;\n lemma_degree_is (ones n) (n - 1)", "val lemma_reverse_degree (a:poly) (n:nat) : Lemma\n (degree (reverse a n) <= n)\n [SMTPat (degree (reverse a n))]", "let lemma_shift_degree a n =\n lemma_index a;\n lemma_degree a;\n lemma_shift_define a n;\n lemma_zero_define ();\n if degree a < 0 || degree a + n < 0 then\n (\n lemma_equal zero (shift a n);\n lemma_degree_negative (shift a n)\n )\n else\n lemma_degree_is (shift a n) (degree a + n)", "val lemma_of_list_degree (l:list bool) : Lemma\n (requires (\n let len = List.length l in\n len == 0 \\/ normalize (b2t (List.index l (len - 1)))\n ))\n (ensures (\n let len = normalize_term (List.length l) in\n let a = of_seq (seq_of_list l) in\n degree a == len - 1 /\\\n (forall (i:int).{:pattern a.[i]} a.[i] ==> (0 <= i && i < len))\n ))", "val lemma_add_define (a b:poly) : Lemma\n (forall (i:int).{:pattern (a +. b).[i] \\/ a.[i] \\/ b.[i]} (a +. b).[i] == (a.[i] <> b.[i]))", "let lemma_and_degree a b =\n lemma_and_define a b;\n lemma_index_all ();\n lemma_degree a;\n lemma_degree b;\n lemma_degree (poly_and a b)", "val lemma_add_define_all (_:unit) : Lemma\n (forall (a b:poly).{:pattern (a +. b)}\n (forall (i:int).{:pattern (a +. b).[i] \\/ a.[i] \\/ b.[i]} (a +. b).[i] == (a.[i] <> b.[i])))", "val lemma_add_zero_right (a:poly) : Lemma ((a +. zero) == a)", "let lemma_or_degree a b =\n lemma_or_define a b;\n lemma_index_all ();\n lemma_degree a;\n lemma_degree b;\n lemma_degree_is (poly_or a b) (FStar.Math.Lib.max (degree a) (degree b))", "val lemma_add_zero_left (a:poly) : Lemma ((zero +. a) == a)", "val lemma_add_all (_:unit) : Lemma\n (ensures\n (forall (a:poly).{:pattern (a +. zero)} (a +. zero) == a) /\\\n (forall (a:poly).{:pattern (a +. a)} (a +. a) == zero) /\\\n (forall (a b:poly).{:pattern (a +. b)} a +. b == b +. a) /\\\n (forall (a b c:poly).{:pattern (a +. (b +. c)) \\/ ((a +. b) +. c)} a +. (b +. c) == (a +. b) +. c)\n )", "let lemma_mask_degree a n =\n lemma_mask_define a n;\n lemma_degree (mask a n)", "val lemma_bitwise_all (_:unit) : Lemma\n (ensures\n (forall (a:poly) (i:int).{:pattern a.[i]} a.[i] ==> 0 <= i /\\ i <= degree a) /\\\n (forall (i:int).{:pattern zero.[i]} not zero.[i]) /\\\n (forall (i:int).{:pattern one.[i]} one.[i] == (i = 0)) /\\\n (forall (n:nat) (i:int).{:pattern (monomial n).[i]} (monomial n).[i] == (i = n)) /\\\n (forall (n:nat) (i:int).{:pattern (ones n).[i]} (ones n).[i] == (0 <= i && i < n)) /\\\n (forall (p:poly) (n:int) (i:int).{:pattern (shift p n).[i]} (shift p n).[i] == (p.[i - n] && i >= 0)) /\\\n (forall (a b:poly) (i:int).{:pattern (poly_and a b).[i]} (poly_and a b).[i] == (a.[i] && b.[i])) /\\\n (forall (a b:poly) (i:int).{:pattern (poly_or a b).[i]} (poly_or a b).[i] == (a.[i] || b.[i])) /\\\n (forall (p:poly) (n:nat) (i:int).{:pattern (mask p n).[i]} (mask p n).[i] == (p.[i] && i < n)) /\\\n (forall (a:poly) (n:nat) (i:int).{:pattern (reverse a n).[i]} (reverse a n).[i] == (a.[n - i] && i >= 0)) /\\\n (forall (a b:poly) (i:int).{:pattern (a +. b).[i]} (a +. b).[i] == (a.[i] <> b.[i]))\n )", "let lemma_reverse_degree a n =\n lemma_index a;\n lemma_reverse_define a n;\n lemma_degree (reverse a n)", "let lemma_of_list_degree l =\n let len = List.length l in\n let s = seq_of_list l in\n let a = of_seq s in\n assert (forall (i:nat).{:pattern (index s i)} i < len ==> index s i == List.index l i);\n lemma_index a;\n lemma_degree a;\n lemma_zero_define ();\n if len > 0 then\n lemma_degree_is a (len - 1)\n else\n assert (not a.[degree a])", "val lemma_monomial_add_degree (n:nat) (a:poly) : Lemma\n (requires degree a < n)\n (ensures degree (monomial n +. a) == n /\\ degree (a +. monomial n) == n)", "let lemma_add_define a b =\n FStar.Classical.forall_intro (lemma_add_define_i a b)", "val lemma_and_zero (a:poly) : Lemma\n (poly_and a zero == zero /\\ poly_and zero a == zero)", "let lemma_add_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> (a +. b)) lemma_add_define", "val lemma_and_ones (a:poly) (n:nat) : Lemma\n (requires degree a < n)\n (ensures poly_and a (ones n) == a /\\ poly_and (ones n) a == a)", "let lemma_add_zero_right = lemma_add_zero", "let lemma_add_zero_left a = lemma_add_zero a; lemma_add_commute a zero", "val lemma_and_consts (_:unit) : Lemma\n (ensures\n (forall (a:poly).{:pattern (poly_and a zero)} poly_and a zero == zero) /\\\n (forall (a:poly).{:pattern (poly_and zero a)} poly_and zero a == zero) /\\\n (forall (a:poly) (n:nat).{:pattern (poly_and a (ones n))} degree a < n ==> poly_and a (ones n) == a) /\\\n (forall (a:poly) (n:nat).{:pattern (poly_and (ones n) a)} degree a < n ==> poly_and (ones n) a == a)\n )", "let lemma_add_all () =\n FStar.Classical.forall_intro_with_pat (fun a -> a +. zero) lemma_add_zero;\n FStar.Classical.forall_intro_with_pat (fun a -> a +. a) lemma_add_cancel;\n FStar.Classical.forall_intro_2_with_pat (fun a b -> a +. b) lemma_add_commute;\n FStar.Classical.forall_intro_3_with_pat (fun a b c -> a +. (b +. c)) lemma_add_associate", "let lemma_bitwise_all () =\n lemma_index_all ();\n lemma_zero_define ();\n lemma_one_define ();\n lemma_monomial_define_all ();\n lemma_ones_define_all ();\n lemma_shift_define_all ();\n lemma_and_define_all ();\n lemma_or_define_all ();\n lemma_mask_define_all ();\n lemma_reverse_define_all ();\n lemma_add_define_all ();\n ()", "val lemma_or_zero (a:poly) : Lemma\n (poly_or a zero == a /\\ poly_or zero a == a)", "val lemma_or_ones (a:poly) (n:nat) : Lemma\n (requires degree a < n)\n (ensures poly_or a (ones n) == ones n /\\ poly_or (ones n) a == ones n)", "val lemma_or_consts (_:unit) : Lemma\n (ensures\n (forall (a:poly).{:pattern (poly_or a zero)} poly_or a zero == a) /\\\n (forall (a:poly).{:pattern (poly_or zero a)} poly_or zero a == a) /\\\n (forall (a:poly) (n:nat).{:pattern (poly_or a (ones n))} degree a < n ==> poly_or a (ones n) == ones n) /\\\n (forall (a:poly) (n:nat).{:pattern (poly_or (ones n) a)} degree a < n ==> poly_or (ones n) a == ones n)\n )", "let lemma_monomial_add_degree n a =\n lemma_bitwise_all ();\n lemma_degree_is (monomial n +. a) n;\n lemma_degree_is (a +. monomial n) n;\n ()", "val lemma_mul_distribute_left (a b c:poly) : Lemma ((a +. b) *. c == (a *. c) +. (b *. c))", "val lemma_mul_distribute_right (a b c:poly) : Lemma (a *. (b +. c) == (a *. b) +. (a *. c))", "val lemma_mul_smaller_is_zero (a b:poly) : Lemma\n (requires degree b > degree (a *. b))\n (ensures a == zero /\\ a *. b == zero)", "let lemma_and_zero a =\n lemma_bitwise_all ();\n lemma_equal (poly_and a zero) zero;\n lemma_equal (poly_and zero a) zero;\n ()", "val lemma_mul_monomials (m n:nat) : Lemma\n (monomial (m + n) == monomial m *. monomial n)", "val lemma_add_reverse (a b:poly) (n:nat) : Lemma\n (reverse (a +. b) n == reverse a n +. reverse b n)", "let lemma_and_ones a n =\n lemma_bitwise_all ();\n lemma_equal (poly_and a (ones n)) a;\n lemma_equal (poly_and (ones n) a) a;\n ()", "val lemma_mul_reverse_shift_1 (a b:poly) (n:nat) : Lemma\n (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n + 1) == shift (reverse a n *. reverse b n) 1)", "let lemma_and_ones_smt (a:poly) (n:nat) : Lemma\n (requires degree a < n)\n (ensures poly_and a (ones n) == a /\\ poly_and (ones n) a == a)\n [SMTPat (poly_and a (ones n)); SMTPat (poly_and (ones n) a)]\n =\n lemma_and_ones a n", "val lemma_shift_is_mul_right (a:poly) (n:nat) : Lemma (shift a n == a *. monomial n)", "val lemma_shift_is_mul_left (a:poly) (n:nat) : Lemma (shift a n == monomial n *. a)", "val lemma_shift_shift (a:poly) (m n:int) : Lemma\n (requires m >= 0 \\/ n <= 0)\n (ensures shift a (m + n) == shift (shift a m) n)", "let lemma_and_consts () =\n let f1 a n : Lemma (degree a < n ==> poly_and a (ones n) == a) =\n if degree a < n then lemma_and_ones a n\n in\n let f2 a n : Lemma (degree a < n ==> poly_and (ones n) a == a) =\n if degree a < n then lemma_and_ones a n\n in\n FStar.Classical.forall_intro lemma_and_zero;\n FStar.Classical.forall_intro_2 f1;\n FStar.Classical.forall_intro_2 f2;\n ()", "val lemma_mul_all (_:unit) : Lemma\n (ensures\n (forall (a:poly).{:pattern (a *. zero)} (a *. zero) == zero) /\\\n (forall (a:poly).{:pattern (a *. one)} (a *. one) == a) /\\\n (forall (a b:poly).{:pattern (a *. b)} a *. b == b *. a) /\\\n (forall (a b c:poly).{:pattern (a *. (b *. c)) \\/ ((a *. b) *. c)} a *. (b *. c) == (a *. b) *. c)\n )", "val lemma_mod_distribute (a b c:poly) : Lemma\n (requires degree c >= 0)\n (ensures (a +. b) %. c == (a %. c) +. (b %. c))", "let lemma_or_zero a =\n lemma_bitwise_all ();\n lemma_equal (poly_or a zero) a;\n lemma_equal (poly_or zero a) a;\n ()", "val lemma_div_mod_unique (a b x y:poly) : Lemma\n (requires\n degree b >= 0 /\\\n degree y < degree b /\\\n a == x *. b +. y\n )\n (ensures\n x == a /. b /\\\n y == a %. b\n )", "let lemma_or_ones a n =\n lemma_bitwise_all ();\n lemma_equal (poly_or a (ones n)) (ones n);\n lemma_equal (poly_or (ones n) a) (ones n);\n ()", "val lemma_div_mod_exact (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures (a *. b) /. b == a /\\ (a *. b) %. b == zero)", "let lemma_or_consts () =\n let f1 a n : Lemma (degree a < n ==> poly_or a (ones n) == (ones n)) =\n if degree a < n then lemma_or_ones a n\n in\n let f2 a n : Lemma (degree a < n ==> poly_or (ones n) a == (ones n)) =\n if degree a < n then lemma_or_ones a n\n in\n FStar.Classical.forall_intro lemma_or_zero;\n FStar.Classical.forall_intro_2 f1;\n FStar.Classical.forall_intro_2 f2;\n ()", "val lemma_mod_small (a b:poly) : Lemma\n (requires degree b >= 0 /\\ degree a < degree b)\n (ensures a %. b == a)", "val lemma_mod_mod (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures (a %. b) %. b == a %. b)", "val lemma_mod_cancel (a:poly) : Lemma\n (requires degree a >= 0)\n (ensures a %. a == zero)", "let lemma_mul_distribute_left a b c =\n lemma_mul_commute (a +. b) c;\n lemma_mul_commute a c;\n lemma_mul_commute b c;\n lemma_mul_distribute c a b" ], "closest": [ "val lemma_mul_distribute (a b c:poly) : Lemma (a *. (b +. c) == (a *. b) +. (a *. c))\nlet lemma_mul_distribute a b c = I.lemma_mul_distribute (to_poly a) (to_poly b) (to_poly c)", "val lemma_mul_distribute_left (a b c: poly) : Lemma ((a +. b) *. c =. (a *. c) +. (b *. c))\nlet lemma_mul_distribute_left (a b c:poly) : Lemma ((a +. b) *. c =. (a *. c) +. (b *. c)) =\n lemma_mul_commute (a +. b) c;\n lemma_mul_commute a c;\n lemma_mul_commute b c;\n lemma_mul_distribute c a b", "val lemma_mul_distribute (a b c: poly) : Lemma (a *. (b +. c) =. (a *. b) +. (a *. c))\nlet lemma_mul_distribute (a b c:poly) : Lemma (a *. (b +. c) =. (a *. b) +. (a *. c)) =\n let f (k:nat) : Lemma\n (ensures mul_element a (b +. c) k == (mul_element a b k <> mul_element a c k))\n =\n lemma_sum_of_pairs 0 (k + 1)\n (mul_element_fun a (b +. c) k)\n (mul_element_fun a b k)\n (mul_element_fun a c k)\n in\n FStar.Classical.forall_intro f", "val lemma_gf128_mul_rev_distribute_right (a b c:poly) : Lemma\n (a *~ (b +. c) == a *~ b +. a *~ c)\nlet lemma_gf128_mul_rev_distribute_right a b c =\n calc (==) {\n a *~ (b +. c);\n == {lemma_gf128_mul_rev_commute a (b +. c)}\n (b +. c) *~ a;\n == {lemma_gf128_mul_rev_distribute_left b c a}\n b *~ a +. c *~ a;\n == {lemma_gf128_mul_rev_commute a b; lemma_gf128_mul_rev_commute a c}\n a *~ b +. a *~ c;\n }", "val lemma_gf128_mul_rev_distribute_left (a b c:poly) : Lemma\n ((a +. b) *~ c == a *~ c +. b *~ c)\nlet lemma_gf128_mul_rev_distribute_left a b c =\n let rev x = reverse x 127 in\n let ra = rev a in\n let rb = rev b in\n let rc = rev c in\n let g = gf128_modulus in\n lemma_gf128_degree ();\n calc (==) {\n (a +. b) *~ c;\n == {}\n rev (rev (a +. b) *. rc %. g);\n == {lemma_add_reverse a b 127}\n rev ((ra +. rb) *. rc %. g);\n == {lemma_mul_distribute_left ra rb rc}\n rev ((ra *. rc +. rb *. rc) %. g);\n == {lemma_mod_distribute (ra *. rc) (rb *. rc) g}\n rev (ra *. rc %. g +. rb *. rc %. g);\n == {lemma_add_reverse (ra *. rc %. g) (rb *. rc %. g) 127}\n rev (ra *. rc %. g) +. rev (rb *. rc %. g);\n == {}\n (a *~ c) +. (b *~ c);\n }", "val lemma_mul_distribute_right (#f:G.field) (a b c:G.felem f) : Lemma\n (fmul a (fadd b c) == fadd (fmul a b) (fmul a c))\nlet lemma_mul_distribute_right #f a b c =\n lemma_mul_distribute_left b c a;\n // fmul (fadd b c) a == fadd (fmul b a) (fmul c a)\n lemma_mul_commute a b;\n lemma_mul_commute a c;\n lemma_mul_commute a (fadd b c);\n ()", "val lemma_mul_associate (a b c:poly) : Lemma (a *. (b *. c) == (a *. b) *. c)\nlet lemma_mul_associate a b c = I.lemma_mul_associate (to_poly a) (to_poly b) (to_poly c)", "val lemma_mul_associate (a b c: poly) : Lemma (a *. (b *. c) =. (a *. b) *. c)\nlet lemma_mul_associate (a b c:poly) : Lemma (a *. (b *. c) =. (a *. b) *. c) =\n let f (k:nat) : Lemma (mul_element a (b *. c) k == mul_element (a *. b) c k) =\n let abc1 (i:int) (j:int) = a.[j] && b.[i - j] && c.[k - i] in\n let abc2 (j:int) (i:int) = a.[j] && b.[i - j] && c.[k - i] in\n let abc3 (j:int) (i:int) = a.[j] && b.[i] && c.[k - j - i] in\n let sum_abc1 (i:int) = sum_of_bools 0 (i + 1) (abc1 i) in\n let sum_abc2 (j:int) = sum_of_bools j (k + 1) (abc2 j) in\n let sum_abc3 (j:int) = sum_of_bools 0 (k + 1 - j) (abc3 j) in\n let l1 (i:int) : Lemma (mul_element_fun (a *. b) c k i == sum_abc1 i) =\n lemma_sum_mul 0 (i + 1) c.[k - i] (abc1 i) (mul_element_fun a b i)\n in\n let l2 (j:int) : Lemma (sum_abc2 j == sum_abc3 j) =\n lemma_sum_shift 0 (k + 1 - j) j (abc3 j) (abc2 j)\n in\n let l3 (j:int) : Lemma (mul_element_fun a (b *. c) k j == sum_abc3 j) =\n lemma_sum_mul 0 (k + 1 - j) a.[j] (abc3 j) (mul_element_fun b c (k - j))\n in\n // mul_element (a *. b) c k\n // sum[0 <= i <= k] (a *. b)[i] * c[k - i]\n // sum[0 <= i <= k] (sum[0 <= j <= i] a[j] * b[i - j]) * c[k - i])\n lemma_sum_pointwise_equal 0 (k + 1) (mul_element_fun (a *. b) c k) sum_abc1 l1;\n // sum[0 <= i <= k] sum[0 <= j <= i] a[j] * b[i - j] * c[k - i]\n lemma_sum_swap_mul_associate (k + 1) abc1 abc2 sum_abc1 sum_abc2;\n // sum[0 <= j <= k] sum[j <= i <= k] a[j] * b[i - j] * c[k - i]\n lemma_sum_pointwise_equal 0 (k + 1) sum_abc2 sum_abc3 l2;\n // sum[0 <= j <= k] sum[0 <= i <= k - j] a[j] * b[i] * c[k - j - i]\n lemma_sum_pointwise_equal 0 (k + 1) (mul_element_fun a (b *. c) k) sum_abc3 l3;\n // sum[0 <= j <= k] a[j] * (sum[0 <= i <= k - j] b[i] * c[k - j - i])\n // sum[0 <= j <= k] (a[j] * (b *. c)[k - j])\n // mul_element a (b *. c) k\n ()\n in\n FStar.Classical.forall_intro f", "val lemma_add_associate (a b c:poly) : Lemma ((a +. (b +. c)) == ((a +. b) +. c))\nlet lemma_add_associate a b c = I.lemma_add_associate (to_poly a) (to_poly b) (to_poly c)", "val lemma_div_distribute (a b c:poly) : Lemma\n (requires degree c >= 0)\n (ensures (a +. b) /. c == (a /. c) +. (b /. c))\nlet lemma_div_distribute a b c =\n let ab = a +. b in\n let a' = a /. c in\n let b' = b /. c in\n let ab' = ab /. c in\n let a'' = a %. c in\n let b'' = b %. c in\n let ab'' = ab %. c in\n lemma_div_mod a c;\n lemma_div_mod b c;\n lemma_div_mod ab c;\n // (a +. b) == (a) +. (b)\n assert ((ab' *. c +. ab'') == (a' *. c +. a'') +. (b' *. c +. b''));\n lemma_add_define_all ();\n lemma_equal (ab' *. c +. a' *. c +. b' *. c) (ab'' +. a'' +. b'');\n lemma_mul_distribute_left ab' a' c;\n lemma_mul_distribute_left (ab' +. a') b' c;\n assert ((ab' +. a' +. b') *. c == ab'' +. a'' +. b'');\n lemma_mul_smaller_is_zero (ab' +. a' +. b') c;\n assert (ab' +. a' +. b' == zero);\n lemma_zero_define ();\n lemma_equal ab' (a' +. b');\n ()", "val lemma_mul_distribute_left (#f:G.field) (a b c:G.felem f) : Lemma\n (fmul (fadd a b) c == fadd (fmul a c) (fmul b c))\nlet lemma_mul_distribute_left #f a b c =\n let pa = to_poly a in\n let pb = to_poly b in\n let pc = to_poly c in\n let m = irred_poly f in\n PL.lemma_mul_distribute_left pa pb pc;\n PL.lemma_mod_distribute (pa *. pc) (pb *. pc) m;\n lemma_eq_to_poly (fmul (fadd a b) c) (fadd (fmul a c) (fmul b c))", "val lemma_mod_distributivity_add_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod a (add_mod b c) == add_mod (mul_mod a b) (mul_mod a c))\nlet lemma_mod_distributivity_add_right #m a b c =\n calc (==) {\n mul_mod a (add_mod b c);\n (==) { }\n a * ((b + c) % m) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b + c) m }\n a * (b + c) % m;\n (==) { Math.Lemmas.distributivity_add_right a b c }\n (a * b + a * c) % m;\n (==) { Math.Lemmas.modulo_distributivity (a * b) (a * c) m }\n add_mod (mul_mod a b) (mul_mod a c);\n }", "val lemma_add_commute (a b:poly) : Lemma ((a +. b) == (b +. a))\nlet lemma_add_commute a b = I.lemma_add_commute (to_poly a) (to_poly b)", "val distributivity_add_right: a:int -> b:int -> c:int -> Lemma\n (a * (b + c) = a * b + a * c)\nlet distributivity_add_right a b c =\n calc (==) {\n a * (b + c);\n == {}\n (b + c) * a;\n == { distributivity_add_left b c a }\n b * a + c * a;\n == {}\n a * b + a * c;\n }", "val lemma_mul_commute (a b: poly) : Lemma ((a *. b) =. (b *. a))\nlet lemma_mul_commute (a b:poly) : Lemma ((a *. b) =. (b *. a)) =\n let f (k:nat) : Lemma (mul_element a b k == mul_element b a k) =\n lemma_sum_reverse 0 (k + 1) (mul_element_fun a b k) (mul_element_fun b a k)\n in\n FStar.Classical.forall_intro f", "val lemma_mul_commute (a b:poly) : Lemma ((a *. b) == (b *. a))\nlet lemma_mul_commute a b = I.lemma_mul_commute (to_poly a) (to_poly b)", "val lemma_mod_distributivity_add_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod (add_mod a b) c == add_mod (mul_mod a c) (mul_mod b c))\nlet lemma_mod_distributivity_add_left #m a b c =\n lemma_mod_distributivity_add_right c a b", "val lemma_mod_distributivity_sub_right: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod a (sub_mod b c) == sub_mod (mul_mod a b) (mul_mod a c))\nlet lemma_mod_distributivity_sub_right #m a b c =\n calc (==) {\n mul_mod a (sub_mod b c);\n (==) { }\n a * ((b - c) % m) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b - c) m }\n a * (b - c) % m;\n (==) { Math.Lemmas.distributivity_sub_right a b c }\n (a * b - a * c) % m;\n (==) { Math.Lemmas.lemma_mod_plus_distr_l (a * b) (- a * c) m }\n (mul_mod a b - a * c) % m;\n (==) { Math.Lemmas.lemma_mod_sub_distr (mul_mod a b) (a * c) m }\n sub_mod (mul_mod a b) (mul_mod a c);\n }", "val distributivity_sub_right: a:int -> b:int -> c:int ->\n Lemma ((a * (b - c) = a * b - a * c))\nlet distributivity_sub_right a b c =\n calc (==) {\n a * (b - c);\n == {}\n a * (b + (-c));\n == { distributivity_add_right a b (-c) }\n a * b + a * (-c);\n == { neg_mul_right a c }\n a * b - a * c;\n }", "val lemma_mul_sub_distr: a:int -> b:int -> c:int -> Lemma\n (a * b - a * c = a * (b - c))\nlet lemma_mul_sub_distr a b c =\n distributivity_sub_right a b c", "val lemma_mul_def (a b: poly) : Lemma (mul_def a b == mul a b)\nlet lemma_mul_def (a b:poly) : Lemma\n (mul_def a b == mul a b)\n =\n reveal_defs ();\n PL.lemma_pointwise_equal (mul_def a b) (mul a b) (lemma_mul_element a b)", "val lemma_add_cancel_eq (a b:poly) : Lemma (requires (a +. b) == zero) (ensures a == b)\nlet lemma_add_cancel_eq a b = I.lemma_add_cancel_eq (to_poly a) (to_poly b)", "val lemma_distr_eucl_mul_add (r a c:int) (b:pos) : Lemma (r * (a % b) + r * (a / b + c) * b = r * a + r * c * b)\nlet lemma_distr_eucl_mul_add r a c b =\n calc (==) {\n r * (a % b) + r * (a / b + c) * b;\n (==) { Math.Lemmas.paren_mul_right r (a / b + c) b }\n r * (a % b) + r * ((a / b + c) * b);\n (==) { Math.Lemmas.distributivity_add_left (a / b) c b }\n r * (a % b) + r * ((a / b * b) + c * b);\n (==) { Math.Lemmas.distributivity_add_right r (a / b * b) (c * b) }\n r * (a % b) + r * (a / b * b) + r * (c * b);\n (==) { Math.Lemmas.paren_mul_right r (a / b) b; Math.Lemmas.paren_mul_right r c b }\n r * (a % b) + r * (a / b) * b + r * c * b;\n (==) { lemma_distr_eucl_mul r a b }\n r * a + r * c * b;\n }", "val lemma_distr_pow (a b:int) (c d:nat) : Lemma ((a + b * pow2 c) * pow2 d = a * pow2 d + b * pow2 (c + d))\nlet lemma_distr_pow a b c d =\n calc (==) {\n (a + b * pow2 c) * pow2 d;\n (==) { Math.Lemmas.distributivity_add_left a (b * pow2 c) (pow2 d) }\n a * pow2 d + b * pow2 c * pow2 d;\n (==) { Math.Lemmas.paren_mul_right b (pow2 c) (pow2 d); Math.Lemmas.pow2_plus c d }\n a * pow2 d + b * pow2 (c + d);\n }", "val lemma_mod_distributivity_sub_left: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod (sub_mod a b) c == sub_mod (mul_mod a c) (mul_mod b c))\nlet lemma_mod_distributivity_sub_left #m a b c =\n lemma_mod_distributivity_sub_right c a b", "val lemma_mod_plus_mul_distr: a:int -> b:int -> c:int -> p:pos -> Lemma\n (((a + b) * c) % p = ((((a % p) + (b % p)) % p) * (c % p)) % p)\nlet lemma_mod_plus_mul_distr a b c p =\n calc (==) {\n ((a + b) * c) % p;\n == { lemma_mod_mul_distr_l (a + b) c p }\n (((a + b) % p) * c) % p;\n == { lemma_mod_mul_distr_r ((a + b) % p) c p }\n (((a + b) % p) * (c % p)) % p;\n == { modulo_distributivity a b p }\n ((((a % p) + (b % p)) % p) * (c % p)) % p;\n }", "val distributivity_sub_left: a:int -> b:int -> c:int ->\n Lemma ((a - b) * c = a * c - b * c)\nlet distributivity_sub_left a b c =\n calc (==) {\n (a - b) * c;\n == {}\n (a + (-b)) * c;\n == { distributivity_add_left a (-b) c }\n a * c + (-b) * c;\n == { neg_mul_left b c }\n a * c - b * c;\n }", "val lemma_gf128_mul (a b c d:poly) (n:nat) : Lemma\n (ensures (\n let m = monomial n in\n let ab = a *. m +. b in\n let cd = c *. m +. d in\n let ac = a *. c in\n let ad = a *. d in\n let bc = b *. c in\n let bd = b *. d in\n ab *. cd ==\n shift (ac +. bc /. m +. ad /. m) (n + n) +.\n ((bc %. m) *. m +. (ad %. m) *. m +. bd)\n ))\nlet lemma_gf128_mul a b c d n =\n let m = monomial n in\n let ab = a *. m +. b in\n let cd = c *. m +. d in\n let ac = a *. c in\n let ad = a *. d in\n let bc = b *. c in\n let bd = b *. d in\n let adh = ad /. m in\n let bch = bc /. m in\n let adl = ad %. m in\n let bcl = bc %. m in\n // ab *. cd\n // (a *. m +. b) *. (c *. m +. d)\n lemma_mul_distribute_right (a *. m +. b) (c *. m) d;\n lemma_mul_distribute_left (a *. m) b (c *. m);\n lemma_mul_distribute_left (a *. m) b d;\n // ((a *. m) *. (c *. m) +. b *. (c *. m)) +. ((a *. m) *. d +. b *. d);\n lemma_mul_associate b c m;\n lemma_mul_associate a m d;\n lemma_mul_commute m d;\n lemma_mul_associate a d m;\n lemma_mul_associate a m (c *. m);\n lemma_mul_associate m c m;\n lemma_mul_commute c m;\n lemma_mul_associate c m m;\n lemma_mul_associate a c (m *. m);\n // (ac *. (m *. m) +. bc *. m) +. (ad *. m +. bd)\n lemma_div_mod ad m;\n lemma_div_mod bc m;\n // (ac *. (m *. m) +. (bch *. m +. bcl) *. m) +. ((adh *. m +. adl) *. m +. bd)\n lemma_mul_distribute_left (bch *. m) bcl m;\n lemma_mul_distribute_left (adh *. m) adl m;\n // (ac *. (m *. m) +. (bch *. m *. m +. bcl *. m)) +. ((adh *. m *. m +. adl *. m) +. bd)\n lemma_mul_associate bch m m;\n lemma_mul_associate adh m m;\n // (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd)\n assert (ab *. cd == (ac *. (m *. m) +. (bch *. (m *. m) +. bcl *. m)) +. ((adh *. (m *. m) +. adl *. m) +. bd));\n lemma_add_define_all ();\n lemma_equal (ab *. cd) ((ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd));\n // (ac *. (m *. m) +. bch *. (m *. m) +. adh *. (m *. m)) +. (bcl *. m +. adl *. m +. bd)\n lemma_mul_distribute_left ac bch (m *. m);\n lemma_mul_distribute_left (ac +. bch) adh (m *. m);\n // (ac +. bch +. adh) *. (m *. m) +. (bcl *. m +. adl *. m +. bd)\n lemma_mul_monomials n n;\n lemma_shift_is_mul (ac +. bch +. adh) (n + n);\n // shift (ac +. bch +. adh) (n + n) +. (bcl *. m +. adl *. m +. bd)\n ()", "val lemma_gf128_mul_rev_associate (a b c:poly) : Lemma\n (a *~ (b *~ c) == (a *~ b) *~ c)\nlet lemma_gf128_mul_rev_associate a b c =\n let rev x = reverse x 127 in\n let ra = rev a in\n let rb = rev b in\n let rc = rev c in\n let g = gf128_modulus in\n lemma_gf128_degree ();\n calc (==) {\n a *~ (b *~ c);\n == {}\n rev (ra *. (rb *. rc %. g) %. g);\n == {lemma_mod_mul_mod_right ra (rb *. rc) g}\n rev (ra *. (rb *. rc) %. g);\n == {lemma_mul_associate ra rb rc}\n rev ((ra *. rb) *. rc %. g);\n == {lemma_mod_mul_mod (ra *. rb) g rc}\n rev ((ra *. rb %. g) *. rc %. g);\n == {}\n (a *~ b) *~ c;\n }", "val lemma_mul_pmul (a b: poly) : Lemma (mul_def a b == pmul b a)\nlet lemma_mul_pmul (a b:poly) : Lemma\n (mul_def a b == pmul b a)\n =\n PL.lemma_pointwise_equal (mul_def a b) (pmul b a) (lemma_mul_pmul_k a b)", "val lemma_mul_degree (a b: poly)\n : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else - 1))\nlet lemma_mul_degree (a b:poly) : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else -1))\n =\n if degree a >= 0 && degree b >= 0 then\n (\n let len = length a + length b in\n lemma_sum_of_zero 0 len (mul_element_fun a b (len - 1));\n lemma_sum_extend 0 (length a - 1) (length a) (len - 1) (mul_element_fun a b (len - 2));\n assert (not (a *. b).[len - 1]);\n assert ((a *. b).[len - 2]);\n ()\n )\n else if degree a < 0 then\n (\n assert (a =. zero);\n lemma_mul_zero b;\n lemma_mul_commute b zero;\n ()\n )\n else\n (\n assert (b =. zero);\n lemma_mul_zero a;\n ()\n )", "val lemma_mod_mul_assoc (n:pos) (a b c:nat) : Lemma ((a * b % n) * c % n == (a * (b * c % n)) % n)\nlet lemma_mod_mul_assoc m a b c =\n calc (==) {\n (a * b % m) * c % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c m }\n (a * b) * c % m;\n (==) { Math.Lemmas.paren_mul_right a b c }\n a * (b * c) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) m }\n a * (b * c % m) % m;\n }", "val lemma_mult_distr_3 (a b c n: nat)\n : Lemma ((a + b - c * pow2 56) * pow2 n == a * pow2 n + b * pow2 n - c * pow2 (n + 56))\nlet lemma_mult_distr_3 (a b c:nat) (n:nat) : Lemma\n ((a + b - c * pow2 56) * pow2 n == a * pow2 n + b * pow2 n - c * pow2 (n + 56))\n =\n Math.Lemmas.distributivity_sub_left (a + b) (c * pow2 56) (pow2 n);\n Math.Lemmas.distributivity_add_left a b (pow2 n);\n Math.Lemmas.pow2_plus 56 n", "val lemma_add_cancel (a:poly) : Lemma ((a +. a) == zero)\nlet lemma_add_cancel a = I.lemma_add_cancel (to_poly a)", "val lemma_add_move (a b: poly) : Lemma (ensures a == (a +. b) +. b)\nlet lemma_add_move (a b:poly) : Lemma (ensures a == (a +. b) +. b) =\n lemma_add_associate a b b;\n lemma_add_cancel b;\n lemma_add_zero a", "val lemma_fmul_assoc1: a:elem -> b:elem -> c:elem ->\n Lemma (a *% b *% c == a *% c *% b)\nlet lemma_fmul_assoc1 a b c =\n assert (a *% b *% c == a *% c *% b) by (ed25519_semiring ())", "val lemma_mul_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (mul_mod (mul_mod a b) c == mul_mod a (mul_mod b c))\nlet lemma_mul_mod_assoc #m a b c =\n calc (==) {\n (a * b % m) * c % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l (a * b) c m }\n (a * b) * c % m;\n (==) { Math.Lemmas.paren_mul_right a b c }\n a * (b * c) % m;\n (==) { Math.Lemmas.lemma_mod_mul_distr_r a (b * c) m }\n a * (b * c % m) % m;\n }", "val lemma_mul_one (a: poly) : Lemma ((a *. one) =. a)\nlet lemma_mul_one (a:poly) : Lemma ((a *. one) =. a) =\n let f (k:nat) : Lemma (mul_element a one k == a.[k]) =\n lemma_sum_of_zero 0 k (mul_element_fun a one k)\n in\n FStar.Classical.forall_intro f", "val lemma_mul_degree (a b:poly) : Lemma\n (degree (a *. b) == (if degree a >= 0 && degree b >= 0 then degree a + degree b else -1))\n [SMTPat (degree (a *. b))]\nlet lemma_mul_degree a b = I.lemma_mul_degree (to_poly a) (to_poly b)", "val lemma_mul_one (a:poly) : Lemma ((a *. one) == a)\nlet lemma_mul_one a = I.lemma_mul_one (to_poly a)", "val modulo_distributivity: a:int -> b:int -> c:pos ->\n Lemma ( (a + b) % c = (a % c + b % c) % c )\nlet modulo_distributivity (a:int) (b:int) (c:pos) =\n lemma_div_mod a c;\n lemma_div_mod b c;\n lemma_div_mod (a % c + b % c) c;\n division_addition_lemma (a - (a / c) * c + b - (b / c) * c) c (a / c + b / c)", "val modulo_distributivity: a:int -> b:int -> c:pos -> Lemma ((a + b) % c == (a % c + b % c) % c)\nlet modulo_distributivity a b c =\n calc (==) {\n (a + b) % c;\n == { lemma_mod_plus_distr_l a b c }\n ((a % c) + b) % c;\n == { lemma_mod_plus_distr_r (a % c) b c }\n ((a % c) + (b % c)) % c;\n }", "val lemma_distr5 (a0 a1 a2 a3 a4 b:int) : Lemma\n ((a0 + a1 + a2 + a3 + a4) * b = a0 * b + a1 * b + a2 * b + a3 * b + a4 * b)\nlet lemma_distr5 a0 a1 a2 a3 a4 b =\n calc (==) {\n (a0 + a1 + a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a0 (a1 + a2 + a3 + a4) b }\n a0 * b + (a1 + a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a1 (a2 + a3 + a4) b }\n a0 * b + a1 * b + (a2 + a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a2 (a3 + a4) b }\n a0 * b + a1 * b + a2 * b + (a3 + a4) * b;\n (==) { Math.Lemmas.distributivity_add_left a3 a4 b }\n a0 * b + a1 * b + a2 * b + a3 * b + a4 * b;\n }", "val lemma_add_lo_mul_right (#n:nat) (a b:natN n) (c:nat1) (m:int) : Lemma\n (add_lo a b c * m == (let x = a * m + b * m + c * m in if a + b + c < n then x else x - n * m))\nlet lemma_add_lo_mul_right #n a b c m =\n reveal_add_lo_all ()", "val lemma_swap_mul3 (a b c:int) : Lemma (a * b * c == a * c * b)\nlet lemma_swap_mul3 a b c =\n calc (==) {\n a * b * c;\n (==) { Math.Lemmas.paren_mul_right a b c }\n a * (b * c);\n (==) { Math.Lemmas.swap_mul b c }\n a * (c * b);\n (==) { Math.Lemmas.paren_mul_right a c b }\n a * c * b;\n }", "val lemma_a_mul_c_plus_d_mod_e_mul_f_g (a b c d f g:nat) : Lemma\n (requires c == g - b)\n (ensures\n a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g ==\n a * pow2 c + d * pow2 (f + g))\nlet lemma_a_mul_c_plus_d_mod_e_mul_f_g a b c d f g =\n calc (==) {\n a % pow2 b * pow2 c + (a / pow2 b + d * pow2 f) * pow2 g;\n (==) { lemma_distr_pow (a / pow2 b) d f g }\n a % pow2 b * pow2 c + (a / pow2 b) * pow2 (c + b) + d * pow2 (f + g);\n (==) { lemma_distr_pow (a % pow2 b) (a / pow2 b) b c }\n (a % pow2 b + (a / pow2 b) * pow2 b) * pow2 c + d * pow2 (f + g);\n (==) { Math.Lemmas.euclidean_division_definition a (pow2 b) }\n a * pow2 c + d * pow2 (f + g);\n }", "val lemma_pow2_div2 (a b c: nat) : Lemma ((a / pow2 b) / pow2 c == a / (pow2 (c + b)))\nlet lemma_pow2_div2 (a:nat) (b:nat) (c:nat)\n : Lemma ((a / pow2 b) / pow2 c == a / (pow2 (c + b)))\n =\n let open FStar.Math.Lemmas in\n pow2_plus b c;\n division_multiplication_lemma a (pow2 b) (pow2 c)", "val lemma_mul_associate (#f:G.field) (a b c:G.felem f) : Lemma\n (fmul a (fmul b c) == fmul (fmul a b) c)\nlet lemma_mul_associate #f a b c =\n let pa = to_poly a in\n let pb = to_poly b in\n let pc = to_poly c in\n let m = irred_poly f in\n lemma_mul_associate pa pb pc;\n // (((a * b) % m) * c) % m\n // (a * ((b * c) % m)) % m\n PL.lemma_mod_mul_mod (pa *. pb) m pc;\n PL.lemma_mod_mul_mod (pb *. pc) m pa;\n Vale.Math.Poly2.lemma_mul_commute pa (pb *. pc);\n Vale.Math.Poly2.lemma_mul_commute pa ((pb *. pc) %. m);\n lemma_eq_to_poly (fmul a (fmul b c)) (fmul (fmul a b) c)", "val lemma_mod_mul_distr (a b:int) (n:pos) : Lemma (a * b % n = (a % n) * (b % n) % n)\nlet lemma_mod_mul_distr a b n =\n Math.Lemmas.lemma_mod_mul_distr_l a b n;\n Math.Lemmas.lemma_mod_mul_distr_r (a % n) b n", "val lemma_aff_point_mul_neg_mul_add (a b c:int) (p:S.aff_point) :\n Lemma (aff_point_mul_neg (a * b + c) p ==\n S.aff_point_add (aff_point_mul_neg b (aff_point_mul_neg a p)) (aff_point_mul_neg c p))\nlet lemma_aff_point_mul_neg_mul_add a b c p =\n lemma_aff_point_mul_neg_add (a * b) c p;\n lemma_aff_point_mul_neg_mul a b p", "val lemma_div_mod (a b:poly) : Lemma\n (requires degree b >= 0)\n (ensures a == (a /. b) *. b +. (a %. b))\nlet lemma_div_mod a b = I.lemma_div_mod (to_poly a) (to_poly b)", "val lemma_distr_pow_pow (a:int) (b:nat) (c:int) (d e:nat) :\n Lemma ((a * pow2 b + c * pow2 d) * pow2 e = a * pow2 (b + e) + c * pow2 (d + e))\nlet lemma_distr_pow_pow a b c d e =\n calc (==) {\n (a * pow2 b + c * pow2 d) * pow2 e;\n (==) { lemma_distr_pow (a * pow2 b) c d e }\n a * pow2 b * pow2 e + c * pow2 (d + e);\n (==) { Math.Lemmas.paren_mul_right a (pow2 b) (pow2 e); Math.Lemmas.pow2_plus b e }\n a * pow2 (b + e) + c * pow2 (d + e);\n }", "val lemma_div_mod_eq_mul_mod (a b c:felem) : Lemma\n (requires b <> 0)\n (ensures (a *% finv b = c) == (a = c *% b))\nlet lemma_div_mod_eq_mul_mod a b c =\n prime_lemma ();\n M.lemma_div_mod_eq_mul_mod #prime a b c", "val lemma_mod_mult_zero (a : int) (b : pos) (c : pos) : Lemma ((a % (b * c)) / b / c == 0)\nlet lemma_mod_mult_zero a b c =\n (* < 1 *)\n lemma_mod_lt a (b * c);\n lemma_div_lt_cancel (a % (b * c)) b c;\n lemma_div_lt_cancel ((a % (b * c)) / b) c 1;\n\n (* >= 0 *)\n nat_over_pos_is_nat (a % (b * c)) b;\n nat_over_pos_is_nat ((a % (b * c)) / b) c;\n ()", "val lemma_gf128_mul_rev_commute (a b:poly) : Lemma (a *~ b == b *~ a)\nlet lemma_gf128_mul_rev_commute a b =\n lemma_mul_all ()", "val lemma_a_mod_b_mul_c_mod_d (a b c d:nat) : Lemma\n (requires c <= d /\\ b <= d - c)\n (ensures (a % pow2 b) * pow2 c % pow2 d = (a % pow2 b) * pow2 c)\nlet lemma_a_mod_b_mul_c_mod_d a b c d =\n Math.Lemmas.pow2_multiplication_modulo_lemma_2 (a % pow2 b) d c;\n Math.Lemmas.pow2_modulo_modulo_lemma_2 a (d - c) b", "val lemma_a_plus_b_pow2_mod2 (a b:int) (c:pos) : Lemma ((a + b * pow2 c) % 2 = a % 2)\nlet lemma_a_plus_b_pow2_mod2 a b c =\n assert_norm (pow2 1 = 2);\n Math.Lemmas.lemma_mod_plus_distr_r a (b * pow2 c) 2;\n Math.Lemmas.pow2_multiplication_modulo_lemma_1 b 1 c", "val lemma_mod_mul_distr_r (a:int) (b:int) (n:pos) : Lemma ((a * b) % n = (a * (b % n)) % n)\nlet lemma_mod_mul_distr_r (a:int) (b:int) (n:pos) =\n calc (==) {\n (a * b) % n;\n == { swap_mul a b }\n (b * a) % n;\n == { lemma_mod_mul_distr_l b a n }\n (b%n * a) % n;\n == { swap_mul a (b%n) }\n (a * (b%n)) % n;\n }", "val lemma_mod_mul_distr_r (a:int) (b:int) (n:pos) : Lemma ((a * b) % n = (a * (b % n)) % n)\nlet lemma_mod_mul_distr_r (a:int) (b:int) (n:pos) = lemma_mod_mul_distr_l b a n", "val lemma_mod_plus_distr_r (a:int) (b:int) (n:pos) : Lemma ((a + b) % n = (a + (b % n)) % n)\nlet lemma_mod_plus_distr_r (a:int) (b:int) (n:pos) = lemma_mod_add_distr a b n", "val lemma_abc_is_acb (a b c:nat) : Lemma (a * b * c = a * c * b)\nlet lemma_abc_is_acb a b c =\n Math.Lemmas.paren_mul_right a b c;\n Math.Lemmas.swap_mul b c;\n Math.Lemmas.paren_mul_right a c b", "val lemma_mul_element (a b: poly) (k: int)\n : Lemma (mul_element a b k == D.mul_element (d a) (d b) k)\nlet lemma_mul_element (a b:poly) (k:int) : Lemma\n (mul_element a b k == D.mul_element (d a) (d b) k)\n =\n reveal_defs ();\n lemma_mul_element_rec a b k (k + 1);\n ()", "val lemma_add_zero (a:poly) : Lemma ((a +. zero) == a)\nlet lemma_add_zero a = I.lemma_add_zero (to_poly a)", "val lemma_distr5_pow52_sub (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c:int) : Lemma\n ((b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 +\n (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208 ==\n (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c -\n (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208))\nlet lemma_distr5_pow52_sub a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 c =\n calc (==) {\n (b0 * c - a0) + (b1 * c - a1) * pow2 52 + (b2 * c - a2) * pow2 104 +\n (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208;\n (==) { Math.Lemmas.distributivity_sub_left (b1 * c) a1 (pow2 52) }\n c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + (b2 * c - a2) * pow2 104 +\n (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208;\n (==) { Math.Lemmas.distributivity_sub_left (b2 * c) a2 (pow2 104) }\n c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 +\n (b3 * c - a3) * pow2 156 + (b4 * c - a4) * pow2 208;\n (==) { Math.Lemmas.distributivity_sub_left (b3 * c) a3 (pow2 156) }\n c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 +\n c * b3 * pow2 156 - a3 * pow2 156 + (b4 * c - a4) * pow2 208;\n (==) { Math.Lemmas.distributivity_sub_left (b4 * c) a4 (pow2 208) }\n c * b0 - a0 + c * b1 * pow2 52 - a1 * pow2 52 + c * b2 * pow2 104 - a2 * pow2 104 +\n c * b3 * pow2 156 - a3 * pow2 156 + c * b4 * pow2 208 - a4 * pow2 208;\n (==) { lemma_distr5_pow52 c b0 b1 b2 b3 b4 }\n (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) * c -\n (a0 + a1 * pow2 52 + a2 * pow2 104 + a3 * pow2 156 + a4 * pow2 208);\n }", "val lemma_add_mod_assoc: #m:pos -> a:nat_mod m -> b:nat_mod m -> c:nat_mod m ->\n Lemma (add_mod (add_mod a b) c == add_mod a (add_mod b c))\nlet lemma_add_mod_assoc #m a b c =\n calc (==) {\n add_mod (add_mod a b) c;\n (==) { Math.Lemmas.lemma_mod_plus_distr_l (a + b) c m }\n ((a + b) + c) % m;\n (==) { }\n (a + (b + c)) % m;\n (==) { Math.Lemmas.lemma_mod_plus_distr_r a (b + c) m }\n add_mod a (add_mod b c);\n }", "val lemma_mul_zero (a: poly) : Lemma ((a *. zero) =. zero)\nlet lemma_mul_zero (a:poly) : Lemma ((a *. zero) =. zero) =\n let f (k:nat) : Lemma (not (mul_element a zero k)) =\n lemma_sum_of_zero 0 (k + 1) (mul_element_fun a zero k)\n in\n FStar.Classical.forall_intro f", "val lemma_mul_zero (a:poly) : Lemma ((a *. zero) == zero)\nlet lemma_mul_zero a = I.lemma_mul_zero (to_poly a)", "val lemma_mul_reverse (a b:poly) (n:nat) : Lemma\n (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) == reverse a n *. reverse b n)\nlet lemma_mul_reverse a b n = I.lemma_mul_reverse (to_poly a) (to_poly b) n", "val lemma_mont_mul_assoc: n:pos -> d:int -> a:nat_mod n -> b:nat_mod n -> c:nat_mod n ->\n Lemma (mont_mul n d (mont_mul n d a b) c == mont_mul n d a (mont_mul n d b c))\nlet lemma_mont_mul_assoc n d a b c =\n calc (==) {\n mont_mul n d (mont_mul n d a b) c;\n (==) { }\n (a * b * d % n) * c * d % n;\n (==) { Math.Lemmas.paren_mul_right (a * b * d % n) c d }\n (a * b * d % n) * (c * d) % n;\n (==) { M.lemma_mod_mul_distr3 1 (a * b * d) (c * d) n }\n a * b * d * (c * d) % n;\n (==) { Math.Lemmas.paren_mul_right (a * b * d) c d }\n a * b * d * c * d % n;\n (==) { Math.Lemmas.paren_mul_right a b d; Math.Lemmas.paren_mul_right a (b * d) c }\n a * (b * d * c) * d % n;\n (==) { Math.Lemmas.paren_mul_right b d c; Math.Lemmas.paren_mul_right b c d }\n a * (b * c * d) * d % n;\n (==) { M.lemma_mod_mul_distr3 a (b * c * d) d n }\n mont_mul n d a (mont_mul n d b c);\n }", "val lemma_distr_eucl_mul (r a:int) (b:pos) : Lemma (r * (a % b) + r * (a / b) * b = r * a)\nlet lemma_distr_eucl_mul r a b =\n calc (==) {\n r * (a % b) + r * (a / b) * b;\n (==) { Math.Lemmas.paren_mul_right r (a / b) b }\n r * (a % b) + r * ((a / b) * b);\n (==) { Math.Lemmas.distributivity_add_right r (a % b) (a / b * b) }\n r * (a % b + a / b * b);\n (==) { Math.Lemmas.euclidean_division_definition a b }\n r * a;\n }", "val lemma_mod_plus_distr_l (a:int) (b:int) (n:pos) : Lemma ((a + b) % n = ((a % n) + b) % n)\nlet lemma_mod_plus_distr_l (a:int) (b:int) (n:pos) = lemma_mod_add_distr b a n", "val lemma_mod_mul_distr3: a:int -> b:int -> c:int -> n:pos -> Lemma\n (a * (b % n) * c % n == a * b * c % n)\nlet lemma_mod_mul_distr3 a b c n =\n calc (==) {\n a * (b % n) * c % n;\n (==) { }\n (b % n) * a * c % n;\n (==) { Math.Lemmas.paren_mul_right (b % n) a c }\n (b % n) * (a * c) % n;\n (==) { Math.Lemmas.lemma_mod_mul_distr_l b (a * c) n }\n b * (a * c) % n;\n (==) { Math.Lemmas.paren_mul_right b a c }\n a * b * c % n;\n }", "val lemma_add_mul_zero_high (a0 a1 b0 b1: poly)\n : Lemma (requires a0 == zero \\/ b0 == zero) (ensures add (mul a0 b0) (mul a1 b1) == mul a1 b1)\nlet lemma_add_mul_zero_high (a0 a1 b0 b1:poly) : Lemma\n (requires a0 == zero \\/ b0 == zero)\n (ensures add (mul a0 b0) (mul a1 b1) == mul a1 b1)\n =\n lemma_mul_commute a0 b0;\n lemma_mul_zero a0;\n lemma_mul_zero b0;\n lemma_add_commute (mul a0 b0) (mul a1 b1);\n lemma_add_zero (mul a1 b1)", "val lemma_mul_reverse (a b: poly) (n: nat)\n : Lemma (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) =. reverse a n *. reverse b n)\nlet lemma_mul_reverse (a b:poly) (n:nat) : Lemma\n (requires degree a <= n /\\ degree b <= n)\n (ensures reverse (a *. b) (n + n) =. reverse a n *. reverse b n)\n =\n let ab = a *. b in\n let rab = reverse ab (n + n) in\n let ra = reverse a n in\n let rb = reverse b n in\n lemma_mul_degree a b;\n lemma_mul_degree ra rb;\n let f (k:int) : Lemma (rab.[k] == (ra *. rb).[k]) =\n if 0 <= k && k <= n + n then\n (\n let f0 = mul_element_fun ra rb k in\n let f1 (i:int) : bool = a.[n + i] && b.[n - k - i] in\n let f2 = mul_element_fun a b (n + n - k) in\n // mul_element a b (n + n - k) == sum_of_bools 0 (n + n + 1 - k) f2\n\n // mul_element ra rb k == sum_of_bools 0 (k + 1) f0\n lemma_sum_invert 0 (k + 1) f0 f1;\n // mul_element ra rb k == sum_of_bools (-k) 1 f1\n lemma_sum_shift (-k) 1 n f1 f2;\n // mul_element ra rb k == sum_of_bools (n - k) (n + 1) f2\n\n let lo = min (n - k) 0 in\n let hi = max (n + 1) (n + n + 1 - k) in\n lemma_sum_extend lo 0 (n + n + 1 - k) hi f2;\n lemma_sum_extend lo (n - k) (n + 1) hi f2;\n ()\n )\n in\n lemma_pointwise_equal rab (ra *. rb) f", "val foldm_snoc_distributivity_right_eq\n (#c #eq: _)\n (mul add: CE.cm c eq)\n (s: SB.seq c)\n (a: c)\n (r: SB.seq c)\n : Lemma\n (requires\n is_fully_distributive mul add /\\ is_absorber add.unit mul /\\\n SB.equal r (seq_op_const mul s a))\n (ensures (mul.mult (SP.foldm_snoc add s) a) `eq.eq` (SP.foldm_snoc add r))\nlet foldm_snoc_distributivity_right_eq #c #eq (mul add: CE.cm c eq) (s: SB.seq c) (a: c) (r: SB.seq c)\n : Lemma (requires is_fully_distributive mul add /\\ is_absorber add.unit mul /\\\n SB.equal r (seq_op_const mul s a)) \n (ensures mul.mult (SP.foldm_snoc add s) a `eq.eq`\n SP.foldm_snoc add r)\n = foldm_snoc_distributivity_right mul add s a", "val lemma_mod_plus_distr_r: a:int -> b:int -> p:pos -> Lemma\n ((a + b) % p = (a + (b % p)) % p)\nlet lemma_mod_plus_distr_r a b p =\n lemma_mod_plus_distr_l b a p", "val lemma_mul_element (a b: poly) (k: int)\n : Lemma (requires True) (ensures (a *. b).[ k ] == mul_element a b k) [SMTPat (a *. b).[ k ]]\nlet lemma_mul_element (a b:poly) (k:int) : Lemma\n (requires True)\n (ensures (a *. b).[k] == mul_element a b k)\n [SMTPat (a *. b).[k]]\n =\n if k >= length a + length b then lemma_sum_of_zero 0 (k + 1) (mul_element_fun a b k)", "val lemma_mod_add_distr (a:int) (b:int) (n:pos) : Lemma ((a + b % n) % n = (a + b) % n)\nlet lemma_mod_add_distr (a:int) (b:int) (n:pos) =\n calc (==) {\n (a + b%n) % n;\n == { lemma_mod_plus (a + (b % n)) (b / n) n }\n (a + b%n + n * (b/n)) % n;\n == { lemma_div_mod b n }\n (a + b) % n;\n }", "val lemma_mod_add_distr (a:int) (b:int) (n:pos) : Lemma ((a + b % n) % n = (a + b) % n)\nlet lemma_mod_add_distr (a:int) (b:int) (n:pos) =\n lemma_div_mod b n;\n // (a + b) % n == (a + (b % n) + (b / n) * n) % n\n lemma_mod_plus (a + (b % n)) (b / n) n", "val lemma_pow_pow_mod_mul: f:S.qelem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.qmul (M.pow (M.pow f a % S.q) b % S.q) (M.pow f c % S.q) == M.pow f (a * b + c) % S.q)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.qmul (M.pow (M.pow f a % S.q) b % S.q) (M.pow f c % S.q);\n (==) {\n M.lemma_pow_mod_base (M.pow f a) b S.q;\n Math.Lemmas.lemma_mod_mul_distr_l (M.pow (M.pow f a) b) (M.pow f c % S.q) S.q;\n Math.Lemmas.lemma_mod_mul_distr_r (M.pow (M.pow f a) b) (M.pow f c) S.q }\n M.pow (M.pow f a) b * M.pow f c % S.q;\n (==) { M.lemma_pow_mul f a b }\n M.pow f (a * b) * M.pow f c % S.q;\n (==) { M.lemma_pow_add f (a * b) c }\n M.pow f (a * b + c) % S.q;\n }", "val lemma_pow_pow_mod_mul: f:S.qelem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.qmul (M.pow (M.pow f a % S.order) b % S.order) (M.pow f c % S.order) == M.pow f (a * b + c) % S.order)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.qmul (M.pow (M.pow f a % S.order) b % S.order) (M.pow f c % S.order);\n (==) { lemma_pow_pow_mod f a b }\n S.qmul (M.pow f (a * b) % S.order) (M.pow f c % S.order);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.order;\n }", "val lemma_mul (f:G.field) (a b:G.felem f) : Lemma\n (requires True)\n (ensures to_poly (G.fmul a b) == (to_poly a *. to_poly b) %. (irred_poly f))\n [SMTPat (to_poly (G.fmul a b))]\nlet lemma_mul f a b =\n let G.GF t irred = f in\n let n = I.bits t in\n let pa = to_poly a in\n let pb = to_poly b in\n let m = irred_poly f in\n lemma_mul_commute pa pb;\n lemma_mul_def pb pa;\n lemma_mul_pmul pb pa;\n lemma_mmul_pmul pa pb m n;\n lemma_mmul_smul pa pb m n;\n lemma_smul_fmul f a b;\n lemma_fmul_gmul f a b;\n lemma_fmul_fmul f a b;\n PL.lemma_mod_small (to_poly (G.fmul a b)) m;\n ()", "val lemma_distr5_pow52 (a b0 b1 b2 b3 b4:int) : Lemma\n (a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208) =\n a * b0 + a * b1 * pow2 52 + a * b2 * pow2 104 + a * b3 * pow2 156 + a * b4 * pow2 208)\nlet lemma_distr5_pow52 a b0 b1 b2 b3 b4 =\n calc (==) {\n a * (b0 + b1 * pow2 52 + b2 * pow2 104 + b3 * pow2 156 + b4 * pow2 208);\n (==) { lemma_distr5 b0 (b1 * pow2 52) (b2 * pow2 104) (b3 * pow2 156) (b4 * pow2 208) a }\n b0 * a + b1 * pow2 52 * a + b2 * pow2 104 * a + b3 * pow2 156 * a + b4 * pow2 208 * a;\n (==) { lemma_swap_mul3 b1 (pow2 52) a; lemma_swap_mul3 b2 (pow2 104) a }\n b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * pow2 156 * a + b4 * pow2 208 * a;\n (==) { lemma_swap_mul3 b3 (pow2 156) a; lemma_swap_mul3 b4 (pow2 208) a }\n b0 * a + b1 * a * pow2 52 + b2 * a * pow2 104 + b3 * a * pow2 156 + b4 * a * pow2 208;\n }", "val lemma_fmul_gmul (f: G.field) (a b: G.felem f) : Lemma (fmul f a b == gmul f a b)\nlet lemma_fmul_gmul (f:G.field) (a b:G.felem f) : Lemma\n (fmul f a b == gmul f a b)\n =\n let pred (n:nat) (pab:(fmul_t f)) : Type0 = gmul_rec f a b n == pab in\n let _ = Lib.LoopCombinators.repeati_inductive' (I.bits f.G.t - 1) pred (fmul_iter f) (G.zero #f, a, b) in\n ()", "val lemma_fmul_fmul (f: G.field) (a b: G.felem f) : Lemma (G.fmul a b == fmul f a b)\nlet lemma_fmul_fmul (f:G.field) (a b:G.felem f) : Lemma\n (G.fmul a b == fmul f a b)\n =\n let repeati = Lib.LoopCombinators.repeati in\n let acc0 = (G.zero #f, a, b) in\n let rec lem (n:nat{n < I.bits f.G.t}) (f1:(i:nat{i < n} -> fmul_t f -> fmul_t f)) : Lemma\n (requires (forall (i:nat{i < n}) (pab:fmul_t f). f1 i pab == fmul_iter f i pab))\n (ensures repeati n (fmul_iter f) acc0 == repeati n f1 acc0)\n [SMTPat (repeati n f1 acc0)]\n =\n if n = 0 then\n (\n let pred (n:nat) (pab:(fmul_t f)) : Type0 = n == 0 ==> pab == acc0 in\n let _ = Lib.LoopCombinators.repeati_inductive' 0 pred (fmul_iter f) acc0 in\n let _ = Lib.LoopCombinators.repeati_inductive' 0 pred f1 acc0 in\n ()\n )\n else\n (\n lem (n - 1) f1;\n Lib.LoopCombinators.unfold_repeati n (fmul_iter f) acc0 (n - 1);\n Lib.LoopCombinators.unfold_repeati n f1 acc0 (n - 1);\n assert (repeati n (fmul_iter f) acc0 == repeati n f1 acc0);\n ()\n )\n in\n ()", "val lemma_mul_element_rec (a b: poly) (k n: int)\n : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\nlet rec lemma_mul_element_rec (a b:poly) (k:int) (n:int) : Lemma\n (sum_of_bools 0 n (mul_element_fun a b k) == sum_of_bools 0 n (D.mul_element_fun (d a) (d b) k))\n =\n reveal_defs ();\n if n > 0 then lemma_mul_element_rec a b k (n - 1)", "val lemma_div_mod_eq_mul_mod: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma ((div_mod a b = c) == (a = mul_mod c b))\nlet lemma_div_mod_eq_mul_mod #m a b c =\n lemma_div_mod_eq_mul_mod1 a b c;\n lemma_div_mod_eq_mul_mod2 a b c", "val lemma_div_mod_eq_mul_mod2: #m:prime -> a:nat_mod m -> b:nat_mod m{b <> 0} -> c:nat_mod m ->\n Lemma (a = mul_mod c b ==> div_mod a b = c)\nlet lemma_div_mod_eq_mul_mod2 #m a b c =\n if a = mul_mod c b then begin\n assert (div_mod a b == div_mod (mul_mod c b) b);\n calc (==) {\n div_mod (mul_mod c b) b;\n (==) { Math.Lemmas.small_mod b m }\n div_mod (mul_mod c b) (mul_mod b 1);\n (==) { lemma_div_mod_prime_cancel c 1 b }\n div_mod c 1;\n (==) { lemma_div_mod_prime_one c }\n c;\n } end\n else ()", "val lemma_mod_plus (a:int) (b:int) (n:pos) : Lemma ((a + b * n) % n = a % n)\nlet lemma_mod_plus (a:int) (b:int) (n:pos) = lemma_div_mod_plus a b n", "val lemma_mul_ab (a0 a1 a2 a3 a4 b0 b1 b2 b3 b4:nat) :\n Lemma\n (let sum0 = a0 * b0 in\n let sum1 = a0 * b1 + a1 * b0 in\n let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in\n let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in\n let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in\n let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in\n let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in\n let sum7 = a3 * b4 + a4 * b3 in\n let sum8 = a4 * b4 in\n (a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) *\n (b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208) =\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208 +\n pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156))\nlet lemma_mul_ab a0 a1 a2 a3 a4 b0 b1 b2 b3 b4 =\n let sum0 = a0 * b0 in\n let sum1 = a0 * b1 + a1 * b0 in\n let sum2 = a0 * b2 + a1 * b1 + a2 * b0 in\n let sum3 = a0 * b3 + a1 * b2 + a2 * b1 + a3 * b0 in\n let sum4 = a0 * b4 + a1 * b3 + a2 * b2 + a3 * b1 + a4 * b0 in\n let sum5 = a1 * b4 + a2 * b3 + a3 * b2 + a4 * b1 in\n let sum6 = a2 * b4 + a3 * b3 + a4 * b2 in\n let sum7 = a3 * b4 + a4 * b3 in\n let sum8 = a4 * b4 in\n\n let b_sum = b0 + b1 * pow52 + b2 * pow104 + b3 * pow156 + b4 * pow208 in\n calc (==) {\n (a0 + a1 * pow52 + a2 * pow104 + a3 * pow156 + a4 * pow208) * b_sum;\n (==) { ML.lemma_distr5 a0 (a1 * pow52) (a2 * pow104) (a3 * pow156) (a4 * pow208) b_sum }\n a0 * b_sum + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52 a0 b0 b1 b2 b3 b4 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * pow52 * b_sum + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a1 b0 b1 b2 b3 b4 52 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * pow104 * b_sum + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a2 b0 b1 b2 b3 b4 104 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * pow156 * b_sum + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a3 b0 b1 b2 b3 b4 156 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * pow208 * b_sum;\n (==) { ML.lemma_distr5_pow52_mul_pow a4 b0 b1 b2 b3 b4 208 }\n sum0 + a0 * b1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b0 * pow2 52 + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { Math.Lemmas.distributivity_add_left (a0 * b1) (a1 * b0) (pow2 52) }\n sum0 + sum1 * pow2 52 + a0 * b2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b1 * pow2 104 + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b0 * pow2 104 + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b2) (a1 * b1) (a2 * b0) 0 0 (pow2 104) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + a0 * b3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b2 * pow2 156 + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b1 * pow2 156 + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b0 * pow2 156 + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b3) (a1 * b2) (a2 * b1) (a3 * b0) 0 (pow2 156) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + a0 * b4 * pow2 208\n + a1 * b3 * pow2 208 + a1 * b4 * pow2 260\n + a2 * b2 * pow2 208 + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b1 * pow2 208 + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b0 * pow2 208 + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a0 * b4) (a1 * b3) (a2 * b2) (a3 * b1) (a4 * b0) (pow2 208) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + a1 * b4 * pow2 260\n + a2 * b3 * pow2 260 + a2 * b4 * pow2 312\n + a3 * b2 * pow2 260 + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b1 * pow2 260 + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a1 * b4) (a2 * b3) (a3 * b2) (a4 * b1) 0 (pow2 260) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260\n + a2 * b4 * pow2 312\n + a3 * b3 * pow2 312 + a3 * b4 * pow2 364\n + a4 * b2 * pow2 312 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { ML.lemma_distr5 (a2 * b4) (a3 * b3) (a4 * b2) 0 0 (pow2 312) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260 + sum6 * pow2 312 + a3 * b4 * pow2 364 + a4 * b3 * pow2 364 + a4 * b4 * pow2 416;\n (==) { Math.Lemmas.distributivity_add_left (a3 * b4) (a4 * b3) (pow2 364) }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + sum5 * pow2 260 + sum6 * pow2 312 + sum7 * pow2 364 + sum8 * pow2 416;\n (==) { ML.lemma_distr5_pow52_mul_pow 1 sum5 sum6 sum7 sum8 0 260 }\n sum0 + sum1 * pow2 52 + sum2 * pow2 104 + sum3 * pow2 156 + sum4 * pow2 208\n + pow2 260 * (sum5 + sum6 * pow2 52 + sum7 * pow2 104 + sum8 * pow2 156);\n }", "val lemma_a_div_b_plus_c_mod_d_mul_e (a b c d e:nat) : Lemma\n (requires a / pow2 b < pow2 e)\n (ensures a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))\nlet lemma_a_div_b_plus_c_mod_d_mul_e a b c d e =\n let t_r = c % pow2 d * pow2 e in\n Math.Lemmas.lemma_mult_le_right (pow2 e) (c % pow2 d) (pow2 d - 1);\n assert (t_r <= (pow2 d - 1) * pow2 e);\n assert (t_r <= pow2 d * pow2 e - pow2 e);\n Math.Lemmas.pow2_plus d e;\n assert (t_r <= pow2 (d + e) - pow2 e);\n assert (a / pow2 b + c % pow2 d * pow2 e < pow2 (d + e))", "val lemma_mod_mul_distr_l (a:int) (b:int) (n:pos) : Lemma\n (requires True)\n (ensures (a * b) % n = ((a % n) * b) % n)\nlet lemma_mod_mul_distr_l a b n =\n calc (==) {\n (a * b) % n;\n == { lemma_div_mod a n }\n ((n * (a/n) + a%n) * b) % n;\n == { distributivity_add_left (n * (a/n)) (a%n) b }\n (n * (a/n) * b + (a%n) * b) % n;\n == { paren_mul_right n (a/n) b; swap_mul ((a/n) * b) n }\n ((a%n) * b + ((a/n) * b) * n) % n;\n == { lemma_mod_plus ((a%n) * b) ((a/n) * b) n }\n ((a%n) * b) % n;\n }", "val lemma_div_mod (a b: poly)\n : Lemma (requires length b > 0) (ensures a =. (a /. b) *. b +. (a %. b)) (decreases (length a))\nlet rec lemma_div_mod (a b:poly) : Lemma\n (requires length b > 0)\n (ensures a =. (a /. b) *. b +. (a %. b))\n (decreases (length a))\n =\n if length a < length b then\n (\n lemma_mul_zero b;\n lemma_mul_commute b zero;\n ()\n )\n else\n (\n let _ = assert (a.[length a - 1]) in\n let n = length a - length b in\n let a' = a +. (shift b n) in\n let xn = monomial n in\n lemma_shift_is_mul b n;\n lemma_mul_commute b xn;\n // a' == a +. xn *. b\n // (a /. b == a' /. b +. xn);\n lemma_add_move (a' /. b) xn;\n // (a' /. b == a /. b +. xn);\n lemma_div_mod a' b;\n // a' == (a' /. b) *. b +. (a' %. b)\n // a +. xn * b == (a /. b + xn) *. b +. (a %. b))\n lemma_mul_distribute_left (a /. b) xn b;\n // a +. xn *. b == (a /. b) *. b +. xn *. b +. (a %. b)\n // a == (a /. b) *. b +. (a %. b)\n ()\n )", "val lemma_mul_pmul_k (a b: poly) (k: int) : Lemma ((mul_def a b).[ k ] == (pmul b a).[ k ])\nlet lemma_mul_pmul_k (a b:poly) (k:int) : Lemma\n ((mul_def a b).[k] == (pmul b a).[k])\n =\n PL.lemma_index_all ();\n let n = poly_length a in\n lemma_pmul_degree b a n;\n if n = k + 1 then lemma_mul_pmul_k_base a b k n\n else if n > k + 1 then lemma_mul_pmul_k_left a b k n (k + 1)\n else lemma_mul_pmul_k_right a b k n (k + 1)", "val lemma_mul_commute (#f:G.field) (a b:G.felem f) : Lemma\n (fmul a b == fmul b a)\nlet lemma_mul_commute #f a b =\n let pa = to_poly a in\n let pb = to_poly b in\n let m = irred_poly f in\n lemma_mul_commute pa pb;\n lemma_eq_to_poly (fmul a b) (fmul b a)", "val lemma_mul_pmul_k_right (a b: poly) (k: int) (n n': nat)\n : Lemma (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[ k ])\n (decreases n')\nlet rec lemma_mul_pmul_k_right (a b:poly) (k:int) (n n':nat) : Lemma\n (requires n == poly_length a /\\ n <= n')\n (ensures sum_of_bools 0 n' (mul_element_fun a b k) == (pmul_rec b a n).[k])\n (decreases n')\n =\n PL.lemma_index_all ();\n PL.lemma_shift_define_all ();\n if n' > n then lemma_mul_pmul_k_right a b k n (n' - 1)\n else lemma_mul_pmul_k_base a b k n", "val lemma_mul_wide_add: #t:limb_t -> a:limb t -> b:limb t -> c:limb t -> d:limb t ->\n Lemma (v a * v b + v c + v d < pow2 (2 * bits t))\nlet lemma_mul_wide_add #t a b c d =\n let n = pow2 (bits t) in\n //assert (v a <= n - 1 /\\ v b <= n - 1 /\\ v c <= n - 1 /\\ v d <= n - 1);\n Math.Lemmas.lemma_mult_le_left (v a) (v b) (n - 1);\n Math.Lemmas.lemma_mult_le_right (n - 1) (v a) (n - 1);\n assert (v a * v b + v c + v d <= (n - 1) * (n - 1) + (n - 1) + (n - 1));\n assert ((n - 1) * (n - 1) + (n - 1) + (n - 1) == n * n - 1)", "val lemma_pow_pow_mod_mul: f:S.felem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime) == M.pow f (a * b + c) % S.prime)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_pow_mod f a b }\n S.fmul (M.pow f (a * b) % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.prime;\n }", "val lemma_pow_pow_mod_mul: f:S.felem -> a:nat -> b:nat -> c:nat ->\n Lemma (S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime) == M.pow f (a * b + c) % S.prime)\nlet lemma_pow_pow_mod_mul f a b c =\n calc (==) {\n S.fmul (M.pow (M.pow f a % S.prime) b % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_pow_mod f a b }\n S.fmul (M.pow f (a * b) % S.prime) (M.pow f c % S.prime);\n (==) { lemma_pow_mod_mul f (a * b) c }\n M.pow f (a * b + c) % S.prime;\n }", "val lemma_mod_plus_distr_l: a:int -> b:int -> p:pos -> Lemma\n ((a + b) % p = ((a % p) + b) % p)\nlet lemma_mod_plus_distr_l a b p =\n let q = (a - (a % p)) / p in\n lemma_mod_spec2 a p;\n lemma_mod_plus (a % p + b) q p" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_distribute_left" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_distribute_right" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_distribute_left" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_distribute_right" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_associate" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fst", "name": "Vale.AES.GHash_BE.lemma_div_distribute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_distribute_left" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mod_distributivity_add_right" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_commute" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.distributivity_add_right" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mod_distributivity_add_left" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mod_distributivity_sub_right" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.distributivity_sub_right" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mul_sub_distr" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_def" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_cancel_eq" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul_add" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr_pow" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mod_distributivity_sub_left" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_plus_mul_distr" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.distributivity_sub_left" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_associate" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_degree" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Montgomery.fst", "name": "Hacl.Spec.P256.Montgomery.lemma_mod_mul_assoc" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.BignumQ.Mul.fst", "name": "Hacl.Spec.BignumQ.Mul.lemma_mult_distr_3" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_cancel" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_add_move" }, { "project_name": "hacl-star", "file_name": "Spec.Ed25519.Lemmas.fst", "name": "Spec.Ed25519.Lemmas.lemma_fmul_assoc1" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_mul_mod_assoc" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_one" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_degree" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_one" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.modulo_distributivity" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.modulo_distributivity" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr5" }, { "project_name": "hacl-star", "file_name": "Vale.Bignum.Lemmas.fst", "name": "Vale.Bignum.Lemmas.lemma_add_lo_mul_right" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_swap_mul3" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_a_mul_c_plus_d_mod_e_mul_f_g" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_pow2_div2" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_associate" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_mod_mul_distr" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.ECSM.Lemmas.fst", "name": "Hacl.Spec.K256.ECSM.Lemmas.lemma_aff_point_mul_neg_mul_add" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_div_mod" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr_pow_pow" }, { "project_name": "hacl-star", "file_name": "Spec.K256.Lemmas.fst", "name": "Spec.K256.Lemmas.lemma_div_mod_eq_mul_mod" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_mult_zero" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GF128.fst", "name": "Vale.AES.GF128.lemma_gf128_mul_rev_commute" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_a_mod_b_mul_c_mod_d" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_a_plus_b_pow2_mod2" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_mul_distr_r" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_mod_mul_distr_r" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_mod_plus_distr_r" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Montgomery.fst", "name": "Hacl.Spec.P256.Montgomery.lemma_abc_is_acb" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_element" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_add_zero" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr5_pow52_sub" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_add_mod_assoc" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_zero" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_zero" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.fst", "name": "Vale.Math.Poly2.lemma_mul_reverse" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Exponentiation.Lemmas.fst", "name": "Hacl.Spec.Exponentiation.Lemmas.lemma_mont_mul_assoc" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr_eucl_mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_mod_plus_distr_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Montgomery.Lemmas.fst", "name": "Hacl.Spec.Montgomery.Lemmas.lemma_mod_mul_distr3" }, { "project_name": "hacl-star", "file_name": "Vale.AES.GHash_BE.fsti", "name": "Vale.AES.GHash_BE.lemma_add_mul_zero_high" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_reverse" }, { "project_name": "FStar", "file_name": "FStar.Matrix.fst", "name": "FStar.Matrix.foldm_snoc_distributivity_right_eq" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_plus_distr_r" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_mul_element" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_add_distr" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_mod_add_distr" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Qinv.fst", "name": "Hacl.Spec.K256.Qinv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Qinv.fst", "name": "Hacl.Spec.P256.Qinv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_distr5_pow52" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_fmul_gmul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_fmul_fmul" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_element_rec" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod" }, { "project_name": "hacl-star", "file_name": "Lib.NatMod.fst", "name": "Lib.NatMod.lemma_div_mod_eq_mul_mod2" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Lemmas.Int.fst", "name": "Vale.Math.Lemmas.Int.lemma_mod_plus" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Field52.Lemmas4.fst", "name": "Hacl.Spec.K256.Field52.Lemmas4.lemma_mul_ab" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.MathLemmas.fst", "name": "Hacl.Spec.K256.MathLemmas.lemma_a_div_b_plus_c_mod_d_mul_e" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_mul_distr_l" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Defs.fst", "name": "Vale.Math.Poly2.Defs.lemma_div_mod" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.Lemmas.fst", "name": "Vale.Math.Poly2.Galois.Lemmas.lemma_mul_commute" }, { "project_name": "hacl-star", "file_name": "Vale.Math.Poly2.Galois.fst", "name": "Vale.Math.Poly2.Galois.lemma_mul_pmul_k_right" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Base.fst", "name": "Hacl.Spec.Bignum.Base.lemma_mul_wide_add" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.P256.Finv.fst", "name": "Hacl.Spec.P256.Finv.lemma_pow_pow_mod_mul" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.K256.Finv.fst", "name": "Hacl.Spec.K256.Finv.lemma_pow_pow_mod_mul" }, { "project_name": "FStar", "file_name": "FStar.Math.Lemmas.fst", "name": "FStar.Math.Lemmas.lemma_mod_plus_distr_l" } ], "selected_premises": [ "Vale.Math.Poly2.Lemmas.lemma_monomial_add_degree", "Vale.Math.Poly2.Lemmas.lemma_degree_negative", "Vale.Math.Poly2.Lemmas.lemma_add_all", "Vale.Math.Poly2.Lemmas.lemma_shift_define_forward", "Vale.Math.Poly2.Lemmas.lemma_index", "Vale.Math.Poly2.Lemmas.lemma_add_zero_right", "Vale.Math.Poly2.Lemmas.lemma_or_ones", "Vale.Math.Poly2.Lemmas.lemma_index_all", "Vale.Math.Poly2.Lemmas.lemma_mul_distribute_left", "Vale.Math.Poly2.Lemmas.lemma_pointwise_equal", "Vale.Math.Poly2.Lemmas.lemma_and_ones", "Vale.Math.Poly2.Lemmas.lemma_add_zero_left", "Vale.Math.Poly2.Lemmas.lemma_shift_define", "Vale.Math.Poly2.Lemmas.lemma_degree_is", "Vale.Math.Poly2.Lemmas.lemma_mask_define_all", "Vale.Math.Poly2.Lemmas.lemma_or_consts", "Vale.Math.Poly2.Lemmas.lemma_and_zero", "Vale.Math.Poly2.Lemmas.lemma_or_zero", "Vale.Math.Poly2.Lemmas.lemma_shift_define_all", "Vale.Math.Poly2.Lemmas.lemma_add_define_all", "Vale.Math.Poly2.Lemmas.lemma_and_consts", "Vale.Math.Poly2.Lemmas.lemma_shift_degree", "Vale.Math.Poly2.Lemmas.lemma_mask_define", "Vale.Math.Poly2.Lemmas.lemma_add_define", "Vale.Math.Poly2.Lemmas.lemma_monomial_define", "Vale.Math.Poly2.Lemmas.lemma_bitwise_all", "Vale.Math.Poly2.Lemmas.lemma_or_define", "Vale.Math.Poly2.Lemmas.lemma_monomial_define_all", "Vale.Math.Poly2.Lemmas.lemma_reverse_degree", "Vale.Math.Poly2.Lemmas.lemma_one_degree", "Vale.Math.Poly2.Lemmas.lemma_ones_define", "Vale.Math.Poly2.Lemmas.lemma_and_define", "FStar.Mul.op_Star", "Vale.Math.Poly2.Lemmas.lemma_one_define", "Vale.Math.Poly2.Lemmas.lemma_or_define_all", "Vale.Math.Poly2.Lemmas.lemma_and_define_all", "Vale.Math.Poly2.Lemmas.lemma_mask_degree", "Vale.Math.Poly2.Lemmas.lemma_zero_degree", "Vale.Math.Poly2.Lemmas.lemma_ones_define_all", "Vale.Math.Poly2.Lemmas.lemma_zero_define", "Vale.Math.Poly2.Lemmas.lemma_or_degree", "Vale.Math.Poly2.Lemmas.lemma_reverse_define", "Vale.Math.Poly2.Lemmas.lemma_of_list_degree", "Vale.Math.Poly2.Lemmas.lemma_and_degree", "FStar.Pervasives.reveal_opaque", "Vale.Math.Poly2.Lemmas.lemma_monomial_degree", "Vale.Math.Poly2.Lemmas.lemma_reverse_define_all", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "Vale.Math.Poly2.Lemmas.lemma_and_ones_smt", "Vale.Math.Poly2.Lemmas.lemma_ones_degree", "FStar.Heap.trivial_preorder", "FStar.ST.op_Bang", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Set.subset", "Prims.l_False", "FStar.TSet.subset", "Prims.l_True", "FStar.Math.Lib.div_non_eucl_decr_lemma", "FStar.Set.remove", "FStar.Math.Lib.slash_decr_axiom", "FStar.Math.Lib.signed_modulo", "FStar.Pervasives.coerce_eq", "FStar.Set.add", "FStar.Math.Lib.slash_star_axiom", "FStar.Set.disjoint", "Prims.auto_squash", "FStar.All.all_pre", "FStar.Math.Lib.op_Plus_Percent", "FStar.List.zip", "Prims.min", "FStar.Monotonic.Heap.set", "FStar.Calc.calc_chain_related", "FStar.All.all_post'", "FStar.All.all_wp", "FStar.Pervasives.all_if_then_else", "Prims.subtype_of", "FStar.All.all_post", "FStar.Pervasives.all_ite_wp", "FStar.Set.as_set'", "FStar.Pervasives.all_post_h'", "FStar.List.for_all", "FStar.All.lift_state_all", "FStar.ST.alloc", "FStar.Monotonic.Heap.tset", "FStar.List.nth", "FStar.Pervasives.all_trivial", "FStar.Set.as_set", "FStar.Pervasives.all_wp_h", "FStar.Calc.calc_chain_compatible", "Prims.as_requires", "FStar.Pervasives.all_close_wp", "FStar.List.splitAt", "Prims.abs", "FStar.Pervasives.all_post_h", "FStar.ST.lift_gst_state", "FStar.Math.Lib.div", "FStar.Preorder.transitive", "FStar.List.choose" ], "source_upto_this": "module Vale.Math.Poly2.Lemmas\nopen FStar.Mul\n\nlet lemma_pointwise_equal a b pf =\n FStar.Classical.forall_intro pf;\n lemma_equal a b\n\nlet lemma_index a =\n FStar.Classical.forall_intro (lemma_index_i a)\n\nlet lemma_index_all () =\n FStar.Classical.forall_intro_2 lemma_index_i\n\nlet lemma_zero_define () =\n FStar.Classical.forall_intro lemma_zero_define_i\n\nlet lemma_one_define () =\n FStar.Classical.forall_intro lemma_one_define_i\n\nlet lemma_monomial_define n =\n FStar.Classical.forall_intro (lemma_monomial_define_i n)\n\nlet lemma_monomial_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> monomial n) lemma_monomial_define\n\nlet lemma_ones_define n =\n FStar.Classical.forall_intro (lemma_ones_define_i n)\n\nlet lemma_ones_define_all () =\n FStar.Classical.forall_intro_with_pat (fun n -> ones n) lemma_ones_define\n\nlet lemma_shift_define p n =\n FStar.Classical.forall_intro (lemma_shift_define_i p n)\n\nlet lemma_shift_define_forward p n =\n lemma_shift_define p n\n\nlet lemma_shift_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> shift p n) lemma_shift_define\n\nlet lemma_and_define a b =\n FStar.Classical.forall_intro (lemma_and_define_i a b)\n\nlet lemma_and_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> poly_and a b) lemma_and_define\n\nlet lemma_or_define a b =\n FStar.Classical.forall_intro (lemma_or_define_i a b)\n\nlet lemma_or_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> poly_or a b) lemma_or_define\n\nlet lemma_mask_define p n =\n FStar.Classical.forall_intro (lemma_mask_define_i p n);\n ()\n\nlet lemma_mask_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun p n -> mask p n) lemma_mask_define\n\nlet lemma_reverse_define p n =\n FStar.Classical.forall_intro (lemma_reverse_define_i p n)\n\nlet lemma_reverse_define_all () =\n FStar.Classical.forall_intro_2 lemma_reverse_define\n\nlet lemma_degree_negative a =\n let f (i:int) : Lemma (not a.[i]) =\n lemma_index_i a i\n in\n FStar.Classical.forall_intro f;\n lemma_zero_define ();\n lemma_equal a zero\n\nlet lemma_degree_is a n =\n lemma_index a;\n lemma_index_i a n;\n lemma_degree a\n\nlet lemma_zero_degree =\n lemma_degree zero;\n lemma_zero_define ()\n\nlet lemma_one_degree =\n lemma_one_define ();\n lemma_degree_is one 0\n\nlet lemma_monomial_degree n =\n lemma_monomial_define n;\n lemma_degree_is (monomial n) n\n\nlet lemma_ones_degree n =\n lemma_ones_define n;\n lemma_degree_is (ones n) (n - 1)\n\nlet lemma_shift_degree a n =\n lemma_index a;\n lemma_degree a;\n lemma_shift_define a n;\n lemma_zero_define ();\n if degree a < 0 || degree a + n < 0 then\n (\n lemma_equal zero (shift a n);\n lemma_degree_negative (shift a n)\n )\n else\n lemma_degree_is (shift a n) (degree a + n)\n\nlet lemma_and_degree a b =\n lemma_and_define a b;\n lemma_index_all ();\n lemma_degree a;\n lemma_degree b;\n lemma_degree (poly_and a b)\n\nlet lemma_or_degree a b =\n lemma_or_define a b;\n lemma_index_all ();\n lemma_degree a;\n lemma_degree b;\n lemma_degree_is (poly_or a b) (FStar.Math.Lib.max (degree a) (degree b))\n\nlet lemma_mask_degree a n =\n lemma_mask_define a n;\n lemma_degree (mask a n)\n\nlet lemma_reverse_degree a n =\n lemma_index a;\n lemma_reverse_define a n;\n lemma_degree (reverse a n)\n\nlet lemma_of_list_degree l =\n let len = List.length l in\n let s = seq_of_list l in\n let a = of_seq s in\n assert (forall (i:nat).{:pattern (index s i)} i < len ==> index s i == List.index l i);\n lemma_index a;\n lemma_degree a;\n lemma_zero_define ();\n if len > 0 then\n lemma_degree_is a (len - 1)\n else\n assert (not a.[degree a])\n\nlet lemma_add_define a b =\n FStar.Classical.forall_intro (lemma_add_define_i a b)\n\nlet lemma_add_define_all () =\n FStar.Classical.forall_intro_2_with_pat (fun a b -> (a +. b)) lemma_add_define\n\nlet lemma_add_zero_right = lemma_add_zero\nlet lemma_add_zero_left a = lemma_add_zero a; lemma_add_commute a zero\n\nlet lemma_add_all () =\n FStar.Classical.forall_intro_with_pat (fun a -> a +. zero) lemma_add_zero;\n FStar.Classical.forall_intro_with_pat (fun a -> a +. a) lemma_add_cancel;\n FStar.Classical.forall_intro_2_with_pat (fun a b -> a +. b) lemma_add_commute;\n FStar.Classical.forall_intro_3_with_pat (fun a b c -> a +. (b +. c)) lemma_add_associate\n\nlet lemma_bitwise_all () =\n lemma_index_all ();\n lemma_zero_define ();\n lemma_one_define ();\n lemma_monomial_define_all ();\n lemma_ones_define_all ();\n lemma_shift_define_all ();\n lemma_and_define_all ();\n lemma_or_define_all ();\n lemma_mask_define_all ();\n lemma_reverse_define_all ();\n lemma_add_define_all ();\n ()\n\nlet lemma_monomial_add_degree n a =\n lemma_bitwise_all ();\n lemma_degree_is (monomial n +. a) n;\n lemma_degree_is (a +. monomial n) n;\n ()\n\nlet lemma_and_zero a =\n lemma_bitwise_all ();\n lemma_equal (poly_and a zero) zero;\n lemma_equal (poly_and zero a) zero;\n ()\n\nlet lemma_and_ones a n =\n lemma_bitwise_all ();\n lemma_equal (poly_and a (ones n)) a;\n lemma_equal (poly_and (ones n) a) a;\n ()\n\nlet lemma_and_ones_smt (a:poly) (n:nat) : Lemma\n (requires degree a < n)\n (ensures poly_and a (ones n) == a /\\ poly_and (ones n) a == a)\n [SMTPat (poly_and a (ones n)); SMTPat (poly_and (ones n) a)]\n =\n lemma_and_ones a n\n\nlet lemma_and_consts () =\n let f1 a n : Lemma (degree a < n ==> poly_and a (ones n) == a) =\n if degree a < n then lemma_and_ones a n\n in\n let f2 a n : Lemma (degree a < n ==> poly_and (ones n) a == a) =\n if degree a < n then lemma_and_ones a n\n in\n FStar.Classical.forall_intro lemma_and_zero;\n FStar.Classical.forall_intro_2 f1;\n FStar.Classical.forall_intro_2 f2;\n ()\n\nlet lemma_or_zero a =\n lemma_bitwise_all ();\n lemma_equal (poly_or a zero) a;\n lemma_equal (poly_or zero a) a;\n ()\n\nlet lemma_or_ones a n =\n lemma_bitwise_all ();\n lemma_equal (poly_or a (ones n)) (ones n);\n lemma_equal (poly_or (ones n) a) (ones n);\n ()\n\nlet lemma_or_consts () =\n let f1 a n : Lemma (degree a < n ==> poly_or a (ones n) == (ones n)) =\n if degree a < n then lemma_or_ones a n\n in\n let f2 a n : Lemma (degree a < n ==> poly_or (ones n) a == (ones n)) =\n if degree a < n then lemma_or_ones a n\n in\n FStar.Classical.forall_intro lemma_or_zero;\n FStar.Classical.forall_intro_2 f1;\n FStar.Classical.forall_intro_2 f2;\n ()\n\nlet lemma_mul_distribute_left a b c =\n lemma_mul_commute (a +. b) c;\n lemma_mul_commute a c;\n lemma_mul_commute b c;\n lemma_mul_distribute c a b\n", "sketch": [ "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a. \nStep 2: Then we will use the lemma_mul_distribute to rewrite (b +. c) *. a as b *. a +. c *. a. \nStep 3: Finally, we will use the lemma_mul_commute to rewrite b *. a +. c *. a as a *. b +. a *. c, which is the right-hand side of the equation.", "Step 1: We will first use the commutative property of multiplication to rewrite the left-hand side of the equation as (b +. c) *. a.\nStep 2: Next, we will use the lemma_mul_distribute function to rewrite (b +. c) *. a as (b *. a) +. (c *. a).\nStep 3: Finally, we will use the commutative property of addition to rearrange the terms and obtain (a *. b) +. (a *. c), which is the right-hand side of the equation.", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a. \nStep 2: Then we will use the lemma_mul_distribute to rewrite the right-hand side of the equation as a *. b +. a *. c. \nStep 3: Finally, we will use the lemma_mul_commute to rewrite a *. b as b *. a, resulting in the equation (b +. c) *. a == b *. a +. c *. a, which is the same as the right-hand side of the original equation.", "Step 1: We will first use the lemma_mul_commute to rewrite the expression a *. (b +. c) as (b +. c) *. a.\nStep 2: Then we will use the lemma_mul_distribute to rewrite (b +. c) *. a as b *. a +. c *. a.\nStep 3: Finally, we will use the lemma_mul_commute again to rewrite b *. a +. c *. a as a *. b +. a *. c, which completes the proof.", "Step 1: We will first apply the lemma lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a. \nStep 2: Then, we will apply the lemma lemma_mul_distribute to expand (b +. c) *. a as b *. a +. c *. a. \nStep 3: Finally, we will use the lemma lemma_mul_commute to rearrange the terms to obtain (a *. b) +. (a *. c) on the right-hand side.", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a.\nStep 2: Then, we will use the lemma_mul_distribute to rewrite (b +. c) *. a as b *. a +. c *. a.\nStep 3: Finally, we will use the lemma_add_commute to rearrange the terms and obtain (a *. b) +. (a *. c) on the right-hand side of the equation.", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a. \nStep 2: Then we will use the lemma_mul_distribute to rewrite the right-hand side of the equation as (b *. a) +. (c *. a). \nStep 3: Finally, we will use the lemma_mul_commute to rewrite (b *. a) +. (c *. a) as a *. b +. a *. c, which completes the proof.", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a. \nStep 2: Then, we will use the lemma_mul_distribute to rewrite the right-hand side of the equation as b *. a +. c *. a. \nStep 3: Finally, we will use the lemma_mul_commute to rewrite c *. a as a *. c, resulting in the equation a *. (b +. c) == (a *. b) +. (a *. c).", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a.\nStep 2: Then we will use the lemma_mul_distribute to rewrite (b +. c) *. a as b *. a +. c *. a.\nStep 3: Finally, we will use the lemma_mul_commute to rewrite b *. a +. c *. a as a *. b +. a *. c, which is the right-hand side of the equation.", "Step 1: We will first use the lemma_mul_commute to rewrite the left-hand side of the equation as (b +. c) *. a.\nStep 2: Then we will use the lemma_mul_distribute to rewrite the right-hand side of the equation as b *. a +. c *. a.\nStep 3: Finally, we will use the lemma_mul_commute to rewrite c *. a as a *. c, and then use the lemma_add_commute to rearrange the terms to match the right-hand side of the equation." ], "generated_solution": [ "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_mul_commute a b;\n lemma_mul_commute a c", "lemma_mul_commute (b +. c) a;\nlemma_mul_distribute (b +. c) a b;\nlemma_mul_commute b a;\nlemma_mul_commute c a;\nlemma_mul_distribute a b c;", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_mul_commute b a;\n lemma_mul_commute c a;", "lemma_mul_distribute_right a b c =\n lemma_mul_commute a (b +. c);\n lemma_mul_distribute (b +. c) a b;\n lemma_mul_commute (b *. a) (c *. a);", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_mul_commute (a *. b) (a *. c)", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_add_commute (a *. b) (a *. c)", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute (b +. c) a;\n lemma_mul_commute b a;\n lemma_mul_commute c a;\n lemma_mul_distribute b a c;", "lemma_mul_commute (b +. c) a;\nlemma_mul_distribute a b c;\nlemma_mul_commute c a;", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_mul_commute b a;\n lemma_mul_commute c a;", "lemma_mul_distribute_right a b c =\n lemma_mul_commute (b +. c) a;\n lemma_mul_distribute a b c;\n lemma_mul_commute c a;\n lemma_add_commute (a *. b) (a *. c)" ] }, { "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.reification_aux", "opens_and_abbrevs": [ { "open": "FStar.Tactics.CanonCommSwaps" }, { "open": "FStar.Classical" }, { "open": "FStar.Tactics.V2" }, { "open": "FStar.Reflection.V2" }, { "open": "FStar.List" }, { "open": "FStar.Algebra.CommMonoid" }, { "open": "FStar.Tactics" }, { "open": "FStar.Tactics" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val reification_aux\n (#a #b: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a b)\n (f: (term -> Tac b))\n (mult unit t: term)\n : Tac (exp * list term * vmap a b)", "source_definition": "let rec reification_aux (#a #b:Type) (unquotea:term->Tac a) (ts:list term)\n (vm:vmap a b) (f:term->Tac b)\n (mult unit t : term) : Tac (exp * list term * vmap a b) =\n let hd, tl = collect_app_ref t in\n let fvar (t:term) (ts:list term) (vm:vmap a b) : Tac (exp * list term * vmap a b) =\n match where t ts with\n | Some v -> (Var v, ts, vm)\n | None -> let vfresh = length ts in let z = unquotea t in\n (Var vfresh, ts @ [t], update vfresh z (f t) vm)\n in\n match inspect hd, list_unref tl with\n | Tv_FVar fv, [(t1, Q_Explicit) ; (t2, Q_Explicit)] ->\n if term_eq_old (pack (Tv_FVar fv)) mult\n then (let (e1,ts,vm) = reification_aux unquotea ts vm f mult unit t1 in\n let (e2,ts,vm) = reification_aux unquotea ts vm f mult unit t2 in\n (Mult e1 e2, ts, vm))\n else fvar t ts vm\n | _, _ ->\n if term_eq_old t unit\n then (Unit, ts, vm)\n else fvar t ts vm", "source_range": { "start_line": 240, "start_col": 0, "end_line": 260, "end_col": 21 }, "interleaved": false, "definition": "fun unquotea ts vm f mult unit t ->\n (let _ = FStar.Reflection.V2.Derived.Lemmas.collect_app_ref t in\n (let FStar.Pervasives.Native.Mktuple2 #_ #_ hd tl = _ in\n let fvar =\n fun t ts vm ->\n (let _ = FStar.Tactics.CanonCommMonoid.where t ts in\n (match _ with\n | FStar.Pervasives.Native.Some #_ v -> FStar.Tactics.CanonCommMonoid.Var v, ts, vm\n | FStar.Pervasives.Native.None #_ ->\n let vfresh = FStar.List.Tot.Base.length ts in\n let z = unquotea t in\n let _ =\n let _ = f t in\n FStar.Tactics.CanonCommMonoid.update vfresh z _ vm\n in\n FStar.Tactics.CanonCommMonoid.Var vfresh, ts @ [t], _)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n <:\n FStar.Tactics.Effect.Tac\n ((FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n in\n let _ =\n let _ = FStar.Tactics.NamedView.inspect hd in\n _, FStar.List.Tot.Base.list_unref tl\n in\n (match _ with\n | FStar.Pervasives.Native.Mktuple2\n #_\n #_\n (FStar.Tactics.NamedView.Tv_FVar fv)\n (Prims.Cons\n #_\n (FStar.Pervasives.Native.Mktuple2 #_ #_ t1 FStar.Stubs.Reflection.V2.Data.Q_Explicit)\n (Prims.Cons\n #_\n (FStar.Pervasives.Native.Mktuple2\n #_\n #_\n t2\n FStar.Stubs.Reflection.V2.Data.Q_Explicit)\n (Prims.Nil #_))) ->\n let _ =\n FStar.Stubs.Tactics.V2.Builtins.term_eq_old (FStar.Tactics.NamedView.pack (FStar.Tactics.NamedView.Tv_FVar\n fv))\n mult\n <:\n Prims.bool\n in\n (match _ with\n | true ->\n let _ = FStar.Tactics.CanonCommMonoid.reification_aux unquotea ts vm f mult unit t1 in\n (let FStar.Pervasives.Native.Mktuple3 #_ #_ #_ e1 ts vm = _ in\n let _ =\n FStar.Tactics.CanonCommMonoid.reification_aux unquotea ts vm f mult unit t2\n in\n (let FStar.Pervasives.Native.Mktuple3 #_ #_ #_ e2 ts vm = _ in\n FStar.Tactics.CanonCommMonoid.Mult e1 e2, ts, vm)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b\n | _ -> fvar t ts vm)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b\n | FStar.Pervasives.Native.Mktuple2 #_ #_ _ _ ->\n let _ = FStar.Stubs.Tactics.V2.Builtins.term_eq_old t unit <: Prims.bool in\n (match _ with\n | true -> FStar.Tactics.CanonCommMonoid.Unit, ts, vm\n | _ -> fvar t ts vm)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n <:\n (FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)\n <:\n FStar.Tactics.Effect.Tac\n ((FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)", "effect": "FStar.Tactics.Effect.Tac", "effect_flags": [], "mutual_with": [], "premises": [ "FStar.Tactics.NamedView.term", "Prims.list", "FStar.Tactics.CanonCommMonoid.vmap", "FStar.Stubs.Reflection.Types.term", "Prims.l_or", "Prims.eq2", "Prims.precedes", "FStar.Stubs.Reflection.V2.Data.argv", "FStar.Pervasives.Native.fst", "FStar.Stubs.Reflection.V2.Data.aqualv", "FStar.Stubs.Reflection.Types.fv", "FStar.Tactics.CanonCommMonoid.exp", "FStar.Pervasives.Native.Mktuple3", "FStar.Tactics.CanonCommMonoid.Mult", "FStar.Pervasives.Native.tuple3", "FStar.Tactics.CanonCommMonoid.reification_aux", "Prims.bool", "FStar.Stubs.Tactics.V2.Builtins.term_eq_old", "FStar.Tactics.NamedView.pack", "FStar.Tactics.NamedView.Tv_FVar", "FStar.Tactics.NamedView.named_term_view", "FStar.Pervasives.Native.tuple2", "FStar.Tactics.CanonCommMonoid.Unit", "FStar.Pervasives.Native.Mktuple2", "FStar.List.Tot.Base.list_unref", "FStar.Tactics.NamedView.inspect", "Prims.nat", "FStar.Tactics.CanonCommMonoid.Var", "FStar.List.Tot.Base.op_At", "Prims.Cons", "Prims.Nil", "FStar.Tactics.CanonCommMonoid.update", "FStar.List.Tot.Base.length", "FStar.Pervasives.Native.option", "FStar.Tactics.CanonCommMonoid.where", "FStar.Reflection.V2.Derived.Lemmas.collect_app_ref" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n unquotea: (_: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac a) ->\n ts: Prims.list FStar.Tactics.NamedView.term ->\n vm: FStar.Tactics.CanonCommMonoid.vmap a b ->\n f: (_: FStar.Tactics.NamedView.term -> FStar.Tactics.Effect.Tac b) ->\n mult: FStar.Tactics.NamedView.term ->\n unit: FStar.Tactics.NamedView.term ->\n t: FStar.Tactics.NamedView.term\n -> FStar.Tactics.Effect.Tac\n ((FStar.Tactics.CanonCommMonoid.exp * Prims.list FStar.Tactics.NamedView.term) *\n FStar.Tactics.CanonCommMonoid.vmap a b)", "prompt": "let rec reification_aux\n (#a #b: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a b)\n (f: (term -> Tac b))\n (mult unit t: term)\n : Tac (exp * list term * vmap a b) =\n ", "expected_response": "let hd, tl = collect_app_ref t in\nlet fvar (t: term) (ts: list term) (vm: vmap a b) : Tac ((exp * list term) * vmap a b) =\n match where t ts with\n | Some v -> (Var v, ts, vm)\n | None ->\n let vfresh = length ts in\n let z = unquotea t in\n (Var vfresh, ts @ [t], update vfresh z (f t) vm)\nin\nmatch inspect hd, list_unref tl with\n| Tv_FVar fv, [t1, Q_Explicit ; t2, Q_Explicit] ->\n if term_eq_old (pack (Tv_FVar fv)) mult\n then\n (let e1, ts, vm = reification_aux unquotea ts vm f mult unit t1 in\n let e2, ts, vm = reification_aux unquotea ts vm f mult unit t2 in\n (Mult e1 e2, ts, vm))\n else fvar t ts vm\n| _, _ -> if term_eq_old t unit then (Unit, ts, vm) else fvar t ts vm", "source": { "project_name": "FStar", "file_name": "ulib/FStar.Tactics.CanonCommMonoid.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Tactics.CanonCommMonoid.fst", "checked_file": "dataset/FStar.Tactics.CanonCommMonoid.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Tactics.Util.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Tactics.CanonCommSwaps.fst.checked", "dataset/FStar.Reflection.V2.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Order.fst.checked", "dataset/FStar.List.Tot.Properties.fst.checked", "dataset/FStar.List.Tot.Base.fst.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.List.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Algebra.CommMonoid.fst.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "let dump m = if debugging () then dump m", "let var : eqtype = nat", "exp", "Unit", "Unit", "Unit", "Var", "Var", "Var", "Mult", "Mult", "Mult", "let rec exp_to_string (e:exp) : string =\n match e with\n | Unit -> \"Unit\"\n | Var x -> \"Var \" ^ string_of_int (x <: var)\n | Mult e1 e2 -> \"Mult (\" ^ exp_to_string e1\n ^ \") (\" ^ exp_to_string e2 ^ \")\"", "let vmap (a b:Type) = list (var * (a*b)) * (a * b)", "let const (#a #b:Type) (xa:a) (xb:b) : vmap a b = [], (xa,xb)", "let select (#a #b:Type) (x:var) (vm:vmap a b) : Tot a =\n match assoc #var #(a * b) x (fst vm) with\n | Some (a, _) -> a\n | _ -> fst (snd vm)", "let select_extra (#a #b:Type) (x:var) (vm:vmap a b) : Tot b =\n match assoc #var #(a * b) x (fst vm) with\n | Some (_, b) -> b\n | _ -> snd (snd vm)", "let update (#a #b:Type) (x:var) (xa:a) (xb:b) (vm:vmap a b) : vmap a b =\n (x, (xa, xb))::fst vm, snd vm", "let rec mdenote (#a #b:Type) (m:cm a) (vm:vmap a b) (e:exp) : Tot a =\n match e with\n | Unit -> CM?.unit m\n | Var x -> select x vm\n | Mult e1 e2 -> CM?.mult m (mdenote m vm e1) (mdenote m vm e2)", "let rec xsdenote (#a #b:Type) (m:cm a) (vm:vmap a b) (xs:list var) : Tot a =\n match xs with\n | [] -> CM?.unit m\n | [x] -> select x vm\n | x::xs' -> CM?.mult m (select x vm) (xsdenote m vm xs')", "let rec flatten (e:exp) : list var =\n match e with\n | Unit -> []\n | Var x -> [x]\n | Mult e1 e2 -> flatten e1 @ flatten e2", "let rec flatten_correct_aux (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs1 xs2:list var) :\n Lemma (xsdenote m vm (xs1 @ xs2) == CM?.mult m (xsdenote m vm xs1)\n (xsdenote m vm xs2)) =\n match xs1 with\n | [] -> CM?.identity m (xsdenote m vm xs2)\n | [x] -> if (Nil? xs2) then right_identity m (select x vm)\n | x::xs1' -> (CM?.associativity m (select x vm)\n (xsdenote m vm xs1') (xsdenote m vm xs2);\n flatten_correct_aux m vm xs1' xs2)", "let rec flatten_correct (#a #b:Type) (m:cm a) (vm:vmap a b) (e:exp) :\n Lemma (mdenote m vm e == xsdenote m vm (flatten e)) =\n match e with\n | Unit | Var _ -> ()\n | Mult e1 e2 -> flatten_correct_aux m vm (flatten e1) (flatten e2);\n flatten_correct m vm e1; flatten_correct m vm e2", "let permute (b:Type) = a:Type -> vmap a b -> list var -> list var", "let permute_correct (#b:Type) (p:permute b) =\n #a:Type -> m:cm a -> vm:vmap a b -> xs:list var ->\n Lemma (xsdenote m vm xs == xsdenote m vm (p a vm xs))", "let rec apply_swap_aux_correct (#a #b:Type) (n:nat) (m:cm a) (vm:vmap a b)\n (xs:list var) (s:swap (length xs + n)) :\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swap_aux n xs s)))\n (decreases xs) =\n match xs with\n | [] | [_] -> ()\n | x1 :: x2 :: xs' ->\n if n = (s <: nat)\n then (// x1 + (x2 + xs') =a (x1 + x2) + xs'\n // =c (x2 + x1) + xs' = a x2 + (x1 + xs')\n let a = CM?.associativity m in\n a (select x1 vm) (select x2 vm) (xsdenote m vm xs');\n a (select x2 vm) (select x1 vm) (xsdenote m vm xs');\n CM?.commutativity m (select x1 vm) (select x2 vm))\n else apply_swap_aux_correct (n+1) m vm (x2 :: xs') s", "let apply_swap_correct (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs:list var) (s:swap (length xs)):\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swap xs s)))\n (decreases xs) = apply_swap_aux_correct 0 m vm xs s", "let rec apply_swaps_correct (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs:list var) (ss:list (swap (length xs))):\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swaps xs ss)))\n (decreases ss) =\n match ss with\n | [] -> ()\n | s::ss' -> apply_swap_correct m vm xs s;\n apply_swaps_correct m vm (apply_swap xs s) ss'", "let permute_via_swaps (#b:Type) (p:permute b) =\n (#a:Type) -> (vm:vmap a b) -> xs:list var ->\n Lemma (exists ss. p a vm xs == apply_swaps xs ss)", "let permute_via_swaps_correct_aux\n (#b:Type) (p:permute b) (pvs:permute_via_swaps p)\n (#a:Type) (m:cm a) (vm:vmap a b) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (p a vm xs)) =\n pvs vm xs;\n assert(exists ss. p a vm xs == apply_swaps xs ss);\n exists_elim (xsdenote m vm xs == xsdenote m vm (p a vm xs))\n (() <: squash (exists ss. p a vm xs == apply_swaps xs ss))\n (fun ss -> apply_swaps_correct m vm xs ss)", "let permute_via_swaps_correct\n (#b:Type) (p:permute b) (pvs:permute_via_swaps p) : permute_correct p =\n permute_via_swaps_correct_aux p pvs", "let sort : permute unit =\n (fun a vm -> List.Tot.Base.sortWith #nat (compare_of_bool (<)))", "let sortWith (#b:Type) (f:nat -> nat -> int) : permute b =\n (fun a vm -> List.Tot.Base.sortWith #nat f)", "let sort_via_swaps (#a:Type) (vm : vmap a unit) (xs:list var) :\n Lemma (exists ss. sort a vm xs == apply_swaps xs ss) =\n List.Tot.Properties.sortWith_permutation #nat (compare_of_bool (<)) xs;\n let ss = equal_counts_implies_swaps #nat xs (sort a vm xs) in\n assert (sort a vm xs == apply_swaps xs ss)", "let sortWith_via_swaps (#a #b:Type) (f:nat -> nat -> int)\n (vm : vmap a b) (xs:list var) :\n Lemma (exists ss. sortWith #b f a vm xs == apply_swaps xs ss) =\n List.Tot.Properties.sortWith_permutation #nat f xs;\n let ss = equal_counts_implies_swaps #nat xs (sortWith #b f a vm xs) in\n assert (sortWith #b f a vm xs == apply_swaps xs ss)", "let sort_correct_aux (#a:Type) (m:cm a) (vm:vmap a unit) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (sort a vm xs)) =\n permute_via_swaps_correct #unit sort sort_via_swaps m vm xs", "let sortWith_correct_aux (#a #b:Type) (f:nat -> nat -> int) (m:cm a) (vm:vmap a b) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (sortWith #b f a vm xs)) =\n permute_via_swaps_correct (sortWith f) (fun #a -> sortWith_via_swaps f) m vm xs", "let sort_correct : permute_correct #unit sort = sort_correct_aux", "let sortWith_correct (#b:Type) (f:nat -> nat -> int) :\n permute_correct #b (sortWith #b f) =\n (fun #a -> sortWith_correct_aux #a #b f)", "let canon (#a #b:Type) (vm:vmap a b) (p:permute b) (e:exp) = p a vm (flatten e)", "let canon_correct (#a #b:Type) (p:permute b) (pc:permute_correct p)\n (m:cm a) (vm:vmap a b) (e:exp) :\n Lemma (mdenote m vm e == xsdenote m vm (canon vm p e)) =\n flatten_correct m vm e; pc m vm (flatten e)", "let monoid_reflect (#a #b:Type) (p:permute b) (pc:permute_correct p)\n (m:cm a) (vm:vmap a b) (e1 e2:exp)\n (_ : squash (xsdenote m vm (canon vm p e1) ==\n xsdenote m vm (canon vm p e2)))\n : squash (mdenote m vm e1 == mdenote m vm e2) =\n canon_correct p pc m vm e1; canon_correct p pc m vm e2", "let rec where_aux (n:nat) (x:term) (xs:list term) :\n Tac (option nat) =\n match xs with\n | [] -> None\n | x'::xs' -> if term_eq_old x x' then Some n else where_aux (n+1) x xs'", "let where = where_aux 0" ], "closest": [ "val reification_aux\n (#a: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a)\n (add opp mone mult t: term)\n : Tac (polynomial a * list term * vmap a)\nlet rec reification_aux (#a:Type) (unquotea:term -> Tac a) (ts:list term) (vm:vmap a) (add opp mone mult t: term) : Tac (polynomial a * list term * vmap a) =\n // ddump (\"term = \" ^ term_to_string t ^ \"\\n\");\n let hd, tl = collect_app_ref t in\n match inspect hd, list_unref tl with\n | Tv_FVar fv, [(t1, _) ; (t2, _)] ->\n //ddump (\"add = \" ^ term_to_string add ^ \"\n // \\nmul = \" ^ term_to_string mult);\n //ddump (\"fv = \" ^ term_to_string (pack (Tv_FVar fv)));\n let binop (op:polynomial a -> polynomial a -> polynomial a) : Tac (polynomial a * list term * vmap a) =\n let (e1, ts, vm) = reification_aux unquotea ts vm add opp mone mult t1 in\n let (e2, ts, vm) = reification_aux unquotea ts vm add opp mone mult t2 in\n (op e1 e2, ts, vm)\n in\n if term_eq (pack (Tv_FVar fv)) add then binop Pplus else\n if term_eq (pack (Tv_FVar fv)) mult then binop Pmult else\n make_fvar t unquotea ts vm\n | Tv_FVar fv, [(t1, _)] ->\n let monop (op:polynomial a -> polynomial a) : Tac (polynomial a * list term * vmap a) =\n let (e, ts, vm) = reification_aux unquotea ts vm add opp mone mult t1 in\n (op e, ts, vm)\n in\n if term_eq (pack (Tv_FVar fv)) opp then monop Popp else\n make_fvar t unquotea ts vm\n | Tv_Const _, [] -> Pconst (unquotea t), ts, vm\n | _, _ -> make_fvar t unquotea ts vm", "val reification_aux (#a: Type) (ts: list term) (am: amap a) (mult unit t: term)\n : Tac (exp * list term * amap a)\nlet rec reification_aux (#a:Type) (ts:list term) (am:amap a)\n (mult unit t : term) : Tac (exp * list term * amap a) =\n let hd, tl = collect_app_ref t in\n let fatom (t:term) (ts:list term) (am:amap a) : Tac (exp * list term * amap a) =\n match where t ts with\n | Some v -> (Atom v, ts, am)\n | None -> let vfresh = length ts in let z = unquote t in\n (Atom vfresh, ts @ [t], update vfresh z am)\n in\n match inspect hd, list_unref tl with\n | Tv_FVar fv, [(t1, Q_Explicit) ; (t2, Q_Explicit)] ->\n if term_eq (pack (Tv_FVar fv)) mult\n then (let (e1,ts,am) = reification_aux ts am mult unit t1 in\n let (e2,ts,am) = reification_aux ts am mult unit t2 in\n (Mult e1 e2, ts, am))\n else fatom t ts am\n | _, _ ->\n if term_eq t unit\n then (Unit, ts, am)\n else fatom t ts am", "val reification_aux (#a: Type) (mult unit me: term) : Tac (exp a)\nlet rec reification_aux (#a:Type) (mult unit me : term) : Tac (exp a) =\n let hd, tl = collect_app_ref me in\n let tl = list_unref tl in\n match inspect hd, tl with\n | Tv_FVar fv, [(me1, Q_Explicit) ; (me2, Q_Explicit)] ->\n if term_eq_old (pack (Tv_FVar fv)) mult\n then Mult (reification_aux mult unit me1) (reification_aux mult unit me2)\n else Var (unquote me)\n | _, _ ->\n if term_eq_old me unit\n then Unit\n else Var (unquote me)", "val reification_aux (ts: list term) (am: amap term) (mult unit t: term)\n : Tac (exp * list term * amap term)\nlet rec reification_aux (ts:list term) (am:amap term)\n (mult unit t : term) : Tac (exp * list term * amap term) =\n let hd, tl = collect_app_ref t in\n match inspect_unascribe hd, List.Tot.Base.list_unref tl with\n | Tv_FVar fv, [(t1, Q_Explicit) ; (t2, Q_Explicit)] ->\n if term_eq_old (pack (Tv_FVar fv)) mult\n then (let (e1, ts, am) = reification_aux ts am mult unit t1 in\n let (e2, ts, am) = reification_aux ts am mult unit t2 in\n (Mult e1 e2, ts, am))\n else fatom t ts am\n | _, _ ->\n if term_eq_old t unit\n then (Unit, ts, am)\n else fatom t ts am", "val reification_aux (ts: list term) (am: amap term) (mult unit t: term)\n : Tac (exp * list term * amap term)\nlet rec reification_aux (ts:list term) (am:amap term)\n (mult unit t : term) : Tac (exp * list term * amap term) =\n let hd, tl = collect_app t in\n match inspect hd, tl with\n | Tv_FVar fv, [(t1, Q_Explicit) ; (t2, Q_Explicit)] ->\n if term_eq (pack (Tv_FVar fv)) mult\n then (let (e1, ts, am) = reification_aux ts am mult unit t1 in\n let (e2, ts, am) = reification_aux ts am mult unit t2 in\n (Mult e1 e2, ts, am))\n else fatom t ts am\n | _, _ ->\n if term_eq t unit\n then (Unit, ts, am)\n else fatom t ts am", "val reification\n (#a: Type)\n (unquotea: (term -> Tac a))\n (quotea: (a -> Tac term))\n (tadd topp tmone tmult: term)\n (munit: a)\n (ts: list term)\n : Tac (list (polynomial a) * vmap a)\nlet reification (#a:Type)\n (unquotea:term -> Tac a) (quotea:a -> Tac term) (tadd topp tmone tmult:term) (munit:a) (ts:list term) : Tac (list (polynomial a) * vmap a) =\n // Be careful not to normalize operations too much\n // E.g. we don't want to turn ( +% ) into (a + b) % prime\n // or we won't be able to spot ring operations\n let add = tadd in\n let opp = topp in\n let mone = tmone in\n let mult = tmult in\n let ts = Tactics.Util.map (norm_term steps) ts in\n //ddump (\"add = \" ^ term_to_string add ^ \"\\nmult = \" ^ term_to_string mult);\n let (es, _, vm) =\n Tactics.Util.fold_left\n (fun (es, vs, vm) t ->\n let (e, vs, vm) = reification_aux unquotea vs vm add opp mone mult t\n in (e::es, vs, vm))\n ([],[], ([], munit)) ts\n in (List.Tot.Base.rev es, vm)", "val make_fvar (#a: Type) (t: term) (unquotea: (term -> Tac a)) (ts: list term) (vm: vmap a)\n : Tac (polynomial a * list term * vmap a)\nlet make_fvar (#a:Type) (t:term) (unquotea:term -> Tac a) (ts:list term)\n (vm:vmap a) : Tac (polynomial a * list term * vmap a) =\n match find t ts with\n | Some v -> (Pvar v, ts, vm)\n | None ->\n let vfresh = length ts in\n let z = unquotea t in\n (Pvar vfresh, ts @ [t], update vfresh z vm)", "val reification (eq m: term) (ts: list term) (am: amap term) (t: term)\n : Tac (exp * list term * amap term)\nlet reification (eq: term) (m: term) (ts:list term) (am:amap term) (t:term) :\n Tac (exp * list term * amap term) =\n let mult = norm_term [iota; zeta; delta] (`CM?.mult (`#m)) in\n let unit = norm_term [iota; zeta; delta] (`CM?.unit (`#m)) in\n let t = norm_term [iota; zeta] t in\n reification_aux ts am mult unit t", "val reification (eq m: term) (ts: list term) (am: amap term) (t: term)\n : Tac (exp * list term * amap term)\nlet reification (eq: term) (m: term) (ts:list term) (am:amap term) (t:term) :\n Tac (exp * list term * amap term) =\n let mult = norm_term [iota; zeta; delta] (`CE.CM?.mult (`#m)) in\n let unit = norm_term [iota; zeta; delta] (`CE.CM?.unit (`#m)) in\n let t = norm_term [iota; zeta] t in\n reification_aux ts am mult unit t", "val reification (#a: Type) (m: cm a) (ts: list term) (am: amap a) (t: term)\n : Tac (exp * list term * amap a)\nlet reification (#a:Type) (m:cm a) (ts:list term) (am:amap a) (t:term) :\n Tac (exp * list term * amap a) =\n let mult = norm_term [delta;zeta;iota] (quote (CM?.mult m)) in\n let unit = norm_term [delta;zeta;iota] (quote (CM?.unit m)) in\n let t = norm_term [delta;zeta;iota] t in\n reification_aux ts am mult unit t", "val canon_semiring_aux\n (a: Type)\n (ta: term)\n (unquotea: (term -> Tac a))\n (quotea: (a -> Tac term))\n (tr tadd topp tmone tmult: term)\n (munit: a)\n : Tac unit\nlet canon_semiring_aux\n (a: Type) (ta: term) (unquotea: term -> Tac a) (quotea: a -> Tac term)\n (tr tadd topp tmone tmult: term)\n (munit: a)\n : Tac unit\n=\n focus (fun () ->\n norm []; // Do not normalize anything implicitly\n let g = cur_goal () in\n match term_as_formula g with\n | Comp (Eq (Some t)) t1 t2 ->\n begin\n //ddump (\"t1 = \" ^ term_to_string t1 ^ \"\\nt2 = \" ^ term_to_string t2);\n if term_eq t ta then\n begin\n match reification unquotea quotea tadd topp tmone tmult munit [t1; t2] with\n | ([e1; e2], vm) ->\n(*\n ddump (term_to_string t1);\n ddump (term_to_string t2);\n let r : cr a = unquote tr in\n ddump (\"vm = \" ^ term_to_string (quote vm) ^ \"\\n\" ^\n \"before = \" ^ term_to_string (norm_term steps\n (quote (interp_p r vm e1 == interp_p r vm e2))));\n dump (\"expected after = \" ^ term_to_string (norm_term steps\n (quote (\n interp_cs r vm (polynomial_simplify r e1) ==\n interp_cs r vm (polynomial_simplify r e2)))));\n*)\n let tvm = quote_vm ta quotea vm in\n let te1 = quote_polynomial ta quotea e1 in\n //ddump (\"te1 = \" ^ term_to_string te1);\n let te2 = quote_polynomial ta quotea e2 in\n //ddump (\"te2 = \" ^ term_to_string te2);\n mapply (`(semiring_reflect\n #(`#ta) (`#tr) (`#tvm) (`#te1) (`#te2) (`#t1) (`#t2)));\n //ddump \"Before canonization\";\n canon_norm ();\n //ddump \"After canonization\";\n later ();\n //ddump \"Before normalizing left-hand side\";\n canon_norm ();\n //ddump \"After normalizing left-hand side\";\n trefl ();\n //ddump \"Before normalizing right-hand side\";\n canon_norm ();\n //ddump \"After normalizing right-hand side\";\n trefl ()\n | _ -> fail \"Unexpected\"\n end\n else fail \"Found equality, but terms do not have the expected type\"\n end\n | _ -> fail \"Goal should be an equality\")", "val reification (#a: Type) (m: monoid a) (me: term) : Tac (exp a)\nlet reification (#a:Type) (m:monoid a) (me:term) : Tac (exp a) =\n let mult = norm_term [delta;zeta;iota] (quote (Monoid?.mult m)) in\n let unit = norm_term [delta;zeta;iota] (quote (Monoid?.unit m)) in\n let me = norm_term [delta;zeta;iota] me in\n // dump (\"mult = \" ^ term_to_string mult ^\n // \"; unit = \" ^ term_to_string unit ^\n // \"; me = \" ^ term_to_string me);\n reification_aux mult unit me", "val mapply (t: term) : Tac unit\nlet mapply (t : term) : Tac unit =\n apply_squash_or_lem 10 t", "val zip : (#a:Type) -> (#b:Type) -> list a -> list b -> Tac (list (a * b))\nlet rec zip #a #b l1 l2 = match l1, l2 with\n | x::xs, y::ys -> (x,y) :: (zip xs ys)\n | _ -> []", "val mapply (#ty: Type) {| _: termable ty |} (x: ty) : Tac unit\nlet mapply (#ty:Type) {| termable ty |} (x : ty) : Tac unit =\n let t = to_term x in\n apply_squash_or_lem 10 t", "val apply (t: term) : Tac unit\nlet apply (t : term) : Tac unit =\n t_apply true false false t", "val apply (t: term) : Tac unit\nlet apply (t : term) : Tac unit =\n t_apply true false false t", "val repeat' (#a: _) (f: (unit -> Tac a)) : Tac unit\nlet repeat' #a (f: unit -> Tac a) : Tac unit =\n let _ = repeat f in ()", "val quote_vm (#a: Type) (ta: term) (quotea: (a -> Tac term)) (vm: vmap a) : Tac term\nlet quote_vm (#a:Type) (ta: term) (quotea:a -> Tac term) (vm:vmap a) : Tac term =\n let quote_map_entry (p:(nat * a)) : Tac term =\n mk_app (`Mktuple2) [(`nat, Q_Implicit); (ta, Q_Implicit);\n (pack (Tv_Const (C_Int (fst p))), Q_Explicit);\n (quotea (snd p), Q_Explicit)] in\n let tyentry = mk_e_app (`tuple2) [(`nat); ta] in\n let tlist = quote_list tyentry quote_map_entry (fst vm) in\n let tylist = mk_e_app (`list) [tyentry] in\n mk_app (`Mktuple2) [(tylist, Q_Implicit); (ta, Q_Implicit);\n (tlist, Q_Explicit); (quotea (snd vm), Q_Explicit)]", "val mapply0 (t: term) : Tac unit\nlet mapply0 (t : term) : Tac unit =\n apply_squash_or_lem 10 t", "val is_reifiable (m_mult m_unit me: term) : Tac bool\nlet is_reifiable (m_mult:term) (m_unit:term) (me:term) : Tac bool =\n let hd, tl = collect_app_ref me in\n match inspect hd with\n | Tv_FVar fv ->\n // if unify (pack (Tv_FVar fv)) (quote (Monoid?.mult m)) then -- doesn't work\n let t1 = norm_term [delta;zeta;iota] (pack (Tv_FVar fv)) in\n term_eq t1 m_mult\n | _ ->\n term_eq (norm_term [delta;zeta;iota] me) m_unit", "val is_true: t: term -> Prims.unit -> Tac unit\nlet is_true (t:term) () : Tac unit =\n match term_as_formula t with\n | True_ -> exact (`())\n | _ -> raise Goal_not_trivial", "val bind\n (a b st0 st1 st2: Type)\n (labs1 labs2: erased (list eff_label))\n (c: repr a st0 st1 labs1)\n (f: (x: a -> repr b st1 st2 labs2))\n : Tot (repr b st0 st2 (labs1 @ labs2))\nlet rec bind (a b : Type)\n (st0 st1 st2 : Type)\n (labs1 labs2 : erased (list eff_label)) // forgetting the erased here gives an odd error ar the effect defn\n (c : repr a st0 st1 labs1)\n (f : (x:a -> repr b st1 st2 labs2))\n : Tot (repr b st0 st2 (labs1@labs2))\n = match c with\n | Return x -> f x\n | Op a i k ->\n let k' o : repr b _ _ (labs1@labs2) =\n bind _ _ _ _ _ _ _ (k o) f\n in\n Op a i k'", "val felem_mul (a b out:F.felem) : Stack unit\n (requires fun h ->\n live h a /\\ live h b /\\ live h out /\\\n eq_or_disjoint out a /\\ eq_or_disjoint out b /\\ eq_or_disjoint a b /\\\n F.inv_lazy_reduced2 h a /\\ F.inv_lazy_reduced2 h b)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F.inv_lazy_reduced2 h1 out /\\\n F.feval h1 out == S.fmul (F.feval h0 a) (F.feval h0 b))\nlet felem_mul a b out =\n F.fmul out a b", "val par\n (#aL:Type u#a)\n (#aR:Type u#a)\n (#preL:vprop)\n (#postL:aL -> vprop)\n (#preR:vprop)\n (#postR:aR -> vprop)\n ($f:unit -> STT aL preL postL)\n ($g:unit -> STT aR preR postR)\n : STT (aL & aR)\n (preL `star` preR)\n (fun y -> postL (fst y) `star` postR (snd y))\nlet par #aL #aR #preL #postL #preR #postR f g =\n let f : unit -> SE.SteelT aL preL postL = fun _ -> f () in\n let g : unit -> SE.SteelT aR preR postR = fun _ -> g () in \n let p\n : unit -> SE.SteelT (aL & aR)\n (preL `star` preR)\n (fun y -> postL (fst y) `star` postR (snd y))\n = fun _ -> SE.par f g in\n coerce_steel p", "val tpair (#a #b: _) (x: a) : Tac (b -> Tac (a * b))\nlet tpair #a #b (x : a) : Tac (b -> Tac (a * b)) =\n fun (y: b) -> (x, y)", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val mul (a:t) (b:t) : Pure t\n (requires (size (v a * v b) n))\n (ensures (fun c -> v a * v b = v c))\nlet mul a b = Mk (mul (v a) (v b))", "val apply (t: T.term) : T.Tac unit\nlet apply (t:T.term) : T.Tac unit =\n T.t_apply true false true t", "val apply (t: T.term) : T.Tac unit\nlet apply (t:T.term) : T.Tac unit =\n T.t_apply true false true t", "val alloc \n (#a:Type0)\n (x:a)\n (n:SZ.t)\n : stt (vec a)\n (requires emp)\n (ensures fun v ->\n pts_to v (Seq.create (SZ.v n) x) **\n pure (length v == SZ.v n /\\ is_full_vec v))\nlet alloc x n = A.alloc x n", "val reify_trivial\n (#a: Type)\n (#l: memory_invariant)\n (#p1 #p2: parser)\n (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l))\n : Tot (repr a p1 p2 l)\nlet reify_trivial\n (#a: Type)\n (#l: memory_invariant)\n (#p1 #p2: parser)\n (f: (unit -> EWrite a p1 p2 (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l))\n: Tot (repr a p1 p2 l)\n= reify (f ())", "val pose (t: term) : Tac binding\nlet pose (t:term) : Tac binding =\n apply (`__cut);\n flip ();\n exact t;\n intro ()", "val add_elims_aux\n (#g: env)\n (#ctxt #frame: term)\n (f: (vprop -> T.Tac bool))\n (mk: mk_t)\n (ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs: env{disjoint uvs g})\n : T.Tac\n (bool &\n (g': env{env_extends g' g /\\ disjoint uvs g'} &\n ctxt': term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\nlet add_elims_aux (#g:env) (#ctxt:term) (#frame:term)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (bool & \n (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\n = let (| ctxt', ctxt'_typing, k |) = canon_right ctxt_frame_typing f in\n let progress, (| g', ctxt'', ctxt''_typing, k' |) =\n elim_all f mk ctxt'_typing uvs in\n progress, (| g', ctxt'', ctxt''_typing, k_elab_trans k k' |)", "val times_2:\n out:felem\n -> a:felem ->\n Stack unit\n (requires fun h -> live h out /\\ live h a /\\ F51.mul_inv_t h a)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.felem_fits h1 out (2, 4, 2, 2, 2) /\\\n F51.fevalh h1 out == 2 `SC.fmul` F51.fevalh h0 a\n )\nlet times_2 out a =\n (**) let h0 = ST.get() in\n let a0 = a.(0ul) in\n let a1 = a.(1ul) in\n let a2 = a.(2ul) in\n let a3 = a.(3ul) in\n let a4 = a.(4ul) in\n let o0 = u64 2 *. a0 in\n let o1 = u64 2 *. a1 in\n let o2 = u64 2 *. a2 in\n let o3 = u64 2 *. a3 in\n let o4 = u64 2 *. a4 in\n make_u64_5 out o0 o1 o2 o3 o4;\n\n (**) let h1 = ST.get() in\n (**) assert (S51.felem_fits1 a0 1);\n (**) assert (F51.felem_fits h1 out (2, 4, 2, 2, 2));\n\n calc (==) {\n (2 * (F51.fevalh h0 a)) % SC.prime;\n (==) { calc (==) {\n F51.fevalh h0 a;\n (==) { }\n S51.as_nat5 (a0, a1, a2, a3, a4) % SC.prime;\n }\n }\n (2 * (S51.as_nat5 (a0, a1, a2, a3, a4) % SC.prime)) % SC.prime;\n (==) { FStar.Math.Lemmas.lemma_mod_mul_distr_r 2 (S51.as_nat5 (a0, a1, a2, a3, a4)) SC.prime }\n (2 * S51.as_nat5 (a0, a1, a2, a3, a4)) % SC.prime;\n (==) { calc (==) {\n 2 * S51.as_nat5 (a0, a1, a2, a3, a4);\n (==) { SL51.lemma_smul_felem5 (u64 2) (a0, a1, a2, a3, a4) }\n 2 * v a0 + 2 * v a1 * S51.pow51 + 2 * v a2 * S51.pow51 * S51.pow51 +\n 2 * v a3 * S51.pow51 * S51.pow51 * S51.pow51 +\n 2 * v a4 * S51.pow51 * S51.pow51 * S51.pow51 * S51.pow51;\n (==) {\n assert_norm (2 * S51.pow51 < pow2 64);\n assert_norm (4 * S51.pow51 < pow2 64);\n FStar.Math.Lemmas.small_mod (2 * v a0) (pow2 64);\n FStar.Math.Lemmas.small_mod (2 * v a1) (pow2 64);\n FStar.Math.Lemmas.small_mod (2 * v a2) (pow2 64);\n FStar.Math.Lemmas.small_mod (2 * v a3) (pow2 64);\n FStar.Math.Lemmas.small_mod (2 * v a4) (pow2 64)\n }\n S51.as_nat5 (u64 2 *. a0, u64 2 *. a1, u64 2 *. a2, u64 2 *. a3, u64 2 *. a4);\n }\n }\n S51.as_nat5 (u64 2 *. a0, u64 2 *. a1, u64 2 *. a2, u64 2 *. a3, u64 2 *. a4) % SC.prime;\n (==) { }\n F51.fevalh h1 out;\n }", "val infer (g: R.env) (sg: list (var & R.term)) (e: stlc_exp unit)\n : T.Tac (e: stlc_exp R.term & R.term)\nlet rec infer (g:R.env)\n (sg:list (var & R.term))\n (e:stlc_exp unit)\n : T.Tac (e:stlc_exp R.term & R.term)\n = match e with\n | EBVar _ -> \n T.fail \"Not locally nameless!\"\n \n | EUnit ->\n (| EUnit, `TUnit |)\n\n\n | EVar x ->\n begin\n match lookup sg x with\n | None -> T.fail \"Unbound variable\"\n | Some ht -> (| EVar x, ht |)\n end\n\n | ELam _ e ->\n let t0 = new_hole g in\n let x = fresh sg in\n let (| e, t |) = infer g ((x, t0) :: sg) (open_exp e x) in\n (| ELam t0 (close_exp e x), `(TArrow (`#(t0)) (`#(t))) |)\n\n | EApp e1 e2 ->\n let (| e1, t1 |) = infer g sg e1 in\n let (| e2, t2 |) = infer g sg e2 in\n let res = new_hole g in\n let ht = (`TArrow (`#(t2)) (`#(res))) in\n if T.unify_env g t1 ht\n then (| EApp e1 e2, res |)\n else T.fail (\"Expected arrow type \" ^ T.term_to_string res ^ \n \" Got \" ^ T.term_to_string t1)", "val and_elim (t: term) : Tac unit\nlet and_elim (t : term) : Tac unit =\n begin\n try apply_lemma (`(__and_elim (`#t)))\n with | _ -> apply_lemma (`(__and_elim' (`#t)))\n end", "val and_elim (t: term) : Tac unit\nlet and_elim (t : term) : Tac unit =\n begin\n try apply_lemma (`(__and_elim (`#t)))\n with | _ -> apply_lemma (`(__and_elim' (`#t)))\n end", "val fatom (t: term) (ts: list term) (am: amap term) : Tac (exp * list term * amap term)\nlet fatom (t:term) (ts:list term) (am:amap term) : Tac (exp * list term * amap term) =\n match where t ts with\n | Some v -> (Atom v, ts, am)\n | None ->\n let vfresh = List.Tot.Base.length ts in\n let t = norm_term [iota; zeta] t in\n (Atom vfresh, ts `List.Tot.append` [t], update vfresh t am)", "val fatom (t: term) (ts: list term) (am: amap term) : Tac (exp * list term * amap term)\nlet fatom (t:term) (ts:list term) (am:amap term) : Tac (exp * list term * amap term) =\n match where t ts with\n | Some v -> (Atom v, ts, am)\n | None ->\n let vfresh = length ts in\n let t = norm_term [iota; zeta] t in\n (Atom vfresh, ts @ [t], update vfresh t am)", "val recheck: #g: env -> #e: term -> #ty: typ -> Prims.unit -> T.Tac (tot_typing g e ty)\nlet recheck (#g:env) (#e:term) (#ty: typ) () : T.Tac (tot_typing g e ty) =\n core_check_tot_term g e ty", "val fmul:\n out:felem\n -> a:felem\n -> b:felem ->\n Stack unit\n (requires fun h -> live h out /\\ live h a /\\ live h b /\\\n F51.felem_fits h a (9, 10, 9, 9, 9) /\\\n F51.felem_fits h b (9, 10, 9, 9, 9)\n )\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F51.mul_inv_t h1 out /\\\n F51.fevalh h1 out == SC.fmul (F51.fevalh h0 a) (F51.fevalh h0 b)\n )\nlet fmul output input input2 =\n push_frame();\n let tmp = create 10ul (u128 0) in\n BN.fmul output input input2 tmp;\n pop_frame()", "val assoc (#a: eqtype) (#b: _) (x: a) (l: list (a & b)) : Tac b\nlet assoc (#a: eqtype) #b (x: a) (l: list (a & b)): Tac b =\n match List.Tot.assoc x l with\n | Some x -> x\n | None -> fail \"failure: assoc\"", "val pose (t: term) : Tac binder\nlet pose (t:term) : Tac binder =\n apply (`__cut);\n flip ();\n exact t;\n intro ()", "val lift : ('a -> Tac 'b) -> ('a -> tm 'b)\nlet lift f x st =\n Inr (f x, st)", "val elim_all\n (#g: env)\n (f: (vprop -> T.Tac bool))\n (mk: mk_t)\n (#ctxt #frame: term)\n (ctxt_frame_typing: tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs: env{disjoint uvs g})\n : T.Tac\n (bool &\n (g': env{env_extends g' g /\\ disjoint uvs g'} &\n ctxt': term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\nlet rec elim_all (#g:env)\n (f:vprop -> T.Tac bool)\n (mk:mk_t)\n (#ctxt:term) (#frame:term) (ctxt_frame_typing:tot_typing g (tm_star ctxt frame) tm_vprop)\n (uvs:env { disjoint uvs g })\n : T.Tac (bool & \n (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star ctxt frame) g' (tm_star ctxt' frame)))\n = match ctxt.t with\n | Tm_Star ctxt' p ->\n let p_typing =\n star_typing_inversion_r #_ #ctxt' #p (star_typing_inversion_l ctxt_frame_typing) in\n if f p\n then match mk #_ #p p_typing with\n | Some (| nx, e1, c1, e1_typing |) ->\n let (| g', _, ctxt_typing', k |) =\n elim_one ctxt' frame p (RU.magic ()) nx e1 c1 e1_typing uvs in\n let k\n : continuation_elaborator g (tm_star (tm_star ctxt' frame) p)\n g' (tm_star _ frame) = k in\n let k\n : continuation_elaborator g (tm_star (tm_star ctxt' p) frame)\n g' (tm_star _ frame) =\n k_elab_equiv k\n (RU.magic ()) (VE_Refl _ _) in\n let _, (| g'', ctxt'', ctxt_typing'', k' |) =\n elim_all #g' f mk ctxt_typing' uvs in\n true, (| g'', ctxt'', ctxt_typing'', k_elab_trans k k' |)\n | None ->\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)\n else begin\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)\n end\n | _ ->\n false, (| g, ctxt, ctxt_frame_typing, k_elab_unit _ _ |)", "val bind (a b: Type) (#labs1 #labs2: ops) (c: tree a labs1) (f: (x: a -> tree b labs2))\n : Tot (tree b (labs1 @ labs2))\nlet bind (a b : Type)\n (#labs1 #labs2 : ops)\n (c : tree a labs1)\n (f : (x:a -> tree b labs2))\n : Tot (tree b (labs1@labs2))\n = handle_with #_ #_ #labs1 #(labs1@labs2) c f (fun act i k -> Op act i k)", "val bind (a b: Type) (#labs1 #labs2: ops) (c: tree a labs1) (f: (x: a -> tree b labs2))\n : Tot (tree b (labs1 @ labs2))\nlet bind (a b : Type)\n (#labs1 #labs2 : ops)\n (c : tree a labs1)\n (f : (x:a -> tree b labs2))\n : Tot (tree b (labs1@labs2))\n = handle_tree #_ #_ #_ #(labs1@labs2) c f (fun act i k -> Op act i k)", "val lex_aux\n (#a: Type u#a)\n (#b: (a -> Type u#b))\n (r_a: binrel u#a u#ra a)\n (r_b: (x: a -> binrel u#b u#rb (b x)))\n : binrel u#(max a b) u#0 (x: a & b x)\nlet lex_aux (#a:Type u#a) (#b:a -> Type u#b)\n (r_a:binrel u#a u#ra a)\n (r_b:(x:a -> binrel u#b u#rb (b x)))\n : binrel u#(max a b) u#0 (x:a & b x)\n = fun (| x1, y1 |) (| x2, y2 |) ->\n (squash (r_a x1 x2)) \\/\n (x1 == x2 /\\ squash ((r_b x1) y1 y2))", "val mdenote_gen (#a: Type u#aa) (unit: a) (mult: (a -> a -> a)) (am: amap a) (e: exp) : a\nlet rec mdenote_gen (#a:Type u#aa) (unit:a) (mult:a -> a -> a) (am:amap a) (e:exp) : a =\n match e with\n | Unit -> unit\n | Atom x -> select x am\n | Mult e1 e2 -> mult (mdenote_gen unit mult am e1) (mdenote_gen unit mult am e2)", "val union_aux (#a: eqtype) (#f: cmp a) (s1 s2: mset a f)\n : s:\n mset a f\n { ((Cons? s1 /\\ Cons? s2) ==>\n (Cons? s /\\\n (let x1 = fst (hd s1) in\n let x2 = fst (hd s2) in\n if f x1 x2 then fst (hd s) == x1 else fst (hd s) == x2))) /\\ (Nil? s1 ==> s == s2) /\\\n (Nil? s2 ==> s == s1) }\nlet rec union_aux (#a:eqtype) (#f:cmp a) (s1 s2:mset a f) :\n s:mset a f{\n ((Cons? s1 /\\ Cons? s2) ==>\n (Cons? s /\\ (let x1 = fst (hd s1) in\n let x2 = fst (hd s2) in\n if f x1 x2 then fst (hd s) == x1\n else fst (hd s) == x2))) /\\\n (Nil? s1 ==> s == s2) /\\\n (Nil? s2 ==> s == s1)} =\n match s1, s2 with\n | [], _ -> s2\n | _, [] -> s1\n | (x1, n1)::_, (x2, n2)::_ ->\n if x1 = x2\n then (x1, n1 + n2)::(union_aux (tl s1) (tl s2))\n else if f x1 x2\n then (x1, n1)::(union_aux (tl s1) s2)\n else (x2, n2)::(union_aux s1 (tl s2))", "val map_aux (#a #b: Type) (f: (a -> b)) (s: seq a)\n : Tot (s': seq b {length s' = length s}) (decreases (length s))\nlet rec map_aux (#a #b:Type) (f:a -> b) (s:seq a):\n Tot (s':seq b{length s' = length s})\n (decreases (length s))\n =\n let n = length s in\n if n = 0 then empty\n else\n let ps = prefix s (n - 1) in\n let e = index s (n - 1) in\n append (map_aux f ps) (create 1 (f e))", "val repeat (#a: Type) (t: (unit -> Tac a)) : Tac (list a)\nlet rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) =\n match catch t with\n | Inl _ -> []\n | Inr x -> x :: repeat t", "val repeat (#a: Type) (t: (unit -> Tac a)) : Tac (list a)\nlet rec repeat (#a:Type) (t : unit -> Tac a) : Tac (list a) =\n match catch t with\n | Inl _ -> []\n | Inr x -> x :: repeat t", "val mult_nat (a b: nat) : Tot (c: nat{c == a `Prims.op_Multiply` b})\nlet mult_nat (a b: nat) : Tot (c: nat { c == a `Prims.op_Multiply` b } ) = a `Prims.op_Multiply` b", "val solve_then (#a #b: _) (t1: (unit -> Tac a)) (t2: (a -> Tac b)) : Tac b\nlet solve_then #a #b (t1 : unit -> Tac a) (t2 : a -> Tac b) : Tac b =\n dup ();\n let x = focus (fun () -> finish_by t1) in\n let y = t2 x in\n trefl ();\n y", "val solve_then (#a #b: _) (t1: (unit -> Tac a)) (t2: (a -> Tac b)) : Tac b\nlet solve_then #a #b (t1 : unit -> Tac a) (t2 : a -> Tac b) : Tac b =\n dup ();\n let x = focus (fun () -> finish_by t1) in\n let y = t2 x in\n trefl ();\n y", "val rewrite_equality (t: term) : Tac unit\nlet rewrite_equality (t:term) : Tac unit =\n try_rewrite_equality t (cur_binders ())", "val rewrite_equality (t: term) : Tac unit\nlet rewrite_equality (t:term) : Tac unit =\n try_rewrite_equality t (cur_vars ())", "val fmul (#f: field) (a b: felem f) : felem f\nlet fmul (#f:field) (a:felem f) (b:felem f) : felem f =\n let one = one #f in\n let zero = zero #f in\n let (p,a,b) =\n repeati (bits f.t - 1) (fun i (p,a,b) ->\n\t let b0 = eq_mask #f.t (b &. one) one in\n\t let p = p ^. (b0 &. a) in\n \t let carry_mask = eq_mask #f.t (a >>. size (bits f.t - 1)) one in\n\t let a = a <<. size 1 in\n\t let a = a ^. (carry_mask &. f.irred) in\n\t let b = b >>. size 1 in\n\t (p,a,b)) (zero,a,b) in\n let b0 = eq_mask #f.t (b &. one) one in\n let p = p ^. (b0 &. a) in\n p", "val t:\n a:Type u#a\n -> Type u#a\nlet t a = (l:len_t & raw a l)", "val specialize: #a: Type -> f: a -> l: list string -> unit -> Tac unit\nlet specialize (#a:Type) (f:a) (l:list string) :unit -> Tac unit\n = fun () -> solve_then (fun () -> exact (quote f)) (fun () -> norm [delta_only l; iota; zeta])", "val specialize: #a: Type -> f: a -> l: list string -> unit -> Tac unit\nlet specialize (#a:Type) (f:a) (l:list string) :unit -> Tac unit\n = fun () -> solve_then (fun () -> exact (quote f)) (fun () -> norm [delta_only l; iota; zeta])", "val t : a:Type u#a -> Type u#a\nlet t a = list a", "val t_bind (#a #b: _) (c: m a T) (f: (a -> m b T)) : m b T\nlet t_bind #a #b (c : m a T) (f : a -> m b T) : m b T = fun () -> f (c ()) ()", "val filter_aux (#a #b: Type) (env: b) (f: (b -> a -> Tot bool)) (l: list a)\n : Tot (m: list a {forall x. memP x m ==> f env x})\nlet rec filter_aux (#a:Type)\n (#b:Type)\n (env:b)\n (f:(b -> a -> Tot bool))\n (l: list a)\n : Tot (m:list a{forall x. memP x m ==> f env x}) =\n match l with\n | [] -> []\n | hd::tl -> if f env hd then hd::filter_aux env f tl else filter_aux env f tl", "val any_tac (#a: Type) (l: list a) : Tac (list a)\nlet any_tac (#a: Type) (l: list a): Tac (list a) = l", "val fill\n (#t:Type0)\n (l:SZ.t)\n (a:larray t (SZ.v l))\n (v:t)\n (#s:Ghost.erased (Seq.seq t))\n : stt unit\n (requires \n pts_to a s)\n (ensures fun _ ->\n exists* (s:Seq.seq t).\n pts_to a s **\n pure (s `Seq.equal` Seq.create (SZ.v l) v))\nlet fill = fill'", "val l_to_r (t: term) : Tac unit\nlet l_to_r (t:term) : Tac unit =\n ctrl_rewrite BottomUp\n (fun _ -> true, Continue)\n (fun _ ->\n try t_apply_lemma false true t\n with _ -> t_trefl false)", "val bind (a b: Type) (labs1 labs2: list eff_label) (c: repr a labs1) (f: (x: a -> repr b labs2))\n : Tot (repr b (labs1 @ labs2))\nlet bind (a b : Type)\n (labs1 labs2 : list eff_label)\n (c : repr a labs1)\n (f : (x:a -> repr b labs2))\n : Tot (repr b (labs1@labs2))\n = let r =\n fun s0 -> match c s0 with\n | Some x, s1 -> f x s1\n | None, s1 -> None, s1\n in\n r", "val bind (a b: Type) (labs1 labs2: list eff_label) (c: repr a labs1) (f: (x: a -> repr b labs2))\n : Tot (repr b (labs1 @ labs2))\nlet bind (a b : Type)\n (labs1 labs2 : list eff_label)\n (c : repr a labs1)\n (f : (x:a -> repr b labs2))\n : Tot (repr b (labs1@labs2))\n = fun () -> f (c ()) ()", "val param (t: term) : Tac term\nlet param (t:term) : Tac term =\n let t = param' init_param_state t in\n //dump (\"res = \" ^ term_to_string t);\n t", "val repeat' (f: (unit -> Tac 'a)) : Tac unit\nlet repeat' (f : unit -> Tac 'a) : Tac unit =\n let _ = repeat f in ()", "val repeat' (f: (unit -> Tac 'a)) : Tac unit\nlet repeat' (f : unit -> Tac 'a) : Tac unit =\n let _ = repeat f in ()", "val mbind\n (#st: state u#s u#act)\n (#a: Type u#a)\n (#b: Type u#b)\n (#p: st.pred)\n (#q: post st a)\n (#r: post st b)\n (f: m a p q)\n (g: (x: a -> Dv (m b (q x) r)))\n : Dv (m b p r)\nlet rec mbind\n (#st:state u#s u#act)\n (#a:Type u#a)\n (#b:Type u#b)\n (#p:st.pred)\n (#q:post st a)\n (#r:post st b)\n (f:m a p q)\n (g: (x:a -> Dv (m b (q x) r)))\n : Dv (m b p r)\n = match f with\n | Ret x -> g x\n | Act act k ->\n Act act (fun x -> mbind (k x) g)\n | Par #_ #pre0 #post0 ml\n #pre1 #post1 mr\n #postk k ->\n let k : m b (post0 `st.star` post1) r = mbind k g in\n let ml' : m (U.raise_t u#0 u#b unit) pre0 (as_post post0) =\n mbind ml (fun _ -> Ret #_ #(U.raise_t u#0 u#b unit) #(as_post post0) (U.raise_val u#0 u#b ()))\n in\n let mr' : m (U.raise_t u#0 u#b unit) pre1 (as_post post1) =\n mbind mr (fun _ -> Ret #_ #(U.raise_t u#0 u#b unit) #(as_post post1) (U.raise_val u#0 u#b ()))\n in\n Par ml' mr' k", "val apply_raw (t: term) : Tac unit\nlet apply_raw (t : term) : Tac unit =\n t_apply false false false t", "val apply_raw (t: term) : Tac unit\nlet apply_raw (t : term) : Tac unit =\n t_apply false false false t", "val exact (t: term) : Tac unit\nlet exact (t : term) : Tac unit =\n with_policy SMT (fun () -> t_exact true false t)", "val exact (t: term) : Tac unit\nlet exact (t : term) : Tac unit =\n with_policy SMT (fun () -> t_exact true false t)", "val on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b)\nlet on (a #b: Type) (f: (a -> Tot b)) : (a ^-> b) = on_dom a f", "val bind\n (a b: Type)\n (f_p: pre)\n (f_q: post a)\n (g_p: (a -> pre))\n (g_q: (a -> post b))\n (f: repr a f_p f_q)\n (g: (x: a -> repr b (g_p x) (g_q x)))\n : repr b (act_p f_p f_q g_p) (act_q f_q g_q)\nlet rec bind (a b:Type)\n (f_p:pre) (f_q:post a)\n (g_p:a -> pre) (g_q:a -> post b)\n (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x)))\n : repr b (act_p f_p f_q g_p) (act_q f_q g_q)\n = fun _ ->\n let f = f () in\n match f with\n | Ret x -> Weaken (g x ())\n | Act #_ #c #a_p #a_q act #_ #_ #_ k ->\n let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in\n Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k')\n | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ())\n | Strengthen #_ #_ #phi #p #q f ->\n let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) =\n fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in\n let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) =\n Strengthen f in\n Weaken f", "val inst_fv_with (fv: string) (def t: term) : Tac term\nlet inst_fv_with (fv:string) (def:term) (t:term) : Tac term =\n (* print (\"t = \" ^ term_to_string t); *)\n match inspect t with\n | Tv_App l (r, Q_Explicit) ->\n if is_fv fv l\n then\n let l : term = pack (Tv_App l (def, Q_Implicit)) in\n pack (Tv_App l (r, Q_Explicit))\n else t\n\n | Tv_App l (r, Q_Implicit) -> t\n | _ -> t", "val one_t: Prims.unit -> Tac term\nlet one_t () : Tac term = pack (Tv_Const (C_Int 1))", "val lift_exn_tac (#a #b: _) (f: (a -> match_res b)) (aa: a) : Tac b\nlet lift_exn_tac #a #b (f: a -> match_res b) (aa: a) : Tac b =\n match f aa with\n | Success bb -> bb\n | Failure ex -> Tactics.fail (string_of_match_exception ex)", "val visit_tm (ff: (term -> Tac unit)) (t: term) : Tac unit\nlet rec visit_tm (ff : term -> Tac unit) (t : term) : Tac unit =\n let tv = inspect t in\n (match tv with\n | Tv_FVar _\n | Tv_UInst _ _\n | Tv_Var _\n | Tv_BVar _ -> ()\n\n | Tv_Type _ -> ()\n | Tv_Const c -> ()\n | Tv_Uvar i u -> ()\n | Tv_Unsupp -> ()\n | Tv_Unknown -> ()\n | Tv_Arrow b c ->\n on_sort_binder ff b;\n visit_comp ff c\n | Tv_Abs b t ->\n let b = on_sort_binder (visit_tm ff) b in\n visit_tm ff t\n\n | Tv_App l (r, q) ->\n visit_tm ff l;\n visit_tm ff r\n\n | Tv_Refine b r ->\n on_sort_binder ff b;\n visit_tm ff r\n\n | Tv_Let r attrs b def t ->\n on_sort_binder ff b;\n visit_tm ff def;\n visit_tm ff t\n\n | Tv_Match sc _ brs ->\n visit_tm ff sc;\n iter (visit_br ff) brs\n\n | Tv_AscribedT e t topt _ ->\n visit_tm ff e;\n visit_tm ff t\n\n | Tv_AscribedC e c topt _ ->\n visit_tm ff e\n\n ); ff t\n\nand visit_br (ff : term -> Tac unit) (b:branch) : Tac unit =\n let (p, t) = b in\n visit_tm ff t\n\nand visit_comp (ff : term -> Tac unit) (c : comp) : Tac unit =\n let cv = inspect_comp c in\n match cv with\n | C_Total ret -> visit_tm ff ret\n | C_GTotal ret -> visit_tm ff ret\n\n | C_Lemma pre post pats ->\n visit_tm ff pre;\n visit_tm ff post;\n visit_tm ff pats\n\n | C_Eff us eff res args decrs ->\n visit_tm ff res;\n iter (fun (a, q) -> visit_tm ff a) args;\n iter (visit_tm ff) decrs", "val run (#a #s: _) (m: m s a) (s0: s) (post: post_t s a)\n : Pure (a * s) (requires wp_of m s0 post) (ensures post)\nlet rec run (#a:_) (#s:_) (m:m s a) (s0:s) (post: post_t s a)\n : Pure (a * s)\n (requires\n wp_of m s0 post)\n (ensures\n post)\n = match m with\n | Ret x -> (x, s0)\n | Get k ->\n run (k s0) s0 post\n | Put s k ->\n run k s post", "val write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write r x);\n return ()", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val exact_args (qs: list aqualv) (t: term) : Tac unit\nlet exact_args (qs : list aqualv) (t : term) : Tac unit =\n focus (fun () ->\n let n = List.Tot.Base.length qs in\n let uvs = repeatn n (fun () -> fresh_uvar None) in\n let t' = mk_app t (zip uvs qs) in\n exact t';\n iter (fun uv -> if is_uvar uv\n then unshelve uv\n else ()) (L.rev uvs)\n )", "val exact_args (qs: list aqualv) (t: term) : Tac unit\nlet exact_args (qs : list aqualv) (t : term) : Tac unit =\n focus (fun () ->\n let n = List.Tot.Base.length qs in\n let uvs = repeatn n (fun () -> fresh_uvar None) in\n let t' = mk_app t (zip uvs qs) in\n exact t';\n iter (fun uv -> if is_uvar uv\n then unshelve uv\n else ()) (L.rev uvs)\n )", "val check (f: fstar_top_env) (sg: src_env) (e: src_exp{ok sg e})\n : T.Tac (t: src_ty & src_typing f sg e t)\nlet rec check (f:fstar_top_env)\n (sg:src_env)\n (e:src_exp { ok sg e })\n : T.Tac (t:src_ty &\n src_typing f sg e t)\n = match e with\n | EBVar _ ->\n T.fail \"Not locally nameless\"\n \n | EBool b ->\n (| TBool, T_Bool _ b |)\n\n | EVar n ->\n begin\n match lookup_ty sg n with\n | None -> T.fail \"Ill-typed\"\n | Some t ->\n let d = T_Var sg n in\n (| t, d |)\n end\n\n \n | ELam t body -> \n let t_ok = check_ty f sg t in\n let x = fresh sg in\n fresh_is_fresh sg;\n open_exp_freevars body (EVar x) 0;\n let (| tbody, dbody |) = check f ((x, Inl t)::sg) (open_exp body x) in\n let dd : src_typing f sg e (TArrow t (close_ty tbody x)) = \n T_Lam sg t body tbody x t_ok dbody in\n (| TArrow t (close_ty tbody x), dd |)\n\n\n | EApp e1 e2 ->\n let (| t1, d1 |) = check f sg e1 in\n let (| t2, d2 |) = check f sg e2 in\n begin\n match t1 with\n | TArrow t_arg t_res ->\n let st_ok = check_sub_typing f sg t2 t_arg in\n (| open_ty_with t_res e2, T_App _ _ _ t_arg t_res _ d1 d2 st_ok |)\n\n | _ -> \n T.fail \"Expected a function\"\n end\n\n \n | EIf b e1 e2 ->\n let (| tb, ok_b |) = check f sg b in\n let hyp = fresh sg in\n fresh_is_fresh sg;\n if tb = TBool\n then (\n let (| t1, ok_1 |) = check f ((hyp, Inr(b, EBool true))::sg) e1 in\n let (| t2, ok_2 |) = check f ((hyp, Inr(b, EBool false))::sg) e2 in \n let (| t, w1, w2 |) = weaken f sg hyp b t1 t2 in\n if not (check_ok_ty t sg)\n then T.fail \"Free variable escapes scope\"\n else (\n let t_ok = check_ty f sg t in\n (| t, T_If _ _ _ _ _ _ _ hyp ok_b ok_1 ok_2 w1 w2 t_ok |)\n )\n )\n else T.fail \"Branching on a non-boolean\"\n\nand check_ty (f:fstar_top_env)\n (sg:src_env)\n (t:src_ty { ok_ty sg t })\n : T.Tac (src_ty_ok f sg t)\n = match t with\n | TBool -> OK_TBool _ \n\n\n | TArrow t t' ->\n let t_ok = check_ty f sg t in\n let x = fresh sg in\n fresh_is_fresh sg;\n open_ty_freevars t' (EVar x) 0;\n let t'_ok = check_ty f ((x, Inl t)::sg) (open_ty t' x) in \n OK_TArrow _ _ _ x t_ok t'_ok\n\n | TRefineBool e ->\n let x = fresh sg in\n fresh_is_fresh sg;\n open_exp_freevars e (EVar x) 0; \n let (| te, de |) = check f ((x, Inl TBool)::sg) (open_exp e x) in\n match te with \n | TBool -> OK_TRefine sg e x de\n | _ -> T.fail \"Ill-typed refinement\"", "val mul_underspec (a:t) (b:t) : Pure t\n (requires True)\n (ensures (fun c ->\n size (v a * v b) n ==> v a * v b = v c))\nlet mul_underspec a b = Mk (mul_underspec (v a) (v b))", "val mul_underspec (a:t) (b:t) : Pure t\n (requires True)\n (ensures (fun c ->\n size (v a * v b) n ==> v a * v b = v c))\nlet mul_underspec a b = Mk (mul_underspec (v a) (v b))" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.reification_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.reification_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonMonoid.fst", "name": "FStar.Tactics.CanonMonoid.reification_aux" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.reification_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.reification_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.reification" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.make_fvar" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.reification" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.reification" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.reification" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.canon_semiring_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonMonoid.fst", "name": "FStar.Tactics.CanonMonoid.reification" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.mapply" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Util.fst", "name": "FStar.Tactics.Util.zip" }, { "project_name": "FStar", "file_name": "FStar.Tactics.MApply.fst", "name": "FStar.Tactics.MApply.mapply" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.apply" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.apply" }, { "project_name": "FStar", "file_name": "FStar.Tactics.PatternMatching.fst", "name": "FStar.Tactics.PatternMatching.repeat'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.quote_vm" }, { "project_name": "FStar", "file_name": "FStar.Tactics.MApply.fst", "name": "FStar.Tactics.MApply.mapply0" }, { "project_name": "FStar", "file_name": "Rewrite.Monoid.fst", "name": "Rewrite.Monoid.is_reifiable" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.is_true" }, { "project_name": "FStar", "file_name": "RunST.fst", "name": "RunST.bind" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.felem_mul" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.par" }, { "project_name": "FStar", "file_name": "FStar.Tactics.PatternMatching.fst", "name": "FStar.Tactics.PatternMatching.tpair" }, { "project_name": "FStar", "file_name": "FStar.Int8.fst", "name": "FStar.Int8.mul" }, { "project_name": "FStar", "file_name": "FStar.Int32.fst", "name": "FStar.Int32.mul" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fst", "name": "FStar.UInt64.mul" }, { "project_name": "FStar", "file_name": "FStar.Int16.fst", "name": "FStar.Int16.mul" }, { "project_name": "FStar", "file_name": "FStar.Int64.fst", "name": "FStar.Int64.mul" }, { "project_name": "FStar", "file_name": "FStar.UInt32.fst", "name": "FStar.UInt32.mul" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fst", "name": "FStar.UInt8.mul" }, { "project_name": "FStar", "file_name": "FStar.UInt16.fst", "name": "FStar.UInt16.mul" }, { "project_name": "FStar", "file_name": "FStar.Int128.fst", "name": "FStar.Int128.mul" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Tac.Enum.fst", "name": "LowParse.Spec.Tac.Enum.apply" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Tac.Enum.fst", "name": "LowParse.SLow.Tac.Enum.apply" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.alloc" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.reify_trivial" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.pose" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.add_elims_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum25519.fst", "name": "Hacl.Bignum25519.times_2" }, { "project_name": "FStar", "file_name": "STLC.Infer.fst", "name": "STLC.Infer.infer" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Logic.fst", "name": "FStar.Tactics.V1.Logic.and_elim" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Logic.fst", "name": "FStar.Tactics.V2.Logic.and_elim" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.fatom" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fatom" }, { "project_name": "steel", "file_name": "Pulse.Checker.WithInv.fst", "name": "Pulse.Checker.WithInv.recheck" }, { "project_name": "hacl-star", "file_name": "Hacl.Bignum25519.fst", "name": "Hacl.Bignum25519.fmul" }, { "project_name": "hacl-star", "file_name": "Meta.Interface.fst", "name": "Meta.Interface.assoc" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.pose" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Arith.fst", "name": "FStar.Reflection.V2.Arith.lift" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.elim_all" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.bind" }, { "project_name": "FStar", "file_name": "Alg.fst", "name": "Alg.bind" }, { "project_name": "FStar", "file_name": "FStar.LexicographicOrdering.fsti", "name": "FStar.LexicographicOrdering.lex_aux" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.mdenote_gen" }, { "project_name": "zeta", "file_name": "Zeta.MultiSet.fst", "name": "Zeta.MultiSet.union_aux" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.map_aux" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.repeat" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.repeat" }, { "project_name": "everparse", "file_name": "LowParse.Math.fst", "name": "LowParse.Math.mult_nat" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.solve_then" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.solve_then" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.rewrite_equality" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.rewrite_equality" }, { "project_name": "hacl-star", "file_name": "Spec.GaloisField.fst", "name": "Spec.GaloisField.fmul" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fst", "name": "FStar.Vector.Base.t" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.specialize" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.specialize" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.t" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.t_bind" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.List.Helpers.fst", "name": "MiTLS.List.Helpers.filter_aux" }, { "project_name": "FStar", "file_name": "Embeddings.fst", "name": "Embeddings.any_tac" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.fst", "name": "Pulse.Lib.Array.fill" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fst", "name": "FStar.FunctionalExtensionality.l_to_r" }, { "project_name": "FStar", "file_name": "Lattice.fst", "name": "Lattice.bind" }, { "project_name": "FStar", "file_name": "LatticeEff.fst", "name": "LatticeEff.bind" }, { "project_name": "FStar", "file_name": "Param.fst", "name": "Param.param" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.repeat'" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.repeat'" }, { "project_name": "steel", "file_name": "PulseCore.Semantics.fst", "name": "PulseCore.Semantics.mbind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.apply_raw" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.apply_raw" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.exact" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.exact" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.on" }, { "project_name": "FStar", "file_name": "HoareSTFree.fst", "name": "HoareSTFree.bind" }, { "project_name": "FStar", "file_name": "Preprocess.fst", "name": "Preprocess.inst_fv_with" }, { "project_name": "FStar", "file_name": "Term.fst", "name": "Term.one_t" }, { "project_name": "FStar", "file_name": "FStar.Tactics.PatternMatching.fst", "name": "FStar.Tactics.PatternMatching.lift_exn_tac" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.visit_tm" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.run" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Derived.fst", "name": "FStar.Tactics.V1.Derived.exact_args" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Derived.fst", "name": "FStar.Tactics.V2.Derived.exact_args" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.check" }, { "project_name": "FStar", "file_name": "FStar.UInt8.fst", "name": "FStar.UInt8.mul_underspec" }, { "project_name": "FStar", "file_name": "FStar.UInt64.fst", "name": "FStar.UInt64.mul_underspec" } ], "selected_premises": [ "FStar.Tactics.CanonCommMonoid.xsdenote", "FStar.Tactics.CanonCommMonoid.select", "FStar.Tactics.CanonCommMonoid.const", "FStar.Tactics.CanonCommMonoid.vmap", "FStar.Tactics.CanonCommMonoid.mdenote", "FStar.Tactics.CanonCommMonoid.select_extra", "FStar.Tactics.Util.map", "FStar.List.Tot.Base.rev", "FStar.Pervasives.Native.fst", "FStar.Tactics.Effect.raise", "FStar.Tactics.CanonCommMonoid.canon", "FStar.Pervasives.Native.snd", "FStar.Tactics.CanonCommMonoid.flatten_correct", "FStar.Tactics.CanonCommMonoid.where_aux", "FStar.List.Tot.Base.append", "FStar.Tactics.Util.fold_left", "FStar.Tactics.CanonCommMonoid.update", "FStar.List.Tot.Properties.assoc_mem", "FStar.List.Tot.Base.mem", "FStar.List.Tot.Base.op_At", "FStar.Tactics.CanonCommMonoid.permute_correct", "FStar.List.Tot.Base.memP", "FStar.List.Tot.Base.fold_left", "FStar.Tactics.CanonCommMonoid.canon_correct", "FStar.Tactics.CanonCommMonoid.flatten_correct_aux", "FStar.List.Tot.Properties.append_assoc", "FStar.List.Tot.Base.tl", "FStar.ST.op_Bang", "FStar.Tactics.CanonCommMonoid.var", "FStar.Tactics.Types.issues", "FStar.Tactics.Util.string_of_list", "FStar.Heap.trivial_preorder", "FStar.Tactics.CanonCommMonoid.permute_via_swaps_correct_aux", "FStar.Tactics.CanonCommMonoid.monoid_reflect", "FStar.List.Tot.Base.hd", "FStar.List.Tot.Base.map", "FStar.Tactics.CanonCommMonoid.permute", "FStar.List.Tot.Properties.append_l_cons", "FStar.List.Tot.Base.length", "FStar.Tactics.Util.iter", "FStar.Tactics.CanonCommMonoid.permute_via_swaps", "FStar.Tactics.Effect.get", "FStar.List.Tot.Properties.append_l_nil", "FStar.Tactics.CanonCommMonoid.sort_via_swaps", "FStar.Tactics.Util.fold_right", "FStar.Tactics.CanonCommMonoid.apply_swap_correct", "FStar.Tactics.CanonCommMonoid.sort_correct_aux", "FStar.Pervasives.dfst", "FStar.ST.alloc", "FStar.Tactics.Util.map_opt", "FStar.Tactics.CanonCommMonoid.dump", "FStar.Pervasives.dsnd", "FStar.Tactics.CanonCommMonoid.flatten", "FStar.Tactics.CanonCommMonoid.apply_swaps_correct", "FStar.List.Tot.Properties.append_mem", "FStar.Tactics.CanonCommMonoid.exp_to_string", "FStar.List.Tot.Properties.map_append", "FStar.List.Tot.Base.fold_right", "FStar.Tactics.CanonCommMonoid.apply_swap_aux_correct", "FStar.List.Tot.Properties.assoc_memP_some", "FStar.Issue.mk_issue", "FStar.Tactics.Util.filter_map_acc", "FStar.List.Tot.Properties.memP_map_intro", "FStar.Tactics.CanonCommMonoid.where", "FStar.List.Tot.Base.concatMap", "FStar.Tactics.CanonCommMonoid.sortWith_via_swaps", "FStar.List.map", "FStar.List.Tot.Base.find", "FStar.List.Tot.Properties.append_inv_head", "FStar.Tactics.CanonCommMonoid.sortWith_correct_aux", "FStar.List.Tot.Base.assoc", "FStar.List.Tot.Properties.rev_rev'", "FStar.Tactics.Util.__mapi", "FStar.Tactics.Util.filter", "FStar.Tactics.CanonCommMonoid.sort", "FStar.Tactics.Util.repeatn", "FStar.List.fold_left", "FStar.List.Tot.Properties.append_memP", "FStar.All.op_Bar_Greater", "FStar.List.Tot.Properties.rev'", "FStar.List.Tot.Properties.assoc_precedes", "FStar.List.Tot.Properties.append_length", "FStar.All.op_Less_Bar", "FStar.List.for_all", "FStar.List.Tot.Properties.map_lemma", "FStar.List.iter", "FStar.List.Tot.Properties.rev_append", "FStar.List.Tot.Properties.append_injective", "FStar.List.Tot.Properties.memP_map_elim", "FStar.List.Tot.Base.flatten", "FStar.Tactics.Util.filter_map", "FStar.List.Tot.Base.rev_acc", "FStar.List.Tot.Properties.rev'_append", "FStar.List.Tot.Properties.rev_memP", "FStar.Tactics.CanonCommSwaps.swaps_for", "FStar.Tactics.Util.tryPick", "FStar.List.Tot.Properties.append_mem_forall", "FStar.List.Tot.Base.snoc", "FStar.List.Tot.Base.split", "FStar.List.Tot.Properties.assoc_memP_none" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Tactics.CanonCommMonoid\n\nopen FStar.Algebra.CommMonoid\nopen FStar.List\nopen FStar.Reflection.V2\nopen FStar.Tactics.V2\nopen FStar.Classical\nopen FStar.Tactics.CanonCommSwaps\n\n(* An expression canonizer for commutative monoids.\n Inspired by:\n - http://adam.chlipala.net/cpdt/html/Cpdt.Reflection.html\n - http://poleiro.info/posts/2015-04-13-writing-reflective-tactics.html\n*)\n\n(* Only dump when debugging is on *)\nprivate let dump m = if debugging () then dump m\n\n(***** Expression syntax *)\n\nlet var : eqtype = nat\n\ntype exp : Type =\n | Unit : exp\n | Var : var -> exp\n | Mult : exp -> exp -> exp\n\nlet rec exp_to_string (e:exp) : string =\n match e with\n | Unit -> \"Unit\"\n | Var x -> \"Var \" ^ string_of_int (x <: var)\n | Mult e1 e2 -> \"Mult (\" ^ exp_to_string e1\n ^ \") (\" ^ exp_to_string e2 ^ \")\"\n\n(***** Expression denotation *)\n\n// Use a map that stores for each variable\n// (1) its denotation that should be treated abstractly (type a) and\n// (2) user-specified extra information depending on its term (type b)\n\nlet vmap (a b:Type) = list (var * (a*b)) * (a * b)\nlet const (#a #b:Type) (xa:a) (xb:b) : vmap a b = [], (xa,xb)\nlet select (#a #b:Type) (x:var) (vm:vmap a b) : Tot a =\n match assoc #var #(a * b) x (fst vm) with\n | Some (a, _) -> a\n | _ -> fst (snd vm)\nlet select_extra (#a #b:Type) (x:var) (vm:vmap a b) : Tot b =\n match assoc #var #(a * b) x (fst vm) with\n | Some (_, b) -> b\n | _ -> snd (snd vm)\nlet update (#a #b:Type) (x:var) (xa:a) (xb:b) (vm:vmap a b) : vmap a b =\n (x, (xa, xb))::fst vm, snd vm\n\nlet rec mdenote (#a #b:Type) (m:cm a) (vm:vmap a b) (e:exp) : Tot a =\n match e with\n | Unit -> CM?.unit m\n | Var x -> select x vm\n | Mult e1 e2 -> CM?.mult m (mdenote m vm e1) (mdenote m vm e2)\n\nlet rec xsdenote (#a #b:Type) (m:cm a) (vm:vmap a b) (xs:list var) : Tot a =\n match xs with\n | [] -> CM?.unit m\n | [x] -> select x vm\n | x::xs' -> CM?.mult m (select x vm) (xsdenote m vm xs')\n\n(***** Flattening expressions to lists of variables *)\n\nlet rec flatten (e:exp) : list var =\n match e with\n | Unit -> []\n | Var x -> [x]\n | Mult e1 e2 -> flatten e1 @ flatten e2\n\nlet rec flatten_correct_aux (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs1 xs2:list var) :\n Lemma (xsdenote m vm (xs1 @ xs2) == CM?.mult m (xsdenote m vm xs1)\n (xsdenote m vm xs2)) =\n match xs1 with\n | [] -> CM?.identity m (xsdenote m vm xs2)\n | [x] -> if (Nil? xs2) then right_identity m (select x vm)\n | x::xs1' -> (CM?.associativity m (select x vm)\n (xsdenote m vm xs1') (xsdenote m vm xs2);\n flatten_correct_aux m vm xs1' xs2)\n\nlet rec flatten_correct (#a #b:Type) (m:cm a) (vm:vmap a b) (e:exp) :\n Lemma (mdenote m vm e == xsdenote m vm (flatten e)) =\n match e with\n | Unit | Var _ -> ()\n | Mult e1 e2 -> flatten_correct_aux m vm (flatten e1) (flatten e2);\n flatten_correct m vm e1; flatten_correct m vm e2\n\n(***** Permuting the lists of variables\n by swapping adjacent elements *)\n\n(* The user has control over the permutation. He can store extra\n information in the vmap and use that for choosing the\n permutation. This means that permute has access to the vmap. *)\n\nlet permute (b:Type) = a:Type -> vmap a b -> list var -> list var\n\n// high-level correctness criterion for permutations\nlet permute_correct (#b:Type) (p:permute b) =\n #a:Type -> m:cm a -> vm:vmap a b -> xs:list var ->\n Lemma (xsdenote m vm xs == xsdenote m vm (p a vm xs))\n\n// sufficient condition:\n// permutation has to be expressible as swaps of adjacent list elements\n\nlet rec apply_swap_aux_correct (#a #b:Type) (n:nat) (m:cm a) (vm:vmap a b)\n (xs:list var) (s:swap (length xs + n)) :\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swap_aux n xs s)))\n (decreases xs) =\n match xs with\n | [] | [_] -> ()\n | x1 :: x2 :: xs' ->\n if n = (s <: nat)\n then (// x1 + (x2 + xs') =a (x1 + x2) + xs'\n // =c (x2 + x1) + xs' = a x2 + (x1 + xs')\n let a = CM?.associativity m in\n a (select x1 vm) (select x2 vm) (xsdenote m vm xs');\n a (select x2 vm) (select x1 vm) (xsdenote m vm xs');\n CM?.commutativity m (select x1 vm) (select x2 vm))\n else apply_swap_aux_correct (n+1) m vm (x2 :: xs') s\n\nlet apply_swap_correct (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs:list var) (s:swap (length xs)):\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swap xs s)))\n (decreases xs) = apply_swap_aux_correct 0 m vm xs s\n\nlet rec apply_swaps_correct (#a #b:Type) (m:cm a) (vm:vmap a b)\n (xs:list var) (ss:list (swap (length xs))):\n Lemma (requires True)\n (ensures (xsdenote m vm xs == xsdenote m vm (apply_swaps xs ss)))\n (decreases ss) =\n match ss with\n | [] -> ()\n | s::ss' -> apply_swap_correct m vm xs s;\n apply_swaps_correct m vm (apply_swap xs s) ss'\n\nlet permute_via_swaps (#b:Type) (p:permute b) =\n (#a:Type) -> (vm:vmap a b) -> xs:list var ->\n Lemma (exists ss. p a vm xs == apply_swaps xs ss)\n\nlet permute_via_swaps_correct_aux\n (#b:Type) (p:permute b) (pvs:permute_via_swaps p)\n (#a:Type) (m:cm a) (vm:vmap a b) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (p a vm xs)) =\n pvs vm xs;\n assert(exists ss. p a vm xs == apply_swaps xs ss);\n exists_elim (xsdenote m vm xs == xsdenote m vm (p a vm xs))\n (() <: squash (exists ss. p a vm xs == apply_swaps xs ss))\n (fun ss -> apply_swaps_correct m vm xs ss)\n\nlet permute_via_swaps_correct\n (#b:Type) (p:permute b) (pvs:permute_via_swaps p) : permute_correct p =\n permute_via_swaps_correct_aux p pvs\n\n(***** Sorting variables is a correct permutation\n (since it can be done by swaps) *)\n\n// Here we sort without associating any extra information with the\n// variables and only look at the actual identifiers\n\nlet sort : permute unit =\n (fun a vm -> List.Tot.Base.sortWith #nat (compare_of_bool (<)))\n\nlet sortWith (#b:Type) (f:nat -> nat -> int) : permute b =\n (fun a vm -> List.Tot.Base.sortWith #nat f)\n\nlet sort_via_swaps (#a:Type) (vm : vmap a unit) (xs:list var) :\n Lemma (exists ss. sort a vm xs == apply_swaps xs ss) =\n List.Tot.Properties.sortWith_permutation #nat (compare_of_bool (<)) xs;\n let ss = equal_counts_implies_swaps #nat xs (sort a vm xs) in\n assert (sort a vm xs == apply_swaps xs ss)\n\nlet sortWith_via_swaps (#a #b:Type) (f:nat -> nat -> int)\n (vm : vmap a b) (xs:list var) :\n Lemma (exists ss. sortWith #b f a vm xs == apply_swaps xs ss) =\n List.Tot.Properties.sortWith_permutation #nat f xs;\n let ss = equal_counts_implies_swaps #nat xs (sortWith #b f a vm xs) in\n assert (sortWith #b f a vm xs == apply_swaps xs ss)\n\nlet sort_correct_aux (#a:Type) (m:cm a) (vm:vmap a unit) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (sort a vm xs)) =\n permute_via_swaps_correct #unit sort sort_via_swaps m vm xs\n\nlet sortWith_correct_aux (#a #b:Type) (f:nat -> nat -> int) (m:cm a) (vm:vmap a b) (xs:list var) :\n Lemma (xsdenote m vm xs == xsdenote m vm (sortWith #b f a vm xs)) =\n permute_via_swaps_correct (sortWith f) (fun #a -> sortWith_via_swaps f) m vm xs\n\nlet sort_correct : permute_correct #unit sort = sort_correct_aux\n\nlet sortWith_correct (#b:Type) (f:nat -> nat -> int) :\n permute_correct #b (sortWith #b f) =\n (fun #a -> sortWith_correct_aux #a #b f)\n\n(***** Canonicalization tactics *)\n\nlet canon (#a #b:Type) (vm:vmap a b) (p:permute b) (e:exp) = p a vm (flatten e)\n\nlet canon_correct (#a #b:Type) (p:permute b) (pc:permute_correct p)\n (m:cm a) (vm:vmap a b) (e:exp) :\n Lemma (mdenote m vm e == xsdenote m vm (canon vm p e)) =\n flatten_correct m vm e; pc m vm (flatten e)\n\nlet monoid_reflect (#a #b:Type) (p:permute b) (pc:permute_correct p)\n (m:cm a) (vm:vmap a b) (e1 e2:exp)\n (_ : squash (xsdenote m vm (canon vm p e1) ==\n xsdenote m vm (canon vm p e2)))\n : squash (mdenote m vm e1 == mdenote m vm e2) =\n canon_correct p pc m vm e1; canon_correct p pc m vm e2\n\n(* Finds the position of first occurrence of x in xs.\n This is now specialized to terms and their funny term_eq. *)\nlet rec where_aux (n:nat) (x:term) (xs:list term) :\n Tac (option nat) =\n match xs with\n | [] -> None\n | x'::xs' -> if term_eq_old x x' then Some n else where_aux (n+1) x xs'\nlet where = where_aux 0\n\n// This expects that mult, unit, and t have already been normalized", "sketch": [ "The definition `reification_aux` is about reifying a list of terms into an expression, along with a modified variable map, by using a given unquoting function and a tactic to process the terms.\n\nThe implementation of `reification_aux` involves iterating through the list of terms, applying the unquoting function to each term to obtain a value of type `a`, and then using the obtained value to construct an expression. The modified variable map is also updated during this process.", "The `reification_aux` function first checks if the list of terms is empty. If it is, it returns the unit expression, the empty list of terms, and the original variable map.\n\nIf the list of terms is not empty, it extracts the first term and applies the `f` tactic to it to obtain a value of type `b`. It then recursively reifies the remaining terms in the list. After reifying the remaining terms, it constructs a `Mult` expression using the reified term, the reified list of terms, and the updated variable map.", "The implementation of `reification_aux` involves iterating through the list of terms, unquoting each term using the `unquotea` function, and then mapping each unquoted term to a value using the `f` function. The resulting values are used to construct an expression, update the variable map, and handle the multiplication and unit terms.\n\n```fstar\nlet rec reification_aux\n (#a #b: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a b)\n (f: (term -> Tac b))\n (mult unit t: term)\n : Tac (exp * list term * vmap a b) =\n match ts with\n | [] -> return (Unit, [], vm)\n | hd::tl ->\n unquotea hd >>= fun a ->\n f hd >>= fun b ->\n let (e, ts', vm') = reification_aux a b tl vm f mult unit t in\n return (Mult e t, hd::ts', vm')\n```" ], "generated_solution": [ "let rec reification_aux\n (#a #b: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a b)\n (f: (term -> Tac b))\n (mult unit t: term)\n : Tac (exp * list term * vmap a b) =\n match ts with\n | [] -> return (Unit, [], vm)\n | hd::tl ->\n unquotea hd >>= fun a ->\n let vm' = update (length (fst vm)) a () vm in\n f hd >>= fun b ->\n let e, ts', vm'' = reification_aux unquotea tl vm' f mult unit t in\n return (Mult (Var (length (fst vm))), ts', vm'')", "let rec reification_aux\n (#a #b: Type)\n (unquotea: (term -> Tac a))\n (ts: list term)\n (vm: vmap a b)\n (f: (term -> Tac b))\n (mult unit t: term)\n : Tac (exp * list term * vmap a b) =\n match ts with\n | [] -> return (Unit, [], vm)\n | t'::ts' ->\n f t' >>= (fun b ->\n reification_aux unquotea ts' vm f mult unit t' >>= (fun (e, ts'', vm') ->\n return (Mult (Var t') e, t'::ts'', vm')))" ] }, { "file_name": "Vale.SHA.PPC64LE.fsti", "name": "Vale.SHA.PPC64LE.va_ens_Sha_update_bytes_main", "opens_and_abbrevs": [ { "open": "Vale.SHA2.Wrapper" }, { "open": "Vale.SHA.PPC64LE.Loop" }, { "open": "Spec.Loops" }, { "open": "Spec.Hash.Definitions" }, { "open": "Spec.Agile.Hash" }, { "open": "Spec.SHA2" }, { "open": "Vale.SHA.PPC64LE.SHA_helpers" }, { "open": "Vale.PPC64LE.InsVector" }, { "open": "Vale.PPC64LE.InsStack" }, { "open": "Vale.PPC64LE.InsMem" }, { "open": "Vale.PPC64LE.InsBasic" }, { "open": "Vale.PPC64LE.QuickCodes" }, { "open": "Vale.PPC64LE.QuickCode" }, { "open": "Vale.PPC64LE.Decls" }, { "open": "Vale.PPC64LE.State" }, { "open": "Vale.PPC64LE.Stack_i" }, { "open": "Vale.PPC64LE.Memory" }, { "open": "Vale.PPC64LE.Machine_s" }, { "open": "Vale.Arch.HeapImpl" }, { "open": "Vale.Arch.Types" }, { "open": "FStar.Seq" }, { "open": "Vale.Def.Words.Seq_s" }, { "open": "Vale.Def.Words_s" }, { "open": "Vale.Def.Types_s" }, { "open": "Vale.Def.Opaque_s" }, { "open": "Vale.SHA" }, { "open": "Vale.SHA" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 1, "initial_ifuel": 0, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": true, "smtencoding_nl_arith_repr": "wrapped", "smtencoding_l_arith_repr": "native", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [ "smt.arith.nl=false", "smt.QI.EAGER_THRESHOLD=100", "smt.CASE_SPLIT=3" ], "z3smtopt": [], "z3refresh": false, "z3rlimit": 2000, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop", "source_definition": "let va_ens_Sha_update_bytes_main (va_b0:va_code) (va_s0:va_state) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Sha_update_bytes_main va_b0 va_s0 ctx_b in_b num_val k_b /\\ va_ensure_total va_b0 va_s0\n va_sM va_fM /\\ va_get_ok va_sM /\\ (let hash_in = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_s0) ctx_b)) in let hash_out = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) ctx_b)) in (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\\n Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b) (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 /\\\n l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (va_get_vec 20 va_sM ==\n va_get_vec 20 va_s0) (va_get_vec 21 va_sM == va_get_vec 21 va_s0)) (va_get_vec 22 va_sM ==\n va_get_vec 22 va_s0)) (va_get_vec 23 va_sM == va_get_vec 23 va_s0)) (va_get_vec 24 va_sM ==\n va_get_vec 24 va_s0)) (va_get_vec 25 va_sM == va_get_vec 25 va_s0)) (va_get_vec 26 va_sM ==\n va_get_vec 26 va_s0)) (va_get_vec 28 va_sM == va_get_vec 28 va_s0)) (va_get_vec 29 va_sM ==\n va_get_vec 29 va_s0)) (va_get_vec 30 va_sM == va_get_vec 30 va_s0)) (va_get_vec 31 va_sM ==\n va_get_vec 31 va_s0)) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_vec 31 va_sM\n (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM (va_update_vec 26 va_sM\n (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM\n (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM\n (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM\n (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM\n (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM\n (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM\n (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM (va_update_reg 10 va_sM\n (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM (va_update_reg 1 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))))))))", "source_range": { "start_line": 57, "start_col": 0, "end_line": 87, "end_col": 94 }, "interleaved": false, "definition": "fun va_b0 va_s0 ctx_b in_b num_val k_b va_sM va_fM ->\n Vale.SHA.PPC64LE.va_req_Sha_update_bytes_main va_b0 va_s0 ctx_b in_b num_val k_b /\\\n Vale.PPC64LE.Decls.va_ensure_total va_b0 va_s0 va_sM va_fM /\\ Vale.PPC64LE.Decls.va_get_ok va_sM /\\\n (let hash_in =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (Vale.PPC64LE.Decls.va_get_mem va_s0)\n ctx_b))\n in\n let hash_out =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (Vale.PPC64LE.Decls.va_get_mem va_sM)\n ctx_b))\n in\n (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (Vale.PPC64LE.Decls.va_get_mem va_sM)\n in_b))\n in\n FStar.Seq.Base.length input_LE % 64 == 0 /\\\n hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash_in input_LE) /\\\n Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_buffer ctx_b)\n (Vale.PPC64LE.Decls.va_get_mem va_s0)\n (Vale.PPC64LE.Decls.va_get_mem va_sM) /\\\n Vale.PPC64LE.Decls.va_get_reg 1 va_sM == Vale.PPC64LE.Decls.va_get_reg 1 va_s0 /\\\n (Vale.PPC64LE.Decls.va_get_vec 20 va_sM == Vale.PPC64LE.Decls.va_get_vec 20 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 21 va_sM == Vale.PPC64LE.Decls.va_get_vec 21 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 22 va_sM == Vale.PPC64LE.Decls.va_get_vec 22 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 23 va_sM == Vale.PPC64LE.Decls.va_get_vec 23 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 24 va_sM == Vale.PPC64LE.Decls.va_get_vec 24 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 25 va_sM == Vale.PPC64LE.Decls.va_get_vec 25 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 26 va_sM == Vale.PPC64LE.Decls.va_get_vec 26 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 28 va_sM == Vale.PPC64LE.Decls.va_get_vec 28 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 29 va_sM == Vale.PPC64LE.Decls.va_get_vec 29 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 30 va_sM == Vale.PPC64LE.Decls.va_get_vec 30 va_s0) /\\\n (Vale.PPC64LE.Decls.va_get_vec 31 va_sM == Vale.PPC64LE.Decls.va_get_vec 31 va_s0)) /\\\n Vale.PPC64LE.Decls.va_state_eq va_sM\n (Vale.PPC64LE.Decls.va_update_stackTaint va_sM\n (Vale.PPC64LE.Decls.va_update_stack va_sM\n (Vale.PPC64LE.Decls.va_update_mem_layout va_sM\n (Vale.PPC64LE.Decls.va_update_mem_heaplet 0\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 31\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 30\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 29\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 28\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 26\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 25\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 24\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 23\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 22\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 21\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 20\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec 19\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 18\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 17\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 16\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 15\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 14\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 13\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 12\n va_sM\n (Vale.PPC64LE.Decls.va_update_vec\n 11\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 10\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 9\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 8\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 7\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 6\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 5\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 4\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 3\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 2\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 1\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_vec\n 0\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_cr0\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_reg\n 10\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_reg\n 6\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_reg\n 5\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_reg\n 4\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_reg\n 1\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_ok\n va_sM\n (\n Vale.PPC64LE.Decls.va_update_mem\n va_sM\n va_s0\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n ))\n ))))))))))))\n ))))))))))\n <:\n Prims.prop", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Memory.buffer128", "Vale.PPC64LE.Memory.nat64", "Vale.PPC64LE.Decls.va_fuel", "Prims.l_and", "Vale.SHA.PPC64LE.va_req_Sha_update_bytes_main", "Vale.PPC64LE.Decls.va_ensure_total", "Prims.b2t", "Vale.PPC64LE.Decls.va_get_ok", "Prims.eq2", "Prims.int", "Prims.op_Modulus", "FStar.Seq.Base.length", "FStar.UInt8.t", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent", "FStar.Seq.Base.seq", "Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8", "Vale.Def.Types_s.le_seq_quad32_to_bytes", "Vale.PPC64LE.Decls.buffer128_as_seq", "Vale.PPC64LE.Decls.va_get_mem", "Vale.PPC64LE.Decls.modifies_mem", "Vale.PPC64LE.Decls.loc_buffer", "Vale.PPC64LE.Memory.vuint128", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Decls.va_get_reg", "Vale.PPC64LE.Machine_s.quad32", "Vale.PPC64LE.Decls.va_get_vec", "Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash", "Vale.PPC64LE.Decls.va_state_eq", "Vale.PPC64LE.Decls.va_update_stackTaint", "Vale.PPC64LE.Decls.va_update_stack", "Vale.PPC64LE.Decls.va_update_mem_layout", "Vale.PPC64LE.Decls.va_update_mem_heaplet", "Vale.PPC64LE.Decls.va_update_vec", "Vale.PPC64LE.Decls.va_update_cr0", "Vale.PPC64LE.Decls.va_update_reg", "Vale.PPC64LE.Decls.va_update_ok", "Vale.PPC64LE.Decls.va_update_mem", "Prims.prop" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "\n va_b0: Vale.PPC64LE.Decls.va_code ->\n va_s0: Vale.PPC64LE.Decls.va_state ->\n ctx_b: Vale.PPC64LE.Memory.buffer128 ->\n in_b: Vale.PPC64LE.Memory.buffer128 ->\n num_val: Vale.PPC64LE.Memory.nat64 ->\n k_b: Vale.PPC64LE.Memory.buffer128 ->\n va_sM: Vale.PPC64LE.Decls.va_state ->\n va_fM: Vale.PPC64LE.Decls.va_fuel\n -> Prims.prop", "prompt": "let va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n ", "expected_response": "(va_req_Sha_update_bytes_main va_b0 va_s0 ctx_b in_b num_val k_b /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let hash_in =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_s0)\n ctx_b))\n in\n let hash_out =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_sM)\n ctx_b))\n in\n (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_sM)\n in_b))\n in\n l_and ((FStar.Seq.Base.length #FStar.UInt8.t input_LE) `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\\n Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b)\n (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 /\\\n l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (va_get_vec 20 va_sM ==\n va_get_vec 20 va_s0)\n (va_get_vec 21 va_sM == va_get_vec 21 va_s0))\n (va_get_vec 22 va_sM == va_get_vec 22 va_s0))\n (va_get_vec 23 va_sM == va_get_vec 23 va_s0))\n (va_get_vec 24 va_sM == va_get_vec 24 va_s0))\n (va_get_vec 25 va_sM == va_get_vec 25 va_s0))\n (va_get_vec 26 va_sM == va_get_vec 26 va_s0))\n (va_get_vec 28 va_sM == va_get_vec 28 va_s0))\n (va_get_vec 29 va_sM == va_get_vec 29 va_s0))\n (va_get_vec 30 va_sM == va_get_vec 30 va_s0))\n (va_get_vec 31 va_sM == va_get_vec 31 va_s0)) /\\\n va_state_eq va_sM\n (va_update_stackTaint va_sM\n (va_update_stack va_sM\n (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0\n va_sM\n (va_update_vec 31\n va_sM\n (va_update_vec 30\n va_sM\n (va_update_vec 29\n va_sM\n (va_update_vec 28\n va_sM\n (va_update_vec 26\n va_sM\n (va_update_vec 25\n va_sM\n (va_update_vec 24\n va_sM\n (va_update_vec 23\n va_sM\n (va_update_vec 22\n va_sM\n (va_update_vec 21\n va_sM\n (va_update_vec 20\n va_sM\n (va_update_vec 19\n va_sM\n (va_update_vec 18\n va_sM\n (va_update_vec 17\n va_sM\n (va_update_vec 16\n va_sM\n (va_update_vec 15\n va_sM\n (va_update_vec 14\n va_sM\n (va_update_vec\n 13\n va_sM\n (va_update_vec\n 12\n va_sM\n (va_update_vec\n 11\n va_sM\n (\n va_update_vec\n 10\n va_sM\n (\n va_update_vec\n 9\n va_sM\n (\n va_update_vec\n 8\n va_sM\n (\n va_update_vec\n 7\n va_sM\n (\n va_update_vec\n 6\n va_sM\n (\n va_update_vec\n 5\n va_sM\n (\n va_update_vec\n 4\n va_sM\n (\n va_update_vec\n 3\n va_sM\n (\n va_update_vec\n 2\n va_sM\n (\n va_update_vec\n 1\n va_sM\n (\n va_update_vec\n 0\n va_sM\n (\n va_update_cr0\n va_sM\n (\n va_update_reg\n 10\n va_sM\n (\n va_update_reg\n 6\n va_sM\n (\n va_update_reg\n 5\n va_sM\n (\n va_update_reg\n 4\n va_sM\n (\n va_update_reg\n 1\n va_sM\n (\n va_update_ok\n va_sM\n (\n va_update_mem\n va_sM\n va_s0\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n\n )\n ))\n ))))))))))))\n )))))))))))", "source": { "project_name": "hacl-star", "file_name": "obj/Vale.SHA.PPC64LE.fsti", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Vale.SHA.PPC64LE.fsti", "checked_file": "dataset/Vale.SHA.PPC64LE.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Vale.SHA2.Wrapper.fsti.checked", "dataset/Vale.SHA.PPC64LE.SHA_helpers.fsti.checked", "dataset/Vale.SHA.PPC64LE.Loop.fsti.checked", "dataset/Vale.PPC64LE.State.fsti.checked", "dataset/Vale.PPC64LE.Stack_i.fsti.checked", "dataset/Vale.PPC64LE.QuickCodes.fsti.checked", "dataset/Vale.PPC64LE.QuickCode.fst.checked", "dataset/Vale.PPC64LE.Memory.fsti.checked", "dataset/Vale.PPC64LE.Machine_s.fst.checked", "dataset/Vale.PPC64LE.InsVector.fsti.checked", "dataset/Vale.PPC64LE.InsStack.fsti.checked", "dataset/Vale.PPC64LE.InsMem.fsti.checked", "dataset/Vale.PPC64LE.InsBasic.fsti.checked", "dataset/Vale.PPC64LE.Decls.fsti.checked", "dataset/Vale.Def.Words_s.fsti.checked", "dataset/Vale.Def.Words.Seq_s.fsti.checked", "dataset/Vale.Def.Types_s.fst.checked", "dataset/Vale.Def.Opaque_s.fsti.checked", "dataset/Vale.Arch.Types.fsti.checked", "dataset/Vale.Arch.HeapImpl.fsti.checked", "dataset/Spec.SHA2.fsti.checked", "dataset/Spec.Loops.fst.checked", "dataset/Spec.Hash.Definitions.fst.checked", "dataset/Spec.Agile.Hash.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.Seq.Base.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "val va_code_Sha_update_bytes_main : va_dummy:unit -> Tot va_code", "val va_codegen_success_Sha_update_bytes_main : va_dummy:unit -> Tot va_pbool", "let va_req_Sha_update_bytes_main (va_b0:va_code) (va_s0:va_state) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Sha_update_bytes_main ()) va_s0 /\\ va_get_ok va_s0 /\\\n (va_get_reg 1 va_s0 == Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\\\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ l_or\n (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b])) (ctx_b == in_b) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 ctx_b; Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 k_b])) (ctx_b == k_b) /\\ l_or (Vale.PPC64LE.Decls.locs_disjoint\n ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b;\n Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 k_b])) (in_b == k_b) /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n (va_get_reg 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0) Secret\n /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 6 va_s0) k_b 16\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem\n va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\\ num_val == va_get_reg\n 5 va_s0 /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 < pow2_64 /\\ va_get_reg 6\n va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply`\n va_get_reg 5 va_s0 /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_s0) k_b)))" ], "closest": [ "val va_ens_Sha_update_bytes_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Sha_update_bytes_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Sha_update_bytes_stdcall va_b0 va_s0 win ctx_b in_b num_val k_b /\\ va_ensure_total va_b0\n va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let (ctx_ptr:(va_int_range 0 18446744073709551615)) =\n (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range\n 0 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0)\n in let (num:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let (k_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in let hash_in =\n Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) ctx_b)) in let hash_out =\n Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM) ctx_b)) in (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM) in_b)) in l_and (FStar.Seq.Base.length\n #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out ==\n Vale.SHA.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\ Vale.X64.Decls.modifies_mem\n (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 ctx_b) (va_get_mem va_s0) (va_get_mem\n va_sM) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\ (win ==> va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp\n va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64\n rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\ (win\n ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==> va_get_xmm 8 va_sM == va_get_xmm 8\n va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ (win ==> va_get_xmm 10 va_sM ==\n va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ (win ==>\n va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==> va_get_xmm 13 va_sM == va_get_xmm 13\n va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ (win ==> va_get_xmm 15 va_sM\n == va_get_xmm 15 va_s0)) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack\n va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM\n (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM\n (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM\n (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM\n (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM\n (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0))))))))))))))))))))))))))))))))))))))))", "val va_req_Sha_update_bytes_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n : prop\nlet va_req_Sha_update_bytes_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Sha_update_bytes_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (ctx_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (num:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (k_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (sha_enabled /\\ sse_enabled) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 in_b]))\n (ctx_b == in_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (ctx_b == k_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 in_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (in_b == k_b) /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) ctx_ptr ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in_ptr\n in_b (4 `op_Multiply` num) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem va_s0) k_ptr k_b 16 (va_get_mem_layout va_s0) Secret /\\ num_val == num /\\ in_ptr +\n 64 `op_Multiply` num < pow2_64 /\\ Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 ctx_b == 2 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == 4 `op_Multiply` num /\\\n Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) k_b)))", "val va_qcode_Sha_update_bytes_main\n (va_mods: va_mods_t)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes_main ()))\nlet va_qcode_Sha_update_bytes_main (va_mods:va_mods_t) (ctx_b:buffer128) (in_b:buffer128)\n (num_val:nat64) (k_b:buffer128) : (va_quickCode unit (va_code_Sha_update_bytes_main ())) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 285 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_CreateHeaplets ([declare_buffer128 in_b 0 Secret Immutable; declare_buffer128 k_b 0\n Secret Immutable; declare_buffer128 ctx_b 0 Secret Mutable])) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 290 column 16 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Alloc_stack (16 `op_Multiply` 11)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 291 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 20) (16 `op_Multiply` 0)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 292 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 21) (16 `op_Multiply` 1)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 293 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 22) (16 `op_Multiply` 2)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 294 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 23) (16 `op_Multiply` 3)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 295 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 24) (16 `op_Multiply` 4)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 296 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 25) (16 `op_Multiply` 5)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 297 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 26) (16 `op_Multiply` 6)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 298 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 28) (16 `op_Multiply` 7)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 299 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 29) (16 `op_Multiply` 8)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 300 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 30) (16 `op_Multiply` 9)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 301 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Store_stack128 (va_op_vec_opr_vec 31) (16 `op_Multiply` 10)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 302 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Sha_update_bytes ctx_b in_b k_b) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 303 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 20) (16 `op_Multiply` 0)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 304 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 21) (16 `op_Multiply` 1)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 305 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 22) (16 `op_Multiply` 2)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 306 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 23) (16 `op_Multiply` 3)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 307 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 24) (16 `op_Multiply` 4)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 308 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 25) (16 `op_Multiply` 5)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 309 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 26) (16 `op_Multiply` 6)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 310 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 28) (16 `op_Multiply` 7)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 311 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 29) (16 `op_Multiply` 8)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 312 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 30) (16 `op_Multiply` 9)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 313 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Load_stack128 (va_op_vec_opr_vec 31) (16 `op_Multiply` 10)) (va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 314 column 18 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Dealloc_stack (16 `op_Multiply` 11)) (fun (va_s:va_state) _ -> let\n (hash_in:Vale.SHA.PPC64LE.SHA_helpers.hash256) = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_old_s) ctx_b)) in let (input_LE:(FStar.Seq.Base.seq FStar.UInt8.t)) =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b)) in let\n (va_arg36:Vale.SHA.PPC64LE.SHA_helpers.bytes) = input_LE in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 318 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_update_multi_opaque_vale_is_update_multi\n hash_in va_arg36) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 320 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_DestroyHeaplets ()) (va_QEmpty (())))))))))))))))))))))))))))))))", "val va_ens_Fmul1\n (va_b0: va_code)\n (va_s0: va_state)\n (dst_b inA_b: buffer64)\n (inB: nat64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul1 (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB:nat64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul1 va_b0 va_s0 dst_b inA_b inB /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok\n va_sM /\\ (let (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem\n va_s0) in let (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem\n va_s0) in let (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem\n va_s0) in let (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem\n va_s0) in let (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime == va_mul_nat a\n (va_get_reg64 rRdx va_s0) `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer dst_b\n (va_get_mem va_s0) (va_get_mem va_sM)) /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))", "val va_ens_Poly1305\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (ctx_b inp_b: buffer64)\n (len_in finish_in: nat64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Poly1305 (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer64) (inp_b:buffer64)\n (len_in:nat64) (finish_in:nat64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Poly1305 va_b0 va_s0 win ctx_b inp_b len_in finish_in /\\ va_ensure_total va_b0 va_s0\n va_sM va_fM /\\ va_get_ok va_sM /\\ (let (ctx_in:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (n:(va_int_range 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let\n (p:(va_int_range 1361129467683753853853498429727072845819\n 1361129467683753853853498429727072845819)) = va_mul_nat n n `op_Multiply` 4 - 5 in\n Vale.Poly1305.Util.modifies_buffer ctx_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (let h0_in =\n Vale.X64.Decls.buffer64_read ctx_b 0 (va_get_mem va_s0) in let h1_in =\n Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem va_s0) in let h2_in =\n Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in let key_r0 =\n Vale.X64.Decls.buffer64_read ctx_b 3 (va_get_mem va_s0) in let key_r1 =\n Vale.X64.Decls.buffer64_read ctx_b 4 (va_get_mem va_s0) in let key_s0 =\n Vale.X64.Decls.buffer64_read ctx_b 5 (va_get_mem va_s0) in let key_s1 =\n Vale.X64.Decls.buffer64_read ctx_b 6 (va_get_mem va_s0) in let h_in =\n Vale.Poly1305.Math.lowerUpper192 (Vale.Poly1305.Math.lowerUpper128 h0_in h1_in) h2_in in let\n key_r = Vale.Poly1305.Math.lowerUpper128 key_r0 key_r1 in let key_s =\n Vale.Poly1305.Math.lowerUpper128 key_s0 key_s1 in let h0_out = Vale.X64.Decls.buffer64_read\n ctx_b 0 (va_get_mem va_sM) in let h1_out = Vale.X64.Decls.buffer64_read ctx_b 1 (va_get_mem\n va_sM) in let h2_out = Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_sM) in let h10 =\n Vale.Poly1305.Math.lowerUpper128 h0_out h1_out in let h210 = Vale.Poly1305.Math.lowerUpper192\n h10 h2_out in let inp_mem = Vale.Poly1305.Util.seqTo128 (Vale.X64.Decls.buffer64_as_seq\n (va_get_mem va_sM) inp_b) in (finish_in == 0 ==> Vale.Poly1305.Spec_s.modp h210 ==\n Vale.Poly1305.Spec_s.poly1305_hash_blocks (Vale.Poly1305.Spec_s.modp h_in) (va_mul_nat n n)\n (Vale.Poly1305.Spec_s.make_r key_r) inp_mem (len_in `op_Division` 16)) /\\ (finish_in == 0 ==>\n h2_out < 5) /\\ (finish_in == 1 ==> h10 == Vale.Poly1305.Spec_s.poly1305_hash_all\n (Vale.Poly1305.Spec_s.modp h_in) key_r key_s inp_mem len_in) /\\ va_get_reg64 rRsp va_sM ==\n va_get_reg64 rRsp va_s0 /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win\n ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0 /\\ va_get_reg64\n rR12 va_sM == va_get_reg64 rR12 va_s0 /\\ va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0 /\\\n va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\\ va_get_reg64 rR15 va_sM == va_get_reg64\n rR15 va_s0)) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_flags va_sM\n (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0))))))))))))))))))))))))", "val va_wp_Sha_update_bytes\n (ctx_b in_b k_b: buffer128)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Sha_update_bytes (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) (va_s0:va_state)\n (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg\n 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0\n va_s0) (va_get_reg 6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b\n 13 3 (va_get_mem_layout va_s0) Secret /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5\n va_s0 < pow2_64 /\\ va_get_reg 6 va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128\n ctx_b in_b /\\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply`\n va_get_reg 5 va_s0 /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_s0) k_b)) /\\ (forall (va_x_mem:vale_heap) (va_x_r4:nat64)\n (va_x_r5:nat64) (va_x_r6:nat64) (va_x_r10:nat64) (va_x_cr0:cr0_t) (va_x_v0:quad32)\n (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32)\n (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)\n (va_x_v11:quad32) (va_x_v12:quad32) (va_x_v13:quad32) (va_x_v14:quad32) (va_x_v15:quad32)\n (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)\n (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)\n (va_x_v26:quad32) (va_x_v28:quad32) (va_x_v29:quad32) (va_x_v30:quad32) (va_x_v31:quad32)\n (va_x_heap0:vale_heap) (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout\n va_x_memLayout (va_upd_mem_heaplet 0 va_x_heap0 (va_upd_vec 31 va_x_v31 (va_upd_vec 30 va_x_v30\n (va_upd_vec 29 va_x_v29 (va_upd_vec 28 va_x_v28 (va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25\n (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21\n (va_upd_vec 20 va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17\n (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13\n (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9\n (va_upd_vec 8 va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5\n (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1\n (va_upd_vec 0 va_x_v0 (va_upd_cr0 va_x_cr0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6\n (va_upd_reg 5 va_x_r5 (va_upd_reg 4 va_x_r4 (va_upd_mem va_x_mem\n va_s0)))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\\ (va_get_reg 4 va_sM ==\n va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 /\\ (let hash_in =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) ctx_b)) in let hash_out =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) ctx_b)) in (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b)) in l_and\n (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out ==\n Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_vale hash_in input_LE)) /\\\n Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM))) ==> va_k va_sM (())))", "val va_wp_Sha_update_bytes\n (ctx_b in_b k_b: buffer128)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Sha_update_bytes (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) (va_s0:va_state)\n (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b (4 `op_Multiply` va_get_reg64 rRdx\n va_s0) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet\n 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16\n (va_get_mem_layout va_s0) Secret /\\ va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64\n rRdx va_s0 < pow2_64 /\\ Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 ctx_b == 2 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == 4 `op_Multiply` va_get_reg64\n rRdx va_s0 /\\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet\n 0 va_s0) k_b)) /\\ (forall (va_x_mem:vale_heap) (va_x_rsi:nat64) (va_x_rdx:nat64)\n (va_x_rax:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32)\n (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32)\n (va_x_xmm9:quad32) (va_x_xmm10:quad32) (va_x_heap0:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let\n va_sM = va_upd_flags va_x_efl (va_upd_mem_heaplet 0 va_x_heap0 (va_upd_xmm 10 va_x_xmm10\n (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6\n (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2\n (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rRdx\n va_x_rdx (va_upd_reg64 rRsi va_x_rsi (va_upd_mem va_x_mem va_s0)))))))))))))))) in va_get_ok\n va_sM /\\ (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64\n rRdx va_s0 /\\ (let hash_in = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_s0) ctx_b)) in let hash_out = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_sM) ctx_b)) in (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.SHA_helpers.update_multi_opaque_vale hash_in input_LE)) /\\\n Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM))) ==> va_k va_sM (())))", "val va_wpProof_Sha_update_bytes_main : ctx_b:buffer128 -> in_b:buffer128 -> num_val:nat64 ->\n k_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update_bytes_main ctx_b in_b num_val k_b va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update_bytes_main ())\n ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31;\n va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;\n va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;\n va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12;\n va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;\n va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0;\n va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_reg 1; va_Mod_mem]) va_s0 va_k\n ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sha_update_bytes_main ctx_b in_b num_val k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update_bytes_main (va_code_Sha_update_bytes_main ()) va_s0\n ctx_b in_b num_val k_b in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_vec 31 va_sM\n (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM (va_update_vec 26 va_sM\n (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM\n (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM\n (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM\n (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM\n (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM\n (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM\n (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM (va_update_reg 10 va_sM\n (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM (va_update_reg 1 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_vec 31; va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25;\n va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19;\n va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13;\n va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7;\n va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec\n 0; va_Mod_cr0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_reg 1;\n va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_ens_Fmul\n (va_b0: va_code)\n (va_s0: va_state)\n (tmp_b inA_b dst_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul (va_b0:va_code) (va_s0:va_state) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64)\n (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul va_b0 va_s0 tmp_b inA_b dst_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) =\n va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) =\n va_get_reg64 rRcx va_s0 in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == va_mul_nat a b `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b\n (va_get_mem va_s0) (va_get_mem va_sM)) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR14 va_sM\n (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0))))))))))))))))))", "val va_ens_Fsqr\n (va_b0: va_code)\n (va_s0: va_state)\n (tmp_b inA_b dst_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsqr (va_b0:va_code) (va_s0:va_state) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsqr va_b0 va_s0 tmp_b inA_b dst_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) =\n va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR12 va_s0 in let a0 =\n Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d = Vale.Curve25519.Fast_defs.pow2_four\n d0 d1 d2 d3 in d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime /\\ va_get_reg64 rR12\n va_s0 == va_get_reg64 rR12 va_sM /\\ Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem\n va_s0) (va_get_mem va_sM)) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))", "val va_ens_Fast_add1\n (va_b0: va_code)\n (va_s0: va_state)\n (dst_b inA_b: buffer64)\n (inB: nat64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fast_add1 (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB:nat64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fast_add1 va_b0 va_s0 dst_b inA_b inB /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0\n (va_get_mem va_s0) in let (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1\n (va_get_mem va_s0) in let (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2\n (va_get_mem va_s0) in let (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3\n (va_get_mem va_s0) in let (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in\n let d0 = Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_five d0 d1 d2 d3 (va_get_reg64 rRax va_sM) in d == a +\n va_get_reg64 rRdx va_s0 /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem\n va_sM)) /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))", "val va_ens_Fsub\n (va_b0: va_code)\n (va_s0: va_state)\n (dst_b inA_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsub (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB_b:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsub va_b0 va_s0 dst_b inA_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0\n (va_get_mem va_s0) in let (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1\n (va_get_mem va_s0) in let (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2\n (va_get_mem va_s0) in let (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3\n (va_get_mem va_s0) in let (b0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 0\n (va_get_mem va_s0) in let (b1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 1\n (va_get_mem va_s0) in let (b2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 2\n (va_get_mem va_s0) in let (b3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 3\n (va_get_mem va_s0) in let (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in\n let (b:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime == (a - b) `op_Modulus`\n prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0\n va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))", "val va_ens_Gctr_bytes_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (in_b: buffer128)\n (num_bytes: nat64)\n (out_b inout_b keys_b ctr_b: buffer128)\n (num_blocks: nat64)\n (key: (seq nat32))\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Gctr_bytes_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (in_b:buffer128) (num_bytes:nat64) (out_b:buffer128) (inout_b:buffer128) (keys_b:buffer128)\n (ctr_b:buffer128) (num_blocks:nat64) (key:(seq nat32)) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Gctr_bytes_stdcall va_b0 va_s0 win alg in_b num_bytes out_b inout_b keys_b ctr_b\n num_blocks key /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let\n (in_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (out_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in\n let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else\n va_get_reg64 rR8 va_s0) in let (ctr_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) else\n va_get_reg64 rR9 va_s0) in Vale.X64.Decls.modifies_buffer128_2 out_b inout_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (let plain_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32\n (Vale.X64.Decls.s128 (va_get_mem va_s0) in_b) (Vale.X64.Decls.s128 (va_get_mem va_s0) inout_b)\n in let plain_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes plain_quads) 0 num_bytes in let cipher_quads =\n FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_sM) out_b)\n (Vale.X64.Decls.s128 (va_get_mem va_sM) inout_b) in let cipher_bytes = FStar.Seq.Base.slice\n #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes cipher_quads) 0 num_bytes in\n cipher_bytes == Vale.AES.GCTR_s.gctr_encrypt_LE (Vale.X64.Decls.buffer128_read ctr_b 0\n (va_get_mem va_s0)) (Vale.AES.GCTR.make_gctr_plain_LE plain_bytes) alg key /\\ va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0 /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64\n rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi\n va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (win ==> va_get_reg64\n rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6\n va_sM == va_get_xmm 6 va_s0) /\\ (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==>\n va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0)\n /\\ (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM ==\n va_get_xmm 11 va_s0) /\\ (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==>\n va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14\n va_s0) /\\ (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0) /\\ (~win ==> va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp\n va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (~win ==>\n va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM ==\n va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0))) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_flags va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM\n (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM\n (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM\n (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM\n (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM\n (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0)))))))))))))))))))))))))))))))))))))))))", "val va_ens_Fadd\n (va_b0: va_code)\n (va_s0: va_state)\n (dst_b inA_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fadd (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB_b:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fadd va_b0 va_s0 dst_b inA_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0\n (va_get_mem va_s0) in let (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1\n (va_get_mem va_s0) in let (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2\n (va_get_mem va_s0) in let (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3\n (va_get_mem va_s0) in let (b0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 0\n (va_get_mem va_s0) in let (b1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 1\n (va_get_mem va_s0) in let (b2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 2\n (va_get_mem va_s0) in let (b3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 3\n (va_get_mem va_s0) in let (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in\n let (b:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime == (a + b) `op_Modulus`\n prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\\n va_state_eq va_sM (va_update_flags va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0\n va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))", "val va_ens_Cswap2\n (va_b0: va_code)\n (va_s0: va_state)\n (bit_in: nat64)\n (p0_b p1_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Cswap2 (va_b0:va_code) (va_s0:va_state) (bit_in:nat64) (p0_b:buffer64) (p1_b:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Cswap2 va_b0 va_s0 bit_in p0_b p1_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (old_p0_0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 0\n (va_get_mem va_s0) in let (old_p0_1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b\n 1 (va_get_mem va_s0) in let (old_p0_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p0_b 2 (va_get_mem va_s0) in let (old_p0_3:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p0_b 3 (va_get_mem va_s0) in let (old_p0_4:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p0_b 4 (va_get_mem va_s0) in let\n (old_p0_5:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 5 (va_get_mem va_s0) in\n let (old_p0_6:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 6 (va_get_mem va_s0)\n in let (old_p0_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 7 (va_get_mem\n va_s0) in let (old_p1_0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 0\n (va_get_mem va_s0) in let (old_p1_1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b\n 1 (va_get_mem va_s0) in let (old_p1_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p1_b 2 (va_get_mem va_s0) in let (old_p1_3:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p1_b 3 (va_get_mem va_s0) in let (old_p1_4:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p1_b 4 (va_get_mem va_s0) in let\n (old_p1_5:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 5 (va_get_mem va_s0) in\n let (old_p1_6:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 6 (va_get_mem va_s0)\n in let (old_p1_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 7 (va_get_mem\n va_s0) in Vale.X64.Decls.modifies_buffer_2 p0_b p1_b (va_get_mem va_s0) (va_get_mem va_sM) /\\\n (let p0_0 = Vale.X64.Decls.buffer64_read p0_b 0 (va_get_mem va_sM) in let p0_1 =\n Vale.X64.Decls.buffer64_read p0_b 1 (va_get_mem va_sM) in let p0_2 =\n Vale.X64.Decls.buffer64_read p0_b 2 (va_get_mem va_sM) in let p0_3 =\n Vale.X64.Decls.buffer64_read p0_b 3 (va_get_mem va_sM) in let p0_4 =\n Vale.X64.Decls.buffer64_read p0_b 4 (va_get_mem va_sM) in let p0_5 =\n Vale.X64.Decls.buffer64_read p0_b 5 (va_get_mem va_sM) in let p0_6 =\n Vale.X64.Decls.buffer64_read p0_b 6 (va_get_mem va_sM) in let p0_7 =\n Vale.X64.Decls.buffer64_read p0_b 7 (va_get_mem va_sM) in let p1_0 =\n Vale.X64.Decls.buffer64_read p1_b 0 (va_get_mem va_sM) in let p1_1 =\n Vale.X64.Decls.buffer64_read p1_b 1 (va_get_mem va_sM) in let p1_2 =\n Vale.X64.Decls.buffer64_read p1_b 2 (va_get_mem va_sM) in let p1_3 =\n Vale.X64.Decls.buffer64_read p1_b 3 (va_get_mem va_sM) in let p1_4 =\n Vale.X64.Decls.buffer64_read p1_b 4 (va_get_mem va_sM) in let p1_5 =\n Vale.X64.Decls.buffer64_read p1_b 5 (va_get_mem va_sM) in let p1_6 =\n Vale.X64.Decls.buffer64_read p1_b 6 (va_get_mem va_sM) in let p1_7 =\n Vale.X64.Decls.buffer64_read p1_b 7 (va_get_mem va_sM) in p0_0 == (if (va_get_reg64 rRdi va_s0\n = 1) then old_p1_0 else old_p0_0) /\\ p0_1 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p1_1\n else old_p0_1) /\\ p0_2 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p1_2 else old_p0_2) /\\\n p0_3 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p1_3 else old_p0_3) /\\ p0_4 == (if\n (va_get_reg64 rRdi va_s0 = 1) then old_p1_4 else old_p0_4) /\\ p0_5 == (if (va_get_reg64 rRdi\n va_s0 = 1) then old_p1_5 else old_p0_5) /\\ p0_6 == (if (va_get_reg64 rRdi va_s0 = 1) then\n old_p1_6 else old_p0_6) /\\ p0_7 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p1_7 else\n old_p0_7) /\\ p1_0 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p0_0 else old_p1_0) /\\ p1_1 ==\n (if (va_get_reg64 rRdi va_s0 = 1) then old_p0_1 else old_p1_1) /\\ p1_2 == (if (va_get_reg64\n rRdi va_s0 = 1) then old_p0_2 else old_p1_2) /\\ p1_3 == (if (va_get_reg64 rRdi va_s0 = 1) then\n old_p0_3 else old_p1_3) /\\ p1_4 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p0_4 else\n old_p1_4) /\\ p1_5 == (if (va_get_reg64 rRdi va_s0 = 1) then old_p0_5 else old_p1_5) /\\ p1_6 ==\n (if (va_get_reg64 rRdi va_s0 = 1) then old_p0_6 else old_p1_6) /\\ p1_7 == (if (va_get_reg64\n rRdi va_s0 = 1) then old_p0_7 else old_p1_7))) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRdi va_sM (va_update_ok\n va_sM (va_update_mem va_sM va_s0))))))))))", "val va_ens_Fsqr2\n (va_b0: va_code)\n (va_s0: va_state)\n (tmp_b inA_b dst_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsqr2 (va_b0:va_code) (va_s0:va_state) (tmp_b:buffer64) (inA_b:buffer64)\n (dst_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsqr2 va_b0 va_s0 tmp_b inA_b dst_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) =\n va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR12 va_s0 in let a0 =\n Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let a0' =\n Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let a1' =\n Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d0' =\n Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in let d1' =\n Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in let d2' =\n Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let a' = Vale.Curve25519.Fast_defs.pow2_four\n a0' a1' a2' a3' in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a a\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' a' `op_Modulus` prime /\\\n va_get_reg64 rR12 va_s0 == va_get_reg64 rR12 va_sM /\\ Vale.X64.Decls.modifies_buffer_2 dst_b\n tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))", "val va_ens_Fmul2\n (va_b0: va_code)\n (va_s0: va_state)\n (tmp_b inA_b dst_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul2 (va_b0:va_code) (va_s0:va_state) (tmp_b:buffer64) (inA_b:buffer64)\n (dst_b:buffer64) (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul2 va_b0 va_s0 tmp_b inA_b dst_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (let (tmp_in:nat64) = va_get_reg64 rRdi va_s0 in let (inA_in:nat64) =\n va_get_reg64 rRsi va_s0 in let (dst_in:nat64) = va_get_reg64 rR15 va_s0 in let (inB_in:nat64) =\n va_get_reg64 rRcx va_s0 in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let\n a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let b0' =\n Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in let b1' =\n Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in let b2' =\n Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in let b3' =\n Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in let a' =\n Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in let b' =\n Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in let d0 = Vale.X64.Decls.buffer64_read\n dst_b 0 (va_get_mem va_sM) in let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM)\n in let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d0' = Vale.X64.Decls.buffer64_read dst_b\n (0 + 4) (va_get_mem va_sM) in let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem\n va_sM) in let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a b\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\\n va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags\n va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))", "val va_ens_Test\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Test (va_b0:va_code) (va_s0:va_state) (win:bool) (arg0:buffer64) (arg1:buffer64)\n (arg2:buffer64) (arg3:buffer64) (arg4:buffer64) (arg5:buffer64) (arg6:buffer64) (arg7:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Test va_b0 va_s0 win arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7 /\\ va_ensure_total va_b0\n va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 /\\ va_get_reg64 rRbp va_sM == va_get_reg64\n rRbp va_s0 /\\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0 /\\ va_get_reg64 rR13 va_sM ==\n va_get_reg64 rR13 va_s0 /\\ va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0 /\\ va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0 /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi\n va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_xmm 6\n va_sM == va_get_xmm 6 va_s0) /\\ (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==>\n va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0)\n /\\ (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM ==\n va_get_xmm 11 va_s0) /\\ (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==>\n va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14\n va_s0) /\\ (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0) /\\ Vale.X64.Decls.modifies_mem\n loc_none (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14\n va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10\n va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6\n va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2\n va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))", "val va_ens_Memcpy\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst src: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Memcpy (va_b0:va_code) (va_s0:va_state) (win:bool) (dst:buffer64) (src:buffer64)\n (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Memcpy va_b0 va_s0 win dst src /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok\n va_sM /\\ Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) dst ==\n Vale.X64.Memory.buffer_as_seq #Vale.X64.Memory.vuint64 (va_get_mem va_sM) src /\\\n Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint64 dst)\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_state_eq va_sM (va_update_mem_heaplet 1 va_sM\n (va_update_mem_layout va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))", "val va_ens_Keyhash_init\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (key: (seq nat32))\n (roundkeys_b hkeys_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Keyhash_init (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm) (key:(seq\n nat32)) (roundkeys_b:buffer128) (hkeys_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Keyhash_init va_b0 va_s0 win alg key roundkeys_b hkeys_b /\\ va_ensure_total va_b0 va_s0\n va_sM va_fM /\\ va_get_ok va_sM /\\ (let (round_ptr:(va_int_range 0 18446744073709551615)) = (if\n win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n Vale.X64.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0) (va_get_mem va_sM) /\\\n Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_sM) hkeys_b)\n (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key\n (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\\ va_get_xmm 6 va_sM == va_get_xmm\n 6 va_s0 /\\ va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ va_state_eq va_sM\n (va_update_flags va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM\n (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))", "val va_ens_Keyhash_init\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (key: (seq nat32))\n (roundkeys_b hkeys_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Keyhash_init (va_b0:va_code) (va_s0:va_state) (alg:algorithm) (key:(seq nat32))\n (roundkeys_b:buffer128) (hkeys_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Keyhash_init va_b0 va_s0 alg key roundkeys_b hkeys_b /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ Vale.PPC64LE.Decls.modifies_buffer128 hkeys_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ Vale.AES.OptPublic_BE.hkeys_reqs_pub\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_sM) hkeys_b))\n (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0\n 0 0 0)) /\\ va_state_eq va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4\n va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0\n va_sM (va_update_reg 10 va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 1 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))", "val va_ens_Fmul1_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b: buffer64)\n (inB_in: nat64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul1_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_in:nat64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul1_stdcall va_b0 va_s0 win dst_b inA_b inB_in /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d = Vale.Curve25519.Fast_defs.pow2_four\n d0 d1 d2 d3 in d `op_Modulus` prime == va_mul_nat a inB_in `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==>\n va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM ==\n va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\\n va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ va_state_eq va_sM (va_update_stackTaint\n va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64\n rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))", "val va_ens_Check_sha_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_sha_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_sha_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok\n va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> sha_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_lemma_Sha_update_bytes_main : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128 ->\n in_b:buffer128 -> num_val:nat64 -> k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update_bytes_main ()) va_s0 /\\ va_get_ok va_s0 /\\\n (va_get_reg 1 va_s0 == Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\\\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ l_or\n (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b])) (ctx_b == in_b) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 ctx_b; Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 k_b])) (ctx_b == k_b) /\\ l_or (Vale.PPC64LE.Decls.locs_disjoint\n ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b;\n Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 k_b])) (in_b == k_b) /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n (va_get_reg 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0) Secret\n /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 6 va_s0) k_b 16\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem\n va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\\ num_val == va_get_reg\n 5 va_s0 /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 < pow2_64 /\\ va_get_reg 6\n va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply`\n va_get_reg 5 va_s0 /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let hash_in = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_s0) ctx_b)) in let hash_out = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) ctx_b)) in (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\\n Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b) (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 /\\\n l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (va_get_vec 20 va_sM ==\n va_get_vec 20 va_s0) (va_get_vec 21 va_sM == va_get_vec 21 va_s0)) (va_get_vec 22 va_sM ==\n va_get_vec 22 va_s0)) (va_get_vec 23 va_sM == va_get_vec 23 va_s0)) (va_get_vec 24 va_sM ==\n va_get_vec 24 va_s0)) (va_get_vec 25 va_sM == va_get_vec 25 va_s0)) (va_get_vec 26 va_sM ==\n va_get_vec 26 va_s0)) (va_get_vec 28 va_sM == va_get_vec 28 va_s0)) (va_get_vec 29 va_sM ==\n va_get_vec 29 va_s0)) (va_get_vec 30 va_sM == va_get_vec 30 va_s0)) (va_get_vec 31 va_sM ==\n va_get_vec 31 va_s0)) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_vec 31 va_sM\n (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM (va_update_vec 26 va_sM\n (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM (va_update_vec 22 va_sM\n (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM\n (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM\n (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM\n (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM\n (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM\n (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM (va_update_reg 10 va_sM\n (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM (va_update_reg 1 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))))))\nlet va_lemma_Sha_update_bytes_main va_b0 va_s0 ctx_b in_b num_val k_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_vec 31; va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25;\n va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19;\n va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13;\n va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7;\n va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec\n 0; va_Mod_cr0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_reg 1;\n va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Sha_update_bytes_main va_mods ctx_b in_b num_val k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update_bytes_main ()) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 237 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 271 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let hash_in = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_s0) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 272 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let hash_out = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 276 column 110 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 278 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b) (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 279 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_reg 1 va_sM == va_get_reg 1 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 283 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (l_and (va_get_vec 20 va_sM ==\n va_get_vec 20 va_s0) (va_get_vec 21 va_sM == va_get_vec 21 va_s0)) (va_get_vec 22 va_sM ==\n va_get_vec 22 va_s0)) (va_get_vec 23 va_sM == va_get_vec 23 va_s0)) (va_get_vec 24 va_sM ==\n va_get_vec 24 va_s0)) (va_get_vec 25 va_sM == va_get_vec 25 va_s0)) (va_get_vec 26 va_sM ==\n va_get_vec 26 va_s0)) (va_get_vec 28 va_sM == va_get_vec 28 va_s0)) (va_get_vec 29 va_sM ==\n va_get_vec 29 va_s0)) (va_get_vec 30 va_sM == va_get_vec 30 va_s0)) (va_get_vec 31 va_sM ==\n va_get_vec 31 va_s0))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_vec 31; va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25;\n va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19;\n va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13;\n va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7;\n va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec\n 0; va_Mod_cr0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_reg 1;\n va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_ens_Fsub_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsub_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsub_stdcall va_b0 va_s0 win dst_b inA_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM\n /\\ va_get_ok va_sM /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == (a - b) `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM ==\n va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13\n va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))))))))", "val va_ens_Fsqr2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsqr2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsqr2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let a0' =\n Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let a1' =\n Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d0' =\n Vale.X64.Decls.buffer64_read dst_b (0 + 4) (va_get_mem va_sM) in let d1' =\n Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem va_sM) in let d2' =\n Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let a' = Vale.Curve25519.Fast_defs.pow2_four\n a0' a1' a2' a3' in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a a\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' a' `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))", "val va_ens_Fast_add1_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b: buffer64)\n (inB_in: nat64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fast_add1_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_in:nat64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fast_add1_stdcall va_b0 va_s0 win dst_b inA_b inB_in /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let a1 =\n Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d = Vale.Curve25519.Fast_defs.pow2_five\n d0 d1 d2 d3 (va_get_reg64 rRax va_sM) in d == a + inB_in /\\ Vale.X64.Decls.modifies_buffer\n dst_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==>\n va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM ==\n va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14\n va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM ==\n va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM ==\n va_get_reg64 rRsp va_s0) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack\n va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM\n (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))", "val va_ens_Fsqr_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fsqr_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fsqr_stdcall va_b0 va_s0 win tmp_b inA_b dst_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM\n /\\ va_get_ok va_sM /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let d = Vale.Curve25519.Fast_defs.pow2_four\n d0 d1 d2 d3 in d `op_Modulus` prime == va_mul_nat a a `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))", "val va_ens_Check_avx_xcr0_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_avx_xcr0_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_avx_xcr0_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> avx_xcr0) /\\ va_state_eq va_sM\n (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64\n rRax va_sM (va_update_ok va_sM va_s0))))))", "val va_wp_Sha_update\n (ctx_b in_b k_b: buffer128)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Sha_update (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) (va_s0:va_state)\n (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg\n 3 va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0)\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0\n va_s0) (va_get_reg 6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b\n 13 3 (va_get_mem_layout va_s0) Secret /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5\n va_s0 < pow2_64 /\\ va_get_reg 6 va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128\n ctx_b in_b /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_s0) k_b)) /\\ (forall (va_x_mem:vale_heap) (va_x_r4:nat64)\n (va_x_r5:nat64) (va_x_r6:nat64) (va_x_r10:nat64) (va_x_cr0:cr0_t) (va_x_v0:quad32)\n (va_x_v1:quad32) (va_x_v2:quad32) (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32)\n (va_x_v6:quad32) (va_x_v7:quad32) (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32)\n (va_x_v11:quad32) (va_x_v12:quad32) (va_x_v13:quad32) (va_x_v14:quad32) (va_x_v15:quad32)\n (va_x_v16:quad32) (va_x_v17:quad32) (va_x_v18:quad32) (va_x_v19:quad32) (va_x_v20:quad32)\n (va_x_v21:quad32) (va_x_v22:quad32) (va_x_v23:quad32) (va_x_v24:quad32) (va_x_v25:quad32)\n (va_x_v26:quad32) (va_x_v28:quad32) (va_x_v29:quad32) (va_x_v30:quad32) (va_x_v31:quad32)\n (va_x_heap0:vale_heap) (va_x_memLayout:vale_heap_layout) . let va_sM = va_upd_mem_layout\n va_x_memLayout (va_upd_mem_heaplet 0 va_x_heap0 (va_upd_vec 31 va_x_v31 (va_upd_vec 30 va_x_v30\n (va_upd_vec 29 va_x_v29 (va_upd_vec 28 va_x_v28 (va_upd_vec 26 va_x_v26 (va_upd_vec 25 va_x_v25\n (va_upd_vec 24 va_x_v24 (va_upd_vec 23 va_x_v23 (va_upd_vec 22 va_x_v22 (va_upd_vec 21 va_x_v21\n (va_upd_vec 20 va_x_v20 (va_upd_vec 19 va_x_v19 (va_upd_vec 18 va_x_v18 (va_upd_vec 17 va_x_v17\n (va_upd_vec 16 va_x_v16 (va_upd_vec 15 va_x_v15 (va_upd_vec 14 va_x_v14 (va_upd_vec 13 va_x_v13\n (va_upd_vec 12 va_x_v12 (va_upd_vec 11 va_x_v11 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9\n (va_upd_vec 8 va_x_v8 (va_upd_vec 7 va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5\n (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3 (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1\n (va_upd_vec 0 va_x_v0 (va_upd_cr0 va_x_cr0 (va_upd_reg 10 va_x_r10 (va_upd_reg 6 va_x_r6\n (va_upd_reg 5 va_x_r5 (va_upd_reg 4 va_x_r4 (va_upd_mem va_x_mem\n va_s0)))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\\ (va_get_reg 4 va_sM ==\n va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 /\\ (let dcba =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let hgfe =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let dcba' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let hgfe' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32 (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg 5 va_s0) in let input_BE =\n Vale.Arch.Types.reverse_bytes_quad32_seq input_LE in\n Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba' hgfe' ==\n Vale.SHA.PPC64LE.SHA_helpers.update_multi_quads input_BE\n (Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba hgfe)) /\\\n Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)) ==> va_k va_sM (())))", "val va_wp_Sha_update\n (ctx_b in_b k_b: buffer128)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Sha_update (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) (va_s0:va_state)\n (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRsi va_s0) in_b (4 `op_Multiply` va_get_reg64 rRdx\n va_s0) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet\n 0 va_s0) (va_get_reg64 rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16\n (va_get_mem_layout va_s0) Secret /\\ va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64\n rRdx va_s0 < pow2_64 /\\ Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b))\n /\\ (forall (va_x_mem:vale_heap) (va_x_rsi:nat64) (va_x_rdx:nat64) (va_x_rax:nat64)\n (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32)\n (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32)\n (va_x_xmm10:quad32) (va_x_heap0:vale_heap) (va_x_efl:Vale.X64.Flags.t) . let va_sM =\n va_upd_flags va_x_efl (va_upd_mem_heaplet 0 va_x_heap0 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9\n va_x_xmm9 (va_upd_xmm 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5\n va_x_xmm5 (va_upd_xmm 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1\n va_x_xmm1 (va_upd_xmm 0 va_x_xmm0 (va_upd_reg64 rRax va_x_rax (va_upd_reg64 rRdx va_x_rdx\n (va_upd_reg64 rRsi va_x_rsi (va_upd_mem va_x_mem va_s0)))))))))))))))) in va_get_ok va_sM /\\\n (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0\n /\\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let efgh =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let abcd' =\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh' =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0) in let input_BE\n = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in\n Vale.SHA.SHA_helpers.make_ordered_hash abcd' efgh' == Vale.SHA.SHA_helpers.update_multi_quads\n input_BE (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) /\\\n Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)) ==> va_k va_sM (())))", "val va_quick_Sha_update_bytes (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes ()))\nlet va_quick_Sha_update_bytes (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) : (va_quickCode\n unit (va_code_Sha_update_bytes ())) =\n (va_QProc (va_code_Sha_update_bytes ()) ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10;\n va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm\n 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64\n rRsi; va_Mod_mem]) (va_wp_Sha_update_bytes ctx_b in_b k_b) (va_wpProof_Sha_update_bytes ctx_b\n in_b k_b))", "val va_quick_Sha_update_bytes (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes ()))\nlet va_quick_Sha_update_bytes (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) : (va_quickCode\n unit (va_code_Sha_update_bytes ())) =\n (va_QProc (va_code_Sha_update_bytes ()) ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31;\n va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;\n va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;\n va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12;\n va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;\n va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0;\n va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_mem]) (va_wp_Sha_update_bytes\n ctx_b in_b k_b) (va_wpProof_Sha_update_bytes ctx_b in_b k_b))", "val va_ens_Fmul2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul2_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b /\\ va_ensure_total va_b0 va_s0\n va_sM va_fM /\\ va_get_ok va_sM /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in let a0 = Vale.X64.Decls.buffer64_read\n inA_b 0 (va_get_mem va_s0) in let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0)\n in let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let a0' = Vale.X64.Decls.buffer64_read inA_b (0 + 4) (va_get_mem va_s0) in let\n a1' = Vale.X64.Decls.buffer64_read inA_b (1 + 4) (va_get_mem va_s0) in let a2' =\n Vale.X64.Decls.buffer64_read inA_b (2 + 4) (va_get_mem va_s0) in let a3' =\n Vale.X64.Decls.buffer64_read inA_b (3 + 4) (va_get_mem va_s0) in let b0' =\n Vale.X64.Decls.buffer64_read inB_b (0 + 4) (va_get_mem va_s0) in let b1' =\n Vale.X64.Decls.buffer64_read inB_b (1 + 4) (va_get_mem va_s0) in let b2' =\n Vale.X64.Decls.buffer64_read inB_b (2 + 4) (va_get_mem va_s0) in let b3' =\n Vale.X64.Decls.buffer64_read inB_b (3 + 4) (va_get_mem va_s0) in let a' =\n Vale.Curve25519.Fast_defs.pow2_four a0' a1' a2' a3' in let b' =\n Vale.Curve25519.Fast_defs.pow2_four b0' b1' b2' b3' in let d0 = Vale.X64.Decls.buffer64_read\n dst_b 0 (va_get_mem va_sM) in let d1 = Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM)\n in let d2 = Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let d =\n Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in let d0' = Vale.X64.Decls.buffer64_read dst_b\n (0 + 4) (va_get_mem va_sM) in let d1' = Vale.X64.Decls.buffer64_read dst_b (1 + 4) (va_get_mem\n va_sM) in let d2' = Vale.X64.Decls.buffer64_read dst_b (2 + 4) (va_get_mem va_sM) in let d3' =\n Vale.X64.Decls.buffer64_read dst_b (3 + 4) (va_get_mem va_sM) in let d' =\n Vale.Curve25519.Fast_defs.pow2_four d0' d1' d2' d3' in d `op_Modulus` prime == va_mul_nat a b\n `op_Modulus` prime /\\ d' `op_Modulus` prime == va_mul_nat a' b' `op_Modulus` prime /\\\n Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rRsp\n va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==>\n va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM ==\n va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\\n va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ va_state_eq va_sM (va_update_stackTaint\n va_sM (va_update_stack va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_flags va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64\n rR13 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))", "val va_ens_Check_avx512_xcr0_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_avx512_xcr0_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_avx512_xcr0_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_xcr0) /\\ va_state_eq va_sM\n (va_update_flags va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64\n rRax va_sM (va_update_ok va_sM va_s0))))))", "val va_ens_Fadd_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fadd_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fadd_stdcall va_b0 va_s0 win dst_b inA_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM va_fM\n /\\ va_get_ok va_sM /\\ (let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let a0 = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in\n let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let a2 =\n Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == (a + b) `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer dst_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM ==\n va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\\n (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64 rR13\n va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))))))))", "val va_ens_Check_avx512_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_avx512_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_avx512_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> avx512_cpuid_enabled) /\\ va_get_reg64\n rRbx va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))))", "val va_ens_Compute_iv_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (iv: supported_iv_BE)\n (iv_b: buffer128)\n (num_bytes len: nat64)\n (j0_b iv_extra_b hkeys_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Compute_iv_stdcall (va_b0:va_code) (va_s0:va_state) (iv:supported_iv_BE)\n (iv_b:buffer128) (num_bytes:nat64) (len:nat64) (j0_b:buffer128) (iv_extra_b:buffer128)\n (hkeys_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Compute_iv_stdcall va_b0 va_s0 iv iv_b num_bytes len j0_b iv_extra_b hkeys_b /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let\n (h_BE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read hkeys_b 2 (va_get_mem va_s0)) in\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read j0_b 0 (va_get_mem\n va_sM)) == Vale.AES.GCM_BE_s.compute_iv_BE h_BE iv /\\ Vale.PPC64LE.Decls.modifies_buffer128\n j0_b (va_get_mem va_s0) (va_get_mem va_sM)) /\\ va_state_eq va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 6 va_sM (va_update_cr0 va_sM (va_update_vec 14 va_sM (va_update_vec 13\n va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9\n va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5\n va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1\n va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8\n va_sM (va_update_reg 7 va_sM (va_update_reg 6 va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0))))))))))))))))))))))))))", "val va_ens_Fmul_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b inB_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Fmul_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Fmul_stdcall va_b0 va_s0 win tmp_b inA_b dst_b inB_b /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ (let (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in\n let (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in let a0 = Vale.X64.Decls.buffer64_read\n inA_b 0 (va_get_mem va_s0) in let a1 = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0)\n in let a2 = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let a3 =\n Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let b0 =\n Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let b1 =\n Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let b2 =\n Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let b3 =\n Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let d0 =\n Vale.X64.Decls.buffer64_read dst_b 0 (va_get_mem va_sM) in let d1 =\n Vale.X64.Decls.buffer64_read dst_b 1 (va_get_mem va_sM) in let d2 =\n Vale.X64.Decls.buffer64_read dst_b 2 (va_get_mem va_sM) in let d3 =\n Vale.X64.Decls.buffer64_read dst_b 3 (va_get_mem va_sM) in let a =\n Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let b = Vale.Curve25519.Fast_defs.pow2_four\n b0 b1 b2 b3 in let d = Vale.Curve25519.Fast_defs.pow2_four d0 d1 d2 d3 in d `op_Modulus` prime\n == va_mul_nat a b `op_Modulus` prime /\\ Vale.X64.Decls.modifies_buffer_2 dst_b tmp_b\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64\n rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi\n va_s0) /\\ (win ==> va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ (win ==> va_get_reg64\n rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))))))))", "val va_wp_Sha_update_bytes_stdcall\n (win: bool)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Sha_update_bytes_stdcall (win:bool) (ctx_b:buffer128) (in_b:buffer128) (num_val:nat64)\n (k_b:buffer128) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (let (ctx_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (num:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (k_ptr:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64\n rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (sha_enabled /\\\n sse_enabled) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 in_b]))\n (ctx_b == in_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (ctx_b == k_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 in_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (in_b == k_b) /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) ctx_ptr ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in_ptr\n in_b (4 `op_Multiply` num) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem va_s0) k_ptr k_b 16 (va_get_mem_layout va_s0) Secret /\\ num_val == num /\\ in_ptr +\n 64 `op_Multiply` num < pow2_64 /\\ Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 ctx_b == 2 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == 4 `op_Multiply` num /\\\n Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) k_b)) /\\\n (forall (va_x_mem:vale_heap) (va_x_rax:nat64) (va_x_rbx:nat64) (va_x_rcx:nat64)\n (va_x_rdx:nat64) (va_x_rsi:nat64) (va_x_rdi:nat64) (va_x_rbp:nat64) (va_x_rsp:nat64)\n (va_x_r8:nat64) (va_x_r9:nat64) (va_x_r10:nat64) (va_x_r11:nat64) (va_x_r12:nat64)\n (va_x_r13:nat64) (va_x_r14:nat64) (va_x_r15:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32)\n (va_x_xmm2:quad32) (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32)\n (va_x_xmm7:quad32) (va_x_xmm8:quad32) (va_x_xmm9:quad32) (va_x_xmm10:quad32)\n (va_x_xmm11:quad32) (va_x_xmm12:quad32) (va_x_xmm13:quad32) (va_x_xmm14:quad32)\n (va_x_xmm15:quad32) (va_x_efl:Vale.X64.Flags.t) (va_x_heap0:vale_heap)\n (va_x_memLayout:vale_heap_layout) (va_x_stack:vale_stack) (va_x_stackTaint:memtaint) . let\n va_sM = va_upd_stackTaint va_x_stackTaint (va_upd_stack va_x_stack (va_upd_mem_layout\n va_x_memLayout (va_upd_mem_heaplet 0 va_x_heap0 (va_upd_flags va_x_efl (va_upd_xmm 15\n va_x_xmm15 (va_upd_xmm 14 va_x_xmm14 (va_upd_xmm 13 va_x_xmm13 (va_upd_xmm 12 va_x_xmm12\n (va_upd_xmm 11 va_x_xmm11 (va_upd_xmm 10 va_x_xmm10 (va_upd_xmm 9 va_x_xmm9 (va_upd_xmm 8\n va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm 4\n va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm 0\n va_x_xmm0 (va_upd_reg64 rR15 va_x_r15 (va_upd_reg64 rR14 va_x_r14 (va_upd_reg64 rR13 va_x_r13\n (va_upd_reg64 rR12 va_x_r12 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rR10 va_x_r10\n (va_upd_reg64 rR9 va_x_r9 (va_upd_reg64 rR8 va_x_r8 (va_upd_reg64 rRsp va_x_rsp (va_upd_reg64\n rRbp va_x_rbp (va_upd_reg64 rRdi va_x_rdi (va_upd_reg64 rRsi va_x_rsi (va_upd_reg64 rRdx\n va_x_rdx (va_upd_reg64 rRcx va_x_rcx (va_upd_reg64 rRbx va_x_rbx (va_upd_reg64 rRax va_x_rax\n (va_upd_mem va_x_mem va_s0))))))))))))))))))))))))))))))))))))) in va_get_ok va_sM /\\ (let\n (ctx_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s0)\n (fun _ -> va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0 18446744073709551615)) =\n va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64 rRsi va_s0) in let\n (num:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s0) (fun\n _ -> va_get_reg64 rRdx va_s0) in let (k_ptr:(va_int_range 0 18446744073709551615)) = va_if win\n (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64 rRcx va_s0) in let hash_in =\n Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) ctx_b)) in let hash_out =\n Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM) ctx_b)) in (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM) in_b)) in l_and (FStar.Seq.Base.length\n #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out ==\n Vale.SHA.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\ Vale.X64.Decls.modifies_mem\n (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 ctx_b) (va_get_mem va_s0) (va_get_mem\n va_sM) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\ (win ==> va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp\n va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64\n rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12\n va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64\n rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15\n va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==>\n va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM ==\n va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15\n va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\ (win\n ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==> va_get_xmm 8 va_sM == va_get_xmm 8\n va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ (win ==> va_get_xmm 10 va_sM ==\n va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ (win ==>\n va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==> va_get_xmm 13 va_sM == va_get_xmm 13\n va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ (win ==> va_get_xmm 15 va_sM\n == va_get_xmm 15 va_s0)) ==> va_k va_sM (())))", "val va_wpProof_Sha_update_bytes : ctx_b:buffer128 -> in_b:buffer128 -> k_b:buffer128 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update_bytes ctx_b in_b k_b va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update_bytes ())\n ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30; va_Mod_vec 29;\n va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22;\n va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16;\n va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10;\n va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec\n 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10; va_Mod_reg 6;\n va_Mod_reg 5; va_Mod_reg 4; va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sha_update_bytes ctx_b in_b k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update_bytes (va_code_Sha_update_bytes ()) va_s0 ctx_b in_b k_b\n in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_vec 31 va_sM (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM\n (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM\n (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM\n (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM\n (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM\n (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM\n (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM\n (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM\n (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sha_update_bytes : ctx_b:buffer128 -> in_b:buffer128 -> k_b:buffer128 ->\n va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update_bytes ctx_b in_b k_b va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update_bytes ()) ([va_Mod_flags;\n va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;\n va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;\n va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_mem]) va_s0 va_k ((va_sM,\n va_f0, va_g))))\nlet va_wpProof_Sha_update_bytes ctx_b in_b k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update_bytes (va_code_Sha_update_bytes ()) va_s0 ctx_b in_b k_b\n in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 0 va_sM (va_update_xmm 10\n va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6\n va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2\n va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRax va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm\n 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;\n va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;\n va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_ens_Compute_iv_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (iv: supported_iv_LE)\n (iv_b: buffer128)\n (num_bytes len: nat64)\n (j0_b iv_extra_b hkeys_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Compute_iv_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (iv:supported_iv_LE)\n (iv_b:buffer128) (num_bytes:nat64) (len:nat64) (j0_b:buffer128) (iv_extra_b:buffer128)\n (hkeys_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Compute_iv_stdcall va_b0 va_s0 win iv iv_b num_bytes len j0_b iv_extra_b hkeys_b /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let (iv_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in\n let (bytes_reg:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0\n else va_get_reg64 rRsi va_s0) in let (len_reg:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in let (j0_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in\n let (extra_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else\n va_get_reg64 rR8 va_s0) in let (h_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) else\n va_get_reg64 rR9 va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem\n va_s0)) in Vale.X64.Decls.buffer128_read j0_b 0 (va_get_mem va_sM) ==\n Vale.AES.GCM_s.compute_iv_BE h_LE iv /\\ Vale.X64.Decls.modifies_buffer128 j0_b (va_get_mem\n va_s0) (va_get_mem va_sM) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\ (win ==>\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM ==\n va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64 rR12\n va_sM == va_get_reg64 rR12 va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\\n (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==> va_get_xmm 8 va_sM == va_get_xmm\n 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ (win ==> va_get_xmm 10 va_sM\n == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ (win ==>\n va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==> va_get_xmm 13 va_sM == va_get_xmm 13\n va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ (win ==> va_get_xmm 15 va_sM\n == va_get_xmm 15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12\n va_sM == va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==>\n va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0)) /\\ va_state_eq va_sM (va_update_stackTaint\n va_sM (va_update_stack va_sM (va_update_flags va_sM (va_update_mem_heaplet 7 va_sM\n (va_update_mem_layout va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13\n va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9\n va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5\n va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1\n va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM\n (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0))))))))))))))))))))))))))))))))))))))))", "val va_ens_Cswap2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (bit_in: nat64)\n (p0_b p1_b: buffer64)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Cswap2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (bit_in:nat64)\n (p0_b:buffer64) (p1_b:buffer64) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Cswap2_stdcall va_b0 va_s0 win bit_in p0_b p1_b /\\ va_ensure_total va_b0 va_s0 va_sM\n va_fM /\\ va_get_ok va_sM /\\ (let (p0_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (p1_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (old_p0_0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 0 (va_get_mem va_s0)\n in let (old_p0_1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 1 (va_get_mem\n va_s0) in let (old_p0_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 2\n (va_get_mem va_s0) in let (old_p0_3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b\n 3 (va_get_mem va_s0) in let (old_p0_4:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p0_b 4 (va_get_mem va_s0) in let (old_p0_5:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p0_b 5 (va_get_mem va_s0) in let (old_p0_6:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p0_b 6 (va_get_mem va_s0) in let\n (old_p0_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 7 (va_get_mem va_s0) in\n let (old_p1_0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 0 (va_get_mem va_s0)\n in let (old_p1_1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 1 (va_get_mem\n va_s0) in let (old_p1_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 2\n (va_get_mem va_s0) in let (old_p1_3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b\n 3 (va_get_mem va_s0) in let (old_p1_4:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p1_b 4 (va_get_mem va_s0) in let (old_p1_5:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p1_b 5 (va_get_mem va_s0) in let (old_p1_6:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p1_b 6 (va_get_mem va_s0) in let\n (old_p1_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 7 (va_get_mem va_s0) in\n let p0_0 = Vale.X64.Decls.buffer64_read p0_b 0 (va_get_mem va_sM) in let p0_1 =\n Vale.X64.Decls.buffer64_read p0_b 1 (va_get_mem va_sM) in let p0_2 =\n Vale.X64.Decls.buffer64_read p0_b 2 (va_get_mem va_sM) in let p0_3 =\n Vale.X64.Decls.buffer64_read p0_b 3 (va_get_mem va_sM) in let p0_4 =\n Vale.X64.Decls.buffer64_read p0_b 4 (va_get_mem va_sM) in let p0_5 =\n Vale.X64.Decls.buffer64_read p0_b 5 (va_get_mem va_sM) in let p0_6 =\n Vale.X64.Decls.buffer64_read p0_b 6 (va_get_mem va_sM) in let p0_7 =\n Vale.X64.Decls.buffer64_read p0_b 7 (va_get_mem va_sM) in let p1_0 =\n Vale.X64.Decls.buffer64_read p1_b 0 (va_get_mem va_sM) in let p1_1 =\n Vale.X64.Decls.buffer64_read p1_b 1 (va_get_mem va_sM) in let p1_2 =\n Vale.X64.Decls.buffer64_read p1_b 2 (va_get_mem va_sM) in let p1_3 =\n Vale.X64.Decls.buffer64_read p1_b 3 (va_get_mem va_sM) in let p1_4 =\n Vale.X64.Decls.buffer64_read p1_b 4 (va_get_mem va_sM) in let p1_5 =\n Vale.X64.Decls.buffer64_read p1_b 5 (va_get_mem va_sM) in let p1_6 =\n Vale.X64.Decls.buffer64_read p1_b 6 (va_get_mem va_sM) in let p1_7 =\n Vale.X64.Decls.buffer64_read p1_b 7 (va_get_mem va_sM) in p0_0 == (if (bit_in = 1) then\n old_p1_0 else old_p0_0) /\\ p0_1 == (if (bit_in = 1) then old_p1_1 else old_p0_1) /\\ p0_2 == (if\n (bit_in = 1) then old_p1_2 else old_p0_2) /\\ p0_3 == (if (bit_in = 1) then old_p1_3 else\n old_p0_3) /\\ p0_4 == (if (bit_in = 1) then old_p1_4 else old_p0_4) /\\ p0_5 == (if (bit_in = 1)\n then old_p1_5 else old_p0_5) /\\ p0_6 == (if (bit_in = 1) then old_p1_6 else old_p0_6) /\\ p0_7\n == (if (bit_in = 1) then old_p1_7 else old_p0_7) /\\ p1_0 == (if (bit_in = 1) then old_p0_0 else\n old_p1_0) /\\ p1_1 == (if (bit_in = 1) then old_p0_1 else old_p1_1) /\\ p1_2 == (if (bit_in = 1)\n then old_p0_2 else old_p1_2) /\\ p1_3 == (if (bit_in = 1) then old_p0_3 else old_p1_3) /\\ p1_4\n == (if (bit_in = 1) then old_p0_4 else old_p1_4) /\\ p1_5 == (if (bit_in = 1) then old_p0_5 else\n old_p1_5) /\\ p1_6 == (if (bit_in = 1) then old_p0_6 else old_p1_6) /\\ p1_7 == (if (bit_in = 1)\n then old_p0_7 else old_p1_7) /\\ Vale.X64.Decls.modifies_buffer_2 p0_b p1_b (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==>\n va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ va_get_reg64 rRsp va_sM == va_get_reg64\n rRsp va_s0) /\\ va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRsp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdx va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))", "val va_ens_Check_avx2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_avx2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_avx2_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> avx2_cpuid_enabled) /\\ va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64\n rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_ens_Check_avx_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_avx_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_avx_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok\n va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> avx_cpuid_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_qcode_Sha_update_bytes_stdcall\n (va_mods: va_mods_t)\n (win: bool)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes_stdcall win))\nlet va_qcode_Sha_update_bytes_stdcall (va_mods:va_mods_t) (win:bool) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) : (va_quickCode unit\n (va_code_Sha_update_bytes_stdcall win)) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in let\n (ctx_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRcx va_s)\n (fun _ -> va_get_reg64 rRdi va_s) in let (in_ptr:(va_int_range 0 18446744073709551615)) = va_if\n win (fun _ -> va_get_reg64 rRdx va_s) (fun _ -> va_get_reg64 rRsi va_s) in let\n (num:(va_int_range 0 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR8 va_s) (fun _\n -> va_get_reg64 rRdx va_s) in let (k_ptr:(va_int_range 0 18446744073709551615)) = va_if win\n (fun _ -> va_get_reg64 rR9 va_s) (fun _ -> va_get_reg64 rRcx va_s) in va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 813 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_CreateHeaplets ([declare_buffer128 in_b 0 Secret Immutable; declare_buffer128 k_b 0\n Secret Immutable; declare_buffer128 ctx_b 0 Secret Mutable])) (fun (va_s:va_state) _ ->\n va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 819 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 821 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 822 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 14) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 823 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 13) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 824 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 12) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 825 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 826 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 10) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 827 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 828 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 8) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 829 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 830 column 23 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PushXmm_Secret (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRax)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 831 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 832 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 833 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 834 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 835 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 836 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 837 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbp)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 838 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_QEmpty (()))))))))))))))))))))) (qblock\n va_mods (fun (va_s:va_state) -> va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 842 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR15)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 843 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR14)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 844 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR13)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 845 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rR12)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 846 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRsi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 847 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRdi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 848 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbp)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 849 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Push_Secret (va_op_reg_opr64_reg64 rRbx)) (va_QEmpty (())))))))))))) (fun\n (va_s:va_state) va_g -> va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 852 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 854 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdi) (va_op_opr64_reg64 rRcx)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 855 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRsi) (va_op_opr64_reg64 rRdx)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 856 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRdx) (va_op_opr64_reg64 rR8)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 857 column 14 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Mov64 (va_op_dst_opr64_reg64 rRcx) (va_op_opr64_reg64 rR9)) (va_QEmpty (())))))))\n (qblock va_mods (fun (va_s:va_state) -> va_QEmpty (())))) (fun (va_s:va_state) va_g -> va_QBind\n va_range1\n \"***** PRECONDITION NOT MET AT line 860 column 21 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Sha_update_bytes ctx_b in_b k_b) (fun (va_s:va_state) _ -> va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 863 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_qInlineIf va_mods win (qblock va_mods (fun (va_s:va_state) -> va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 864 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 865 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbp)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 866 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 867 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 868 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 869 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 870 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 871 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 873 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 6) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 6 va_old_s))\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 874 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 7) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 7 va_old_s))\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 875 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 8) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 8 va_old_s))\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 876 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 9) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 9 va_old_s))\n (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 877 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 10) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 10\n va_old_s)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 878 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 11) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 11\n va_old_s)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 879 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 12) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 12\n va_old_s)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 880 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 13) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 13\n va_old_s)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 881 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 14) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 14\n va_old_s)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 882 column 22 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_PopXmm_Secret (va_op_xmm_xmm 15) (va_op_reg_opr64_reg64 rRax) (va_get_xmm 15\n va_old_s)) (va_QEmpty (()))))))))))))))))))))) (qblock va_mods (fun (va_s:va_state) -> va_QSeq\n va_range1\n \"***** PRECONDITION NOT MET AT line 886 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbx)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 887 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRbp)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 888 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRdi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 889 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rRsi)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 890 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR12)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 891 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR13)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 892 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR14)) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 893 column 19 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Pop_Secret (va_op_dst_opr64_reg64 rR15)) (va_QEmpty (())))))))))))) (fun\n (va_s:va_state) va_g -> let (hash_in:Vale.SHA.SHA_helpers.hash256) =\n Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_old_s) ctx_b)) in let\n (input_LE:(FStar.Seq.Base.seq FStar.UInt8.t)) = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_s) in_b)) in let (va_arg77:Vale.SHA.SHA_helpers.bytes) = input_LE in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 898 column 51 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_update_multi_opaque_vale_is_update_multi hash_in\n va_arg77) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 900 column 20 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_DestroyHeaplets ()) (va_QEmpty (()))))))))))", "val va_lemma_Sha_update_bytes_stdcall : va_b0:va_code -> va_s0:va_state -> win:bool ->\n ctx_b:buffer128 -> in_b:buffer128 -> num_val:nat64 -> k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update_bytes_stdcall win) va_s0 /\\ va_get_ok va_s0\n /\\ (let (ctx_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0\n else va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (num:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (k_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (sha_enabled /\\ sse_enabled) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 in_b]))\n (ctx_b == in_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 ctx_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (ctx_b == k_b) /\\ l_or (Vale.X64.Decls.locs_disjoint ([Vale.X64.Decls.loc_buffer\n #Vale.X64.Memory.vuint128 in_b; Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 k_b]))\n (in_b == k_b) /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) ctx_ptr ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in_ptr\n in_b (4 `op_Multiply` num) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem va_s0) k_ptr k_b 16 (va_get_mem_layout va_s0) Secret /\\ num_val == num /\\ in_ptr +\n 64 `op_Multiply` num < pow2_64 /\\ Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 ctx_b == 2 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b == 4 `op_Multiply` num /\\\n Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (ctx_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0\n else va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (num:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (k_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let hash_in = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0)\n ctx_b)) in let hash_out = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM)\n ctx_b)) in (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM)\n in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out\n == Vale.SHA.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\\n Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 ctx_b)\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp\n va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi\n va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64\n rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64\n rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==>\n va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM ==\n va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6 va_sM ==\n va_get_xmm 6 va_s0) /\\ (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==>\n va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0)\n /\\ (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM ==\n va_get_xmm 11 va_s0) /\\ (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==>\n va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14\n va_s0) /\\ (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0)) /\\ va_state_eq va_sM\n (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM (va_update_xmm 15 va_sM (va_update_xmm 14\n va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10\n va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6\n va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2\n va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM\n (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRbp va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))))\nlet va_lemma_Sha_update_bytes_stdcall va_b0 va_s0 win ctx_b in_b num_val k_b =\n let (va_mods:va_mods_t) = [va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet\n 0; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;\n va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm\n 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64\n rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64\n rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64\n rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok;\n va_Mod_mem] in\n let va_qc = va_qcode_Sha_update_bytes_stdcall va_mods win ctx_b in_b num_val k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update_bytes_stdcall win) va_qc\n va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 735 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (let (ctx_ptr:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rRcx va_s0) (fun _ -> va_get_reg64 rRdi va_s0) in let (in_ptr:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rRdx va_s0) (fun _ -> va_get_reg64\n rRsi va_s0) in let (num:(va_int_range 0 18446744073709551615)) = va_if win (fun _ ->\n va_get_reg64 rR8 va_s0) (fun _ -> va_get_reg64 rRdx va_s0) in let (k_ptr:(va_int_range 0\n 18446744073709551615)) = va_if win (fun _ -> va_get_reg64 rR9 va_s0) (fun _ -> va_get_reg64\n rRcx va_s0) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 776 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let hash_in = Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 777 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let hash_out = Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 781 column 102 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem va_sM)\n in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out\n == Vale.SHA.SHA_helpers.update_multi_transparent hash_in input_LE)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 784 column 55 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (Vale.X64.Decls.modifies_mem (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 ctx_b)\n (va_get_mem va_s0) (va_get_mem va_sM)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 786 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 788 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 789 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 790 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 791 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 792 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 793 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 794 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 795 column 33 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 796 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 797 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 798 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 799 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 800 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 801 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 802 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 803 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 804 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 805 column 35 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 806 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 807 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 808 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 809 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 810 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 811 column 37 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;\n va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm\n 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64\n rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64\n rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64\n rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_ok;\n va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_quick_Sha_update_bytes_stdcall\n (win: bool)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes_stdcall win))\nlet va_quick_Sha_update_bytes_stdcall (win:bool) (ctx_b:buffer128) (in_b:buffer128) (num_val:nat64)\n (k_b:buffer128) : (va_quickCode unit (va_code_Sha_update_bytes_stdcall win)) =\n (va_QProc (va_code_Sha_update_bytes_stdcall win) ([va_Mod_stackTaint; va_Mod_stack;\n va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm\n 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7;\n va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm\n 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64\n rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64\n rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64\n rRbx; va_Mod_reg64 rRax; va_Mod_mem]) (va_wp_Sha_update_bytes_stdcall win ctx_b in_b num_val\n k_b) (va_wpProof_Sha_update_bytes_stdcall win ctx_b in_b num_val k_b))", "val va_ens_Check_sse_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_sse_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_sse_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok\n va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> sse_enabled) /\\ va_get_reg64 rRbx va_sM ==\n va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_lemma_Sha_update_bytes : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128 ->\n in_b:buffer128 -> k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update_bytes ()) va_s0 /\\ va_get_ok va_s0 /\\\n (Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 4 va_s0) in_b (4\n `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0\n va_s0) (va_get_reg 6 va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b\n 13 3 (va_get_mem_layout va_s0) Secret /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5\n va_s0 < pow2_64 /\\ va_get_reg 6 va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128\n ctx_b in_b /\\ Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply`\n va_get_reg 5 va_s0 /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 /\\ (let hash_in\n = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) ctx_b)) in let hash_out =\n Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) ctx_b)) in (let input_LE =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) in_b)) in l_and\n (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0) (hash_out ==\n Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_vale hash_in input_LE)) /\\\n Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM))) /\\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_vec 31 va_sM (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM\n (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM\n (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM\n (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM\n (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM\n (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM\n (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM\n (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM\n (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))))))\nlet va_lemma_Sha_update_bytes va_b0 va_s0 ctx_b in_b k_b =\n let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Sha_update_bytes va_mods ctx_b in_b k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update_bytes ()) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 184 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 210 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 212 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let hash_in = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_s0) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 213 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let hash_out = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 217 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE\n `op_Modulus` 64 == 0) (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_opaque_vale\n hash_in input_LE)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 220 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Sha_update_bytes : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128 ->\n in_b:buffer128 -> k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update_bytes ()) va_s0 /\\ va_get_ok va_s0 /\\\n (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)\n (va_get_reg64 rRsi va_s0) in_b (4 `op_Multiply` va_get_reg64 rRdx va_s0) (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64\n rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret\n /\\ va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\\\n Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\ Vale.X64.Decls.buffer_length\n #Vale.X64.Memory.vuint128 ctx_b == 2 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128\n in_b == 4 `op_Multiply` va_get_reg64 rRdx va_s0 /\\ Vale.SHA.SHA_helpers.k_reqs\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0\n /\\ (let hash_in = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_s0) ctx_b)) in let hash_out = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_sM) ctx_b)) in (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.SHA_helpers.update_multi_opaque_vale hash_in input_LE)) /\\\n Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM))) /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM\n (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM\n (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRax\n va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM\n (va_update_mem va_sM va_s0))))))))))))))))))))\nlet va_lemma_Sha_update_bytes va_b0 va_s0 ctx_b in_b k_b =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9;\n va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm\n 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;\n va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Sha_update_bytes va_mods ctx_b in_b k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update_bytes ()) va_qc va_s0 (fun\n va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 672 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 702 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0)\n /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 704 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let hash_in = Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 705 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let hash_out = Vale.SHA.SHA_helpers.le_bytes_to_hash (Vale.Def.Types_s.le_seq_quad32_to_bytes\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_sM) ctx_b)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 709 column 64 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let input_LE = Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_sM) in_b)) in l_and (FStar.Seq.Base.length #FStar.UInt8.t input_LE `op_Modulus` 64 == 0)\n (hash_out == Vale.SHA.SHA_helpers.update_multi_opaque_vale hash_in input_LE)) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 712 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm\n 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;\n va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_ok;\n va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_ens_KeyExpansionStdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (input_key_b output_key_expansion_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_KeyExpansionStdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (input_key_b:buffer128) (output_key_expansion_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) :\n prop =\n (va_req_KeyExpansionStdcall va_b0 va_s0 win alg input_key_b output_key_expansion_b /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let (key_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) in\n let (key_expansion_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRdx\n va_s0 else va_get_reg64 rRsi va_s0) in let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) =\n (if (alg = AES_128) then Vale.Arch.Types.quad32_to_seq (Vale.X64.Decls.buffer128_read\n input_key_b 0 (va_get_mem va_s0)) else Vale.AES.AES256_helpers.make_AES256_key\n (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem va_s0)) (Vale.X64.Decls.buffer128_read\n input_key_b 1 (va_get_mem va_s0))) in Vale.X64.Decls.modifies_buffer128 output_key_expansion_b\n (va_get_mem va_s0) (va_get_mem va_sM) /\\ (forall j . 0 <= j /\\ j <= Vale.AES.AES_common_s.nr\n alg ==> Vale.X64.Decls.buffer128_read output_key_expansion_b j (va_get_mem va_sM) ==\n FStar.Seq.Base.index #Vale.Def.Types_s.quad32 (Vale.AES.AES_s.key_to_round_keys_LE alg key) j))\n /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM\n (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 1 va_sM (va_update_reg64 rRdx va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))", "val va_qcode_Sha_update_bytes (va_mods: va_mods_t) (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes ()))\nlet va_qcode_Sha_update_bytes (va_mods:va_mods_t) (ctx_b:buffer128) (in_b:buffer128)\n (k_b:buffer128) : (va_quickCode unit (va_code_Sha_update_bytes ())) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 714 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Sha_update ctx_b in_b k_b) (fun (va_s:va_state) _ -> let (old_ctx:(seq (four nat32)))\n = Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_old_s) ctx_b in let (new_ctx:(seq\n (four nat32))) = Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) ctx_b in let\n (va_arg34:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = old_ctx in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 717 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_hash_to_bytes va_arg34) (let\n (va_arg33:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = new_ctx in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 718 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_hash_to_bytes va_arg33) (let\n (hash_in:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes old_ctx) in let\n (hash_out:Vale.SHA.SHA_helpers.hash256) = Vale.SHA.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes new_ctx) in va_qAssertSquash va_range1\n \"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 728 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n ((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let\n (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908\n j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))\n Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) 0 (4\n `op_Multiply` va_get_reg64 rRdx va_old_s)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq\n Vale.X64.Decls.quad32)) = FStar.Seq.Base.slice #Vale.X64.Decls.quad32\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) 0 (4 `op_Multiply`\n va_get_reg64 rRdx va_old_s) in let (input_BE:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =\n Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in va_qAssert va_range1\n \"***** PRECONDITION NOT MET AT line 730 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (hash_out == Vale.SHA.SHA_helpers.update_multi_quads input_BE hash_in) (let\n (va_arg32:(FStar.Seq.Base.seq Vale.SHA.SHA_helpers.byte)) =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes input_LE)\n in let (va_arg31:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) =\n Vale.Def.Types_s.le_seq_quad32_to_bytes input_LE in let (va_arg30:(FStar.Seq.Base.seq\n Vale.Def.Types_s.quad32)) = input_LE in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 731 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (fun (_:unit) -> Vale.SHA.SHA_helpers.lemma_update_multi_equiv_vale hash_in hash_out va_arg30\n input_BE va_arg31 va_arg32) (va_QEmpty (())))))))))", "val va_qcode_Sha_update_bytes (va_mods: va_mods_t) (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update_bytes ()))\nlet va_qcode_Sha_update_bytes (va_mods:va_mods_t) (ctx_b:buffer128) (in_b:buffer128)\n (k_b:buffer128) : (va_quickCode unit (va_code_Sha_update_bytes ())) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QBind va_range1\n \"***** PRECONDITION NOT MET AT line 222 column 15 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Sha_update ctx_b in_b k_b) (fun (va_s:va_state) _ -> let (old_ctx:(seq (four nat32)))\n = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_old_s) ctx_b in let\n (new_ctx:(seq (four nat32))) = Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s)\n ctx_b in let (va_arg22:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = old_ctx in va_qPURE\n va_range1\n \"***** PRECONDITION NOT MET AT line 225 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_hash_to_bytes va_arg22) (let\n (va_arg21:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) = new_ctx in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 226 column 24 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_hash_to_bytes va_arg21) (let\n (hash_in:Vale.SHA.PPC64LE.SHA_helpers.hash256) = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes old_ctx) in let\n (hash_out:Vale.SHA.PPC64LE.SHA_helpers.hash256) = Vale.SHA.PPC64LE.SHA_helpers.le_bytes_to_hash\n (Vale.Def.Types_s.le_seq_quad32_to_bytes new_ctx) in va_qAssertSquash va_range1\n \"***** EXPRESSION PRECONDITIONS NOT MET WITHIN line 230 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n ((fun a_1906 (s_1907:(FStar.Seq.Base.seq a_1906)) (i_1908:Prims.nat) (j_1909:Prims.nat) -> let\n (j_1869:Prims.nat) = j_1909 in Prims.b2t (Prims.op_AmpAmp (Prims.op_LessThanOrEqual i_1908\n j_1869) (Prims.op_LessThanOrEqual j_1869 (FStar.Seq.Base.length #a_1906 s_1907))))\n Vale.PPC64LE.Machine_s.quad32 (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s)\n in_b) 0 (4 `op_Multiply` va_get_reg 5 va_old_s)) (fun _ -> let (input_LE:(FStar.Seq.Base.seq\n Vale.PPC64LE.Machine_s.quad32)) = FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s) in_b) 0 (4 `op_Multiply`\n va_get_reg 5 va_old_s) in let (input_BE:(FStar.Seq.Base.seq Vale.Def.Types_s.quad32)) =\n Vale.Arch.Types.reverse_bytes_quad32_seq input_LE in va_qAssert va_range1\n \"***** PRECONDITION NOT MET AT line 232 column 5 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (hash_out == Vale.SHA.PPC64LE.SHA_helpers.update_multi_quads input_BE hash_in) (let\n (va_arg20:(FStar.Seq.Base.seq Vale.SHA.PPC64LE.SHA_helpers.byte)) =\n Vale.Def.Words.Seq_s.seq_nat8_to_seq_uint8 (Vale.Def.Types_s.le_seq_quad32_to_bytes input_LE)\n in let (va_arg19:(FStar.Seq.Base.seq Vale.Def.Words_s.nat8)) =\n Vale.Def.Types_s.le_seq_quad32_to_bytes input_LE in let (va_arg18:(FStar.Seq.Base.seq\n Vale.Def.Types_s.quad32)) = input_LE in va_qPURE va_range1\n \"***** PRECONDITION NOT MET AT line 233 column 34 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (fun (_:unit) -> Vale.SHA.PPC64LE.SHA_helpers.lemma_update_multi_equiv_vale hash_in hash_out\n va_arg18 input_BE va_arg19 va_arg20) (va_QEmpty (())))))))))", "val va_ens_KeyExpansionStdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (input_key_b output_key_expansion_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_KeyExpansionStdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm)\n (input_key_b:buffer128) (output_key_expansion_b:buffer128) (va_sM:va_state) (va_fM:va_fuel) :\n prop =\n (va_req_KeyExpansionStdcall va_b0 va_s0 alg input_key_b output_key_expansion_b /\\ va_ensure_total\n va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let (in_key1:Vale.Def.Types_s.quad32) =\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 0\n (va_get_mem va_s0)) in let (in_key2:Vale.Def.Types_s.quad32) =\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read input_key_b 1\n (va_get_mem va_s0)) in let (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = (if (alg =\n AES_128) then Vale.AES.AES256_helpers_BE.be_quad32_to_seq in_key1 else\n Vale.AES.AES256_helpers_BE.make_AES256_key in_key1 in_key2) in\n Vale.PPC64LE.Decls.modifies_buffer128 output_key_expansion_b (va_get_mem va_s0) (va_get_mem\n va_sM) /\\ (forall j . 0 <= j /\\ j <= Vale.AES.AES_common_s.nr alg ==>\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read output_key_expansion_b\n j (va_get_mem va_sM)) == FStar.Seq.Base.index #Vale.Def.Types_s.quad32\n (Vale.AES.AES_BE_s.key_to_round_keys_word alg key) j)) /\\ va_state_eq va_sM (va_update_vec 5\n va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1\n va_sM (va_update_vec 0 va_sM (va_update_reg 10 va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 1 va_sM (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))", "val va_ens_Check_aesni_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_aesni_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_aesni_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> aesni_enabled /\\ pclmulqdq_enabled) /\\\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_ens_Gcm_blocks_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_LE)\n (hkeys_b abytes_b in128x6_b out128x6_b: buffer128)\n (len128x6_num: nat64)\n (in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (plain_num: nat64)\n (scratch_b tag_b: buffer128)\n (key: (seq nat32))\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Gcm_blocks_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_LE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128)\n (out128x6_b:buffer128) (len128x6_num:nat64) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (plain_num:nat64) (scratch_b:buffer128) (tag_b:buffer128)\n (key:(seq nat32)) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Gcm_blocks_stdcall va_b0 va_s0 win alg auth_b auth_bytes auth_num keys_b iv_b iv hkeys_b\n abytes_b in128x6_b out128x6_b len128x6_num in128_b out128_b len128_num inout_b plain_num\n scratch_b tag_b key /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let\n (auth_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (auth_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (auth_len:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let (iv_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else\n va_get_reg64 rR8 va_s0) in let (xip:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) else\n va_get_reg64 rR9 va_s0) in let (abytes_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 16) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) in\n let (in128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) in let\n (out128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack va_s0)) in let\n (len128x6:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack va_s0)) in let (in128_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 48) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 32) (va_get_stack va_s0)) in let (out128_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack va_s0)) in\n let (len128:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack va_s0)) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 72) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 56) (va_get_stack va_s0)) in let (plain_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack va_s0)) in\n let (scratch_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack va_s0)) in let\n (tag_ptr:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack va_s0)) in Vale.X64.Decls.modifies_mem\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 tag_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 iv_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 scratch_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 out128x6_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 out128_b)\n (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 inout_b)))))) (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ plain_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ (let iv_BE =\n Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem va_s0) in let auth_raw_quads =\n FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_s0) auth_b)\n (Vale.X64.Decls.s128 (va_get_mem va_s0) abytes_b) in let auth_bytes = FStar.Seq.Base.slice\n #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0\n auth_num_bytes in let plain_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32\n (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_s0)\n in128x6_b) (Vale.X64.Decls.s128 (va_get_mem va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem\n va_s0) inout_b) in let plain_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes plain_raw_quads) 0 plain_num_bytes in let\n cipher_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append\n #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_sM) out128x6_b) (Vale.X64.Decls.s128\n (va_get_mem va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem va_sM) inout_b) in let\n cipher_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes cipher_raw_quads) 0 plain_num_bytes in l_and (l_and\n (l_and (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.nat8 auth_bytes < pow2_32)\n (FStar.Seq.Base.length #Vale.Def.Types_s.nat8 plain_bytes < pow2_32))\n (Vale.AES.AES_common_s.is_aes_key alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key)))\n (cipher_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)\n #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) (Vale.AES.GCM_s.gcm_encrypt_LE alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes)))\n (Vale.Def.Types_s.le_quad32_to_bytes (Vale.X64.Decls.buffer128_read tag_b 0 (va_get_mem va_sM))\n == __proj__Mktuple2__item___2 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #(FStar.Seq.Base.seq\n Vale.Def.Types_s.nat8) (Vale.AES.GCM_s.gcm_encrypt_LE alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv plain_bytes auth_bytes)) /\\ va_get_reg64\n rRsp va_sM == va_get_reg64 rRsp va_s0 /\\ (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx\n va_s0) /\\ (win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64\n rRdi va_sM == va_get_reg64 rRdi va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi\n va_s0) /\\ (win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (win ==> va_get_reg64\n rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14\n va_s0) /\\ (win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6\n va_sM == va_get_xmm 6 va_s0) /\\ (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==>\n va_get_xmm 8 va_sM == va_get_xmm 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0)\n /\\ (win ==> va_get_xmm 10 va_sM == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM ==\n va_get_xmm 11 va_s0) /\\ (win ==> va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==>\n va_get_xmm 13 va_sM == va_get_xmm 13 va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14\n va_s0) /\\ (win ==> va_get_xmm 15 va_sM == va_get_xmm 15 va_s0) /\\ (~win ==> va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0) /\\ (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp\n va_s0) /\\ (~win ==> va_get_reg64 rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (~win ==>\n va_get_reg64 rR13 va_sM == va_get_reg64 rR13 va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM ==\n va_get_reg64 rR14 va_s0) /\\ (~win ==> va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0))) /\\\n va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_flags va_sM\n (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 4 va_sM\n (va_update_mem_heaplet 3 va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM\n (va_update_mem_layout va_sM (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13\n va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9\n va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5\n va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1\n va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM\n (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM\n (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRsp va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))))))))))))))))))))))))))))))", "val va_wpProof_Sha_update_bytes_stdcall : win:bool -> ctx_b:buffer128 -> in_b:buffer128 ->\n num_val:nat64 -> k_b:buffer128 -> va_s0:va_state -> va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update_bytes_stdcall win ctx_b in_b num_val k_b va_s0\n va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update_bytes_stdcall win)\n ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_flags;\n va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11; va_Mod_xmm 10;\n va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm\n 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64 rR14; va_Mod_reg64\n rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64 rR9; va_Mod_reg64\n rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64 rRsi; va_Mod_reg64\n rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem]) va_s0 va_k ((va_sM,\n va_f0, va_g))))\nlet va_wpProof_Sha_update_bytes_stdcall win ctx_b in_b num_val k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update_bytes_stdcall (va_code_Sha_update_bytes_stdcall win)\n va_s0 win ctx_b in_b num_val k_b in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_stackTaint va_sM (va_update_stack va_sM\n (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM (va_update_flags va_sM\n (va_update_xmm 15 va_sM (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM\n (va_update_xmm 11 va_sM (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM\n (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM\n (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM\n (va_update_reg64 rR15 va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM\n (va_update_reg64 rR12 va_sM (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rR8 va_sM (va_update_reg64 rRsp va_sM\n (va_update_reg64 rRbp va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRsi va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0))))))))))))))))))))))))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_stackTaint; va_Mod_stack; va_Mod_mem_layout; va_Mod_mem_heaplet 0;\n va_Mod_flags; va_Mod_xmm 15; va_Mod_xmm 14; va_Mod_xmm 13; va_Mod_xmm 12; va_Mod_xmm 11;\n va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm\n 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rR15; va_Mod_reg64\n rR14; va_Mod_reg64 rR13; va_Mod_reg64 rR12; va_Mod_reg64 rR11; va_Mod_reg64 rR10; va_Mod_reg64\n rR9; va_Mod_reg64 rR8; va_Mod_reg64 rRsp; va_Mod_reg64 rRbp; va_Mod_reg64 rRdi; va_Mod_reg64\n rRsi; va_Mod_reg64 rRdx; va_Mod_reg64 rRcx; va_Mod_reg64 rRbx; va_Mod_reg64 rRax; va_Mod_mem])\n va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_wpProof_Sha_update : ctx_b:buffer128 -> in_b:buffer128 -> k_b:buffer128 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update ctx_b in_b k_b va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update ()) ([va_Mod_flags;\n va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6;\n va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0;\n va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_mem]) va_s0 va_k ((va_sM,\n va_f0, va_g))))\nlet va_wpProof_Sha_update ctx_b in_b k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update (va_code_Sha_update ()) va_s0 ctx_b in_b k_b in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 0 va_sM (va_update_xmm 10\n va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM (va_update_xmm 6\n va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM (va_update_xmm 2\n va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRax va_sM\n (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM (va_update_mem\n va_sM va_s0)))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm\n 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;\n va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;\n va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_ens_Check_rdrand_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_rdrand_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_rdrand_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> rdrand_enabled) /\\ va_get_reg64 rRbx\n va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64\n rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_wpProof_Sha_update : ctx_b:buffer128 -> in_b:buffer128 -> k_b:buffer128 -> va_s0:va_state ->\n va_k:(va_state -> unit -> Type0)\n -> Ghost (va_state & va_fuel & unit)\n (requires (va_t_require va_s0 /\\ va_wp_Sha_update ctx_b in_b k_b va_s0 va_k))\n (ensures (fun (va_sM, va_f0, va_g) -> va_t_ensure (va_code_Sha_update ()) ([va_Mod_mem_layout;\n va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec\n 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20;\n va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14;\n va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8;\n va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec\n 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4;\n va_Mod_mem]) va_s0 va_k ((va_sM, va_f0, va_g))))\nlet va_wpProof_Sha_update ctx_b in_b k_b va_s0 va_k =\n let (va_sM, va_f0) = va_lemma_Sha_update (va_code_Sha_update ()) va_s0 ctx_b in_b k_b in\n va_lemma_upd_update va_sM;\n assert (va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_vec 31 va_sM (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM\n (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM\n (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM\n (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM\n (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM\n (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM\n (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM\n (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM\n (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0)))))))))))))))))))))))))))))))))))))))));\n va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_mem]) va_sM va_s0;\n let va_g = () in\n (va_sM, va_f0, va_g)", "val va_ens_Gcm_blocks_decrypt_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_LE)\n (hkeys_b abytes_b in128x6_b out128x6_b: buffer128)\n (len128x6_num: nat64)\n (in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (cipher_num: nat64)\n (scratch_b tag_b: buffer128)\n (key: (seq nat32))\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Gcm_blocks_decrypt_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_LE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128)\n (out128x6_b:buffer128) (len128x6_num:nat64) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (cipher_num:nat64) (scratch_b:buffer128) (tag_b:buffer128)\n (key:(seq nat32)) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Gcm_blocks_decrypt_stdcall va_b0 va_s0 win alg auth_b auth_bytes auth_num keys_b iv_b iv\n hkeys_b abytes_b in128x6_b out128x6_b len128x6_num in128_b out128_b len128_num inout_b\n cipher_num scratch_b tag_b key /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let (auth_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0\n else va_get_reg64 rRdi va_s0) in let (auth_num_bytes:(va_int_range 0 18446744073709551615)) =\n (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let\n (auth_len:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in let (iv_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 0) (va_get_stack va_s0) else va_get_reg64 rR8 va_s0) in let (xip:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 8) (va_get_stack va_s0) else va_get_reg64 rR9 va_s0) in let (abytes_ptr:(va_int_range\n 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0\n + 40 + 16) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8\n + 0) (va_get_stack va_s0)) in let (in128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) in\n let (out128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack va_s0)) in let\n (len128x6:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack va_s0)) in let (in128_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 48) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 32) (va_get_stack va_s0)) in let (out128_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack va_s0)) in\n let (len128:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack va_s0)) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 72) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 56) (va_get_stack va_s0)) in let (cipher_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack va_s0)) in\n let (scratch_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack va_s0)) in let\n (tag_ptr:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack va_s0)) in Vale.X64.Decls.modifies_mem\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 iv_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 scratch_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 out128x6_b)\n (Vale.X64.Decls.loc_union (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 out128_b)\n (Vale.X64.Decls.loc_buffer #Vale.X64.Memory.vuint128 inout_b))))) (va_get_mem va_s0)\n (va_get_mem va_sM) /\\ cipher_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ (let iv_BE =\n Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem va_s0) in let auth_raw_quads =\n FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_s0) auth_b)\n (Vale.X64.Decls.s128 (va_get_mem va_s0) abytes_b) in let auth_bytes = FStar.Seq.Base.slice\n #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes auth_raw_quads) 0\n auth_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32\n (FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_s0)\n in128x6_b) (Vale.X64.Decls.s128 (va_get_mem va_s0) in128_b)) (Vale.X64.Decls.s128 (va_get_mem\n va_s0) inout_b) in let cipher_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes cipher_raw_quads) 0 cipher_num_bytes in let\n plain_raw_quads = FStar.Seq.Base.append #Vale.X64.Decls.quad32 (FStar.Seq.Base.append\n #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_sM) out128x6_b) (Vale.X64.Decls.s128\n (va_get_mem va_sM) out128_b)) (Vale.X64.Decls.s128 (va_get_mem va_sM) inout_b) in let\n plain_bytes = FStar.Seq.Base.slice #Vale.Def.Types_s.nat8\n (Vale.Def.Types_s.le_seq_quad32_to_bytes plain_raw_quads) 0 cipher_num_bytes in let\n expected_tag = Vale.Def.Types_s.le_quad32_to_bytes (Vale.X64.Decls.buffer128_read tag_b 0\n (va_get_mem va_s0)) in l_and (l_and (l_and (l_and (FStar.Seq.Base.length #Vale.Def.Types_s.nat8\n auth_bytes < pow2_32) (FStar.Seq.Base.length #Vale.Def.Types_s.nat8 cipher_bytes < pow2_32))\n (Vale.AES.AES_common_s.is_aes_key alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key)))\n (plain_bytes == __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool\n (Vale.AES.GCM_s.gcm_decrypt_LE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv\n cipher_bytes auth_bytes expected_tag))) (va_get_reg64 rRax va_sM = 0 ==\n __proj__Mktuple2__item___2 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool\n (Vale.AES.GCM_s.gcm_decrypt_LE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_LE key) iv\n cipher_bytes auth_bytes expected_tag)) /\\ va_get_reg64 rRsp va_sM == va_get_reg64 rRsp va_s0 /\\\n (win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\ (win ==> va_get_reg64 rRbp\n va_sM == va_get_reg64 rRbp va_s0) /\\ (win ==> va_get_reg64 rRdi va_sM == va_get_reg64 rRdi\n va_s0) /\\ (win ==> va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0) /\\ (win ==> va_get_reg64\n rR12 va_sM == va_get_reg64 rR12 va_s0) /\\ (win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (win ==> va_get_reg64\n rR15 va_sM == va_get_reg64 rR15 va_s0) /\\ (win ==> va_get_xmm 6 va_sM == va_get_xmm 6 va_s0) /\\\n (win ==> va_get_xmm 7 va_sM == va_get_xmm 7 va_s0) /\\ (win ==> va_get_xmm 8 va_sM == va_get_xmm\n 8 va_s0) /\\ (win ==> va_get_xmm 9 va_sM == va_get_xmm 9 va_s0) /\\ (win ==> va_get_xmm 10 va_sM\n == va_get_xmm 10 va_s0) /\\ (win ==> va_get_xmm 11 va_sM == va_get_xmm 11 va_s0) /\\ (win ==>\n va_get_xmm 12 va_sM == va_get_xmm 12 va_s0) /\\ (win ==> va_get_xmm 13 va_sM == va_get_xmm 13\n va_s0) /\\ (win ==> va_get_xmm 14 va_sM == va_get_xmm 14 va_s0) /\\ (win ==> va_get_xmm 15 va_sM\n == va_get_xmm 15 va_s0) /\\ (~win ==> va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0) /\\\n (~win ==> va_get_reg64 rRbp va_sM == va_get_reg64 rRbp va_s0) /\\ (~win ==> va_get_reg64 rR12\n va_sM == va_get_reg64 rR12 va_s0) /\\ (~win ==> va_get_reg64 rR13 va_sM == va_get_reg64 rR13\n va_s0) /\\ (~win ==> va_get_reg64 rR14 va_sM == va_get_reg64 rR14 va_s0) /\\ (~win ==>\n va_get_reg64 rR15 va_sM == va_get_reg64 rR15 va_s0))) /\\ va_state_eq va_sM\n (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_flags va_sM (va_update_mem_layout\n va_sM (va_update_mem_heaplet 6 va_sM (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 3\n va_sM (va_update_mem_heaplet 2 va_sM (va_update_mem_heaplet 1 va_sM (va_update_xmm 15 va_sM\n (va_update_xmm 14 va_sM (va_update_xmm 13 va_sM (va_update_xmm 12 va_sM (va_update_xmm 11 va_sM\n (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM\n (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM\n (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rR15\n va_sM (va_update_reg64 rR14 va_sM (va_update_reg64 rR13 va_sM (va_update_reg64 rR12 va_sM\n (va_update_reg64 rR11 va_sM (va_update_reg64 rR10 va_sM (va_update_reg64 rR9 va_sM\n (va_update_reg64 rR8 va_sM (va_update_reg64 rRbp va_sM (va_update_reg64 rRsp va_sM\n (va_update_reg64 rRsi va_sM (va_update_reg64 rRdi va_sM (va_update_reg64 rRdx va_sM\n (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))))))))", "val va_ens_Check_movbe_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_movbe_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_movbe_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> movbe_enabled) /\\ va_get_reg64 rRbx va_sM\n == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_reg64 rR9\n va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM (va_update_reg64 rRbx va_sM\n (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_ens_Check_adx_bmi2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Check_adx_bmi2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (va_sM:va_state)\n (va_fM:va_fuel) : prop =\n (va_req_Check_adx_bmi2_stdcall va_b0 va_s0 win /\\ va_ensure_total va_b0 va_s0 va_sM va_fM /\\\n va_get_ok va_sM /\\ (va_get_reg64 rRax va_sM =!= 0 ==> adx_enabled /\\ bmi2_enabled) /\\\n va_get_reg64 rRbx va_sM == va_get_reg64 rRbx va_s0 /\\ va_state_eq va_sM (va_update_flags va_sM\n (va_update_reg64 rR9 va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRcx va_sM\n (va_update_reg64 rRbx va_sM (va_update_reg64 rRax va_sM (va_update_ok va_sM va_s0))))))))", "val va_req_Poly1305\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (ctx_b inp_b: buffer64)\n (len_in finish_in: nat64)\n : prop\nlet va_req_Poly1305 (va_b0:va_code) (va_s0:va_state) (win:bool) (ctx_b:buffer64) (inp_b:buffer64)\n (len_in:nat64) (finish_in:nat64) : prop =\n (va_require_total va_b0 (va_code_Poly1305 win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (ctx_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inp_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (n:(va_int_range\n 18446744073709551616 18446744073709551616)) = 18446744073709551616 in let (p:(va_int_range\n 1361129467683753853853498429727072845819 1361129467683753853853498429727072845819)) =\n va_mul_nat n n `op_Multiply` 4 - 5 in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp\n (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem\n va_s0) /\\ Vale.X64.Decls.buffers_disjoint ctx_b inp_b /\\ Vale.X64.Decls.validDstAddrs64\n (va_get_mem va_s0) ctx_in ctx_b 24 (va_get_mem_layout va_s0) Public /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inp_in inp_b\n (Vale.Poly1305.Util.readable_words len_in) (va_get_mem_layout va_s0) Public /\\ len_in == (if\n win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\\ finish_in == (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) /\\ (let h2_in =\n Vale.X64.Decls.buffer64_read ctx_b 2 (va_get_mem va_s0) in h2_in < 5 /\\ inp_in + len_in <\n pow2_64 /\\ finish_in < 2)))", "val va_req_Gctr_bytes_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (in_b: buffer128)\n (num_bytes: nat64)\n (out_b inout_b keys_b ctr_b: buffer128)\n (num_blocks: nat64)\n (key: (seq nat32))\n : prop\nlet va_req_Gctr_bytes_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (in_b:buffer128) (num_bytes:nat64) (out_b:buffer128) (inout_b:buffer128) (keys_b:buffer128)\n (ctr_b:buffer128) (num_blocks:nat64) (key:(seq nat32)) : prop =\n (va_require_total va_b0 (va_code_Gctr_bytes_stdcall win alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (in_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (out_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in\n let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else\n va_get_reg64 rR8 va_s0) in let (ctr_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) else\n va_get_reg64 rR9 va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (win\n ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0))\n /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 16)\n (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==>\n Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)\n Public (va_get_stackTaint va_s0)) /\\ num_bytes == (if win then va_get_reg64 rRdx va_s0 else\n va_get_reg64 rRsi va_s0) /\\ num_blocks == (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 16) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8) (va_get_stack va_s0)) /\\ Vale.X64.Decls.buffers_disjoint128 in_b\n out_b /\\ Vale.X64.Decls.buffers_disjoint128 keys_b out_b /\\ (Vale.X64.Decls.buffers_disjoint128\n in_b keys_b \\/ in_b == keys_b) /\\ Vale.X64.Decls.buffer_disjoints128 ctr_b ([in_b; out_b;\n keys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 inout_b ([in_b; out_b; keys_b; ctr_b]) /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in_ptr in_b num_blocks (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) out_ptr out_b num_blocks\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0)\n inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem va_s0) keys_ptr keys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) ctr_ptr ctr_b 1 (va_get_mem_layout\n va_s0) Secret /\\ in_ptr + 16 `op_Multiply` num_blocks < pow2_64 /\\ out_ptr + 16 `op_Multiply`\n num_blocks < pow2_64 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b ==\n num_blocks /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b ==\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out_b /\\ Vale.X64.Decls.buffer_length\n #Vale.X64.Memory.vuint128 ctr_b == 1 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128\n inout_b == 1 /\\ 256 `op_Multiply` Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in_b <\n pow2_32 /\\ 4096 `op_Multiply` num_blocks `op_Multiply` 16 < pow2_32 /\\ (num_blocks\n `op_Multiply` 128 `op_Division` 8 <= num_bytes /\\ num_bytes < num_blocks `op_Multiply` 128\n `op_Division` 8 + 128 `op_Division` 8) /\\ (aesni_enabled /\\ avx_enabled /\\ sse_enabled) /\\ (alg\n = AES_128 \\/ alg = AES_256) /\\ Vale.AES.AES_s.is_aes_key_LE alg key /\\\n Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) keys_b ==\n Vale.AES.AES_s.key_to_round_keys_LE alg key))", "val va_ens_Gcm_blocks_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_BE)\n (hkeys_b abytes_b in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (plain_num: nat64)\n (gcm_struct_b: buffer64)\n (tag_b: buffer128)\n (key: (seq nat32))\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Gcm_blocks_stdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm) (auth_b:buffer128)\n (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128) (iv:supported_iv_BE)\n (hkeys_b:buffer128) (abytes_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (plain_num:nat64) (gcm_struct_b:buffer64)\n (tag_b:buffer128) (key:(seq nat32)) (va_sM:va_state) (va_fM:va_fuel) : prop =\n (va_req_Gcm_blocks_stdcall va_b0 va_s0 alg auth_b auth_bytes auth_num keys_b iv_b iv hkeys_b\n abytes_b in128_b out128_b len128_num inout_b plain_num gcm_struct_b tag_b key /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let\n (abytes_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 0\n (va_get_mem_heaplet 3 va_s0) in let (in128_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 1 (va_get_mem_heaplet 3 va_s0) in let\n (out128_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 2\n (va_get_mem_heaplet 3 va_s0) in let (len128:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 3 (va_get_mem_heaplet 3 va_s0) in let\n (inout_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 4\n (va_get_mem_heaplet 3 va_s0) in let (plain_num_bytes:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 5 (va_get_mem_heaplet 3 va_s0) in let\n (auth_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 6\n (va_get_mem_heaplet 3 va_s0) in let (auth_len:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 7 (va_get_mem_heaplet 3 va_s0) in let\n (auth_num_bytes:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 8\n (va_get_mem_heaplet 3 va_s0) in let (iv_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 9 (va_get_mem_heaplet 3 va_s0) in let\n (keys_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 10\n (va_get_mem_heaplet 3 va_s0) in let (h_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 11 (va_get_mem_heaplet 3 va_s0) in let\n (tag_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 12\n (va_get_mem_heaplet 3 va_s0) in Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_union\n (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 tag_b)\n (Vale.PPC64LE.Decls.loc_union (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n iv_b) (Vale.PPC64LE.Decls.loc_union (Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 out128_b) (Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 inout_b)))) (va_get_mem va_s0) (va_get_mem va_sM) /\\\n plain_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ (let iv_BE =\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read iv_b 0 (va_get_mem\n va_s0)) in let auth_raw_quads = FStar.Seq.Base.append #Vale.Def.Types_s.quad32\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) auth_b))\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0)\n abytes_b)) in let auth_bytes = FStar.Seq.Base.slice #Vale.Def.Words_s.nat8\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE\n #Vale.Def.Words_s.nat32 auth_raw_quads)) 0 auth_num_bytes in let plain_raw_quads =\n FStar.Seq.Base.append #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) in128_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) inout_b)) in let plain_bytes = FStar.Seq.Base.slice\n #Vale.Def.Words_s.nat8 (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE\n (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 plain_raw_quads)) 0\n plain_num_bytes in let cipher_raw_quads = FStar.Seq.Base.append #Vale.Def.Types_s.quad32\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_sM)\n out128_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem\n va_sM) inout_b)) in let cipher_bytes = FStar.Seq.Base.slice #Vale.Def.Words_s.nat8\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE\n #Vale.Def.Words_s.nat32 cipher_raw_quads)) 0 plain_num_bytes in l_and (l_and (l_and (l_and\n (FStar.Seq.Base.length #Vale.Def.Words_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length\n #Vale.Def.Words_s.nat8 plain_bytes < pow2_32)) (Vale.AES.AES_common_s.is_aes_key alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key))) (cipher_bytes ==\n __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #(FStar.Seq.Base.seq\n Vale.Def.Types_s.nat8) (Vale.AES.GCM_BE_s.gcm_encrypt_BE alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key) iv plain_bytes auth_bytes)))\n (Vale.Arch.Types.be_quad32_to_bytes (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read tag_b 0 (va_get_mem va_sM))) == __proj__Mktuple2__item___2\n #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8)\n (Vale.AES.GCM_BE_s.gcm_encrypt_BE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key) iv\n plain_bytes auth_bytes)) /\\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 /\\ l_and (l_and (l_and\n (l_and (l_and (l_and (l_and (l_and (va_get_reg 25 va_sM == va_get_reg 25 va_s0) (va_get_reg 26\n va_sM == va_get_reg 26 va_s0)) (va_get_reg 27 va_sM == va_get_reg 27 va_s0)) (va_get_reg 28\n va_sM == va_get_reg 28 va_s0)) (va_get_reg 29 va_sM == va_get_reg 29 va_s0)) (va_get_reg 30\n va_sM == va_get_reg 30 va_s0)) (va_get_reg 31 va_sM == va_get_reg 31 va_s0)) (va_get_vec 20\n va_sM == va_get_vec 20 va_s0)) (va_get_vec 21 va_sM == va_get_vec 21 va_s0))) /\\ va_state_eq\n va_sM (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 4 va_sM (va_update_mem_heaplet 2 va_sM\n (va_update_mem_heaplet 1 va_sM (va_update_cr0 va_sM (va_update_vec 21 va_sM (va_update_vec 20\n va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16\n va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12\n va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8\n va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4\n va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0\n va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29 va_sM (va_update_reg 28\n va_sM (va_update_reg 27 va_sM (va_update_reg 26 va_sM (va_update_reg 25 va_sM (va_update_reg 10\n va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 7 va_sM (va_update_reg 6\n va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM (va_update_reg 3 va_sM (va_update_reg 1\n va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0)))))))))))))))))))))))))))))))))))))))))))))))))", "val va_req_Compute_iv_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (iv: supported_iv_BE)\n (iv_b: buffer128)\n (num_bytes len: nat64)\n (j0_b iv_extra_b hkeys_b: buffer128)\n : prop\nlet va_req_Compute_iv_stdcall (va_b0:va_code) (va_s0:va_state) (iv:supported_iv_BE)\n (iv_b:buffer128) (num_bytes:nat64) (len:nat64) (j0_b:buffer128) (iv_extra_b:buffer128)\n (hkeys_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Compute_iv_stdcall ()) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (h_BE:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read hkeys_b 2 (va_get_mem va_s0)) in\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ va_get_reg\n 8 va_s0 == num_bytes /\\ va_get_reg 6 va_s0 == len /\\ Vale.PPC64LE.Decls.validSrcAddrs128\n (va_get_mem va_s0) (va_get_reg 7 va_s0) iv_b len (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 4 va_s0) iv_extra_b 1\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0)\n (va_get_reg 3 va_s0) j0_b 1 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 5 va_s0) hkeys_b 3\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.buffers_disjoint128 iv_b iv_extra_b /\\\n Vale.PPC64LE.Decls.buffers_disjoint128 iv_b hkeys_b /\\ Vale.PPC64LE.Decls.buffers_disjoint128\n iv_extra_b hkeys_b /\\ Vale.PPC64LE.Decls.buffers_disjoint128 j0_b iv_b /\\\n Vale.PPC64LE.Decls.buffers_disjoint128 j0_b hkeys_b /\\ (Vale.PPC64LE.Decls.buffers_disjoint128\n j0_b iv_extra_b \\/ j0_b == iv_extra_b) /\\ Vale.PPC64LE.Decls.buffer_length\n #Vale.PPC64LE.Memory.vuint128 iv_b == len /\\ Vale.PPC64LE.Decls.buffer_length\n #Vale.PPC64LE.Memory.vuint128 iv_extra_b == 1 /\\ va_get_reg 7 va_s0 + 16 `op_Multiply` len <\n pow2_64 /\\ va_get_reg 5 va_s0 + 32 < pow2_64 /\\ (va_mul_nat len (128 `op_Division` 8) <=\n num_bytes /\\ num_bytes < va_mul_nat len (128 `op_Division` 8) + 128 `op_Division` 8) /\\ (0 < 8\n `op_Multiply` num_bytes /\\ 8 `op_Multiply` num_bytes < pow2_64) /\\\n Vale.AES.OptPublic_BE.hkeys_reqs_pub (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) hkeys_b)) h_BE /\\ (let iv_raw_quads =\n FStar.Seq.Base.append #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) iv_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) iv_extra_b)) in let (iv_bytes_BE:supported_iv_BE) =\n FStar.Seq.Base.slice #Vale.Def.Words_s.nat8 (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE\n (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 iv_raw_quads)) 0 num_bytes in\n iv_bytes_BE == iv)))", "val va_req_Keyhash_init\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (key: (seq nat32))\n (roundkeys_b hkeys_b: buffer128)\n : prop\nlet va_req_Keyhash_init (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm) (key:(seq\n nat32)) (roundkeys_b:buffer128) (hkeys_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Keyhash_init win alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (round_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (hkey_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (aesni_enabled /\\ pclmulqdq_enabled /\\\n avx_enabled /\\ sse_enabled) /\\ (alg = AES_128 \\/ alg = AES_256) /\\\n Vale.X64.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\\ Vale.AES.AES_s.is_aes_key_LE alg key\n /\\ Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b ==\n Vale.AES.AES_s.key_to_round_keys_LE alg key /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem\n va_s0) round_ptr roundkeys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) hkey_ptr hkeys_b 8\n (va_get_mem_layout va_s0) Secret))", "val va_req_Keyhash_init\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (key: (seq nat32))\n (roundkeys_b hkeys_b: buffer128)\n : prop\nlet va_req_Keyhash_init (va_b0:va_code) (va_s0:va_state) (alg:algorithm) (key:(seq nat32))\n (roundkeys_b:buffer128) (hkeys_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Keyhash_init alg) va_s0 /\\ va_get_ok va_s0 /\\\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (alg =\n AES_128 \\/ alg = AES_256) /\\ Vale.PPC64LE.Decls.buffers_disjoint128 roundkeys_b hkeys_b /\\\n Vale.AES.AES_BE_s.is_aes_key_word alg key /\\ Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem va_s0) roundkeys_b) ==\n Vale.AES.AES_BE_s.key_to_round_keys_word alg key /\\ Vale.PPC64LE.Decls.validSrcAddrs128\n (va_get_mem va_s0) (va_get_reg 4 va_s0) roundkeys_b (Vale.AES.AES_common_s.nr alg + 1)\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0)\n (va_get_reg 3 va_s0) hkeys_b 3 (va_get_mem_layout va_s0) Secret)", "val va_ens_Gcm_blocks_decrypt_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_BE)\n (hkeys_b abytes_b in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (cipher_num: nat64)\n (gcm_struct_b: buffer64)\n (tag_b: buffer128)\n (key: (seq nat32))\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop\nlet va_ens_Gcm_blocks_decrypt_stdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_BE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128_b:buffer128)\n (out128_b:buffer128) (len128_num:nat64) (inout_b:buffer128) (cipher_num:nat64)\n (gcm_struct_b:buffer64) (tag_b:buffer128) (key:(seq nat32)) (va_sM:va_state) (va_fM:va_fuel) :\n prop =\n (va_req_Gcm_blocks_decrypt_stdcall va_b0 va_s0 alg auth_b auth_bytes auth_num keys_b iv_b iv\n hkeys_b abytes_b in128_b out128_b len128_num inout_b cipher_num gcm_struct_b tag_b key /\\\n va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\ (let\n (abytes_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 0\n (va_get_mem_heaplet 3 va_s0) in let (in128_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 1 (va_get_mem_heaplet 3 va_s0) in let\n (out128_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 2\n (va_get_mem_heaplet 3 va_s0) in let (len128:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 3 (va_get_mem_heaplet 3 va_s0) in let\n (inout_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 4\n (va_get_mem_heaplet 3 va_s0) in let (cipher_num_bytes:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 5 (va_get_mem_heaplet 3 va_s0) in let\n (auth_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 6\n (va_get_mem_heaplet 3 va_s0) in let (auth_len:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 7 (va_get_mem_heaplet 3 va_s0) in let\n (auth_num_bytes:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 8\n (va_get_mem_heaplet 3 va_s0) in let (iv_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 9 (va_get_mem_heaplet 3 va_s0) in let\n (keys_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 10\n (va_get_mem_heaplet 3 va_s0) in let (h_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 11 (va_get_mem_heaplet 3 va_s0) in let\n (tag_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 12\n (va_get_mem_heaplet 3 va_s0) in Vale.PPC64LE.Decls.modifies_mem (Vale.PPC64LE.Decls.loc_union\n (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 iv_b)\n (Vale.PPC64LE.Decls.loc_union (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n out128_b) (Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 inout_b))) (va_get_mem\n va_s0) (va_get_mem va_sM) /\\ cipher_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ (let\n iv_BE = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read iv_b 0\n (va_get_mem va_s0)) in let auth_raw_quads = FStar.Seq.Base.append #Vale.Def.Types_s.quad32\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) auth_b))\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0)\n abytes_b)) in let auth_bytes = FStar.Seq.Base.slice #Vale.Def.Words_s.nat8\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE\n #Vale.Def.Words_s.nat32 auth_raw_quads)) 0 auth_num_bytes in let cipher_raw_quads =\n FStar.Seq.Base.append #Vale.Def.Types_s.quad32 (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) in128_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) inout_b)) in let cipher_bytes =\n FStar.Seq.Base.slice #Vale.Def.Words_s.nat8 (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE\n (Vale.Def.Words.Seq_s.seq_four_to_seq_BE #Vale.Def.Words_s.nat32 cipher_raw_quads)) 0\n cipher_num_bytes in let plain_raw_quads = FStar.Seq.Base.append #Vale.Def.Types_s.quad32\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_sM)\n out128_b)) (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem\n va_sM) inout_b)) in let plain_bytes = FStar.Seq.Base.slice #Vale.Def.Words_s.nat8\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE\n #Vale.Def.Words_s.nat32 plain_raw_quads)) 0 cipher_num_bytes in let expected_tag =\n Vale.Arch.Types.be_quad32_to_bytes (Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read tag_b 0 (va_get_mem va_s0))) in l_and (l_and (l_and (l_and\n (FStar.Seq.Base.length #Vale.Def.Words_s.nat8 auth_bytes < pow2_32) (FStar.Seq.Base.length\n #Vale.Def.Words_s.nat8 plain_bytes < pow2_32)) (Vale.AES.AES_common_s.is_aes_key alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key))) (plain_bytes ==\n __proj__Mktuple2__item___1 #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool\n (Vale.AES.GCM_BE_s.gcm_decrypt_BE alg (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key) iv\n cipher_bytes auth_bytes expected_tag))) (va_get_reg 3 va_sM = 0 == __proj__Mktuple2__item___2\n #(FStar.Seq.Base.seq Vale.Def.Types_s.nat8) #bool (Vale.AES.GCM_BE_s.gcm_decrypt_BE alg\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE key) iv cipher_bytes auth_bytes expected_tag))\n /\\ va_get_reg 1 va_sM == va_get_reg 1 va_s0 /\\ l_and (l_and (l_and (l_and (l_and (l_and (l_and\n (l_and (va_get_reg 25 va_sM == va_get_reg 25 va_s0) (va_get_reg 26 va_sM == va_get_reg 26\n va_s0)) (va_get_reg 27 va_sM == va_get_reg 27 va_s0)) (va_get_reg 28 va_sM == va_get_reg 28\n va_s0)) (va_get_reg 29 va_sM == va_get_reg 29 va_s0)) (va_get_reg 30 va_sM == va_get_reg 30\n va_s0)) (va_get_reg 31 va_sM == va_get_reg 31 va_s0)) (va_get_vec 20 va_sM == va_get_vec 20\n va_s0)) (va_get_vec 21 va_sM == va_get_vec 21 va_s0))) /\\ va_state_eq va_sM\n (va_update_stackTaint va_sM (va_update_stack va_sM (va_update_mem_layout va_sM\n (va_update_mem_heaplet 5 va_sM (va_update_mem_heaplet 4 va_sM (va_update_mem_heaplet 2 va_sM\n (va_update_mem_heaplet 1 va_sM (va_update_xer va_sM (va_update_cr0 va_sM (va_update_vec 21\n va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM (va_update_vec 18 va_sM (va_update_vec 17\n va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM (va_update_vec 14 va_sM (va_update_vec 13\n va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM (va_update_vec 10 va_sM (va_update_vec 9\n va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM (va_update_vec 6 va_sM (va_update_vec 5\n va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM (va_update_vec 2 va_sM (va_update_vec 1\n va_sM (va_update_vec 0 va_sM (va_update_reg 31 va_sM (va_update_reg 30 va_sM (va_update_reg 29\n va_sM (va_update_reg 28 va_sM (va_update_reg 27 va_sM (va_update_reg 26 va_sM (va_update_reg 25\n va_sM (va_update_reg 10 va_sM (va_update_reg 9 va_sM (va_update_reg 8 va_sM (va_update_reg 7\n va_sM (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM (va_update_reg 3\n va_sM (va_update_reg 1 va_sM (va_update_ok va_sM (va_update_mem va_sM\n va_s0))))))))))))))))))))))))))))))))))))))))))))))))))", "val va_lemma_Sha_update : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128 -> in_b:buffer128 ->\n k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update ()) va_s0 /\\ va_get_ok va_s0 /\\\n (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)\n (va_get_reg64 rRsi va_s0) in_b (4 `op_Multiply` va_get_reg64 rRdx va_s0) (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64\n rRdi va_s0) ctx_b 2 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret\n /\\ va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0 < pow2_64 /\\\n Vale.X64.Decls.buffers_disjoint128 ctx_b in_b /\\ Vale.SHA.SHA_helpers.k_reqs\n (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0\n /\\ (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let efgh =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let abcd' =\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh' =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0) in let input_BE\n = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in\n Vale.SHA.SHA_helpers.make_ordered_hash abcd' efgh' == Vale.SHA.SHA_helpers.update_multi_quads\n input_BE (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) /\\\n Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)) /\\ va_state_eq va_sM (va_update_flags va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_xmm 10 va_sM (va_update_xmm 9 va_sM (va_update_xmm 8 va_sM (va_update_xmm 7 va_sM\n (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4 va_sM (va_update_xmm 3 va_sM\n (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0 va_sM (va_update_reg64 rRax\n va_sM (va_update_reg64 rRdx va_sM (va_update_reg64 rRsi va_sM (va_update_ok va_sM\n (va_update_mem va_sM va_s0))))))))))))))))))))\nlet va_lemma_Sha_update va_b0 va_s0 ctx_b in_b k_b =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9;\n va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm\n 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi;\n va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Sha_update va_mods ctx_b in_b k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 627 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 653 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_reg64 rRsi va_sM == va_get_reg64 rRsi va_s0 + 64 `op_Multiply` va_get_reg64 rRdx va_s0)\n /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 662 column 103 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (let abcd = Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let efgh =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let abcd' =\n Vale.X64.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let efgh' =\n Vale.X64.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.X64.Decls.quad32 (Vale.X64.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg64 rRdx va_s0) in let input_BE\n = Vale.Arch.Types.reverse_bytes_nat32_quad32_seq input_LE in\n Vale.SHA.SHA_helpers.make_ordered_hash abcd' efgh' == Vale.SHA.SHA_helpers.update_multi_quads\n input_BE (Vale.SHA.SHA_helpers.make_ordered_hash abcd efgh)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 665 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (Vale.X64.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm 9; va_Mod_xmm\n 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3; va_Mod_xmm 2;\n va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64 rRsi; va_Mod_ok;\n va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val va_lemma_Sha_update : va_b0:va_code -> va_s0:va_state -> ctx_b:buffer128 -> in_b:buffer128 ->\n k_b:buffer128\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Sha_update ()) va_s0 /\\ va_get_ok va_s0 /\\\n (Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0\n va_s0) (va_get_reg 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0)\n Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0)\n k_b 16 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrsOffset128\n (va_get_mem_heaplet 0 va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\\\n va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 < pow2_64 /\\ va_get_reg 6 va_s0 + 256\n < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_s0) k_b))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 /\\ (let dcba =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let hgfe =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let dcba' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let hgfe' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32 (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg 5 va_s0) in let input_BE =\n Vale.Arch.Types.reverse_bytes_quad32_seq input_LE in\n Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba' hgfe' ==\n Vale.SHA.PPC64LE.SHA_helpers.update_multi_quads input_BE\n (Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba hgfe)) /\\\n Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)) /\\ va_state_eq va_sM (va_update_mem_layout va_sM (va_update_mem_heaplet 0 va_sM\n (va_update_vec 31 va_sM (va_update_vec 30 va_sM (va_update_vec 29 va_sM (va_update_vec 28 va_sM\n (va_update_vec 26 va_sM (va_update_vec 25 va_sM (va_update_vec 24 va_sM (va_update_vec 23 va_sM\n (va_update_vec 22 va_sM (va_update_vec 21 va_sM (va_update_vec 20 va_sM (va_update_vec 19 va_sM\n (va_update_vec 18 va_sM (va_update_vec 17 va_sM (va_update_vec 16 va_sM (va_update_vec 15 va_sM\n (va_update_vec 14 va_sM (va_update_vec 13 va_sM (va_update_vec 12 va_sM (va_update_vec 11 va_sM\n (va_update_vec 10 va_sM (va_update_vec 9 va_sM (va_update_vec 8 va_sM (va_update_vec 7 va_sM\n (va_update_vec 6 va_sM (va_update_vec 5 va_sM (va_update_vec 4 va_sM (va_update_vec 3 va_sM\n (va_update_vec 2 va_sM (va_update_vec 1 va_sM (va_update_vec 0 va_sM (va_update_cr0 va_sM\n (va_update_reg 10 va_sM (va_update_reg 6 va_sM (va_update_reg 5 va_sM (va_update_reg 4 va_sM\n (va_update_ok va_sM (va_update_mem va_sM va_s0))))))))))))))))))))))))))))))))))))))))))\nlet va_lemma_Sha_update va_b0 va_s0 ctx_b in_b k_b =\n let (va_mods:va_mods_t) = [va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_ok; va_Mod_mem] in\n let va_qc = va_qcode_Sha_update va_mods ctx_b in_b k_b in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Sha_update ()) va_qc va_s0 (fun va_s0\n va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 143 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 167 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_get_reg 4 va_sM == va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 175 column 103 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (let dcba = Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_s0) in let hgfe\n = Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_s0) in let dcba' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 0 (va_get_mem_heaplet 0 va_sM) in let hgfe' =\n Vale.PPC64LE.Decls.buffer128_read ctx_b 1 (va_get_mem_heaplet 0 va_sM) in let input_LE =\n FStar.Seq.Base.slice #Vale.PPC64LE.Machine_s.quad32 (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem_heaplet 0 va_sM) in_b) 0 (4 `op_Multiply` va_get_reg 5 va_s0) in let input_BE =\n Vale.Arch.Types.reverse_bytes_quad32_seq input_LE in\n Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba' hgfe' ==\n Vale.SHA.PPC64LE.SHA_helpers.update_multi_quads input_BE\n (Vale.SHA.PPC64LE.SHA_helpers.make_ordered_hash dcba hgfe)) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 177 column 53 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (Vale.PPC64LE.Decls.modifies_buffer128 ctx_b (va_get_mem_heaplet 0 va_s0) (va_get_mem_heaplet 0\n va_sM)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31; va_Mod_vec 30;\n va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24; va_Mod_vec 23;\n va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18; va_Mod_vec 17;\n va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12; va_Mod_vec 11;\n va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6; va_Mod_vec 5; va_Mod_vec\n 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0; va_Mod_reg 10;\n va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_ok; va_Mod_mem]) va_sM va_s0;\n (va_sM, va_fM)", "val sha_lemma'\n (code: V.va_code)\n (_win: bool)\n (ctx_b: b128)\n (in_b: b8_128)\n (num_val: uint64)\n (k_b: ib128)\n (va_s0: V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires sha_pre code ctx_b in_b num_val k_b va_s0)\n (ensures\n (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\ VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code ctx_b in_b num_val k_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\ ME.buffer_writeable (as_vale_buffer in_b))\n )\nlet sha_lemma'\n (code:V.va_code)\n (_win:bool)\n (ctx_b:b128)\n (in_b:b8_128)\n (num_val:uint64)\n (k_b:ib128)\n (va_s0:V.va_state)\n : Ghost (V.va_state & V.va_fuel)\n (requires\n sha_pre code ctx_b in_b num_val k_b va_s0)\n (ensures (fun (va_s1, f) ->\n V.eval_code code va_s0 f va_s1 /\\\n VSig.vale_calling_conventions_stdcall va_s0 va_s1 /\\\n sha_post code ctx_b in_b num_val k_b va_s0 va_s1 f /\\\n ME.buffer_writeable (as_vale_buffer ctx_b) /\\\n ME.buffer_writeable (as_vale_buffer in_b)\n )) =\n let va_s1, f = SH.va_lemma_Sha_update_bytes_stdcall code va_s0 IA.win (as_vale_buffer ctx_b) (as_vale_buffer in_b) (UInt64.v num_val) (as_vale_immbuffer k_b) in\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt32 ME.TUInt128 ctx_b;\n Vale.AsLowStar.MemoryHelpers.buffer_writeable_reveal ME.TUInt8 ME.TUInt128 in_b;\n (va_s1, f)", "val va_req_Fmul1_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b: buffer64)\n (inB_in: nat64)\n : prop\nlet va_req_Fmul1_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_in:nat64) : prop =\n (va_require_total va_b0 (va_code_Fmul1_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in va_get_reg64 rRsp va_s0 ==\n Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\ bmi2_enabled) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ inA_b == dst_b) /\\ inB_in = (if win then\n va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\\ Vale.X64.Decls.validDstAddrs64\n (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout va_s0)\n Secret /\\ inB_in < 131072))", "val va_req_Compute_iv_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (iv: supported_iv_LE)\n (iv_b: buffer128)\n (num_bytes len: nat64)\n (j0_b iv_extra_b hkeys_b: buffer128)\n : prop\nlet va_req_Compute_iv_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (iv:supported_iv_LE)\n (iv_b:buffer128) (num_bytes:nat64) (len:nat64) (j0_b:buffer128) (iv_extra_b:buffer128)\n (hkeys_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Compute_iv_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (iv_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (bytes_reg:(va_int_range 0 18446744073709551615)) = (if win\n then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (len_reg:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (j0_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let (extra_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0)\n else va_get_reg64 rR8 va_s0) in let (h_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0)\n else va_get_reg64 rR9 va_s0) in let (h_LE:Vale.Def.Types_s.quad32) =\n Vale.Def.Types_s.reverse_bytes_quad32 (Vale.X64.Decls.buffer128_read hkeys_b 2 (va_get_mem\n va_s0)) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (win ==>\n Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 0) (va_get_stack va_s0)\n Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64\n rRsp va_s0 + 40 + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\ bytes_reg ==\n num_bytes /\\ len_reg == len /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) iv_ptr iv_b\n len (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0)\n extra_ptr iv_extra_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128\n (va_get_mem va_s0) j0_ptr j0_b 1 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) h_ptr hkeys_b 8 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.buffers_disjoint128 iv_b iv_extra_b /\\\n Vale.X64.Decls.buffers_disjoint128 iv_b hkeys_b /\\ Vale.X64.Decls.buffers_disjoint128\n iv_extra_b hkeys_b /\\ Vale.X64.Decls.buffers_disjoint128 j0_b iv_b /\\\n Vale.X64.Decls.buffers_disjoint128 j0_b hkeys_b /\\ (Vale.X64.Decls.buffers_disjoint128 j0_b\n iv_extra_b \\/ j0_b == iv_extra_b) /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128\n iv_b == len /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 iv_extra_b == 1 /\\ iv_ptr\n + 16 `op_Multiply` len < pow2_64 /\\ h_ptr + 32 < pow2_64 /\\ (va_mul_nat len (128 `op_Division`\n 8) <= num_bytes /\\ num_bytes < va_mul_nat len (128 `op_Division` 8) + 128 `op_Division` 8) /\\\n (0 < 8 `op_Multiply` num_bytes /\\ 8 `op_Multiply` num_bytes < pow2_64) /\\ (pclmulqdq_enabled /\\\n avx_enabled /\\ sse_enabled) /\\ Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128\n (va_get_mem va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\\ (let iv_raw_quads =\n FStar.Seq.Base.append #Vale.X64.Decls.quad32 (Vale.X64.Decls.s128 (va_get_mem va_s0) iv_b)\n (Vale.X64.Decls.s128 (va_get_mem va_s0) iv_extra_b) in let (iv_bytes_LE:supported_iv_LE) =\n FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes\n iv_raw_quads) 0 num_bytes in iv_bytes_LE == iv)))", "val va_req_Fsqr2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b: buffer64)\n : prop\nlet va_req_Fsqr2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) : prop =\n (va_require_total va_b0 (va_code_Fsqr2_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\\n bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem\n va_s0) dst_in dst_b 8 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64\n (va_get_mem va_s0) inA_in inA_b 8 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in tmp_b 16 (va_get_mem_layout va_s0)\n Secret))", "val va_qcode_Sha_update (va_mods: va_mods_t) (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update ()))\nlet va_qcode_Sha_update (va_mods:va_mods_t) (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) :\n (va_quickCode unit (va_code_Sha_update ())) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 667 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Preamble ctx_b) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 668 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Loop in_b k_b) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 669 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_quick_Epilogue ctx_b) (va_QEmpty (()))))))", "val va_qcode_Sha_update (va_mods: va_mods_t) (ctx_b in_b k_b: buffer128)\n : (va_quickCode unit (va_code_Sha_update ()))\nlet va_qcode_Sha_update (va_mods:va_mods_t) (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) :\n (va_quickCode unit (va_code_Sha_update ())) =\n (qblock va_mods (fun (va_s:va_state) -> let (va_old_s:va_state) = va_s in va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 179 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Preamble ctx_b) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 180 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Loop in_b k_b) (va_QSeq va_range1\n \"***** PRECONDITION NOT MET AT line 181 column 13 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.vaf *****\"\n (va_quick_Epilogue ctx_b) (va_QEmpty (()))))))", "val va_req_Fast_add1_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (dst_b inA_b: buffer64)\n (inB_in: nat64)\n : prop\nlet va_req_Fast_add1_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (dst_b:buffer64)\n (inA_b:buffer64) (inB_in:nat64) : prop =\n (va_require_total va_b0 (va_code_Fast_add1_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (dst_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in va_get_reg64 rRsp va_s0 ==\n Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (adx_enabled /\\ bmi2_enabled) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ inA_b == dst_b) /\\ inB_in = (if win then\n va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) /\\ Vale.X64.Decls.validDstAddrs64\n (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout va_s0)\n Secret))", "val va_quick_Sha_update (ctx_b in_b k_b: buffer128) : (va_quickCode unit (va_code_Sha_update ()))\nlet va_quick_Sha_update (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) : (va_quickCode unit\n (va_code_Sha_update ())) =\n (va_QProc (va_code_Sha_update ()) ([va_Mod_mem_layout; va_Mod_mem_heaplet 0; va_Mod_vec 31;\n va_Mod_vec 30; va_Mod_vec 29; va_Mod_vec 28; va_Mod_vec 26; va_Mod_vec 25; va_Mod_vec 24;\n va_Mod_vec 23; va_Mod_vec 22; va_Mod_vec 21; va_Mod_vec 20; va_Mod_vec 19; va_Mod_vec 18;\n va_Mod_vec 17; va_Mod_vec 16; va_Mod_vec 15; va_Mod_vec 14; va_Mod_vec 13; va_Mod_vec 12;\n va_Mod_vec 11; va_Mod_vec 10; va_Mod_vec 9; va_Mod_vec 8; va_Mod_vec 7; va_Mod_vec 6;\n va_Mod_vec 5; va_Mod_vec 4; va_Mod_vec 3; va_Mod_vec 2; va_Mod_vec 1; va_Mod_vec 0; va_Mod_cr0;\n va_Mod_reg 10; va_Mod_reg 6; va_Mod_reg 5; va_Mod_reg 4; va_Mod_mem]) (va_wp_Sha_update ctx_b\n in_b k_b) (va_wpProof_Sha_update ctx_b in_b k_b))", "val va_quick_Sha_update (ctx_b in_b k_b: buffer128) : (va_quickCode unit (va_code_Sha_update ()))\nlet va_quick_Sha_update (ctx_b:buffer128) (in_b:buffer128) (k_b:buffer128) : (va_quickCode unit\n (va_code_Sha_update ())) =\n (va_QProc (va_code_Sha_update ()) ([va_Mod_flags; va_Mod_mem_heaplet 0; va_Mod_xmm 10; va_Mod_xmm\n 9; va_Mod_xmm 8; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4; va_Mod_xmm 3;\n va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_reg64 rRax; va_Mod_reg64 rRdx; va_Mod_reg64\n rRsi; va_Mod_mem]) (va_wp_Sha_update ctx_b in_b k_b) (va_wpProof_Sha_update ctx_b in_b k_b))", "val va_req_Test\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (arg0 arg1 arg2 arg3 arg4 arg5 arg6 arg7: buffer64)\n : prop\nlet va_req_Test (va_b0:va_code) (va_s0:va_state) (win:bool) (arg0:buffer64) (arg1:buffer64)\n (arg2:buffer64) (arg3:buffer64) (arg4:buffer64) (arg5:buffer64) (arg6:buffer64) (arg7:buffer64) :\n prop =\n (va_require_total va_b0 (va_code_Test win) va_s0 /\\ va_get_ok va_s0 /\\ va_get_reg64 rRsp va_s0 ==\n Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0)) /\\ (win ==>\n Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0))\n /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 16)\n (va_get_stack va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 24) (va_get_stack va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_src_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) /\\ (~win ==>\n Vale.X64.Stack_i.valid_src_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) arg0 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rRdx va_s0 else\n va_get_reg64 rRsi va_s0) arg1 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) arg2 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) arg3 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else va_get_reg64 rR8 va_s0) arg4 0\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0)\n else va_get_reg64 rR9 va_s0) arg5 0 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 16) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) arg6 0 (va_get_mem_layout va_s0) Secret\n /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 32 + 8 + 24) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) arg7 0 (va_get_mem_layout va_s0) Secret)", "val va_req_Fmul2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b inB_b: buffer64)\n : prop\nlet va_req_Fmul2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : prop =\n (va_require_total va_b0 (va_code_Fmul2_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (adx_enabled /\\ bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b ==\n inA_b) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.buffers_disjoint tmp_b inB_b /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 8 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 8 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 8\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in\n tmp_b 16 (va_get_mem_layout va_s0) Secret))", "val va_req_Fmul_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (tmp_b inA_b dst_b inB_b: buffer64)\n : prop\nlet va_req_Fmul_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (tmp_b:buffer64)\n (inA_b:buffer64) (dst_b:buffer64) (inB_b:buffer64) : prop =\n (va_require_total va_b0 (va_code_Fmul_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (tmp_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (inA_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (dst_in:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (inB_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (adx_enabled /\\ bmi2_enabled) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b ==\n inA_b) /\\ (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.buffers_disjoint tmp_b inB_b /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in\n tmp_b 8 (va_get_mem_layout va_s0) Secret))", "val va_req_Fsub (va_b0: va_code) (va_s0: va_state) (dst_b inA_b inB_b: buffer64) : prop\nlet va_req_Fsub (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB_b:buffer64)\n : prop =\n (va_require_total va_b0 (va_code_Fsub ()) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let\n (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let\n (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let\n (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let\n (b0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let\n (b1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let\n (b2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let\n (b3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let\n (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let (b:Prims.nat) =\n Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in adx_enabled /\\ bmi2_enabled /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (va_get_reg64 rRdi va_s0) dst_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0)\n (va_get_reg64 rRsi va_s0) inA_b 4 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (va_get_reg64 rRdx va_s0) inB_b 4\n (va_get_mem_layout va_s0) Secret))", "val va_req_Cswap2_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (bit_in: nat64)\n (p0_b p1_b: buffer64)\n : prop\nlet va_req_Cswap2_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (bit_in:nat64)\n (p0_b:buffer64) (p1_b:buffer64) : prop =\n (va_require_total va_b0 (va_code_Cswap2_stdcall win) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (p0_in:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRdx va_s0 else\n va_get_reg64 rRsi va_s0) in let (p1_in:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in let (old_p0_0:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p0_b 0 (va_get_mem va_s0) in let (old_p0_1:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p0_b 1 (va_get_mem va_s0) in let\n (old_p0_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 2 (va_get_mem va_s0) in\n let (old_p0_3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 3 (va_get_mem va_s0)\n in let (old_p0_4:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 4 (va_get_mem\n va_s0) in let (old_p0_5:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b 5\n (va_get_mem va_s0) in let (old_p0_6:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p0_b\n 6 (va_get_mem va_s0) in let (old_p0_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p0_b 7 (va_get_mem va_s0) in let (old_p1_0:Vale.Def.Types_s.nat64) =\n Vale.X64.Decls.buffer64_read p1_b 0 (va_get_mem va_s0) in let (old_p1_1:Vale.Def.Types_s.nat64)\n = Vale.X64.Decls.buffer64_read p1_b 1 (va_get_mem va_s0) in let\n (old_p1_2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 2 (va_get_mem va_s0) in\n let (old_p1_3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 3 (va_get_mem va_s0)\n in let (old_p1_4:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 4 (va_get_mem\n va_s0) in let (old_p1_5:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b 5\n (va_get_mem va_s0) in let (old_p1_6:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read p1_b\n 6 (va_get_mem va_s0) in let (old_p1_7:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read\n p1_b 7 (va_get_mem va_s0) in va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack\n va_s0) /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n bit_in <= 1 /\\ bit_in = (if win then va_get_reg64 rRcx va_s0 else va_get_reg64 rRdi va_s0) /\\\n (Vale.X64.Decls.buffers_disjoint p0_b p1_b \\/ p1_b == p0_b) /\\ Vale.X64.Decls.validDstAddrs64\n (va_get_mem va_s0) p0_in p0_b 8 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) p1_in p1_b 8 (va_get_mem_layout va_s0)\n Secret))", "val va_req_Fadd (va_b0: va_code) (va_s0: va_state) (dst_b inA_b inB_b: buffer64) : prop\nlet va_req_Fadd (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB_b:buffer64)\n : prop =\n (va_require_total va_b0 (va_code_Fadd ()) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let\n (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let\n (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let\n (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let\n (b0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 0 (va_get_mem va_s0) in let\n (b1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 1 (va_get_mem va_s0) in let\n (b2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 2 (va_get_mem va_s0) in let\n (b3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inB_b 3 (va_get_mem va_s0) in let\n (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in let (b:Prims.nat) =\n Vale.Curve25519.Fast_defs.pow2_four b0 b1 b2 b3 in adx_enabled /\\ bmi2_enabled /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (va_get_reg64 rRdi va_s0) dst_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0)\n (va_get_reg64 rRsi va_s0) inA_b 4 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) (va_get_reg64 rRdx va_s0) inB_b 4\n (va_get_mem_layout va_s0) Secret))", "val va_req_Gcm_blocks_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_LE)\n (hkeys_b abytes_b in128x6_b out128x6_b: buffer128)\n (len128x6_num: nat64)\n (in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (plain_num: nat64)\n (scratch_b tag_b: buffer128)\n (key: (seq nat32))\n : prop\nlet va_req_Gcm_blocks_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_LE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128)\n (out128x6_b:buffer128) (len128x6_num:nat64) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (plain_num:nat64) (scratch_b:buffer128) (tag_b:buffer128)\n (key:(seq nat32)) : prop =\n (va_require_total va_b0 (va_code_Gcm_blocks_stdcall win alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (auth_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (auth_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (auth_len:(va_int_range 0\n 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else va_get_reg64 rRdx va_s0) in\n let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR9 va_s0 else\n va_get_reg64 rRcx va_s0) in let (iv_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 0) (va_get_stack va_s0) else\n va_get_reg64 rR8 va_s0) in let (xip:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 32 + 8 + 8) (va_get_stack va_s0) else\n va_get_reg64 rR9 va_s0) in let (abytes_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 16) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)) in\n let (in128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) in let\n (out128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack va_s0)) in let\n (len128x6:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack va_s0)) in let (in128_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 48) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 32) (va_get_stack va_s0)) in let (out128_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack va_s0)) in\n let (len128:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack va_s0)) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 72) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 56) (va_get_stack va_s0)) in let (plain_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack va_s0)) in\n let (scratch_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack va_s0)) in let\n (tag_ptr:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack va_s0)) in aesni_enabled /\\ pclmulqdq_enabled\n /\\ avx_enabled /\\ sse_enabled /\\ movbe_enabled /\\ va_get_reg64 rRsp va_s0 ==\n Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\ Vale.X64.Memory.is_initial_heap\n (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 56) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 0) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 16) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 48) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 72) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ auth_len == auth_num /\\ auth_num_bytes ==\n auth_bytes /\\ len128x6 == len128x6_num /\\ len128 == len128_num /\\ plain_num_bytes == plain_num\n /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) auth_ptr auth_b auth_len\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0)\n abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128\n (va_get_mem va_s0) iv_ptr iv_b 1 (va_get_mem_layout va_s0) Public /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in128x6_ptr in128x6_b len128x6\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0)\n out128x6_ptr out128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) in128_ptr in128_b len128 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) out128_ptr out128_b len128\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0)\n inout_ptr inout_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128\n (va_get_mem va_s0) scratch_ptr scratch_b 9 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) xip hkeys_b 8 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) tag_ptr tag_b 1 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.buffer_disjoints128 tag_b ([keys_b; auth_b; abytes_b; iv_b;\n in128x6_b; out128x6_b; in128_b; out128_b; inout_b; scratch_b; hkeys_b]) /\\\n Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b; auth_b; abytes_b; in128x6_b; out128x6_b;\n in128_b; out128_b; inout_b; scratch_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128\n scratch_b ([keys_b; auth_b; abytes_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b;\n hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; auth_b; abytes_b; in128x6_b;\n out128x6_b; in128_b; out128_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 auth_b ([keys_b;\n abytes_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 abytes_b ([keys_b; hkeys_b]) /\\\n Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b; auth_b; abytes_b; hkeys_b; in128_b;\n inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 in128x6_b ([keys_b; auth_b; abytes_b; hkeys_b;\n in128_b; inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; auth_b; abytes_b;\n hkeys_b; in128x6_b; out128x6_b; inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 in128_b\n ([keys_b; auth_b; abytes_b; hkeys_b; in128x6_b; out128x6_b; inout_b]) /\\\n (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \\/ in128x6_b == out128x6_b) /\\\n (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \\/ in128_b == out128_b) /\\ auth_ptr + 16\n `op_Multiply` auth_len < pow2_64 /\\ in128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\\\n out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\\ in128_ptr + 16 `op_Multiply` len128 <\n pow2_64 /\\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\\ inout_ptr + 16 < pow2_64 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b == auth_len /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length\n #Vale.X64.Memory.vuint128 out128_b /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128\n in128x6_b == len128x6 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==\n len128 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\\\n plain_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ xip + 32 < pow2_64 /\\\n Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem va_s0) + 128 < pow2_64\n /\\ len128x6 `op_Modulus` 6 == 0 /\\ (len128x6 > 0 ==> len128x6 >= 18) /\\ 12 + len128x6 + 6 <\n pow2_32 /\\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8)\n <= plain_num_bytes /\\ plain_num_bytes < va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat\n len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\\ (va_mul_nat auth_len (128 `op_Division`\n 8) <= auth_num_bytes /\\ auth_num_bytes < va_mul_nat auth_len (128 `op_Division` 8) + 128\n `op_Division` 8) /\\ (alg = AES_128 \\/ alg = AES_256) /\\ Vale.AES.AES_s.is_aes_key_LE alg key /\\\n Vale.X64.Decls.buffer128_as_seq (va_get_mem va_s0) keys_b ==\n Vale.AES.AES_s.key_to_round_keys_LE alg key /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem\n va_s0) keys_ptr keys_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0) Secret /\\\n Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_s0) hkeys_b)\n (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key\n (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\\ (let h_LE =\n Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)\n in let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem va_s0) in iv_BE ==\n Vale.AES.GCM_s.compute_iv_BE h_LE iv)))", "val va_req_KeyExpansionStdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (input_key_b output_key_expansion_b: buffer128)\n : prop\nlet va_req_KeyExpansionStdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (input_key_b:buffer128) (output_key_expansion_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_KeyExpansionStdcall win alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (key_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0 else\n va_get_reg64 rRdi va_s0) in let (key_expansion_ptr:(va_int_range 0 18446744073709551615)) = (if\n win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let (key:(FStar.Seq.Base.seq\n Vale.Def.Types_s.nat32)) = (if (alg = AES_128) then Vale.Arch.Types.quad32_to_seq\n (Vale.X64.Decls.buffer128_read input_key_b 0 (va_get_mem va_s0)) else\n Vale.AES.AES256_helpers.make_AES256_key (Vale.X64.Decls.buffer128_read input_key_b 0\n (va_get_mem va_s0)) (Vale.X64.Decls.buffer128_read input_key_b 1 (va_get_mem va_s0))) in\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (aesni_enabled\n /\\ avx_enabled /\\ sse_enabled) /\\ (alg = AES_128 \\/ alg = AES_256) /\\\n Vale.X64.Decls.buffers_disjoint128 input_key_b output_key_expansion_b /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) key_ptr input_key_b (if (alg = AES_128) then\n 1 else 2) (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem\n va_s0) key_expansion_ptr output_key_expansion_b (Vale.AES.AES_common_s.nr alg + 1)\n (va_get_mem_layout va_s0) Secret))", "val va_req_KeyExpansionStdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (input_key_b output_key_expansion_b: buffer128)\n : prop\nlet va_req_KeyExpansionStdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm)\n (input_key_b:buffer128) (output_key_expansion_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_KeyExpansionStdcall alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (in_key1:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read input_key_b 0 (va_get_mem va_s0)) in let\n (in_key2:Vale.Def.Types_s.quad32) = Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read input_key_b 1 (va_get_mem va_s0)) in let\n (key:(FStar.Seq.Base.seq Vale.Def.Types_s.nat32)) = (if (alg = AES_128) then\n Vale.AES.AES256_helpers_BE.be_quad32_to_seq in_key1 else\n Vale.AES.AES256_helpers_BE.make_AES256_key in_key1 in_key2) in\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (alg =\n AES_128 \\/ alg = AES_256) /\\ Vale.PPC64LE.Decls.buffers_disjoint128 input_key_b\n output_key_expansion_b /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 4\n va_s0) input_key_b (if (alg = AES_128) then 1 else 2) (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) (va_get_reg 3 va_s0)\n output_key_expansion_b (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0) Secret))", "val va_wp_Ghash_extra_bytes\n (hkeys_b: buffer128)\n (total_bytes: nat)\n (old_hash h_LE: quad32)\n (completed_quads: (seq quad32))\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Ghash_extra_bytes (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (h_LE:quad32)\n (completed_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (pclmulqdq_enabled /\\ avx_enabled /\\ sse_enabled /\\ va_get_xmm 9 va_s0 ==\n Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 202182159 134810123 67438087 66051 /\\\n va_get_xmm 8 va_s0 == Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.GHash.ghash_incremental0\n h_LE old_hash completed_quads) /\\ Vale.AES.GHash.hkeys_reqs_priv (Vale.X64.Decls.s128\n (va_get_mem_heaplet 0 va_s0) hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 h_LE) /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg64 rR9 va_s0 - 32)\n hkeys_b 8 (va_get_mem_layout va_s0) Secret /\\ FStar.Seq.Base.length #quad32 completed_quads ==\n total_bytes `op_Division` 16 /\\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32\n completed_quads + 16 /\\ va_get_reg64 rR10 va_s0 == total_bytes `op_Modulus` 16 /\\ total_bytes\n `op_Modulus` 16 =!= 0 /\\ (0 < total_bytes /\\ total_bytes < 16 `op_Multiply`\n Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes) /\\ 16 `op_Multiply`\n (Vale.AES.GCM_helpers.bytes_to_quad_size total_bytes - 1) < total_bytes) /\\ (forall\n (va_x_rcx:nat64) (va_x_r11:nat64) (va_x_xmm0:quad32) (va_x_xmm1:quad32) (va_x_xmm2:quad32)\n (va_x_xmm3:quad32) (va_x_xmm4:quad32) (va_x_xmm5:quad32) (va_x_xmm6:quad32) (va_x_xmm7:quad32)\n (va_x_xmm8:quad32) (va_x_efl:Vale.X64.Flags.t) . let va_sM = va_upd_flags va_x_efl (va_upd_xmm\n 8 va_x_xmm8 (va_upd_xmm 7 va_x_xmm7 (va_upd_xmm 6 va_x_xmm6 (va_upd_xmm 5 va_x_xmm5 (va_upd_xmm\n 4 va_x_xmm4 (va_upd_xmm 3 va_x_xmm3 (va_upd_xmm 2 va_x_xmm2 (va_upd_xmm 1 va_x_xmm1 (va_upd_xmm\n 0 va_x_xmm0 (va_upd_reg64 rR11 va_x_r11 (va_upd_reg64 rRcx va_x_rcx va_s0))))))))))) in\n va_get_ok va_sM /\\ (let raw_quads = FStar.Seq.Base.append #quad32 completed_quads\n (FStar.Seq.Base.create #quad32 1 (va_get_xmm 0 va_s0)) in let input_bytes =\n FStar.Seq.Base.slice #Vale.Def.Types_s.nat8 (Vale.Def.Types_s.le_seq_quad32_to_bytes raw_quads)\n 0 total_bytes in let padded_bytes = Vale.AES.GCTR_s.pad_to_128_bits input_bytes in let\n input_quads = Vale.Def.Types_s.le_bytes_to_seq_quad32 padded_bytes in total_bytes > 0 ==> l_and\n (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0)\n (Vale.Def.Types_s.reverse_bytes_quad32 (va_get_xmm 8 va_sM) == Vale.AES.GHash.ghash_incremental\n h_LE old_hash input_quads)) ==> va_k va_sM (())))", "val va_req_Gcm_blocks_decrypt_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_BE)\n (hkeys_b abytes_b in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (cipher_num: nat64)\n (gcm_struct_b: buffer64)\n (tag_b: buffer128)\n (key: (seq nat32))\n : prop\nlet va_req_Gcm_blocks_decrypt_stdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_BE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128_b:buffer128)\n (out128_b:buffer128) (len128_num:nat64) (inout_b:buffer128) (cipher_num:nat64)\n (gcm_struct_b:buffer64) (tag_b:buffer128) (key:(seq nat32)) : prop =\n (va_require_total va_b0 (va_code_Gcm_blocks_decrypt_stdcall alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (abytes_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 0\n (va_get_mem_heaplet 3 va_s0) in let (in128_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 1 (va_get_mem_heaplet 3 va_s0) in let\n (out128_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 2\n (va_get_mem_heaplet 3 va_s0) in let (len128:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 3 (va_get_mem_heaplet 3 va_s0) in let\n (inout_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 4\n (va_get_mem_heaplet 3 va_s0) in let (cipher_num_bytes:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 5 (va_get_mem_heaplet 3 va_s0) in let\n (auth_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 6\n (va_get_mem_heaplet 3 va_s0) in let (auth_len:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 7 (va_get_mem_heaplet 3 va_s0) in let\n (auth_num_bytes:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 8\n (va_get_mem_heaplet 3 va_s0) in let (iv_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 9 (va_get_mem_heaplet 3 va_s0) in let\n (keys_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 10\n (va_get_mem_heaplet 3 va_s0) in let (h_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 11 (va_get_mem_heaplet 3 va_s0) in let\n (tag_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 12\n (va_get_mem_heaplet 3 va_s0) in va_get_reg 1 va_s0 == Vale.PPC64LE.Stack_i.init_r1\n (va_get_stack va_s0) /\\ Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0)\n (va_get_mem va_s0) /\\ auth_len == auth_num /\\ auth_num_bytes == auth_bytes /\\ len128 ==\n len128_num /\\ cipher_num_bytes == cipher_num /\\ Vale.PPC64LE.Decls.validSrcAddrs64 (va_get_mem\n va_s0) (va_get_reg 3 va_s0) gcm_struct_b 13 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) auth_ptr auth_b auth_len\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128\n (va_get_mem va_s0) iv_ptr iv_b 1 (va_get_mem_layout va_s0) Public /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) in128_ptr in128_b len128\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0)\n out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) inout_ptr inout_b 1 (va_get_mem_layout\n va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) h_ptr hkeys_b 3\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n tag_ptr tag_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.buffer_disjoints64_128\n gcm_struct_b ([keys_b; auth_b; abytes_b; iv_b; in128_b; out128_b; inout_b; hkeys_b; tag_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 tag_b ([keys_b; auth_b; abytes_b; iv_b; in128_b;\n out128_b; inout_b; hkeys_b]) /\\ Vale.PPC64LE.Decls.buffer_disjoints128 iv_b ([keys_b; auth_b;\n abytes_b; in128_b; out128_b; inout_b; hkeys_b]) /\\ Vale.PPC64LE.Decls.buffer_disjoints128\n inout_b ([keys_b; auth_b; abytes_b; in128_b; out128_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 auth_b ([keys_b; abytes_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 abytes_b ([keys_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 out128_b ([keys_b; auth_b; abytes_b; hkeys_b; inout_b])\n /\\ Vale.PPC64LE.Decls.buffer_disjoints128 in128_b ([keys_b; auth_b; abytes_b; hkeys_b;\n inout_b]) /\\ (Vale.PPC64LE.Decls.buffers_disjoint128 in128_b out128_b \\/ in128_b == out128_b)\n /\\ auth_ptr + 16 `op_Multiply` auth_len < pow2_64 /\\ in128_ptr + 16 `op_Multiply` len128 <\n pow2_64 /\\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\\ inout_ptr + 16 < pow2_64 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 auth_b == auth_len /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 abytes_b == 1 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in128_b ==\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out128_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in128_b == len128 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 inout_b == 1 /\\ cipher_num_bytes\n < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ Vale.PPC64LE.Memory.buffer_addr\n #Vale.PPC64LE.Memory.vuint128 keys_b (va_get_mem va_s0) + 128 < pow2_64 /\\ (va_mul_nat len128\n (128 `op_Division` 8) <= cipher_num_bytes /\\ cipher_num_bytes < va_mul_nat len128 (128\n `op_Division` 8) + 128 `op_Division` 8) /\\ (va_mul_nat auth_len (128 `op_Division` 8) <=\n auth_num_bytes /\\ auth_num_bytes < va_mul_nat auth_len (128 `op_Division` 8) + 128\n `op_Division` 8) /\\ aes_reqs alg key (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem va_s0) keys_b)) keys_b keys_ptr (va_get_mem\n va_s0) (va_get_mem_layout va_s0) /\\ Vale.AES.OptPublic_BE.hkeys_reqs_pub\n (Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) hkeys_b))\n (Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0\n 0 0 0)) /\\ (let h_BE = Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.Def.Words_s.Mkfour\n #Vale.Def.Types_s.nat32 0 0 0 0) in let iv_BE = Vale.Def.Types_s.reverse_bytes_quad32\n (Vale.PPC64LE.Decls.buffer128_read iv_b 0 (va_get_mem va_s0)) in iv_BE ==\n Vale.AES.GCM_BE_s.compute_iv_BE h_BE iv)))", "val va_req_Fast_add1 (va_b0: va_code) (va_s0: va_state) (dst_b inA_b: buffer64) (inB: nat64) : prop\nlet va_req_Fast_add1 (va_b0:va_code) (va_s0:va_state) (dst_b:buffer64) (inA_b:buffer64) (inB:nat64)\n : prop =\n (va_require_total va_b0 (va_code_Fast_add1 ()) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (a0:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 0 (va_get_mem va_s0) in let\n (a1:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 1 (va_get_mem va_s0) in let\n (a2:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 2 (va_get_mem va_s0) in let\n (a3:Vale.Def.Types_s.nat64) = Vale.X64.Decls.buffer64_read inA_b 3 (va_get_mem va_s0) in let\n (a:Prims.nat) = Vale.Curve25519.Fast_defs.pow2_four a0 a1 a2 a3 in adx_enabled /\\ bmi2_enabled\n /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ inA_b == dst_b) /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) (va_get_reg64 rRdi va_s0) dst_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0)\n (va_get_reg64 rRsi va_s0) inA_b 4 (va_get_mem_layout va_s0) Secret /\\ inB == va_get_reg64 rRdx\n va_s0))", "val va_wp_Ghash_extra_bytes\n (hkeys_b: buffer128)\n (total_bytes: nat)\n (old_hash h_BE: quad32)\n (completed_quads: (seq quad32))\n (va_s0: va_state)\n (va_k: (va_state -> unit -> Type0))\n : Type0\nlet va_wp_Ghash_extra_bytes (hkeys_b:buffer128) (total_bytes:nat) (old_hash:quad32) (h_BE:quad32)\n (completed_quads:(seq quad32)) (va_s0:va_state) (va_k:(va_state -> unit -> Type0)) : Type0 =\n (va_get_ok va_s0 /\\ (va_get_vec 1 va_s0 == Vale.AES.GHash_BE.ghash_incremental0 h_BE old_hash\n completed_quads /\\ Vale.AES.GHash_BE.hkeys_reqs_priv (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem_heaplet 0 va_s0) hkeys_b)) h_BE /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0) (va_get_reg 5 va_s0) hkeys_b 3\n (va_get_mem_layout va_s0) Secret /\\ FStar.Seq.Base.length #quad32 completed_quads ==\n total_bytes `op_Division` 16 /\\ total_bytes < 16 `op_Multiply` FStar.Seq.Base.length #quad32\n completed_quads + 16 /\\ va_get_reg 8 va_s0 == total_bytes `op_Modulus` 16 /\\ total_bytes\n `op_Modulus` 16 =!= 0 /\\ (0 < total_bytes /\\ total_bytes < 16 `op_Multiply`\n Vale.AES.GCM_helpers_BE.bytes_to_quad_size total_bytes) /\\ 16 `op_Multiply`\n (Vale.AES.GCM_helpers_BE.bytes_to_quad_size total_bytes - 1) < total_bytes) /\\ (forall\n (va_x_r7:nat64) (va_x_r10:nat64) (va_x_v0:quad32) (va_x_v1:quad32) (va_x_v2:quad32)\n (va_x_v3:quad32) (va_x_v4:quad32) (va_x_v5:quad32) (va_x_v6:quad32) (va_x_v7:quad32)\n (va_x_v8:quad32) (va_x_v9:quad32) (va_x_v10:quad32) (va_x_cr0:cr0_t) . let va_sM = va_upd_cr0\n va_x_cr0 (va_upd_vec 10 va_x_v10 (va_upd_vec 9 va_x_v9 (va_upd_vec 8 va_x_v8 (va_upd_vec 7\n va_x_v7 (va_upd_vec 6 va_x_v6 (va_upd_vec 5 va_x_v5 (va_upd_vec 4 va_x_v4 (va_upd_vec 3 va_x_v3\n (va_upd_vec 2 va_x_v2 (va_upd_vec 1 va_x_v1 (va_upd_vec 0 va_x_v0 (va_upd_reg 10 va_x_r10\n (va_upd_reg 7 va_x_r7 va_s0))))))))))))) in va_get_ok va_sM /\\ (let raw_quads =\n FStar.Seq.Base.append #quad32 completed_quads (FStar.Seq.Base.create #quad32 1 (va_get_vec 9\n va_s0)) in let input_bytes = FStar.Seq.Base.slice #Vale.Def.Words_s.nat8\n (Vale.Def.Words.Seq_s.seq_nat32_to_seq_nat8_BE (Vale.Def.Words.Seq_s.seq_four_to_seq_BE\n #Vale.Def.Words_s.nat32 raw_quads)) 0 total_bytes in let padded_bytes =\n Vale.AES.GCTR_BE_s.pad_to_128_bits input_bytes in let input_quads =\n Vale.Def.Types_s.be_bytes_to_seq_quad32 padded_bytes in total_bytes > 0 ==> l_and\n (FStar.Seq.Base.length #Vale.Def.Types_s.quad32 input_quads > 0) (va_get_vec 1 va_sM ==\n Vale.AES.GHash_BE.ghash_incremental h_BE old_hash input_quads)) ==> va_k va_sM (())))", "val va_req_Gcm_blocks_decrypt_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (win: bool)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_LE)\n (hkeys_b abytes_b in128x6_b out128x6_b: buffer128)\n (len128x6_num: nat64)\n (in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (cipher_num: nat64)\n (scratch_b tag_b: buffer128)\n (key: (seq nat32))\n : prop\nlet va_req_Gcm_blocks_decrypt_stdcall (va_b0:va_code) (va_s0:va_state) (win:bool) (alg:algorithm)\n (auth_b:buffer128) (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128)\n (iv:supported_iv_LE) (hkeys_b:buffer128) (abytes_b:buffer128) (in128x6_b:buffer128)\n (out128x6_b:buffer128) (len128x6_num:nat64) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (cipher_num:nat64) (scratch_b:buffer128) (tag_b:buffer128)\n (key:(seq nat32)) : prop =\n (va_require_total va_b0 (va_code_Gcm_blocks_decrypt_stdcall win alg) va_s0 /\\ va_get_ok va_s0 /\\\n (let (auth_ptr:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rRcx va_s0\n else va_get_reg64 rRdi va_s0) in let (auth_num_bytes:(va_int_range 0 18446744073709551615)) =\n (if win then va_get_reg64 rRdx va_s0 else va_get_reg64 rRsi va_s0) in let\n (auth_len:(va_int_range 0 18446744073709551615)) = (if win then va_get_reg64 rR8 va_s0 else\n va_get_reg64 rRdx va_s0) in let (keys_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n va_get_reg64 rR9 va_s0 else va_get_reg64 rRcx va_s0) in let (iv_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 0) (va_get_stack va_s0) else va_get_reg64 rR8 va_s0) in let (xip:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 32 + 8 + 8) (va_get_stack va_s0) else va_get_reg64 rR9 va_s0) in let (abytes_ptr:(va_int_range\n 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0\n + 40 + 16) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8\n + 0) (va_get_stack va_s0)) in let (in128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0)) in\n let (out128x6_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack va_s0)) in let\n (len128x6:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack va_s0)) in let (in128_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 48) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 32) (va_get_stack va_s0)) in let (out128_ptr:(va_int_range 0 18446744073709551615)) = (if win\n then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack va_s0)) in\n let (len128:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack va_s0)) in let (inout_ptr:(va_int_range 0\n 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 +\n 40 + 72) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 +\n 56) (va_get_stack va_s0)) in let (cipher_num_bytes:(va_int_range 0 18446744073709551615)) = (if\n win then Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack va_s0)\n else Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack va_s0)) in\n let (scratch_ptr:(va_int_range 0 18446744073709551615)) = (if win then\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack va_s0) else\n Vale.X64.Stack_i.load_stack64 (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack va_s0)) in let\n (tag_ptr:(va_int_range 0 18446744073709551615)) = (if win then Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack va_s0) else Vale.X64.Stack_i.load_stack64\n (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack va_s0)) in sse_enabled /\\ movbe_enabled /\\\n va_get_reg64 rRsp va_s0 == Vale.X64.Stack_i.init_rsp (va_get_stack va_s0) /\\\n Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ (~win ==>\n Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 0) (va_get_stack va_s0)\n Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 8) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 16) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 24) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 32) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 40) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 48) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 56) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 64) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (~win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 8 + 72) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (~win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 8 + 80) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 0) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 8) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 16) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 24) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 32) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 40) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 48) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 56) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 64) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 72) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 80) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n (win ==> Vale.X64.Stack_i.valid_stack_slot64 (va_get_reg64 rRsp va_s0 + 40 + 88) (va_get_stack\n va_s0) Public (va_get_stackTaint va_s0)) /\\ (win ==> Vale.X64.Stack_i.valid_stack_slot64\n (va_get_reg64 rRsp va_s0 + 40 + 96) (va_get_stack va_s0) Public (va_get_stackTaint va_s0)) /\\\n auth_len == auth_num /\\ auth_num_bytes == auth_bytes /\\ len128x6 == len128x6_num /\\ len128 ==\n len128_num /\\ cipher_num_bytes == cipher_num /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem\n va_s0) auth_ptr auth_b auth_len (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) abytes_ptr abytes_b 1 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) iv_ptr iv_b 1\n (va_get_mem_layout va_s0) Public /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0)\n in128x6_ptr in128x6_b len128x6 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) out128x6_ptr out128x6_b len128x6\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0)\n in128_ptr in128_b len128 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128\n (va_get_mem va_s0) out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\\\n Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) inout_ptr inout_b 1 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem va_s0) scratch_ptr scratch_b 9\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem va_s0) xip\n hkeys_b 8 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs128 (va_get_mem\n va_s0) tag_ptr tag_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.buffer_disjoints128\n tag_b ([auth_b; abytes_b; iv_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b; scratch_b])\n /\\ Vale.X64.Decls.buffer_disjoints128 iv_b ([keys_b; auth_b; abytes_b; in128x6_b; out128x6_b;\n in128_b; out128_b; inout_b; scratch_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128\n scratch_b ([keys_b; auth_b; abytes_b; in128x6_b; out128x6_b; in128_b; out128_b; inout_b;\n hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 inout_b ([keys_b; auth_b; abytes_b; in128x6_b;\n out128x6_b; in128_b; out128_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 auth_b ([keys_b;\n abytes_b; hkeys_b]) /\\ Vale.X64.Decls.buffer_disjoints128 abytes_b ([keys_b; hkeys_b]) /\\\n Vale.X64.Decls.buffer_disjoints128 out128x6_b ([keys_b; auth_b; abytes_b; hkeys_b; in128_b;\n inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 in128x6_b ([keys_b; auth_b; abytes_b; hkeys_b;\n in128_b; inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 out128_b ([keys_b; auth_b; abytes_b;\n hkeys_b; in128x6_b; out128x6_b; inout_b]) /\\ Vale.X64.Decls.buffer_disjoints128 in128_b\n ([keys_b; auth_b; abytes_b; hkeys_b; in128x6_b; out128x6_b; inout_b]) /\\\n (Vale.X64.Decls.buffers_disjoint128 in128x6_b out128x6_b \\/ in128x6_b == out128x6_b) /\\\n (Vale.X64.Decls.buffers_disjoint128 in128_b out128_b \\/ in128_b == out128_b) /\\ auth_ptr + 16\n `op_Multiply` auth_len < pow2_64 /\\ in128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\\\n out128x6_ptr + 16 `op_Multiply` len128x6 < pow2_64 /\\ in128_ptr + 16 `op_Multiply` len128 <\n pow2_64 /\\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\\ inout_ptr + 16 < pow2_64 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 auth_b == auth_len /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 abytes_b == 1 /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128x6_b ==\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 out128x6_b /\\\n Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b == Vale.X64.Decls.buffer_length\n #Vale.X64.Memory.vuint128 out128_b /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128\n in128x6_b == len128x6 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 in128_b ==\n len128 /\\ Vale.X64.Decls.buffer_length #Vale.X64.Memory.vuint128 inout_b == 1 /\\\n cipher_num_bytes < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ xip + 32 < pow2_64 /\\\n Vale.X64.Memory.buffer_addr #Vale.X64.Memory.vuint128 keys_b (va_get_mem va_s0) + 128 < pow2_64\n /\\ len128x6 `op_Modulus` 6 == 0 /\\ (len128x6 > 0 ==> len128x6 >= 6) /\\ 12 + len128x6 + 6 <\n pow2_32 /\\ (va_mul_nat len128x6 (128 `op_Division` 8) + va_mul_nat len128 (128 `op_Division` 8)\n <= cipher_num_bytes /\\ cipher_num_bytes < va_mul_nat len128x6 (128 `op_Division` 8) +\n va_mul_nat len128 (128 `op_Division` 8) + 128 `op_Division` 8) /\\ (va_mul_nat auth_len (128\n `op_Division` 8) <= auth_num_bytes /\\ auth_num_bytes < va_mul_nat auth_len (128 `op_Division`\n 8) + 128 `op_Division` 8) /\\ aes_reqs alg key (Vale.X64.Decls.buffer128_as_seq (va_get_mem\n va_s0) keys_b) keys_b keys_ptr (va_get_mem va_s0) (va_get_mem_layout va_s0) /\\\n pclmulqdq_enabled /\\ Vale.AES.OptPublic.hkeys_reqs_pub (Vale.X64.Decls.s128 (va_get_mem va_s0)\n hkeys_b) (Vale.Def.Types_s.reverse_bytes_quad32 (Vale.AES.AES_s.aes_encrypt_LE alg key\n (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0))) /\\ (let h_LE =\n Vale.AES.AES_s.aes_encrypt_LE alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)\n in let iv_BE = Vale.X64.Decls.buffer128_read iv_b 0 (va_get_mem va_s0) in iv_BE ==\n Vale.AES.GCM_s.compute_iv_BE h_LE iv)))", "val va_req_Gcm_blocks_stdcall\n (va_b0: va_code)\n (va_s0: va_state)\n (alg: algorithm)\n (auth_b: buffer128)\n (auth_bytes auth_num: nat64)\n (keys_b iv_b: buffer128)\n (iv: supported_iv_BE)\n (hkeys_b abytes_b in128_b out128_b: buffer128)\n (len128_num: nat64)\n (inout_b: buffer128)\n (plain_num: nat64)\n (gcm_struct_b: buffer64)\n (tag_b: buffer128)\n (key: (seq nat32))\n : prop\nlet va_req_Gcm_blocks_stdcall (va_b0:va_code) (va_s0:va_state) (alg:algorithm) (auth_b:buffer128)\n (auth_bytes:nat64) (auth_num:nat64) (keys_b:buffer128) (iv_b:buffer128) (iv:supported_iv_BE)\n (hkeys_b:buffer128) (abytes_b:buffer128) (in128_b:buffer128) (out128_b:buffer128)\n (len128_num:nat64) (inout_b:buffer128) (plain_num:nat64) (gcm_struct_b:buffer64)\n (tag_b:buffer128) (key:(seq nat32)) : prop =\n (va_require_total va_b0 (va_code_Gcm_blocks_stdcall alg) va_s0 /\\ va_get_ok va_s0 /\\ (let\n (abytes_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 0\n (va_get_mem_heaplet 3 va_s0) in let (in128_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 1 (va_get_mem_heaplet 3 va_s0) in let\n (out128_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 2\n (va_get_mem_heaplet 3 va_s0) in let (len128:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 3 (va_get_mem_heaplet 3 va_s0) in let\n (inout_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 4\n (va_get_mem_heaplet 3 va_s0) in let (plain_num_bytes:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 5 (va_get_mem_heaplet 3 va_s0) in let\n (auth_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 6\n (va_get_mem_heaplet 3 va_s0) in let (auth_len:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 7 (va_get_mem_heaplet 3 va_s0) in let\n (auth_num_bytes:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 8\n (va_get_mem_heaplet 3 va_s0) in let (iv_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 9 (va_get_mem_heaplet 3 va_s0) in let\n (keys_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 10\n (va_get_mem_heaplet 3 va_s0) in let (h_ptr:Vale.PPC64LE.Machine_s.nat64) =\n Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 11 (va_get_mem_heaplet 3 va_s0) in let\n (tag_ptr:Vale.PPC64LE.Machine_s.nat64) = Vale.PPC64LE.Decls.buffer64_read gcm_struct_b 12\n (va_get_mem_heaplet 3 va_s0) in va_get_reg 1 va_s0 == Vale.PPC64LE.Stack_i.init_r1\n (va_get_stack va_s0) /\\ Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0)\n (va_get_mem va_s0) /\\ auth_len == auth_num /\\ auth_num_bytes == auth_bytes /\\ len128 ==\n len128_num /\\ plain_num_bytes == plain_num /\\ Vale.PPC64LE.Decls.validSrcAddrs64 (va_get_mem\n va_s0) (va_get_reg 3 va_s0) gcm_struct_b 13 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) auth_ptr auth_b auth_len\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n abytes_ptr abytes_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128\n (va_get_mem va_s0) iv_ptr iv_b 1 (va_get_mem_layout va_s0) Public /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) in128_ptr in128_b len128\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0)\n out128_ptr out128_b len128 (va_get_mem_layout va_s0) Secret /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) inout_ptr inout_b 1 (va_get_mem_layout\n va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) h_ptr hkeys_b 3\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0)\n tag_ptr tag_b 1 (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.buffer_disjoints64_128\n gcm_struct_b ([keys_b; auth_b; abytes_b; iv_b; in128_b; out128_b; inout_b; hkeys_b; tag_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 tag_b ([keys_b; auth_b; abytes_b; iv_b; in128_b;\n out128_b; inout_b; hkeys_b]) /\\ Vale.PPC64LE.Decls.buffer_disjoints128 iv_b ([keys_b; auth_b;\n abytes_b; in128_b; out128_b; inout_b; hkeys_b]) /\\ Vale.PPC64LE.Decls.buffer_disjoints128\n inout_b ([keys_b; auth_b; abytes_b; in128_b; out128_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 auth_b ([keys_b; abytes_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 abytes_b ([keys_b; hkeys_b]) /\\\n Vale.PPC64LE.Decls.buffer_disjoints128 out128_b ([keys_b; auth_b; abytes_b; hkeys_b; inout_b])\n /\\ Vale.PPC64LE.Decls.buffer_disjoints128 in128_b ([keys_b; auth_b; abytes_b; hkeys_b;\n inout_b]) /\\ (Vale.PPC64LE.Decls.buffers_disjoint128 in128_b out128_b \\/ in128_b == out128_b)\n /\\ auth_ptr + 16 `op_Multiply` auth_len < pow2_64 /\\ in128_ptr + 16 `op_Multiply` len128 <\n pow2_64 /\\ out128_ptr + 16 `op_Multiply` len128 < pow2_64 /\\ inout_ptr + 16 < pow2_64 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 auth_b == auth_len /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 abytes_b == 1 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in128_b ==\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 out128_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in128_b == len128 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 inout_b == 1 /\\ plain_num_bytes\n < pow2_32 /\\ auth_num_bytes < pow2_32 /\\ Vale.PPC64LE.Memory.buffer_addr\n #Vale.PPC64LE.Memory.vuint128 keys_b (va_get_mem va_s0) + 128 < pow2_64 /\\ (va_mul_nat len128\n (128 `op_Division` 8) <= plain_num_bytes /\\ plain_num_bytes < va_mul_nat len128 (128\n `op_Division` 8) + 128 `op_Division` 8) /\\ (va_mul_nat auth_len (128 `op_Division` 8) <=\n auth_num_bytes /\\ auth_num_bytes < va_mul_nat auth_len (128 `op_Division` 8) + 128\n `op_Division` 8) /\\ (alg = AES_128 \\/ alg = AES_256) /\\ Vale.AES.AES_BE_s.is_aes_key_word alg\n key /\\ Vale.Arch.Types.reverse_bytes_quad32_seq (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_s0) keys_b) == Vale.AES.AES_BE_s.key_to_round_keys_word alg key /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) keys_ptr keys_b\n (Vale.AES.AES_common_s.nr alg + 1) (va_get_mem_layout va_s0) Secret /\\\n Vale.AES.OptPublic_BE.hkeys_reqs_pub (Vale.Arch.Types.reverse_bytes_quad32_seq\n (Vale.PPC64LE.Decls.s128 (va_get_mem va_s0) hkeys_b)) (Vale.AES.AES_BE_s.aes_encrypt_word alg\n key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0 0 0)) /\\ (let h_BE =\n Vale.AES.AES_BE_s.aes_encrypt_word alg key (Vale.Def.Words_s.Mkfour #Vale.Def.Types_s.nat32 0 0\n 0 0) in let iv_BE = Vale.Def.Types_s.reverse_bytes_quad32 (Vale.PPC64LE.Decls.buffer128_read\n iv_b 0 (va_get_mem va_s0)) in iv_BE == Vale.AES.GCM_BE_s.compute_iv_BE h_BE iv)))", "val va_req_Fmul (va_b0: va_code) (va_s0: va_state) (tmp_b inA_b dst_b inB_b: buffer64) : prop\nlet va_req_Fmul (va_b0:va_code) (va_s0:va_state) (tmp_b:buffer64) (inA_b:buffer64) (dst_b:buffer64)\n (inB_b:buffer64) : prop =\n (va_require_total va_b0 (va_code_Fmul ()) va_s0 /\\ va_get_ok va_s0 /\\ (let (tmp_in:nat64) =\n va_get_reg64 rRdi va_s0 in let (inA_in:nat64) = va_get_reg64 rRsi va_s0 in let (dst_in:nat64) =\n va_get_reg64 rR15 va_s0 in let (inB_in:nat64) = va_get_reg64 rRcx va_s0 in adx_enabled /\\\n bmi2_enabled /\\ Vale.X64.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inA_b \\/ dst_b == inA_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b inB_b \\/ dst_b == inB_b) /\\\n (Vale.X64.Decls.buffers_disjoint dst_b tmp_b \\/ dst_b == tmp_b) /\\\n Vale.X64.Decls.buffers_disjoint tmp_b inA_b /\\ Vale.X64.Decls.buffers_disjoint tmp_b inB_b /\\\n Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) dst_in dst_b 4 (va_get_mem_layout va_s0)\n Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inA_in inA_b 4 (va_get_mem_layout\n va_s0) Secret /\\ Vale.X64.Decls.validSrcAddrs64 (va_get_mem va_s0) inB_in inB_b 4\n (va_get_mem_layout va_s0) Secret /\\ Vale.X64.Decls.validDstAddrs64 (va_get_mem va_s0) tmp_in\n tmp_b 8 (va_get_mem_layout va_s0) Secret))", "val va_code_Sha_update_bytes_main : va_dummy:unit -> Tot va_code\nlet va_code_Sha_update_bytes_main () =\n (va_Block (va_CCons (va_code_CreateHeaplets ()) (va_CCons (va_code_Alloc_stack (16 `op_Multiply`\n 11)) (va_CCons (va_code_Store_stack128 (va_op_vec_opr_vec 20) (16 `op_Multiply` 0)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 21) (16 `op_Multiply` 1)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 22) (16 `op_Multiply` 2)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 23) (16 `op_Multiply` 3)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 24) (16 `op_Multiply` 4)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 25) (16 `op_Multiply` 5)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 26) (16 `op_Multiply` 6)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 28) (16 `op_Multiply` 7)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 29) (16 `op_Multiply` 8)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 30) (16 `op_Multiply` 9)) (va_CCons\n (va_code_Store_stack128 (va_op_vec_opr_vec 31) (16 `op_Multiply` 10)) (va_CCons\n (va_code_Sha_update_bytes ()) (va_CCons (va_code_Load_stack128 (va_op_vec_opr_vec 20) (16\n `op_Multiply` 0)) (va_CCons (va_code_Load_stack128 (va_op_vec_opr_vec 21) (16 `op_Multiply` 1))\n (va_CCons (va_code_Load_stack128 (va_op_vec_opr_vec 22) (16 `op_Multiply` 2)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 23) (16 `op_Multiply` 3)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 24) (16 `op_Multiply` 4)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 25) (16 `op_Multiply` 5)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 26) (16 `op_Multiply` 6)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 28) (16 `op_Multiply` 7)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 29) (16 `op_Multiply` 8)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 30) (16 `op_Multiply` 9)) (va_CCons\n (va_code_Load_stack128 (va_op_vec_opr_vec 31) (16 `op_Multiply` 10)) (va_CCons\n (va_code_Dealloc_stack (16 `op_Multiply` 11)) (va_CCons (va_code_DestroyHeaplets ()) (va_CNil\n ())))))))))))))))))))))))))))))" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fsti", "name": "Vale.SHA.X64.va_ens_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fsti", "name": "Vale.SHA.X64.va_req_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_qcode_Sha_update_bytes_main" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fmul1" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.X64.fsti", "name": "Vale.Poly1305.X64.va_ens_Poly1305" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_wp_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_wp_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_wpProof_Sha_update_bytes_main" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fmul" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fsqr" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_ens_Fast_add1" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fsub" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCTR.fsti", "name": "Vale.AES.X64.GCTR.va_ens_Gctr_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fadd" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_ens_Cswap2" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fsqr2" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fmul2" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Args.fsti", "name": "Vale.Test.X64.Args.va_ens_Test" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Vale_memcpy.fsti", "name": "Vale.Test.X64.Vale_memcpy.va_ens_Memcpy" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GF128_Init.fsti", "name": "Vale.AES.X64.GF128_Init.va_ens_Keyhash_init" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GF128_Init.fsti", "name": "Vale.AES.PPC64LE.GF128_Init.va_ens_Keyhash_init" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fmul1_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_sha_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_lemma_Sha_update_bytes_main" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fsub_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fsqr2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_ens_Fast_add1_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fsqr_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx_xcr0_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_wp_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_wp_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_quick_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_quick_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fmul2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx512_xcr0_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_ens_Fadd_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx512_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMencrypt.fsti", "name": "Vale.AES.PPC64LE.GCMencrypt.va_ens_Compute_iv_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_ens_Fmul_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fsti", "name": "Vale.SHA.X64.va_wp_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_wpProof_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_wpProof_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fsti", "name": "Vale.AES.X64.GCMencryptOpt.va_ens_Compute_iv_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_ens_Cswap2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_avx_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_qcode_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fsti", "name": "Vale.SHA.X64.va_quick_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_sse_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_lemma_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AES.fsti", "name": "Vale.AES.X64.AES.va_ens_KeyExpansionStdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_qcode_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_qcode_Sha_update_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.AES.fsti", "name": "Vale.AES.PPC64LE.AES.va_ens_KeyExpansionStdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_aesni_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fsti", "name": "Vale.AES.X64.GCMencryptOpt.va_ens_Gcm_blocks_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_wpProof_Sha_update_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_wpProof_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_rdrand_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_wpProof_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMdecryptOpt.fsti", "name": "Vale.AES.X64.GCMdecryptOpt.va_ens_Gcm_blocks_decrypt_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_movbe_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.X64.Cpuidstdcall.fsti", "name": "Vale.Lib.X64.Cpuidstdcall.va_ens_Check_adx_bmi2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Poly1305.X64.fsti", "name": "Vale.Poly1305.X64.va_req_Poly1305" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCTR.fsti", "name": "Vale.AES.X64.GCTR.va_req_Gctr_bytes_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMencrypt.fsti", "name": "Vale.AES.PPC64LE.GCMencrypt.va_ens_Gcm_blocks_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMencrypt.fsti", "name": "Vale.AES.PPC64LE.GCMencrypt.va_req_Compute_iv_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GF128_Init.fsti", "name": "Vale.AES.X64.GF128_Init.va_req_Keyhash_init" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GF128_Init.fsti", "name": "Vale.AES.PPC64LE.GF128_Init.va_req_Keyhash_init" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMdecrypt.fsti", "name": "Vale.AES.PPC64LE.GCMdecrypt.va_ens_Gcm_blocks_decrypt_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_lemma_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.Sha.fsti", "name": "Vale.Stdcalls.X64.Sha.sha_lemma'" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_req_Fmul1_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fsti", "name": "Vale.AES.X64.GCMencryptOpt.va_req_Compute_iv_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_req_Fsqr2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_qcode_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_qcode_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_req_Fast_add1_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_quick_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_quick_Sha_update" }, { "project_name": "hacl-star", "file_name": "Vale.Test.X64.Args.fsti", "name": "Vale.Test.X64.Args.va_req_Test" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_req_Fmul2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_req_Fmul_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_req_Fsub" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_req_Cswap2_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastHybrid.fsti", "name": "Vale.Curve25519.X64.FastHybrid.va_req_Fadd" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fsti", "name": "Vale.AES.X64.GCMencryptOpt.va_req_Gcm_blocks_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.AES.fsti", "name": "Vale.AES.X64.AES.va_req_KeyExpansionStdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.AES.fsti", "name": "Vale.AES.PPC64LE.AES.va_req_KeyExpansionStdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMencryptOpt.fsti", "name": "Vale.AES.X64.GCMencryptOpt.va_wp_Ghash_extra_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMdecrypt.fsti", "name": "Vale.AES.PPC64LE.GCMdecrypt.va_req_Gcm_blocks_decrypt_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastUtil.fsti", "name": "Vale.Curve25519.X64.FastUtil.va_req_Fast_add1" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMencrypt.fsti", "name": "Vale.AES.PPC64LE.GCMencrypt.va_wp_Ghash_extra_bytes" }, { "project_name": "hacl-star", "file_name": "Vale.AES.X64.GCMdecryptOpt.fsti", "name": "Vale.AES.X64.GCMdecryptOpt.va_req_Gcm_blocks_decrypt_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.AES.PPC64LE.GCMencrypt.fsti", "name": "Vale.AES.PPC64LE.GCMencrypt.va_req_Gcm_blocks_stdcall" }, { "project_name": "hacl-star", "file_name": "Vale.Curve25519.X64.FastWide.fsti", "name": "Vale.Curve25519.X64.FastWide.va_req_Fmul" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.fst", "name": "Vale.SHA.PPC64LE.va_code_Sha_update_bytes_main" } ], "selected_premises": [ "Vale.PPC64LE.Decls.va_expand_state", "Vale.PPC64LE.Decls.va_get_ok", "Vale.PPC64LE.Decls.va_get_reg", "Vale.PPC64LE.Decls.va_get_mem_layout", "Vale.X64.Machine_s.rRdi", "Vale.X64.Machine_s.reg_64", "Vale.PPC64LE.Decls.va_upd_reg", "Vale.X64.Machine_s.rRsp", "Vale.PPC64LE.Decls.va_get_mem_heaplet", "Vale.PPC64LE.QuickCodes.va_range1", "Vale.PPC64LE.Decls.va_state", "Vale.PPC64LE.Decls.va_is_dst_reg_opr", "Vale.PPC64LE.Decls.va_reveal_opaque", "Vale.PPC64LE.QuickCodes.label", "Vale.PPC64LE.Decls.va_upd_cr0", "Vale.PPC64LE.Decls.va_eval_reg_opr", "Vale.PPC64LE.QuickCode.va_Mod_ok", "Vale.PPC64LE.Decls.va_require_total", "Vale.PPC64LE.Decls.va_get_mem", "Vale.PPC64LE.Decls.va_is_dst_vec_opr", "Vale.X64.Machine_s.rRbp", "Vale.X64.Machine_s.rRsi", "Vale.X64.Machine_s.nat64", "Vale.Def.Words_s.nat64", "Vale.X64.Machine_s.rRax", "Vale.PPC64LE.Decls.va_is_src_reg_opr", "Vale.X64.Machine_s.rRdx", "Vale.PPC64LE.Machine_s.nat64", "Vale.PPC64LE.Memory.nat64", "Vale.Def.Types_s.nat64", "Vale.PPC64LE.Decls.va_eval_vec_opr", "Vale.X64.Machine_s.rR12", "Vale.X64.Machine_s.rRbx", "Vale.PPC64LE.Decls.va_upd_mem_heaplet", "Vale.PPC64LE.Decls.va_upd_ok", "Vale.X64.Machine_s.rR8", "Vale.X64.Machine_s.rRcx", "Vale.X64.Machine_s.rR10", "Vale.X64.Machine_s.rR11", "Vale.X64.Machine_s.rR9", "Vale.PPC64LE.QuickCode.va_Mod_mem_heaplet", "Vale.X64.Machine_s.rR13", "Vale.PPC64LE.Decls.from_heap_impl", "Vale.PPC64LE.Decls.va_upd_vec", "Vale.X64.Machine_s.reg_xmm", "Vale.PPC64LE.Decls.va_upd_operand_reg_opr", "Vale.PPC64LE.Decls.va_code", "Vale.PPC64LE.Decls.va_get_cr0", "Vale.PPC64LE.Decls.va_get_vec", "Vale.X64.Machine_s.rR14", "Vale.X64.Machine_s.rR15", "Vale.PPC64LE.Decls.va_is_src_vec_opr", "Vale.PPC64LE.Decls.va_op_heaplet_mem_heaplet", "Vale.PPC64LE.Decls.va_value_reg_opr", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale_64", "Vale.PPC64LE.Decls.va_if", "Vale.PPC64LE.Decls.va_upd_mem", "Vale.PPC64LE.QuickCode.va_Mod_mem_layout", "Vale.PPC64LE.State.state", "Vale.PPC64LE.Decls.va_mul_nat", "Vale.PPC64LE.QuickCode.va_Mod_mem", "Vale.PPC64LE.Decls.va_update_mem_layout", "Vale.PPC64LE.Decls.va_update_mem_heaplet", "Vale.PPC64LE.Decls.va_upd_mem_layout", "Vale.PPC64LE.InsBasic.vale_heap", "Vale.Def.Words_s.nat32", "Vale.PPC64LE.Decls.va_upd_operand_heaplet", "Vale.PPC64LE.Decls.buffer128_read", "Vale.PPC64LE.Decls.va_upd_operand_vec_opr", "Vale.SHA.PPC64LE.va_req_Sha_update_bytes_main", "Vale.PPC64LE.QuickCode.va_Mod_vec", "Vale.PPC64LE.Decls.va_get_block", "Vale.X64.Machine_s.operand128", "Vale.PPC64LE.Decls.va_value_vec_opr", "Vale.PPC64LE.Decls.state_inv", "Vale.SHA.PPC64LE.SHA_helpers.hash256", "Lib.Sequence.lseq", "Vale.PPC64LE.Decls.va_op_reg_opr_reg", "Vale.PPC64LE.Decls.validSrcAddrs128", "Vale.PPC64LE.QuickCode.va_Mod_reg", "Lib.IntTypes.int_t", "Vale.PPC64LE.Decls.va_op_vec_opr_vec", "Vale.PPC64LE.Decls.va_eval_reg", "Vale.PPC64LE.Memory.quad32", "Vale.PPC64LE.Machine_s.quad32", "Vale.X64.Machine_s.quad32", "Vale.PPC64LE.InsBasic.vale_stack", "Vale.PPC64LE.Decls.va_get_stack", "Vale.PPC64LE.Memory.get_vale_heap", "Lib.IntTypes.uint_t", "Vale.SHA.PPC64LE.SHA_helpers.k_reqs", "Vale.SHA.PPC64LE.SHA_helpers.repeat_range_vale", "Vale.PPC64LE.Memory.vuint128", "Vale.SHA.PPC64LE.SHA_helpers.block_w", "Vale.X64.Machine_s.operand64", "Vale.PPC64LE.Decls.va_ensure_total", "Vale.PPC64LE.Decls.va_CNil", "Lib.IntTypes.u64", "Vale.PPC64LE.Decls.validDstAddrs128", "Lib.Sequence.op_String_Access" ], "source_upto_this": "module Vale.SHA.PPC64LE\nopen Vale.Def.Opaque_s\nopen Vale.Def.Types_s\nopen Vale.Def.Words_s\nopen Vale.Def.Words.Seq_s\nopen FStar.Seq\nopen Vale.Arch.Types\nopen Vale.Arch.HeapImpl\nopen Vale.PPC64LE.Machine_s\nopen Vale.PPC64LE.Memory\nopen Vale.PPC64LE.Stack_i\nopen Vale.PPC64LE.State\nopen Vale.PPC64LE.Decls\nopen Vale.PPC64LE.QuickCode\nopen Vale.PPC64LE.QuickCodes\nopen Vale.PPC64LE.InsBasic\nopen Vale.PPC64LE.InsMem\nopen Vale.PPC64LE.InsStack\nopen Vale.PPC64LE.InsVector\nopen Vale.SHA.PPC64LE.SHA_helpers\nopen Spec.SHA2\nopen Spec.Agile.Hash\nopen Spec.Hash.Definitions\nopen Spec.Loops\nopen Vale.SHA.PPC64LE.Loop\nopen Vale.SHA2.Wrapper\n#reset-options \"--z3rlimit 2000\"\n//-- Sha_update_bytes_main\n\nval va_code_Sha_update_bytes_main : va_dummy:unit -> Tot va_code\n\nval va_codegen_success_Sha_update_bytes_main : va_dummy:unit -> Tot va_pbool\nlet va_req_Sha_update_bytes_main (va_b0:va_code) (va_s0:va_state) (ctx_b:buffer128)\n (in_b:buffer128) (num_val:nat64) (k_b:buffer128) : prop =\n (va_require_total va_b0 (va_code_Sha_update_bytes_main ()) va_s0 /\\ va_get_ok va_s0 /\\\n (va_get_reg 1 va_s0 == Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_s0) /\\\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_s0) (va_get_mem va_s0) /\\ l_or\n (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128\n ctx_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b])) (ctx_b == in_b) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 ctx_b; Vale.PPC64LE.Decls.loc_buffer\n #Vale.PPC64LE.Memory.vuint128 k_b])) (ctx_b == k_b) /\\ l_or (Vale.PPC64LE.Decls.locs_disjoint\n ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b;\n Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 k_b])) (in_b == k_b) /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_s0) (va_get_reg 3 va_s0) ctx_b 2\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0)\n (va_get_reg 4 va_s0) in_b (4 `op_Multiply` va_get_reg 5 va_s0) (va_get_mem_layout va_s0) Secret\n /\\ Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_s0) (va_get_reg 6 va_s0) k_b 16\n (va_get_mem_layout va_s0) Secret /\\ Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem\n va_s0) (va_get_reg 6 va_s0) k_b 13 3 (va_get_mem_layout va_s0) Secret /\\ num_val == va_get_reg\n 5 va_s0 /\\ va_get_reg 4 va_s0 + 64 `op_Multiply` va_get_reg 5 va_s0 < pow2_64 /\\ va_get_reg 6\n va_s0 + 256 < pow2_64 /\\ Vale.PPC64LE.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply`\n va_get_reg 5 va_s0 /\\ Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq\n (va_get_mem va_s0) k_b)))", "sketch": [ "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition `va_ens_Sha_update_bytes_main` ensures that the system and memory state after the execution of `Sha_update_bytes_main` meet certain requirements and constraints.\n\nStep 2: The post-condition `va_ens_Sha_update_bytes_main` is implemented by checking various properties of the system state, memory layout, buffer lengths, and buffer disjointness to ensure that the post-conditions are satisfied.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: We need to ensure that the memory layout and state are appropriately updated after the execution of `Sha_update_bytes_main`.\nStep 2: The post-condition should verify that the memory and state have been updated correctly, and the function has executed successfully.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed correctly and the memory and system state have been updated appropriately.\n\nStep 2: The post-condition checks for the correct update of the system state and memory after the execution of the `Sha_update_bytes_main` function.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed successfully and the memory and state have been updated according to the expected behavior of the `Sha_update_bytes_main` function.\n\nStep 2: The post-condition checks that the memory layout and state have been appropriately modified, and the buffer and register values have been updated as expected.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed successfully and the state and memory have been updated appropriately.\n\nStep 2: The post-condition checks the final state `va_sM` and fuel `va_fM` to ensure that the function has completed its execution correctly and the memory and state have been updated as expected.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed correctly and the memory and state have been updated as expected.\n\nStep 2: The post-condition checks that the function has completed successfully, the memory and state have been updated according to the function's specifications, and the fuel consumption is within the allowed limits.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed correctly and the memory and system state have been appropriately updated.\n\nStep 2: The post-condition checks the final state of the system and memory, ensuring that the function has updated the memory and system state as expected.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: We want to ensure that the function `Sha_update_bytes_main` has executed successfully and has produced the expected results in the system state and memory.\n\nStep 2: We will check that the system state and memory have been updated correctly according to the specifications of the SHA update operation. We will verify that the input and output buffers, the value of `num_val`, and the key buffer `k_b` have been processed as expected.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition `va_ens_Sha_update_bytes_main` ensures that the system state and memory satisfy certain properties after the execution of the `Sha_update_bytes_main` function.\n\nStep 2: The post-condition is implemented by checking various properties of the system state and memory, including the validity of memory addresses, buffer lengths, and the satisfaction of specific requirements related to the SHA algorithm.", "The definition `va_ens_Sha_update_bytes_main` specifies the post-condition for the `Sha_update_bytes_main` function. It describes the expected state of the system and the memory after the execution of the function.\n\nStep 1: The post-condition ensures that the function has executed successfully and the memory and system state have been updated appropriately.\n\nStep 2: The post-condition checks that the function has completed successfully, the memory locations `ctx_b` and `in_b` have been updated, and the system state `va_sM` and fuel `va_fM` have been appropriately modified." ], "generated_solution": [ "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // Implementation of post-condition properties\n // Check various properties of the system state, memory layout, buffer lengths, and buffer disjointness\n // Ensure that the post-conditions are satisfied\n // Return the prop that specifies the post-condition", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // Post-condition ensuring the memory and state are appropriately updated\n (va_get_ok va_sM /\\\n // Additional post-condition checks here\n )", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // F* code for the post-condition goes here", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // F* code for the post-condition goes here\n // Check the updated memory layout and state\n // Verify the buffer and register values have been updated as expected", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // Post-condition checks for successful execution and memory/state updates\n (va_require_total va_b0 (va_code_Sha_update_bytes_main ()) va_sM /\\\n va_get_ok va_sM /\\\n // Additional checks for memory and state updates\n // ... (additional checks go here)\n )", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n (va_require_total va_b0 (va_code_Sha_update_bytes_main ()) va_s0 /\\\n va_get_ok va_sM /\\\n va_get_reg 1 va_sM == Vale.PPC64LE.Stack_i.init_r1 (va_get_stack va_sM) /\\\n Vale.PPC64LE.Memory.is_initial_heap (va_get_mem_layout va_sM) (va_get_mem va_sM) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 ctx_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b])) (ctx_b == in_b) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 ctx_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 k_b])) (ctx_b == k_b) /\\\n l_or (Vale.PPC64LE.Decls.locs_disjoint ([Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 in_b; Vale.PPC64LE.Decls.loc_buffer #Vale.PPC64LE.Memory.vuint128 k_b])) (in_b == k_b) /\\\n Vale.PPC64LE.Decls.validDstAddrs128 (va_get_mem va_sM) (va_get_reg 3 va_sM) ctx_b 2 (va_get_mem_layout va_sM) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_sM) (va_get_reg 4 va_sM) in_b (4 `op_Multiply` va_get_reg 5 va_sM) (va_get_mem_layout va_sM) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrs128 (va_get_mem va_sM) (va_get_reg 6 va_sM) k_b 16 (va_get_mem_layout va_sM) Secret /\\\n Vale.PPC64LE.Decls.validSrcAddrsOffset128 (va_get_mem va_sM) (va_get_reg 6 va_sM) k_b 13 3 (va_get_mem_layout va_sM) Secret /\\\n num_val == va_get_reg 5 va_sM /\\\n va_get_reg 4 va_sM + 64 `op_Multiply` va_get_reg 5 va_sM < pow2_64 /\\\n va_get_reg 6 va_sM + 256 < pow2_64 /\\\n Vale.PPC64LE.Decls.buffers_disjoint128 ctx_b in_b /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 ctx_b == 2 /\\\n Vale.PPC64LE.Decls.buffer_length #Vale.PPC64LE.Memory.vuint128 in_b == 4 `op_Multiply` va_get_reg 5 va_sM /\\\n Vale.SHA.PPC64LE.SHA_helpers.k_reqs (Vale.PPC64LE.Decls.buffer128_as_seq (va_get_mem va_sM) k_b))", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // F* code for the post-condition goes here", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // Post-condition checks for the system state and memory after the execution of Sha_update_bytes_main function\n // Verify the expected updates to the system state and memory based on the input parameters and the operation of the function\n // Ensure that the function has executed successfully and produced the desired results\n // Add specific post-condition checks based on the requirements and specifications of the Sha_update_bytes_main function\n // ...", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop =\n // Implementation of post-condition properties here\n // Check system state and memory properties after function execution\n // Ensure validity of memory addresses, buffer lengths, and algorithm-specific requirements\n // Return a prop indicating the satisfaction of post-condition properties", "val va_ens_Sha_update_bytes_main\n (va_b0: va_code)\n (va_s0: va_state)\n (ctx_b in_b: buffer128)\n (num_val: nat64)\n (k_b: buffer128)\n (va_sM: va_state)\n (va_fM: va_fuel)\n : prop = \n // F* code for the post-condition goes here" ] }, { "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.bind_comp_freevars", "opens_and_abbrevs": [ { "open": "Pulse.Soundness.Common" }, { "open": "Pulse.Elaborate" }, { "open": "Pulse.Typing" }, { "open": "Pulse.Syntax" }, { "open": "FStar.List.Tot" }, { "abbrev": "L", "full_module": "FStar.List.Tot" }, { "abbrev": "R", "full_module": "FStar.Reflection.V2" }, { "abbrev": "RT", "full_module": "FStar.Reflection.Typing" }, { "open": "Pulse.Typing" }, { "open": "Pulse.Syntax.Naming" }, { "open": "Pulse.Syntax" }, { "open": "FStar.List.Tot" }, { "abbrev": "L", "full_module": "FStar.List.Tot" }, { "abbrev": "R", "full_module": "FStar.Reflection.V2" }, { "abbrev": "RT", "full_module": "FStar.Reflection.Typing" }, { "open": "Pulse.Typing" }, { "open": "Pulse.Typing" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 2, "initial_ifuel": 2, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 2, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "source_definition": "let bind_comp_freevars (#g:_) (#x:_) (#c1 #c2 #c:_)\n (d:bind_comp g x c1 c2 c)\n : Lemma \n (requires freevars_comp c1 `Set.subset` vars_of_env g /\\\n freevars_comp c2 `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures freevars_comp c `Set.subset` vars_of_env g)\n = match d with\n | Bind_comp _ _ _ _ dt _ _ -> tot_or_ghost_typing_freevars dt", "source_range": { "start_line": 318, "start_col": 0, "end_line": 325, "end_col": 65 }, "interleaved": false, "definition": "fun d ->\n (let Pulse.Typing.Bind_comp _ _ _ _ dt _ _ = d in\n Pulse.Typing.FV.tot_or_ghost_typing_freevars dt)\n <:\n FStar.Pervasives.Lemma\n (requires\n FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c1) (Pulse.Typing.FV.vars_of_env g) /\\\n FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c2)\n (FStar.Set.union (Pulse.Typing.FV.vars_of_env g) (FStar.Set.singleton x)))\n (ensures FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c) (Pulse.Typing.FV.vars_of_env g))", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Pulse.Typing.Env.env", "Pulse.Syntax.Base.var", "Pulse.Syntax.Base.comp", "Pulse.Typing.bind_comp", "Prims.b2t", "FStar.Pervasives.Native.uu___is_None", "Pulse.Syntax.Base.typ", "Pulse.Typing.Env.lookup", "Pulse.Syntax.Base.comp_st", "Pulse.Typing.bind_comp_pre", "Pulse.Typing.universe_of", "Pulse.Syntax.Base.comp_res", "Pulse.Syntax.Base.comp_u", "Prims.l_and", "Prims.l_not", "FStar.Set.mem", "Pulse.Syntax.Naming.freevars", "Pulse.Syntax.Base.comp_post", "Pulse.Typing.tot_typing", "Pulse.Typing.Env.push_binding", "Pulse.Syntax.Base.ppname_default", "Pulse.Syntax.Naming.open_term", "Pulse.Syntax.Base.tm_vprop", "Pulse.Typing.FV.tot_or_ghost_typing_freevars", "Pulse.Syntax.Pure.tm_type", "FStar.Stubs.TypeChecker.Core.E_Total", "Prims.unit", "FStar.Set.subset", "Pulse.Syntax.Naming.freevars_comp", "Pulse.Typing.FV.vars_of_env", "FStar.Set.union", "FStar.Set.singleton", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "d: Pulse.Typing.bind_comp g x c1 c2 c\n -> FStar.Pervasives.Lemma\n (requires\n FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c1) (Pulse.Typing.FV.vars_of_env g) /\\\n FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c2)\n (FStar.Set.union (Pulse.Typing.FV.vars_of_env g) (FStar.Set.singleton x)))\n (ensures\n FStar.Set.subset (Pulse.Syntax.Naming.freevars_comp c) (Pulse.Typing.FV.vars_of_env g))", "prompt": "let bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g)) =\n ", "expected_response": "match d with | Bind_comp _ _ _ _ dt _ _ -> tot_or_ghost_typing_freevars dt", "source": { "project_name": "steel", "file_name": "lib/steel/pulse/Pulse.Typing.FV.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Typing.FV.fst", "checked_file": "dataset/Pulse.Typing.FV.fst.checked", "interface_file": true, "dependencies": [ "dataset/Pulse.Typing.Metatheory.Base.fsti.checked", "dataset/Pulse.Typing.fst.checked", "dataset/Pulse.Syntax.fst.checked", "dataset/Pulse.Soundness.Common.fst.checked", "dataset/Pulse.Elaborate.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Reflection.V2.fst.checked", "dataset/FStar.Reflection.Typing.fsti.checked", "dataset/FStar.Range.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let mem_intension_pat (#a:eqtype) (x:a) (f:(a -> Tot bool))\n : Lemma\n (ensures FStar.Set.(mem x (intension f) = f x))\n [SMTPat FStar.Set.(mem x (intension f))]\n = Set.mem_intension x f", "let vars_of_rt_env (g:R.env) = Set.intension (fun x -> Some? (RT.lookup_bvar g x))", "let freevars_close_term_host_term (t:host_term) (x:var) (i:index)\n : Lemma\n (ensures (freevars (close_term' (tm_fstar t FStar.Range.range_0) x i)\n `Set.equal`\n (freevars (tm_fstar t FStar.Range.range_0) `set_minus` x)))\n = admit()", "let contains (g:env) (x:var) = Some? (lookup g x)", "let vars_of_env (g:env) = dom g", "let set_minus (#a:eqtype) (s:Set.set a) (x:a) =\n Set.intersect s (Set.complement (Set.singleton x))", "let rec freevars_close_term' (e:term) (x:var) (i:index)\n : Lemma \n (ensures freevars (close_term' e x i) `Set.equal`\n (freevars e `set_minus` x))\n = match e.t with\n | Tm_Emp\n | Tm_VProp\n | Tm_Inames\n | Tm_EmpInames\n | Tm_Unknown -> ()\n\n | Tm_Inv p ->\n freevars_close_term' p x i\n | Tm_Pure p ->\n freevars_close_term' p x i\n\n | Tm_AddInv l r\n | Tm_Star l r ->\n freevars_close_term' l x i;\n freevars_close_term' r x i\n\n | Tm_ExistsSL _ t b\n | Tm_ForallSL _ t b ->\n freevars_close_term' t.binder_ty x i; \n freevars_close_term' b x (i + 1)\n\n | Tm_FStar t ->\n freevars_close_term_host_term t x i", "val freevars_close_term (e:term) (x:var) (i:index)\n : Lemma \n (ensures freevars (close_term' e x i) ==\n freevars e `set_minus` x)\n [SMTPat (freevars (close_term' e x i))]", "val freevars_close_st_term (e:st_term) (x:var) (i:index)\n : Lemma \n (ensures freevars_st (close_st_term' e x i) ==\n freevars_st e `set_minus` x)\n [SMTPat (freevars_st (close_st_term' e x i))]", "val tot_typing_freevars (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)", "val comp_typing_freevars (#g:_) (#c:_) (#u:_)\n (d:comp_typing g c u)\n : Lemma \n (ensures freevars_comp c `Set.subset` vars_of_env g)", "val st_typing_freevars (#g:_) (#t:_) (#c:_)\n (d:st_typing g t c)\n : Lemma \n (ensures freevars_st t `Set.subset` vars_of_env g /\\\n freevars_comp c `Set.subset` vars_of_env g)", "let freevars_close_comp (c:comp)\n (x:var)\n (i:index)\n : Lemma \n (ensures freevars_comp (close_comp' c x i) `Set.equal`\n (freevars_comp c `set_minus` x))\n [SMTPat (freevars_comp (close_comp' c x i))]\n = match c with\n | C_Tot t ->\n freevars_close_term' t x i\n\n | C_ST s\n | C_STGhost s -> \n freevars_close_term' s.res x i;\n freevars_close_term' s.pre x i; \n freevars_close_term' s.post x (i + 1)\n\n | C_STAtomic n _ s ->\n freevars_close_term' n x i; \n freevars_close_term' s.res x i;\n freevars_close_term' s.pre x i; \n freevars_close_term' s.post x (i + 1)", "let st_typing_freevars_inv (#g:_) (#t:_) (#c:_)\n (d:st_typing g t c)\n (x:var)\n : Lemma \n (requires None? (lookup g x))\n (ensures ~(x `Set.mem` freevars_st t) /\\\n ~(x `Set.mem` freevars_comp c))\n = st_typing_freevars d", "let freevars_close_term_opt' (t:option term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_term_opt (close_term_opt' t x i) `Set.equal`\n (freevars_term_opt t `set_minus` x)))\n (decreases t)\n = match t with\n | None -> ()\n | Some t -> freevars_close_term' t x i", "let rec freevars_close_term_list' (t:list term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_list (close_term_list' t x i) `Set.equal`\n (freevars_list t `set_minus` x)))\n (decreases t)\n = match t with\n | [] -> ()\n | hd::tl ->\n freevars_close_term' hd x i;\n freevars_close_term_list' tl x i", "let rec freevars_close_term_pairs' (t:list (term & term)) (x:var) (i:index)\n : Lemma\n (ensures (freevars_pairs (close_term_pairs' t x i) `Set.equal`\n (freevars_pairs t `set_minus` x)))\n (decreases t)\n = match t with\n | [] -> ()\n | (u, v)::tl ->\n freevars_close_term' u x i;\n freevars_close_term' v x i;\n freevars_close_term_pairs' tl x i", "let freevars_close_proof_hint' (ht:proof_hint_type) (x:var) (i:index)\n : Lemma\n (ensures (freevars_proof_hint (close_proof_hint' ht x i) `Set.equal`\n (freevars_proof_hint ht `set_minus` x)))\n = match ht with\n | ASSERT { p }\n | FOLD { p }\n | UNFOLD { p } ->\n freevars_close_term' p x i\n | RENAME { pairs; goal } ->\n freevars_close_term_pairs' pairs x i;\n freevars_close_term_opt' goal x i\n | REWRITE { t1; t2 } ->\n freevars_close_term' t1 x i;\n freevars_close_term' t2 x i\n | WILD\n | SHOW_PROOF_STATE _ -> ()", "let rec freevars_close_st_term' (t:st_term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_st (close_st_term' t x i) `Set.equal`\n (freevars_st t `set_minus` x)))\n (decreases t)\n = match t.term with\n | Tm_Return { expected_type; term } ->\n freevars_close_term' expected_type x i;\n freevars_close_term' term x i\n\n | Tm_STApp { head; arg } ->\n freevars_close_term' head x i;\n freevars_close_term' arg x i\n \n | Tm_Abs { b; ascription=c; body } ->\n freevars_close_term' b.binder_ty x i;\n (\n match c.annotated with\n | None -> ()\n | Some c ->\n freevars_close_comp c x (i + 1)\n );\n (\n match c.elaborated with\n | None -> ()\n | Some c ->\n freevars_close_comp c x (i + 1)\n );\n freevars_close_st_term' body x (i + 1)\n\n | Tm_Bind { binder; head; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_st_term' head x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_TotBind { binder; head; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' head x i;\n freevars_close_st_term' body x (i + 1)\n \n | Tm_If { b; then_; else_; post } ->\n freevars_close_term' b x i; \n freevars_close_st_term' then_ x i; \n freevars_close_st_term' else_ x i; \n freevars_close_term_opt' post x (i + 1) \n\n | Tm_Match _ ->\n admit ()\n\n | Tm_IntroPure { p } \n | Tm_ElimExists { p } ->\n freevars_close_term' p x i\n \n | Tm_IntroExists { p; witnesses } ->\n freevars_close_term' p x i;\n freevars_close_term_list' witnesses x i\n\n | Tm_While { invariant; condition; body } ->\n freevars_close_term' invariant x (i + 1);\n freevars_close_st_term' condition x i;\n freevars_close_st_term' body x i\n\n | Tm_Par { pre1; body1; post1; pre2; body2; post2 } ->\n freevars_close_term' pre1 x i;\n freevars_close_st_term' body1 x i;\n freevars_close_term' post1 x (i + 1);\n freevars_close_term' pre2 x i;\n freevars_close_st_term' body2 x i;\n freevars_close_term' post2 x (i + 1)\n\n | Tm_Rewrite { t1; t2 } ->\n freevars_close_term' t1 x i;\n freevars_close_term' t2 x i\n\n | Tm_WithLocal { binder; initializer; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' initializer x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_WithLocalArray { binder; initializer; length; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' initializer x i;\n freevars_close_term' length x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_Admit { typ; post } ->\n freevars_close_term' typ x i;\n freevars_close_term_opt' post x (i + 1)\n \n | Tm_Unreachable -> ()\n\n | Tm_ProofHintWithBinders { binders; hint_type; t } ->\n let n = L.length binders in\n freevars_close_proof_hint' hint_type x (i + n);\n freevars_close_st_term' t x (i + n)\n\n | Tm_WithInv { name; body; returns_inv } ->\n freevars_close_term' name x i;\n freevars_close_st_term' body x i;\n match returns_inv with\n | None -> ()\n | Some (b, r) ->\n freevars_close_term' b.binder_ty x i;\n freevars_close_term' r x (i + 1)", "let freevars_close_term (e:term) (x:var) (i:index)\n : Lemma \n (ensures freevars (close_term' e x i) `Set.equal`\n (freevars e `set_minus` x))\n = freevars_close_term' e x i", "let freevars_close_st_term e x i = freevars_close_st_term' e x i", "let contains_r (g:R.env) (x:var) = Some? (RT.lookup_bvar g x)", "let vars_of_env_r (g:R.env) = Set.intension (contains_r g)", "val refl_typing_freevars (#g:R.env) (#e:R.term) (#t:R.term) (#eff:_) \n (_:RT.typing g e (eff, t))\n : Lemma \n (ensures RT.freevars e `Set.subset` (vars_of_env_r g) /\\\n RT.freevars t `Set.subset` (vars_of_env_r g))", "val refl_equiv_freevars (#g:R.env) (#e1 #e2:R.term) (d:RT.equiv g e1 e2)\n : Lemma (RT.freevars e1 `Set.subset` (vars_of_env_r g) /\\\n RT.freevars e2 `Set.subset` (vars_of_env_r g))", "let freevars_open_term_inv (e:term) \n (x:var {~ (x `Set.mem` freevars e) })\n : Lemma \n (ensures freevars e `Set.equal` (freevars (open_term e x) `set_minus` x))\n [SMTPat (freevars (open_term e x))]\n = calc (==) {\n freevars e;\n (==) { close_open_inverse e x }\n freevars (close_term (open_term e x) x);\n (==) { freevars_close_term (open_term e x) x 0 }\n freevars (open_term e x) `set_minus` x;\n }", "val freevars_open_term (e:term) (x:term) (i:index)\n : Lemma (freevars (open_term' e x i) `Set.subset` \n (freevars e `Set.union` freevars x))\n [SMTPat (freevars (open_term' e x i))]", "val freevars_open_comp (c:comp) (x:term) (i:index)\n : Lemma \n (ensures\n freevars_comp (open_comp' c x i) `Set.subset` \n (freevars_comp c `Set.union` freevars x))\n [SMTPat (freevars_comp (open_comp' c x i))]", "let tot_or_ghost_typing_freevars\n (#g:_) (#t:_) (#ty:_) (#eff:_)\n (d:typing g t eff ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = elab_freevars t;\n elab_freevars ty; \n let E d = d in\n refl_typing_freevars d;\n assert (vars_of_env_r (elab_env g) `Set.equal` (vars_of_env g))", "let tot_typing_freevars\n (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = tot_or_ghost_typing_freevars d" ], "closest": [ "val st_typing_freevars_inv (#g #t #c: _) (d: st_typing g t c) (x: var)\n : Lemma (requires None? (lookup g x))\n (ensures ~(x `Set.mem` (freevars_st t)) /\\ ~(x `Set.mem` (freevars_comp c)))\nlet st_typing_freevars_inv (#g:_) (#t:_) (#c:_)\n (d:st_typing g t c)\n (x:var)\n : Lemma \n (requires None? (lookup g x))\n (ensures ~(x `Set.mem` freevars_st t) /\\\n ~(x `Set.mem` freevars_comp c))\n = st_typing_freevars d", "val elab_freevars_comp_eq (c: comp)\n : Lemma (Set.equal (freevars_comp c) (RT.freevars (elab_comp c)))\nlet elab_freevars_comp_eq (c:comp)\n : Lemma (Set.equal (freevars_comp c) (RT.freevars (elab_comp c))) =\n\n match c with\n | C_Tot t -> elab_freevars_eq t\n | C_ST st\n | C_STGhost st ->\n elab_freevars_eq st.res;\n elab_freevars_eq st.pre;\n elab_freevars_eq st.post\n | C_STAtomic inames _ st ->\n elab_freevars_eq inames;\n elab_freevars_eq st.res;\n elab_freevars_eq st.pre;\n elab_freevars_eq st.post", "val close_comp_with_not_free_var (c: R.comp) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ND x i] == c)\n (decreases c)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val close_comp_with_non_free_var (c:comp) (x:var) (i:nat)\r\n : Lemma\r\n (requires ~ (x `Set.mem` freevars_comp c))\r\n (ensures close_comp' c x i == c)\nlet close_comp_with_non_free_var (c:comp) (x:var) (i:nat)\r\n : Lemma\r\n (requires ~ (x `Set.mem` freevars_comp c))\r\n (ensures close_comp' c x i == c) =\r\n match c with\r\n | C_Tot t1 -> close_with_non_freevar t1 x i\r\n | C_ST s \r\n | C_STGhost s ->\r\n close_with_non_freevar_st s x i\r\n | C_STAtomic inames _ s ->\r\n close_with_non_freevar inames x i;\r\n close_with_non_freevar_st s x i", "val close_open_inverse_comp' (c:comp)\r\n (x:var { ~(x `Set.mem` freevars_comp c) } )\r\n (i:index)\r\n : Lemma (ensures close_comp' (open_comp' c (U.term_of_no_name_var x) i) x i == c)\nlet close_open_inverse_comp' (c:comp)\r\n (x:var { ~(x `Set.mem` freevars_comp c) } )\r\n (i:index)\r\n : Lemma (ensures close_comp' (open_comp' c (U.term_of_no_name_var x) i) x i == c)\r\n = match c with\r\n | C_Tot t ->\r\n close_open_inverse' t x i\r\n\r\n | C_ST s \r\n | C_STGhost s -> \r\n close_open_inverse' s.res x i;\r\n close_open_inverse' s.pre x i; \r\n close_open_inverse' s.post x (i + 1)\r\n\r\n | C_STAtomic n _ s -> \r\n close_open_inverse' n x i; \r\n close_open_inverse' s.res x i;\r\n close_open_inverse' s.pre x i; \r\n close_open_inverse' s.post x (i + 1)", "val close_open_inverse'_comp (i:nat)\n (c:comp)\n (x:var{ ~(x `Set.mem` freevars_comp c) })\n : Lemma\n (ensures subst_comp \n (subst_comp c (open_with_var x i))\n [ ND x i ]\n == c)\nlet rec close_open_inverse' (i:nat)\n (t:term) \n (x:var { ~(x `Set.mem` freevars t) })\n : Lemma \n (ensures subst_term \n (subst_term t (open_with_var x i))\n [ ND x i ]\n == t)\n (decreases t)\n = match inspect_ln t with\n | Tv_Uvar _ _ -> assert false\n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unsupp\n | Tv_Unknown -> ()\n | Tv_BVar _ -> ()\n | Tv_Var _ -> ()\n | Tv_App t1 a ->\n close_open_inverse' i t1 x;\n close_open_inverse' i (fst a) x\n \n | Tv_Abs b body -> \n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Arrow b c ->\n close_open_inverse'_binder i b x;\n close_open_inverse'_comp (i + 1) c x\n\n | Tv_Refine b f ->\n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) f x\n \n | Tv_Let recf attrs b def body ->\n close_open_inverse'_terms i attrs x;\n close_open_inverse'_binder i b x;\n close_open_inverse' (if recf then (i + 1) else i) def x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Match scr ret brs ->\n close_open_inverse' i scr x;\n (match ret with\n | None -> ()\n | Some m -> close_open_inverse'_match_returns i m x);\n close_open_inverse'_branches i brs x\n\n | Tv_AscribedT e t tac b ->\n close_open_inverse' i e x;\n close_open_inverse' i t x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n\n | Tv_AscribedC e c tac b ->\n close_open_inverse' i e x;\n close_open_inverse'_comp i c x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n \nand close_open_inverse'_comp (i:nat)\n (c:comp)\n (x:var{ ~(x `Set.mem` freevars_comp c) })\n : Lemma\n (ensures subst_comp \n (subst_comp c (open_with_var x i))\n [ ND x i ]\n == c)\n (decreases c)\n = match inspect_comp c with\n | C_Total t \n | C_GTotal t -> \n close_open_inverse' i t x\n\n | C_Lemma pre post pats ->\n close_open_inverse' i pre x;\n close_open_inverse' i post x;\n close_open_inverse' i pats x\n\n | C_Eff us eff_name res args decrs ->\n close_open_inverse' i res x;\n close_open_inverse'_args i args x;\n close_open_inverse'_terms i decrs x\n\nand close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })\n : Lemma\n (ensures subst_args \n (subst_args args (open_with_var x i))\n [ ND x i]\n == args)\n (decreases args)\n = match args with\n | [] -> ()\n | (a, q) :: args ->\n close_open_inverse' i a x;\n close_open_inverse'_args i args x\n\nand close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })\n : Lemma \n (ensures subst_binder \n (subst_binder b (open_with_var x i))\n [ ND x i ]\n == b)\n (decreases b)\n = let bndr = inspect_binder b in\n close_open_inverse' i bndr.sort x;\n close_open_inverse'_terms i bndr.attrs x;\n pack_inspect_binder b\n\nand close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })\n : Lemma \n (ensures subst_terms \n (subst_terms ts (open_with_var x i))\n [ ND x i ]\n == ts)\n (decreases ts)\n = match ts with\n | [] -> ()\n | hd :: tl ->\n close_open_inverse' i hd x;\n close_open_inverse'_terms i tl x\n\nand close_open_inverse'_branches (i:nat) (brs:list branch) \n (x:var{ ~(x `Set.mem` freevars_branches brs) })\n : Lemma\n (ensures subst_branches\n (subst_branches brs (open_with_var x i))\n [ ND x i ]\n == brs)\n (decreases brs)\n = match brs with\n | [] -> ()\n | b :: brs ->\n close_open_inverse'_branch i b x;\n close_open_inverse'_branches i brs x\n\nand close_open_inverse'_branch (i:nat)\n (br:branch)\n (x:var{ ~(x `Set.mem` freevars_branch br) })\n : Lemma\n (ensures subst_branch\n (subst_branch br (open_with_var x i))\n [ ND x i ]\n == br)\n (decreases br)\n = let p, t = br in\n close_open_inverse'_pattern i p x;\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse' (i + binder_offset_pattern p) t x\n\n\nand close_open_inverse'_pattern (i:nat)\n (p:pattern)\n (x:var{ ~(x `Set.mem` freevars_pattern p) })\n : Lemma\n (ensures subst_pattern\n (subst_pattern p (open_with_var x i))\n [ ND x i ]\n == p)\n (decreases p)\n = match p with\n | Pat_Constant _ -> ()\n\n | Pat_Cons fv us pats -> \n close_open_inverse'_patterns i pats x\n \n | Pat_Var bv _ -> ()\n\n | Pat_Dot_Term topt ->\n match topt with\n | None -> ()\n | Some t -> close_open_inverse' i t x\n\nand close_open_inverse'_patterns (i:nat)\n (ps:list (pattern & bool))\n (x:var {~ (x `Set.mem` freevars_patterns ps) })\n : Lemma \n (ensures subst_patterns\n (subst_patterns ps (open_with_var x i))\n [ ND x i ]\n == ps)\n (decreases ps)\n = match ps with\n | [] -> ()\n | (p, b)::ps' ->\n close_open_inverse'_pattern i p x;\n let n = binder_offset_pattern p in\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse'_patterns (i + n) ps' x\n\nand close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)\n (x:var{ ~(x `Set.mem` freevars_match_returns m) })\n : Lemma\n (ensures subst_match_returns\n (subst_match_returns m (open_with_var x i))\n [ ND x i ]\n == m)\n (decreases m)\n = let b, (ret, as_, eq) = m in\n close_open_inverse'_binder i b x;\n (match ret with\n | Inl t -> close_open_inverse' (i + 1) t x\n | Inr c -> close_open_inverse'_comp (i + 1) c x);\n (match as_ with\n | None -> ()\n | Some t -> close_open_inverse' (i + 1) t x)", "val freevars_comp (c: comp) : Tot (Set.set var) (decreases c)\nlet freevars_comp (c:comp) : Tot (Set.set var) (decreases c) =\r\n match c with\r\n | C_Tot t -> freevars t\r\n | C_ST s\r\n | C_STGhost s -> freevars_st_comp s\r\n | C_STAtomic inames _ s ->\r\n freevars inames `Set.union` freevars_st_comp s", "val bind_comp_pre (x: var) (c1 c2: comp_st) : prop\nlet bind_comp_pre (x:var) (c1 c2:comp_st)\n : prop\n = open_term (comp_post c1) x == comp_pre c2 /\\\n (~ (x `Set.mem` freevars (comp_post c2))) /\\ //x doesn't escape in the result type\n bind_comp_compatible c1 c2", "val lift_comp_subst\n (g: env)\n (x: var)\n (t: typ)\n (g': env{pairwise_disjoint g (singleton_env (fstar_env g) x t) g'})\n (#e: term)\n (e_typing: tot_typing g e t)\n (#c1 #c2: comp)\n (d: lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e))\nlet lift_comp_subst\n (g:env) (x:var) (t:typ) (g':env { pairwise_disjoint g (singleton_env (fstar_env g) x t) g' })\n (#e:term)\n (e_typing:tot_typing g e t)\n (#c1 #c2:comp)\n (d:lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e)) =\n\n let ss = nt x e in\n \n match d with\n | Lift_STAtomic_ST _ c ->\n Lift_STAtomic_ST _ (subst_comp c ss)\n\n | Lift_Ghost_Neutral _ c d_non_informative ->\n Lift_Ghost_Neutral _ (subst_comp c ss)\n (non_informative_c_subst g x t g' e_typing _ d_non_informative)\n \n | Lift_Neutral_Ghost _ c ->\n Lift_Neutral_Ghost _ (subst_comp c ss)\n \n | Lift_Observability _ c o ->\n Lift_Observability _ (subst_comp c ss) o", "val freevars_open (e: stlc_exp) (x: var) (n: nat)\n : Lemma ((freevars (open_exp' e x n)) `Set.subset` ((freevars e) `Set.union` (Set.singleton x)))\nlet rec freevars_open (e:stlc_exp) (x:var) (n:nat)\n : Lemma (freevars (open_exp' e x n) `Set.subset`\n (freevars e `Set.union` Set.singleton x))\n = match e with\n | EUnit \n | EBVar _\n | EVar _ -> ()\n | ELam _ e -> freevars_open e x (n + 1)\n | EApp e1 e2 ->\n freevars_open e1 x n;\n freevars_open e2 x n", "val mk_bind (g:env)\n (pre:term)\n (e1:st_term)\n (e2:st_term)\n (c1:comp_st)\n (c2:comp_st)\n (px:nvar { ~ (Set.mem (snd px) (dom g)) })\n (d_e1:st_typing g e1 c1)\n (d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))\n (d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)\n (res_typing:universe_of g (comp_res c2) (comp_u c2))\n (post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))\n (open_term_nv (comp_post c2) px)\n tm_vprop)\n (bias_towards_continuation:bool)\n : T.TacH (t:st_term &\n c:comp_st { st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\\\n (bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &\n st_typing g t c)\n (requires fun _ ->\n let _, x = px in\n comp_pre c1 == pre /\\\n None? (lookup g x) /\\\n (~(x `Set.mem` freevars_st e2)) /\\\n open_term (comp_post c1) x == comp_pre c2 /\\\n (~ (x `Set.mem` freevars (comp_post c2))))\n (ensures fun _ _ -> True)\nlet rec mk_bind (g:env) \n (pre:term)\n (e1:st_term)\n (e2:st_term)\n (c1:comp_st)\n (c2:comp_st)\n (px:nvar { ~ (Set.mem (snd px) (dom g)) })\n (d_e1:st_typing g e1 c1)\n (d_c1res:tot_typing g (comp_res c1) (tm_type (comp_u c1)))\n (d_e2:st_typing (push_binding g (snd px) (fst px) (comp_res c1)) (open_st_term_nv e2 px) c2)\n (res_typing:universe_of g (comp_res c2) (comp_u c2))\n (post_typing:tot_typing (push_binding g (snd px) (fst px) (comp_res c2))\n (open_term_nv (comp_post c2) px)\n tm_vprop)\n (bias_towards_continuation:bool)\n : T.TacH (t:st_term &\n c:comp_st {\n st_comp_of_comp c == st_comp_with_pre (st_comp_of_comp c2) pre /\\\n (bias_towards_continuation ==> effect_annot_of_comp c == effect_annot_of_comp c2) } &\n st_typing g t c)\n (requires fun _ ->\n let _, x = px in\n comp_pre c1 == pre /\\\n None? (lookup g x) /\\\n (~(x `Set.mem` freevars_st e2)) /\\\n open_term (comp_post c1) x == comp_pre c2 /\\\n (~ (x `Set.mem` freevars (comp_post c2))))\n (ensures fun _ _ -> True) =\n let _, x = px in\n let b = nvar_as_binder px (comp_res c1) in\n let fail_bias (#a:Type) tag\n : T.TacH a (requires fun _ -> True) (ensures fun _ r -> FStar.Tactics.Result.Failed? r)\n = let open Pulse.PP in\n fail_doc g (Some e1.range)\n [text \"Cannot compose computations in this \" ^/^ text tag ^/^ text \" block:\";\n prefix 4 1 (text \"This computation has effect: \") (pp (effect_annot_of_comp c1));\n prefix 4 1 (text \"The continuation has effect: \") (pp (effect_annot_of_comp c2))]\n in\n match c1, c2 with\n | C_ST _, C_ST _ ->\n mk_bind_st_st g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_STGhost _, C_STGhost _ ->\n mk_bind_ghost_ghost g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_STAtomic inames1 obs1 sc1, C_STAtomic inames2 obs2 sc2 ->\n if at_most_one_observable obs1 obs2\n then (\n mk_bind_atomic_atomic g pre e1 e2 c1 c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n ) \n else if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n\n | C_STAtomic inames _ _, C_ST _ ->\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_STAtomic_ST _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_ST _, C_STAtomic inames _ _ ->\n if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_STAtomic_ST _ c2) in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )\n\n | C_STGhost _, C_STAtomic _ Neutral _ -> (\n match try_lift_ghost_atomic d_e1 with\n | Some d_e1 ->\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n | None ->\n if bias_towards_continuation\n then fail_bias \"atomic\"\n else (\n let d_e2 = T_Lift _ _ _ _ d_e2 (Lift_Neutral_Ghost _ c2) in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )\n )\n\n | C_STAtomic _ Neutral _, C_STGhost _ -> (\n if bias_towards_continuation\n then (\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n else (\n match try_lift_ghost_atomic d_e2 with\n | Some d_e2 ->\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n | None ->\n let d_e1 = T_Lift _ _ _ _ d_e1 (Lift_Neutral_Ghost _ c1) in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n )\n )\n\n | C_STGhost _, C_ST _\n | C_STGhost _, C_STAtomic _ _ _ ->\n let d_e1 = lift_ghost_atomic d_e1 in\n mk_bind g pre e1 e2 _ c2 px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation\n\n | C_ST _, C_STGhost _\n | C_STAtomic _ _ _, C_STGhost _ ->\n if bias_towards_continuation\n then fail_bias \"ghost\"\n else (\n let d_e2 = lift_ghost_atomic d_e2 in\n let (| t, c, d |) = mk_bind g pre e1 e2 _ _ px d_e1 d_c1res d_e2 res_typing post_typing bias_towards_continuation in\n (| t, c, d |)\n )", "val open_exp_freevars (e v: src_exp) (n: nat)\n : Lemma\n (ensures\n ((freevars e) `Set.subset` (freevars (open_exp' e v n))) /\\\n ((freevars (open_exp' e v n)) `Set.subset` ((freevars e) `Set.union` (freevars v))))\n (decreases e)\nlet rec open_exp_freevars (e:src_exp) (v:src_exp) (n:nat)\n : Lemma \n (ensures (freevars e `Set.subset` freevars (open_exp' e v n)) /\\\n (freevars (open_exp' e v n) `Set.subset` (freevars e `Set.union` freevars v)))\n (decreases e)\n // [SMTPat (freevars (open_exp' e v n))]\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 ->\n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | EIf b e1 e2 ->\n open_exp_freevars b v n; \n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | ELam t e ->\n open_ty_freevars t v n;\n open_exp_freevars e v (n + 1)\n\nand open_ty_freevars (t:src_ty) (v:src_exp) (n:nat)\n : Lemma \n (ensures (freevars_ty t `Set.subset` freevars_ty (open_ty' t v n)) /\\\n (freevars_ty (open_ty' t v n) `Set.subset` (freevars_ty t `Set.union` freevars v)))\n (decreases t)\n // [SMTPat (freevars_ty (open_ty' t v n))]\n = match t with\n | TBool -> ()\n | TArrow t1 t2 ->\n open_ty_freevars t1 v n;\n open_ty_freevars t2 v (n + 1)\n | TRefineBool e ->\n open_exp_freevars e v (n + 1)", "val freevars_comp (c: comp) : FStar.Set.set var\nlet rec freevars (e:term)\n : FStar.Set.set var\n = match inspect_ln e with\n | Tv_Uvar _ _ -> Set.complement Set.empty\n \n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unknown \n | Tv_Unsupp\n | Tv_BVar _ -> Set.empty\n\n | Tv_Var x -> Set.singleton (namedv_uniq x)\n \n | Tv_App e1 (e2, _) ->\n Set.union (freevars e1) (freevars e2)\n\n | Tv_Abs b body -> \n Set.union (freevars_binder b) (freevars body)\n\n | Tv_Arrow b c ->\n Set.union (freevars_binder b) (freevars_comp c)\n\n | Tv_Refine b f ->\n freevars (binder_sort b) `Set.union`\n freevars f\n \n | Tv_Let recf attrs b def body ->\n freevars_terms attrs `Set.union`\n freevars (binder_sort b) `Set.union`\n freevars def `Set.union`\n freevars body\n\n | Tv_Match scr ret brs ->\n freevars scr `Set.union`\n freevars_opt ret freevars_match_returns `Set.union`\n freevars_branches brs\n\n | Tv_AscribedT e t tac b ->\n freevars e `Set.union`\n freevars t `Set.union`\n freevars_opt tac freevars\n \n | Tv_AscribedC e c tac b ->\n freevars e `Set.union`\n freevars_comp c `Set.union`\n freevars_opt tac freevars\n\nand freevars_opt (#a:Type0) (o:option a) (f: (x:a { x << o } -> FStar.Set.set var))\n : FStar.Set.set var\n = match o with\n | None -> Set.empty\n | Some x -> f x\n\nand freevars_comp (c:comp)\n : FStar.Set.set var\n = match inspect_comp c with\n | C_Total t\n | C_GTotal t ->\n freevars t\n\n | C_Lemma pre post pats ->\n freevars pre `Set.union`\n freevars post `Set.union`\n freevars pats\n\n | C_Eff us eff_name res args decrs ->\n freevars res `Set.union`\n freevars_args args `Set.union`\n freevars_terms decrs\n\nand freevars_args (ts:list argv)\n : FStar.Set.set var\n = match ts with\n | [] -> Set.empty\n | (t,q)::ts ->\n freevars t `Set.union`\n freevars_args ts\n\nand freevars_terms (ts:list term)\n : FStar.Set.set var\n = match ts with\n | [] -> Set.empty\n | t::ts ->\n freevars t `Set.union`\n freevars_terms ts\n \nand freevars_binder (b:binder)\n : Tot (Set.set var) (decreases b)\n = let bndr = inspect_binder b in\n freevars bndr.sort `Set.union`\n freevars_terms bndr.attrs \n\nand freevars_pattern (p:pattern) \n : Tot (Set.set var) (decreases p)\n = match p with\n | Pat_Constant _ ->\n Set.empty\n\n | Pat_Cons head univs subpats ->\n freevars_patterns subpats\n \n | Pat_Var bv s -> Set.empty\n\n | Pat_Dot_Term topt ->\n freevars_opt topt freevars\n\nand freevars_patterns (ps:list (pattern & bool))\n : Tot (Set.set var) (decreases ps)\n = match ps with\n | [] -> Set.empty\n | (p, b)::ps ->\n freevars_pattern p `Set.union`\n freevars_patterns ps\n\nand freevars_branch (br:branch)\n : Tot (Set.set var) (decreases br)\n = let p, t = br in\n freevars_pattern p `Set.union`\n freevars t\n\nand freevars_branches (brs:list branch)\n : Tot (Set.set var) (decreases brs)\n = match brs with\n | [] -> Set.empty\n | hd::tl -> freevars_branch hd `Set.union` freevars_branches tl\n \nand freevars_match_returns (m:match_returns_ascription)\n : Tot (Set.set var) (decreases m)\n = let b, (ret, as_, eq) = m in\n let b = freevars_binder b in\n let ret =\n match ret with\n | Inl t -> freevars t\n | Inr c -> freevars_comp c\n in\n let as_ = freevars_opt as_ freevars in\n b `Set.union` ret `Set.union` as_", "val free_in_context : x:var -> #e:exp -> #g:env -> #t:typ -> h:typing g e t ->\n Lemma (requires True) (ensures (appears_free_in x e ==> Some? (g x))) (decreases h)\nlet rec free_in_context x #e #g #t h =\n match h with\n | TyVar x -> ()\n | TyLam t h1 -> free_in_context (x+1) h1\n | TyApp h1 h2 -> free_in_context x h1; free_in_context x h2\n | TyUnit -> ()", "val free_in_context : x:var -> #e:exp -> #g:env -> #t:ty -> h:rtyping g e t ->\n Lemma (requires True) (ensures (appears_free_in x e ==> Some? (g x))) (decreases h)\nlet rec free_in_context x #e #g #t h =\n match h with\n | TyVar x -> ()\n | TyAbs t h1 -> free_in_context (x+1) h1\n | TyApp h1 h2 -> free_in_context x h1; free_in_context x h2", "val rename_freevars (e: src_exp) (x y: var)\n : Lemma ((freevars (rename e x y)) `Set.subset` ((freevars e) `Set.union` (Set.singleton y)))\n [SMTPat (freevars (rename e x y))]\nlet rec rename_freevars (e:src_exp) (x y:var)\n : Lemma (freevars (rename e x y) `Set.subset` (freevars e `Set.union` (Set.singleton y)))\n [SMTPat (freevars (rename e x y))]\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 -> \n rename_freevars e1 x y;\n rename_freevars e2 x y\n | EIf b e1 e2 ->\n rename_freevars b x y; \n rename_freevars e1 x y;\n rename_freevars e2 x y \n | ELam t body ->\n rename_freevars body x y", "val close_with_non_freevar_st (s:st_comp) (x:var) (i:nat)\r\n : Lemma\r\n (requires ~ (x `Set.mem` freevars_st_comp s))\r\n (ensures close_st_comp' s x i == s)\nlet close_with_non_freevar_st (s:st_comp) (x:var) (i:nat)\r\n : Lemma\r\n (requires ~ (x `Set.mem` freevars_st_comp s))\r\n (ensures close_st_comp' s x i == s) =\r\n let {res; pre; post} = s in\r\n close_with_non_freevar res x i;\r\n close_with_non_freevar pre x i;\r\n close_with_non_freevar post x (i + 1)", "val open_exp_freevars (e: src_exp) (v: var) (n: nat)\n : Lemma\n (((freevars e) `Set.subset` (freevars (open_exp' e v n))) /\\\n ((freevars (open_exp' e v n)) `Set.subset` ((freevars e) `Set.union` (Set.singleton v))))\n [SMTPat (freevars (open_exp' e v n))]\nlet rec open_exp_freevars (e:src_exp) (v:var) (n:nat)\n : Lemma ((freevars e `Set.subset` freevars (open_exp' e v n)) /\\\n (freevars (open_exp' e v n) `Set.subset` (freevars e `Set.union` Set.singleton v)))\n [SMTPat (freevars (open_exp' e v n))]\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 ->\n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | EIf b e1 e2 ->\n open_exp_freevars b v n; \n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | ELam t e ->\n open_exp_freevars e v (n + 1)", "val lift_comp_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c1 #c2: comp)\n (d: lift_comp (push_env g g') c1 c2)\n (g1: env{pairwise_disjoint g g1 g'})\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2) (decreases d)\nlet lift_comp_weakening (g:env) (g':env { disjoint g g'})\n (#c1 #c2:comp) (d:lift_comp (push_env g g') c1 c2)\n (g1:env { pairwise_disjoint g g1 g' })\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2)\n (decreases d) =\n \n match d with\n | Lift_STAtomic_ST _ c -> Lift_STAtomic_ST _ c\n | Lift_Ghost_Neutral _ c non_informative_c ->\n Lift_Ghost_Neutral _ c (non_informative_c_weakening g g' g1 _ non_informative_c)\n | Lift_Neutral_Ghost _ c -> Lift_Neutral_Ghost _ c\n | Lift_Observability _ obs c -> Lift_Observability _ obs c", "val open_ty_freevars (t: src_ty) (v: src_exp) (n: nat)\n : Lemma\n (ensures\n ((freevars_ty t) `Set.subset` (freevars_ty (open_ty' t v n))) /\\\n ((freevars_ty (open_ty' t v n)) `Set.subset` ((freevars_ty t) `Set.union` (freevars v))))\n (decreases t)\nlet rec open_exp_freevars (e:src_exp) (v:src_exp) (n:nat)\n : Lemma \n (ensures (freevars e `Set.subset` freevars (open_exp' e v n)) /\\\n (freevars (open_exp' e v n) `Set.subset` (freevars e `Set.union` freevars v)))\n (decreases e)\n // [SMTPat (freevars (open_exp' e v n))]\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 ->\n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | EIf b e1 e2 ->\n open_exp_freevars b v n; \n open_exp_freevars e1 v n;\n open_exp_freevars e2 v n\n | ELam t e ->\n open_ty_freevars t v n;\n open_exp_freevars e v (n + 1)\n\nand open_ty_freevars (t:src_ty) (v:src_exp) (n:nat)\n : Lemma \n (ensures (freevars_ty t `Set.subset` freevars_ty (open_ty' t v n)) /\\\n (freevars_ty (open_ty' t v n) `Set.subset` (freevars_ty t `Set.union` freevars v)))\n (decreases t)\n // [SMTPat (freevars_ty (open_ty' t v n))]\n = match t with\n | TBool -> ()\n | TArrow t1 t2 ->\n open_ty_freevars t1 v n;\n open_ty_freevars t2 v (n + 1)\n | TRefineBool e ->\n open_exp_freevars e v (n + 1)", "val elab_comp_close_commute (c:comp) (x:var)\n : Lemma (elab_comp (close_comp c x) == RT.close_term (elab_comp c) x)\nlet elab_comp_close_commute (c:comp) (x:var)\n : Lemma (elab_comp (close_comp c x) == RT.close_term (elab_comp c) x)\n = RT.close_term_spec (elab_comp c) x;\n elab_comp_close_commute' c x 0", "val FStar.Reflection.Typing.freevars_comp_typ = c: FStar.Reflection.Typing.comp_typ -> FStar.Set.set FStar.Stubs.Reflection.V2.Data.var\nlet freevars_comp_typ (c:comp_typ) = freevars (snd c)", "val elab_exp_freevars (e: stlc_exp) : Lemma ((freevars e) `Set.equal` (RT.freevars (elab_exp e)))\nlet rec elab_exp_freevars (e:stlc_exp)\n : Lemma (freevars e `Set.equal` RT.freevars (elab_exp e))\n = match e with\n | EUnit\n | EBVar _\n | EVar _ -> ()\n | ELam t e ->\n elab_ty_freevars t;\n elab_exp_freevars e\n | EApp e1 e2 ->\n elab_exp_freevars e1;\n elab_exp_freevars e2", "val close_exp_freevars (m: int) (e: src_exp{ln' e m}) (v: var) (n: nat)\n : Lemma (ensures (freevars (close_exp' e v n)) `Set.equal` ((freevars e) `minus` v))\n (decreases e)\nlet rec close_exp_freevars (m:int) (e:src_exp { ln' e m } ) (v:var) (n:nat)\n : Lemma \n (ensures freevars (close_exp' e v n) `Set.equal`\n (freevars e `minus` v))\n (decreases e)\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n | EApp e1 e2 ->\n close_exp_freevars m e1 v n;\n close_exp_freevars m e2 v n\n | EIf b e1 e2 ->\n close_exp_freevars m b v n; \n close_exp_freevars m e1 v n;\n close_exp_freevars m e2 v n\n | ELam t body ->\n close_exp_freevars (m + 1) body v (n + 1)", "val freevars_st_comp (s: st_comp) : Set.set var\nlet freevars_st_comp (s:st_comp) : Set.set var =\r\n freevars s.res `Set.union`\r\n freevars s.pre `Set.union`\r\n freevars s.post", "val r_cbl\n (b: exp bool)\n (c c' d : computation)\n (phi phi' : gexp bool)\n: Lemma\n (requires (\n exec_equiv\n (gand phi (exp_to_gexp b Left))\n phi'\n c\n d /\\\n exec_equiv\n (gand phi (gnot (exp_to_gexp b Left)))\n phi'\n c'\n d\n ))\n (ensures (\n exec_equiv\n phi\n phi'\n (ifthenelse b c c')\n d\n ))\nlet r_cbl\n (b: exp bool)\n (c c' d : computation)\n (phi phi' : gexp bool)\n: Lemma\n (requires (\n exec_equiv\n (gand phi (exp_to_gexp b Left))\n phi'\n c\n d /\\\n exec_equiv\n (gand phi (gnot (exp_to_gexp b Left)))\n phi'\n c'\n d\n ))\n (ensures (\n exec_equiv\n phi\n phi'\n (ifthenelse b c c')\n d\n ))\n= (* NOTE: the following let _ are necessary, and must be stated in this form instead of asserts alone, the latter seeming ineffective *)\n let _ : squash (forall s1 s2 . holds (interp (gand phi (exp_to_gexp b Left))) s1 s2 <==> holds (interp phi) s1 s2 /\\ fst (reify_exp b s1) == true) =\n assert (forall s1 s2 . holds (interp (gand phi (exp_to_gexp b Left))) s1 s2 <==> holds (interp phi) s1 s2 /\\ fst (reify_exp b s1) == true)\n in\n let _ : squash (forall s1 s2 . holds (interp (gand phi (gnot (exp_to_gexp b Left)))) s1 s2 <==> holds (interp phi) s1 s2 /\\ ~ (fst (reify_exp b s1) == true)) =\n assert (forall s1 s2 . holds (interp (gand phi (gnot (exp_to_gexp b Left)))) s1 s2 <==> holds (interp phi) s1 s2 /\\ ~ (fst (reify_exp b s1) == true))\n \n in\n ()", "val free_in_context (e: exp) (g: env)\n : Lemma (requires Some? (typing g e)) (ensures forall x. appears_free_in x e ==> Some? (g x))\nlet rec free_in_context (e:exp) (g:env)\n : Lemma\n (requires Some? (typing g e))\n (ensures forall x. appears_free_in x e ==> Some? (g x))\n = match e with\n | EVar _\n | EUnit -> ()\n | EAbs y t e1 -> free_in_context e1 (extend g y t)\n | EApp e1 e2 -> free_in_context e1 g; free_in_context e2 g", "val open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)\n : Lemma \n (ensures subst_comp\n (subst_comp c [ ND x i ])\n (open_with_var x i)\n == c)\nlet rec open_close_inverse' (i:nat) (t:term { ln' t (i - 1) }) (x:var)\n : Lemma\n (ensures subst_term \n (subst_term t [ ND x i ])\n (open_with_var x i)\n == t)\n (decreases t)\n = match inspect_ln t with\n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unsupp\n | Tv_Unknown\n | Tv_BVar _ -> ()\n | Tv_Var _ -> ()\n | Tv_App t1 a ->\n open_close_inverse' i t1 x;\n open_close_inverse' i (fst a) x\n \n | Tv_Abs b body -> \n open_close_inverse'_binder i b x;\n open_close_inverse' (i + 1) body x\n\n | Tv_Arrow b c ->\n open_close_inverse'_binder i b x;\n open_close_inverse'_comp (i + 1) c x\n\n | Tv_Refine b f ->\n open_close_inverse'_binder i b x;\n open_close_inverse' (i + 1) f x\n \n | Tv_Let recf attrs b def body ->\n open_close_inverse'_terms i attrs x;\n open_close_inverse'_binder i b x;\n (if recf \n then open_close_inverse' (i + 1) def x\n else open_close_inverse' i def x);\n open_close_inverse' (i + 1) body x\n\n | Tv_Match scr ret brs ->\n open_close_inverse' i scr x;\n (match ret with\n | None -> ()\n | Some m -> open_close_inverse'_match_returns i m x);\n open_close_inverse'_branches i brs x\n \n | Tv_AscribedT e t tac b ->\n open_close_inverse' i e x;\n open_close_inverse' i t x; \n (match tac with\n | None -> ()\n | Some tac -> open_close_inverse' i tac x)\n\n | Tv_AscribedC e c tac b ->\n open_close_inverse' i e x;\n open_close_inverse'_comp i c x; \n (match tac with\n | None -> ()\n | Some tac -> open_close_inverse' i tac x)\n \n\nand open_close_inverse'_binder (i:nat) (b:binder { ln'_binder b (i - 1) }) (x:var)\n : Lemma (ensures subst_binder\n (subst_binder b [ ND x i ])\n (open_with_var x i)\n == b)\n (decreases b) \n = let bndr = inspect_binder b in\n let {ppname; qual=q; attrs=attrs; sort=sort} = bndr in\n open_close_inverse' i sort x;\n open_close_inverse'_terms i attrs x;\n assert (subst_terms (subst_terms attrs [ ND x i ])\n (open_with_var x i) == attrs); \n pack_inspect_binder b; \n assert (pack_binder {ppname; qual=q; attrs=attrs; sort=sort} == b)\n\nand open_close_inverse'_terms (i:nat) (ts:list term { ln'_terms ts (i - 1) }) (x:var)\n : Lemma (ensures subst_terms\n (subst_terms ts [ ND x i ])\n (open_with_var x i)\n == ts)\n (decreases ts) \n = match ts with\n | [] -> ()\n | t::ts -> \n open_close_inverse' i t x;\n open_close_inverse'_terms i ts x\n\nand open_close_inverse'_comp (i:nat) (c:comp { ln'_comp c (i - 1) }) (x:var)\n : Lemma \n (ensures subst_comp\n (subst_comp c [ ND x i ])\n (open_with_var x i)\n == c)\n (decreases c)\n = match inspect_comp c with\n | C_Total t\n | C_GTotal t -> open_close_inverse' i t x\n\n | C_Lemma pre post pats ->\n open_close_inverse' i pre x;\n open_close_inverse' i post x;\n open_close_inverse' i pats x\n\n | C_Eff us eff_name res args decrs ->\n open_close_inverse' i res x;\n open_close_inverse'_args i args x;\n open_close_inverse'_terms i decrs x \n\nand open_close_inverse'_args (i:nat) \n (ts:list argv { ln'_args ts (i - 1) })\n (x:var)\n : Lemma\n (ensures subst_args\n (subst_args ts [ ND x i ])\n (open_with_var x i)\n == ts)\n (decreases ts)\n = match ts with\n | [] -> ()\n | (t,q)::ts -> \n open_close_inverse' i t x;\n open_close_inverse'_args i ts x\n\nand open_close_inverse'_patterns (i:nat)\n (ps:list (pattern & bool) { ln'_patterns ps (i - 1) })\n (x:var)\n : Lemma \n (ensures subst_patterns\n (subst_patterns ps [ ND x i ])\n (open_with_var x i)\n == ps)\n (decreases ps)\n = match ps with\n | [] -> ()\n | (p, b)::ps' ->\n open_close_inverse'_pattern i p x;\n let n = binder_offset_pattern p in\n binder_offset_pattern_invariant p [ ND x i ];\n open_close_inverse'_patterns (i + n) ps' x\n\nand open_close_inverse'_pattern (i:nat) (p:pattern{ln'_pattern p (i - 1)}) (x:var)\n : Lemma \n (ensures subst_pattern\n (subst_pattern p [ ND x i ])\n (open_with_var x i)\n == p)\n (decreases p)\n = match p with\n | Pat_Constant _ -> ()\n\n | Pat_Cons fv us pats -> \n open_close_inverse'_patterns i pats x\n \n | Pat_Var bv _ -> ()\n\n | Pat_Dot_Term topt ->\n match topt with\n | None -> ()\n | Some t -> open_close_inverse' i t x\n\n \nand open_close_inverse'_branch (i:nat) (br:branch{ln'_branch br (i - 1)}) (x:var)\n : Lemma\n (ensures subst_branch\n (subst_branch br [ ND x i ])\n (open_with_var x i)\n == br)\n (decreases br) \n = let p, t = br in\n let j = binder_offset_pattern p in\n binder_offset_pattern_invariant p [ ND x i ];\n open_close_inverse'_pattern i p x;\n open_close_inverse' (i + j) t x\n \nand open_close_inverse'_branches (i:nat)\n (brs:list branch { ln'_branches brs (i - 1) })\n (x:var)\n : Lemma\n (ensures subst_branches\n (subst_branches brs [ ND x i ])\n (open_with_var x i)\n == brs)\n (decreases brs)\n = match brs with\n | [] -> ()\n | br::brs -> \n open_close_inverse'_branch i br x;\n open_close_inverse'_branches i brs x\n \nand open_close_inverse'_match_returns (i:nat) \n (m:match_returns_ascription { ln'_match_returns m (i - 1) })\n (x:var)\n : Lemma \n (ensures subst_match_returns\n (subst_match_returns m [ ND x i ])\n (open_with_var x i)\n == m)\n (decreases m)\n = let b, (ret, as_, eq) = m in\n open_close_inverse'_binder i b x;\n let ret =\n match ret with\n | Inl t ->\n open_close_inverse' (i + 1) t x\n | Inr c ->\n open_close_inverse'_comp (i + 1) c x\n in\n let as_ =\n match as_ with\n | None -> ()\n | Some t ->\n open_close_inverse' (i + 1) t x\n in\n ()", "val bind_comp_out (c1: comp_st) (c2: comp_st{bind_comp_compatible c1 c2}) : comp_st\nlet bind_comp_out (c1:comp_st) (c2:comp_st{bind_comp_compatible c1 c2})\n : comp_st\n = let s : st_comp = {u=comp_u c2; res=comp_res c2; pre=comp_pre c1; post=comp_post c2} in\n match c1, c2 with\n | C_STGhost _, C_STGhost _ -> C_STGhost s\n | C_STAtomic inames obs1 _, C_STAtomic _ obs2 _ ->\n C_STAtomic inames (join_obs obs1 obs2) s\n | C_ST _, C_ST _ -> C_ST s", "val close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val elab_freevars_eq (e: term) : Lemma (Set.equal (freevars e) (RT.freevars (elab_term e)))\nlet rec elab_freevars_eq (e:term)\n : Lemma (Set.equal (freevars e) (RT.freevars (elab_term e))) =\n match e.t with\n | Tm_Emp -> ()\n | Tm_Inv p -> elab_freevars_eq p\n | Tm_Pure t -> elab_freevars_eq t\n | Tm_AddInv l r\n | Tm_Star l r ->\n elab_freevars_eq l;\n elab_freevars_eq r\n | Tm_ExistsSL _ t body\n | Tm_ForallSL _ t body ->\n elab_freevars_eq t.binder_ty;\n elab_freevars_eq body\n | Tm_VProp\n | Tm_Inames\n | Tm_EmpInames\n | Tm_Unknown\n | Tm_FStar _ -> ()", "val elab_comp_close_commute (c: comp) (x: var)\n : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x)\n [SMTPat (elab_comp (close_comp c x))]\nlet elab_comp_close_commute (c:comp) (x:var)\n : Lemma (ensures elab_comp (close_comp c x) == RT.close_term (elab_comp c) x)\n [SMTPat (elab_comp (close_comp c x))] =\n\n elab_comp_close_commute c x", "val elab_freevars (e:term)\n : Lemma (freevars e == RT.freevars (elab_term e))\nlet elab_freevars e = elab_freevars_eq e", "val close_binder_with_not_free_var (b: R.binder) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ND x i] == b)\n (decreases b)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val st_equiv_post\n (#g: env)\n (#t: st_term)\n (#c: comp_st)\n (d: st_typing g t c)\n (post: term{(freevars post) `Set.subset` (freevars (comp_post c))})\n (veq:\n (x: var{fresh_wrt x g (freevars (comp_post c))}\n -> vprop_equiv (push_binding g x ppname_default (comp_res c))\n (open_term (comp_post c) x)\n (open_term post x)))\n : st_typing g t (comp_st_with_post c post)\nlet st_equiv_post (#g:env) (#t:st_term) (#c:comp_st) (d:st_typing g t c)\n (post:term { freevars post `Set.subset` freevars (comp_post c)})\n (veq: (x:var { fresh_wrt x g (freevars (comp_post c)) } ->\n vprop_equiv (push_binding g x ppname_default (comp_res c)) \n (open_term (comp_post c) x)\n (open_term post x)))\n : st_typing g t (comp_st_with_post c post)\n = if eq_tm post (comp_post c) then d\n else\n let c' = comp_st_with_post c post in\n let (| u_of, pre_typing, x, post_typing |) = Metatheory.(st_comp_typing_inversion (fst (comp_typing_inversion (st_typing_correctness d)))) in\n let veq = veq x in\n let st_equiv : st_equiv g c c' =\n ST_VPropEquiv g c c' x pre_typing u_of post_typing (RT.Rel_refl _ _ _) (VE_Refl _ _) veq\n in\n t_equiv d st_equiv", "val elab_st_sub (#g: env) (#c1 #c2: comp) (d_sub: st_sub g c1 c2)\n : Tot (t: R.term & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\nlet elab_st_sub (#g:env) (#c1 #c2 : comp)\n (d_sub : st_sub g c1 c2)\n : Tot (t:R.term\n & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\n= RU.magic_s \"elab_st_sub\"", "val freevars_ascription (c: comp_ascription) : Set.set var\nlet freevars_ascription (c:comp_ascription) \r\n : Set.set var\r\n = Set.union (freevars_opt freevars_comp c.elaborated)\r\n (freevars_opt freevars_comp c.annotated)", "val bind_comp_no_leakage\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n (from to: loc)\n (s0: store)\n (k: _)\n : Lemma (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1) :: fs1))))\n (ensures\n (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\nlet bind_comp_no_leakage (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n (from to:loc)\n (s0:store) (k:_)\n : Lemma\n (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1))))\n (ensures (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\n = let f = bind_comp x y in\n assert (reads_ok x r0);\n let s0' = havoc s0 from k in\n let _, s2f = f s0 in\n let _, s2f' = f s0' in\n let flows = (fs0 @ add_source r0 ((r1, w1)::fs1)) in\n let v0, s1 = x s0 in\n let v0', s1' = x s0' in\n elim_has_flow_seq from to r0 r1 w1 fs0 fs1;\n assert (~(has_flow from to fs0));\n assert (respects_flows x fs0);\n assert (no_leakage x from to);\n assert (sel s1 to == sel s1' to);\n let _, s2 = y v0 s1 in\n let _, s2' = y v0' s1' in\n assert (s2 == s2f);\n assert (s2' == s2f');\n //Given: (from not-in r0 U r1) \\/ (to not-in w1)\n //suppose (from in r0) \\/ (from in r1)\n // them to not-in w1\n //suppose (from not-in r0 U r1)\n //then v0 = v0'\n // s1' = havoc from s1 k\n // s2 to = s2' to\n if Set.mem to w1\n then begin\n assert (~(Set.mem from r0));\n assert (reads_ok x r0);\n assert (does_not_read_loc x from s0);\n assert (does_not_read_loc_v x from s0 k);\n assert (v0 == v0');\n assert (forall l. l <> from ==> sel s1 l == sel s1' l);\n assert (Map.equal s1' (havoc s1 from k) \\/ Map.equal s1' s1);\n if (sel s1 from = sel s1' from)\n then begin\n assert (Map.equal s1 s1')\n end\n else begin\n assert (Map.equal s1' (havoc s1 from k));\n assert (reads_ok (y v0) r1);\n if (sel s2 to = sel s2' to)\n then ()\n else begin\n assert (sel s2 to <> sel s1 to \\/ sel s2' to <> sel s1' to);\n has_flow_soundness (y v0) from to s1 k;\n assert (has_flow from to fs1);\n add_source_monotonic from to r0 fs1\n //y reads from and writes to, so (from, to) should be in fs1\n //so, we should get a contradiction\n end\n end\n end\n else //to is not in w1, so y does not write it\n ()", "val bind_comp_no_leakage\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n (from to: loc)\n (s0: store)\n (k: _)\n : Lemma (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1) :: fs1))))\n (ensures\n (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\nlet bind_comp_no_leakage (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n (from to:loc)\n (s0:store) (k:_)\n : Lemma\n (requires from <> to /\\ ~(has_flow from to (fs0 @ add_source r0 ((bot, w1)::fs1))))\n (ensures (let f = bind_comp x y in\n let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to))\n = let f = bind_comp x y in\n assert (reads_ok x r0);\n let s0' = havoc s0 from k in\n let _, s2f = f s0 in\n let _, s2f' = f s0' in\n let flows = (fs0 @ add_source r0 ((r1, w1)::fs1)) in\n let v0, s1 = x s0 in\n let v0', s1' = x s0' in\n elim_has_flow_seq from to r0 r1 w1 fs0 fs1;\n assert (~(has_flow from to fs0));\n assert (respects_flows x fs0);\n assert (no_leakage x from to);\n assert (sel s1 to == sel s1' to);\n let _, s2 = y v0 s1 in\n let _, s2' = y v0' s1' in\n assert (s2 == s2f);\n assert (s2' == s2f');\n //Given: (from not-in r0 U r1) \\/ (to not-in w1)\n //suppose (from in r0) \\/ (from in r1)\n // them to not-in w1\n //suppose (from not-in r0 U r1)\n //then v0 = v0'\n // s1' = havoc from s1 k\n // s2 to = s2' to\n if Set.mem to w1\n then begin\n assert (~(Set.mem from r0));\n assert (reads_ok x r0);\n assert (does_not_read_loc x r0 from s0);\n assert (does_not_read_loc_v x r0 from s0 k);\n assert (v0 == v0');\n assert (forall l. l <> from ==> sel s1 l == sel s1' l);\n assert (Map.equal s1' (havoc s1 from k) \\/ Map.equal s1' s1);\n if (sel s1 from = sel s1' from)\n then begin\n assert (Map.equal s1 s1')\n end\n else begin\n assert (Map.equal s1' (havoc s1 from k));\n assert (reads_ok (y v0) r1);\n if (sel s2 to = sel s2' to)\n then ()\n else begin\n assert (sel s2 to <> sel s1 to \\/ sel s2' to <> sel s1' to);\n has_flow_soundness (y v0) from to s1 k;\n assert (has_flow from to fs1);\n add_source_monotonic from to r0 fs1\n //y reads from and writes to, so (from, to) should be in fs1\n //so, we should get a contradiction\n end\n end\n end\n else //to is not in w1, so y does not write it\n ()", "val src_typing_freevars (#f: _) (sg: src_env) (e: src_exp) (t: s_ty) (d: src_typing f sg e t)\n : Lemma (ensures e `freevars_included_in` sg) (decreases d)\nlet rec src_typing_freevars #f (sg:src_env) (e:src_exp) (t:s_ty) (d:src_typing f sg e t)\n : Lemma \n (ensures e `freevars_included_in` sg)\n (decreases d)\n = match d with\n | T_Bool _ _ -> ()\n | T_Var _ _ -> ()\n | T_App _ _ _ _ _ _ d1 d2 s ->\n src_typing_freevars _ _ _ d1;\n src_typing_freevars _ _ _ d2 \n | T_If _ _ _ _ _ _ _ hyp db d1 d2 s1 s2 _ ->\n src_typing_freevars _ _ _ db;\n src_typing_freevars _ _ _ d1;\n src_typing_freevars _ _ _ d2 \n | T_Lam _ _ _ _ x dt dbody ->\n src_typing_freevars _ _ _ dbody", "val elab_bind (#g #x #c1 #c2 #c: _) (bc: bind_comp g x c1 c2 c) (e1 e2: R.term) : R.term\nlet elab_bind #g #x #c1 #c2 #c\n (bc:bind_comp g x c1 c2 c)\n (e1 e2:R.term)\n : R.term\n = let t1 = elab_term (comp_res c1) in\n let t2 = elab_term (comp_res c2) in\n match c1 with\n | C_ST _ ->\n mk_bind_stt\n (comp_u c1)\n (comp_u c2)\n t1 t2\n (elab_term (comp_pre c1))\n (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))\n (mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))\n e1 e2\n | C_STGhost _ ->\n mk_bind_ghost\n (comp_u c1)\n (comp_u c2)\n t1 t2\n (elab_term (comp_pre c1))\n (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))\n (mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))\n e1 e2\n | C_STAtomic inames obs1 _ ->\n let C_STAtomic _ obs2 _ = c2 in \n mk_bind_atomic\n (comp_u c1)\n (comp_u c2)\n (elab_observability obs1)\n (elab_observability obs2)\n (elab_term (comp_inames c1))\n t1 t2\n (elab_term (comp_pre c1))\n (mk_abs t1 R.Q_Explicit (elab_term (comp_post c1)))\n (mk_abs t2 R.Q_Explicit (elab_term (comp_post c2)))\n e1 e2", "val tsubst_comp : s1:tsub -> s2:tsub -> t:typ -> Lemma\n (ensures (tsubst s1 (tsubst s2 t) = tsubst (tsub_comp s1 s2) t))\n (decreases %[is_tvar t;\n is_trenaming s1;\n is_trenaming s2;\n t])\nlet rec tsubst_comp s1 s2 t =\n match t with\n | TVar z -> ()\n | TApp t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n | TLam k tbody ->\n let tsub_lam_comp : x:var ->\n Lemma(tsub_lam (tsub_comp s1 s2) x =\n tsub_comp (tsub_lam s1) (tsub_lam s2) x) =\n fun x -> match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n in\n let hoist1 = tsub_lam_hoist k tbody s2 in\n let hoist2 = tsub_lam_hoist k (tsubst (tsub_lam s2) tbody) s1 in\n let h1 =\n tsub_lam_renaming s1;\n tsub_lam_renaming s2;\n tsubst_comp (tsub_lam s1) (tsub_lam s2) tbody in\n\n let h2 =\n forall_intro tsub_lam_comp;\n cut (feq (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))) in\n\n let ext = tsubst_extensional\n (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))\n tbody in\n\n tsub_lam_hoist k tbody (tsub_comp s1 s2)\n\n | TArr t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2", "val remove_binding (g:env { Cons? (bindings g) })\n : Pure (var & typ & env)\n (requires True)\n (ensures fun r ->\n let (x, t, g') = r in\n fstar_env g' == fstar_env g /\\\n (~ (x `Set.mem` dom g')) /\\\n g == push_env (push_binding (mk_env (fstar_env g)) x ppname_default t) g')\nlet remove_binding g =\n remove_binding_aux g [] [] g.bs g.names", "val freevars_elab_ty (t: src_ty) : Lemma ((RT.freevars (elab_ty t)) `Set.equal` (freevars_ty t))\nlet rec freevars_elab_exp (e:src_exp)\n : Lemma ( RT.freevars (elab_exp e) `Set.equal` freevars e )\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n\n | ELam t e ->\n freevars_elab_ty t;\n freevars_elab_exp e\n\n \n | EApp e1 e2 ->\n freevars_elab_exp e1;\n freevars_elab_exp e2\n\n | EIf b e1 e2 ->\n freevars_elab_exp b; \n freevars_elab_exp e1;\n freevars_elab_exp e2\n \nand freevars_elab_ty (t:src_ty)\n : Lemma (RT.freevars (elab_ty t) `Set.equal` freevars_ty t)\n = match t with\n | TBool -> ()\n \n | TArrow t1 t2 ->\n freevars_elab_ty t1;\n freevars_elab_ty t2 \n \n | TRefineBool e ->\n freevars_elab_exp e", "val tsubst_commute_aux : y:nat -> x:nat{x >= y} -> s1:typ -> s2:typ -> v:var ->\n Lemma (requires True)\n (ensures ((tsub_comp (tsub_beta_gen x s1) (tsub_beta_gen y s2)) v =\n (tsub_comp (tsub_beta_gen y (tsubst_beta_gen x s1 s2))\n (tsub_beta_gen (x+1) (tshift_up_above y s1))) v))\nlet tsubst_commute_aux y x s1 s2 v =\n if v = x+1 then shift_above_and_subst s1 y (tsubst_beta_gen x s1 s2)", "val faithful_lemma_comp (c1 c2: comp)\n : Lemma (requires faithful_comp c1 /\\ faithful_comp c2) (ensures defined (comp_cmp c1 c2))\nlet rec faithful_lemma (t1 t2 : term) =\n match inspect_ln t1, inspect_ln t2 with\n | Tv_Var _, Tv_Var _\n | Tv_BVar _, Tv_BVar _\n | Tv_FVar _, Tv_FVar _ -> ()\n | Tv_UInst f1 us1, Tv_UInst f2 us2 ->\n let tv1 = inspect_ln t1 in\n let tv2 = inspect_ln t2 in\n univ_faithful_lemma_list t1 t2 us1 us2;\n ()\n\n | Tv_Const c1, Tv_Const c2 -> ()\n | Tv_App h1 a1, Tv_App h2 a2 ->\n faithful_lemma h1 h2;\n faithful_lemma_arg a1 a2\n | Tv_Abs b1 t1, Tv_Abs b2 t2 ->\n faithful_lemma_binder b1 b2;\n faithful_lemma t1 t2\n | Tv_Arrow b1 c1, Tv_Arrow b2 c2 ->\n faithful_lemma_binder b1 b2;\n faithful_lemma_comp c1 c2\n | Tv_Type u1, Tv_Type u2 ->\n univ_faithful_lemma u1 u2\n | Tv_Refine b1 t1, Tv_Refine b2 t2 ->\n faithful_lemma_binder b1 b2;\n faithful_lemma t1 t2\n\n | Tv_Let r1 ats1 x1 e1 b1, Tv_Let r2 ats2 x2 e2 b2 ->\n faithful_lemma_attrs_dec t1 t2 ats1 ats2;\n faithful_lemma_binder x1 x2;\n faithful_lemma e1 e2;\n faithful_lemma b1 b2;\n (***)term_eq_Tv_Let t1 t2 r1 r2 ats1 ats2 x1 x2 e1 e2 b1 b2;\n ()\n\n | Tv_Match sc1 o1 brs1, Tv_Match sc2 o2 brs2 ->\n (***)faithful_Tv_Match t1 sc1 o1 brs1;\n (***)faithful_Tv_Match t2 sc2 o2 brs2;\n faithful_lemma sc1 sc2;\n faithful_lemma_branches t1 t2 brs1 brs2;\n (***)term_eq_Tv_Match t1 t2 sc1 sc2 o1 o2 brs1 brs2;\n ()\n\n | Tv_AscribedT e1 t1 tacopt1 eq1, Tv_AscribedT e2 t2 tacopt2 eq2 ->\n faithful_lemma e1 e2;\n faithful_lemma t1 t2;\n (match tacopt1, tacopt2 with | Some t1, Some t2 -> faithful_lemma t1 t2 | _ -> ());\n ()\n\n | Tv_AscribedC e1 c1 tacopt1 eq1, Tv_AscribedC e2 c2 tacopt2 eq2 ->\n faithful_lemma e1 e2;\n faithful_lemma_comp c1 c2;\n (match tacopt1, tacopt2 with | Some t1, Some t2 -> faithful_lemma t1 t2 | _ -> ());\n ()\n\n | Tv_Unknown, Tv_Unknown -> ()\n\n | _ -> assert (defined (term_cmp t1 t2)) (* rest of the cases trivial *)\n\nand faithful_lemma_pattern (p1 p2 : pattern) : Lemma (requires faithful_pattern p1 /\\ faithful_pattern p2) (ensures defined (pat_cmp p1 p2)) =\n match p1, p2 with\n | Pat_Var _ _, Pat_Var _ _ -> ()\n | Pat_Constant _, Pat_Constant _ -> ()\n | Pat_Dot_Term (Some t1), Pat_Dot_Term (Some t2) ->\n faithful_lemma t1 t2\n | Pat_Cons head1 univs1 subpats1, Pat_Cons head2 univs2 subpats2 ->\n (***)faithful_Pat_Cons p1 head1 univs1 subpats1;\n (***)faithful_Pat_Cons p2 head2 univs2 subpats2;\n let aux : squash (defined (opt_dec_cmp p1 p2 (list_dec_cmp p1 p2 univ_cmp) univs1 univs2)) =\n match univs1, univs2 with\n | Some us1, Some us2 ->\n univ_faithful_lemma_list p1 p2 us1 us2\n | _ -> ()\n in\n faithful_lemma_pattern_args p1 p2 subpats1 subpats2;\n (***)pat_eq_Pat_Cons p1 p2 head1 head2 univs1 univs2 subpats1 subpats2;\n ()\n\n | _ -> ()\n\nand faithful_lemma_pattern_arg (pb1 pb2 : pattern & bool)\n : Lemma (requires faithful_pattern_arg pb1 /\\ faithful_pattern_arg pb2)\n (ensures defined (pat_arg_cmp pb1 pb2))\n =\n let (p1, _) = pb1 in\n let (p2, _) = pb2 in\n faithful_lemma_pattern p1 p2\n\nand faithful_lemma_pattern_args #b\n (top1 top2 : b)\n (pats1 : list (pattern & bool){pats1 << top1})\n (pats2 : list (pattern & bool){pats2 << top2})\n : Lemma (requires allP top1 faithful_pattern_arg pats1 /\\ allP top2 faithful_pattern_arg pats2)\n (ensures defined (list_dec_cmp top1 top2 pat_arg_cmp pats1 pats2))\n (decreases pats1)\n =\n introduce forall x y. L.memP x pats1 /\\ L.memP y pats2 ==> defined (pat_arg_cmp x y) with\n (introduce forall y. L.memP x pats1 /\\ L.memP y pats2 ==> defined (pat_arg_cmp x y) with\n (introduce (L.memP x pats1 /\\ L.memP y pats2) ==> (defined (pat_arg_cmp x y)) with h. (\n faithful_lemma_pattern_arg x y\n )\n )\n )\n ;\n defined_list_dec top1 top2 pat_arg_cmp pats1 pats2\n\nand faithful_lemma_branch (br1 br2 : branch) : Lemma (requires faithful_branch br1 /\\ faithful_branch br2) (ensures defined (br_cmp br1 br2)) =\n faithful_lemma_pattern (fst br1) (fst br2);\n faithful_lemma (snd br1) (snd br2)\n\nand faithful_lemma_branches #b (top1 top2 : b)\n (brs1 : list branch{brs1 << top1})\n (brs2 : list branch{brs2 << top2})\n : Lemma (requires allP top1 faithful_branch brs1 /\\ allP top2 faithful_branch brs2)\n (ensures defined (list_dec_cmp top1 top2 br_cmp brs1 brs2))\n (decreases brs1)\n =\n introduce forall x y. L.memP x brs1 /\\ L.memP y brs2 ==> defined (br_cmp x y) with\n (introduce forall y. L.memP x brs1 /\\ L.memP y brs2 ==> defined (br_cmp x y) with\n (introduce (L.memP x brs1 /\\ L.memP y brs2) ==> (defined (br_cmp x y)) with h. (\n faithful_lemma_branch x y\n )\n )\n )\n ;\n defined_list_dec top1 top2 br_cmp brs1 brs2\n\nand faithful_lemma_arg (a1 a2 : argv) : Lemma (requires faithful_arg a1 /\\ faithful_arg a2) (ensures defined (arg_cmp a1 a2)) =\n faithful_lemma (fst a1) (fst a2);\n (match snd a1, snd a2 with | Q_Meta t1, Q_Meta t2 -> faithful_lemma t1 t2 | _ -> ())\n\nand faithful_lemma_binder (b1 b2 : binder) : Lemma (requires faithful_binder b1 /\\ faithful_binder b2) (ensures defined (binder_cmp b1 b2)) =\n let bv1 = inspect_binder b1 in\n let bv2 = inspect_binder b2 in\n faithful_lemma_qual bv1.qual bv2.qual;\n faithful_lemma bv1.sort bv2.sort;\n faithful_lemma_attrs_dec b1 b2 bv1.attrs bv2.attrs;\n assert_norm (\n (term_cmp bv1.sort bv2.sort\n &&& aqual_cmp bv1.qual bv2.qual\n &&& list_dec_cmp b1 b2 term_cmp bv1.attrs bv2.attrs) == binder_cmp b1 b2);\n ()\n\nand faithful_lemma_qual (q1 q2 : aqualv) : Lemma (requires faithful_qual q1 /\\ faithful_qual q2) (ensures defined (aqual_cmp q1 q2)) =\n match q1, q2 with\n | Q_Meta t1, Q_Meta t2 -> faithful_lemma t1 t2\n | _ -> ()\n\nand faithful_lemma_attrs_dec #b (top1 top2 : b)\n (at1 : list term{at1 << top1})\n (at2 : list term{at2 << top2})\n : Lemma (requires faithful_attrs at1 /\\ faithful_attrs at2)\n (ensures defined (list_dec_cmp top1 top2 term_cmp at1 at2))\n (decreases at1)\n =\n // TODO: factor out\n introduce forall x y. L.memP x at1 /\\ L.memP y at2 ==> defined (term_cmp x y) with\n (introduce forall y. L.memP x at1 /\\ L.memP y at2 ==> defined (term_cmp x y) with\n (introduce (L.memP x at1 /\\ L.memP y at2) ==> (defined (term_cmp x y)) with h. (\n faithful_lemma x y\n )\n )\n )\n ;\n defined_list_dec top1 top2 term_cmp at1 at2\n\nand faithful_lemma_comp (c1 c2 : comp) : Lemma (requires faithful_comp c1 /\\ faithful_comp c2) (ensures defined (comp_cmp c1 c2)) =\n match inspect_comp c1, inspect_comp c2 with\n | C_Total t1, C_Total t2 -> faithful_lemma t1 t2\n | C_GTotal t1, C_GTotal t2 -> faithful_lemma t1 t2\n | C_Lemma pre1 post1 pat1, C_Lemma pre2 post2 pat2 ->\n faithful_lemma pre1 pre2;\n faithful_lemma post1 post2;\n faithful_lemma pat1 pat2\n | C_Eff us1 e1 r1 args1 dec1, C_Eff us2 e2 r2 args2 dec2 ->\n univ_faithful_lemma_list c1 c2 us1 us2;\n faithful_lemma r1 r2;\n introduce forall x y. L.memP x args1 /\\ L.memP y args2 ==> defined (arg_cmp x y) with\n (introduce forall y. L.memP x args1 /\\ L.memP y args2 ==> defined (arg_cmp x y) with\n (introduce (L.memP x args1 /\\ L.memP y args2) ==> (defined (arg_cmp x y)) with h. (\n faithful_lemma_arg x y\n )\n )\n )\n ;\n defined_list_dec c1 c2 arg_cmp args1 args2;\n introduce forall x y. L.memP x dec1 /\\ L.memP y dec2 ==> defined (term_cmp x y) with\n (introduce forall y. L.memP x dec1 /\\ L.memP y dec2 ==> defined (term_cmp x y) with\n (introduce (L.memP x dec1 /\\ L.memP y dec2) ==> (defined (term_cmp x y)) with h. (\n faithful_lemma x y\n )\n )\n )\n ;\n defined_list_dec c1 c2 term_cmp dec1 dec2;\n (***)comp_eq_C_Eff c1 c2 us1 us2 e1 e2 r1 r2 args1 args2 dec1 dec2;\n ()\n | _ -> ()", "val freevars_elab_exp (e: src_exp) : Lemma ((RT.freevars (elab_exp e)) `Set.equal` (freevars e))\nlet rec freevars_elab_exp (e:src_exp)\n : Lemma ( RT.freevars (elab_exp e) `Set.equal` freevars e )\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n\n | ELam t e ->\n freevars_elab_ty t;\n freevars_elab_exp e\n\n \n | EApp e1 e2 ->\n freevars_elab_exp e1;\n freevars_elab_exp e2\n\n | EIf b e1 e2 ->\n freevars_elab_exp b; \n freevars_elab_exp e1;\n freevars_elab_exp e2\n \nand freevars_elab_ty (t:src_ty)\n : Lemma (RT.freevars (elab_ty t) `Set.equal` freevars_ty t)\n = match t with\n | TBool -> ()\n \n | TArrow t1 t2 ->\n freevars_elab_ty t1;\n freevars_elab_ty t2 \n \n | TRefineBool e ->\n freevars_elab_exp e", "val elab_comp_close_commute' (c: comp) (v: var) (n: index)\n : Lemma (ensures RT.subst_term (elab_comp c) [RT.ND v n] == elab_comp (close_comp' c v n))\n (decreases c)\nlet elab_comp_close_commute' (c:comp) (v:var) (n:index)\n : Lemma (ensures\n RT.subst_term (elab_comp c) [ RT.ND v n ] ==\n elab_comp (close_comp' c v n))\n (decreases c)\n = match c with\n | C_Tot t -> elab_close_commute' t v n\n | C_ST s\n | C_STGhost s -> \n elab_close_commute' s.res v n;\n elab_close_commute' s.pre v n;\n elab_close_commute' s.post v (n + 1)\n | C_STAtomic inames _ s ->\n elab_close_commute' inames v n;\n elab_close_commute' s.res v n;\n elab_close_commute' s.pre v n;\n elab_close_commute' s.post v (n + 1)", "val bind_comp_compatible (c1 c2: comp_st) : prop\nlet bind_comp_compatible (c1 c2:comp_st)\n : prop\n = match c1, c2 with\n | C_ST _, C_ST _\n | C_STGhost _, C_STGhost _ -> True\n | C_STAtomic inames1 obs1 _, C_STAtomic inames2 obs2 _ ->\n inames1 == inames2 /\\ at_most_one_observable obs1 obs2\n | _, _ -> False", "val bind_comp_flows_ok\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1) :: fs1)))\nlet bind_comp_flows_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1)::fs1)))\n = let f = bind_comp x y in\n let flows = (fs0 @ add_source r0 ((bot, w1)::fs1)) in\n let respects_flows_lemma (from to:loc)\n : Lemma (requires from <> to /\\ ~(has_flow from to flows))\n (ensures no_leakage f from to)\n [SMTPat (no_leakage f from to)]\n = let aux (s0:store) (k:_)\n : Lemma (let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to)\n [SMTPat (havoc s0 from k)]\n = bind_comp_no_leakage x y from to s0 k\n in\n ()\n in\n ()", "val bind_comp_flows_ok\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1) :: fs1)))\nlet bind_comp_flows_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (respects_flows (bind_comp x y) (fs0 @ add_source r0 ((bot, w1)::fs1)))\n = let f = bind_comp x y in\n let flows = (fs0 @ add_source r0 ((bot, w1)::fs1)) in\n let respects_flows_lemma (from to:loc)\n : Lemma (requires from <> to /\\ ~(has_flow from to flows))\n (ensures no_leakage f from to)\n [SMTPat (no_leakage f from to)]\n = let aux (s0:store) (k:_)\n : Lemma (let s0' = havoc s0 from k in\n let _, s2 = f s0 in\n let _, s2' = f s0' in\n sel s2 to == sel s2' to)\n [SMTPat (havoc s0 from k)]\n = bind_comp_no_leakage x y from to s0 k\n in\n ()\n in\n ()", "val freevars_elab_ty (t: src_ty) : Lemma ((freevars_ty t) `Set.equal` (RT.freevars (elab_ty t)))\nlet rec freevars_elab_exp (e:src_exp)\n : Lemma (freevars e `Set.equal` RT.freevars (elab_exp e))\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n\n | ELam t e ->\n freevars_elab_ty t;\n freevars_elab_exp e\n \n | EApp e1 e2 ->\n freevars_elab_exp e1;\n freevars_elab_exp e2\n\n | EIf b e1 e2 ->\n freevars_elab_exp b; \n freevars_elab_exp e1;\n freevars_elab_exp e2\n \nand freevars_elab_ty (t:src_ty)\n : Lemma (freevars_ty t `Set.equal` RT.freevars (elab_ty t))\n = match t with\n | TBool -> ()\n \n | TArrow t1 t2 ->\n freevars_elab_ty t1;\n freevars_elab_ty t2 \n \n | TRefineBool e ->\n freevars_elab_exp e", "val bind\n (a b: Type)\n (req_f: Type0)\n (ens_f req_g: (a -> Type0))\n (ens_g: (a -> (b -> Type0)))\n (f: repr a req_f ens_f)\n (g: (x: a -> repr b (req_g x) (ens_g x)))\n : repr b\n (req_f /\\ (forall (x: a). ens_f x ==> req_g x))\n (fun y -> exists x. ens_f x /\\ ens_g x y)\nlet bind (a:Type) (b:Type)\n (req_f:Type0) (ens_f:a -> Type0)\n (req_g:a -> Type0) (ens_g:a -> (b -> Type0))\n (f:repr a req_f ens_f) (g:(x:a -> repr b (req_g x) (ens_g x)))\n: repr b\n (req_f /\\ (forall (x:a). ens_f x ==> req_g x))\n (fun y -> exists x. ens_f x /\\ ens_g x y)\n= fun _ ->\n let x = f () in\n g x ()", "val freevars_elab_exp (e: src_exp) : Lemma ((freevars e) `Set.equal` (RT.freevars (elab_exp e)))\nlet rec freevars_elab_exp (e:src_exp)\n : Lemma (freevars e `Set.equal` RT.freevars (elab_exp e))\n = match e with\n | EBool _\n | EBVar _ \n | EVar _ -> ()\n\n | ELam t e ->\n freevars_elab_ty t;\n freevars_elab_exp e\n \n | EApp e1 e2 ->\n freevars_elab_exp e1;\n freevars_elab_exp e2\n\n | EIf b e1 e2 ->\n freevars_elab_exp b; \n freevars_elab_exp e1;\n freevars_elab_exp e2\n \nand freevars_elab_ty (t:src_ty)\n : Lemma (freevars_ty t `Set.equal` RT.freevars (elab_ty t))\n = match t with\n | TBool -> ()\n \n | TArrow t1 t2 ->\n freevars_elab_ty t1;\n freevars_elab_ty t2 \n \n | TRefineBool e ->\n freevars_elab_exp e", "val elab_ty_freevars (ty: stlc_ty) : Lemma ((RT.freevars (elab_ty ty)) `Set.equal` Set.empty)\nlet rec elab_ty_freevars (ty:stlc_ty)\n : Lemma (RT.freevars (elab_ty ty) `Set.equal` Set.empty)\n = match ty with\n | TUnit -> ()\n | TArrow t1 t2 ->\n elab_ty_freevars t1;\n elab_ty_freevars t2", "val free_pointer_doesnt_depend_on_gvars\n (vs: list var_id_t)\n (ptr_value: valid_object_value_t (ObjectTDPrimitive PrimitiveTDPointer))\n (mem1 mem2: Armada.Memory.t)\n : Lemma\n (requires\n memories_match_except_global_variables vs mem1 mem2 /\\\n global_variables_unaddressed_in_memory vs mem1 /\\\n global_variables_unaddressed_in_memory vs mem2 /\\ roots_match mem1 /\\ roots_match mem2 /\\\n global_variables_unaddressed_in_object_value vs ptr_value)\n (ensures\n (let p = PrimitiveBoxPointer?.ptr (ObjectValuePrimitive?.value ptr_value) in\n match free_pointer p mem1, free_pointer p mem2 with\n | ComputationProduces mem1', ComputationProduces mem2' ->\n memories_match_except_global_variables vs mem1' mem2' /\\\n global_variables_unaddressed_in_memory vs mem1' /\\\n global_variables_unaddressed_in_memory vs mem2' /\\ roots_match mem1' /\\\n roots_match mem2'\n | ComputationImpossible, ComputationImpossible -> True\n | ComputationUndefined, ComputationUndefined -> True\n | _ -> False))\nlet free_pointer_doesnt_depend_on_gvars\n (vs: list var_id_t)\n (ptr_value: valid_object_value_t (ObjectTDPrimitive PrimitiveTDPointer))\n (mem1: Armada.Memory.t)\n (mem2: Armada.Memory.t)\n : Lemma (requires memories_match_except_global_variables vs mem1 mem2\n /\\ global_variables_unaddressed_in_memory vs mem1\n /\\ global_variables_unaddressed_in_memory vs mem2\n /\\ roots_match mem1\n /\\ roots_match mem2\n /\\ global_variables_unaddressed_in_object_value vs ptr_value)\n (ensures (let p = PrimitiveBoxPointer?.ptr (ObjectValuePrimitive?.value ptr_value) in\n match free_pointer p mem1, free_pointer p mem2 with\n | ComputationProduces mem1', ComputationProduces mem2' ->\n memories_match_except_global_variables vs mem1' mem2'\n /\\ global_variables_unaddressed_in_memory vs mem1'\n /\\ global_variables_unaddressed_in_memory vs mem2'\n /\\ roots_match mem1'\n /\\ roots_match mem2'\n | ComputationImpossible, ComputationImpossible -> True\n | ComputationUndefined, ComputationUndefined -> True\n | _ -> False)) =\n let p = PrimitiveBoxPointer?.ptr (ObjectValuePrimitive?.value ptr_value) in\n match p with\n | PointerIndex (PointerRoot root_id) idx ->\n if idx <> 0 then\n ()\n else\n (match mem1 root_id with\n | RootAllocated allocated freed storage ->\n if not allocated || freed then\n ()\n else (\n let root' = RootAllocated true true storage in\n let mem1' = Spec.Map.upd mem1 root_id root' in\n let mem2' = Spec.Map.upd mem2 root_id root' in\n assert (memories_match_except_global_variables vs mem1' mem2');\n assert (global_variables_unaddressed_in_memory vs mem1');\n assert (global_variables_unaddressed_in_memory vs mem2')\n )\n | _ -> ())\n | _ -> ()", "val check\n (g: R.env)\n (sg: list (var & stlc_ty))\n (e: stlc_exp{ln e /\\ ((freevars e) `Set.subset` (vars_of_env sg))})\n : T.Tac (t: stlc_ty & stlc_typing sg e t)\nlet rec check (g:R.env)\n (sg:list (var & stlc_ty))\n (e:stlc_exp { ln e /\\ (freevars e `Set.subset` vars_of_env sg)})\n : T.Tac (t:stlc_ty &\n stlc_typing sg e t)\n = match e with\n | EUnit ->\n let d = T_Unit sg in\n (| TUnit, d |)\n \n | EVar n ->\n begin\n match lookup sg n with\n | None -> T.fail \"Ill-typed\"\n | Some t ->\n let d = T_Var sg n in\n (| t, d |)\n end\n\n | ELam t e ->\n let x = fresh sg in\n fresh_is_fresh sg;\n freevars_open e x 0;\n let (| tbody, dbody |) = check g ((x,t)::sg) (open_exp e x) in\n (| TArrow t tbody, \n T_Lam sg t e tbody x dbody |)\n \n | EApp e1 e2 ->\n let (| t1, d1 |) = check g sg e1 in\n let (| t2, d2 |) = check g sg e2 in\n match t1 with\n | TArrow t2' t ->\n if t2' = t2\n then (| t, T_App _ _ _ _ _ d1 d2 |)\n else T.fail \n (Printf.sprintf \"Expected argument of type %s got %s\"\n (ty_to_string t2')\n (ty_to_string t2))\n \n | _ -> \n T.fail (Printf.sprintf \"Expected an arrow, got %s\"\n (ty_to_string t1))", "val rename_as_bindings_commute_1 (b: either s_ty src_eqn) (x y: var)\n : Lemma (ensures RT.rename (elab_binding b) x y == elab_binding (rename_binding b x y))\nlet rename_as_bindings_commute_1 (b:either s_ty src_eqn) (x y:var)\n : Lemma \n (ensures \n RT.rename (elab_binding b) x y ==\n elab_binding (rename_binding b x y))\n = match b with\n | Inl t ->\n assert (rename_binding b x y == Inl t);\n src_types_are_closed_core t (rt_rename x y) 0;\n RT.rename_spec (elab_ty t) x y\n | Inr (e0, e1) -> \n calc (==) {\n elab_binding (rename_binding b x y);\n (==) {}\n RT.eq2 RT.u_zero RT.bool_ty \n (elab_exp (rename e0 x y))\n (elab_exp (rename e1 x y));\n (==) {\n rename_elab_commute e0 x y;\n rename_elab_commute e1 x y\n }\n RT.eq2 RT.u_zero RT.bool_ty \n (RT.rename (elab_exp e0) x y)\n (RT.rename (elab_exp e1) x y);\n (==) { \n rename_eq2 RT.bool_ty (elab_exp e0) (elab_exp e1) x y;\n RT.rename_spec RT.bool_ty x y\n }\n RT.rename (RT.eq2 RT.u_zero RT.bool_ty (elab_exp e0) (elab_exp e1)) x y;\n }", "val close_args_with_not_free_var (l: list R.argv) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_args l)))\n (ensures subst_args l [ND x i] == l)\n (decreases l)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })\n : Lemma \n (ensures subst_binder \n (subst_binder b (open_with_var x i))\n [ ND x i ]\n == b)\nlet rec close_open_inverse' (i:nat)\n (t:term) \n (x:var { ~(x `Set.mem` freevars t) })\n : Lemma \n (ensures subst_term \n (subst_term t (open_with_var x i))\n [ ND x i ]\n == t)\n (decreases t)\n = match inspect_ln t with\n | Tv_Uvar _ _ -> assert false\n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unsupp\n | Tv_Unknown -> ()\n | Tv_BVar _ -> ()\n | Tv_Var _ -> ()\n | Tv_App t1 a ->\n close_open_inverse' i t1 x;\n close_open_inverse' i (fst a) x\n \n | Tv_Abs b body -> \n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Arrow b c ->\n close_open_inverse'_binder i b x;\n close_open_inverse'_comp (i + 1) c x\n\n | Tv_Refine b f ->\n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) f x\n \n | Tv_Let recf attrs b def body ->\n close_open_inverse'_terms i attrs x;\n close_open_inverse'_binder i b x;\n close_open_inverse' (if recf then (i + 1) else i) def x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Match scr ret brs ->\n close_open_inverse' i scr x;\n (match ret with\n | None -> ()\n | Some m -> close_open_inverse'_match_returns i m x);\n close_open_inverse'_branches i brs x\n\n | Tv_AscribedT e t tac b ->\n close_open_inverse' i e x;\n close_open_inverse' i t x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n\n | Tv_AscribedC e c tac b ->\n close_open_inverse' i e x;\n close_open_inverse'_comp i c x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n \nand close_open_inverse'_comp (i:nat)\n (c:comp)\n (x:var{ ~(x `Set.mem` freevars_comp c) })\n : Lemma\n (ensures subst_comp \n (subst_comp c (open_with_var x i))\n [ ND x i ]\n == c)\n (decreases c)\n = match inspect_comp c with\n | C_Total t \n | C_GTotal t -> \n close_open_inverse' i t x\n\n | C_Lemma pre post pats ->\n close_open_inverse' i pre x;\n close_open_inverse' i post x;\n close_open_inverse' i pats x\n\n | C_Eff us eff_name res args decrs ->\n close_open_inverse' i res x;\n close_open_inverse'_args i args x;\n close_open_inverse'_terms i decrs x\n\nand close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })\n : Lemma\n (ensures subst_args \n (subst_args args (open_with_var x i))\n [ ND x i]\n == args)\n (decreases args)\n = match args with\n | [] -> ()\n | (a, q) :: args ->\n close_open_inverse' i a x;\n close_open_inverse'_args i args x\n\nand close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })\n : Lemma \n (ensures subst_binder \n (subst_binder b (open_with_var x i))\n [ ND x i ]\n == b)\n (decreases b)\n = let bndr = inspect_binder b in\n close_open_inverse' i bndr.sort x;\n close_open_inverse'_terms i bndr.attrs x;\n pack_inspect_binder b\n\nand close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })\n : Lemma \n (ensures subst_terms \n (subst_terms ts (open_with_var x i))\n [ ND x i ]\n == ts)\n (decreases ts)\n = match ts with\n | [] -> ()\n | hd :: tl ->\n close_open_inverse' i hd x;\n close_open_inverse'_terms i tl x\n\nand close_open_inverse'_branches (i:nat) (brs:list branch) \n (x:var{ ~(x `Set.mem` freevars_branches brs) })\n : Lemma\n (ensures subst_branches\n (subst_branches brs (open_with_var x i))\n [ ND x i ]\n == brs)\n (decreases brs)\n = match brs with\n | [] -> ()\n | b :: brs ->\n close_open_inverse'_branch i b x;\n close_open_inverse'_branches i brs x\n\nand close_open_inverse'_branch (i:nat)\n (br:branch)\n (x:var{ ~(x `Set.mem` freevars_branch br) })\n : Lemma\n (ensures subst_branch\n (subst_branch br (open_with_var x i))\n [ ND x i ]\n == br)\n (decreases br)\n = let p, t = br in\n close_open_inverse'_pattern i p x;\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse' (i + binder_offset_pattern p) t x\n\n\nand close_open_inverse'_pattern (i:nat)\n (p:pattern)\n (x:var{ ~(x `Set.mem` freevars_pattern p) })\n : Lemma\n (ensures subst_pattern\n (subst_pattern p (open_with_var x i))\n [ ND x i ]\n == p)\n (decreases p)\n = match p with\n | Pat_Constant _ -> ()\n\n | Pat_Cons fv us pats -> \n close_open_inverse'_patterns i pats x\n \n | Pat_Var bv _ -> ()\n\n | Pat_Dot_Term topt ->\n match topt with\n | None -> ()\n | Some t -> close_open_inverse' i t x\n\nand close_open_inverse'_patterns (i:nat)\n (ps:list (pattern & bool))\n (x:var {~ (x `Set.mem` freevars_patterns ps) })\n : Lemma \n (ensures subst_patterns\n (subst_patterns ps (open_with_var x i))\n [ ND x i ]\n == ps)\n (decreases ps)\n = match ps with\n | [] -> ()\n | (p, b)::ps' ->\n close_open_inverse'_pattern i p x;\n let n = binder_offset_pattern p in\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse'_patterns (i + n) ps' x\n\nand close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)\n (x:var{ ~(x `Set.mem` freevars_match_returns m) })\n : Lemma\n (ensures subst_match_returns\n (subst_match_returns m (open_with_var x i))\n [ ND x i ]\n == m)\n (decreases m)\n = let b, (ret, as_, eq) = m in\n close_open_inverse'_binder i b x;\n (match ret with\n | Inl t -> close_open_inverse' (i + 1) t x\n | Inr c -> close_open_inverse'_comp (i + 1) c x);\n (match as_ with\n | None -> ()\n | Some t -> close_open_inverse' (i + 1) t x)", "val non_informative_c_weakening\n (g g': env)\n (g1: env{pairwise_disjoint g g1 g'})\n (c: comp_st)\n (d: non_informative_c (push_env g g') c)\n : non_informative_c (push_env (push_env g g1) g') c\nlet non_informative_c_weakening (g g':env) (g1:env{ pairwise_disjoint g g1 g' })\n (c:comp_st)\n (d:non_informative_c (push_env g g') c)\n : non_informative_c (push_env (push_env g g1) g') c =\n non_informative_t_weakening g g' g1 _ _ d", "val bind_comp\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : comp b\nlet bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1", "val bind_comp\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : comp b\nlet bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1", "val st_sub_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c1 #c2: comp)\n (d: st_sub (push_env g g') c1 c2)\n (g1: env{pairwise_disjoint g g1 g'})\n : Tot (st_sub (push_env (push_env g g1) g') c1 c2) (decreases d)\nlet rec st_sub_weakening (g:env) (g':env { disjoint g g' })\n (#c1 #c2:comp) (d:st_sub (push_env g g') c1 c2)\n (g1:env { pairwise_disjoint g g1 g' })\n : Tot (st_sub (push_env (push_env g g1) g') c1 c2)\n (decreases d)\n=\n let g'' = push_env (push_env g g1) g' in\n match d with\n | STS_Refl _ _ ->\n STS_Refl _ _\n | STS_Trans _ _ _ _ dl dr ->\n STS_Trans _ _ _ _ (st_sub_weakening g g' dl g1) (st_sub_weakening g g' dr g1)\n | STS_AtomicInvs _ stc is1 is2 o1 o2 tok ->\n let tok : prop_validity g'' (tm_inames_subset is1 is2) = prop_validity_token_weakening tok g'' in\n STS_AtomicInvs g'' stc is1 is2 o1 o2 tok", "val d_lu1\n (b: exp bool)\n (c: computation)\n (phi phi' : gexp bool)\n: Lemma\n (requires (exec_equiv phi phi' (while b c) (while b c)))\n (ensures (exec_equiv phi phi' (while b c) (ifthenelse b (seq c (while b c)) skip)))\nlet d_lu1\n (b: exp bool)\n (c: computation)\n (phi phi' : gexp bool)\n: Lemma\n (requires (exec_equiv phi phi' (while b c) (while b c)))\n (ensures (exec_equiv phi phi' (while b c) (ifthenelse b (seq c (while b c)) skip)))\n= Benton2004.d_lu1 b c (interp phi) (interp phi')", "val rename_id (x y: var) (e: src_exp{~(x `Set.mem` (freevars e)) \\/ x == y})\n : Lemma (ensures rename e x y == e) (decreases e)\nlet rec rename_id (x y:var) \n (e:src_exp { ~ (x `Set.mem` freevars e) \\/ x == y })\n : Lemma \n (ensures rename e x y == e)\n (decreases e)\n = match e with\n | EBool _ -> ()\n | EVar _ -> ()\n | EBVar _ -> ()\n | EApp e1 e2 -> \n rename_id x y e1;\n rename_id x y e2 \n | EIf b e1 e2 ->\n rename_id x y b; \n rename_id x y e1;\n rename_id x y e2 \n | ELam t e ->\n rename_id x y e", "val as_bindings_rename_env_append (sg sg': src_env) (x y: var)\n : Lemma\n (ensures\n as_bindings (rename_env (sg @ sg') x y) ==\n as_bindings (rename_env sg x y) @ as_bindings (rename_env sg' x y)) (decreases sg)\nlet rec as_bindings_rename_env_append (sg sg':src_env) (x y:var)\n : Lemma \n (ensures\n as_bindings (rename_env (sg@sg') x y) ==\n as_bindings (rename_env sg x y) @ as_bindings (rename_env sg' x y))\n (decreases sg)\n = match sg with\n | [] -> ()\n | hd::tl -> as_bindings_rename_env_append tl sg' x y", "val sec42_ex5 (x y z: var)\n : Lemma (requires (x <> y))\n (ensures\n (exec_equiv (geq (gvar y Left) (gvar y Right))\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gvar z Left) (gvar z Right)))\n (seq (assign x (eop op_Addition (evar y) (const 1)))\n (assign z (eop op_Addition (evar y) (const 1))))\n (seq (assign x (eop op_Addition (evar y) (const 1))) (assign z (evar x)))))\nlet sec42_ex5\n (x y z: var)\n: Lemma\n (requires (x <> y))\n (ensures (\n exec_equiv\n (geq (gvar y Left) (gvar y Right))\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gvar z Left) (gvar z Right)))\n (seq (assign x (eop op_Addition (evar y) (const 1))) (assign z (eop op_Addition (evar y) (const 1))))\n (seq (assign x (eop op_Addition (evar y) (const 1))) (assign z (evar x)))\n ))\n= sec42_ex1 x y z;\n sec42_ex4 x y", "val weaken_comp_inames\n (#g: env)\n (#e: st_term)\n (#c: comp_st)\n (d_e: st_typing g e c)\n (new_inames: term)\n : T.Tac (c': comp_st{with_inames c new_inames == c'} & st_typing g e c')\nlet weaken_comp_inames (#g:env) (#e:st_term) (#c:comp_st) (d_e:st_typing g e c) (new_inames:term)\n : T.Tac (c':comp_st { with_inames c new_inames == c' } &\n st_typing g e c')\n = match c with\n | C_ST _\n | C_STGhost _ -> (| c, d_e |)\n\n | C_STAtomic inames obs sc ->\n let d_e = T_Sub _ _ _ _ d_e (STS_AtomicInvs _ sc inames new_inames obs obs (check_prop_validity _ _ (tm_inames_subset_typing _ _ _))) in\n (| with_inames c new_inames, d_e |)", "val bind\n (a b: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (#pre_g: (a -> pre_t))\n (#post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val t_equiv (#g #st #c: _) (d: st_typing g st c) (#c': comp) (eq: st_equiv g c c')\n : st_typing g st c'\nlet t_equiv #g #st #c (d:st_typing g st c) (#c':comp) (eq:st_equiv g c c')\n : st_typing g st c'\n = match d with\n | T_Equiv _ _ _ _ d0 eq' -> (\n match st_equiv_trans eq' eq with\n | None -> T_Equiv _ _ _ _ d eq\n | Some eq'' -> T_Equiv _ _ _ _ d0 eq''\n )\n | _ -> T_Equiv _ _ _ _ d eq", "val rename_as_bindings_commute (sg: src_env) (x y: var)\n : Lemma (ensures as_bindings (rename_env sg x y) == RT.rename_bindings (as_bindings sg) x y)\n (decreases sg)\nlet rec rename_as_bindings_commute (sg:src_env) (x y:var)\n : Lemma \n (ensures \n as_bindings (rename_env sg x y) ==\n RT.rename_bindings (as_bindings sg) x y)\n (decreases sg)\n = match sg with\n | [] -> ()\n | (z,b)::tl ->\n calc (==) {\n as_bindings (rename_env sg x y);\n (==) { as_bindings_rename_env_append [(z,b)] tl x y }\n (z, elab_binding (rename_binding b x y)) :: as_bindings (rename_env tl x y);\n (==) { rename_as_bindings_commute tl x y }\n (z, elab_binding (rename_binding b x y)) :: RT.rename_bindings (as_bindings tl) x y;\n (==) { rename_as_bindings_commute_1 b x y }\n (z, RT.rename (elab_binding b) x y) :: RT.rename_bindings (as_bindings tl) x y; \n (==) { }\n RT.rename_bindings (as_bindings sg) x y;\n }", "val tsub_lam_comp : s1:tsub -> s2:tsub -> x:var -> Lemma\n (tsub_lam (tsub_comp s1 s2) x = tsub_comp (tsub_lam s1) (tsub_lam s2) x)\nlet tsub_lam_comp s1 s2 x =\n match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end", "val bind_wp_lem' (#a: Type u#aa) (#b: Type u#bb) (#s: _) (f: m s a) (g: (a -> m s b))\n : Lemma ((wp_of (bind_m f g)) `F.feq` (bind_wp (wp_of f) (wp_of *. g)))\nlet rec bind_wp_lem' (#a:Type u#aa) (#b:Type u#bb) (#s:_) (f:m s a) (g: (a -> m s b))\n : Lemma (wp_of (bind_m f g) `F.feq` bind_wp (wp_of f) (wp_of *. g))\n = match f with\n | Ret x ->\n assert (bind_m f g == g x);\n assert_norm (wp_of #a #s (Ret x) `F.feq` (fun s0 post -> post (x, s0)));\n assert (wp_of (bind_m (Ret x) g) `F.feq` bind_wp (wp_of (Ret x)) (wp_of *. g))\n by (T.norm [zeta; iota; delta];\n let x = T.forall_intro () in\n T.mapply (quote (eta u#(max bb 1) u#1)))\n\n | Put s k ->\n bind_wp_lem' k g;\n assert_norm (wp_put (bind_wp (wp_of k) (wp_of *. g)) s `F.feq`\n bind_wp (wp_put (wp_of k) s) (wp_of *. g))\n\n | Get k ->\n let aux (x:s)\n : Lemma\n (ensures (wp_of (bind_m (k x) g) `F.feq`\n bind_wp (wp_of (k x)) (wp_of *. g)))\n [SMTPat (k x)]\n = bind_wp_lem' (k x) g\n in\n assert_norm (wp_of (bind_m (Get k) g) ==\n wp_of (Get (fun x -> bind_m (k x) g)));\n assert_norm (wp_of (Get (fun x -> bind_m (k x) g)) ==\n F.on _ (fun s0 -> (wp_of (bind_m (k s0) g)) s0));\n\n assert ((fun s0 -> (wp_of (bind_m (k s0) g)) s0) `F.feq`\n (fun s0 -> bind_wp (wp_of (k s0)) (wp_of *. g) s0));\n assert_norm (bind_wp (wp_of (Get k)) (wp_of *. g) ==\n bind_wp (F.on _ (fun s0 -> wp_of (k s0) s0))\n (wp_of *. g));\n assert_norm (bind_wp (F.on _ (fun s0 -> wp_of (k s0) s0)) (wp_of *. g) ==\n F.on _ (fun s0 -> bind_wp (wp_of (k s0)) (wp_of *. g) s0))", "val bind\n (a b: Type)\n (pre_f: pre_t)\n (post_f: post_t a)\n (pre_g: (a -> pre_t))\n (post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val close_terms_with_not_free_var (l: list R.term) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ND x i] == l)\n (decreases l)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val dereference_computation_doesnt_depend_on_global_variables\n (vs: list var_id_t)\n (p: Armada.Pointer.t)\n (mem1 mem2: Armada.Memory.t)\n : Lemma\n (requires\n memories_match_except_global_variables vs mem1 mem2 /\\\n global_variables_unaddressed_in_pointer vs p /\\\n global_variables_unaddressed_in_memory vs mem1 /\\\n global_variables_unaddressed_in_memory vs mem2 /\\ roots_match mem1 /\\ roots_match mem2)\n (ensures\n dereference_computation p mem1 == dereference_computation p mem2 /\\\n (match dereference_computation p mem1 with\n | ComputationProduces storage -> global_variables_unaddressed_in_storage vs storage\n | _ -> True))\nlet rec dereference_computation_doesnt_depend_on_global_variables\n (vs: list var_id_t)\n (p: Armada.Pointer.t)\n (mem1: Armada.Memory.t)\n (mem2: Armada.Memory.t)\n : Lemma (requires memories_match_except_global_variables vs mem1 mem2\n /\\ global_variables_unaddressed_in_pointer vs p\n /\\ global_variables_unaddressed_in_memory vs mem1\n /\\ global_variables_unaddressed_in_memory vs mem2\n /\\ roots_match mem1\n /\\ roots_match mem2)\n (ensures dereference_computation p mem1 == dereference_computation p mem2\n /\\ (match dereference_computation p mem1 with\n | ComputationProduces storage -> global_variables_unaddressed_in_storage vs storage\n | _ -> True)) =\n match p with\n | PointerUninitialized -> ()\n | PointerNull -> ()\n | PointerRoot root_id -> ()\n | PointerField struct_ptr field_id ->\n dereference_computation_doesnt_depend_on_global_variables vs struct_ptr mem1 mem2\n | PointerIndex array_ptr idx ->\n dereference_computation_doesnt_depend_on_global_variables vs array_ptr mem1 mem2", "val dereference_computation_doesnt_depend_on_global_variables\n (vs: list var_id_t)\n (p: Armada.Pointer.t)\n (mem1 mem2: Armada.Memory.t)\n : Lemma\n (requires\n memories_match_except_global_variables vs mem1 mem2 /\\\n global_variables_unaddressed_in_pointer vs p /\\\n global_variables_unaddressed_in_memory vs mem1 /\\\n global_variables_unaddressed_in_memory vs mem2 /\\ roots_match mem1 /\\ roots_match mem2)\n (ensures\n dereference_computation p mem1 == dereference_computation p mem2 /\\\n (match dereference_computation p mem1 with\n | ComputationProduces storage -> global_variables_unaddressed_in_storage vs storage\n | _ -> True))\nlet rec dereference_computation_doesnt_depend_on_global_variables\n (vs: list var_id_t)\n (p: Armada.Pointer.t)\n (mem1: Armada.Memory.t)\n (mem2: Armada.Memory.t)\n : Lemma (requires memories_match_except_global_variables vs mem1 mem2\n /\\ global_variables_unaddressed_in_pointer vs p\n /\\ global_variables_unaddressed_in_memory vs mem1\n /\\ global_variables_unaddressed_in_memory vs mem2\n /\\ roots_match mem1\n /\\ roots_match mem2)\n (ensures dereference_computation p mem1 == dereference_computation p mem2\n /\\ (match dereference_computation p mem1 with\n | ComputationProduces storage -> global_variables_unaddressed_in_storage vs storage\n | _ -> True)) =\n match p with\n | PointerUninitialized -> ()\n | PointerNull -> ()\n | PointerRoot root_id -> ()\n | PointerField struct_ptr field_id ->\n dereference_computation_doesnt_depend_on_global_variables vs struct_ptr mem1 mem2\n | PointerIndex array_ptr idx ->\n dereference_computation_doesnt_depend_on_global_variables vs array_ptr mem1 mem2", "val close_open_inverse_ascription'\n (t: comp_ascription)\n (x: var{~(x `Set.mem` (freevars_ascription t))})\n (i: index)\n : Lemma (ensures close_ascription' (open_ascription' t (U.term_of_no_name_var x) i) x i == t)\nlet close_open_inverse_ascription' (t:comp_ascription)\r\n (x:var { ~(x `Set.mem` freevars_ascription t) } )\r\n (i:index)\r\n : Lemma (ensures close_ascription' (open_ascription' t (U.term_of_no_name_var x) i) x i == t)\r\n = (match t.annotated with\r\n | None -> ()\r\n | Some c -> close_open_inverse_comp' c x i);\r\n (match t.elaborated with\r\n | None -> ()\r\n | Some c -> close_open_inverse_comp' c x i)", "val st_equiv_trans (#g: env) (#c0 #c1 #c2: comp) (d01: st_equiv g c0 c1) (d12: st_equiv g c1 c2)\n : option (st_equiv g c0 c2)\nlet st_equiv_trans (#g:env) (#c0 #c1 #c2:comp) (d01:st_equiv g c0 c1) (d12:st_equiv g c1 c2)\n : option (st_equiv g c0 c2)\n = \n match d01 with\n | ST_VPropEquiv _f _c0 _c1 x c0_pre_typing c0_res_typing c0_post_typing eq_res_01 eq_pre_01 eq_post_01 -> (\n let ST_VPropEquiv _f _c1 _c2 y c1_pre_typing c1_res_typing c1_post_typing eq_res_12 eq_pre_12 eq_post_12 = d12 in\n if x = y && eq_tm (comp_res c0) (comp_res c1)\n then Some (\n ST_VPropEquiv g c0 c2 x c0_pre_typing c0_res_typing c0_post_typing\n (RT.Rel_trans _ _ _ _ _ eq_res_01 eq_res_12)\n (VE_Trans _ _ _ _ eq_pre_01 eq_pre_12)\n (VE_Trans _ _ _ _ eq_post_01 eq_post_12)\n )\n else None\n )\n | ST_TotEquiv g t1 t2 u typing eq ->\n let ST_TotEquiv _g _t1 t3 _ _ eq' = d12 in\n let eq'' = Ghost.hide (RT.Rel_trans _ _ _ _ _ eq eq') in\n Some (ST_TotEquiv g t1 t3 u typing eq'')", "val bind (a b s: _) (f: st a s) (g: (a -> st b s)) : st b s\nlet bind a b s (f:st a s) (g:a -> st b s)\n : st b s\n = fun s ->\n let x, s' = f s in\n g x s'", "val close_pattern_with_not_free_var (p: R.pattern) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ND x i] == p)\n (decreases p)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i", "val lemma_bounded_effects_series_aux2 (c1 c2 f1 f2 s: _)\n : Lemma\n (requires\n ((forall s. {:pattern (constant_on_execution c1 f1 s)} (constant_on_execution c1 f1 s)) /\\\n (forall s. {:pattern (constant_on_execution c2 f2 s)} (constant_on_execution c2 f2 s))))\n (ensures\n (let open Vale.X64.Machine_Semantics_s in\n (constant_on_execution (c1 `intersect` c2)\n (let* _ = f1 in\n f2)\n s)))\nlet rec lemma_bounded_effects_series_aux2 c1 c2 f1 f2 s :\n Lemma\n (requires (\n (forall s. {:pattern (constant_on_execution c1 f1 s)} (constant_on_execution c1 f1 s)) /\\\n (forall s. {:pattern (constant_on_execution c2 f2 s)} (constant_on_execution c2 f2 s))))\n (ensures (\n let open Vale.X64.Machine_Semantics_s in\n (constant_on_execution (c1 `intersect` c2) (f1;*f2) s))) =\n let open Vale.X64.Machine_Semantics_s in\n let f = f1;*f2 in\n if (run f s).ms_ok then (\n match c1 with\n | [] -> ()\n | (|l,v|) :: xs ->\n if L.mem (|l,v|) c2 then (\n lemma_constant_on_execution_mem c2 f2 (run f1 s) l v\n ) else ();\n assert (forall s. constant_on_execution c1 f1 s ==> constant_on_execution xs f1 s); (* OBSERVE *)\n lemma_bounded_effects_series_aux2 xs c2 f1 f2 s\n ) else ()", "val close_open_inverse' (i:nat)\n (t:term) \n (x:var { ~(x `Set.mem` freevars t) })\n : Lemma \n (ensures subst_term \n (subst_term t (open_with_var x i))\n [ ND x i ]\n == t)\nlet rec close_open_inverse' (i:nat)\n (t:term) \n (x:var { ~(x `Set.mem` freevars t) })\n : Lemma \n (ensures subst_term \n (subst_term t (open_with_var x i))\n [ ND x i ]\n == t)\n (decreases t)\n = match inspect_ln t with\n | Tv_Uvar _ _ -> assert false\n | Tv_UInst _ _\n | Tv_FVar _\n | Tv_Type _\n | Tv_Const _\n | Tv_Unsupp\n | Tv_Unknown -> ()\n | Tv_BVar _ -> ()\n | Tv_Var _ -> ()\n | Tv_App t1 a ->\n close_open_inverse' i t1 x;\n close_open_inverse' i (fst a) x\n \n | Tv_Abs b body -> \n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Arrow b c ->\n close_open_inverse'_binder i b x;\n close_open_inverse'_comp (i + 1) c x\n\n | Tv_Refine b f ->\n close_open_inverse'_binder i b x;\n close_open_inverse' (i + 1) f x\n \n | Tv_Let recf attrs b def body ->\n close_open_inverse'_terms i attrs x;\n close_open_inverse'_binder i b x;\n close_open_inverse' (if recf then (i + 1) else i) def x;\n close_open_inverse' (i + 1) body x\n\n | Tv_Match scr ret brs ->\n close_open_inverse' i scr x;\n (match ret with\n | None -> ()\n | Some m -> close_open_inverse'_match_returns i m x);\n close_open_inverse'_branches i brs x\n\n | Tv_AscribedT e t tac b ->\n close_open_inverse' i e x;\n close_open_inverse' i t x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n\n | Tv_AscribedC e c tac b ->\n close_open_inverse' i e x;\n close_open_inverse'_comp i c x;\n (match tac with\n | None -> ()\n | Some t -> close_open_inverse' i t x)\n \nand close_open_inverse'_comp (i:nat)\n (c:comp)\n (x:var{ ~(x `Set.mem` freevars_comp c) })\n : Lemma\n (ensures subst_comp \n (subst_comp c (open_with_var x i))\n [ ND x i ]\n == c)\n (decreases c)\n = match inspect_comp c with\n | C_Total t \n | C_GTotal t -> \n close_open_inverse' i t x\n\n | C_Lemma pre post pats ->\n close_open_inverse' i pre x;\n close_open_inverse' i post x;\n close_open_inverse' i pats x\n\n | C_Eff us eff_name res args decrs ->\n close_open_inverse' i res x;\n close_open_inverse'_args i args x;\n close_open_inverse'_terms i decrs x\n\nand close_open_inverse'_args (i:nat) (args:list argv) (x:var{ ~(x `Set.mem` freevars_args args) })\n : Lemma\n (ensures subst_args \n (subst_args args (open_with_var x i))\n [ ND x i]\n == args)\n (decreases args)\n = match args with\n | [] -> ()\n | (a, q) :: args ->\n close_open_inverse' i a x;\n close_open_inverse'_args i args x\n\nand close_open_inverse'_binder (i:nat) (b:binder) (x:var{ ~(x `Set.mem` freevars_binder b) })\n : Lemma \n (ensures subst_binder \n (subst_binder b (open_with_var x i))\n [ ND x i ]\n == b)\n (decreases b)\n = let bndr = inspect_binder b in\n close_open_inverse' i bndr.sort x;\n close_open_inverse'_terms i bndr.attrs x;\n pack_inspect_binder b\n\nand close_open_inverse'_terms (i:nat) (ts:list term) (x:var{ ~(x `Set.mem` freevars_terms ts) })\n : Lemma \n (ensures subst_terms \n (subst_terms ts (open_with_var x i))\n [ ND x i ]\n == ts)\n (decreases ts)\n = match ts with\n | [] -> ()\n | hd :: tl ->\n close_open_inverse' i hd x;\n close_open_inverse'_terms i tl x\n\nand close_open_inverse'_branches (i:nat) (brs:list branch) \n (x:var{ ~(x `Set.mem` freevars_branches brs) })\n : Lemma\n (ensures subst_branches\n (subst_branches brs (open_with_var x i))\n [ ND x i ]\n == brs)\n (decreases brs)\n = match brs with\n | [] -> ()\n | b :: brs ->\n close_open_inverse'_branch i b x;\n close_open_inverse'_branches i brs x\n\nand close_open_inverse'_branch (i:nat)\n (br:branch)\n (x:var{ ~(x `Set.mem` freevars_branch br) })\n : Lemma\n (ensures subst_branch\n (subst_branch br (open_with_var x i))\n [ ND x i ]\n == br)\n (decreases br)\n = let p, t = br in\n close_open_inverse'_pattern i p x;\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse' (i + binder_offset_pattern p) t x\n\n\nand close_open_inverse'_pattern (i:nat)\n (p:pattern)\n (x:var{ ~(x `Set.mem` freevars_pattern p) })\n : Lemma\n (ensures subst_pattern\n (subst_pattern p (open_with_var x i))\n [ ND x i ]\n == p)\n (decreases p)\n = match p with\n | Pat_Constant _ -> ()\n\n | Pat_Cons fv us pats -> \n close_open_inverse'_patterns i pats x\n \n | Pat_Var bv _ -> ()\n\n | Pat_Dot_Term topt ->\n match topt with\n | None -> ()\n | Some t -> close_open_inverse' i t x\n\nand close_open_inverse'_patterns (i:nat)\n (ps:list (pattern & bool))\n (x:var {~ (x `Set.mem` freevars_patterns ps) })\n : Lemma \n (ensures subst_patterns\n (subst_patterns ps (open_with_var x i))\n [ ND x i ]\n == ps)\n (decreases ps)\n = match ps with\n | [] -> ()\n | (p, b)::ps' ->\n close_open_inverse'_pattern i p x;\n let n = binder_offset_pattern p in\n binder_offset_pattern_invariant p (open_with_var x i);\n close_open_inverse'_patterns (i + n) ps' x\n\nand close_open_inverse'_match_returns (i:nat) (m:match_returns_ascription)\n (x:var{ ~(x `Set.mem` freevars_match_returns m) })\n : Lemma\n (ensures subst_match_returns\n (subst_match_returns m (open_with_var x i))\n [ ND x i ]\n == m)\n (decreases m)\n = let b, (ret, as_, eq) = m in\n close_open_inverse'_binder i b x;\n (match ret with\n | Inl t -> close_open_inverse' (i + 1) t x\n | Inr c -> close_open_inverse'_comp (i + 1) c x);\n (match as_ with\n | None -> ()\n | Some t -> close_open_inverse' (i + 1) t x)", "val intro_comp_typing (g:env) \n (c:comp_st)\n (pre_typing:tot_typing g (comp_pre c) tm_vprop)\n (iname_typing:effect_annot_typing g (effect_annot_of_comp c))\n (res_typing:universe_of g (comp_res c) (comp_u c))\n (x:var { fresh_wrt x g (freevars (comp_post c)) })\n (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)\n : T.Tac (comp_typing g c (universe_of_comp c))\nlet intro_comp_typing (g:env) \n (c:comp_st)\n (pre_typing:tot_typing g (comp_pre c) tm_vprop)\n (i_typing:effect_annot_typing g (effect_annot_of_comp c))\n (res_typing:universe_of g (comp_res c) (comp_u c))\n (x:var { fresh_wrt x g (freevars (comp_post c)) })\n (post_typing:tot_typing (push_binding g x ppname_default (comp_res c)) (open_term (comp_post c) x) tm_vprop)\n : T.Tac (comp_typing g c (universe_of_comp c))\n = let intro_st_comp_typing (st:st_comp { comp_u c == st.u /\\\n comp_pre c == st.pre /\\\n comp_res c == st.res /\\\n comp_post c == st.post } )\n : T.Tac (st_comp_typing g st)\n = STC g st x res_typing pre_typing post_typing\n in\n match c with\n | C_ST st -> \n let stc = intro_st_comp_typing st in\n CT_ST _ _ stc\n | C_STAtomic i obs st -> \n let stc = intro_st_comp_typing st in\n CT_STAtomic _ i obs _ i_typing stc\n | C_STGhost st -> \n let stc = intro_st_comp_typing st in\n CT_STGhost _ _ stc", "val soundness_lemma\n (g:stt_env)\n (t:st_term)\n (c:comp)\n (d:st_typing g t c)\n : Lemma (ensures RT.tot_typing (elab_env g)\n (elab_st_typing d)\n (elab_comp c))\nlet soundness_lemma\n (g:stt_env)\n (t:st_term)\n (c:comp)\n (d:st_typing g t c)\n : Lemma (ensures RT.tot_typing (elab_env g)\n (elab_st_typing d)\n (elab_comp c))\n = FStar.Squash.bind_squash\n #(st_typing g t c)\n ()\n (fun dd -> FStar.Squash.return_squash (soundness g t c d))", "val d_div\n (b: exp bool)\n (c: computation)\n (phi phi' : sttype)\n: Lemma\n (requires (\n eval_equiv phi (ns_singl true) b b /\\\n exec_equiv phi phi c c\n ))\n (ensures (\n exec_equiv phi phi' (while b c) (while b c)\n ))\nlet d_div\n (b: exp bool)\n (c: computation)\n (phi phi' : sttype)\n: Lemma\n (requires (\n eval_equiv phi (ns_singl true) b b /\\\n exec_equiv phi phi c c\n ))\n (ensures (\n exec_equiv phi phi' (while b c) (while b c)\n ))\n= let f = reify_computation (while b c) in\n let e = reify_exp b in\n let e_rel : squash (eval_equiv phi (ns_singl true) b b) = () in\n let fc = reify_computation c in\n let f_rel : squash (exec_equiv_reified phi phi fc fc) = () in\n let rec prf\n (s0 s0' : heap)\n (fuel: nat)\n : Lemma\n (requires (holds phi s0 s0'))\n (ensures (fst (f fuel s0) == false))\n (decreases fuel)\n = let _ : squash (e s0 == (true, s0) /\\ e s0' == (true, s0')) =\n e_rel;\n ()\n in\n let k = fc fuel s0 in\n if fst k\n then\n let s1 = snd k in\n if fuel = 0\n then assert (fst (f fuel s0) == false)\n else begin\n assert (terminates_on fc s0);\n assert (terminates_on fc s0');\n let g\n (fuel' : nat)\n : Lemma\n (requires (fst (fc fuel' s0') == true))\n (ensures (fst (f fuel s0) == false))\n = let s1' = snd (fc fuel' s0') in\n assert (fc (fuel + fuel') s0 == fc fuel s0);\n assert (fc (fuel + fuel') s0' == fc fuel' s0');\n assert (f fuel s0 == f (fuel - 1) s1);\n let _ : squash (holds phi s1 s1') =\n f_rel;\n ()\n in\n prf s1 s1' (fuel - 1)\n in\n Classical.forall_intro (Classical.move_requires g)\n end else\n assert (fst (f fuel s0) == false)\n in\n Classical.forall_intro_3 (fun x y -> Classical.move_requires (prf x y))", "val bind_comp_reads_ok\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\nlet bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x l s0);\n assert (does_not_read_loc_v x l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()", "val bind_comp_reads_ok\n (#a #b: Type)\n (#w0 #r0 #w1 #r1: label)\n (#fs0 #fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\nlet bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f reads l s0))\n [SMTPat (does_not_read_loc f reads l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f reads l s0 k))\n [SMTPat (does_not_read_loc_v f reads l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x r0 l s0);\n assert (does_not_read_loc_v x r0 l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) r1 l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()", "val push_env_assoc (g1 g2 g3:env)\n : Lemma (requires disjoint g1 g2 /\\ disjoint g2 g3 /\\ disjoint g3 g1)\n (ensures push_env g1 (push_env g2 g3) == push_env (push_env g1 g2) g3)\nlet push_env_assoc g1 g2 g3 =\n L.append_assoc g3.bs g2.bs g1.bs;\n assert (equal (push_env g1 (push_env g2 g3)) (push_env (push_env g1 g2) g3))", "val rename_open (e: src_exp) (x: var{~(x `Set.mem` (freevars e))}) (y: var)\n : Lemma (rename (open_exp e x) x y == open_exp e y)\nlet rename_open (e:src_exp) (x:var { ~(x `Set.mem` freevars e) }) (y:var)\n : Lemma (rename (open_exp e x) x y == open_exp e y)\n = rename_open' x y e 0", "val sec42_ex1 (x y z: var)\n : Lemma\n (ensures\n (exec_equiv (gand (geq (gvar x Left) (gvar x Right))\n (geq (gop op_Addition (gvar y Left) (gconst 1)) (gvar x Right)))\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gvar z Left) (gvar z Right)))\n (assign z (eop op_Addition (evar y) (const 1)))\n (assign z (evar x))))\nlet sec42_ex1\n (x y z: var)\n: Lemma\n (ensures (\n exec_equiv\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gop op_Addition (gvar y Left) (gconst 1)) (gvar x Right)))\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gvar z Left) (gvar z Right)))\n (assign z (eop op_Addition (evar y) (const 1)))\n (assign z (evar x))\n ))\n= r_ass\n z\n z\n (eop op_Addition (evar y) (const 1))\n (evar x)\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gvar z Left) (gvar z Right)))", "val r_ass (x y: var) (e e': exp int) (p p': gexp bool)\n : Lemma\n (requires\n (included p (gsubst (gsubst p' x Left (exp_to_gexp e Left)) y Right (exp_to_gexp e' Right)))\n ) (ensures (exec_equiv p p' (assign x e) (assign y e')))\nlet r_ass\n (x y: var)\n (e e' : exp int)\n (p p': gexp bool)\n: Lemma\n (requires (\n included\n p\n (gsubst (gsubst p' x Left (exp_to_gexp e Left)) y Right (exp_to_gexp e' Right))\n ))\n (ensures (exec_equiv\n p\n p'\n (assign x e)\n (assign y e')\n ))\n= Benton2004.RHL.r_ass x y e e' p'", "val closed (s: src_exp) : b: bool{b <==> ((freevars s) `Set.equal` Set.empty)}\nlet rec closed (s:src_exp) \n : b:bool { b <==> (freevars s `Set.equal` Set.empty) }\n = match s with\n | EBool _\n | EBVar _ -> true\n | EVar m -> assert (m `Set.mem` freevars s); false\n | EIf b e1 e2 -> closed b && closed e1 && closed e2\n | ELam t e -> closed_ty t && closed e\n | EApp e1 e2 -> closed e1 && closed e2\n\nand closed_ty (t:src_ty)\n : b:bool { b <==> (freevars_ty t `Set.equal` Set.empty) }\n = match t with\n | TBool -> true\n | TRefineBool e -> closed e\n | TArrow t1 t2 -> closed_ty t1 && closed_ty t2", "val close_comp_ln' (c: comp) (x: var) (i: index)\n : Lemma (requires ln_c' c (i - 1)) (ensures ln_c' (close_comp' c x i) i)\nlet close_comp_ln' (c:comp)\n (x:var)\n (i:index)\n : Lemma \n (requires ln_c' c (i - 1))\n (ensures ln_c' (close_comp' c x i) i)\n = match c with\n | C_Tot t ->\n close_term_ln' t x i\n\n | C_ST s\n | C_STGhost s ->\n close_term_ln' s.res x i;\n close_term_ln' s.pre x i; \n close_term_ln' s.post x (i + 1)\n\n | C_STAtomic n _ s -> \n close_term_ln' n x i; \n close_term_ln' s.res x i;\n close_term_ln' s.pre x i; \n close_term_ln' s.post x (i + 1)", "val bind_wp_lem (#a #b #s: _) (f: m s a) (g: (a -> m s b))\n : Lemma (wp_of (bind_m f g) == bind_wp (wp_of f) (wp_of *. g))\nlet bind_wp_lem (#a:_) (#b:_) (#s:_) (f:m s a) (g: (a -> m s b))\n : Lemma (wp_of (bind_m f g) == bind_wp (wp_of f) (wp_of *. g))\n = bind_wp_lem' f g", "val sec42_ex4 (x y: var)\n : Lemma (requires (x <> y))\n (ensures\n (exec_equiv (geq (gvar y Left) (gvar y Right))\n (gand (geq (gvar x Left) (gvar x Right))\n (geq (gop op_Addition (gvar y Left) (gconst 1)) (gvar x Right)))\n (assign x (eop op_Addition (evar y) (const 1)))\n (assign x (eop op_Addition (evar y) (const 1)))))\nlet sec42_ex4\n (x y: var)\n: Lemma\n (requires (x <> y))\n (ensures (\n exec_equiv\n (geq (gvar y Left) (gvar y Right))\n (gand (geq (gvar x Left) (gvar x Right)) (geq (gop op_Addition (gvar y Left) (gconst 1)) (gvar x Right)))\n (assign x (eop op_Addition (evar y) (const 1)))\n (assign x (eop op_Addition (evar y) (const 1))) \n ))\n= sec42_ex2 x y;\n sec42_ex3 y", "val seq_inv_com' : env:label_fun -> c1:com -> c2:com -> l:label -> h0:heap ->\n Lemma (requires (ni_com env c1 l /\\ ni_com env c2 l))\n (ensures (inv_com' env (Seq c1 c2) l h0))\nlet seq_inv_com' env c1 c2 l h0 =\n match reify (interpret_com_st c1 h0) h0 with\n | None, _ -> seq_nil1 c1 c2 h0\n | Some (), h1 ->\n match reify (interpret_com_st c2 h1) h1 with\n | None, _ -> seq_nil2 c1 c2 h0 h1\n | Some (), h2 -> ()", "val g_bind (#a #b: _) (c: m a G) (f: (a -> m b G)) : m b G\nlet g_bind #a #b (c : m a G) (f : a -> m b G) : m b G = fun () -> f (c ()) ()", "val close_patterns_with_not_free_var (l: list (R.pattern & bool)) (x: var) (i: nat)\n : Lemma (requires ~(Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ND x i] == l)\n (decreases l)\nlet rec close_with_not_free_var (t:R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars t)))\n (ensures subst_term t [ ND x i ] == t)\n (decreases t) =\n\n match inspect_ln t with\n | Tv_Var _\n | Tv_BVar _\n | Tv_FVar _\n | Tv_UInst _ _ -> ()\n | Tv_App hd (arg, _) ->\n close_with_not_free_var hd x i;\n close_with_not_free_var arg x i\n | Tv_Abs b body ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var body x (i + 1)\n | Tv_Arrow b c ->\n close_binder_with_not_free_var b x i;\n close_comp_with_not_free_var c x (i + 1)\n | Tv_Type _ -> ()\n | Tv_Refine b t ->\n close_binder_with_not_free_var b x i;\n close_with_not_free_var t x (i + 1)\n | Tv_Const _ -> ()\n | Tv_Uvar _ _ -> assert False\n | Tv_Let recf attrs b e1 e2 ->\n close_terms_with_not_free_var attrs x i;\n close_binder_with_not_free_var b x i;\n (if recf then close_with_not_free_var e1 x (i + 1)\n else close_with_not_free_var e1 x i);\n close_with_not_free_var e2 x (i + 1)\n | Tv_Match scrutinee ret_opt brs ->\n close_with_not_free_var scrutinee x i;\n (match ret_opt with\n | None -> ()\n | Some ret -> close_match_returns_with_not_free_var ret x i);\n close_branches_with_not_free_var brs x i\n\n | Tv_AscribedT e t tacopt _ ->\n close_with_not_free_var e x i;\n close_with_not_free_var t x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_AscribedC e c tacopt _ ->\n close_with_not_free_var e x i;\n close_comp_with_not_free_var c x i;\n (match tacopt with\n | None -> ()\n | Some tac -> close_with_not_free_var tac x i)\n\n | Tv_Unknown -> ()\n | Tv_Unsupp -> ()\n\nand close_match_returns_with_not_free_var\n (r:match_returns_ascription)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_match_returns r)))\n (ensures subst_match_returns r [ ND x i ] == r)\n (decreases r) =\n\n let b, (ret, as_opt, _) = r in\n close_binder_with_not_free_var b x i;\n (match ret with\n | Inl t -> close_with_not_free_var t x (i + 1)\n | Inr c -> close_comp_with_not_free_var c x (i + 1));\n (match as_opt with\n | None -> ()\n | Some t -> close_with_not_free_var t x (i + 1))\n\nand close_branches_with_not_free_var\n (brs:list R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branches brs)))\n (ensures subst_branches brs [ ND x i ] == brs)\n (decreases brs) =\n\n match brs with\n | [] -> ()\n | hd::tl ->\n close_branch_with_not_free_var hd x i;\n close_branches_with_not_free_var tl x i\n\nand close_branch_with_not_free_var\n (br:R.branch)\n (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_branch br)))\n (ensures subst_branch br [ ND x i ] == br)\n (decreases br) =\n\n let p, t = br in\n close_pattern_with_not_free_var p x i;\n close_with_not_free_var t x (binder_offset_pattern p + i)\n \nand close_pattern_with_not_free_var (p:R.pattern) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_pattern p)))\n (ensures subst_pattern p [ ND x i ] == p)\n (decreases p) =\n\n match p with\n | Pat_Constant _ -> ()\n | Pat_Cons _ _ pats ->\n close_patterns_with_not_free_var pats x i\n | Pat_Var bv _ -> ()\n | Pat_Dot_Term topt ->\n (match topt with\n | None -> ()\n | Some t -> close_with_not_free_var t x i)\n\nand close_patterns_with_not_free_var (l:list (R.pattern & bool)) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_patterns l)))\n (ensures subst_patterns l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (p, _)::tl ->\n close_pattern_with_not_free_var p x i;\n close_patterns_with_not_free_var tl x (binder_offset_pattern p + i)\n\nand close_terms_with_not_free_var (l:list R.term) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_terms l)))\n (ensures subst_terms l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | hd::tl ->\n close_with_not_free_var hd x i;\n close_terms_with_not_free_var tl x i\n\nand close_binder_with_not_free_var (b:R.binder) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_binder b)))\n (ensures subst_binder b [ ND x i ] == b)\n (decreases b) =\n\n let {attrs; sort} = inspect_binder b in\n close_with_not_free_var sort x i;\n close_terms_with_not_free_var attrs x i\n\nand close_comp_with_not_free_var (c:R.comp) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_comp c)))\n (ensures subst_comp c [ ND x i ] == c)\n (decreases c) =\n\n match inspect_comp c with\n | C_Total t\n | C_GTotal t -> close_with_not_free_var t x i\n | C_Lemma pre post pats ->\n close_with_not_free_var pre x i;\n close_with_not_free_var post x i;\n close_with_not_free_var pats x i\n | C_Eff _ _ t args decrs ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var args x i;\n close_terms_with_not_free_var decrs x i\n\nand close_args_with_not_free_var (l:list R.argv) (x:var) (i:nat)\n : Lemma\n (requires ~ (Set.mem x (freevars_args l)))\n (ensures subst_args l [ ND x i ] == l)\n (decreases l) =\n\n match l with\n | [] -> ()\n | (t, _)::tl ->\n close_with_not_free_var t x i;\n close_args_with_not_free_var tl x i" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Typing.FV.fsti", "name": "Pulse.Typing.FV.st_typing_freevars_inv" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.fst", "name": "Pulse.Elaborate.elab_freevars_comp_eq" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_comp_with_not_free_var" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fst", "name": "Pulse.Syntax.Naming.close_comp_with_non_free_var" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fst", "name": "Pulse.Syntax.Naming.close_open_inverse_comp'" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_open_inverse'_comp" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.freevars_comp" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.bind_comp_pre" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_subst" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.freevars_open" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.mk_bind" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.open_exp_freevars" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.freevars_comp" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.free_in_context" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.free_in_context" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.rename_freevars" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fst", "name": "Pulse.Syntax.Naming.close_with_non_freevar_st" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.open_exp_freevars" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_weakening" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.open_ty_freevars" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.fst", "name": "Pulse.Elaborate.elab_comp_close_commute" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.freevars_comp_typ" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.elab_exp_freevars" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.close_exp_freevars" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.freevars_st_comp" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fst", "name": "Benton2004.RHL.r_cbl" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.free_in_context" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.open_close_inverse'_comp" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.bind_comp_out" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_with_not_free_var" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.fst", "name": "Pulse.Elaborate.elab_freevars_eq" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Common.fst", "name": "Pulse.Soundness.Common.elab_comp_close_commute" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.fst", "name": "Pulse.Elaborate.elab_freevars" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_binder_with_not_free_var" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.st_equiv_post" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_st_sub" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fsti", "name": "Pulse.Syntax.Naming.freevars_ascription" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.bind_comp_no_leakage" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.bind_comp_no_leakage" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_typing_freevars" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_bind" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.tsubst_comp" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.remove_binding" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.freevars_elab_ty" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.tsubst_commute_aux" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.faithful_lemma_comp" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.freevars_elab_exp" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.fst", "name": "Pulse.Elaborate.elab_comp_close_commute'" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.bind_comp_compatible" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.bind_comp_flows_ok" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.bind_comp_flows_ok" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.freevars_elab_ty" }, { "project_name": "FStar", "file_name": "HoareDiv.fst", "name": "HoareDiv.bind" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.freevars_elab_exp" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.elab_ty_freevars" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Util.fst", "name": "Strategies.GlobalVars.Util.free_pointer_doesnt_depend_on_gvars" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.check" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.rename_as_bindings_commute_1" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_args_with_not_free_var" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_open_inverse'_binder" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.non_informative_c_weakening" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.bind_comp" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.bind_comp" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.st_sub_weakening" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fst", "name": "Benton2004.RHL.d_lu1" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.rename_id" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.as_bindings_rename_env_append" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.Examples.fst", "name": "Benton2004.RHL.Examples.sec42_ex5" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.weaken_comp_inames" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.t_equiv" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.rename_as_bindings_commute" }, { "project_name": "FStar", "file_name": "LambdaOmega.fst", "name": "LambdaOmega.tsub_lam_comp" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.bind_wp_lem'" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.bind" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_terms_with_not_free_var" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Pointer.fst", "name": "Strategies.GlobalVars.Pointer.dereference_computation_doesnt_depend_on_global_variables" }, { "project_name": "Armada", "file_name": "Strategies.GlobalVars.Value.fst", "name": "Strategies.GlobalVars.Value.dereference_computation_doesnt_depend_on_global_variables" }, { "project_name": "steel", "file_name": "Pulse.Syntax.Naming.fst", "name": "Pulse.Syntax.Naming.close_open_inverse_ascription'" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.st_equiv_trans" }, { "project_name": "FStar", "file_name": "OPLSS2021.BasicState.fst", "name": "OPLSS2021.BasicState.bind" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_pattern_with_not_free_var" }, { "project_name": "hacl-star", "file_name": "Vale.Transformers.BoundedInstructionEffects.fst", "name": "Vale.Transformers.BoundedInstructionEffects.lemma_bounded_effects_series_aux2" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_open_inverse'" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.intro_comp_typing" }, { "project_name": "steel", "file_name": "Pulse.Soundness.fst", "name": "Pulse.Soundness.soundness_lemma" }, { "project_name": "FStar", "file_name": "Benton2004.DDCC.fst", "name": "Benton2004.DDCC.d_div" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.bind_comp_reads_ok" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.bind_comp_reads_ok" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.push_env_assoc" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.rename_open" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.Examples.fst", "name": "Benton2004.RHL.Examples.sec42_ex1" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.Examples.fst", "name": "Benton2004.RHL.Examples.r_ass" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.closed" }, { "project_name": "steel", "file_name": "Pulse.Typing.LN.fst", "name": "Pulse.Typing.LN.close_comp_ln'" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.bind_wp_lem" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.Examples.fst", "name": "Benton2004.RHL.Examples.sec42_ex4" }, { "project_name": "FStar", "file_name": "IfcRulesReify.fst", "name": "IfcRulesReify.seq_inv_com'" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.g_bind" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fst", "name": "FStar.Reflection.Typing.close_patterns_with_not_free_var" } ], "selected_premises": [ "Pulse.Typing.comp_post_matches_hint", "Pulse.Typing.Env.lookup", "Pulse.Typing.FV.tot_typing_freevars", "Pulse.Soundness.Common.tot_typing_soundness", "Pulse.Soundness.Common.comp_post_type", "Pulse.Typing.elab_env", "Pulse.Typing.FV.freevars_close_term'", "FStar.Printf.sprintf", "Pulse.Typing.universe_of", "Pulse.Soundness.Common.ghost_typing_soundness", "Pulse.Typing.subtyping_token", "Pulse.Typing.as_binder", "Pulse.Typing.tm_inames_subset_typing", "Pulse.Typing.tot_typing", "Pulse.Typing.tm_prop", "Pulse.Typing.post_hint_for_env_p", "FStar.Reflection.Typing.var_as_namedv", "Pulse.Typing.post_hint_for_env", "Pulse.Soundness.Common.elab_comp_post", "Pulse.Typing.FV.freevars_close_term_pairs'", "FStar.Reflection.V2.Data.var", "Pulse.Reflection.Util.mk_arrow", "Pulse.Typing.non_informative_t", "FStar.Reflection.Typing.sort_default", "Pulse.Typing.post_hint_opt", "Pulse.Typing.Env.equal", "Pulse.Typing.post_hint_typing", "Pulse.Reflection.Util.vprop_tm", "Pulse.Soundness.Common.bind_type", "Pulse.Soundness.Common.has_stt_bindings", "Pulse.Typing.FV.freevars_close_proof_hint'", "Pulse.Typing.FV.freevars_close_term_opt'", "Pulse.Typing.Env.contains", "Pulse.Typing.debug_log", "Pulse.Typing.FV.vars_of_rt_env", "Pulse.Typing.wr", "Pulse.Typing.fresh_wrt", "Pulse.Soundness.Common.post1_type_bind", "Pulse.Typing.comp_typing_u", "Pulse.Typing.Env.dom", "Pulse.Typing.wtag", "Pulse.Typing.tm_bool", "Pulse.Typing.non_informative_c", "Pulse.Reflection.Util.mk_pulse_lib_forall_lid", "FStar.Pervasives.Native.snd", "FStar.Printf.arg_type", "Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2", "Pulse.Soundness.Common.soundness_t", "Pulse.Typing.Env.env_extends", "Pulse.Typing.ghost_typing", "FStar.Pervasives.Native.fst", "Pulse.Reflection.Util.mk_pulse_lib_reference_lid", "FStar.Reflection.Typing.pp_name_t", "Pulse.Typing.extend_env_l", "Pulse.Typing.add_iname_at_least_unobservable", "Pulse.Typing.comp_withlocal_array_body_pre", "Pulse.Typing.FV.freevars_close_term_list'", "FStar.Heap.trivial_preorder", "Pulse.Typing.comp_intro_exists", "Pulse.Typing.comp_intro_pure", "Pulse.Typing.effect_annot_typing", "Pulse.Soundness.Common.bind_type_t1_t2", "Pulse.Soundness.Common.frame_type_t_pre_post_frame", "Pulse.Typing.prop_validity", "Pulse.Soundness.Common.frame_type_t_pre_post", "Pulse.Reflection.Util.mk_stt_comp", "FStar.ST.op_Bang", "Pulse.Typing.tm_unit", "Pulse.Soundness.Common.frame_type", "Pulse.Soundness.Common.post2_type_bind", "Pulse.Soundness.Common.bind_type_t1_t2_pre_post1", "Pulse.Typing.FV.freevars_close_term", "Pulse.Typing.Env.disjoint", "Pulse.Soundness.Common.g_type_bind", "Pulse.Soundness.Common.bind_type_t1", "Pulse.Typing.FV.vars_of_env_r", "Pulse.Typing.FV.tot_or_ghost_typing_freevars", "Pulse.Typing.Env.singleton_env", "FStar.Reflection.Typing.constant_as_term", "Pulse.Reflection.Util.mk_pulse_lib_core_lid", "Pulse.Reflection.Util.inv_disjointness_goal", "Pulse.Soundness.Common.frame_res", "FStar.String.strlen", "Pulse.Soundness.Common.bind_type_t1_t2_pre_post1_post2_f", "Pulse.Typing.freshv", "FStar.Reflection.V2.Data.ppname_t", "Pulse.Typing.FV.freevars_close_st_term", "Pulse.Reflection.Util.mk_observability_lid", "Pulse.Reflection.Util.tot_lid", "Pulse.Soundness.Common.sub_stt_post1", "FStar.Reflection.Typing.blob", "Pulse.Typing.Env.push_binding_def", "Pulse.Reflection.Util.mk_pulse_lib_array_core_lid", "Pulse.Typing.mk_vprop_eq", "FStar.Reflection.Typing.freevars_comp_typ", "Pulse.Typing.bind_comp_ghost_l_compatible", "FStar.Sealed.Inhabited.seal", "Pulse.Reflection.Util.binder_of_t_q_s", "Pulse.Typing.eff_of_ctag", "Pulse.Typing.lift_typing_to_ghost_typing" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Typing.FV\nmodule RT = FStar.Reflection.Typing\nmodule R = FStar.Reflection.V2\nmodule L = FStar.List.Tot\nopen FStar.List.Tot\nopen Pulse.Syntax\nopen Pulse.Typing\nopen Pulse.Elaborate\nopen Pulse.Soundness.Common\n\nlet vars_of_rt_env (g:R.env) = Set.intension (fun x -> Some? (RT.lookup_bvar g x))\n\nlet freevars_close_term_host_term (t:host_term) (x:var) (i:index)\n : Lemma\n (ensures (freevars (close_term' (tm_fstar t FStar.Range.range_0) x i)\n `Set.equal`\n (freevars (tm_fstar t FStar.Range.range_0) `set_minus` x)))\n = admit()\n\n#push-options \"--query_stats --z3rlimit_factor 2\"\nlet rec freevars_close_term' (e:term) (x:var) (i:index)\n : Lemma\n (ensures freevars (close_term' e x i) `Set.equal`\n (freevars e `set_minus` x))\n = match e.t with\n | Tm_Emp\n | Tm_VProp\n | Tm_Inames\n | Tm_EmpInames\n | Tm_Unknown -> ()\n\n | Tm_Inv p ->\n freevars_close_term' p x i\n | Tm_Pure p ->\n freevars_close_term' p x i\n\n | Tm_AddInv l r\n | Tm_Star l r ->\n freevars_close_term' l x i;\n freevars_close_term' r x i\n\n | Tm_ExistsSL _ t b\n | Tm_ForallSL _ t b ->\n freevars_close_term' t.binder_ty x i;\n freevars_close_term' b x (i + 1)\n\n | Tm_FStar t ->\n freevars_close_term_host_term t x i\n\nlet freevars_close_comp (c:comp)\n (x:var)\n (i:index)\n : Lemma\n (ensures freevars_comp (close_comp' c x i) `Set.equal`\n (freevars_comp c `set_minus` x))\n [SMTPat (freevars_comp (close_comp' c x i))]\n = match c with\n | C_Tot t ->\n freevars_close_term' t x i\n\n | C_ST s\n | C_STGhost s ->\n freevars_close_term' s.res x i;\n freevars_close_term' s.pre x i;\n freevars_close_term' s.post x (i + 1)\n\n | C_STAtomic n _ s ->\n freevars_close_term' n x i;\n freevars_close_term' s.res x i;\n freevars_close_term' s.pre x i;\n freevars_close_term' s.post x (i + 1)\n\nlet freevars_close_term_opt' (t:option term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_term_opt (close_term_opt' t x i) `Set.equal`\n (freevars_term_opt t `set_minus` x)))\n (decreases t)\n = match t with\n | None -> ()\n | Some t -> freevars_close_term' t x i\n\nlet rec freevars_close_term_list' (t:list term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_list (close_term_list' t x i) `Set.equal`\n (freevars_list t `set_minus` x)))\n (decreases t)\n = match t with\n | [] -> ()\n | hd::tl ->\n freevars_close_term' hd x i;\n freevars_close_term_list' tl x i\n\nlet rec freevars_close_term_pairs' (t:list (term & term)) (x:var) (i:index)\n : Lemma\n (ensures (freevars_pairs (close_term_pairs' t x i) `Set.equal`\n (freevars_pairs t `set_minus` x)))\n (decreases t)\n = match t with\n | [] -> ()\n | (u, v)::tl ->\n freevars_close_term' u x i;\n freevars_close_term' v x i;\n freevars_close_term_pairs' tl x i\n\nlet freevars_close_proof_hint' (ht:proof_hint_type) (x:var) (i:index)\n : Lemma\n (ensures (freevars_proof_hint (close_proof_hint' ht x i) `Set.equal`\n (freevars_proof_hint ht `set_minus` x)))\n = match ht with\n | ASSERT { p }\n | FOLD { p }\n | UNFOLD { p } ->\n freevars_close_term' p x i\n | RENAME { pairs; goal } ->\n freevars_close_term_pairs' pairs x i;\n freevars_close_term_opt' goal x i\n | REWRITE { t1; t2 } ->\n freevars_close_term' t1 x i;\n freevars_close_term' t2 x i\n | WILD\n | SHOW_PROOF_STATE _ -> ()\n\n// Needs a bit more rlimit sometimes. Also splitting is too expensive\n#push-options \"--z3rlimit 20 --split_queries no\"\nlet rec freevars_close_st_term' (t:st_term) (x:var) (i:index)\n : Lemma\n (ensures (freevars_st (close_st_term' t x i) `Set.equal`\n (freevars_st t `set_minus` x)))\n (decreases t)\n = match t.term with\n | Tm_Return { expected_type; term } ->\n freevars_close_term' expected_type x i;\n freevars_close_term' term x i\n\n | Tm_STApp { head; arg } ->\n freevars_close_term' head x i;\n freevars_close_term' arg x i\n\n | Tm_Abs { b; ascription=c; body } ->\n freevars_close_term' b.binder_ty x i;\n (\n match c.annotated with\n | None -> ()\n | Some c ->\n freevars_close_comp c x (i + 1)\n );\n (\n match c.elaborated with\n | None -> ()\n | Some c ->\n freevars_close_comp c x (i + 1)\n );\n freevars_close_st_term' body x (i + 1)\n\n | Tm_Bind { binder; head; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_st_term' head x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_TotBind { binder; head; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' head x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_If { b; then_; else_; post } ->\n freevars_close_term' b x i;\n freevars_close_st_term' then_ x i;\n freevars_close_st_term' else_ x i;\n freevars_close_term_opt' post x (i + 1)\n\n | Tm_Match _ ->\n admit ()\n\n | Tm_IntroPure { p }\n | Tm_ElimExists { p } ->\n freevars_close_term' p x i\n\n | Tm_IntroExists { p; witnesses } ->\n freevars_close_term' p x i;\n freevars_close_term_list' witnesses x i\n\n | Tm_While { invariant; condition; body } ->\n freevars_close_term' invariant x (i + 1);\n freevars_close_st_term' condition x i;\n freevars_close_st_term' body x i\n\n | Tm_Par { pre1; body1; post1; pre2; body2; post2 } ->\n freevars_close_term' pre1 x i;\n freevars_close_st_term' body1 x i;\n freevars_close_term' post1 x (i + 1);\n freevars_close_term' pre2 x i;\n freevars_close_st_term' body2 x i;\n freevars_close_term' post2 x (i + 1)\n\n | Tm_Rewrite { t1; t2 } ->\n freevars_close_term' t1 x i;\n freevars_close_term' t2 x i\n\n | Tm_WithLocal { binder; initializer; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' initializer x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_WithLocalArray { binder; initializer; length; body } ->\n freevars_close_term' binder.binder_ty x i;\n freevars_close_term' initializer x i;\n freevars_close_term' length x i;\n freevars_close_st_term' body x (i + 1)\n\n | Tm_Admit { typ; post } ->\n freevars_close_term' typ x i;\n freevars_close_term_opt' post x (i + 1)\n\n | Tm_Unreachable -> ()\n\n | Tm_ProofHintWithBinders { binders; hint_type; t } ->\n let n = L.length binders in\n freevars_close_proof_hint' hint_type x (i + n);\n freevars_close_st_term' t x (i + n)\n\n | Tm_WithInv { name; body; returns_inv } ->\n freevars_close_term' name x i;\n freevars_close_st_term' body x i;\n match returns_inv with\n | None -> ()\n | Some (b, r) ->\n freevars_close_term' b.binder_ty x i;\n freevars_close_term' r x (i + 1)\n#pop-options\n\nlet freevars_close_term (e:term) (x:var) (i:index)\n : Lemma\n (ensures freevars (close_term' e x i) `Set.equal`\n (freevars e `set_minus` x))\n = freevars_close_term' e x i\n\nlet freevars_close_st_term e x i = freevars_close_st_term' e x i\n\nlet contains_r (g:R.env) (x:var) = Some? (RT.lookup_bvar g x)\nlet vars_of_env_r (g:R.env) = Set.intension (contains_r g)\n\nassume\nval refl_typing_freevars (#g:R.env) (#e:R.term) (#t:R.term) (#eff:_)\n (_:RT.typing g e (eff, t))\n : Lemma\n (ensures RT.freevars e `Set.subset` (vars_of_env_r g) /\\\n RT.freevars t `Set.subset` (vars_of_env_r g))\n\nassume\nval refl_equiv_freevars (#g:R.env) (#e1 #e2:R.term) (d:RT.equiv g e1 e2)\n : Lemma (RT.freevars e1 `Set.subset` (vars_of_env_r g) /\\\n RT.freevars e2 `Set.subset` (vars_of_env_r g))\n\nlet freevars_open_term_inv (e:term)\n (x:var {~ (x `Set.mem` freevars e) })\n : Lemma\n (ensures freevars e `Set.equal` (freevars (open_term e x) `set_minus` x))\n [SMTPat (freevars (open_term e x))]\n = calc (==) {\n freevars e;\n (==) { close_open_inverse e x }\n freevars (close_term (open_term e x) x);\n (==) { freevars_close_term (open_term e x) x 0 }\n freevars (open_term e x) `set_minus` x;\n }\n\nassume\nval freevars_open_term (e:term) (x:term) (i:index)\n : Lemma (freevars (open_term' e x i) `Set.subset`\n (freevars e `Set.union` freevars x))\n [SMTPat (freevars (open_term' e x i))]\n\nassume\nval freevars_open_comp (c:comp) (x:term) (i:index)\n : Lemma\n (ensures\n freevars_comp (open_comp' c x i) `Set.subset`\n (freevars_comp c `Set.union` freevars x))\n [SMTPat (freevars_comp (open_comp' c x i))]\n\n#push-options \"--fuel 2 --ifuel 2\"\nlet tot_or_ghost_typing_freevars\n (#g:_) (#t:_) (#ty:_) (#eff:_)\n (d:typing g t eff ty)\n : Lemma\n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = elab_freevars t;\n elab_freevars ty;\n let E d = d in\n refl_typing_freevars d;\n assert (vars_of_env_r (elab_env g) `Set.equal` (vars_of_env g))\n\nlet tot_typing_freevars\n (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma\n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = tot_or_ghost_typing_freevars d\n", "sketch": [ "We will prove the lemma `bind_comp_freevars` by showing that the free variables of the bound computation `c` are a subset of the variables in the environment `g`. \n\nStep 1: We will first establish that the free variables of `c1` are a subset of the variables in the environment `g`.\nStep 2: Next, we will show that the free variables of `c2` are a subset of the union of the variables in the environment `g` and the singleton set containing the variable `x`.\nStep 3: Finally, we will conclude that the free variables of the bound computation `c` are a subset of the variables in the environment `g`.", "Step 1: We will first use the assumption `bind_comp` to obtain the typing environment `g`, the variable `x`, and the computations `c1`, `c2`, and `c`. We will also use the assumption to obtain the subset relations between the free variables of `c1` and `c2` and the variables in the environment `g` and the variable `x`.\n\nStep 2: Next, we will apply the subset relations obtained in step 1 to ensure that the free variables of the bound computation `c` are also a subset of the variables in the environment `g`. This will complete the proof for the lemma.", "Step 1: We will first assume the given preconditions for the bind_comp lemma, which state that the free variables of c1 are a subset of the variables in the environment g, and the free variables of c2 are a subset of the union of the variables in the environment g and the singleton set containing the variable x.\n\nStep 2: Next, we will use these preconditions to ensure that the free variables of the bound computation c are a subset of the variables in the environment g.", "Step 1: We will first apply the bind_comp lemma to obtain the typing derivation for c1 and c2, along with the binding of x in c. We will use the ensures clause of the bind_comp lemma to show that the free variables of c are a subset of the variables in the environment g.\nStep 2: We will then use the given assumptions about the free variables of c1 and c2 to show that their free variables are subsets of the environment g and the environment extended with the variable x, respectively.\nStep 3: Finally, we will combine the results from steps 1 and 2 to conclude that the free variables of c are indeed a subset of the variables in the environment g.", "Step 1: We will first apply the bind_comp lemma to obtain the typing derivation for c1 and c2, and then use the tot_or_ghost_typing_freevars lemma to ensure that the free variables of c1 and c2 are subsets of the environment variables and the union of environment variables and x, respectively.\nStep 2: Next, we will use the ensures clause of the bind_comp lemma to show that the free variables of the bound computation c are subsets of the environment variables.", "Step 1: We will start by applying the bind_comp lemma to obtain the typing derivation for c1 and c2, and then combine them to obtain the typing derivation for c. We will use the fact that the free variables of c1 and c2 are subsets of the environment variables g and the union of g and x, respectively.\n\nStep 2: We will then use the tot_or_ghost_typing_freevars lemma to ensure that the free variables of the resulting computation c are subsets of the environment variables g.", "Step 1: We will start by assuming the preconditions of the lemma, which state that the free variables of `c1` are a subset of the variables in the environment `g`, and the free variables of `c2` are a subset of the union of the variables in `g` and the singleton set containing `x`.\n\nStep 2: We will use the `bind_comp` definition to bind `c1` and `c2` to form `c`. This will involve substituting the free variables of `c1` with `c2` in the environment `g`.\n\nStep 3: We will then show that the free variables of the resulting `c` are a subset of the variables in the environment `g`.", "We will prove the lemma `bind_comp_freevars` by first assuming the preconditions and then ensuring the postcondition. \nStep 1: We assume that the free variables of `c1` are a subset of the variables in the environment `g`, and the free variables of `c2` are a subset of the union of variables in the environment `g` and the singleton set containing `x`.\nStep 2: We ensure that the free variables of the bound computation `c` are a subset of the variables in the environment `g`.", "Step 1: We will start by assuming the bind_comp function `bind_comp g x c1 c2 c` and its proof `d`. We will also assume that the free variables of `c1` are a subset of the variables in the environment `g`, and the free variables of `c2` are a subset of the union of variables in `g` and the singleton set containing `x`.\n\nStep 2: We will then ensure that the free variables of the resulting computation `c` are a subset of the variables in the environment `g`.", "Step 1: We will start by applying the bind_comp lemma to obtain the typing derivation for c1 and c2, and then use the tot_or_ghost_typing_freevars lemma to ensure that the free variables of c1 and c2 are subsets of the environment variables g and the union of g and x, respectively.\nStep 2: Next, we will use the ensures clause of the bind_comp lemma to show that the free variables of the bound computation c are subsets of the environment variables g." ], "generated_solution": [ "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "let bind_comp_freevars (g:_) (x:_) (c1:_) (c2:_) (c: _)\n (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "let bind_comp_freevars (g:_) (x:_) (c1:_) (c2:_) (c: _)\n (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))\n = \n bind_comp g x c1 c2 c d;\n tot_or_ghost_typing_freevars d", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "val bind_comp_freevars (#g #x #c1 #c2 #c: _) (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))", "let bind_comp_freevars (g:_) (x:_) (c1:_) (c2:_) (c: _)\n (d: bind_comp g x c1 c2 c)\n : Lemma\n (requires\n (freevars_comp c1) `Set.subset` (vars_of_env g) /\\\n (freevars_comp c2) `Set.subset` (Set.union (vars_of_env g) (Set.singleton x)))\n (ensures (freevars_comp c) `Set.subset` (vars_of_env g))" ] }, { "file_name": "BUGSLowParseWriters.fst", "name": "BUGSLowParseWriters.read_subcomp_spec_cond", "opens_and_abbrevs": [ { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n : GTot Type0", "source_definition": "let read_subcomp_spec_cond\n (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n: GTot Type0\n= (pre' ==> pre) /\\\n (forall x . (pre' /\\ post x) ==> post' x) /\\\n ((pre' /\\ post_err ()) ==> post_err' ())", "source_range": { "start_line": 124, "start_col": 0, "end_line": 131, "end_col": 42 }, "interleaved": false, "definition": "fun a pre post post_err pre' post' post_err' ->\n (pre' ==> pre) /\\ (forall (x: a). pre' /\\ post x ==> post' x) /\\\n (pre' /\\ post_err () ==> post_err' ())\n <:\n Prims.GTot Type0", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "Prims.pure_pre", "BUGSLowParseWriters.pure_post'", "BUGSLowParseWriters.pure_post_err", "Prims.l_and", "Prims.l_imp", "Prims.l_Forall" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": true, "type": "\n a: Type ->\n pre: Prims.pure_pre ->\n post: BUGSLowParseWriters.pure_post' a pre ->\n post_err: BUGSLowParseWriters.pure_post_err pre ->\n pre': Prims.pure_pre ->\n post': BUGSLowParseWriters.pure_post' a pre' ->\n post_err': BUGSLowParseWriters.pure_post_err pre'\n -> Prims.GTot Type0", "prompt": "let read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n : GTot Type0 =\n ", "expected_response": "(pre' ==> pre) /\\ (forall x. (pre' /\\ post x) ==> post' x) /\\\n((pre' /\\ post_err ()) ==> post_err' ())", "source": { "project_name": "FStar", "file_name": "examples/layeredeffects/BUGSLowParseWriters.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "BUGSLowParseWriters.fst", "checked_file": "dataset/BUGSLowParseWriters.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Pure.fst.checked" ] }, "definitions_in_context": [ "", "", "", "", "let memory_invariant : Type0 = nat", "result", "Correct", "Correct", "Correct", "Error", "Error", "Error", "let pure_post_err\n (pre: pure_pre)\n: Tot Type\n= unit (* squash pre *) -> GTot Type0", "let pure_post'\n (a: Type)\n (pre: pure_pre)\n: Tot Type\n= (x: a) -> GTot Type0", "let read_repr_spec (a:Type u#x) (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre) : Tot (Type u#x) =\n unit ->\n Ghost (result a)\n (requires pre)\n (ensures (fun res ->\n match res with\n | Correct v -> post v\n | Error _ -> post_err ()\n ))", "read_repr", "ReadRepr", "ReadRepr", "ReadRepr", "spec", "spec", "let read_return_spec\n (a:Type) (x:a)\n: Tot (read_repr_spec a True (fun res -> res == x) (fun _ -> False))\n= fun _ -> Correct x", "let read_return\n (a:Type) (x:a) (inv: memory_invariant)\n: Tot (read_repr a True (fun res -> res == x) (fun _ -> False) inv)\n= ReadRepr (read_return_spec a x)", "let read_bind_spec\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n: Tot (read_repr_spec b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n )\n= fun _ ->\n match f_bind_spec () with\n | Correct a -> g a ()\n | Error e -> Error e", "let read_bind\n (a:Type) (b:Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (l: memory_invariant)\n (f_bind : read_repr a pre_f post_f post_err_f l)\n (g : (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l))\n: Tot (read_repr b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n l\n )\n= ReadRepr (read_bind_spec a b pre_f post_f post_err_f pre_g post_g post_err_g (ReadRepr?.spec f_bind) (fun x -> ReadRepr?.spec (g x)))" ], "closest": [ "val read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n : GTot Type0\nlet read_subcomp_spec_cond\n (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n: GTot Type0\n= (pre' ==> pre) /\\\n (forall x . (pre' /\\ post x) ==> post' x) /\\\n ((pre' /\\ post_err ()) ==> post_err' ())", "val read_subcomp_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n (l l': memory_invariant)\n : GTot Type0\nlet read_subcomp_cond\n (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n (l: memory_invariant)\n (l' : memory_invariant)\n: GTot Type0\n= l `memory_invariant_includes` l' /\\\n read_subcomp_spec_cond a pre post post_err pre' post' post_err'", "val subcomp_spec_cond\n (a: Type)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (pre': pre_t r_in)\n (post': post_t a r_in r_out pre')\n (post_err': post_err_t r_in pre')\n : GTot Type0\nlet subcomp_spec_cond\n (a:Type)\n (r_in:parser) (r_out: parser)\n (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre)\n (pre': pre_t r_in) (post': post_t a r_in r_out pre') (post_err': post_err_t r_in pre')\n: GTot Type0\n= (forall v_in . pre' v_in ==> pre v_in) /\\\n (forall v_in x v_out . (pre' v_in /\\ post v_in x v_out) ==> post' v_in x v_out) /\\\n (forall v_in . (pre' v_in /\\ post_err v_in) ==> post_err' v_in)", "val read_subcomp_spec\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n (f_subcomp: read_repr_spec a pre post post_err)\n : Pure (read_repr_spec a pre' post' post_err')\n (requires (read_subcomp_spec_cond a pre post post_err pre' post' post_err'))\n (ensures (fun _ -> True))\nlet read_subcomp_spec (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n (f_subcomp:read_repr_spec a pre post post_err)\n: Pure (read_repr_spec a pre' post' post_err')\n (requires (read_subcomp_spec_cond a pre post post_err pre' post' post_err'))\n (ensures (fun _ -> True))\n= (fun x -> f_subcomp x)", "val subcomp_cond\n (a: Type)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (pre': pre_t r_in)\n (post': post_t a r_in r_out pre')\n (post_err': post_err_t r_in pre')\n (l l': memory_invariant)\n : GTot Type0\nlet subcomp_cond\n (a:Type)\n (r_in:parser) (r_out: parser)\n (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre)\n (pre': pre_t r_in) (post': post_t a r_in r_out pre') (post_err': post_err_t r_in pre')\n (l: memory_invariant)\n (l' : memory_invariant)\n: GTot Type0\n= l `memory_invariant_includes` l' /\\\n subcomp_spec_cond a r_in r_out pre post post_err pre' post' post_err'", "val read_subcomp\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n (l': memory_invariant)\n (f_subcomp: read_repr a pre post post_err l)\n : Pure (read_repr a pre' post' post_err' l')\n (requires (read_subcomp_cond a pre post post_err pre' post' post_err' l l'))\n (ensures (fun _ -> True))\nlet read_subcomp (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (l:memory_invariant)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n (l' : memory_invariant)\n (f_subcomp:read_repr a pre post post_err l)\n: Pure (read_repr a pre' post' post_err' l')\n (requires (read_subcomp_cond a pre post post_err pre' post' post_err' l l'))\n (ensures (fun _ -> True))\n= ReadRepr (read_subcomp_spec a pre post post_err pre' post' post_err' (ReadRepr?.spec f_subcomp))\n (read_subcomp_impl a pre post post_err pre' post' post_err' l l' (ReadRepr?.spec f_subcomp) (ReadRepr?.impl f_subcomp) ()\n )", "val read_subcomp_impl (a:Type)\n (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre)\n (pre': pure_pre) (post': pure_post' a pre') (post_err': pure_post_err pre')\n (l:memory_invariant)\n (l' : memory_invariant)\n (f_subcomp_spec:read_repr_spec a pre post post_err)\n (f_subcomp:read_repr_impl a pre post post_err l f_subcomp_spec)\n (sq: squash (read_subcomp_cond a pre post post_err pre' post' post_err' l l'))\n: Tot (read_repr_impl a pre' post' post_err' l' (read_subcomp_spec a pre post post_err pre' post' post_err' f_subcomp_spec))\nlet read_subcomp_impl\n a pre post post_err pre' post' post_err' l l' f_subcomp_spec f_subcomp sq\n=\n fun _ -> f_subcomp ()", "val subcomp_spec\n (a: Type)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (pre': pre_t r_in)\n (post': post_t a r_in r_out pre')\n (post_err': post_err_t r_in pre')\n (f_subcomp: repr_spec a r_in r_out pre post post_err)\n : Pure (repr_spec a r_in r_out pre' post' post_err')\n (requires (subcomp_spec_cond a r_in r_out pre post post_err pre' post' post_err'))\n (ensures (fun _ -> True))\nlet subcomp_spec (a:Type)\n (r_in:parser) (r_out: parser)\n (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre)\n (pre': pre_t r_in) (post': post_t a r_in r_out pre') (post_err': post_err_t r_in pre')\n (f_subcomp:repr_spec a r_in r_out pre post post_err)\n: Pure (repr_spec a r_in r_out pre' post' post_err')\n (requires (subcomp_spec_cond a r_in r_out pre post post_err pre' post' post_err'))\n (ensures (fun _ -> True))\n= (fun x -> f_subcomp x)", "val read_repr_spec\n (a: Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n : Tot (Type u#x)\nlet read_repr_spec (a:Type u#x) (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre) : Tot (Type u#x) =\n unit ->\n Ghost (result a)\n (requires pre)\n (ensures (fun res ->\n match res with\n | Correct v -> post v\n | Error _ -> post_err ()\n ))", "val subcomp\n (a: Type)\n (pre_f: pre_t)\n (post_f: post_t a)\n (pre_g: pre_t)\n (post_g: post_t a)\n (f: repr a pre_f post_f)\n : Pure (repr a pre_g post_g)\n (requires\n (forall (h: heap). pre_g h ==> pre_f h) /\\\n (forall (h0: heap) (h1: heap) (x: a). (pre_g h0 /\\ post_f h0 x h1) ==> post_g h0 x h1))\n (ensures fun _ -> True)\nlet subcomp (a:Type)\n (pre_f:pre_t) (post_f:post_t a)\n (pre_g:pre_t) (post_g:post_t a)\n (f:repr a pre_f post_f)\n: Pure (repr a pre_g post_g)\n (requires\n (forall (h:heap). pre_g h ==> pre_f h) /\\\n (forall (h0 h1:heap) (x:a). (pre_g h0 /\\ post_f h0 x h1) ==> post_g h0 x h1))\n (ensures fun _ -> True)\n= f", "val read_bind_spec\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g: (x: a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n : Tot\n (read_repr_spec b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ()))))\nlet read_bind_spec\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n: Tot (read_repr_spec b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n )\n= fun _ ->\n match f_bind_spec () with\n | Correct a -> g a ()\n | Error e -> Error e", "val subcomp\n (a: Type)\n ([@@@ refl_implicit]r_in [@@@ refl_implicit]r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n ([@@@ refl_implicit]l: memory_invariant)\n ([@@@ refl_implicit]r_in' [@@@ refl_implicit]r_out': parser)\n (pre': pre_t r_in')\n (post': post_t a r_in' r_out' pre')\n (post_err': post_err_t r_in' pre')\n ([@@@ refl_implicit]l': memory_invariant)\n ([@@@ refl_implicit]pr1: squash (r_in == r_in'))\n ([@@@ refl_implicit]pr2: squash (r_out == r_out'))\n (f_subcomp: repr a r_in r_out pre post post_err l)\n : Pure (repr a r_in' r_out' pre' post' post_err' l')\n (requires (subcomp_cond a r_in r_out pre post post_err pre' post' post_err' l l'))\n (ensures (fun _ -> True))\nlet subcomp (a:Type)\n ([@@@refl_implicit] r_in:parser)\n ([@@@ refl_implicit] r_out: parser)\n (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre)\n ([@@@ refl_implicit] l:memory_invariant)\n ([@@@refl_implicit] r_in':parser)\n ([@@@ refl_implicit] r_out': parser)\n (pre': pre_t r_in') (post': post_t a r_in' r_out' pre') (post_err': post_err_t r_in' pre')\n ([@@@ refl_implicit] l' : memory_invariant)\n ([@@@ refl_implicit] pr1:squash (r_in == r_in'))\n ([@@@ refl_implicit] pr2:squash (r_out == r_out'))\n (f_subcomp:repr a r_in r_out pre post post_err l)\n: Pure (repr a r_in' r_out' pre' post' post_err' l')\n (requires (subcomp_cond a r_in r_out pre post post_err pre' post' post_err' l l'))\n (ensures (fun _ -> True))\n= Repr (subcomp_spec a r_in r_out pre post post_err pre' post' post_err' (Repr?.spec f_subcomp))\n (subcomp_impl a r_in r_out pre post post_err l r_in' r_out' pre' post' post_err' l' (Repr?.spec f_subcomp) (Repr?.impl f_subcomp) ()\n )", "val read_repr_impl\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n (spec: read_repr_spec a pre post post_err)\n: Tot Type0\nlet read_repr_impl\n a pre post post_err l spec\n=\n unit ->\n HST.Stack (result a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n pre\n ))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == spec ()\n ))", "val subcomp\n (a: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (#pre_g: pre_t)\n (#post_g: post_t a)\n (f: repr a pre_f post_f)\n : Pure (repr a pre_g post_g)\n (requires\n (forall (h: heap). pre_g h ==> pre_f h) /\\\n (forall (h0: heap) (h1: heap) (x: a). (pre_g h0 /\\ post_f h0 x h1) ==> post_g h0 x h1))\n (ensures fun _ -> True)\nlet subcomp (a:Type)\n (#pre_f:pre_t) (#post_f:post_t a)\n (#pre_g:pre_t) (#post_g:post_t a)\n (f:repr a pre_f post_f)\n: Pure (repr a pre_g post_g)\n (requires\n (forall (h:heap). pre_g h ==> pre_f h) /\\\n (forall (h0 h1:heap) (x:a). (pre_g h0 /\\ post_f h0 x h1) ==> post_g h0 x h1))\n (ensures fun _ -> True)\n= f", "val repr_impl_post\n (a: Type u#x)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (spec: repr_spec a r_in r_out pre post post_err)\n (b: B.buffer u8 {l.lwrite `B.loc_includes` (B.loc_buffer b)})\n (pos1: U32.t{U32.v pos1 <= B.length b})\n (h: HS.mem)\n (res: iresult a)\n (h': HS.mem)\n : GTot Type0\nlet repr_impl_post\n (a:Type u#x)\n (r_in: parser)\n (r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (spec: repr_spec a r_in r_out pre post post_err)\n (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b })\n (pos1: U32.t { U32.v pos1 <= B.length b })\n (h: HS.mem)\n (res: iresult a)\n (h' : HS.mem)\n: GTot Type0\n= \n valid_pos r_in h b 0ul pos1 /\\\n B.modifies (B.loc_buffer b) h h' /\\ (\n let v_in = contents r_in h b 0ul pos1 in\n pre v_in /\\\n begin match spec v_in, res with\n | Correct (v, v_out), ICorrect v' pos2 ->\n U32.v pos1 <= U32.v pos2 /\\\n valid_pos (r_out) h' b 0ul pos2 /\\\n v' == v /\\\n v_out == contents (r_out) h' b 0ul pos2\n | Correct (v, v_out), IOverflow ->\n size (r_out) v_out > B.length b\n | Error s, IError s' ->\n s == s'\n | Error _, IOverflow ->\n (* overflow happened in implementation before specification could reach error *)\n True\n | _ -> False\n end\n )", "val lift_read_spec\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n : Tot\n (repr_spec a r (r) (fun _ -> pre) (fun st x st' -> st == st' /\\ post x) (fun _ -> post_err ()))\nlet lift_read_spec\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n: Tot (repr_spec a r (r)\n (fun _ -> pre) // (lift_read_pre pre r)\n (fun st x st' -> st == st' /\\ post x) // (lift_read_post a pre post r)\n (fun _ -> post_err ()) // (lift_read_post_err pre post_err r))\n )\n= fun st -> \n match ReadRepr?.spec f_read_spec () with\n | Correct res -> Correct (res, st)\n | Error e -> Error e", "val repr_spec\n (a: Type u#x)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n : Tot (Type u#x)\nlet repr_spec (a:Type u#x) (r_in: parser) (r_out: parser) (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre) : Tot (Type u#x) =\n (v_in: Parser?.t r_in) ->\n Ghost (result (a & Parser?.t r_out))\n (requires (pre v_in))\n (ensures (fun res ->\n match res with\n | Correct (v, v_out) -> post v_in v v_out /\\ size r_in v_in <= size r_out v_out\n | Error _ -> post_err v_in\n ))", "val subcomp_impl (a:Type)\n (r_in:parser) (r_out: parser)\n (pre: pre_t r_in) (post: post_t a r_in r_out pre) (post_err: post_err_t r_in pre)\n (l:memory_invariant)\n (r_in':parser) (r_out': parser) \n (pre': pre_t r_in) (post': post_t a r_in r_out pre') (post_err': post_err_t r_in pre')\n (l' : memory_invariant)\n (f_subcomp_spec:repr_spec a r_in r_out pre post post_err)\n (f_subcomp:repr_impl a r_in r_out pre post post_err l f_subcomp_spec)\n (sq: squash (subcomp_cond a r_in r_out pre post post_err pre' post' post_err' l l'))\n: Tot (repr_impl a r_in r_out pre' post' post_err' l' (subcomp_spec a r_in r_out pre post post_err pre' post' post_err' f_subcomp_spec))\nlet subcomp_impl\n a r_in r_out pre post post_err l r_in' r_out' pre' post' post_err' l' f_subcomp_spec f_subcomp sq\n: Tot (repr_impl a r_in r_out pre' post' post_err' l' (subcomp_spec a r_in r_out pre post post_err pre' post' post_err' f_subcomp_spec))\n= (fun b len pos -> f_subcomp b len pos)", "val destr_read_repr_spec\n (a: Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: (unit -> ERead a pre post post_err l))\n : Tot (read_repr_spec a pre post post_err)\nlet destr_read_repr_spec\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: unit -> ERead a pre post post_err l)\n: Tot (read_repr_spec a pre post post_err)\n= ReadRepr?.spec (reify (r ()))", "val subcomp\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: pre_t state)\n (ens_g: post_t state a)\n (f: repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\nlet subcomp\n (a:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:pre_t state)\n (ens_g:post_t state a)\n (f:repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\n =\n f", "val subcomp\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: pre_t state)\n (ens_g: post_t state a)\n (f: repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\nlet subcomp\n (a:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:pre_t state)\n (ens_g:post_t state a)\n (f:repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\n =\n f", "val bind_spec\n (a b: Type)\n (r_in_f r_out_f: parser)\n (pre_f: pre_t r_in_f)\n (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n (r_out_g: parser)\n (pre_g: (x: a -> pre_t (r_out_f)))\n (post_g: (x: a -> post_t b (r_out_f) r_out_g (pre_g x)))\n (post_err_g: (x: a -> post_err_t (r_out_f) (pre_g x)))\n (f_bind_spec: repr_spec a r_in_f r_out_f pre_f post_f post_err_f)\n (g: (x: a -> repr_spec b (r_out_f) r_out_g (pre_g x) (post_g x) (post_err_g x)))\n : Tot\n (repr_spec b\n r_in_f\n r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out. post_f v_in x v_out ==> pre_g x v_out))\n (fun v_in y v_out ->\n exists x v_out_f. pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out)\n (fun v_in ->\n pre_f v_in /\\\n (post_err_f v_in \\/ (exists x v_out_f. post_f v_in x v_out_f /\\ post_err_g x v_out_f))))\nlet bind_spec (a:Type) (b:Type)\n (r_in_f:parser) (r_out_f: parser)\n (pre_f: pre_t r_in_f) (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n (r_out_g: parser)\n (pre_g: (x:a) -> pre_t (r_out_f)) (post_g: (x:a) -> post_t b (r_out_f) r_out_g (pre_g x))\n (post_err_g: (x:a) -> post_err_t (r_out_f) (pre_g x))\n (f_bind_spec:repr_spec a r_in_f r_out_f pre_f post_f post_err_f)\n (g:(x:a -> repr_spec b (r_out_f) r_out_g (pre_g x) (post_g x) (post_err_g x)))\n: Tot (repr_spec b r_in_f r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out . post_f v_in x v_out ==> pre_g x v_out)) // (bind_pre a r_in_f r_out_f pre_f post_f pre_g)\n (fun v_in y v_out -> exists x v_out_f . pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out) // (bind_post a b r_in_f r_out_f pre_f post_f r_out_g pre_g post_g)\n (fun v_in -> \n pre_f v_in /\\ (\n post_err_f v_in \\/ (\n exists x v_out_f . post_f v_in x v_out_f /\\ post_err_g x v_out_f\n ))) // (bind_post_err a r_in_f r_out_f pre_f post_f post_err_f pre_g post_err_g))\n )\n= fun c ->\n match f_bind_spec c with\n | Correct (x, cf) ->\n g x cf\n | Error e -> Error e", "val subcomp\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: M.pre_t state)\n (ens_g: M.post_t state a)\n (f: repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\nlet subcomp\n (a:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:M.pre_t state)\n (ens_g:M.post_t state a)\n (f:repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\n =\n f", "val subcomp\n (a: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: M.pre_t state)\n (ens_g: M.post_t state a)\n (f: repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\nlet subcomp\n (a:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:M.pre_t state)\n (ens_g:M.post_t state a)\n (f:repr a state rel req_f ens_f)\n : Pure (repr a state rel req_g ens_g)\n (requires\n (forall s. req_g s ==> req_f s) /\\\n (forall s0 x s1. (req_g s0 /\\ ens_f s0 x s1) ==> ens_g s0 x s1))\n (ensures fun _ -> True)\n =\n f", "val subcomp\n (a: Type)\n (pre1: pre_t)\n (post1: post_t a)\n (labs1: list eff_label)\n (pre2: pre_t)\n (post2: post_t a)\n (labs2: list eff_label)\n (f: repr a pre1 post1 labs1)\n : Pure (repr a pre2 post2 labs2)\n (requires\n ((forall s0. pre2 s0 ==> pre1 s0) /\\ (forall s0 r s1. post1 s0 r s1 ==> post2 s0 r s1) /\\\n sublist labs1 labs2))\n (ensures (fun _ -> True))\nlet subcomp (a:Type)\n (pre1 : pre_t)\n (post1 : post_t a)\n (labs1 : list eff_label)\n (pre2 : pre_t)\n (post2 : post_t a)\n (labs2 : list eff_label)\n (f : repr a pre1 post1 labs1)\n : Pure (repr a pre2 post2 labs2)\n (requires ((forall s0. pre2 s0 ==> pre1 s0) /\\\n (forall s0 r s1. post1 s0 r s1 ==> post2 s0 r s1) /\\\n sublist labs1 labs2))\n (ensures (fun _ -> True))\n = f", "val lift_read\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n : Tot\n (repr a r (r) (fun _ -> pre) (fun st x st' -> st == st' /\\ post x) (fun _ -> post_err ()) inv)\nlet lift_read\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n: Tot (repr a r (r)\n (fun _ -> pre) // (lift_read_pre pre r)\n (fun st x st' -> st == st' /\\ post x) // (lift_read_post a pre post r)\n (fun _ -> post_err ()) // (lift_read_post_err pre post_err r))\n inv\n )\n= Repr (lift_read_spec a pre post post_err inv r f_read_spec) (lift_read_impl a pre post post_err inv r f_read_spec)", "val subcomp_pre:\n #a: Type ->\n #pre_f: pre_t ->\n #post_f: post_t a ->\n req_f: req_t pre_f ->\n ens_f: ens_t pre_f a post_f ->\n #pre_g: pre_t ->\n #post_g: post_t a ->\n req_g: req_t pre_g ->\n ens_g: ens_t pre_g a post_g ->\n #frame: vprop ->\n #pr: prop ->\n squash (can_be_split_dep pr pre_g (pre_f `star` frame)) ->\n squash (equiv_forall post_g (fun x -> (post_f x) `star` frame))\n -> pure_pre\nlet subcomp_pre (#a:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (#pre_g:pre_t) (#post_g:post_t a) (req_g:req_t pre_g) (ens_g:ens_t pre_g a post_g)\n (#frame:vprop)\n (#pr:prop)\n (_:squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (_:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n : pure_pre\n// The call to with_tactic allows us to reduce VCs in a controlled way, once all\n// uvars have been resolved.\n// To ensure an SMT-friendly encoding of the VC, it needs to be encapsulated in a squash call\n= T.rewrite_with_tactic vc_norm (squash (\n (forall (h0:hmem pre_g). req_g (mk_rmem pre_g h0) ==> pr /\\\n (can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0:hmem pre_g) (x:a) (h1:hmem (post_g x)). (\n pr ==> (\n can_be_split_trans (post_g x) (post_f x `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) (post_f x `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f) x (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_equalities frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame))\n\n ==> ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))\n ))\n))", "val subcomp_pre:\n #a: Type ->\n #pre_f: pre_t ->\n #post_f: post_t a ->\n req_f: req_t pre_f ->\n ens_f: ens_t pre_f a post_f ->\n #pre_g: pre_t ->\n #post_g: post_t a ->\n req_g: req_t pre_g ->\n ens_g: ens_t pre_g a post_g ->\n #frame: vprop ->\n #p: prop ->\n squash (can_be_split_dep p pre_g (pre_f `star` frame)) ->\n squash (equiv_forall post_g (fun x -> (post_f x) `star` frame))\n -> pure_pre\nlet subcomp_pre (#a:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (#pre_g:pre_t) (#post_g:post_t a) (req_g:req_t pre_g) (ens_g:ens_t pre_g a post_g)\n (#frame:vprop)\n (#p:prop)\n (_:squash (can_be_split_dep p pre_g (pre_f `star` frame)))\n (_:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n : pure_pre\n// The call to with_tactic allows us to reduce VCs in a controlled way, once all\n// uvars have been resolved.\n// To ensure an SMT-friendly encoding of the VC, it needs to be encapsulated in a squash call\n= T.rewrite_with_tactic vc_norm (squash (\n (forall (h0:hmem pre_g). req_g (mk_rmem pre_g h0) ==> p /\\\n (can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0:hmem pre_g) (x:a) (h1:hmem (post_g x)). (\n p ==> (\n can_be_split_trans (post_g x) (post_f x `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) (post_f x `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f) x (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_equalities frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame))\n\n ==> ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))\n ))\n))", "val subcomp (a: Type) (f_p: pre) (f_q: post a) (g_p: pre) (g_q: post a) (f: repr a f_p f_q)\n : Pure (repr a g_p g_q) (requires weaken_ok f_p f_q g_p g_q) (ensures fun _ -> True)\nlet subcomp (a:Type)\n (f_p:pre) (f_q:post a)\n (g_p:pre) (g_q:post a)\n (f:repr a f_p f_q)\n : Pure (repr a g_p g_q)\n (requires weaken_ok f_p f_q g_p g_q)\n (ensures fun _ -> True)\n = fun _ -> Weaken (f ())", "val repr_impl\n (a:Type u#x)\n (r_in: parser)\n (r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (spec: repr_spec a r_in r_out pre post post_err)\n: Tot Type0\nlet repr_impl\n (a:Type u#x)\n (r_in: parser)\n (r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (spec: repr_spec a r_in r_out pre post post_err)\n: Tot Type0 =\n (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) ->\n (len: U32.t { len == B.len b }) ->\n (pos1: buffer_offset b) ->\n HST.Stack (iresult a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n valid_pos r_in h b 0ul pos1 /\\\n pre (contents r_in h b 0ul pos1)\n ))\n (ensures (fun h res h' ->\n repr_impl_post a r_in r_out pre post post_err l spec b pos1 h res h'\n ))", "val subcomp\n (a: Type)\n (i1: idx)\n (pre: st_pre)\n (post: st_bpost a)\n (i2: idx)\n (pre': st_pre)\n (post': st_bpost a)\n (f: m a i1 pre post)\n : Pure (m a i2 pre' post')\n (requires (flows i1 i2 /\\ pre_leq pre pre' /\\ post_leq post post'))\n (ensures (fun _ -> True))\nlet subcomp (a:Type) (i1:idx) (pre : st_pre) (post : st_bpost a)\n (i2:idx) (pre' : st_pre) (post' : st_bpost a)\n (f : m a i1 pre post)\n : Pure (m a i2 pre' post')\n (requires (flows i1 i2 /\\ pre_leq pre pre' /\\ post_leq post post'))\n (ensures (fun _ -> True))\n = fun () -> f ()", "val subcomp\n (a: Type)\n (#framed_f #framed_g: eqtype_as_type bool)\n (#[@@@ framing_implicit]pre_f: pre_t)\n (#[@@@ framing_implicit]post_f: post_t a)\n (#[@@@ framing_implicit]pre_g: pre_t)\n (#[@@@ framing_implicit]post_g: post_t a)\n (#[@@@ framing_implicit]p1: squash (can_be_split pre_g pre_f))\n (#[@@@ framing_implicit]p2: squash (can_be_split_forall post_f post_g))\n (f: steelK a framed_f pre_f post_f)\n : Tot (steelK a framed_g pre_g post_g)\nlet subcomp (a:Type)\n (#framed_f:eqtype_as_type bool) (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] p1:squash (can_be_split pre_g pre_f))\n (#[@@@ framing_implicit] p2:squash (can_be_split_forall post_f post_g))\n (f:steelK a framed_f pre_f post_f)\n: Tot (steelK a framed_g pre_g post_g)\n= fun #frame #postf (k:(x:a -> SteelT unit (frame `star` post_g x) (fun _ -> postf))) ->\n change_slprop_imp pre_g pre_f ();\n f #frame #postf ((fun x -> change_slprop_imp (frame `star` post_f x) (frame `star` post_g x)\n (can_be_split_forall_frame post_f post_g frame x);\n k x) <: (x:a -> SteelT unit (frame `star` post_f x) (fun _ -> postf)))", "val read_bind\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n ([@@@ refl_implicit]l_f: memory_invariant)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr: squash (l_f == l_g))\n (f_bind: read_repr a pre_f post_f post_err_f l_f)\n (g: (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l_g))\n : Tot\n (read_repr b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ())))\n l_g)\nlet read_bind\n (a:Type) (b:Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n ([@@@ refl_implicit] l_f:memory_invariant)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr:squash (l_f == l_g))\n (f_bind : read_repr a pre_f post_f post_err_f l_f)\n (g : (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l_g))\n: Tot (read_repr b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n l_g\n )\n= ReadRepr _ (read_bind_impl a b pre_f post_f post_err_f pre_g post_g post_err_g (ReadRepr?.spec f_bind) (fun x -> ReadRepr?.spec (g x)) l_g (ReadRepr?.impl f_bind) (fun x -> ReadRepr?.impl (g x)) )", "val read_bind_impl\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_impl: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n (l: memory_invariant)\n (f' : read_repr_impl a pre_f post_f post_err_f l f_bind_impl)\n (g' : (x: a -> read_repr_impl b (pre_g x) (post_g x) (post_err_g x) l (g x)))\n: Tot (read_repr_impl b _ _ _ l (read_bind_spec a b pre_f post_f post_err_f pre_g post_g post_err_g f_bind_impl g))\nlet read_bind_impl\n a b pre_f post_f post_err_f pre_g post_g post_err_g f_bind_impl g l f' g'\n=\n fun _ ->\n match f' () with\n | Correct x -> g' x ()\n | Error e -> Error e", "val lift_read_impl\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (inv: memory_invariant)\n (r: parser)\n (f_read_spec: read_repr a pre post post_err inv)\n: Tot (repr_impl a r (r) _ _ _ inv (lift_read_spec a pre post post_err inv r f_read_spec))\nlet lift_read_impl\n a pre post post_err inv r f_read_spec\n=\n fun b len pos ->\n let h = HST.get () in\n match ReadRepr?.impl f_read_spec () with\n | Correct res -> \n let h' = HST.get () in\n valid_frame r h b 0ul pos B.loc_none h';\n ICorrect res pos\n | Error e ->\n IError e", "val mk_read_repr_impl\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n (spec: read_repr_spec a pre post post_err)\n (impl: (\n unit ->\n HST.Stack (result a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n pre\n ))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == spec ()\n ))\n ))\n: Tot (read_repr_impl a pre post post_err l spec)\nlet mk_read_repr_impl\n a pre post post_err l spec impl\n=\n impl", "val subcomp_pre_opaque:\n #a: Type ->\n #pre_f: pre_t ->\n #post_f: post_t a ->\n req_f: req_t pre_f ->\n ens_f: ens_t pre_f a post_f ->\n #pre_g: pre_t ->\n #post_g: post_t a ->\n req_g: req_t pre_g ->\n ens_g: ens_t pre_g a post_g ->\n #frame: vprop ->\n #pr: prop ->\n squash (can_be_split_dep pr pre_g (pre_f `star` frame)) ->\n squash (equiv_forall post_g (fun x -> (post_f x) `star` frame))\n -> pure_pre\nlet subcomp_pre_opaque (#a:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (#pre_g:pre_t) (#post_g:post_t a) (req_g:req_t pre_g) (ens_g:ens_t pre_g a post_g)\n (#frame:vprop) (#pr:prop)\n (_:squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (_:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n : pure_pre\n= (forall (h0:hmem pre_g). req_g (mk_rmem pre_g h0) ==> pr /\\ (\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0:hmem pre_g) (x:a) (h1:hmem (post_g x)). (\n pr ==> (\n can_be_split_trans (post_g x) (post_f x `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) (post_f x `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f) x (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_opaque frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame))\n\n ==> ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))\n ))", "val destr_read_repr_impl\n (a: Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: (unit -> ERead a pre post post_err l))\n : Tot (read_repr_impl a pre post post_err l (destr_read_repr_spec a pre post post_err l r))\nlet destr_read_repr_impl\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: unit -> ERead a pre post post_err l)\n: Tot (read_repr_impl a pre post post_err l (destr_read_repr_spec a pre post post_err l r))\n= ReadRepr?.impl (reify (r ()))", "val check_precond_spec (p1: parser) (precond: pre_t p1)\n : Tot\n (repr_spec unit\n p1\n (p1)\n precond\n (fun vin _ vout -> vin == vout /\\ precond vin)\n (fun vin -> ~(precond vin)))\nlet check_precond_spec\n (p1: parser)\n (precond: pre_t p1)\n: Tot (repr_spec unit p1 (p1) precond (fun vin _ vout -> vin == vout /\\ precond vin) (fun vin -> ~ (precond vin)))\n= fun vin ->\n if FStar.StrongExcludedMiddle.strong_excluded_middle (precond vin)\n then Correct ((), vin)\n else Error \"check_precond failed\"", "val stt (a:Type u#a) (pre:vprop) (post:a -> vprop) : Type0\nlet stt = I.stt", "val subcomp (a:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:pure_pre)\n (#[@@@ framing_implicit] ens_f:pure_post a)\n (#[@@@ framing_implicit] pre_g:pre_t)\n (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:pure_pre)\n (#[@@@ framing_implicit] ens_g:pure_post a)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n: Pure (repr a framed_g pre_g post_g req_g ens_g)\n (requires\n req_g ==> (req_f /\\ (forall x. ens_f x ==> ens_g x)))\n (ensures fun _ -> True)\nlet subcomp (a:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:Type0)\n (#[@@@ framing_implicit] ens_f:a -> Type0)\n (#[@@@ framing_implicit] pre_g:pre_t)\n (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:Type0)\n (#[@@@ framing_implicit] ens_g:a -> Type0)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _x1 : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] p1:squash (\n can_be_split pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (\n equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n : Pure (repr a framed_g pre_g post_g req_g ens_g)\n (requires\n req_g ==> (req_f /\\ (forall x. ens_f x ==> ens_g x)))\n (ensures fun _ -> True)\n = weaken_repr _ _ _ _ _ _ _ _\n (Steel.Effect.subcomp\n a\n #framed_f\n #framed_g\n #pre_f\n #post_f\n #(fun _ -> req_f)\n #(fun _ x _ -> ens_f x)\n #pre_g\n #post_g\n #(fun _ -> req_g)\n #(fun _ x _ -> ens_g x)\n #frame\n #_x1\n #True\n #p1\n #p2\n f)\n () ()", "val r_if_precond (b b': exp bool) (c c' d d': computation) (p p': gexp bool) : GTot (gexp bool)\nlet r_if_precond\n (b b': exp bool)\n (c c' d d' : computation)\n (p p' : gexp bool)\n: GTot (gexp bool)\n= gand p (geq (exp_to_gexp b Left) (exp_to_gexp b' Right))", "val subcomp\n (a: Type)\n ([@@@ refl_implicit]r_in_f r_out_f: parser)\n (l_f: memory_invariant)\n ([@@@ refl_implicit]r_in_g r_out_g: parser)\n (l_g: memory_invariant)\n ([@@@ refl_implicit]pr: squash (r_in_f == r_in_g))\n (f_subcomp: repr a r_in_f r_out_f l_f)\n : Pure (repr a r_in_g r_out_g l_g)\n (requires (l_f `memory_invariant_includes` l_g /\\ valid_rewrite_prop r_out_f r_out_g))\n (ensures (fun _ -> True))\nlet subcomp\n (a:Type)\n ([@@@ refl_implicit] r_in_f:parser)\n (r_out_f:parser)\n (l_f:memory_invariant)\n ([@@@ refl_implicit] r_in_g:parser)\n (r_out_g: parser)\n (l_g:memory_invariant)\n ([@@@ refl_implicit] pr:squash (r_in_f == r_in_g))\n (f_subcomp:repr a r_in_f r_out_f l_f)\n: Pure (repr a r_in_g r_out_g l_g)\n (requires (\n l_f `memory_invariant_includes` l_g /\\\n valid_rewrite_prop r_out_f r_out_g\n ))\n (ensures (fun _ -> True))\n= 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)", "val bind_pre\n (a: Type)\n (pre1: pre_t)\n (post1: post_t a)\n (b: Type)\n (pre2: (a -> pre_t))\n (post2: (a -> post_t b))\n : pre_t\nlet bind_pre\n (a:Type) (pre1:pre_t) (post1:post_t a)\n (b:Type) (pre2:a -> pre_t) (post2:a -> post_t b)\n : pre_t\n = fun s0 -> pre1 s0 /\\ (forall y s1. post1 s0 (Some y) s1 ==> pre2 y s1)", "val destr_repr_spec\n (a: Type u#x)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n ($f_destr_spec: (unit -> EWrite a r_in r_out pre post post_err l))\n : Tot (repr_spec a r_in r_out pre post post_err)\nlet destr_repr_spec\n (a:Type u#x)\n (r_in: parser)\n (r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n ($f_destr_spec: unit -> EWrite a r_in r_out pre post post_err l)\n: Tot (repr_spec a r_in r_out pre post post_err)\n= Repr?.spec (reify (f_destr_spec ()))", "val subcomp (a:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:req_t pre_f) (#[@@@ framing_implicit] ens_f:ens_t pre_f a post_f)\n (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:req_t pre_g) (#[@@@ framing_implicit] ens_g:ens_t pre_g a post_g)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] pr : prop)\n (#[@@@ framing_implicit] p1:squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n: Pure (repr a framed_g pre_g post_g req_g ens_g)\n (requires subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures fun _ -> True)\nlet subcomp a #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #fr #_ #pr #p1 #p2 f =\n lemma_subcomp_pre_opaque req_f ens_f req_g ens_g p1 p2;\n subcomp_opaque a #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #fr #pr #_ #p1 #p2 f", "val ( ^+^ )\n (#a #b: Type0)\n (#rel1: preorder a)\n (#rel2: preorder b)\n (r1: mref a rel1)\n (r2: mref b rel2)\n : GTot (set nat)\nlet op_Hat_Plus_Hat (#a:Type0) (#b:Type0) (#rel1:preorder a) (#rel2:preorder b) (r1:mref a rel1) (r2:mref b rel2)\n :GTot (set nat) = S.union (only r1) (only r2)", "val subcomp\n (a: Type)\n (#req_f: Type0)\n (ens_f: (a -> Type0))\n (#req_g: Type0)\n (ens_g: (a -> Type0))\n (f: repr a req_f ens_f)\n : Pure (repr a req_g ens_g)\n (requires (req_g ==> req_f) /\\ (forall (x: a). ens_f x ==> ens_g x))\n (ensures fun _ -> True)\nlet subcomp (a:Type)\n (#req_f:Type0) (ens_f:a -> Type0)\n (#req_g:Type0) (ens_g:a -> Type0)\n (f:repr a req_f ens_f)\n: Pure (repr a req_g ens_g)\n (requires\n (req_g ==> req_f) /\\\n (forall (x:a). ens_f x ==> ens_g x))\n (ensures fun _ -> True)\n= f", "val bind\n (a b: Type)\n (r_in_f [@@@ refl_implicit]r_out_f: parser)\n (pre_f: pre_t r_in_f)\n (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n ([@@@ refl_implicit]l_f: memory_invariant)\n ([@@@ refl_implicit]r_in_g r_out_g: parser)\n (pre_g: (x: a -> pre_t r_in_g))\n (post_g: (x: a -> post_t b r_in_g r_out_g (pre_g x)))\n (post_err_g: (x: a -> post_err_t r_in_g (pre_g x)))\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr: squash (l_f == l_g))\n ([@@@ refl_implicit]pr': squash (r_out_f == r_in_g))\n (f_bind: repr a r_in_f r_out_f pre_f post_f post_err_f l_f)\n (g: (x: a -> repr b (r_in_g) r_out_g (pre_g x) (post_g x) (post_err_g x) l_g))\n : Tot\n (repr b\n r_in_f\n r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out. post_f v_in x v_out ==> pre_g x v_out))\n (fun v_in y v_out ->\n exists x v_out_f. pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out)\n (fun v_in ->\n pre_f v_in /\\\n (post_err_f v_in \\/ (exists x v_out_f. post_f v_in x v_out_f /\\ post_err_g x v_out_f)))\n l_g)\nlet bind (a:Type) (b:Type)\n (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser)\n (pre_f: pre_t r_in_f) (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n ([@@@ refl_implicit] l_f: memory_invariant)\n ([@@@ refl_implicit] r_in_g:parser)\n (r_out_g: parser)\n (pre_g: (x:a) -> pre_t r_in_g) (post_g: (x:a) -> post_t b r_in_g r_out_g (pre_g x))\n (post_err_g: (x:a) -> post_err_t r_in_g (pre_g x))\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr:squash (l_f == l_g))\n ([@@@ refl_implicit] pr':squash (r_out_f == r_in_g))\n (f_bind : repr a r_in_f r_out_f pre_f post_f post_err_f l_f)\n (g : (x: a -> repr b (r_in_g) r_out_g (pre_g x) (post_g x) (post_err_g x) l_g))\n: Tot (repr b r_in_f r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out . post_f v_in x v_out ==> pre_g x v_out)) // (bind_pre a r_in_f r_out_f pre_f post_f pre_g)\n (fun v_in y v_out -> exists x v_out_f . pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out) // (bind_post a b r_in_f r_out_f pre_f post_f r_out_g pre_g post_g)\n (fun v_in -> \n pre_f v_in /\\ (\n post_err_f v_in \\/ (\n exists x v_out_f . post_f v_in x v_out_f /\\ post_err_g x v_out_f\n ))) // (bind_post_err a r_in_f r_out_f pre_f post_f post_err_f pre_g post_err_g))\n l_g\n )\n= Repr (bind_spec a b r_in_f r_out_f pre_f post_f post_err_f r_out_g pre_g post_g post_err_g (Repr?.spec f_bind) (fun x -> Repr?.spec (g x))) (bind_impl a b r_in_f r_out_f pre_f post_f post_err_f r_out_g pre_g post_g post_err_g (Repr?.spec f_bind) (fun x -> Repr?.spec (g x)) l_g (Repr?.impl f_bind) (fun x -> Repr?.impl (g x)))", "val size32_postcond\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (s: serializer p)\n (x: t)\n (y: U32.t)\n : GTot Type0\nlet size32_postcond\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (s: serializer p)\n (x: t)\n (y: U32.t)\n: GTot Type0\n= let sz = Seq.length (serialize s x) in\n if sz > U32.v u32_max\n then y == u32_max\n else U32.v y == sz", "val reify_read\n (a: Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: (unit -> ERead a pre post post_err l))\n : HST.Stack (result a)\n (requires\n (fun h ->\n B.modifies l.lwrite l.h0 h /\\ (HS.get_tip l.h0) `HS.includes` (HS.get_tip h) /\\ pre))\n (ensures\n (fun h res h' -> B.modifies B.loc_none h h' /\\ res == destr_read_repr_spec _ _ _ _ _ r ()))\nlet reify_read\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n ($r: unit -> ERead a pre post post_err l)\n: HST.Stack (result a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n pre\n ))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == destr_read_repr_spec _ _ _ _ _ r ()\n ))\n=\n extract_read_repr_impl _ _ _ _ _ _ (destr_read_repr_impl _ _ _ _ _ r)", "val r_if_precond_true (b b': exp bool) (c c' d d': computation) (p p': gexp bool) : GTot (gexp bool)\nlet r_if_precond_true\n (b b': exp bool)\n (c c' d d' : computation)\n (p p' : gexp bool)\n: GTot (gexp bool)\n= gand p (gand (exp_to_gexp b Left) (exp_to_gexp b' Right))", "val gaccessor_post'\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl: bytes)\n (res: nat)\n : GTot Type0\nlet gaccessor_post' \n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl : bytes)\n (res: nat)\n: GTot Type0\n= \n res <= Seq.length sl /\\\n (gaccessor_pre p1 p2 cl sl ==> gaccessor_post p1 p2 cl sl res)", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val extract_read_repr_impl\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n (spec: read_repr_spec a pre post post_err)\n (impl: read_repr_impl a pre post post_err l spec)\n: HST.Stack (result a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n pre\n ))\n (ensures (fun h res h' ->\n B.modifies B.loc_none h h' /\\\n res == spec ()\n ))\nlet extract_read_repr_impl\n a pre post post_err l spec impl\n=\n impl ()", "val sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\nlet sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\r\n= coerce_eq (conv pre1 pre2 post1 post2 pf1 pf2) e", "val bind_post\n (a: Type)\n (pre1: pre_t)\n (post1: post_t a)\n (b: Type)\n (pre2: (a -> pre_t))\n (post2: (a -> post_t b))\n : post_t b\nlet bind_post\n (a:Type) (pre1:pre_t) (post1:post_t a)\n (b:Type) (pre2:a -> pre_t) (post2:a -> post_t b)\n : post_t b\n = fun s0 z s2 -> (exists s1 y. post1 s0 (Some y) s1 /\\ post2 y s1 z s2)\n \\/ (post1 s0 None s2)", "val ac: r:retract_cond 'a 'b -> retract 'a 'b -> x:'a ->\n GTot (ceq ((MkC?.j2 r) (MkC?.i2 r x)) x)\nlet ac (MkC _ _ inv2) = inv2", "val repr (a:Type)\n (framed:bool)\n (pre:pre_t)\n (post:post_t a)\n (req:pure_pre)\n (ens:pure_post a)\n : Type u#2\nlet repr a framed pre post req ens : Type u#2 =\n Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ v _ -> ens v)", "val read_subcomp (a: Type) (l l': memory_invariant) (f_subcomp: read_repr a l)\n : Pure (read_repr a l') (requires (l `memory_invariant_includes` l')) (ensures (fun _ -> True))\nlet read_subcomp (a:Type)\n (l:memory_invariant)\n (l' : memory_invariant)\n (f_subcomp:read_repr a l)\n: Pure (read_repr a l')\n (requires (l `memory_invariant_includes` l'))\n (ensures (fun _ -> True))\n= read_reify_trivial (read_subcomp_conv a l l' f_subcomp ())", "val m (a: Type u#aa) (i: idx) (pre: st_pre) (post: st_bpost a) : Type0\nlet m (a:Type u#aa) (i:idx) (pre : st_pre) (post : st_bpost a): Type0 =\n unit -> ST a pre (real_post i post)", "val repr (a:Type u#a) //result type\n (already_framed:bool) //framed or not\n (opened_invariants:inames) //which invariants are we relying on\n (g:observability) //is this a ghost computation?\n (pre:pre_t) //expects vprop\n (post:post_t a) //provides a -> vprop\n (req:pure_pre) //a prop refinement as a precondition\n (ens:pure_post a) //an (a -> prop) as a postcondition\n : Type u#(max a 2)\nlet repr (a:Type u#a)\n (already_framed:bool)\n (opened_invariants:inames)\n (g:observability)\n (pre:pre_t)\n (post:post_t a)\n (req:Type0)\n (ens:a -> Type0)\n : Type u#(max a 2)\n = SEA.repr a already_framed opened_invariants g pre post\n (fun _ -> req)\n (fun _ x _ -> ens x)", "val bind_lpost\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (#b: Type)\n (#post_b: post_t st b)\n (lpost_b: (x: a -> l_post (post_a x) post_b))\n : l_post pre post_b\nlet bind_lpost\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (#b:Type)\n (#post_b:post_t st b)\n (lpost_b:(x:a -> l_post (post_a x) post_b))\n : l_post pre post_b\n =\n fun h0 y h2 -> lpre_a h0 /\\ (exists x h1. lpost_a h0 x h1 /\\ (lpost_b x) h1 y h2)", "val extract_t\n (#a: Type u#x)\n (#r_in #r_out: parser)\n (#pre: pre_t r_in)\n (#post: post_t a r_in r_out pre)\n (#post_err: post_err_t r_in pre)\n (l: memory_invariant)\n ($f_destr_spec: (unit -> EWrite a r_in r_out pre post post_err l))\n : Tot Type\nlet extract_t\n (#a:Type u#x)\n (#r_in: parser)\n (#r_out: parser)\n (#pre: pre_t r_in)\n (#post: post_t a r_in r_out pre)\n (#post_err: post_err_t r_in pre)\n (l: memory_invariant)\n ($f_destr_spec: unit -> EWrite a r_in r_out pre post post_err l)\n: Tot Type\n= \n (b: B.buffer u8 { l.lwrite `B.loc_includes` B.loc_buffer b }) ->\n (len: U32.t { len == B.len b }) ->\n (pos1: buffer_offset b) ->\n HST.Stack (iresult a)\n (requires (fun h ->\n B.modifies l.lwrite l.h0 h /\\\n HS.get_tip l.h0 `HS.includes` HS.get_tip h /\\\n valid_pos r_in h b 0ul pos1 /\\\n pre (contents r_in h b 0ul pos1)\n ))\n (ensures (fun h res h' ->\n valid_pos r_in h b 0ul pos1 /\\\n B.modifies (B.loc_buffer b) h h' /\\ (\n let v_in = contents r_in h b 0ul pos1 in\n pre v_in /\\\n begin match destr_repr_spec _ _ _ _ _ _ _ f_destr_spec v_in, res with\n | Correct (v, v_out), ICorrect v' pos2 ->\n U32.v pos1 <= U32.v pos2 /\\\n valid_pos (r_out) h' b 0ul pos2 /\\\n v' == v /\\\n v_out == contents (r_out) h' b 0ul pos2\n | Correct (v, v_out), IOverflow ->\n size (r_out) v_out > B.length b\n | Error s, IError s' ->\n s == s'\n | Error _, IOverflow ->\n (* overflow happened in implementation before specification could reach error *)\n True\n | _ -> False\n end\n )))", "val bind\n (a b: Type)\n (pre_f: pre_t)\n (post_f: post_t a)\n (pre_g: (a -> pre_t))\n (post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val r_if_precond_false (b b': exp bool) (c c' d d': computation) (p p': gexp bool)\n : GTot (gexp bool)\nlet r_if_precond_false\n (b b': exp bool)\n (c c' d d' : computation)\n (p p' : gexp bool)\n: GTot (gexp bool)\n= gand p (gnot (gor (exp_to_gexp b Left) (exp_to_gexp b' Right)))", "val join_comps\n (g_then:env)\n (e_then:st_term)\n (c_then:comp_st)\n (e_then_typing:st_typing g_then e_then c_then)\n (g_else:env)\n (e_else:st_term)\n (c_else:comp_st)\n (e_else_typing:st_typing g_else e_else c_else)\n (post:post_hint_t)\n: TacS (c:comp_st &\n st_typing g_then e_then c &\n st_typing g_else e_else c)\n (requires\n comp_post_matches_hint c_then (Some post) /\\\n comp_post_matches_hint c_else (Some post) /\\\n comp_pre c_then == comp_pre c_else)\n (ensures fun (| c, _, _ |) ->\n st_comp_of_comp c == st_comp_of_comp c_then /\\\n comp_post_matches_hint c (Some post))\nlet join_comps\n (g_then:env)\n (e_then:st_term)\n (c_then:comp_st)\n (e_then_typing:st_typing g_then e_then c_then)\n (g_else:env)\n (e_else:st_term)\n (c_else:comp_st)\n (e_else_typing:st_typing g_else e_else c_else)\n (post:post_hint_t)\n : TacS (c:comp_st &\n st_typing g_then e_then c &\n st_typing g_else e_else c)\n (requires\n comp_post_matches_hint c_then (Some post) /\\\n comp_post_matches_hint c_else (Some post) /\\\n comp_pre c_then == comp_pre c_else)\n (ensures fun (| c, _, _ |) ->\n st_comp_of_comp c == st_comp_of_comp c_then /\\\n comp_post_matches_hint c (Some post))\n= let g = g_then in\n assert (st_comp_of_comp c_then == st_comp_of_comp c_else);\n match c_then, c_else with\n | C_STAtomic _ obs1 _, C_STAtomic _ obs2 _ ->\n let obs = join_obs obs1 obs2 in\n let e_then_typing = T_Lift _ _ _ _ e_then_typing (Lift_Observability g_then c_then obs) in\n let e_else_typing = T_Lift _ _ _ _ e_else_typing (Lift_Observability g_else c_else obs) in\n (| _, e_then_typing, e_else_typing |)\n | _ -> \n (| _, e_then_typing, e_else_typing |)", "val gaccessor_post\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl: bytes)\n (res: nat)\n : GTot Type0\nlet gaccessor_post\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl: bytes)\n (res : nat)\n: GTot Type0\n= res <= Seq.length sl /\\\n begin match parse p1 sl with\n | Some (x1, consumed1) ->\n begin match parse p2 (Seq.slice sl res (Seq.length sl)) with\n | Some (x2, consumed2) ->\n cl.clens_cond x1 /\\\n x2 == cl.clens_get x1 /\\\n res + consumed2 <= consumed1\n | _ -> False\n end\n | _ -> False\n end", "val createL_pre (#a: Type0) (init: list a) : GTot Type0\nlet createL_pre (#a: Type0) (init: list a) : GTot Type0 =\n alloca_of_list_pre init", "val sec43'_postcond (x y: var) : GTot (gexp bool)\nlet sec43'_postcond\n (x y: var)\n: GTot (gexp bool)\n= gand\n (gop op_GreaterThan (gvar y Left) (gconst 2))\n (gop op_GreaterThan (gvar y Right) (gconst 2))", "val recast_writer_spec\n (a: Type u#x)\n (r_in r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (f: (unit -> EWrite a r_in r_out pre post post_err l))\n : Tot\n (repr_spec a\n r_in\n r_out\n pre\n (recast_writer_post a r_in r_out pre post post_err l f)\n (recast_writer_post_err a r_in r_out pre post post_err l f))\nlet recast_writer_spec\n (a:Type u#x)\n (r_in: parser)\n (r_out: parser)\n (pre: pre_t r_in)\n (post: post_t a r_in r_out pre)\n (post_err: post_err_t r_in pre)\n (l: memory_invariant)\n (f: unit -> EWrite a r_in r_out pre post post_err l)\n: Tot (repr_spec a r_in r_out pre (recast_writer_post a r_in r_out pre post post_err l f) (recast_writer_post_err a r_in r_out pre post post_err l f))\n= fun v_in -> destr_repr_spec a r_in r_out pre post post_err l f v_in", "val sub_stt (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt a pre1 post1)\n: stt a pre2 post2\nlet sub_stt = I.sub", "val check_precond_impl\n (p1: parser)\n (precond: pre_t p1)\n (c: check_precond_t p1 precond)\n (inv: memory_invariant)\n : Tot\n (repr_impl unit\n p1\n (p1)\n precond\n (fun vin _ vout -> vin == vout /\\ precond vin)\n (fun vin -> ~(precond vin))\n inv\n (check_precond_spec p1 precond))\nlet check_precond_impl\n (p1: parser)\n (precond: pre_t p1)\n (c: check_precond_t p1 precond)\n (inv: memory_invariant)\n: Tot (repr_impl unit p1 (p1) precond (fun vin _ vout -> vin == vout /\\ precond vin) (fun vin -> ~ (precond vin)) inv (check_precond_spec p1 precond))\n= fun b len pos ->\n let h = HST.get () in\n if c b len 0ul pos\n then\n let h' = HST.get () in\n let _ = valid_frame p1 h b 0ul pos B.loc_none h' in\n ICorrect () pos\n else IError \"check_precond failed\"", "val copy_buffer_contents_postcond\n (#t: typ)\n (a: buffer t)\n (idx_a: UInt32.t)\n (b: buffer t)\n (idx_b len: UInt32.t)\n (h h': HS.mem)\n : GTot Type0\nlet copy_buffer_contents_postcond\n (#t: typ)\n (a: buffer t) (* source *)\n (idx_a: UInt32.t)\n (b: buffer t) (* destination *)\n (idx_b: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n (h' : HS.mem)\n: GTot Type0\n= copy_buffer_contents_precond a idx_a b idx_b len h /\\\n modifies (loc_buffer (gsub_buffer b idx_b len)) h h' /\\\n buffer_readable h' (gsub_buffer b idx_b len) /\\\n buffer_as_seq h' (gsub_buffer b idx_b len) == buffer_as_seq h (gsub_buffer a idx_a len)", "val injective_postcond (#t: Type) (p: bare_parser t) (b1 b2: bytes) : GTot Type0\nlet injective_postcond\n (#t: Type)\n (p: bare_parser t)\n (b1 b2: bytes)\n: GTot Type0\n= Some? (parse p b1) /\\\n Some? (parse p b2) /\\ (\n let (Some (v1, len1)) = parse p b1 in\n let (Some (v2, len2)) = parse p b2 in\n (len1 <: nat) == (len2 <: nat) /\\\n Seq.slice b1 0 len1 == Seq.slice b2 0 len2\n )", "val lemma_subcomp_pre_opaque_aux1\n (#a: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (req_f: req_t pre_f)\n (ens_f: ens_t pre_f a post_f)\n (#pre_g: pre_t)\n (#post_g: post_t a)\n (req_g: req_t pre_g)\n (ens_g: ens_t pre_g a post_g)\n (#frame: vprop)\n (#pr: prop)\n (p1: squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (p2: squash (equiv_forall post_g (fun x -> (post_f x) `star` frame)))\n : Lemma (requires subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures\n ((forall (h0: hmem pre_g).\n req_g (mk_rmem pre_g h0) ==>\n pr /\\\n (can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0: hmem pre_g) (x: a) (h1: hmem (post_g x)).\n (pr ==>\n (can_be_split_trans (post_g x) ((post_f x) `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) ((post_f x) `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f)\n x\n (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_equalities frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame)) ==>\n ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))))))\nlet lemma_subcomp_pre_opaque_aux1 (#a:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (#pre_g:pre_t) (#post_g:post_t a) (req_g:req_t pre_g) (ens_g:ens_t pre_g a post_g)\n (#frame:vprop)\n (#pr:prop)\n (p1:squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n : Lemma\n (requires subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures (\n (forall (h0:hmem pre_g). req_g (mk_rmem pre_g h0) ==> pr /\\ (\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0:hmem pre_g) (x:a) (h1:hmem (post_g x)). (\n pr ==> (\n\n can_be_split_trans (post_g x) (post_f x `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) (post_f x `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f) x (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_equalities frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame))\n\n ==> ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))\n ))))\n = lemma_rewrite (squash (\n (forall (h0:hmem pre_g). req_g (mk_rmem pre_g h0) ==> pr /\\ (\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n req_f (focus_rmem (mk_rmem pre_g h0) pre_f))) /\\\n (forall (h0:hmem pre_g) (x:a) (h1:hmem (post_g x)). (\n pr ==> (\n can_be_split_trans (post_g x) (post_f x `star` frame) (post_f x);\n can_be_split_trans (pre_g) (pre_f `star` frame) frame;\n can_be_split_trans (post_g x) (post_f x `star` frame) frame;\n can_be_split_trans pre_g (pre_f `star` frame) pre_f;\n\n (req_g (mk_rmem pre_g h0) /\\\n ens_f (focus_rmem (mk_rmem pre_g h0) pre_f) x (focus_rmem (mk_rmem (post_g x) h1) (post_f x)) /\\\n frame_equalities frame\n (focus_rmem (mk_rmem pre_g h0) frame)\n (focus_rmem (mk_rmem (post_g x) h1) frame))\n\n ==> ens_g (mk_rmem pre_g h0) x (mk_rmem (post_g x) h1))\n ))\n ))", "val stt_ghost\n (a:Type u#a)\n (pre:vprop)\n (post:a -> vprop)\n: Type u#(max 2 a)\nlet stt_ghost = A.stt_ghost", "val subcomp (a:Type)\n (opened_invariants:inames)\n (o1:eqtype_as_type observability)\n (o2:eqtype_as_type observability)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:pure_pre)\n (#[@@@ framing_implicit] ens_f:pure_post a)\n (#[@@@ framing_implicit] pre_g:pre_t)\n (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:pure_pre)\n (#[@@@ framing_implicit] ens_g:pure_post a)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f opened_invariants o1 pre_f post_f req_f ens_f)\n: Pure (repr a framed_g opened_invariants o2 pre_g post_g req_g ens_g)\n (requires\n (o1 = Unobservable || o2 = Observable) /\\\n (req_g ==> (req_f /\\ (forall x. ens_f x ==> ens_g x))))\n (ensures fun _ -> True)\nlet subcomp (a:Type)\n (opened_invariants:inames)\n (o1:eqtype_as_type observability)\n (o2:eqtype_as_type observability)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:Type0)\n (#[@@@ framing_implicit] ens_f:a -> Type0)\n (#[@@@ framing_implicit] pre_g:pre_t)\n (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:Type0)\n (#[@@@ framing_implicit] ens_g:a -> Type0)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _x : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] p1:squash (can_be_split pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f opened_invariants o1 pre_f post_f req_f ens_f)\n : Pure (repr a framed_g opened_invariants o2 pre_g post_g req_g ens_g)\n (requires\n (o1 = Unobservable || o2 = Observable) /\\\n (req_g ==> (req_f /\\ (forall x. ens_f x ==> ens_g x))))\n (ensures fun _ -> True)\n = weaken_repr (SEA.subcomp a opened_invariants o1 o2\n #framed_f\n #framed_g\n #pre_f\n #post_f\n #(fun _ -> req_f)\n #(fun _ x _ -> ens_f x)\n #pre_g\n #post_g\n #(fun _ -> req_g)\n #(fun _ y _ -> ens_g y)\n #frame\n #_x\n #True\n #p1\n #p2\n f) () ()", "val gen_elim_pred\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: (Ghost.erased a -> Tot vprop))\n (post: (Ghost.erased a -> Tot prop))\n (ij: (gen_elim_i & gen_elim_nondep_t))\n : Tot prop\nlet gen_elim_pred\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (ij: (gen_elim_i & gen_elim_nondep_t))\n: Tot prop\n= let (i, j) = ij in\n p == compute_gen_elim_p i /\\\n check_gen_elim_nondep_sem i j /\\ \n a == compute_gen_elim_nondep_a i j /\\\n post == compute_gen_elim_nondep_post i j /\\\n q == compute_gen_elim_nondep_q i j", "val read_subcomp_conv:\n a: Type ->\n l: memory_invariant ->\n l': memory_invariant ->\n f_subcomp: read_repr a l ->\n sq: squash (l `memory_invariant_includes` l') ->\n Prims.unit\n -> ERead a True (fun _ -> True) (fun _ -> True) l'\nlet read_subcomp_conv (a:Type)\n (l:memory_invariant)\n (l' : memory_invariant)\n (f_subcomp:read_repr a l)\n (sq: squash (l `memory_invariant_includes` l'))\n ()\n: ERead a True (fun _ -> True) (fun _ -> True) l'\n= let x = ERead?.reflect f_subcomp in\n x", "val subcomp (a:Type)\n (opened_invariants:inames)\n (o1:eqtype_as_type observability)\n (o2:eqtype_as_type observability)\n (#framed_f: eqtype_as_type bool)\n (#framed_g: eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:req_t pre_f) (#[@@@ framing_implicit] ens_f:ens_t pre_f a post_f)\n (#[@@@ framing_implicit] pre_g:pre_t) (#[@@@ framing_implicit] post_g:post_t a)\n (#[@@@ framing_implicit] req_g:req_t pre_g) (#[@@@ framing_implicit] ens_g:ens_t pre_g a post_g)\n (#[@@@ framing_implicit] frame:vprop)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame))\n (#[@@@ framing_implicit] p: prop)\n (#[@@@ framing_implicit] p1:squash (can_be_split_dep p pre_g (pre_f `star` frame)))\n (#[@@@ framing_implicit] p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n (f:repr a framed_f opened_invariants o1 pre_f post_f req_f ens_f)\n: Pure (repr a framed_g opened_invariants o2 pre_g post_g req_g ens_g)\n (requires (o1 = Unobservable || o2 = Observable) /\\\n subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures fun _ -> True)\nlet subcomp a opened o1 o2 #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #fr #_ #pr #p1 #p2 f =\n lemma_subcomp_pre_opaque req_f ens_f req_g ens_g p1 p2;\n subcomp_opaque a opened o1 o2 #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #fr #pr #_ #p1 #p2 f", "val lemma_subcomp_pre_opaque\n (#a: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (req_f: req_t pre_f)\n (ens_f: ens_t pre_f a post_f)\n (#pre_g: pre_t)\n (#post_g: post_t a)\n (req_g: req_t pre_g)\n (ens_g: ens_t pre_g a post_g)\n (#frame: vprop)\n (#pr: prop)\n (p1: squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (p2: squash (equiv_forall post_g (fun x -> (post_f x) `star` frame)))\n : Lemma (requires subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures subcomp_pre_opaque req_f ens_f req_g ens_g p1 p2)\nlet lemma_subcomp_pre_opaque (#a:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (#pre_g:pre_t) (#post_g:post_t a) (req_g:req_t pre_g) (ens_g:ens_t pre_g a post_g)\n (#frame:vprop)\n (#pr : prop)\n (p1:squash (can_be_split_dep pr pre_g (pre_f `star` frame)))\n (p2:squash (equiv_forall post_g (fun x -> post_f x `star` frame)))\n : Lemma\n (requires subcomp_pre req_f ens_f req_g ens_g p1 p2)\n (ensures subcomp_pre_opaque req_f ens_f req_g ens_g p1 p2)\n = lemma_subcomp_pre_opaque_aux1 req_f ens_f req_g ens_g p1 p2;\n lemma_subcomp_pre_opaque_aux2 req_f ens_f req_g ens_g p1 p2", "val tac_subcomp (a: Type) (wp_f wp_g: tac_wp_t a) (f: tac_repr a wp_f)\n : Pure (tac_repr a wp_g) (requires forall ps p. wp_g ps p ==> wp_f ps p) (ensures fun _ -> True)\nlet tac_subcomp (a:Type)\n (wp_f:tac_wp_t a)\n (wp_g:tac_wp_t a)\n (f:tac_repr a wp_f)\n : Pure (tac_repr a wp_g)\n (requires forall ps p. wp_g ps p ==> wp_f ps p)\n (ensures fun _ -> True)\n = f", "val grifthenelse\n (#h0: HS.mem)\n (#sout:\n slice (srel_of_buffer_srel (B.trivial_preorder _))\n (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (#t: Type)\n (cond: bool)\n (grtrue: (squash (cond == true) -> Tot (greader h0 sout pout_from0 t)))\n (grfalse: (squash (cond == false) -> Tot (greader h0 sout pout_from0 t)))\n : Tot\n (r':\n greader h0 sout pout_from0 t\n {grvalue r' == (if cond then grvalue (grtrue ()) else grvalue (grfalse ()))})\nlet grifthenelse\n (#h0: HS.mem) \n (#sout: slice (srel_of_buffer_srel (B.trivial_preorder _)) (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (#t: Type)\n (cond: bool)\n (grtrue: (squash (cond == true) -> Tot (greader h0 sout pout_from0 t)))\n (grfalse: (squash (cond == false) -> Tot (greader h0 sout pout_from0 t)))\n: Tot (r' : greader h0 sout pout_from0 t { grvalue r' == (if cond then grvalue (grtrue ()) else grvalue (grfalse ())) } )\n= GReader (Ghost.hide (if cond then grvalue (grtrue ()) else grvalue (grfalse ()))) (fun _ ->\n if cond then gread (grtrue ()) else gread (grfalse ())\n )", "val conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\nlet conv (#a:Type u#a)\r\n (pre1:slprop)\r\n (pre2:slprop)\r\n (post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n: Lemma (stt a pre1 post1 == stt a pre2 post2)\r\n= slprop_equiv_elim pre1 pre2;\r\n introduce forall x. post1 x == post2 x\r\n with slprop_equiv_elim (post1 x) (post2 x);\r\n Sem.conv #state a #pre1 #(F.on_dom _ post1) (F.on_dom _ post2);\r\n ()", "val copy_buffer_contents_postcond' (#t: typ) (a b: buffer t) (h h': HS.mem) : GTot Type0\nlet copy_buffer_contents_postcond'\n (#t: typ)\n (a: buffer t) (* source *)\n (b: buffer t) (* destination *)\n (h: HS.mem)\n (h' : HS.mem)\n: GTot Type0\n= copy_buffer_contents_precond' a b h /\\\n modifies (loc_buffer b) h h' /\\\n buffer_readable h' b /\\\n buffer_as_seq h' b == buffer_as_seq h a", "val gaccessor_pre\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl: bytes)\n : GTot Type0\nlet gaccessor_pre\n (#k1: parser_kind)\n (#t1: Type)\n (p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (p2: parser k2 t2)\n (cl: clens t1 t2)\n (sl: bytes)\n: GTot Type0\n= match parse p1 sl with\n | Some (x1, _) -> cl.clens_cond x1\n | _ -> False", "val Prims.pure_post' = a: Type -> pre: Type -> Type\nlet pure_post' (a pre: Type) = _: a{pre} -> GTot Type0", "val bind\n (a b: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (#pre_g: (a -> pre_t))\n (#post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val trivial_pure_post (a: Type) : pure_post a\nlet trivial_pure_post (a: Type) : pure_post a = fun _ -> True", "val size32_sum_gen_precond (kt k: parser_kind) : GTot Type0\nlet size32_sum_gen_precond\n (kt: parser_kind)\n (k: parser_kind)\n: GTot Type0\n= kt.parser_kind_subkind == Some ParserStrong /\\\n Some? kt.parser_kind_high /\\\n Some? k.parser_kind_high /\\ (\n let (Some vt) = kt.parser_kind_high in\n let (Some v) = k.parser_kind_high in\n vt + v < 4294967295\n )", "val stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\nlet stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\r\n= lower (Sem.m u#2 u#100 u#a #state a pre (F.on_dom a post))", "val read : #a:Type ->\n #r:preorder a ->\n\t m:mref a r ->\n\t MRefST a (fun _ -> True)\n (fun h0 x h1 -> h0 == h1 /\\\n\t\t contains m h1 /\\\n\t\t\t\t sel h1 m == x)\nlet read #a #r m =\n let h = ist_get () in\n ist_recall (contains m); //recalling that the current heap must contain the given reference\n sel h m", "val sub_ghost\n (#a:Type u#a)\n (#pre1:vprop)\n (pre2:vprop)\n (#post1:a -> vprop)\n (post2:a -> vprop)\n (pf1 : vprop_equiv pre1 pre2)\n (pf2 : vprop_post_equiv post1 post2)\n (e:stt_ghost a pre1 post1)\n: stt_ghost a pre2 post2\nlet sub_ghost = A.sub_ghost", "val bind_explicit_univs\n (a b: Type u#a)\n (pre_f: pre_t)\n (post_f: post_t a)\n (req_f: req_t pre_f)\n (ens_f: ens_t pre_f a post_f)\n (post_g: post_t b)\n (req_g: (x: a -> req_t (post_f x)))\n (ens_g: (x: a -> ens_t (post_f x) b post_g))\n (f: repr a pre_f post_f req_f ens_f)\n (g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n : repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g)\nlet bind_explicit_univs (a:Type u#a) (b:Type u#a)\n (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))\n (f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n: repr u#a b pre_f post_g\n (Sem.bind_lpre req_f ens_f req_g)\n (Sem.bind_lpost req_f ens_f ens_g)\n= Sem.Bind f g", "val subcomp (a: Type) (wp_f wp_g: wp_t a) (f: repr a wp_f)\n : Pure (repr a wp_g) (requires forall p s. wp_g p s ==> wp_f p s) (ensures fun _ -> True)\nlet subcomp (a:Type)\n (wp_f:wp_t a) (wp_g:wp_t a)\n (f:repr a wp_f)\n: Pure (repr a wp_g)\n (requires forall p s. wp_g p s ==> wp_f p s)\n (ensures fun _ -> True)\n= f", "val subcomp (a: Type) (wp_f wp_g: wp_t a) (f: repr a wp_f)\n : Pure (repr a wp_g) (requires forall p s. wp_g p s ==> wp_f p s) (ensures fun _ -> True)\nlet subcomp (a:Type)\n (wp_f:wp_t a) (wp_g:wp_t a)\n (f:repr a wp_f)\n: Pure (repr a wp_g)\n (requires forall p s. wp_g p s ==> wp_f p s)\n (ensures fun _ -> True)\n= f", "val injective_postcond (#t: Type0) (p: bare_parser t) (b1 b2: bytes) : GTot Type0\nlet injective_postcond\n (#t: Type0)\n (p: bare_parser t)\n (b1 b2: bytes)\n: GTot Type0\n= Some? (bparse p b1) /\\\n Some? (bparse p b2) /\\ (\n let (Some (v1, len1)) = bparse p b1 in\n let (Some (v2, len2)) = bparse p b2 in\n (len1 <: nat) == (len2 <: nat) /\\\n Seq.slice b1 0 len1 == Seq.slice b2 0 len2\n )", "val fill_buffer_postcond\n (#t: typ)\n (b: buffer t)\n (idx_b len: UInt32.t)\n (v: type_of_typ t)\n (h h': HS.mem)\n : GTot Type0\nlet fill_buffer_postcond\n (#t: typ)\n (b: buffer t) (* destination *)\n (idx_b: UInt32.t)\n (len: UInt32.t)\n (v: type_of_typ t)\n (h: HS.mem)\n (h' : HS.mem)\n: GTot Type0\n= fill_buffer_precond b idx_b len h /\\\n modifies (loc_buffer (gsub_buffer b idx_b len)) h h' /\\\n buffer_readable h' (gsub_buffer b idx_b len) /\\\n buffer_as_seq h' (gsub_buffer b idx_b len) == Seq.create (UInt32.v len) v", "val subcomp (a: Type) (wp_f wp_g: wp_t a) (f: repr a wp_f)\n : Pure (repr a wp_g) (requires forall p m. wp_g p m ==> wp_f p m) (ensures fun _ -> True)\nlet subcomp (a:Type)\n (wp_f:wp_t a) (wp_g:wp_t a)\n (f:repr a wp_f)\n: Pure (repr a wp_g)\n (requires forall p m. wp_g p m ==> wp_f p m)\n (ensures fun _ -> True)\n= f" ], "closest_src": [ { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_subcomp_spec_cond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_subcomp_cond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.subcomp_spec_cond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_subcomp_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.subcomp_cond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.read_subcomp_impl" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.subcomp_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_repr_spec" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_bind_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.read_repr_impl" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.repr_impl_post" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.lift_read_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.repr_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.subcomp_impl" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.destr_read_repr_spec" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.subcomp" }, { "project_name": "FStar", "file_name": "FStar.MSTTotal.fst", "name": "FStar.MSTTotal.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.bind_spec" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.subcomp" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.subcomp" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.lift_read" }, { "project_name": "steel", "file_name": "Steel.Effect.fsti", "name": "Steel.Effect.subcomp_pre" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fsti", "name": "Steel.Effect.Atomic.subcomp_pre" }, { "project_name": "FStar", "file_name": "HoareSTFree.fst", "name": "HoareSTFree.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.repr_impl" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.subcomp" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.Unix.fst", "name": "Steel.Primitive.ForkJoin.Unix.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_bind" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.read_bind_impl" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.lift_read_impl" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.mk_read_repr_impl" }, { "project_name": "steel", "file_name": "Steel.Effect.fst", "name": "Steel.Effect.subcomp_pre_opaque" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.destr_read_repr_impl" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.check_precond_spec" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.stt" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.fst", "name": "Steel.ST.Effect.subcomp" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.r_if_precond" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.subcomp" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.bind_pre" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.destr_repr_spec" }, { "project_name": "steel", "file_name": "Steel.Effect.fst", "name": "Steel.Effect.subcomp" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Hat_Plus_Hat" }, { "project_name": "FStar", "file_name": "HoareDiv.fst", "name": "HoareDiv.subcomp" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.bind" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Base.fst", "name": "LowParse.SLow.Base.size32_postcond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.reify_read" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.r_if_precond_true" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.gaccessor_post'" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.extract_read_repr_impl" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.sub" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.bind_post" }, { "project_name": "FStar", "file_name": "FStar.SquashProperties.fst", "name": "FStar.SquashProperties.ac" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.fst", "name": "Steel.ST.Effect.repr" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.read_subcomp" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.m" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.repr" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpost" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.extract_t" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.bind" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.fsti", "name": "Benton2004.RHL.r_if_precond_false" }, { "project_name": "steel", "file_name": "Pulse.JoinComp.fst", "name": "Pulse.JoinComp.join_comps" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.gaccessor_post" }, { "project_name": "FStar", "file_name": "LowStar.BufferCompat.fst", "name": "LowStar.BufferCompat.createL_pre" }, { "project_name": "FStar", "file_name": "Benton2004.RHL.Examples.fst", "name": "Benton2004.RHL.Examples.sec43'_postcond" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.recast_writer_spec" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.sub_stt" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.check_precond_impl" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fsti", "name": "FStar.Pointer.Derived2.copy_buffer_contents_postcond" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.injective_postcond" }, { "project_name": "steel", "file_name": "Steel.Effect.fst", "name": "Steel.Effect.lemma_subcomp_pre_opaque_aux1" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.stt_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.subcomp" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_pred" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.read_subcomp_conv" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.subcomp" }, { "project_name": "steel", "file_name": "Steel.Effect.fst", "name": "Steel.Effect.lemma_subcomp_pre_opaque" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.tac_subcomp" }, { "project_name": "everparse", "file_name": "LowParse.Low.Writers.fst", "name": "LowParse.Low.Writers.grifthenelse" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.conv" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived2.fst", "name": "FStar.Pointer.Derived2.copy_buffer_contents_postcond'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.gaccessor_pre" }, { "project_name": "FStar", "file_name": "prims.fst", "name": "Prims.pure_post'" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.trivial_pure_post" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Sum.fst", "name": "LowParse.SLow.Sum.size32_sum_gen_precond" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.stt" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.sub_ghost" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.bind_explicit_univs" }, { "project_name": "FStar", "file_name": "Z3EncodingIssue.fst", "name": "Z3EncodingIssue.subcomp" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.subcomp" }, { "project_name": "FStar", "file_name": "MiniParse.Spec.Base.fst", "name": "MiniParse.Spec.Base.injective_postcond" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived3.fsti", "name": "FStar.Pointer.Derived3.fill_buffer_postcond" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.subcomp" } ], "selected_premises": [ "BUGSLowParseWriters.memory_invariant", "BUGSLowParseWriters.read_repr_spec", "BUGSLowParseWriters.read_return", "BUGSLowParseWriters.read_bind_spec", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "BUGSLowParseWriters.read_bind", "BUGSLowParseWriters.read_return_spec", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "Prims.pure_post'", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Pervasives.trivial_pure_post", "Prims.pure_post", "FStar.Monotonic.Pure.is_monotonic", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "FStar.Pervasives.div_hoare_to_wp", "Prims.as_ensures", "FStar.Pervasives.st_post_h", "Prims.pure_stronger", "FStar.Monotonic.Pure.elim_pure", "FStar.Pervasives.st_pre_h", "Prims.purewp_id", "Prims.pure_trivial", "Prims.as_requires", "FStar.Monotonic.Pure.as_pure_wp", "Prims.pure_wp_monotonic0", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.all_post_h", "Prims.pure_pre", "FStar.Pervasives.all_pre_h", "Prims.pure_wp'", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.all_post_h'", "FStar.Pervasives.pure_ite_wp", "Prims.pure_wp_monotonic", "FStar.Pervasives.all_return", "FStar.Pervasives.id", "Prims.pure_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.st_return", "FStar.Pervasives.lift_div_exn", "FStar.Pervasives.st_trivial", "Prims.subtype_of", "FStar.Pervasives.st_stronger", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.ex_pre", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.all_trivial", "FStar.Pervasives.all_stronger", "FStar.Pervasives.pure_return", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.ex_post'", "Prims.abs", "Prims.l_False", "Prims.__cache_version_number__", "Prims.pow2", "Prims.l_True", "Prims.returnM", "FStar.Pervasives.ex_post", "FStar.Pervasives.coerce_eq", "Prims.op_Hat", "FStar.Pervasives.all_if_then_else", "FStar.Pervasives.all_close_wp", "Prims.auto_squash", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.ex_return", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.ex_wp", "FStar.Pervasives.ex_trivial", "Prims.min", "FStar.Pervasives.ex_ite_wp", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.ex_close_wp" ], "source_upto_this": "(*\n Copyright 2019 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule BUGSLowParseWriters\n\n//\n// This module is a testcase for an already fixed bug\n// The effect combinators defined here are non-substitutive\n// See LowParse.fsti for a substitutive version of the effect defined here\n//\n\n// silence not a substitutive combinator warning\n#set-options \"--warn_error -352\"\n\nlet memory_invariant : Type0 = nat\n\n(*\n// also makes the `assert False` at the bottom succeed\nnoeq\ntype memory_invariant : Type0 = | Meminv\n\n// this one will make that `assert False` fail:\nlet memory_invariant : Type0 = unit\n*)\n\nnoeq\ntype result (a: Type u#x) : Type u#x =\n| Correct of a\n| Error of string\n\nlet pure_post_err\n (pre: pure_pre)\n: Tot Type\n= unit (* squash pre *) -> GTot Type0\n\nlet pure_post'\n (a: Type)\n (pre: pure_pre)\n: Tot Type\n= (x: a) -> GTot Type0 // (requires pre) (ensures (fun _ -> True))\n\n\nlet read_repr_spec (a:Type u#x) (pre: pure_pre) (post: pure_post' a pre) (post_err: pure_post_err pre) : Tot (Type u#x) =\n unit ->\n Ghost (result a)\n (requires pre)\n (ensures (fun res ->\n match res with\n | Correct v -> post v\n | Error _ -> post_err ()\n ))\n\nnoeq\ntype read_repr\n (a:Type u#x)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (l: memory_invariant)\n= | ReadRepr:\n spec: read_repr_spec a pre post post_err ->\n read_repr a pre post post_err l\n\nlet read_return_spec\n (a:Type) (x:a)\n: Tot (read_repr_spec a True (fun res -> res == x) (fun _ -> False))\n= fun _ -> Correct x\n\nlet read_return\n (a:Type) (x:a) (inv: memory_invariant)\n: Tot (read_repr a True (fun res -> res == x) (fun _ -> False) inv)\n= ReadRepr (read_return_spec a x)\n\nlet read_bind_spec\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n: Tot (read_repr_spec b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n )\n= fun _ ->\n match f_bind_spec () with\n | Correct a -> g a ()\n | Error e -> Error e\n\nlet read_bind\n (a:Type) (b:Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (l: memory_invariant)\n (f_bind : read_repr a pre_f post_f post_err_f l)\n (g : (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l))\n: Tot (read_repr b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n l\n )\n= ReadRepr (read_bind_spec a b pre_f post_f post_err_f pre_g post_g post_err_g (ReadRepr?.spec f_bind) (fun x -> ReadRepr?.spec (g x)))\n\nunfold", "sketch": [ "The `read_subcomp_spec_cond` function checks if the post-condition of a subcomputation is satisfied based on the pre- and post-conditions of the parent and subcomputation.\n\nStep 1: The `read_subcomp_spec_cond` function takes pre- and post-conditions for both the parent and subcomputation, and it determines whether the post-condition of the subcomputation is satisfied given the pre- and post-conditions of the parent and subcomputation.\n\nStep 2: To implement `read_subcomp_spec_cond`, we need to check if the pre-condition of the subcomputation implies the pre-condition of the parent, and if the post-condition of the parent implies the pre-condition of the subcomputation. If both conditions are satisfied, we return `True`; otherwise, we return `False`.", "The `read_subcomp_spec_cond` function checks if the postcondition of one computation implies the precondition of another computation, and if the error postcondition of the first computation implies the error postcondition of the second computation.\n\nThe `read_subcomp_spec_cond` function takes two sets of preconditions and postconditions for two computations and checks if the postcondition of the first computation implies the precondition of the second computation, and if the error postcondition of the first computation implies the error postcondition of the second computation.", "The `read_subcomp_spec_cond` function defines a condition for composing two read specifications in F*.\n\nStep 1: We need to define a condition for composing two read specifications, which takes into account the pre- and post-conditions as well as the error handling.\n\nStep 2: The `read_subcomp_spec_cond` function takes two sets of pre- and post-conditions for reading a value of type `a`, along with their corresponding error handling conditions. It then defines a condition for composing these specifications, ensuring that the pre-conditions of the second specification are satisfied if the post-condition of the first specification is satisfied. It also handles error conditions appropriately.", "The `read_subcomp_spec_cond` function takes the postcondition `post` for a subcomputation, the postcondition `post'` for the encompassing computation, and their corresponding preconditions. It then checks if the postcondition `post` is implied by the postcondition `post'` under the given preconditions, and returns a proof of this implication.\n\n```fstar\nlet read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n : GTot Type0 =\n // Implementation goes here\n```" ], "generated_solution": [ "let read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n: GTot Type0 =\n (pre' ==> pre) /\\ (forall (x: a) . post x ==> post' x) // Check if the pre-condition of the subcomputation implies the pre-condition of the parent, and if the post-condition of the parent implies the pre-condition of the subcomputation", "let read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n: GTot Type0 =\n (pre ==> pre') /\\ (forall (x: a) . post x ==> post' x) /\\ (post_err () ==> post_err' ())", "let read_subcomp_spec_cond\n (a: Type)\n (pre: pure_pre)\n (post: pure_post' a pre)\n (post_err: pure_post_err pre)\n (pre': pure_pre)\n (post': pure_post' a pre')\n (post_err': pure_post_err pre')\n: GTot Type0\n= (* Your F* code here *)" ] }, { "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.length", "opens_and_abbrevs": [ { "abbrev": "U", "full_module": "FStar.Universe" }, { "abbrev": "Seq", "full_module": "FStar.Seq" }, { "abbrev": "SZ", "full_module": "FStar.SizeT" }, { "open": "FStar.Ghost" }, { "open": "PulseCore.FractionalPermission" }, { "abbrev": "H", "full_module": "Pulse.Lib.HigherArray" }, { "open": "Pulse.Lib.Core" }, { "open": "Pulse.Main" }, { "abbrev": "Seq", "full_module": "FStar.Seq" }, { "abbrev": "SZ", "full_module": "FStar.SizeT" }, { "open": "FStar.Ghost" }, { "open": "PulseCore.FractionalPermission" }, { "open": "Pulse.Lib.Core" }, { "open": "FStar.Tactics.V2" }, { "open": "Pulse.Lib.Array" }, { "open": "Pulse.Lib.Array" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val length (#a:Type u#0) (x:array a) : GTot nat", "source_definition": "let length #a x = H.length x", "source_range": { "start_line": 28, "start_col": 0, "end_line": 28, "end_col": 28 }, "interleaved": false, "definition": "fun x -> Pulse.Lib.HigherArray.length x", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "Pulse.Lib.Array.Core.array", "Pulse.Lib.HigherArray.length", "FStar.Universe.raise_t", "Prims.nat" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "x: Pulse.Lib.Array.Core.array a -> Prims.GTot Prims.nat", "prompt": "let length #a x =\n ", "expected_response": "H.length x", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Array.Core.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.Array.Core.fst", "checked_file": "dataset/Pulse.Lib.Array.Core.fst.checked", "interface_file": true, "dependencies": [ "dataset/PulseCore.FractionalPermission.fst.checked", "dataset/Pulse.Main.fsti.checked", "dataset/Pulse.Lib.HigherArray.fsti.checked", "dataset/Pulse.Lib.Core.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.SizeT.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Ghost.fsti.checked" ] }, "definitions_in_context": [ "val array ([@@@strictly_positive] a:Type u#0) : Type u#0", "let array a = H.array (U.raise_t a)", "val length (#a:Type u#0) (x:array a) : GTot nat" ], "closest": [ "val length (#a:Type) (x:array a) : GTot nat\nlet length (#elt: Type) (a: array elt) : GTot nat = a.length", "val length (#a:Type0) (x:t a) : GTot nat\nlet length x = L.length x", "val length (#a:Type0) (v:vec a) : GTot nat\nlet length v = A.length v", "val length (#a: Type) (x: t a) : nat\nlet length (#a:Type) (x:t a) : nat = U32.v (len x)", "val length (#elt: Type) (a: array elt) : GTot nat\nlet length (#elt: Type) (a: array elt) : GTot nat =\n dsnd a", "val length (#elt: Type) (a: array elt) : GTot nat\nlet length (#elt: Type) (a: array elt) : GTot nat =\n dsnd a", "val length (#a:Type0) (x:array a)\n : ST nat\n (requires (fun h -> contains h x))\n (ensures (fun h0 y h1 -> y = length (sel h0 x) /\\ h0 == h1))\nlet length #a x = let s = !x in Seq.length s", "val length: #a:Type -> seq a -> Tot nat\nlet length #_ s = List.length (MkSeq?.l s)", "val length (#a: typ) (b: buffer a) : GTot nat\nlet length (#a: typ) (b: buffer a) : GTot nat =\n UInt32.v (P.buffer_length b)", "val length (#a: Type0) (x: array a)\n : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\\ h0 == h1)\nlet length (#a:Type0) (x:array a)\n: HoareST nat\n (fun _ -> True)\n (fun h0 y h1 -> y == Seq.length (sel h0 x) /\\ h0 == h1)\n= let s = !x in\n Seq.length s", "val length (#a: Type0) (x: array a)\n : HoareST nat (fun _ -> True) (fun h0 y h1 -> y == Seq.length (sel h0 x) /\\ h0 == h1)\nlet length (#a:Type0) (x:array a)\n: HoareST nat\n (fun _ -> True)\n (fun h0 y h1 -> y == Seq.length (sel h0 x) /\\ h0 == h1)\n= let s = !x in\n Seq.length s", "val array_length (#t: Type) (#td: typedef t) (a: array td) : GTot nat\nlet array_length\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: GTot nat\n= SZ.v (dsnd a)", "val array_length (#t: Type) (#td: typedef t) (a: array td) : GTot nat\nlet array_length\n (#t: Type)\n (#td: typedef t)\n (a: array td)\n: GTot nat\n= SZ.v (dsnd a)", "val length (#a: _) (b: buffer a) : GTot nat\nlet length #a (b:buffer a) : GTot nat = v b.length", "val length (#a: Type0) (s: seq a) : nat\nlet length (#a:Type0) (s:seq a) : nat = Seq.length s", "val raw_length (#a: Type) (#l: len_t) (v: raw a l) : GTot nat\nlet raw_length (#a:Type) (#l:len_t) (v:raw a l) : GTot nat = U32.v l", "val count (#a: eqtype) (x: a) (s: Seq.seq a) : GTot nat\nlet count (#a:eqtype) (x:a) (s:Seq.seq a) : GTot nat = Seq.count x s", "val length_all: #t: _ -> #input_stream_inst t -> x: t -> GTot nat\nlet length_all #t (#_: input_stream_inst t) (x: t) : GTot nat = U64.v (len_all x)", "val length (#a: Type) (b: buffer a) : GTot U32.t\nlet length (#a:Type) (b:buffer a) : GTot U32.t =\n U32.uint_to_t (B.length b)", "val length (#a: Type) (b: buffer a) : GTot U32.t\nlet length (#a:Type) (b:buffer a) : GTot U32.t =\n U32.uint_to_t (B.length b)", "val length: list 'a -> Tot nat\nlet rec length = function\n | [] -> 0\n | _::tl -> 1 + length tl", "val length (#a: _) (l: list a) : nat\nlet rec length #a (l:list a) \n : nat\n = match l with\n | [] -> 0\n | _ :: tl -> 1 + length tl", "val length : list 'a -> Tot nat\nlet rec length l =\n match l with\n | [] -> 0\n | hd::tl -> 1 + length tl", "val length (#a: Type0) (#rrel #rel: srel a) (b: mbuffer a rrel rel) : GTot nat\nlet length (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) :GTot nat = U32.v (len b)", "val length (s: t): GTot (n:nat{n > 0 /\\ n == Seq.length (v s)})\nlet length s = Seq.length s.s", "val length (#a:Type0) (p:t a)\n : Steel int (llist p) (fun _ -> llist p)\n (requires fun _ -> True)\n (ensures fun h0 x h1 ->\n v_llist p h0 == v_llist p h1 /\\\n L.length (v_llist p h0) == x)\nlet rec length #a p =\n if is_null p then (elim_llist_nil p; 0)\n else (\n let tl = tail p in\n let aux = length tl in\n intro_llist_cons p tl;\n 1 + aux)", "val height (#a: Type) (x: tree a) : nat\nlet rec height (#a: Type) (x: tree a) : nat =\n match x with\n | Leaf -> 0\n | Node data left right ->\n if height left > height right then (height left) + 1\n else (height right) + 1", "val only (#a: Type0) (arr: array a) : GTot (Set.set nat)\nlet only (#a:Type0) (arr:array a) : GTot (Set.set nat) = Set.singleton (addr_of arr)", "val length: p:t -> Tot nat\nlet length p = length p", "val p (#a: Type0) (init: list a) : GTot Type0\nlet p (#a:Type0) (init:list a) : GTot Type0 =\n normalize (0 < FStar.List.Tot.length init) /\\\n normalize (FStar.List.Tot.length init <= UInt.max_int 32)", "val addr_of (#a: Type0) (arr: array a) : GTot nat\nlet addr_of (#a:Type0) (arr:array a) : GTot nat = addr_of (as_ref arr)", "val length : #ty: Type -> seq ty -> nat\nlet length = FLT.length", "val length: s:seq 'a -> Tot nat\nlet length s = Seq?.end_i s - Seq?.start_i s", "val sel (#a: Type0) (h: heap) (s: array a) : GTot (seq a)\nlet sel (#a:Type0) (h:heap) (s:array a) : GTot (seq a) = Heap.sel h (as_ref s)", "val get (#a:Type0) (x: t a) (i:US.t{US.v i < length x}) :\n Pure a\n (requires True)\n (ensures fun y ->\n US.v i < L.length (v x) /\\\n y == L.index (v x) (US.v i))\nlet get x i = L.index x (US.v i)", "val depth (#p: Type0) (x: tree' p) : nat\nlet rec depth (#p:Type0) (x:tree' p) : nat =\n match x with\n | Leaf _ -> 0\n | Node _ lxs -> 1 + children_depth lxs\nand children_depth (#p:Type0) (lxs:children' p) : nat =\n match lxs with\n | (_,x) :: lxs -> max (depth x) (children_depth lxs)\n | [] -> 0", "val only (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (set nat)\nlet only (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (set nat) = S.singleton (addr_of x)", "val v (#t #l: _) (u: int_t t l) : GTot (range_t t)\nlet v #t #l (u: int_t t l) : GTot (range_t t) =\n v u", "val contains (#a:Type) (s:seq a) (x:a) : Tot Type0\nlet contains #a s x =\n exists (k:nat). k < Seq.length s /\\ Seq.index s k == x", "val length : ilist -> Tot nat\nlet rec length l =\n match l with\n | Nil -> 0\n | Cons h t -> length t + 1", "val length (#a: Type) (gn: G.erased (list a)) (l: t a): Stack UInt32.t\n (requires (fun h -> well_formed h l gn))\n (ensures (fun h0 n h1 ->\n h0 == h1 /\\\n U32.v n = L.length (G.reveal gn)\n ))\nlet rec length #a gn l =\n if B.is_null l then\n 0ul\n else\n let open U32 in\n let c = !* l in\n let next = c.next in\n let n = length (G.hide (L.tail (G.reveal gn))) next in\n if n = 0xfffffffful then begin\n LowStar.Failure.failwith \"Integer overflow in LowStar.LinkedList.length\"\n end else\n n +^ 1ul", "val as_ref (#a:Type0) (arr:array a) : GTot (ref (seq a))\nlet as_ref #_ arr = arr", "val v: #a:Type -> h:HS.mem -> ll: t a -> GTot (list a)\nlet v #_ h ll =\n B.deref h ll.v", "val cons (#a: Type) (x: a) (s: seq a) : Tot (seq a)\nlet cons (#a:Type) (x:a) (s:seq a) : Tot (seq a) = append (create 1 x) s", "val len_all (x: t) : GTot LPE.pos_t\nlet len_all\n (x: t)\n: GTot LPE.pos_t\n= if x.Aux.has_length\n then x.Aux.length\n else Aux.len_all x.Aux.base", "val find_in_array (#ty: Type) (a: array_t ty) (x: ty)\n : GTot\n (result:\n option nat\n { match result with\n | None ->\n (forall (i: nat). {:pattern array_index a i} i < array_len a ==> ~(array_index a i == x)\n ) /\\ (forall (i: nat). {:pattern array_nth a i} ~(array_nth a i == Some x))\n | Some i -> i < array_len a /\\ array_index a i == x /\\ array_nth a i == Some x })\nlet find_in_array\n (#ty: Type)\n (a: array_t ty)\n (x: ty)\n : GTot (result: option nat{\n match result with\n | None -> (forall (i: nat).{:pattern array_index a i} i < array_len a ==> ~(array_index a i == x))\n /\\ (forall (i: nat).{:pattern array_nth a i} ~(array_nth a i == Some x))\n | Some i -> i < array_len a /\\ array_index a i == x /\\ array_nth a i == Some x}) =\n find_in_array_offset a 0 x", "val only (#a: Type0) (r: ref a) : GTot (Set.set nat)\nlet only (#a:Type0) (r:ref a) :GTot (Set.set nat)\n = Heap.only r", "val p (#a: typ) (init: list (P.type_of_typ a)) : GTot Type0\nlet p (#a:typ) (init:list (P.type_of_typ a)) : GTot Type0 =\n normalize (0 < FStar.List.Tot.length init) /\\\n normalize (FStar.List.Tot.length init < UInt.max_int 32)", "val i (x: U32.t) : GTot int\nlet i (x:U32.t) : GTot int = U32.v x", "val count: #a:eqtype -> a -> list a -> Tot nat\nlet rec count #a x = function\n | hd::tl -> (if hd = x then 1 else 0) + count x tl\n | [] -> 0", "val count: #a:eqtype -> a -> list a -> Tot nat\nlet rec count #a x = function\n | [] -> 0\n | hd::tl -> if x=hd then 1 + count x tl else count x tl", "val varint_len (x: U62.t) : GTot (y: nat{y <= 8})\nlet varint_len\n (x: U62.t)\n: GTot (y: nat {y <= 8})\n= if x `U62.lt` 64uL\n then 1\n else if x `U62.lt` 16384uL\n then 2\n else if x `U62.lt` 1073741824uL\n then 4\n else 8", "val count (#a: eqtype) (x: a) (s: seq a) : Tot nat (decreases (length s))\nlet rec count (#a:eqtype) (x:a) (s:seq a) : Tot nat (decreases (length s))\n= if length s = 0 then 0\n else if head s = x\n then 1 + count x (tail s)\n else count x (tail s)", "val asel\n (#elt: Type)\n (#vp: vprop)\n (a: array elt)\n (h: rmem vp {FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varray a) /\\ True)})\n : GTot (Seq.lseq elt (length a))\nlet asel (#elt: Type) (#vp: vprop) (a: array elt)\n (h: rmem vp { FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varray a) /\\ True) })\n: GTot (Seq.lseq elt (length a))\n= h (varray a)", "val pts_to_len (#t:Type) (a:array t) (#p:perm) (#x:Seq.seq t)\n : stt_ghost unit\n (pts_to a #p x)\n (fun _ \u2192 pts_to a #p x ** pure (length a == Seq.length x))\nlet pts_to_len = pts_to_len'", "val null (#a: Type u#a) : array a\nlet null (#a: Type u#a) : array a\n= (| null_ptr a, Ghost.hide 0 |)", "val point: #a:eqtype -> x:a -> y:option a -> nat\nlet point #a x = fun y -> if y = Some x then 1 else 0", "val point: #a:eqtype -> x:a -> y:option a -> nat\nlet point #a x = fun y -> if y = Some x then 1 else 0", "val null (#a: Type u#1) : array a\nlet null (#a: Type u#1) : array a\n= { p = null_ptr a; length =Ghost.hide 0 }", "val mem (#a: eqtype) (x: a) (l: seq a) : Tot bool\nlet mem (#a:eqtype) (x:a) (l:seq a) : Tot bool = count x l > 0", "val array ([@@@ strictly_positive]elt: Type u#a) : Tot Type0\nlet array ([@@@strictly_positive] elt: Type u#a) : Tot Type0 =\n (p: ptr elt & (length: Ghost.erased nat {offset p + length <= base_len (base p)}))", "val flat_length (#a:Type) (ss: sseq a)\n : Tot nat\nlet flat_length (#a:Type) (ss: sseq a):\n Tot nat =\n reduce 0 nat_add (map length ss)", "val only_t (#a: Type0) (#rel: preorder a) (x: mref a rel) : GTot (tset nat)\nlet only_t (#a:Type0) (#rel:preorder a) (x:mref a rel) :GTot (tset nat) = TS.singleton (addr_of x)", "val alloc \n (#a:Type0)\n (x:a)\n (n:SZ.t)\n : stt (vec a)\n (requires emp)\n (ensures fun v ->\n pts_to v (Seq.create (SZ.v n) x) **\n pure (length v == SZ.v n /\\ is_full_vec v))\nlet alloc x n = A.alloc x n", "val refl (a: LSeq.lseq uint64 5 {linv a}) : GTot S.felem\nlet refl (a:LSeq.lseq uint64 5{linv a}) : GTot S.felem =\n let open Lib.Sequence in\n feval5 (a.[0],a.[1],a.[2],a.[3],a.[4])", "val v (#a:Type0) (x : t a) : G.erased (list a)\nlet v x = G.hide x", "val aselp\n (#elt: Type)\n (#vp: vprop)\n (a: array elt)\n (p: P.perm)\n (h:\n rmem vp\n {FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varrayp a p) /\\ True)})\n : GTot (Seq.lseq elt (length a))\nlet aselp (#elt: Type) (#vp: vprop) (a: array elt) (p: P.perm)\n (h: rmem vp { FStar.Tactics.with_tactic selector_tactic (can_be_split vp (varrayp a p) /\\ True) })\n: GTot (Seq.lseq elt (length a))\n= h (varrayp a p)", "val sel (#a: Type0) (h: heap) (r: ref a) : GTot a\nlet sel (#a:Type0) (h:heap) (r:ref a) : GTot a\n = Heap.sel h r", "val choose (#a: eqtype) (s: set a{exists x. mem x s})\n : GTot (x: a{mem x s})\nlet choose (#a: eqtype) (s: set a{exists x. mem x s}) : GTot (x: a{mem x s}) =\n Cons?.hd (set_as_list s)", "val count_until (#a: eqtype) (x: a) (s: Seq.seq a) (j: nat{j <= Seq.length s}) : GTot nat\nlet count_until (#a:eqtype) (x:a) (s:Seq.seq a) (j:nat { j <= Seq.length s }) : GTot nat =\r\n Seq.count x (Seq.slice s 0 j)", "val ( ++^ ) (#a: Type0) (#rel: preorder a) (s: set nat) (r: mref a rel) : GTot (set nat)\nlet op_Plus_Plus_Hat (#a:Type0) (#rel:preorder a) (s:set nat) (r:mref a rel) :GTot (set nat) = S.union s (only r)", "val live: #a:Type -> HS.mem -> vector a -> GTot Type0\nlet live #a h vec =\n B.live h (Vec?.vs vec)", "val defined (#r #a #b #inv: _) (m: t r a b inv) (x: a) (h: HS.mem) : GTot Type0\nlet defined #r #a #b #inv (m:t r a b inv) (x:a) (h:HS.mem)\n : GTot Type0\n = Some? (sel (HS.sel h m) x)", "val alloc \n (#elt: Type)\n (x: elt)\n (n: SZ.t)\n : stt (array elt) \n (requires emp)\n (ensures fun a ->\n pts_to a (Seq.create (SZ.v n) x) **\n pure (length a == SZ.v n /\\ is_full_array a))\nlet alloc = alloc'", "val ( ^++ ) (#a: Type0) (#rel: preorder a) (r: mref a rel) (s: set nat) : GTot (set nat)\nlet op_Hat_Plus_Plus (#a:Type0) (#rel:preorder a) (r:mref a rel) (s:set nat) :GTot (set nat) = S.union (only r) s", "val refl (a: LSeq.lseq uint64 4 {linv a}) : GTot S.felem\nlet refl (a:LSeq.lseq uint64 4{linv a}) : GTot S.felem =\n SM.from_mont (BD.bn_v a)", "val create (#a:Type0) (n:nat) (init:a)\n : ST (array a)\n (requires (fun h -> True))\n (ensures (fun h0 x h1 -> x `unused_in` h0 /\\\n contains h1 x /\\\n modifies Set.empty h0 h1 /\\\n sel h1 x == Seq.create n init))\nlet create #a n init = ST.alloc (Seq.create n init)", "val createL_pre (#a: Type0) (init: list a) : GTot Type0\nlet createL_pre (#a: Type0) (init: list a) : GTot Type0 =\n alloca_of_list_pre init", "val length : bytes -> Tot nat\nlet length b = Seq.length b", "val return (#a: Type) (x: a) : GTot (conditional_computation_t a)\nlet return (#a: Type) (x: a) : GTot (conditional_computation_t a) = ComputationProduces x", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc_pt x) in\n r", "val alloc (#a:Type) (x:a)\n : ST (ref a)\n emp \n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\nlet alloc (#a:Type) (x:a)\n : ST (ref a)\n emp\n (fun r -> pts_to r full_perm x)\n (requires True)\n (ensures fun r -> not (is_null r))\n = let r = coerce_steel (fun _ -> R.alloc x) in\n r", "val includes (#a: typ) (x y: buffer a) : GTot Type0\nlet includes\n (#a: typ)\n (x y: buffer a)\n: GTot Type0\n= P.buffer_includes x y", "val u256_bytesize (x:u256) : GTot nat\nlet u256_bytesize (x:u256) : GTot nat = Seq.length (u256_serializer x)", "val freeable: #a:Type -> vector a -> GTot Type0\nlet freeable #a vec =\n B.freeable (Vec?.vs vec)", "val size (x: int) (n: nat) : Tot Type0\nlet size (x:int) (n:nat) : Tot Type0 = b2t(fits x n)", "val max_length (#a: _) (b: buffer a) : GTot nat\nlet max_length #a (b:buffer a) : GTot nat = v b.max_length", "val compute_gen_elim_a (x: gen_elim_i) : Tot (Type u#1)\nlet rec compute_gen_elim_a\n (x: gen_elim_i)\n: Tot (Type u#1)\n= match x with\n | GEUnit _ -> U.raise_t unit\n | GEStarL left _ -> compute_gen_elim_a left\n | GEStarR _ right -> compute_gen_elim_a right\n | GEStar left right -> (compute_gen_elim_a left & compute_gen_elim_a right)\n | GEExistsNoAbs0 #a _\n | GEExistsUnit0 #a _ -> U.raise_t a\n | GEExists0 #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))\n | GEExistsNoAbs1 #a _\n | GEExistsUnit1 #a _ -> a\n | GEExists1 #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))", "val mem (#a: eqtype) (x: a) (xs: Seq.seq a) : Tot bool\nlet mem (#a:eqtype) (x:a) (xs:Seq.seq a) : Tot bool =\n Some? (Seq.seq_find (fun y -> y = x) xs)", "val cardinality (#a: eqtype) (s: set a)\n : GTot nat\nlet cardinality (#a: eqtype) (s: set a) : GTot nat =\n FLT.length (set_as_list s)", "val addr_of (#a: Type0) (r: ref a) : GTot nat\nlet addr_of (#a:Type0) (r:ref a) : GTot nat = addr_of r", "val datas (#a: Type0) (l: v a) : Tot (list a)\nlet datas\n (#a: Type0)\n (l: v a)\n: Tot (list a)\n= l", "val create: #a:Type -> nat -> a -> Tot (seq a)\nlet rec create #_ len v = if len = 0 then MkSeq [] else _cons v (create (len - 1) v)", "val delta (#a: eqtype) (x y: a) : GTot int\nlet delta (#a: eqtype) (x y:a): GTot int = (if x = y then 1 else 0)", "val partial_serialize32_list'_measure (#t: Type) (x: (bytes32 * list t)) : GTot nat\nlet partial_serialize32_list'_measure\n (#t: Type)\n (x: bytes32 * list t)\n: GTot nat\n= L.length (snd x)", "val length (#a: Type0) (#len: flen) (s: ntuple a len) : flen\nlet length (#a:Type0) (#len:flen) (s: ntuple a len) : flen = len", "val cardinality (#a: eqtype) (#b: Type u#b) (m: map a b)\n : GTot nat\nlet cardinality (#a: eqtype) (#b: Type u#b) (m: map a b) : GTot nat =\n FSet.cardinality (domain m)", "val slice (#a: Type) (x: t a) (i: len_t) (j: len_t{let open U32 in v i <= v j /\\ v j <= length x})\n : Tot (t a)\nlet slice\n (#a:Type)\n (x:t a)\n (i:len_t)\n (j:len_t{U32.(v i <= v j /\\ v j <= length x)})\n : Tot (t a)\n = from_raw (sub (as_raw x) i j)", "val q (#a: Type0) (len: nat) (buf: buffer a) : GTot Type0\nlet q (#a:Type0) (len:nat) (buf:buffer a) : GTot Type0 =\n normalize (length buf == len)", "val upd_ (#a: Type) (#len: flen) (s: ntuple a len) (i: nat{i < len}) (x: a) : ntuple_ a len\nlet rec upd_ (#a:Type) (#len:flen) (s:ntuple a len) (i:nat{i < len}) (x:a) : ntuple_ a len =\n if i = 0 then\n if len = 1 then x\n else x,rest s\n else fst s,upd_ #a #(len-1) (rest s) (i-1) x" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.length" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.length" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.length" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.length" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.length" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fsti", "name": "Steel.ST.Array.length" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.length" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.length" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.length" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.length" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.length" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.fsti", "name": "Pulse.C.Types.Array.array_length" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.fsti", "name": "Steel.ST.C.Types.Array.array_length" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.length" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fsti", "name": "Lib.Sequence.length" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.raw_length" }, { "project_name": "steel", "file_name": "PulseTutorial.Algorithms.fst", "name": "PulseTutorial.Algorithms.count" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.Base.fst", "name": "EverParse3d.InputStream.Base.length_all" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.length" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.length" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.length" }, { "project_name": "FStar", "file_name": "OPLSS2021.Basic.fst", "name": "OPLSS2021.Basic.length" }, { "project_name": "FStar", "file_name": "SfPoly.fst", "name": "SfPoly.length" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.length" }, { "project_name": "karamel", "file_name": "C.String.fst", "name": "C.String.length" }, { "project_name": "steel", "file_name": "Selectors.LList.Derived.fst", "name": "Selectors.LList.Derived.length" }, { "project_name": "steel", "file_name": "Trees.fst", "name": "Trees.height" }, { "project_name": "FStar", "file_name": "FStar.Array.fsti", "name": "FStar.Array.only" }, { "project_name": "FStar", "file_name": "HyE.Plain.fst", "name": "HyE.Plain.length" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.p" }, { "project_name": "FStar", "file_name": "FStar.Array.fsti", "name": "FStar.Array.addr_of" }, { "project_name": "FStar", "file_name": "FStar.Sequence.Base.fst", "name": "FStar.Sequence.Base.length" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.length" }, { "project_name": "FStar", "file_name": "FStar.Array.fsti", "name": "FStar.Array.sel" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.get" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Pkg.Tree.fst", "name": "MiTLS.Pkg.Tree.depth" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.only" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Secret.Int.Base.fst", "name": "QUIC.Secret.Int.Base.v" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.contains" }, { "project_name": "FStar", "file_name": "SfLists.fst", "name": "SfLists.length" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.length" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.as_ref" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.v" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fsti", "name": "FStar.Seq.Base.cons" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.Extern.fst", "name": "EverParse3d.InputStream.Extern.len_all" }, { "project_name": "Armada", "file_name": "Util.ImmutableArray.fsti", "name": "Util.ImmutableArray.find_in_array" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.only" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.p" }, { "project_name": "steel", "file_name": "Demo.MultiplyByRepeatedAddition.fst", "name": "Demo.MultiplyByRepeatedAddition.i" }, { "project_name": "FStar", "file_name": "QuickSort.List.fst", "name": "QuickSort.List.count" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.count" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Base.fst", "name": "QUIC.Spec.Base.varint_len" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.count" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.asel" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.pts_to_len" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.null" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Random.fst", "name": "FStar.DM4F.Random.point" }, { "project_name": "FStar", "file_name": "FStar.DM4F.OTP.Random.fst", "name": "FStar.DM4F.OTP.Random.point" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.null" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.mem" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.array" }, { "project_name": "zeta", "file_name": "Zeta.SSeq.fst", "name": "Zeta.SSeq.flat_length" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.only_t" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.alloc" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Finv.fst", "name": "Hacl.Impl.K256.Finv.refl" }, { "project_name": "steel", "file_name": "Steel.TLArray.fst", "name": "Steel.TLArray.v" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.aselp" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.sel" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fst", "name": "FStar.FiniteSet.Base.choose" }, { "project_name": "steel", "file_name": "PulseTutorial.Algorithms.fst", "name": "PulseTutorial.Algorithms.count_until" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Plus_Plus_Hat" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.live" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Map.fst", "name": "FStar.Monotonic.Map.defined" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.alloc" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.op_Hat_Plus_Plus" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Finv.fst", "name": "Hacl.Impl.P256.Finv.refl" }, { "project_name": "FStar", "file_name": "FStar.Array.fst", "name": "FStar.Array.create" }, { "project_name": "FStar", "file_name": "LowStar.BufferCompat.fst", "name": "LowStar.BufferCompat.createL_pre" }, { "project_name": "FStar", "file_name": "Platform.Bytes.fst", "name": "Platform.Bytes.length" }, { "project_name": "Armada", "file_name": "Armada.Computation.fst", "name": "Armada.Computation.return" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.alloc" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.alloc" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.includes" }, { "project_name": "zeta", "file_name": "Zeta.Formats.Aux.U256.fst", "name": "Zeta.Formats.Aux.U256.u256_bytesize" }, { "project_name": "FStar", "file_name": "LowStar.Vector.fst", "name": "LowStar.Vector.freeable" }, { "project_name": "FStar", "file_name": "FStar.UInt.fsti", "name": "FStar.UInt.size" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.max_length" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_a" }, { "project_name": "FStar", "file_name": "HyE.AE.fsti", "name": "HyE.AE.mem" }, { "project_name": "FStar", "file_name": "FStar.FiniteSet.Base.fst", "name": "FStar.FiniteSet.Base.cardinality" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.addr_of" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.datas" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.create" }, { "project_name": "FStar", "file_name": "LeftistHeap.fst", "name": "LeftistHeap.delta" }, { "project_name": "everparse", "file_name": "LowParse.SLow.List.fst", "name": "LowParse.SLow.List.partial_serialize32_list'_measure" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.length" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fst", "name": "FStar.FiniteMap.Base.cardinality" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fsti", "name": "FStar.Vector.Base.slice" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.q" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.upd_" } ], "selected_premises": [ "Pulse.Lib.Array.Core.array", "PulseCore.FractionalPermission.full_perm", "FStar.Real.one", "FStar.Real.two", "FStar.UInt.size", "FStar.PCM.composable", "Pulse.Lib.Core.all_inames", "Pulse.Lib.Core.inames", "Pulse.Lib.Core.emp_inames", "PulseCore.FractionalPermission.comp_perm", "PulseCore.FractionalPermission.sum_perm", "FStar.Mul.op_Star", "FStar.PCM.op", "FStar.PCM.compatible", "Pulse.Lib.Core.one_half", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "Pulse.Lib.Core.join_inames", "PulseCore.FractionalPermission.half_perm", "Pulse.Lib.Core.add_iname", "Pulse.Lib.Core.unit_non_informative", "FStar.Real.zero", "PulseCore.FractionalPermission.lesser_perm", "Pulse.Lib.Core.prop_non_informative", "FStar.Math.Lemmas.pow2_plus", "Pulse.Lib.Core.inames_subset", "Pulse.Lib.Core.squash_non_informative", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "PulseCore.FractionalPermission.writeable", "Pulse.Lib.Core.erased_non_informative", "FStar.Math.Lemmas.pow2_lt_compat", "FStar.SizeT.mod_spec", "FStar.Math.Lemmas.pow2_le_compat", "Pulse.Lib.Core.mem_iname", "PulseCore.FractionalPermission.lesser_equal_perm", "PulseCore.Observability.at_most_one_observable", "FStar.Math.Lemmas.lemma_mod_plus_distr_l", "FStar.PCM.lem_commutative", "FStar.UInt.max_int", "FStar.UInt16.lt", "FStar.UInt64.lt", "FStar.UInt32.lt", "FStar.Math.Lemmas.lemma_mod_plus_distr_r", "FStar.PCM.compatible_elim", "FStar.UInt64.n", "FStar.UInt.to_vec", "FStar.UInt.fits", "FStar.PCM.compatible_trans", "FStar.Math.Lemmas.lemma_mod_mul_distr_r", "FStar.Universe.lift_codom", "FStar.Math.Lemmas.cancel_mul_mod", "FStar.Math.Lemmas.lemma_div_lt", "FStar.Math.Lemmas.distributivity_add_right", "FStar.PCM.lem_assoc_l", "FStar.Math.Lemmas.distributivity_sub_left", "FStar.UInt32.n", "PulseCore.Observability.join_obs", "FStar.Math.Lib.slash_decr_axiom", "PulseCore.FractionalPermission.sum_halves", "FStar.PCM.exclusive", "Pulse.Lib.Core.mem_inv", "FStar.Preorder.preorder_rel", "Pulse.Lib.Core.add_inv", "FStar.Real.mul_nil_r", "FStar.Math.Lemmas.lemma_mod_twice", "FStar.UInt16.n", "FStar.Real.test", "FStar.PCM.frame_compatible", "FStar.UInt16.gt", "FStar.UInt32.gt", "FStar.UInt64.gt", "FStar.Real.test_le3", "FStar.Math.Lib.max", "FStar.PCM.frame_preserving_val_to_fp_upd", "FStar.Real.mul_dist", "FStar.UInt.xor", "FStar.Real.test_div_lt", "FStar.UInt64.lte", "FStar.UInt16.lte", "FStar.UInt32.lte", "FStar.Real.test_div_eq", "FStar.Math.Lemmas.lemma_mod_mul_distr_l", "FStar.Real.test_add_eq'", "FStar.Math.Lib.powx", "FStar.Real.test_le2", "FStar.BitVector.logor_vec", "FStar.Real.test_le1", "FStar.Math.Lemmas.distributivity_sub_right", "FStar.Real.test_sqrt_2_scale", "FStar.Math.Lemmas.pow2_modulo_modulo_lemma_1", "FStar.UInt64.gte_mask", "FStar.UInt16.gte_mask", "FStar.UInt32.gte_mask", "FStar.PCM.lem_assoc_r", "FStar.Math.Lemmas.modulo_distributivity", "FStar.Ghost.tot_to_gtot", "FStar.Universe.lift_dom", "FStar.Math.Lemmas.lemma_mult_lt_sqr" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.Array.Core\nopen Pulse.Main\nopen Pulse.Lib.Core\nmodule H = Pulse.Lib.HigherArray\nopen PulseCore.FractionalPermission\nopen FStar.Ghost\nmodule SZ = FStar.SizeT\nmodule Seq = FStar.Seq\nmodule U = FStar.Universe\n\nlet array a = H.array (U.raise_t a)", "sketch": [ "The definition is about finding the length of an array.\n\nStep 1: We want to define a function that takes an array as input and returns its length as a natural number.\n\nStep 2: To implement this, we will use the built-in function provided by the HigherArray module to obtain the length of the array.", "The definition is about finding the length of an array.\n\nStep 1: We need to define a function that takes an array as input and returns its length as a natural number.\n\nStep 2: To implement this, we will use the built-in function to calculate the length of the array and return it as a natural number.", "The definition is about finding the length of an array.\n\nStep 1: We need to define a function that takes an array as input and returns its length as a natural number.\n\nStep 2: To implement this, we will use the built-in function to calculate the length of the array.", "We want to define a function that returns the length of an array.\n\nStep 1: The length function takes an array as input and returns its length as a natural number.\n\nStep 2: To implement the length function, we will use the built-in function provided by the HigherArray module to obtain the length of the array.", "The definition is about finding the length of an array.\n\nStep 1: We want to define a function that takes an array as input and returns its length.\n\nStep 2: We can implement the function by using the `H.length` function provided by the `Pulse.Lib.HigherArray` module, which calculates the length of the array.", "We want to define a function that returns the length of an array.\n\nStep 1: The length function takes an array as input and returns the length of the array as a natural number.\n\nStep 2: To implement the length function, we will use the higher-order array library to obtain the length of the array.", "The definition is about finding the length of an array.\n\nStep 1: We need to define a function that takes an array and returns its length.\n\nStep 2: To implement this, we will use the `length` function provided by the HigherArray module to obtain the length of the array.", "We want to define a function that returns the length of an array.\n\nStep 1: The length function takes an array as input and returns its length as a natural number.\n\nStep 2: To implement the length function, we will use the `H.length` function provided by the `HigherArray` module, which returns the length of the array.", "The definition is about finding the length of an array.\n\nStep 1: We want to define a function that takes an array as input and returns its length as a natural number.\n\nStep 2: To implement this, we will use the built-in function provided by the HigherArray module to obtain the length of the array.", "The definition is about finding the length of an array.\n\nStep 1: We need to define a function that takes an array as input and returns its length as a natural number.\n\nStep 2: To implement this, we will use the built-in function to calculate the length of the array." ], "generated_solution": [ "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "val length (a:Type u) (x:array a) : GTot nat = H.length x", "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "let length (x:array a) : GTot nat =\n H.length x", "val length (#a:Type u#0) (x:array a) : GTot nat = H.length x", "val length (a:Type u#0) (x:array a) : GTot nat = H.length x", "let length (a:Type u) (x:array a) : GTot nat =\n H.length x" ] }, { "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.addrs_dom", "opens_and_abbrevs": [ { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )", "source_range": { "start_line": 39, "start_col": 0, "end_line": 40, "end_col": 53 }, "interleaved": false, "definition": "fun regions -> r: FStar.Monotonic.HyperHeap.rid{FStar.Set.mem r (FStar.Ghost.reveal regions)}", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Ghost.erased", "FStar.Set.set", "FStar.Monotonic.HyperHeap.rid", "Prims.b2t", "FStar.Set.mem", "FStar.Ghost.reveal" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "prompt": "let addrs_dom regions =\n ", "expected_response": "(r: HS.rid{Set.mem r (Ghost.reveal regions)})", "source": { "project_name": "FStar", "file_name": "ulib/FStar.ModifiesGen.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.ModifiesGen.fst", "checked_file": "dataset/FStar.ModifiesGen.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Tactics.SMT.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.GSet.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "aloc", "ALoc", "ALoc", "ALoc", "aloc_t", "region", "region", "addr", "addr", "loc", "loc", "cls", "Cls", "Cls", "Cls", "aloc_includes", "aloc_includes", "let aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))", "aloc_includes_refl", "aloc_includes_refl", "let i_restricted_g_t = F.restricted_g_t" ], "closest": [ "val MiTLS.AEAD.addr_unused_in = rid: FStar.Monotonic.HyperHeap.rid -> a: MiTLS.AEAD.address -> m0: FStar.Monotonic.HyperStack.mem\n -> Type0\nlet addr_unused_in (rid:rid) (a:address) (m0:mem) =\n Monotonic.Heap.addr_unused_in a (Map.sel (HS.get_hmap m0) rid)", "val MiTLS.AEAD.fresh_addresses = \n rid: FStar.Monotonic.HyperHeap.rid ->\n addrs: FStar.Set.set MiTLS.AEAD.address ->\n m0: FStar.Monotonic.HyperStack.mem ->\n m1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet fresh_addresses (rid:rid) (addrs:Set.set address) (m0:mem) (m1:mem) =\n forall a. a `Set.mem` addrs ==>\n addr_unused_in rid a m0 /\\\n contains_addr rid a m1", "val FStar.Monotonic.HyperStack.is_eternal_region_hs = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_eternal_region_hs r = is_heap_color (color r) && not (rid_freeable r)", "val FStar.Monotonic.HyperStack.is_eternal_region = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_eternal_region r = is_heap_color (color r) && not (rid_freeable r)", "val Impl.Noise.Allocate.disjoint_regions = r1: FStar.Monotonic.HyperHeap.rid -> r2: FStar.Monotonic.HyperHeap.rid -> Type0\nlet disjoint_regions r1 r2 = B.loc_disjoint (region_to_loc r1) (region_to_loc r2)", "val Lib.Buffer.modifies0 = h1: FStar.Monotonic.HyperStack.mem -> h2: FStar.Monotonic.HyperStack.mem -> Type0\nlet modifies0 (h1 h2:HS.mem) =\n modifies (B.loc_none) h1 h2", "val FStar.Buffer.modifies_buf_0 = \n rid: FStar.Monotonic.HyperHeap.rid ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_buf_0 rid h h' =\n modifies_ref rid (Set.empty #nat) h h'\n /\\ (forall (#tt:Type) (bb:buffer tt). (frameOf bb == rid /\\ live h bb) ==> equal h bb h' bb /\\ live h' bb)", "val FStar.ModifiesGen.loc_disjoint_addresses = \n preserve_liveness1: Prims.bool ->\n preserve_liveness2: Prims.bool ->\n r1: FStar.Monotonic.HyperHeap.rid ->\n r2: FStar.Monotonic.HyperHeap.rid ->\n n1: FStar.Set.set Prims.nat ->\n n2: FStar.Set.set Prims.nat\n -> FStar.Pervasives.Lemma\n (requires r1 <> r2 \\/ FStar.Set.subset (FStar.Set.intersect n1 n2) FStar.Set.empty)\n (ensures\n FStar.ModifiesGen.loc_disjoint (FStar.ModifiesGen.loc_addresses preserve_liveness1 r1 n1)\n (FStar.ModifiesGen.loc_addresses preserve_liveness2 r2 n2))\nlet loc_disjoint_addresses #aloc #c = loc_disjoint_addresses_intro #aloc #c", "val FStar.Monotonic.HyperStack.fresh_region = \n i: FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperStack.mem ->\n m1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet fresh_region (i:rid) (m0 m1:mem) =\n not (get_hmap m0 `Map.contains` i) /\\ get_hmap m1 `Map.contains` i", "val FStar.ST.modifies_none = h0: FStar.Monotonic.Heap.heap -> h1: FStar.Monotonic.Heap.heap -> Prims.logical\nlet modifies_none (h0:heap) (h1:heap) = modifies !{} h0 h1", "val Impl.Noise.Allocate.region_includes_region = r1: FStar.Monotonic.HyperHeap.rid -> r2: FStar.Monotonic.HyperHeap.rid -> Type0\nlet region_includes_region r1 r2 = B.loc_includes (region_to_loc r1) (region_to_loc r2)", "val FStar.Monotonic.HyperStack.is_stack_region = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_stack_region r = color r > 0", "val FStar.HyperStack.ST.modifies_none = h0: FStar.Monotonic.HyperStack.mem -> h1: FStar.Monotonic.HyperStack.mem -> Prims.logical\nlet modifies_none (h0:mem) (h1:mem) = modifies Set.empty h0 h1", "val MiTLS.AEAD.contains_addr = rid: FStar.Monotonic.HyperHeap.rid -> a: MiTLS.AEAD.address -> m: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet contains_addr (rid:rid) (a:address) (m:mem) =\n ~(addr_unused_in rid a m)", "val MiTLS.Mem.is_hs_rgn = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_hs_rgn r = HS.color r = hs_color", "val FStar.HyperStack.ST.new_region_post_common = \n r0: FStar.Monotonic.HyperHeap.rid ->\n r1: FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperStack.mem ->\n m1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet new_region_post_common (r0 r1:rid) (m0 m1:mem) =\n r1 `HS.extends` r0 /\\\n HS.fresh_region r1 m0 m1 /\\\n get_hmap m1 == Map.upd (get_hmap m0) r1 Heap.emp /\\\n get_tip m1 == get_tip m0 /\\ \n HS.live_region m0 r0", "val FStar.TwoLevelHeap.fresh_region = i: FStar.TwoLevelHeap.rid -> m0: FStar.TwoLevelHeap.t -> m1: FStar.TwoLevelHeap.t -> Prims.logical\nlet fresh_region (i:rid) (m0:t) (m1:t) =\n not (Map.contains m0 i)\n /\\ Map.contains m1 i", "val FStar.HyperStack.ST.contains_region = m: FStar.Monotonic.HyperStack.mem -> r: FStar.Monotonic.HyperHeap.rid -> Prims.bool\nlet contains_region (m:mem) (r:rid) = get_hmap m `Map.contains` r", "val modifies_0_preserves_regions (h1 h2: HS.mem) : GTot Type0\nlet modifies_0_preserves_regions (h1 h2: HS.mem) : GTot Type0 =\n forall (r: HS.rid) . HS.live_region h1 r ==> HS.live_region h2 r", "val Impl.Noise.Allocate.region_includes = r1: FStar.Monotonic.HyperHeap.rid -> s2: LowStar.Monotonic.Buffer.loc -> Prims.GTot Type0\nlet region_includes r1 = B.loc_includes (region_to_loc r1)", "val contained_region: mem -> mem -> rid -> Type0\nlet contained_region :mem -> mem -> rid -> Type0\n = fun m0 m1 r -> m0 `contains_region` r /\\ m1 `contains_region` r", "val FStar.Monotonic.HyperStack.modifies_ref = \n id: FStar.Monotonic.HyperHeap.rid ->\n s: FStar.Set.set Prims.nat ->\n h0: FStar.Monotonic.HyperStack.mem ->\n h1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_ref (id:rid) (s:Set.set nat) (h0:mem) (h1:mem) =\n Heap.modifies s (get_hmap h0 `Map.sel` id) (get_hmap h1 `Map.sel` id)", "val Impl.Noise.Allocate.region_to_loc = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot LowStar.Monotonic.Buffer.loc\nlet region_to_loc = B.loc_all_regions_from false", "val FStar.Monotonic.HyperHeap.modifies = \n s: FStar.Set.set FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperHeap.hmap ->\n m1: FStar.Monotonic.HyperHeap.hmap\n -> Prims.logical\nlet modifies (s:Set.set rid) (m0:hmap) (m1:hmap) =\n Map.equal m1 (Map.concat m1 (Map.restrict (Set.complement (mod_set s)) m0)) /\\\n Set.subset (Map.domain m0) (Map.domain m1)", "val FStar.Monotonic.HyperStack.modifies_one = \n id: FStar.Monotonic.HyperHeap.rid ->\n h0: FStar.Monotonic.HyperStack.mem' ->\n h1: FStar.Monotonic.HyperStack.mem'\n -> Prims.logical\nlet modifies_one id h0 h1 = modifies_one id (get_hmap h0) (get_hmap h1)", "val FStar.Monotonic.HyperHeap.modifies_one = \n r: FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperHeap.hmap ->\n m1: FStar.Monotonic.HyperHeap.hmap\n -> Prims.logical\nlet modifies_one (r:rid) (m0:hmap) (m1:hmap) = modifies_just (Set.singleton r) m0 m1", "val FStar.Monotonic.Heap.modifies = \n s: FStar.Monotonic.Heap.set Prims.nat ->\n h0: FStar.Monotonic.Heap.heap ->\n h1: FStar.Monotonic.Heap.heap\n -> Prims.logical\nlet modifies (s:set nat) (h0:heap) (h1:heap) = modifies_t (TS.tset_of_set s) h0 h1", "val MiTLS.Mem.is_epoch_rgn = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_epoch_rgn r = HS.color r = epoch_color", "val FStar.Monotonic.HyperStack.contains_ref_in_its_region = m: FStar.Monotonic.HyperStack.mem -> r: FStar.Monotonic.HyperStack.mreference a rel -> Type0\nlet contains_ref_in_its_region (#a:Type) (#rel:preorder a) (m:mem) (r:mreference a rel) =\n Heap.contains (get_hmap m `Map.sel` (frameOf r)) (as_ref r)", "val FStar.DM4F.Heap.modifies = s: FStar.Set.set Prims.nat -> h0: FStar.DM4F.Heap.heap -> h1: FStar.DM4F.Heap.heap -> Prims.logical\nlet modifies (s:set nat) (h0:heap) (h1:heap) =\n (forall (a:Type) (r:ref a).{:pattern (sel h1 r)}\n ~ (mem (addr_of r) s) /\\ h0 `contains` r ==>\n sel h1 r == sel h0 r) /\\\n (forall (a:Type) (r:ref a).{:pattern (h1 `contains` r)}\n h0 `contains` r ==> h1 `contains` r) /\\\n (* AR: an alternative to this would be to prove a lemma that if sel is same and h0 contains_a_well_typed then h1 contains_a_well_typed, then the following clause would follow from the first clause of sel remaining same *)\n (forall (a:Type) (r:ref a).{:pattern (h1 `contains_a_well_typed` r)}\n (~ (mem (addr_of r) s) /\\ h0 `contains_a_well_typed` r) ==> h1 `contains_a_well_typed` r)", "val create_regions2 : r0:rid ->\n ST (rid & rid)\n (requires (fun _ -> is_eternal_region r0))\n (ensures (fun h0 res h1 ->\n let (r1, r2) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r0 r1 /\\\n region_is_child r0 r2 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n ]\n ))\nlet create_regions2 r0 =\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n (r1, r2)", "val FStar.DM4F.StMap.state = Type0\nlet state = (Map.t int int)", "val Vale.Stdcalls.X64.GCTR.lowstar_gctr256_t = s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32) -> Type0\nlet lowstar_gctr256_t (s:Ghost.erased (Seq.seq nat32)) =\n assert_norm (List.length dom + List.length ([]<:list arg) <= 20);\n IX64.as_lowstar_sig_t_weak_stdcall\n code_gctr256\n dom\n []\n _\n _\n (W.mk_prediction code_gctr256 dom [] ((gctr256_lemma s) code_gctr256 IA.win))", "val new_region_modifies (m0: HS.mem) (r0: HS.rid) (col: option int) : Lemma\n (requires (HST.is_eternal_region r0 /\\ HS.live_region m0 r0 /\\ (None? col \\/ HS.is_heap_color (Some?.v col))))\n (ensures (\n let (_, m1) = HS.new_eternal_region m0 r0 col in\n modifies loc_none m0 m1\n ))\n [SMTPat (HS.new_eternal_region m0 r0 col)]\nlet new_region_modifies = MG.new_region_modifies #_ cls", "val FStar.Monotonic.HyperStack.modifies = \n s: FStar.Set.set FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperStack.mem ->\n m1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies (s:Set.set rid) (m0:mem) (m1:mem) = modifies_just s (get_hmap m0) (get_hmap m1)", "val MiTLS.Mem.hs_rgn = Type0\nlet hs_rgn = r:rgn {is_hs_rgn r}", "val WithLocal.hprop = l: FStar.Ghost.erased LowStar.Monotonic.Buffer.loc -> Type\nlet hprop (l:Ghost.erased B.loc) =\n p:(HS.mem -> Type) { frameable l p }", "val MiTLS.Mem.is_tls_rgn = r: FStar.Monotonic.HyperHeap.rid -> Prims.GTot Prims.bool\nlet is_tls_rgn r = HS.color r = tls_color", "val create_regions4 : r0:rid ->\n ST (rid & rid & rid & rid)\n (requires (fun _ -> is_eternal_region r0))\n (ensures (fun h0 res h1 ->\n let (r1, r2, r3, r4) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r0 r1 /\\\n region_is_child r0 r2 /\\\n region_is_child r0 r3 /\\\n region_is_child r0 r4 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n region_to_loc r3;\n region_to_loc r4;\n ]\n ))\nlet create_regions4 r0 =\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n let r3 = new_region r0 in\n let r4 = new_region r0 in\n (r1, r2, r3, r4)", "val Lib.Buffer.modifies = \n s: LowStar.Monotonic.Buffer.loc ->\n h1: FStar.Monotonic.HyperStack.mem ->\n h2: FStar.Monotonic.HyperStack.mem\n -> Type0\nlet modifies (s:B.loc) (h1 h2:HS.mem) = B.modifies s h1 h2", "val Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t = s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32) -> Type0\nlet lowstar_gctr128_t (s:Ghost.erased (Seq.seq nat32)) =\n assert_norm (List.length dom + List.length ([]<:list arg) <= 20);\n IX64.as_lowstar_sig_t_weak_stdcall\n code_gctr128\n dom\n []\n _\n _\n (W.mk_prediction code_gctr128 dom [] ((gctr128_lemma s) code_gctr128 IA.win))", "val create_regions_non_root_2 : r00:rid ->\n ST (rid & rid & rid)\n (requires (fun _ -> is_eternal_region r00))\n (ensures (fun h0 res h1 ->\n let (r0, r1, r2) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r00 r0 /\\\n region_is_grandchild r00 r0 r1 /\\\n region_is_grandchild r00 r0 r2 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n ]\n ))\nlet create_regions_non_root_2 r00 =\n let r0 = new_region r00 in\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n (r0, r1, r2)", "val FStar.Buffer.modifies_buf_1 = \n rid: FStar.Monotonic.HyperHeap.rid ->\n b: FStar.Buffer.buffer t ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_buf_1 (#t:Type) rid (b:buffer t) h h' = //would be good to drop the rid argument on these, since they can be computed from the buffers\n modifies_ref rid (Set.singleton (Heap.addr_of (as_ref b))) h h'\n /\\ (forall (#tt:Type) (bb:buffer tt). (frameOf bb == rid /\\ live h bb /\\ disjoint b bb) ==> equal h bb h' bb /\\ live h' bb)", "val FStar.Buffer.modifies_bufs = \n rid: FStar.Monotonic.HyperHeap.rid ->\n buffs: FStar.TSet.set FStar.Buffer.abuffer ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_bufs rid buffs h h' =\n modifies_ref rid (arefs buffs) h h'\n /\\ (forall (#a:Type) (b:buffer a). (frameOf b == rid /\\ live h b /\\ disjoint_from_bufs b buffs) ==> equal h b h' b /\\ live h' b)", "val FStar.Integers.pos = Type0\nlet pos = i:nat{ 0 < i }", "val FStar.Monotonic.Heap.modifies_t = \n s: FStar.Monotonic.Heap.tset Prims.nat ->\n h0: FStar.Monotonic.Heap.heap ->\n h1: FStar.Monotonic.Heap.heap\n -> Prims.logical\nlet modifies_t (s:tset nat) (h0:heap) (h1:heap) =\n (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (sel h1 r)}\n ((~ (TS.mem (addr_of r) s)) /\\ h0 `contains` r) ==> sel h1 r == sel h0 r) /\\\n (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (contains h1 r)}\n h0 `contains` r ==> h1 `contains` r) /\\\n (forall (a:Type) (rel:preorder a) (r:mref a rel).{:pattern (r `unused_in` h0)}\n r `unused_in` h1 ==> r `unused_in` h0) /\\\n (forall (n: nat) . {:pattern (n `addr_unused_in` h0) }\n n `addr_unused_in` h1 ==> n `addr_unused_in` h0\n )", "val FStar.Monotonic.HyperStack.modifies_transitively = \n s: FStar.Set.set FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperStack.mem ->\n m1: FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_transitively (s:Set.set rid) (m0:mem) (m1:mem) = FStar.Monotonic.HyperHeap.modifies s (get_hmap m0) (get_hmap m1)", "val FStar.Monotonic.HyperHeap.modifies_just = \n s: FStar.Set.set FStar.Monotonic.HyperHeap.rid ->\n m0: FStar.Monotonic.HyperHeap.hmap ->\n m1: FStar.Monotonic.HyperHeap.hmap\n -> Prims.logical\nlet modifies_just (s:Set.set rid) (m0:hmap) (m1:hmap) =\n Map.equal m1 (Map.concat m1 (Map.restrict (Set.complement s) m0)) /\\\n Set.subset (Map.domain m0) (Map.domain m1)", "val FStar.TwoLevelHeap.modifies = s: FStar.Set.set FStar.TwoLevelHeap.rid -> m0: FStar.TwoLevelHeap.t -> m1: FStar.TwoLevelHeap.t\n -> Prims.prop\nlet modifies (s:Set.set rid) (m0:t) (m1:t) =\n Map.equal m1 (Map.concat m1 (Map.restrict (Set.complement s) m0))", "val FStar.Monotonic.HyperStack.some_refs = Type\nlet some_refs = list some_ref", "val FStar.DM4F.Heap.Random.elem = Type0\nlet elem = n:nat{n < q}", "val FStar.DM4F.OTP.Heap.elem = Type0\nlet elem = bv_t q", "val FStar.ST.contains_pred = r: FStar.Monotonic.Heap.mref a rel -> h: FStar.Monotonic.Heap.heap -> Type0\nlet contains_pred (#a:Type0) (#rel:preorder a) (r:mref a rel) = fun h -> h `contains` r", "val FStar.Buffer.modifies_none = \n h:\n m:\n FStar.Monotonic.HyperStack.mem'\n { FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip (FStar.Monotonic.HyperStack.get_hmap m)\n (FStar.Monotonic.HyperStack.get_rid_ctr m)\n (FStar.Monotonic.HyperStack.get_tip m) } ->\n h':\n m:\n FStar.Monotonic.HyperStack.mem'\n { FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip (FStar.Monotonic.HyperStack.get_hmap m)\n (FStar.Monotonic.HyperStack.get_rid_ctr m)\n (FStar.Monotonic.HyperStack.get_tip m) }\n -> Prims.logical\nlet modifies_none h h' =\n HS.get_tip h' == HS.get_tip h /\\ HS.modifies_transitively Set.empty h h'", "val FStar.HyperStack.ST.equal_domains = m0: FStar.Monotonic.HyperStack.mem -> m1: FStar.Monotonic.HyperStack.mem -> Prims.logical\nlet equal_domains (m0 m1:mem) =\n get_tip m0 == get_tip m1 /\\\n Set.equal (Map.domain (get_hmap m0)) (Map.domain (get_hmap m1)) /\\\n same_refs_in_all_regions m0 m1", "val FStar.Integers.uint_64 = Type0\nlet uint_64 = int_t (Unsigned W64)", "val create_regions3 : r0:rid ->\n ST (rid & rid & rid)\n (requires (fun _ -> is_eternal_region r0))\n (ensures (fun h0 res h1 ->\n let (r1, r2, r3) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r0 r1 /\\\n region_is_child r0 r2 /\\\n region_is_child r0 r3 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n region_to_loc r3;\n ]\n ))\nlet create_regions3 r0 =\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n let r3 = new_region r0 in\n (r1, r2, r3)", "val Demo.Deps.modifies = \n b: LowStar.Buffer.buffer 'a ->\n h0: FStar.Monotonic.HyperStack.mem ->\n h1: FStar.Monotonic.HyperStack.mem\n -> Type0\nlet modifies (b:B.buffer 'a) h0 h1 = modifies (loc_buffer b) h0 h1", "val FStar.Monotonic.HyperStack.s_mref = i: FStar.Monotonic.HyperHeap.rid -> a: Type0 -> rel: FStar.Preorder.preorder a -> Type0\nlet s_mref (i:rid) (a:Type) (rel:preorder a) = s:mreference a rel{frameOf s = i}", "val FStar.Integers.uint_16 = Type0\nlet uint_16 = int_t (Unsigned W16)", "val FStar.Integers.uint_8 = Type0\nlet uint_8 = int_t (Unsigned W8)", "val modifies_region (rid: rid) (bufs: TSet.set abuffer) (h0 h1: mem) : Type0\nlet modifies_region (rid:rid) (bufs:TSet.set abuffer) (h0 h1:mem) :Type0 =\n modifies_one rid h0 h1 /\\ modifies_bufs rid bufs h0 h1 /\\ HS.get_tip h0 == HS.get_tip h1", "val FStar.Integers.uint_32 = Type0\nlet uint_32 = int_t (Unsigned W32)", "val FStar.Buffer.modifies_buf_2 = \n rid: FStar.Monotonic.HyperHeap.rid ->\n b: FStar.Buffer.buffer t ->\n b': FStar.Buffer.buffer t' ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_buf_2 (#t:Type) (#t':Type) rid (b:buffer t) (b':buffer t') h h' =\n modifies_ref rid (to_set_2 (as_addr b) (as_addr b')) h h'\n /\\ (forall (#tt:Type) (bb:buffer tt). (frameOf bb == rid /\\ live h bb /\\ disjoint b bb /\\ disjoint b' bb)\n ==> equal h bb h' bb /\\ live h' bb)", "val create_regions6 : r0:rid ->\n ST (rid & rid & rid & rid & rid & rid)\n (requires (fun _ -> is_eternal_region r0))\n (ensures (fun h0 res h1 ->\n let (r1, r2, r3, r4, r5, r6) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r0 r1 /\\\n region_is_child r0 r2 /\\\n region_is_child r0 r3 /\\\n region_is_child r0 r4 /\\\n region_is_child r0 r5 /\\\n region_is_child r0 r6 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n region_to_loc r3;\n region_to_loc r4;\n region_to_loc r5;\n region_to_loc r6;\n ]\n ))\nlet create_regions6 r0 =\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n let r3 = new_region r0 in\n let r4 = new_region r0 in\n let r5 = new_region r0 in\n let r6 = new_region r0 in\n (r1, r2, r3, r4, r5, r6)", "val array_domain (n: Ghost.erased SZ.t) : Tot eqtype\nlet array_domain\n (n: Ghost.erased SZ.t)\n: Tot eqtype\n= (i: SZ.t { SZ.v i < SZ.v n })", "val array_domain (n: Ghost.erased SZ.t) : Tot eqtype\nlet array_domain\n (n: Ghost.erased SZ.t)\n: Tot eqtype\n= (i: SZ.t { SZ.v i < SZ.v n })", "val modifies_addr_of_preserves_not_unused_in\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_addr_of_preserves_not_unused_in (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :GTot Type0\n = forall (r: HS.rid) (n: nat) .\n ((r <> frameOf b \\/ n <> as_addr b) /\\\n HS.live_region h1 r /\\ HS.live_region h2 r /\\\n n `Heap.addr_unused_in` (HS.get_hmap h2 `Map.sel` r)) ==>\n (n `Heap.addr_unused_in` (HS.get_hmap h1 `Map.sel` r))", "val HWAbstraction.all_heap_buffers_except_ghost_state_remain_same = h0: FStar.Monotonic.HyperStack.mem -> h1: FStar.Monotonic.HyperStack.mem -> Prims.logical\nlet all_heap_buffers_except_ghost_state_remain_same (h0 h1:HS.mem) =\n let s = st () in\n forall (a:Type0) (b:B.buffer a).\n (ST.is_eternal_region (B.frameOf b) /\\\n B.disjoint b s.ghost_state /\\\n B.live h0 b) ==> (B.as_seq h0 b == B.as_seq h1 b /\\ B.live h1 b)", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_regions (Set.singleton r)) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses r a) l) h1 h2))\nlet modifies_loc_addresses_intro r a l h1 h2 =\n MG.modifies_loc_addresses_intro r a l h1 h2;\n MG.loc_includes_addresses_addresses #_ cls false true r a a;\n MG.loc_includes_refl l;\n MG.loc_includes_union_l (loc_addresses r a) l l;\n MG.loc_includes_union_l (loc_addresses r a) l (MG.loc_addresses true r a);\n MG.loc_includes_union_r (loc_union (loc_addresses r a) l) (MG.loc_addresses true r a) l;\n MG.modifies_loc_includes (loc_union (loc_addresses r a) l) h1 h2 (loc_union (MG.loc_addresses true r a) l)", "val FStar.HyperStack.ST.equal_stack_domains = m0: FStar.Monotonic.HyperStack.mem -> m1: FStar.Monotonic.HyperStack.mem -> Prims.logical\nlet equal_stack_domains (m0 m1:mem) =\n get_tip m0 == get_tip m1 /\\\n same_refs_in_stack_regions m0 m1", "val addrs_set (mem: interop_heap) : GTot (Set.set int)\nlet addrs_set (mem:interop_heap) : GTot (Set.set int) =\n L.fold_right_gtot (ptrs_of_mem mem) (addrs_ptr 0 (addrs_of_mem mem)) Set.empty", "val LowStar.Regional.rg_inv = rg: LowStar.Regional.regional rst a -> _: FStar.Monotonic.HyperStack.mem -> _: a -> Prims.GTot Type0\nlet rg_inv #a #rst (rg: regional rst a) =\n Rgl?.r_inv rg", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val loc_regions\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions", "val modifies_addr_of (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem) :GTot Type0\nlet modifies_addr_of = modifies_addr_of'", "val create_in: #a:Type -> r:HS.rid -> ST (t a)\n (requires fun h0 ->\n ST.is_eternal_region r)\n (ensures fun h0 ll h1 ->\n invariant h1 ll /\\\n B.(modifies loc_none h0 h1) /\\\n B.fresh_loc (footprint h1 ll) h0 h1 /\\\n v h1 ll == [] /\\\n cells h1 ll == [] /\\\n ll.r == r)\nlet create_in #a r =\n let ptr_v_rid = ST.new_region r in\n let spine_rid = ST.new_region r in\n let ptr = B.malloc ptr_v_rid (B.null <: LL1.t a) 1ul in\n let v = B.malloc ptr_v_rid (G.hide ([] <: list a)) 1ul in\n { ptr; v; r; ptr_v_rid; spine_rid }", "val FStar.Buffer.modifies_buf_3 = \n rid: FStar.Monotonic.HyperHeap.rid ->\n b: FStar.Buffer.buffer t ->\n b': FStar.Buffer.buffer t' ->\n b'': FStar.Buffer.buffer t'' ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_buf_3 (#t:Type) (#t':Type) (#t'':Type) rid (b:buffer t) (b':buffer t') (b'':buffer t'') h h' =\n modifies_ref rid (to_set_3 (as_addr b) (as_addr b') (as_addr b'')) h h'\n /\\ (forall (#tt:Type) (bb:buffer tt). (frameOf bb == rid /\\ live h bb /\\ disjoint b bb /\\ disjoint b' bb /\\ disjoint b'' bb)\n ==> equal h bb h' bb /\\ live h' bb)", "val FStar.Reflection.Typing.subst = Type0\nlet subst = list subst_elt", "val FStar.Tactics.CanonCommMonoidSimple.permute = Type0\nlet permute = list atom -> list atom", "val FStar.HyperStack.mmref = a: Type0 -> Type0\nlet mmref (a:Type) = mmmref a (Heap.trivial_preorder a)", "val FStar.Buffer.modifies_buf_4 = \n rid: FStar.Monotonic.HyperHeap.rid ->\n b: FStar.Buffer.buffer t ->\n b': FStar.Buffer.buffer t' ->\n b'': FStar.Buffer.buffer t'' ->\n b''': FStar.Buffer.buffer t''' ->\n h: FStar.Monotonic.HyperStack.mem ->\n h': FStar.Monotonic.HyperStack.mem\n -> Prims.logical\nlet modifies_buf_4 (#t:Type) (#t':Type) (#t'':Type) (#t''':Type) rid (b:buffer t) (b':buffer t') (b'':buffer t'') (b''':buffer t''') h h' =\n modifies_ref rid (to_set_4 (as_addr b) (as_addr b') (as_addr b'') (as_addr b''')) h h'\n /\\ (forall (#tt:Type) (bb:buffer tt). (frameOf bb == rid /\\ live h bb /\\ disjoint b bb /\\ disjoint b' bb /\\ disjoint b'' bb /\\ disjoint b''' bb)\n ==> equal h bb h' bb /\\ live h' bb)", "val FStar.FiniteMap.Base.subtract_domain_fact = Prims.logical\nlet subtract_domain_fact =\n forall (a: eqtype) (b: Type u#b) (m: map a b) (s: FSet.set a).{:pattern domain (subtract m s)}\n domain (subtract m s) == FSet.difference (domain m) s", "val FStar.FiniteMap.Base.glue_domain_fact = Prims.logical\nlet glue_domain_fact =\n forall (a: eqtype) (b: Type u#b) (keys: FSet.set a) (f: setfun_t a b keys).{:pattern domain (glue keys f)}\n domain (glue keys f) == keys", "val Vale.Interop.Base.mem_roots_p = h0: FStar.Monotonic.HyperStack.mem -> args: Prims.list Vale.Interop.Base.arg -> Prims.logical\nlet mem_roots_p (h0:HS.mem) (args:list arg) =\n disjoint_or_eq args /\\\n all_live h0 args", "val contained_non_tip_region: mem -> mem -> rid -> Type0\nlet contained_non_tip_region :mem -> mem -> rid -> Type0\n = fun m0 m1 r -> r =!= get_tip m0 /\\ r =!= get_tip m1 /\\ contained_region m0 m1 r", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro", "val modifies_loc_addresses_intro\n (r: HS.rid)\n (a: Set.set nat)\n (l: loc)\n (h1 h2: HS.mem)\n: Lemma\n (requires (\n HS.live_region h2 r /\\\n modifies (loc_union (loc_region_only false r) l) h1 h2 /\\\n HS.modifies_ref r a h1 h2\n ))\n (ensures (modifies (loc_union (loc_addresses true r a) l) h1 h2))\nlet modifies_loc_addresses_intro = MG.modifies_loc_addresses_intro #_ #cls", "val FStar.Integers.nat = Type0\nlet nat = i:int{ i >= 0 }", "val Vale.Stdcalls.X64.AesHash.lowstar_key256_t = s: FStar.Ghost.erased (FStar.Seq.Base.seq Vale.Def.Types_s.nat32) -> Type0\nlet lowstar_key256_t (s:Ghost.erased (Seq.seq nat32)) =\n assert_norm (List.length dom + List.length ([]<:list arg) <= 4);\n IX64.as_lowstar_sig_t_weak_stdcall\n code_key256\n dom\n []\n _\n _\n (W.mk_prediction code_key256 dom [] ((key256_lemma s) code_key256 IA.win))", "val FStar.FiniteMap.Base.merge_domain_is_union_fact = Prims.logical\nlet merge_domain_is_union_fact =\n forall (a: eqtype) (b: Type u#b) (m1: map a b) (m2: map a b).{:pattern domain (merge m1 m2)}\n domain (merge m1 m2) == FSet.union (domain m1) (domain m2)", "val monotone_domain_write_vale_mem\n (contents: Seq.seq UInt8.t)\n (length: nat{length = FStar.Seq.Base.length contents})\n (addr: _)\n (i: nat{i <= length})\n (curr_heap:\n machine_heap\n { forall j. {:pattern (Seq.index contents j)}\n 0 <= j /\\ j < i ==> curr_heap.[ addr + j ] == UInt8.v (Seq.index contents j) })\n : Lemma (requires True)\n (ensures\n (let new_heap = write_vale_mem contents length addr i curr_heap in\n forall j. Set.mem j (Map.domain curr_heap) ==> Set.mem j (Map.domain new_heap)))\n (decreases (length - i))\nlet rec monotone_domain_write_vale_mem\n (contents:Seq.seq UInt8.t)\n (length:nat{length = FStar.Seq.Base.length contents})\n addr\n (i:nat{i <= length})\n (curr_heap:machine_heap{forall j. {:pattern (Seq.index contents j)} 0 <= j /\\ j < i ==>\n curr_heap.[addr + j] == UInt8.v (Seq.index contents j)}) : Lemma\n (requires True)\n (ensures (let new_heap = write_vale_mem contents length addr i curr_heap in\n forall j. Set.mem j (Map.domain curr_heap) ==> Set.mem j (Map.domain new_heap)))\n (decreases (length - i))=\n if i >= length then ()\n else begin\n let heap = curr_heap.[addr + i] <- UInt8.v (FStar.Seq.index contents i) in\n monotone_domain_write_vale_mem contents length addr (i+1) heap\n end", "val LowStar.Monotonic.Buffer.loc_in = l: LowStar.Monotonic.Buffer.loc -> h: FStar.Monotonic.HyperStack.mem -> Type0\nlet loc_in (l: loc) (h: HS.mem) =\n loc_not_unused_in h `loc_includes` l", "val FStar.Integers.int_8 = Type0\nlet int_8 = int_t (Signed W8)", "val LowStar.Monotonic.Buffer.deref = h: FStar.Monotonic.HyperStack.mem -> x: LowStar.Monotonic.Buffer.mpointer a rrel rel -> Prims.GTot a\nlet deref (#a:Type0) (#rrel #rel:srel a) (h:HS.mem) (x:mpointer a rrel rel) =\n get h x 0", "val create_regions_non_root_4 : r00:rid ->\n ST (rid & rid & rid & rid & rid)\n (requires (fun _ -> is_eternal_region r00))\n (ensures (fun h0 res h1 ->\n let (r0, r1, r2, r3, r4) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r00 r0 /\\\n region_is_grandchild r00 r0 r1 /\\\n region_is_grandchild r00 r0 r2 /\\\n region_is_grandchild r00 r0 r3 /\\\n region_is_grandchild r00 r0 r4 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n region_to_loc r3;\n region_to_loc r4\n ]\n ))\nlet create_regions_non_root_4 r00 =\n let r0 = new_region r00 in\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n let r3 = new_region r0 in\n let r4 = new_region r0 in\n (r0, r1, r2, r3, r4)", "val rg_alloc (#a #rst: _) (rg: regional rst a) (r: HST.erid)\n : HST.ST a\n (requires (fun h0 -> True))\n (ensures\n (fun h0 v h1 ->\n Set.subset (Map.domain (HS.get_hmap h0)) (Map.domain (HS.get_hmap h1)) /\\\n modifies loc_none h0 h1 /\\ fresh_loc (Rgl?.loc_of rg v) h0 h1 /\\ (Rgl?.r_alloc_p rg) v /\\\n rg_inv rg h1 v /\\ (Rgl?.region_of rg) v == r /\\\n (Rgl?.r_repr rg) h1 v == Ghost.reveal (Rgl?.irepr rg)))\nlet rg_alloc #a #rst (rg:regional rst a) (r:HST.erid)\n: HST.ST a\n (requires (fun h0 -> True))\n (ensures (fun h0 v h1 ->\n Set.subset (Map.domain (HS.get_hmap h0))\n (Map.domain (HS.get_hmap h1)) /\\\n modifies loc_none h0 h1 /\\\n fresh_loc (Rgl?.loc_of rg v) h0 h1 /\\\n (Rgl?.r_alloc_p rg) v /\\ rg_inv rg h1 v /\\ (Rgl?.region_of rg) v == r /\\\n (Rgl?.r_repr rg) h1 v == Ghost.reveal (Rgl?.irepr rg)))\n= Rgl?.r_alloc rg (Rgl?.state rg) r", "val LowParse.Repr.stable_region_repr_ptr = r: FStar.HyperStack.ST.drgn -> t: Type -> Type\nlet stable_region_repr_ptr (r:ST.drgn) (t:Type) =\n p:repr_ptr t {\n is_stable_in_region p /\\\n B.frameOf (C.cast p.b) == ST.rid_of_drgn r\n }", "val create_regions5 : r0:rid ->\n ST (rid & rid & rid & rid & rid)\n (requires (fun _ -> is_eternal_region r0))\n (ensures (fun h0 res h1 ->\n let (r1, r2, r3, r4, r5) = res in\n B.modifies B.loc_none h0 h1 /\\\n region_is_child r0 r1 /\\\n region_is_child r0 r2 /\\\n region_is_child r0 r3 /\\\n region_is_child r0 r4 /\\\n region_is_child r0 r5 /\\\n B.all_disjoint [\n region_to_loc r1;\n region_to_loc r2;\n region_to_loc r3;\n region_to_loc r4;\n region_to_loc r5;\n ]\n ))\nlet create_regions5 r0 =\n let r1 = new_region r0 in\n let r2 = new_region r0 in\n let r3 = new_region r0 in\n let r4 = new_region r0 in\n let r5 = new_region r0 in\n (r1, r2, r3, r4, r5)", "val FStar.HyperStack.ref = a: Type0 -> Type0\nlet ref (a:Type) = mref a (Heap.trivial_preorder a)" ], "closest_src": [ { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.addr_unused_in" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.fresh_addresses" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.is_eternal_region_hs" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.is_eternal_region" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.disjoint_regions" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.modifies0" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_buf_0" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_disjoint_addresses" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.fresh_region" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.modifies_none" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.region_includes_region" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.is_stack_region" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.modifies_none" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEAD.fsti", "name": "MiTLS.AEAD.contains_addr" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.is_hs_rgn" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.new_region_post_common" }, { "project_name": "FStar", "file_name": "FStar.TwoLevelHeap.fst", "name": "FStar.TwoLevelHeap.fresh_region" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.contains_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_0_preserves_regions" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.region_includes" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.contained_region" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.modifies_ref" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.region_to_loc" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fsti", "name": "FStar.Monotonic.HyperHeap.modifies" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.modifies_one" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fsti", "name": "FStar.Monotonic.HyperHeap.modifies_one" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.modifies" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.is_epoch_rgn" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.contains_ref_in_its_region" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.fsti", "name": "FStar.DM4F.Heap.modifies" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions2" }, { "project_name": "FStar", "file_name": "FStar.DM4F.StMap.fst", "name": "FStar.DM4F.StMap.state" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.lowstar_gctr256_t" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.new_region_modifies" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.modifies" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.hs_rgn" }, { "project_name": "FStar", "file_name": "WithLocal.fst", "name": "WithLocal.hprop" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.Mem.fst", "name": "MiTLS.Mem.is_tls_rgn" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions4" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.modifies" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.GCTR.fst", "name": "Vale.Stdcalls.X64.GCTR.lowstar_gctr128_t" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions_non_root_2" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_buf_1" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_bufs" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.pos" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.modifies_t" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.modifies_transitively" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperHeap.fsti", "name": "FStar.Monotonic.HyperHeap.modifies_just" }, { "project_name": "FStar", "file_name": "FStar.TwoLevelHeap.fst", "name": "FStar.TwoLevelHeap.modifies" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.some_refs" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.Random.fsti", "name": "FStar.DM4F.Heap.Random.elem" }, { "project_name": "FStar", "file_name": "FStar.DM4F.OTP.Heap.fsti", "name": "FStar.DM4F.OTP.Heap.elem" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.contains_pred" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_none" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.equal_domains" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.uint_64" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions3" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.modifies" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.s_mref" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.uint_16" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.uint_8" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_region" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.uint_32" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_buf_2" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions6" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Array.Base.fst", "name": "Pulse.C.Types.Array.Base.array_domain" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Array.Base.fst", "name": "Steel.ST.C.Types.Array.Base.array_domain" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_addr_of_preserves_not_unused_in" }, { "project_name": "dice-star", "file_name": "HWAbstraction.fsti", "name": "HWAbstraction.all_heap_buffers_except_ghost_state_remain_same" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.equal_stack_domains" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Heap_s.fst", "name": "Vale.Interop.Heap_s.addrs_set" }, { "project_name": "FStar", "file_name": "LowStar.Regional.fst", "name": "LowStar.Regional.rg_inv" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_addr_of" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.create_in" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_buf_3" }, { "project_name": "FStar", "file_name": "FStar.Reflection.Typing.fsti", "name": "FStar.Reflection.Typing.subst" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.permute" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.mmref" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.modifies_buf_4" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.subtract_domain_fact" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.glue_domain_fact" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.Base.fst", "name": "Vale.Interop.Base.mem_roots_p" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.contained_non_tip_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_addresses_intro" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.nat" }, { "project_name": "hacl-star", "file_name": "Vale.Stdcalls.X64.AesHash.fst", "name": "Vale.Stdcalls.X64.AesHash.lowstar_key256_t" }, { "project_name": "FStar", "file_name": "FStar.FiniteMap.Base.fsti", "name": "FStar.FiniteMap.Base.merge_domain_is_union_fact" }, { "project_name": "hacl-star", "file_name": "Vale.Interop.fst", "name": "Vale.Interop.monotone_domain_write_vale_mem" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_in" }, { "project_name": "FStar", "file_name": "FStar.Integers.fst", "name": "FStar.Integers.int_8" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.deref" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions_non_root_4" }, { "project_name": "FStar", "file_name": "LowStar.Regional.fst", "name": "LowStar.Regional.rg_alloc" }, { "project_name": "everparse", "file_name": "LowParse.Repr.fsti", "name": "LowParse.Repr.stable_region_repr_ptr" }, { "project_name": "noise-star", "file_name": "Impl.Noise.Allocate.fst", "name": "Impl.Noise.Allocate.create_regions5" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.ref" } ], "selected_premises": [ "FStar.Tactics.SMT.get_initial_fuel", "FStar.Reflection.V2.Data.var", "FStar.FunctionalExtensionality.feq", "FStar.Tactics.V2.Builtins.ret_t", "FStar.Tactics.SMT.get_max_fuel", "FStar.Tactics.SMT.get_rlimit", "FStar.Tactics.Effect.raise", "FStar.Heap.trivial_preorder", "FStar.Tactics.SMT.get_initial_ifuel", "FStar.Monotonic.HyperStack.live_region", "FStar.Tactics.SMT.get_max_ifuel", "FStar.Tactics.SMT.smt_sync", "FStar.Monotonic.HyperStack.sel", "FStar.HyperStack.ST.is_eternal_region", "FStar.FunctionalExtensionality.on_dom", "FStar.Tactics.Types.issues", "FStar.Sealed.Inhabited.seal", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Reflection.V2.Data.ppname_t", "FStar.ModifiesGen.i_restricted_g_t", "FStar.Reflection.Const.cons_qn", "FStar.Tactics.SMT.smt_sync'", "FStar.Tactics.SMT.set_initial_fuel", "FStar.Tactics.SMT.set_fuel", "FStar.Tactics.SMT.set_max_fuel", "FStar.Tactics.SMT.set_rlimit", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.HyperStack.mreference", "FStar.Reflection.V2.Data.as_ppname", "FStar.Tactics.Effect.get", "FStar.Tactics.SMT.set_ifuel", "FStar.Reflection.Const.squash_qn", "FStar.ModifiesGen.aloc_domain", "FStar.Monotonic.HyperStack.as_addr", "FStar.Reflection.Const.prop_qn", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Reflection.Const.nil_qn", "FStar.Monotonic.HyperStack.frameOf", "FStar.Pervasives.dfst", "FStar.Tactics.SMT.set_initial_ifuel", "FStar.Tactics.SMT.set_max_ifuel", "FStar.Sealed.Inhabited.sealed", "FStar.Pervasives.dsnd", "FStar.Monotonic.HyperStack.is_eternal_region_hs", "FStar.FunctionalExtensionality.on", "FStar.Reflection.Const.string_lid", "FStar.HyperStack.ST.contains_region", "FStar.Reflection.Const.unit_lid", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.HyperStack.ST.is_freeable_heap_region", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.Monotonic.HyperStack.is_eternal_region", "FStar.Reflection.Const.or_qn", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Issue.mk_issue", "FStar.Reflection.Const.imp_qn", "FStar.Monotonic.HyperStack.contains", "FStar.Sealed.Inhabited.sealed_", "FStar.Reflection.Const.eq2_qn", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperStack.is_in", "FStar.Sealed.Inhabited.is_sealed", "FStar.HyperStack.ST.contained_region", "FStar.FunctionalExtensionality.restricted_t", "FStar.Reflection.Const.mktuple8_qn", "FStar.Monotonic.HyperStack.fresh_region", "FStar.Monotonic.HyperHeap.disjoint_regions", "FStar.Reflection.Const.and_qn", "FStar.FunctionalExtensionality.arrow", "FStar.Reflection.Const.eq1_qn", "FStar.Reflection.Const.forall_qn", "FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip", "FStar.Reflection.Const.b2t_qn", "FStar.Reflection.Const.add_qn", "FStar.Reflection.Const.mktuple6_qn", "FStar.Reflection.Const.lsub_qn", "FStar.Reflection.Const.iff_qn", "FStar.Reflection.Const.mod_qn", "FStar.Reflection.V2.Data.notAscription", "FStar.Reflection.Const.mult_qn", "FStar.Reflection.Const.bool_lid", "FStar.Monotonic.HyperHeap.modifies", "FStar.Monotonic.HyperStack.new_eternal_region", "FStar.Reflection.Const.mktuple3_qn", "FStar.Reflection.Const.mktuple7_qn", "FStar.HyperStack.ST.contained_non_tip_region", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Monotonic.HyperStack.modifies_transitively", "FStar.Reflection.Const.neg_qn", "FStar.Monotonic.Heap.mref", "FStar.Reflection.Const.mult'_qn", "FStar.Issue.issue_level_string", "FStar.FunctionalExtensionality.is_restricted", "FStar.Reflection.Const.mktuple5_qn", "FStar.HyperStack.ST.equal_domains", "FStar.Reflection.Const.mktuple2_qn" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.ModifiesGen\n\n#set-options \"--split_queries no\"\n#set-options \"--using_facts_from '*,-FStar.Tactics,-FStar.Reflection,-FStar.List'\"\n\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\nnoeq\ntype aloc (#al: aloc_t) (c: cls al) = | ALoc:\n (region: HS.rid) ->\n (addr: nat) ->\n (loc: option (al region addr)) ->\n aloc c\n\nlet aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))\n\nmodule F = FStar.FunctionalExtensionality\n\n[@@(unifier_hint_injective)]\nlet i_restricted_g_t = F.restricted_g_t\n", "sketch": [ "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will define the `addrs_dom` type as a set of addresses that belong to the specified set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We define a type that represents the domain of addresses in a set of regions.\n\nStep 2: The type `addrs_dom` is implemented by using the `GSet.set` type to represent a set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions.", "The definition `addrs_dom` is about defining a type that represents the domain of addresses in a given set of regions.\n\nStep 1: We need to define a type that represents the domain of addresses in a set of regions.\n\nStep 2: We will implement the `addrs_dom` type by using the `GSet.set` type to represent the set of addresses in the given set of regions." ], "generated_solution": [ "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0", "val addrs_dom : regions: FStar.Ghost.erased (FStar.Set.set FStar.Monotonic.HyperHeap.rid) -> Type0" ] }, { "file_name": "LambdaOmega.fst", "name": "LambdaOmega.kinding_strengthening_ebnd", "opens_and_abbrevs": [ { "open": "FStar.StrongExcludedMiddle" }, { "open": "FStar.FunctionalExtensionality" }, { "open": "FStar.Classical" }, { "open": "FStar.Constructive" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val kinding_strengthening_ebnd :\n g:env -> x:var -> t_x:typ -> #t:typ -> #k:knd ->\n h:(kinding (extend_evar g x t_x) t k) ->\n Tot (kinding g t k) (decreases h)", "source_definition": "let kinding_strengthening_ebnd g x t_x #t #k h = kinding_extensional h g", "source_range": { "start_line": 556, "start_col": 0, "end_line": 556, "end_col": 72 }, "interleaved": false, "definition": "fun g x t_x h -> LambdaOmega.kinding_extensional h g", "effect": "Prims.Tot", "effect_flags": [ "total", "" ], "mutual_with": [], "premises": [ "LambdaOmega.env", "LambdaOmega.var", "LambdaOmega.typ", "LambdaOmega.knd", "LambdaOmega.kinding", "LambdaOmega.extend_evar", "LambdaOmega.kinding_extensional" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n g: LambdaOmega.env ->\n x: LambdaOmega.var ->\n t_x: LambdaOmega.typ ->\n h: LambdaOmega.kinding (LambdaOmega.extend_evar g x t_x) t k\n -> Prims.Tot (LambdaOmega.kinding g t k)", "prompt": "let kinding_strengthening_ebnd g x t_x #t #k h =\n ", "expected_response": "kinding_extensional h g", "source": { "project_name": "FStar", "file_name": "examples/metatheory/LambdaOmega.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "LambdaOmega.fst", "checked_file": "dataset/LambdaOmega.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Constructive.fst.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "var", "knd", "KTyp", "KTyp", "KTyp", "KArr", "KArr", "KArr", "typ", "TVar", "TVar", "TVar", "TLam", "TLam", "TLam", "t", "t", "TApp", "TApp", "TApp", "TArr", "TArr", "TArr", "exp", "EVar", "EVar", "EVar", "EApp", "EApp", "EApp", "ELam", "ELam", "ELam", "esub", "erenaming", "val is_erenaming : s:esub -> GTot (n:int{( erenaming s ==> n=0) /\\\n (~(erenaming s) ==> n=1)})", "let is_erenaming s = (if strong_excluded_middle (erenaming s) then 0 else 1)", "val esub_inc : var -> Tot exp", "let esub_inc y = EVar (y+1)", "let is_evar (e:exp) : int = if EVar? e then 0 else 1", "val esubst : s:esub -> e:exp -> Pure exp (requires True)\n (ensures (fun e' -> erenaming s /\\ EVar? e ==> EVar? e'))\n (decreases %[is_evar e; is_erenaming s; 1; e])", "val esub_lam: s:esub -> x:var -> Tot (e:exp{ erenaming s ==> EVar? e})\n (decreases %[1;is_erenaming s; 0; EVar 0])", "let rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))", "let rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))", "val esub_lam_renaming: s:esub -> Lemma\n (ensures (forall (x:var). erenaming s ==> EVar? (esub_lam s x)))", "let esub_lam_renaming s = ()", "val esubst_extensional: s1:esub -> s2:esub{feq s1 s2} -> e:exp ->\n Lemma (requires True) (ensures (esubst s1 e == esubst s2 e))\n\t\t\t (decreases e)", "let rec esubst_extensional s1 s2 e =\n match e with\n | EVar _ -> ()\n | ELam t e1 ->\n let open FStar.Tactics in\n assert (esubst s1 (ELam t e1) == ELam t (esubst (esub_lam s1) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n assert (esubst s2 (ELam t e1) == ELam t (esubst (esub_lam s2) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n esubst_extensional (esub_lam s1) (esub_lam s2) e1\n | EApp e1 e2 -> esubst_extensional s1 s2 e1; esubst_extensional s1 s2 e2", "val esub_lam_hoist : t:typ -> e:exp -> s:esub -> Lemma (requires True)\n (ensures (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e)))", "let esub_lam_hoist t e s =\n let open FStar.Tactics in\n assert (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e))\n by (norm [zeta; iota; delta_only [`%esubst]])", "val esub_beta : exp -> Tot esub", "let esub_beta e = fun y -> if y = 0 then e\n else (EVar (y-1))", "val esubst_beta : exp -> exp -> Tot exp", "let esubst_beta e = esubst (esub_beta e)", "tsub", "trenaming", "val is_trenaming : s:tsub -> GTot (n:int{( trenaming s ==> n=0) /\\\n (~(trenaming s) ==> n=1)})", "let is_trenaming s = (if strong_excluded_middle (trenaming s) then 0 else 1)", "val tsub_inc_above : nat -> var -> Tot typ", "let tsub_inc_above x y = if y Tot typ", "let tsub_inc = tsub_inc_above 0", "val trenaming_sub_inc : unit -> Lemma (trenaming (tsub_inc))", "let trenaming_sub_inc _ = ()", "let is_tvar (t:typ) : int = if TVar? t then 0 else 1", "val tsubst : s:tsub -> t:typ -> Pure typ (requires True)\n (ensures (fun t' -> trenaming s /\\ TVar? t ==> TVar? t'))\n (decreases %[is_tvar t; is_trenaming s; 1; t])", "val tsub_lam: s:tsub -> x:var -> Tot (t:typ{trenaming s ==> TVar? t})\n (decreases %[1; is_trenaming s; 0; TVar 0])", "let rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))", "let rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))", "val tsubst_extensional: s1:tsub -> s2:tsub{feq s1 s2} -> t:typ ->\n Lemma (requires True) (ensures (tsubst s1 t = tsubst s2 t))\n\t\t\t (decreases t)", "let rec tsubst_extensional s1 s2 t =\n match t with\n | TVar _ -> ()\n | TLam k t1 -> \n let open FStar.Tactics in\n assert (tsubst s1 (TLam k t1) == TLam k (tsubst (tsub_lam s1) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n assert (tsubst s2 (TLam k t1) == TLam k (tsubst (tsub_lam s2) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n tsubst_extensional (tsub_lam s1) (tsub_lam s2) t1\n | TArr t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n | TApp t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2", "val tsub_lam_hoist : k:knd -> t:typ -> s:tsub -> Lemma\n (ensures (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t)))", "let tsub_lam_hoist k t s =\n let open FStar.Tactics in\n assert (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t))\n by norm [zeta; iota; delta_only [`%tsubst]]", "val tsub_comp : s1:tsub -> s2:tsub -> Tot tsub", "let tsub_comp s1 s2 x = tsubst s1 (s2 x)", "val tsub_comp_inc : s:tsub -> x:var ->\n Lemma (tsub_comp tsub_inc s x = tsub_comp (tsub_lam s) tsub_inc x)", "let tsub_comp_inc s x = ()", "val tsub_lam_renaming: s:tsub -> Lemma\n (ensures (forall (x:var). trenaming s ==> TVar? (tsub_lam s x)))", "let tsub_lam_renaming s = ()", "val tsubst_comp : s1:tsub -> s2:tsub -> t:typ -> Lemma\n (ensures (tsubst s1 (tsubst s2 t) = tsubst (tsub_comp s1 s2) t))\n (decreases %[is_tvar t;\n is_trenaming s1;\n is_trenaming s2;\n t])", "let rec tsubst_comp s1 s2 t =\n match t with\n | TVar z -> ()\n | TApp t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n | TLam k tbody ->\n let tsub_lam_comp : x:var ->\n Lemma(tsub_lam (tsub_comp s1 s2) x =\n tsub_comp (tsub_lam s1) (tsub_lam s2) x) =\n fun x -> match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n in\n let hoist1 = tsub_lam_hoist k tbody s2 in\n let hoist2 = tsub_lam_hoist k (tsubst (tsub_lam s2) tbody) s1 in\n let h1 =\n tsub_lam_renaming s1;\n tsub_lam_renaming s2;\n tsubst_comp (tsub_lam s1) (tsub_lam s2) tbody in\n\n let h2 =\n forall_intro tsub_lam_comp;\n cut (feq (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))) in\n\n let ext = tsubst_extensional\n (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))\n tbody in\n\n tsub_lam_hoist k tbody (tsub_comp s1 s2)\n\n | TArr t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2", "val tsub_lam_comp : s1:tsub -> s2:tsub -> x:var -> Lemma\n (tsub_lam (tsub_comp s1 s2) x = tsub_comp (tsub_lam s1) (tsub_lam s2) x)", "let tsub_lam_comp s1 s2 x =\n match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end", "val tsub_id : tsub", "let tsub_id x = TVar x", "val tsubst_id : t:typ -> Lemma (tsubst tsub_id t = t)", "let rec tsubst_id t =\n let open FStar.Tactics in\n match t with\n | TVar z -> ()\n | TLam k t1 ->\n tsub_lam_hoist k t1 tsub_id;\n assert (feq tsub_id (tsub_lam tsub_id))\n by (norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc]]);\n tsubst_extensional tsub_id (tsub_lam tsub_id) t1;\n tsubst_id t1\n | TArr t1 t2\n | TApp t1 t2 -> tsubst_id t1; tsubst_id t2", "val tsub_beta_gen : var -> typ -> Tot tsub", "let tsub_beta_gen x t = fun y -> if y < x then (TVar y)\n else if y = x then t\n else (TVar (y-1))", "val tsubst_beta_gen : var -> typ -> typ -> Tot typ", "let tsubst_beta_gen x t' t = tsubst (tsub_beta_gen x t') t", "let tsubst_beta t' t = tsubst_beta_gen 0 t' t", "val tshift_up_above : nat -> typ -> Tot typ", "let tshift_up_above x = tsubst (tsub_inc_above x)", "val tshift_up : typ -> Tot typ", "let tshift_up = tshift_up_above 0", "step", "SBeta", "SBeta", "SBeta", "t", "t", "e1", "e1", "e2", "e2", "SApp1", "SApp1", "SApp1", "e1", "e1", "e2", "e2", "e1'", "e1'", "hst", "hst", "SApp2", "SApp2", "SApp2", "e1", "e1", "e2", "e2", "e2'", "e2'", "hst", "hst", "a_env", "x_env", "val empty_a: a_env", "let empty_a = fun _ -> None", "val empty_x: x_env", "let empty_x = fun _ -> None", "env", "MkEnv", "MkEnv", "MkEnv", "a", "a", "x", "x", "val lookup_tvar: env -> nat -> Tot (option knd)", "let lookup_tvar g n = MkEnv?.a g n", "val lookup_evar: env -> nat -> Tot (option typ)", "let lookup_evar g n = MkEnv?.x g n", "val empty: env", "let empty = MkEnv empty_a empty_x", "val extend_tvar: g:env -> n:nat -> k:knd -> Tot env", "let extend_tvar g n k =\n let a_env = fun (a:nat) -> if a < n then lookup_tvar g a\n else if a = n then Some k\n else lookup_tvar g (a - 1) in\n let x_env = fun (x:nat) -> match lookup_evar g x with\n | None -> None\n | Some t -> Some (tshift_up_above n t)\n in\n MkEnv a_env x_env", "val extend_evar: g:env -> n:nat -> t:typ -> Tot env", "let extend_evar g n t =\n let a_env = fun (a:nat) -> lookup_tvar g a in\n let x_env = fun (x:nat) -> if x < n then lookup_evar g x\n else if x = n then Some t\n else lookup_evar g (x - 1) in\n MkEnv a_env x_env", "kinding", "KiVar", "KiVar", "KiVar", "g", "g", "a", "a", "KiLam", "KiLam", "KiLam", "g", "g", "k", "k", "t", "t", "k'", "k'", "hk", "hk", "KiApp", "KiApp", "KiApp", "g", "g", "t1", "t1", "t2", "t2", "k11", "k11", "k12", "k12", "hk1", "hk1", "hk2", "hk2", "KiArr", "KiArr", "KiArr", "g", "g", "t1", "t1", "t2", "t2", "hk1", "hk1", "hk2", "hk2", "tequiv", "EqRefl", "EqRefl", "EqRefl", "t", "t", "EqSymm", "EqSymm", "EqSymm", "t1", "t1", "t2", "t2", "he", "he", "EqTran", "EqTran", "EqTran", "t1", "t1", "t2", "t2", "t3", "t3", "he12", "he12", "he23", "he23", "EqLam", "EqLam", "EqLam", "t", "t", "t'", "t'", "k", "k", "he", "he", "EqApp", "EqApp", "EqApp", "t1", "t1", "t1'", "t1'", "t2", "t2", "t2'", "t2'", "he1", "he1", "he2", "he2", "EqBeta", "EqBeta", "EqBeta", "k", "k", "t1", "t1", "t2", "t2", "EqArr", "EqArr", "EqArr", "t1", "t1", "t1'", "t1'", "t2", "t2", "t2'", "t2'", "he1", "he1", "he2", "he2", "typing", "TyVar", "TyVar", "TyVar", "g", "g", "x", "x", "hk", "hk", "TyLam", "TyLam", "TyLam", "g", "g", "t", "t", "e1", "e1", "t'", "t'", "hk", "hk", "ht", "ht", "TyApp", "TyApp", "TyApp", "g", "g", "e1", "e1", "e2", "e2", "t1", "t1", "t2", "t2", "ht1", "ht1", "ht2", "ht2", "TyEqu", "TyEqu", "TyEqu", "g", "g", "e", "e", "t1", "t1", "t2", "t2", "ht", "ht", "he", "he", "hk", "hk", "val is_value : exp -> Tot bool", "let is_value = ELam?", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (b2t (not (is_value e))))\n (ensures (fun _ -> True)) (decreases h)", "let rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n (match e1 with\n | ELam t e1' -> ExIntro (esubst_beta e2 e1') (SBeta t e1' e2)\n | _ -> (match progress h1 with\n | ExIntro e1' h1' -> ExIntro (EApp e1' e2) (SApp1 e2 h1')))\n (* | TyEqu h1 _ _ -> progress h1 -- used to work *)\n (* | TyEqu #g #e #t1 #t2 h1 _ _ -> progress #e #t1 h1\n// -- explicit annotation doesn't help with Pure annotation *)\n | TyEqu h1 _ _ -> progress h1", "val tappears_free_in : x:var -> t:typ -> Tot bool (decreases t)", "let rec tappears_free_in x t =\n match t with\n | TVar y -> x = y\n | TArr t1 t2\n | TApp t1 t2 -> tappears_free_in x t1 || tappears_free_in x t2\n | TLam _ t1 -> tappears_free_in (x+1) t1", "envEqualT", "val tcontext_invariance : #t:typ -> #g:env -> #k:knd ->\n h:(kinding g t k) -> g':env{envEqualT t g g'} ->\n Tot (kinding g' t k) (decreases h)", "let rec tcontext_invariance #t #g #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (tcontext_invariance h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n | KiArr h1 h2 -> KiArr (tcontext_invariance h1 g') (tcontext_invariance h2 g')", "val kinding_extensional: #g:env -> #t:typ -> #k:knd -> h:(kinding g t k) ->\n g':env{feq (MkEnv?.a g) (MkEnv?.a g')} ->\n Tot (kinding g' t k) (decreases h)", "let rec kinding_extensional #g #t #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (kinding_extensional h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (kinding_extensional h1 g') (kinding_extensional h2 g')\n | KiArr h1 h2 -> KiArr (kinding_extensional h1 g') (kinding_extensional h2 g')", "val kinding_weakening_ebnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> t':typ ->\n Tot (kinding (extend_evar g x t') t k)", "let kinding_weakening_ebnd #g #t #k h x t' =\n kinding_extensional h (extend_evar g x t')", "val tshift_up_above_lam: n:nat -> k:knd -> t:typ -> Lemma\n (ensures (tshift_up_above n (TLam k t) = TLam k (tshift_up_above (n + 1) t)))", "let tshift_up_above_lam n k t =\n let open FStar.Tactics in\n assert(tshift_up_above n (TLam k t) = tsubst (tsub_inc_above n) (TLam k t));\n tsub_lam_hoist k t (tsub_inc_above n);\n assert(tshift_up_above n (TLam k t) =\n TLam k (tsubst (tsub_lam (tsub_inc_above n)) t));\n assert (feq (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)))\n by norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc_above]];\n tsubst_extensional (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)) t", "val kinding_weakening_tbnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> k':knd ->\n Tot (kinding (extend_tvar g x k') (tshift_up_above x t) k) (decreases h)", "let rec kinding_weakening_tbnd #g #t #k h x k' =\n match h with\n | KiVar a -> if a < x then KiVar a\n else KiVar (a + 1)\n | KiLam #g k'' #t1 #_ h1 ->\n tshift_up_above_lam x k'' t1;\n let h2 = kinding_weakening_tbnd h1 (x + 1) k' in\n KiLam k'' (kinding_extensional h2 (extend_tvar (extend_tvar g x k') 0 k''))\n | KiApp h1 h2 ->\n KiApp (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n | KiArr h1 h2 ->\n KiArr (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')", "val kinding_strengthening_ebnd :\n g:env -> x:var -> t_x:typ -> #t:typ -> #k:knd ->\n h:(kinding (extend_evar g x t_x) t k) ->\n Tot (kinding g t k) (decreases h)" ], "closest": [ "val weakening : n:nat -> #g:env -> #e:exp -> #t:typ -> t':typ ->\n h:typing g e t -> Tot (typing (extend_gen n t' g) (shift_up_above n e) t)\n (decreases h)\nlet rec weakening n #g #v #t t' h =\n let hs : subst_typing (sub_inc_above n) g (extend_gen n t' g) =\n fun y -> if y < n then TyVar y else TyVar (y+1)\n in substitution (sub_inc_above n) h hs", "val typing_extensional : #e:exp -> #g:env -> #t:typ ->\n h:(typing g e t) -> g':env{feq g g'} -> Tot (typing g' e t) (decreases h)\nlet rec typing_extensional #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyLam t h -> TyLam t (typing_extensional h (extend t g'))\n | TyApp h1 h2 -> TyApp (typing_extensional h1 g') (typing_extensional h2 g')\n | TyUnit -> TyUnit", "val substitution_preserves_typing :\n x:var -> #e:exp -> #v:exp -> #t_x:typ -> #t:typ -> #g:env ->\n $h1:typing empty v t_x ->\n $h2:typing (extend_gen x t_x g) e t ->\n Tot (typing g (subst (sub_beta_gen x v) e) t) (decreases e)\nlet rec substitution_preserves_typing x #e #v #t_x #t #g h1 h2 =\n match h2 with\n | TyVar y ->\n if x=y then (typable_empty_closed h1;\n closed_appears_free v;\n context_invariance h1 g)\n else if y\n let h21' = typing_extensional h21 (extend_gen (x+1) t_x (extend t_y g)) in\n typable_empty_closed h1;\n subst_gen_elam x v t_y e';\n let h21' : (r:typing (extend_gen (x+1) t_x (extend t_y g)) e' t'{e' << e}) =\n h21' in\n TyLam t_y (substitution_preserves_typing (x+1) h1 h21')\n | TyApp #_ #e1 #e2 #t11 #t12 h21 h22 ->\n let h21 : (r:typing (extend_gen x t_x g) e1 (TArr t11 t12){e1 << e}) = h21 in\n let h22 : (r:typing (extend_gen x t_x g) e2 t11{e2 << e}) = h22 in\n (TyApp (substitution_preserves_typing x h1 h21)\n (substitution_preserves_typing x h1 h22))\n | TyUnit -> TyUnit", "val substitution_preserves_typing :\n x:var -> #e:exp -> #v:exp -> #t_x:ty -> #t:ty -> #g:env ->\n h1:rtyping empty v t_x ->\n h2:rtyping (extend g x t_x) e t ->\n Tot (rtyping g (subst_beta x v e) t) (decreases e)\nlet rec substitution_preserves_typing x #e #v #t_x #t #g h1 h2 =\n match h2 with\n | TyVar y ->\n if x=y then (typable_empty_closed' h1; context_invariance h1 g)\n else if y\n (let h21' = typing_extensional h21 (extend (extend g 0 t_y) (x+1) t_x) in\n TyAbs t_y (substitution_preserves_typing (x+1) h1 h21'))\n | TyApp #g' #e1 #e2 #t11 #t12 h21 h22 ->\n (* CH: implicits don't work here, why? *)\n (* NS: They do now *)\n (TyApp // #g #(subst_beta x v e1) #(subst_beta x v e2) #t11 #t12\n (substitution_preserves_typing x h1 h21)\n (substitution_preserves_typing x h1 h22))", "val context_invariance : #e:exp -> #g:env -> #t:typ ->\n h:(typing g e t) -> g':env{envEqualE e g g'} ->\n Tot (typing g' e t) (decreases h)\nlet rec context_invariance #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyLam t_y h1 ->\n TyLam t_y (context_invariance h1 (extend t_y g'))\n | TyApp h1 h2 ->\n TyApp (context_invariance h1 g') (context_invariance h2 g')\n | TyUnit -> TyUnit", "val context_invariance : #e:exp -> #g:env -> #t:ty ->\n h:(rtyping g e t) -> g':env{equalE e g g'} ->\n Tot (rtyping g' e t) (decreases h)\nlet rec context_invariance #e #g #t h g' =\n match h with\n | TyVar x -> TyVar x\n | TyAbs t_y h1 ->\n TyAbs t_y (context_invariance h1 (extend g' 0 t_y))\n | TyApp h1 h2 ->\n TyApp (context_invariance h1 g') (context_invariance h2 g')", "val preservation : #e:exp -> #e':exp -> #g:env -> #t:typ ->\n ht:(typing g e t) ->\n hs:step e e' ->\n Tot (typing g e' t) (decreases ht)\nlet rec preservation #e #e' #g #t (TyApp h1 h2) hs =\n match hs with\n | SBeta tx e1' e2' -> substitution_beta h2 (TyLam?.hbody h1)\n | SApp1 e2' hs1 -> TyApp (preservation h1 hs1) h2\n | SApp2 e1' hs2 -> TyApp h1 (preservation h2 hs2)", "val substitution :\n #g1:env -> #e:exp -> #t:typ -> s:sub -> #g2:env ->\n h1:typing g1 e t ->\n hs:subst_typing s g1 g2 ->\n Tot (typing g2 (subst s e) t)\n (decreases %[is_var e; is_renaming s; e])\nlet rec substitution #g1 #e #t s #g2 h1 hs =\n match h1 with\n | TyVar x -> hs x\n | TyApp hfun harg -> TyApp (substitution s hfun hs) (substitution s harg hs)\n | TyLam tlam hbody ->\n let hs'' : subst_typing (sub_inc) g2 (extend tlam g2) =\n fun x -> TyVar (x+1) in\n let hs' : subst_typing (sub_elam s) (extend tlam g1) (extend tlam g2) =\n fun y -> if y = 0 then TyVar y\n else let n:var = y - 1 in //Silly limitation of implicits and refinements\n substitution sub_inc (hs n) hs'' //NS: needed to instantiate the Some?.v \n in TyLam tlam (substitution (sub_elam s) hbody hs')\n | TyUnit -> TyUnit", "val tot_typing_weakening_n\n (#g:env) (#t:term) (#ty:term)\n (bs:list binding{all_fresh g bs})\n (d:tot_typing g t ty)\n : Tot (tot_typing (push_bindings g bs) t ty)\n (decreases bs)\nlet rec tot_typing_weakening_n bs d =\n match bs with\n | [] -> d\n | (x,t)::bs ->\n let d = Pulse.Typing.Metatheory.tot_typing_weakening_single d x t in\n tot_typing_weakening_n bs d", "val tot_typing_weakening_standard (g:env)\n (#t #ty:term) (d:tot_typing g t ty)\n (g1:env { g1 `env_extends` g })\n : tot_typing g1 t ty\nlet tot_typing_weakening_standard g #t #ty d g2 =\n let g1 = diff g2 g in\n let g' = mk_env (fstar_env g) in\n assert (equal (push_env g g1) g2);\n assert (equal (push_env g g') g);\n assert (equal (push_env (push_env g g1) g') g2);\n tot_typing_weakening g g' t ty d g1", "val tot_typing_weakening_single (#g:env) (#t #ty:term)\n (d:tot_typing g t ty)\n (x:var { ~ (x `Set.mem` dom g)})\n (x_t:typ)\n\n : tot_typing (push_binding g x ppname_default x_t) t ty\nlet tot_typing_weakening_single #g #t #ty d x x_t =\n let g1 = singleton_env (fstar_env g) x x_t in\n let g' = mk_env (fstar_env g) in\n assert (equal (push_env g g') g);\n assert (equal (push_env (push_env g g1) g') (push_env g g1));\n assert (equal (push_env g g1) (push_binding g x ppname_default x_t));\n tot_typing_weakening g g' t ty d g1", "val src_typing_weakening\n (#f: _)\n (sg sg': src_env)\n (x: var{None? (lookup sg x) && None? (lookup sg' x)})\n (b: binding)\n (e: src_exp)\n (t: s_ty)\n (d: src_typing f (sg' @ sg) e t)\n : GTot (d': src_typing f (sg' @ ((x, b) :: sg)) e t {height d == height d'})\n (decreases (height d))\nlet rec src_typing_weakening #f (sg sg':src_env) \n (x:var { None? (lookup sg x) && None? (lookup sg' x) })\n (b:binding)\n (e:src_exp)\n (t:s_ty) \n (d:src_typing f (sg'@sg) e t)\n : GTot (d':src_typing f (sg'@((x, b)::sg)) e t { height d == height d' })\n (decreases (height d))\n = match d with\n | T_Bool _ b -> T_Bool _ b\n\n | T_Var _ y -> \n lookup_append_inverse sg sg' y; \n lookup_append_inverse ((x,b)::sg) sg' y;\n T_Var _ y\n\n | T_App g e1 e2 t t' s0 d1 d2 s ->\n let d1 = src_typing_weakening _ _ _ _ _ _ d1 in\n let d2 = src_typing_weakening _ _ _ _ _ _ d2 in \n let s = sub_typing_weakening _ _ _ _ _ _ s in\n T_App _ _ _ _ _ _ d1 d2 s\n\n | T_Lam g t e t' y dt de ->\n assert (None? (lookup (sg'@sg) y));\n lookup_append_inverse sg sg' y;\n src_typing_freevars _ _ _ d;\n let dt = src_ty_ok_weakening sg sg' x b _ dt in\n let y' = fresh (sg'@((x,b) :: sg)) in\n fresh_is_fresh (sg'@((x,b) :: sg));\n lookup_append_inverse ((x,b)::sg) sg' y';\n lookup_append_inverse sg sg' y'; \n assert (None? (lookup (sg'@sg) y'));\n let de \n : src_typing f ((y', Inl t)::(sg'@sg)) (open_exp e y') t'\n = rename_open e y y';\n src_typing_renaming (sg'@sg) [] y y' (Inl t) _ _ de\n in\n let de\n : src_typing f ((y', Inl t)::sg'@(x,b)::sg) (open_exp e y') t'\n = src_typing_weakening sg ((y', Inl t)::sg') x b _ _ de\n in\n T_Lam _ _ _ _ _ dt de\n\n | T_If g eb e1 e2 t1 t2 t hyp db d1 d2 s1 s2 dt ->\n src_typing_freevars _ _ _ d;\n let db = src_typing_weakening _ _ _ _ _ _ db in\n lookup_append_inverse sg sg' hyp;\n let hyp' = fresh (sg'@((x,b) :: sg)) in\n fresh_is_fresh (sg'@((x,b) :: sg));\n lookup_append_inverse ((x,b)::sg) sg' hyp';\n lookup_append_inverse sg sg' hyp'; \n rename_id hyp hyp' e1;\n rename_id hyp hyp' e2; \n let d1 \n : src_typing f ((hyp', Inr (eb, EBool true))::(sg'@sg)) (rename e1 hyp hyp') t1\n = src_typing_renaming (sg'@sg) [] hyp hyp' _ _ _ d1\n in\n let d1\n : src_typing f ((hyp', Inr (eb, EBool true))::sg'@(x,b)::sg) (rename e1 hyp hyp') t1\n = src_typing_weakening sg ((hyp', Inr (eb, EBool true))::sg') x b _ _ d1\n in\n let d2\n : src_typing f ((hyp', Inr (eb, EBool false))::(sg'@sg)) (rename e2 hyp hyp') t2\n = src_typing_renaming (sg'@sg) [] hyp hyp' _ _ _ d2\n in\n let d2\n : src_typing f ((hyp', Inr (eb, EBool false))::sg'@(x,b)::sg) (rename e2 hyp hyp') t2\n = src_typing_weakening sg ((hyp', Inr (eb, EBool false))::sg') x b _ _ d2\n in\n let s1 : sub_typing f ((hyp', Inr (eb, EBool true))::sg'@(x,b)::sg) t1 t\n = sub_typing_weakening sg ((hyp', Inr (eb, EBool true))::sg') x b _ _\n (sub_typing_renaming g [] hyp hyp' _ _ _ s1)\n in\n let s2 : sub_typing f ((hyp', Inr (eb, EBool false))::sg'@(x,b)::sg) t2 t\n = sub_typing_weakening sg ((hyp', Inr (eb, EBool false))::sg') x b _ _\n (sub_typing_renaming g [] hyp hyp' _ _ _ s2)\n in\n let dt = src_ty_ok_weakening _ _ _ _ _ dt in\n T_If _ _ _ _ _ _ _ hyp' db d1 d2 s1 s2 dt", "val substitution_beta :\n #e:exp -> #v:exp -> #t_x:typ -> #t:typ -> #g:env ->\n h1:typing g v t_x ->\n h2:typing (extend t_x g) e t ->\n Tot (typing g (subst (sub_beta v) e) t) (decreases e)\nlet rec substitution_beta #e #v #t_x #t #g h1 h2 =\n let hs : subst_typing (sub_beta v) (extend t_x g) g =\n fun y -> if y = 0 then h1 else TyVar (y-1) in\n substitution (sub_beta v) h2 hs", "val typing_extensional : #e:exp -> #g:env -> #t:ty ->\n h:(rtyping g e t) -> g':env{equal g g'} ->\n Tot (rtyping g' e t)\nlet typing_extensional #e #g #t h g' = context_invariance h g'", "val extend_gen_typing_conversion\n (#t: typ)\n (#g: env)\n (#e0: exp)\n (#t0: typ)\n (h: typing (extend t g) e0 t0)\n : Tot (typing (extend_gen 0 t g) e0 t0)\nlet rec extend_gen_typing_conversion (#t:typ) (#g:env) (#e0:exp) (#t0:typ) (h:typing (extend t g) e0 t0)\n :Tot (typing (extend_gen 0 t g) e0 t0) = h", "val typable_below : x:var -> #g:env -> #e:exp -> #t:typ\n -> h:typing g e t{below_env x g} ->\n Lemma (requires True) (ensures (below x e)) (decreases h)\nlet rec typable_below x #g #e #t h =\n match h with\n | TyVar y -> ()\n | TyApp h1 h2 -> typable_below x h1; typable_below x h2\n | TyLam _y h1 -> typable_below (x+1) h1\n | TyUnit -> ()", "val st_typing_weakening_end\n (g:env) (g':env { disjoint g g' })\n (t:st_term) (c:comp) (d:st_typing (push_env g g') t c)\n (g'':env { g'' `env_extends` g' /\\ disjoint g'' g })\n : st_typing (push_env g g'') t c\nlet st_typing_weakening_end\n (g:env) (g':env { disjoint g g' })\n (t:st_term) (c:comp) (d:st_typing (push_env g g') t c)\n (g'':env { g'' `env_extends` g' /\\ disjoint g'' g })\n : st_typing (push_env g g'') t c =\n\n let g2 = diff g'' g' in\n let emp_env = mk_env (fstar_env g) in\n assert (equal (push_env g g')\n (push_env (push_env g g') emp_env));\n let d\n : st_typing (push_env (push_env (push_env g g') g2) emp_env) _ _\n = Pulse.Typing.Metatheory.Base.st_typing_weakening (push_env g g') emp_env t c (coerce_eq () d) g2 in\n assert (equal (push_env (push_env (push_env g g') g2) emp_env)\n (push_env (push_env g g') g2));\n push_env_assoc g g' g2;\n assert (equal (push_env (push_env g g') g2)\n (push_env g (push_env g' g2)));\n assert (equal (push_env g (push_env g' g2))\n (push_env g g''));\n coerce_eq () d", "val src_ty_ok_weakening\n (#f: RT.fstar_top_env)\n (sg sg': src_env)\n (x: var{None? (lookup sg x) && None? (lookup sg' x)})\n (b: binding)\n (t: s_ty)\n (d: src_ty_ok f (sg' @ sg) t)\n : GTot (d': src_ty_ok f (sg' @ ((x, b) :: sg)) t {t_height d' == t_height d}) (decreases d)\nlet rec src_ty_ok_weakening (#f:RT.fstar_top_env)\n (sg sg':src_env)\n (x:var { None? (lookup sg x) && None? (lookup sg' x) })\n (b:binding)\n (t:s_ty)\n (d:src_ty_ok f (sg'@sg) t)\n : GTot (d':src_ty_ok f (sg'@((x, b)::sg)) t { t_height d' == t_height d })\n (decreases d)\n = match d with\n | OK_TBool _ -> OK_TBool _\n | OK_TArrow _ _ _ d1 d2 -> \n let d1 = src_ty_ok_weakening _ _ _ _ _ d1 in\n let d2 = src_ty_ok_weakening _ _ _ _ _ d2 in \n OK_TArrow _ _ _ d1 d2\n | OK_TRefine _ _ d -> OK_TRefine _ _ d", "val soundness\n (#sg: stlc_env)\n (#se: stlc_exp)\n (#st: stlc_ty)\n (dd: stlc_typing sg se st)\n (g: RT.fstar_top_env)\n : GTot (RT.tot_typing (extend_env_l g sg) (elab_exp se) (elab_ty st)) (decreases dd)\nlet rec soundness (#sg:stlc_env) \n (#se:stlc_exp)\n (#st:stlc_ty)\n (dd:stlc_typing sg se st)\n (g:RT.fstar_top_env)\n : GTot (RT.tot_typing (extend_env_l g sg)\n (elab_exp se)\n (elab_ty st))\n (decreases dd)\n = match dd with\n | T_Unit _ ->\n RT.T_Const _ _ _ RT.CT_Unit\n\n | T_Var _ x ->\n RT.T_Var _ (R.pack_namedv (RT.make_namedv x))\n\n | T_Lam _ t e t' x de ->\n let de : RT.tot_typing (extend_env_l g ((x,t)::sg))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = soundness de g \n in \n let de : RT.tot_typing (RT.extend_env (extend_env_l g sg) x (elab_ty t))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = de\n in\n fresh_is_fresh sg;\n elab_exp_freevars e;\n let dd\n = RT.T_Abs (extend_env_l g sg)\n x\n (elab_ty t) \n (elab_exp e)\n (T.E_Total, elab_ty t')\n _\n RT.pp_name_default\n R.Q_Explicit\n _\n (elab_ty_soundness g sg t)\n de\n in\n dd\n | T_App _ e1 e2 t t' d1 d2 ->\n let dt1 \n : RT.tot_typing (extend_env_l g sg)\n (elab_exp e1)\n (elab_ty (TArrow t t'))\n = soundness d1 g\n in\n let dt2\n : RT.tot_typing (extend_env_l g sg)\n (elab_exp e2)\n (elab_ty t)\n = soundness d2 g\n in\n let dt :\n RT.tot_typing (extend_env_l g sg)\n (elab_exp (EApp e1 e2))\n (RT.open_with (elab_ty t') (elab_exp e2))\n = RT.T_App _ _ _ _ _ _ dt1 dt2\n in\n dt", "val st_typing_weakening_standard\n (#g:env) (#t:st_term) (#c:comp) (d:st_typing g t c)\n (g1:env { g1 `env_extends` g })\n : st_typing g1 t c\nlet st_typing_weakening_standard\n (#g:env) (#t:st_term) (#c:comp) (d:st_typing g t c)\n (g1:env { g1 `env_extends` g })\n : st_typing g1 t c =\n\n let g' = mk_env (fstar_env g) in\n assert (equal (push_env g g') g);\n let d = st_typing_weakening g g' t c d g1 in\n assert (equal (push_env g1 g') g1);\n d", "val src_typing_weakening_l\n (#f: _)\n (sg: src_env)\n (sg': src_env{(src_env_ok sg') /\\ (forall x. Some? (lookup sg' x) ==> None? (lookup sg x))})\n (e: src_exp)\n (t: s_ty)\n (d: src_typing f sg e t)\n : GTot (d': src_typing f L.(sg' @ sg) e t {height d == height d'}) (decreases sg')\nlet rec src_typing_weakening_l #f (sg:src_env) \n (sg':src_env { \n (src_env_ok sg') /\\\n (forall x. Some? (lookup sg' x) ==> None? (lookup sg x))\n })\n (e:src_exp)\n (t:s_ty) \n (d:src_typing f sg e t)\n : GTot (d':src_typing f L.(sg' @ sg) e t { height d == height d' })\n (decreases sg')\n = match sg' with\n | [] -> d\n | (x, b)::tl ->\n let d = src_typing_weakening_l sg tl e t d in\n lookup_append_inverse sg tl x;\n src_typing_weakening (tl@sg) [] x b _ _ d", "val preservation : #e:exp -> #t:ty -> h:rtyping empty e t{Some? (step e)} ->\n Tot (rtyping empty (Some?.v (step e)) t) (decreases e)\nlet rec preservation #e #t h =\n let TyApp #g #e1 #e2 #t11 #t12 h1 h2 = h in\n if is_value e1\n then (if is_value e2\n then let TyAbs t_x hbody = h1 in\n substitution_preserves_typing 0 h2 hbody\n else TyApp h1 (preservation h2)) \n //^^^^^^^^^^^^^^^^^\n else TyApp (preservation h1) h2", "val soundness\n (#f: fstar_top_env)\n (#sg: src_env{src_env_ok sg})\n (#se: src_exp)\n (#st: src_ty)\n (dd: src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_exp se) (elab_ty st)) (decreases (height dd))\nlet rec soundness (#f:fstar_top_env)\n (#sg:src_env { src_env_ok sg } ) \n (#se:src_exp)\n (#st:src_ty)\n (dd:src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg)\n (elab_exp se)\n (elab_ty st))\n (decreases (height dd))\n = match dd with\n | T_Bool _ true ->\n RT.T_Const _ _ _ RT.CT_True\n\n | T_Bool _ false ->\n RT.T_Const _ _ _ RT.CT_False\n\n | T_Var _ x ->\n RT.T_Var _ (R.pack_namedv (RT.make_namedv x))\n\n | T_Lam _ t e t' x dt de ->\n let de : RT.tot_typing (extend_env_l f ((x,Inl t)::sg))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = soundness de\n in \n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x (elab_ty t))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = de\n in\n fresh_is_fresh sg;\n freevars_elab_exp e;\n let dt : RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero) =\n src_ty_ok_soundness sg t dt\n in\n let dd\n : RT.tot_typing (extend_env_l f sg)\n (R.pack_ln (R.Tv_Abs (RT.mk_simple_binder RT.pp_name_default (elab_ty t)) (elab_exp e)))\n (elab_ty (TArrow t (close_ty t' x)))\n = RT.close_term_spec (elab_ty t') x;\n assert (elab_ty (close_ty t' x) ==\n RT.subst_term (elab_ty t') [ RT.ND x 0 ]);\n RT.T_Abs (extend_env_l f sg)\n x\n (elab_ty t) \n (elab_exp e)\n (T.E_Total, elab_ty t')\n _\n _\n _\n _\n dt\n de\n in\n dd\n\n | T_If _ b e1 e2 t1 t2 t hyp db d1 d2 s1 s2 tok ->\n let db = soundness db in\n let d1 = soundness d1 in\n let d2 = soundness d2 in\n let s1 = subtyping_soundness s1 in\n let s2 = subtyping_soundness s2 in\n let t_ok = src_ty_ok_soundness sg t tok in\n let d1 = RT.T_Sub _ _ _ _ d1 (RT.Relc_typ _ _ _ _ _ s1) in\n let d2 = RT.T_Sub _ _ _ _ d2 (RT.Relc_typ _ _ _ _ _ s2) in\n freevars_elab_exp e1;\n freevars_elab_exp e2;\n RT.T_If (extend_env_l f sg) (elab_exp b) (elab_exp e1) (elab_exp e2) _ _ hyp _ _ db d1 d2 t_ok\n\n | T_App _ e1 e2 t t' t0 d1 d2 st ->\n let dt1 \n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e1)\n (elab_ty (TArrow t t'))\n = soundness d1\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t0)\n = soundness d2\n in\n let st\n : RT.sub_typing (extend_env_l f sg) (elab_ty t0) (elab_ty t)\n = subtyping_soundness st\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t)\n = RT.T_Sub _ _ _ _ dt2 (RT.Relc_typ _ _ _ _ _ st)\n in\n RT.T_App _ _ _ _ (elab_ty t') _ dt1 dt2\n\nand src_ty_ok_soundness (#f:fstar_top_env)\n (sg:src_env { src_env_ok sg })\n (t:src_ty)\n (dt:src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\n = match dt with\n | OK_TBool _ ->\n RT.T_FVar _ RT.bool_fv\n\n | OK_TArrow _ t1 t2 x ok_t1 ok_t2 ->\n let t1_ok = src_ty_ok_soundness sg _ ok_t1 in\n let t2_ok = src_ty_ok_soundness ((x, Inl t1)::sg) _ ok_t2 in\n freevars_elab_ty t2;\n let arr_max = RT.T_Arrow _ x (elab_ty t1) (elab_ty t2) _ _ RT.pp_name_default R.Q_Explicit T.E_Total _ _ t1_ok t2_ok in\n RT.simplify_umax arr_max\n\n | OK_TRefine _ e x de ->\n let de \n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp (open_exp e x))\n (elab_ty TBool)\n = soundness de\n in\n let de\n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (r_b2t (elab_exp (open_exp e x)))\n (RT.tm_type RT.u_zero)\n = b2t_typing _ _ de\n in\n let bool_typing\n : RT.tot_typing (extend_env_l f sg) RT.bool_ty (RT.tm_type RT.u_zero)\n = RT.T_FVar _ RT.bool_fv\n in\n elab_open_b2t e x;\n freevars_elab_exp e;\n RT.T_Refine (extend_env_l f sg)\n x\n RT.bool_ty\n (r_b2t (elab_exp e))\n _ _ _ _\n bool_typing \n de", "val preservation : #e:exp -> #t:typ -> h:typing empty e t{Some? (step e)} ->\n Tot (typing empty (Some?.v (step e)) t) (decreases e)\nlet rec preservation #e #t h =\n let TyApp #g #e1 #e2 #t11 #t12 h1 h2 = h in\n if is_value e1\n then (if is_value e2\n then let TyLam t_x hbody = h1 in\n (extend_gen_0 t_x empty;\n substitution_preserves_typing 0 h2 (extend_gen_typing_conversion hbody))\n else TyApp h1 (preservation h2))\n else TyApp (preservation h1) h2", "val st_sub_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c1 #c2: comp)\n (d: st_sub (push_env g g') c1 c2)\n (g1: env{pairwise_disjoint g g1 g'})\n : Tot (st_sub (push_env (push_env g g1) g') c1 c2) (decreases d)\nlet rec st_sub_weakening (g:env) (g':env { disjoint g g' })\n (#c1 #c2:comp) (d:st_sub (push_env g g') c1 c2)\n (g1:env { pairwise_disjoint g g1 g' })\n : Tot (st_sub (push_env (push_env g g1) g') c1 c2)\n (decreases d)\n=\n let g'' = push_env (push_env g g1) g' in\n match d with\n | STS_Refl _ _ ->\n STS_Refl _ _\n | STS_Trans _ _ _ _ dl dr ->\n STS_Trans _ _ _ _ (st_sub_weakening g g' dl g1) (st_sub_weakening g g' dr g1)\n | STS_AtomicInvs _ stc is1 is2 o1 o2 tok ->\n let tok : prop_validity g'' (tm_inames_subset is1 is2) = prop_validity_token_weakening tok g'' in\n STS_AtomicInvs g'' stc is1 is2 o1 o2 tok", "val elab_ty_soundness (g: RT.fstar_top_env) (sg: stlc_env) (t: stlc_ty)\n : GTot (RT.tot_typing (extend_env_l g sg) (elab_ty t) (RT.tm_type RT.u_zero)) (decreases t)\nlet rec elab_ty_soundness (g:RT.fstar_top_env)\n (sg:stlc_env)\n (t:stlc_ty)\n : GTot (RT.tot_typing (extend_env_l g sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases t)\n = match t with\n | TUnit -> \n RT.T_FVar _ RT.unit_fv\n \n | TArrow t1 t2 ->\n let t1_ok = elab_ty_soundness g sg t1 in\n let x = fresh sg in\n fresh_is_fresh sg;\n elab_ty_freevars t2;\n let t2_ok = elab_ty_soundness g ((x, t1)::sg) t2 in\n let arr_max \n : RT.tot_typing \n (extend_env_l g sg)\n (elab_ty t)\n (RT.tm_type RT.(u_max u_zero u_zero))\n = RT.T_Arrow _ x (elab_ty t1) (elab_ty t2) \n _ _ RT.pp_name_default R.Q_Explicit T.E_Total _ _ t1_ok t2_ok\n in\n RT.simplify_umax arr_max", "val st_typing_weakening\n (g:env) (g':env { disjoint g g' })\n (t:st_term) (c:comp) (d:st_typing (push_env g g') t c)\n (g1:env { g1 `env_extends` g /\\ disjoint g1 g' })\n : st_typing (push_env g1 g') t c\nlet st_typing_weakening\n (g:env) (g':env { disjoint g g' })\n (t:st_term) (c:comp) (d:st_typing (push_env g g') t c)\n (g1:env { g1 `env_extends` g /\\ disjoint g1 g' })\n : st_typing (push_env g1 g') t c =\n\n let g2 = diff g1 g in\n let d = st_typing_weakening g g' t c d g2 in\n assert (equal (push_env (push_env g g2) g') (push_env g1 g'));\n d", "val extend (g: env) (x: int) (t: ty) : env\nlet extend (g:env) (x:int) (t:ty) \n : env \n = fun x' -> if x = x' then Some t else g x'", "val elab_st_typing (#g: env) (#t: st_term) (#c: comp) (d: st_typing g t c)\n : Tot R.term (decreases d)\nlet rec elab_st_typing (#g:env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c)\n : Tot R.term (decreases d)\n = match d with\n // | T_Tot _ t _ _ -> elab_term t\n\n | T_Abs _ x qual b _u body _c ty_typing body_typing ->\n let ty = elab_term b.binder_ty in\n let ppname = b.binder_ppname.name in\n let body = elab_st_typing body_typing in\n mk_abs_with_name ppname ty (elab_qual qual) (RT.close_term body x) //this closure should be provably redundant by strengthening the conditions on x\n\n\n | T_STApp _ head _ qual _ arg _ _\n | T_STGhostApp _ head _ qual _ arg _ _ _ _ ->\n let head = elab_term head in\n let arg = elab_term arg in\n R.mk_app head [(arg, elab_qual qual)]\n\n | T_Return _ c use_eq u ty t post _ _ _ _ ->\n let ru = u in\n let rty = elab_term ty in\n let rt = elab_term t in\n let rp = elab_term post in\n let rp = mk_abs rty R.Q_Explicit rp in\n (match c, use_eq with\n | STT, true -> mk_stt_return ru rty rt rp\n | STT, false -> mk_stt_return_noeq ru rty rt rp\n | STT_Atomic, true -> mk_stt_atomic_return ru rty rt rp\n | STT_Atomic, false -> mk_stt_atomic_return_noeq ru rty rt rp\n | STT_Ghost, true -> mk_stt_ghost_return ru rty rt rp\n | STT_Ghost, false -> mk_stt_ghost_return_noeq ru rty rt rp)\n\n | T_Bind _ e1 e2 c1 c2 b x c e1_typing t_typing e2_typing bc ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n elab_bind bc e1 (mk_abs_with_name b.binder_ppname.name ty1 R.Q_Explicit (RT.close_term e2 x))\n\n | T_BindFn _ _ _ c1 c2 b x e1_typing _u t_typing e2_typing c2_typing ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n RT.mk_let RT.pp_name_default e1 ty1 (RT.close_term e2 x)\n \n | T_Frame _ _ c frame _frame_typing e_typing ->\n let e = elab_st_typing e_typing in\n elab_frame c frame e\n \n | T_Equiv _ _ c1 c2 e_typing (ST_TotEquiv _ _ _ _ _ _) ->\n let e = elab_st_typing e_typing in\n e\n\n | T_Equiv _ _ c1 c2 e_typing _ ->\n let e = elab_st_typing e_typing in\n elab_sub c1 c2 e\n\n | T_Sub _ _ c1 c2 e_typing d_sub ->\n let e = elab_st_typing e_typing in\n let (| coercion, _ |) = elab_st_sub d_sub in\n R.mk_e_app coercion [e]\n\n | T_Lift _ _ c1 c2 e_typing lc ->\n let e = elab_st_typing e_typing in\n elab_lift lc e\n\n | T_If _ b _ _ _ _ _ e1_typing e2_typing _c_typing ->\n let rb = elab_term b in\n let re1 = elab_st_typing e1_typing in\n let re2 = elab_st_typing e2_typing in\n RT.mk_if rb re1 re2\n\n | T_Match _ _ _ sc _ _ _ _ _ brty _ ->\n let sc = elab_term sc in\n let brs = elab_branches brty in\n R.pack_ln (R.Tv_Match sc None brs)\n\n | T_IntroPure _ p _ _ ->\n let head = \n tm_pureapp (tm_fvar (as_fv (mk_pulse_lib_core_lid \"intro_pure\")))\n None\n p\n in\n let arg = (`()) in\n R.mk_app (elab_term head) [(arg, elab_qual None)]\n\n | T_ElimExists _ u t p _ d_t d_exists ->\n let ru = u in\n let rt = elab_term t in\n let rp = elab_term p in\n mk_elim_exists ru rt (mk_abs rt R.Q_Explicit rp)\n\n | T_IntroExists _ u b p e _ _ _ ->\n let ru = u in\n let rt = elab_term b.binder_ty in\n let rp = elab_term p in\n let re = elab_term e in\n mk_intro_exists ru rt (mk_abs rt R.Q_Explicit rp) re\n\n | T_While _ inv _ _ _ cond_typing body_typing ->\n let inv = elab_term inv in\n let cond = elab_st_typing cond_typing in\n let body = elab_st_typing body_typing in\n mk_while (mk_abs bool_tm R.Q_Explicit inv) cond body\n\n | T_Par _ eL cL eR cR _ _ _ eL_typing eR_typing ->\n let ru = comp_u cL in\n let raL = elab_term (comp_res cL) in\n let raR = elab_term (comp_res cR) in\n let rpreL = elab_term (comp_pre cL) in\n let rpostL = elab_term (comp_post cL) in\n let rpreR = elab_term (comp_pre cR) in\n let rpostR = elab_term (comp_post cR) in\n let reL = elab_st_typing eL_typing in\n let reR = elab_st_typing eR_typing in\n mk_par ru\n raL\n raR\n rpreL\n (mk_abs raL R.Q_Explicit rpostL)\n rpreR\n (mk_abs raR R.Q_Explicit rpostR)\n reL reR\n\n\t\t\t\t| T_Rewrite _ p q _ _ ->\n\t\t\t\t let rp = elab_term p in\n\t\t\t\t\t\tlet rq = elab_term q in\n\t\t\t\t\t\tmk_rewrite rp rq\n\n | T_WithLocal _ _ init _ init_t c x _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_ref ra) R.Q_Explicit rbody in\n mk_withlocal rret_u ra rinit rpre rret_t rpost rbody\n\n | T_WithLocalArray _ _ init len _ init_t c x _ _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rlen = elab_term len in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_array ra) R.Q_Explicit rbody in\n mk_withlocalarray rret_u ra rinit rlen rpre rret_t rpost rbody\n\n | T_Admit _ {u;res;pre;post} c _ ->\n let ru = u in\n let rres = elab_term res in\n let rpre = elab_term pre in\n let rpost = elab_term post in\n let rpost = mk_abs rres R.Q_Explicit rpost in\n (match c with\n | STT -> mk_stt_admit ru rres rpre rpost\n | STT_Atomic -> mk_stt_atomic_admit ru rres rpre rpost\n | STT_Ghost -> mk_stt_ghost_admit ru rres rpre rpost)\n\n | T_Unreachable _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_Unreachable\")\n\n | T_WithInv _ _ _ _ _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_WithInv\")\n\nand elab_br (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#p:pattern)\n (#e:st_term)\n (d : br_typing g sc_u sc_ty sc p e c)\n : Tot R.branch (decreases d)\n = let TBR _ _ _ _ _ _ _ _ bs _ _ _ ed = d in\n let e = elab_st_typing ed in\n (elab_pat p, e)\nand elab_branches (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#brs:list branch)\n (d : brs_typing g sc_u sc_ty sc brs c)\n : Tot (list R.branch)\n (decreases d)\n = match d with\n | TBRS_0 _ -> []\n | TBRS_1 _ p e bd _ d' ->\n elab_br bd :: elab_branches d'", "val soundness\n (#f: RT.fstar_top_env)\n (#sg: src_env{src_env_ok sg})\n (#se: src_exp{ln se})\n (#st: s_ty)\n (dd: src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_exp se) (elab_ty st)) (decreases (height dd))\nlet rec soundness (#f:RT.fstar_top_env)\n (#sg:src_env { src_env_ok sg } ) \n (#se:src_exp { ln se })\n (#st:s_ty)\n (dd:src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg)\n (elab_exp se)\n (elab_ty st))\n (decreases (height dd))\n = match dd with\n | T_Bool _ true ->\n RT.T_Const _ _ _ RT.CT_True\n\n | T_Bool _ false ->\n RT.T_Const _ _ _ RT.CT_False\n\n | T_Var _ x ->\n RT.T_Var _ (R.pack_namedv (RT.make_namedv x))\n\n | T_Lam _ t e t' x dt de ->\n let de : RT.tot_typing (extend_env_l f ((x,Inl t)::sg))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = soundness de\n in \n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x (elab_ty t))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = de\n in\n fresh_is_fresh sg;\n let dt : RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero) =\n src_ty_ok_soundness sg t dt\n in\n freevars_elab_exp e;\n let dd\n : RT.tot_typing (extend_env_l f sg)\n _ //(R.pack_ln (R.Tv_Abs (RT.mk_binder RT.pp_name_default 0 (elab_ty t) R.Q_Explicit) (elab_exp e)))\n (elab_ty (TArrow t t'))\n = RT.close_term_spec (elab_ty t') x;\n RT.T_Abs (extend_env_l f sg)\n x\n (elab_ty t) \n (elab_exp e)\n (T.E_Total, elab_ty t')\n _\n RT.pp_name_default\n R.Q_Explicit\n _\n dt\n de\n in\n dd\n\n | T_App _ e1 e2 t t' t0 d1 d2 st ->\n let dt1 \n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e1)\n (elab_ty (TArrow t t'))\n = soundness d1\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t0)\n = soundness d2\n in\n let st\n : RT.sub_typing (extend_env_l f sg) (elab_ty t0) (elab_ty t)\n = subtyping_soundness st\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t)\n = RT.T_Sub _ _ _ _ dt2 (RT.Relc_typ _ _ _ _ _ st)\n in\n RT.T_App _ _ _ _ (elab_ty t') _ dt1 dt2\n\n | T_If _ b e1 e2 t1 t2 t hyp db d1 d2 s1 s2 dt ->\n let db = soundness db in\n let d1 = soundness d1 in\n let d2 = soundness d2 in\n let s1 = subtyping_soundness s1 in\n let s2 = subtyping_soundness s2 in\n let d1 = RT.T_Sub _ _ _ _ d1 (RT.Relc_typ _ _ _ _ _ s1) in\n let d2 = RT.T_Sub _ _ _ _ d2 (RT.Relc_typ _ _ _ _ _ s2) in \n let dt = src_ty_ok_soundness _ _ dt in\n freevars_elab_exp e1;\n freevars_elab_exp e2;\n RT.T_If (extend_env_l f sg) (elab_exp b) (elab_exp e1) (elab_exp e2) _ _ hyp _ _ db d1 d2 dt\n\n\nand src_ty_ok_soundness (#f:RT.fstar_top_env)\n (sg:src_env { src_env_ok sg })\n (t:s_ty)\n (dt:src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\n = match dt with\n | OK_TBool _ ->\n RT.T_FVar _ RT.bool_fv\n \n | OK_TArrow _ t1 t2 ok_t1 ok_t2 ->\n let t1_ok = src_ty_ok_soundness sg _ ok_t1 in\n let x = fresh sg in\n fresh_is_fresh sg;\n freevars_elab_ty t2; \n let t2_ok = src_ty_ok_soundness ((x, Inl t1)::sg) _ (src_ty_ok_weakening _ [] _ _ _ ok_t2) in\n let arr_max = RT.T_Arrow _ x (elab_ty t1) (elab_ty t2) _ _ RT.pp_name_default R.Q_Explicit T.E_Total _ _ t1_ok t2_ok in\n RT.simplify_umax arr_max\n \n | OK_TRefine _ e de ->\n let x = fresh sg in\n fresh_is_fresh sg;\n freevars_elab_exp e; \n let sg' = ((fresh sg, Inl TBool)::sg) in\n let de = src_typing_weakening_l [] sg' _ _ de in\n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp e)\n (elab_ty (TArrow TBool TBool)) = soundness de in\n let arg_x = RT.var_as_term x in\n let arg_x_typing\n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n arg_x\n RT.bool_ty\n = RT.T_Var _ (RT.var_as_namedv x)\n in\n let refinement = apply (elab_exp e) (arg_x, R.Q_Explicit) in\n let dr : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n refinement\n RT.bool_ty\n = RT.T_App (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp e)\n (arg_x)\n (RT.mk_simple_binder RT.pp_name_default RT.bool_ty)\n RT.bool_ty\n _\n de\n arg_x_typing\n in\n let dr : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (r_b2t refinement)\n (RT.tm_type RT.u_zero)\n = b2t_typing _ _ dr\n in\n apply_refinement_closed e x;\n let refinement' = r_b2t (apply (elab_exp e) (bv_as_arg bv0)) in\n assert (RT.open_term refinement' x == r_b2t refinement);\n let bool_typing\n : RT.tot_typing (extend_env_l f sg) RT.bool_ty (RT.tm_type RT.u_zero)\n = RT.T_FVar _ RT.bool_fv\n in\n freevars_refinement (elab_exp e) bv0;\n RT.T_Refine (extend_env_l f sg) x RT.bool_ty refinement' _ _ _ _ bool_typing dr", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Lemma (ensures (is_value e \\/ (Some? (step e)))) (decreases h)\nlet rec progress #e #t h =\n if TyApp? h then let TyApp h1 h2 = h in progress h1; progress h2", "val lift_comp_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c1 #c2: comp)\n (d: lift_comp (push_env g g') c1 c2)\n (g1: env{pairwise_disjoint g g1 g'})\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2) (decreases d)\nlet lift_comp_weakening (g:env) (g':env { disjoint g g'})\n (#c1 #c2:comp) (d:lift_comp (push_env g g') c1 c2)\n (g1:env { pairwise_disjoint g g1 g' })\n : Tot (lift_comp (push_env (push_env g g1) g') c1 c2)\n (decreases d) =\n \n match d with\n | Lift_STAtomic_ST _ c -> Lift_STAtomic_ST _ c\n | Lift_Ghost_Neutral _ c non_informative_c ->\n Lift_Ghost_Neutral _ c (non_informative_c_weakening g g' g1 _ non_informative_c)\n | Lift_Neutral_Ghost _ c -> Lift_Neutral_Ghost _ c\n | Lift_Observability _ obs c -> Lift_Observability _ obs c", "val weak_kind_glb (k1 k2: weak_kind) : Tot weak_kind\nlet weak_kind_glb\r\n (k1 k2: weak_kind)\r\n: Tot weak_kind\r\n= if k1 = k2\r\n then k1\r\n else WeakKindWeak", "val free_in_context : x:var -> #e:exp -> #g:env -> #t:typ -> h:typing g e t ->\n Lemma (requires True) (ensures (appears_free_in x e ==> Some? (g x))) (decreases h)\nlet rec free_in_context x #e #g #t h =\n match h with\n | TyVar x -> ()\n | TyLam t h1 -> free_in_context (x+1) h1\n | TyApp h1 h2 -> free_in_context x h1; free_in_context x h2\n | TyUnit -> ()", "val free_in_context : x:var -> #e:exp -> #g:env -> #t:ty -> h:rtyping g e t ->\n Lemma (requires True) (ensures (appears_free_in x e ==> Some? (g x))) (decreases h)\nlet rec free_in_context x #e #g #t h =\n match h with\n | TyVar x -> ()\n | TyAbs t h1 -> free_in_context (x+1) h1\n | TyApp h1 h2 -> free_in_context x h1; free_in_context x h2", "val extend_gen : var -> typ -> env -> Tot env\nlet extend_gen x t g = if x = 0 then extend t g\n else (fun y -> if y < x then g y\n else if y = x then Some t\n else g (y-1))", "val substitution_preserves_typing (x: int) (e v: exp) (g: env)\n : Lemma\n (requires Some? (typing empty v) /\\ Some? (typing (extend g x (Some?.v (typing empty v))) e))\n (ensures typing g (subst x v e) == typing (extend g x (Some?.v (typing empty v))) e)\nlet rec substitution_preserves_typing (x:int) (e v:exp) (g:env)\n : Lemma\n (requires Some? (typing empty v) /\\\n Some? (typing (extend g x (Some?.v (typing empty v))) e))\n (ensures typing g (subst x v e) ==\n typing (extend g x (Some?.v (typing empty v))) e)\n = let Some t_x = typing empty v in\n let gx = extend g x t_x in\n match e with\n | EUnit -> ()\n | EVar y ->\n if x=y\n then (\n typable_empty_closed v;\n context_invariance v empty g\n )\n else context_invariance e gx g\n \n | EApp e1 e2 ->\n substitution_preserves_typing x e1 v g;\n substitution_preserves_typing x e2 v g\n\n | EAbs y t_y e1 ->\n let gxy = extend gx y t_y in\n let gy = extend g y t_y in\n if x=y\n then typing_extensional gxy gy e1\n else\n (let gyx = extend gy x t_x in\n typing_extensional gxy gyx e1;\n substitution_preserves_typing x e1 v gy)", "val src_ty_ok_soundness\n (#f: fstar_top_env)\n (sg: src_env{src_env_ok sg})\n (t: src_ty)\n (dt: src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\nlet rec soundness (#f:fstar_top_env)\n (#sg:src_env { src_env_ok sg } ) \n (#se:src_exp)\n (#st:src_ty)\n (dd:src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg)\n (elab_exp se)\n (elab_ty st))\n (decreases (height dd))\n = match dd with\n | T_Bool _ true ->\n RT.T_Const _ _ _ RT.CT_True\n\n | T_Bool _ false ->\n RT.T_Const _ _ _ RT.CT_False\n\n | T_Var _ x ->\n RT.T_Var _ (R.pack_namedv (RT.make_namedv x))\n\n | T_Lam _ t e t' x dt de ->\n let de : RT.tot_typing (extend_env_l f ((x,Inl t)::sg))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = soundness de\n in \n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x (elab_ty t))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = de\n in\n fresh_is_fresh sg;\n freevars_elab_exp e;\n let dt : RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero) =\n src_ty_ok_soundness sg t dt\n in\n let dd\n : RT.tot_typing (extend_env_l f sg)\n (R.pack_ln (R.Tv_Abs (RT.mk_simple_binder RT.pp_name_default (elab_ty t)) (elab_exp e)))\n (elab_ty (TArrow t (close_ty t' x)))\n = RT.close_term_spec (elab_ty t') x;\n assert (elab_ty (close_ty t' x) ==\n RT.subst_term (elab_ty t') [ RT.ND x 0 ]);\n RT.T_Abs (extend_env_l f sg)\n x\n (elab_ty t) \n (elab_exp e)\n (T.E_Total, elab_ty t')\n _\n _\n _\n _\n dt\n de\n in\n dd\n\n | T_If _ b e1 e2 t1 t2 t hyp db d1 d2 s1 s2 tok ->\n let db = soundness db in\n let d1 = soundness d1 in\n let d2 = soundness d2 in\n let s1 = subtyping_soundness s1 in\n let s2 = subtyping_soundness s2 in\n let t_ok = src_ty_ok_soundness sg t tok in\n let d1 = RT.T_Sub _ _ _ _ d1 (RT.Relc_typ _ _ _ _ _ s1) in\n let d2 = RT.T_Sub _ _ _ _ d2 (RT.Relc_typ _ _ _ _ _ s2) in\n freevars_elab_exp e1;\n freevars_elab_exp e2;\n RT.T_If (extend_env_l f sg) (elab_exp b) (elab_exp e1) (elab_exp e2) _ _ hyp _ _ db d1 d2 t_ok\n\n | T_App _ e1 e2 t t' t0 d1 d2 st ->\n let dt1 \n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e1)\n (elab_ty (TArrow t t'))\n = soundness d1\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t0)\n = soundness d2\n in\n let st\n : RT.sub_typing (extend_env_l f sg) (elab_ty t0) (elab_ty t)\n = subtyping_soundness st\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t)\n = RT.T_Sub _ _ _ _ dt2 (RT.Relc_typ _ _ _ _ _ st)\n in\n RT.T_App _ _ _ _ (elab_ty t') _ dt1 dt2\n\nand src_ty_ok_soundness (#f:fstar_top_env)\n (sg:src_env { src_env_ok sg })\n (t:src_ty)\n (dt:src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\n = match dt with\n | OK_TBool _ ->\n RT.T_FVar _ RT.bool_fv\n\n | OK_TArrow _ t1 t2 x ok_t1 ok_t2 ->\n let t1_ok = src_ty_ok_soundness sg _ ok_t1 in\n let t2_ok = src_ty_ok_soundness ((x, Inl t1)::sg) _ ok_t2 in\n freevars_elab_ty t2;\n let arr_max = RT.T_Arrow _ x (elab_ty t1) (elab_ty t2) _ _ RT.pp_name_default R.Q_Explicit T.E_Total _ _ t1_ok t2_ok in\n RT.simplify_umax arr_max\n\n | OK_TRefine _ e x de ->\n let de \n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp (open_exp e x))\n (elab_ty TBool)\n = soundness de\n in\n let de\n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (r_b2t (elab_exp (open_exp e x)))\n (RT.tm_type RT.u_zero)\n = b2t_typing _ _ de\n in\n let bool_typing\n : RT.tot_typing (extend_env_l f sg) RT.bool_ty (RT.tm_type RT.u_zero)\n = RT.T_FVar _ RT.bool_fv\n in\n elab_open_b2t e x;\n freevars_elab_exp e;\n RT.T_Refine (extend_env_l f sg)\n x\n RT.bool_ty\n (r_b2t (elab_exp e))\n _ _ _ _\n bool_typing \n de", "val extend : env -> var -> ty -> Tot env\nlet extend g x t y = if y < x then g y\n else if y = x then Some t\n else g (y-1)", "val veq_weakening_end\n (g:env) (g':env { disjoint g g' })\n (#v1 #v2:vprop) (d:vprop_equiv (push_env g g') v1 v2)\n (g'':env { g'' `env_extends` g' /\\ disjoint g'' g })\n : vprop_equiv (push_env g g'') v1 v2\nlet veq_weakening_end g g' #v1 #v2 d g'' =\n let g2 = diff g'' g' in\n let emp_env = mk_env (fstar_env g) in\n assert (equal (push_env g g')\n (push_env (push_env g g') emp_env));\n let d = Pulse.Typing.Metatheory.Base.veq_weakening (push_env g g') emp_env #v1 #v2(coerce_eq () d) g2 in\n assert (equal (push_env (push_env (push_env g g') g2) emp_env)\n (push_env (push_env g g') g2));\n push_env_assoc g g' g2;\n assert (equal (push_env (push_env g g') g2)\n (push_env g (push_env g' g2)));\n assert (equal (push_env g (push_env g' g2))\n (push_env g g''));\n coerce_eq () d", "val height (#f #g #e #t: _) (d: src_typing f g e t) : GTot nat (decreases d)\nlet rec height #f #g #e #t (d:src_typing f g e t)\n : GTot nat (decreases d)\n = match d with\n | T_Bool _ _ -> 1\n | T_Var _ _ -> 1\n | T_Lam _ _ _ _ _ ty_ok body -> max (height body) (t_height ty_ok) + 1\n | T_App _ _ _ _ _ _ tl tr ts -> max (max (height tl) (height tr)) (s_height ts) + 1\n | T_If _ _ _ _ _ _ _ _ tb tl tr sl sr st ->\n max (height tb) \n (max (max (height tl) (height tr))\n (max (s_height sl) (max (s_height sr) (t_height st)))) + 1\n \nand t_height #f (#g:src_env) (#t:s_ty) (d:src_ty_ok f g t) \n : GTot nat (decreases d)\n = match d with\n | OK_TBool _ -> 1\n | OK_TArrow _ _ _ d0 d1 -> max (t_height d0) (t_height d1) + 1\n | OK_TRefine _ _ d -> height d + 1", "val height (#f #g #e #t: _) (d: src_typing f g e t) : GTot nat (decreases d)\nlet rec height #f #g #e #t (d:src_typing f g e t)\n : GTot nat (decreases d)\n = match d with\n | T_Bool _ _ -> 1\n | T_Var _ _ -> 1\n | T_Lam _ _ _ _ _ ty_ok body -> max (height body) (t_height ty_ok) + 1\n | T_App _ _ _ _ _ _ tl tr ts -> max (max (height tl) (height tr)) (s_height ts) + 1\n | T_If _ _ _ _ _ _ _ _ tb tl tr sl sr st ->\n max (height tb) \n (max (max (height tl) (height tr))\n (max (s_height sl) (max (s_height sr) (t_height st)))) + 1\n \nand t_height #f (#g:src_env) (#t:src_ty) (d:src_ty_ok f g t) \n : GTot nat (decreases d)\n = match d with\n | OK_TBool _ -> 1\n | OK_TArrow _ _ _ _ d0 d1 -> max (t_height d0) (t_height d1) + 1\n | OK_TRefine _ _ _ d -> height d + 1", "val tot_typing_soundness (#g: env) (#e #t: term) (d: tot_typing g e t)\n : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))\nlet tot_typing_soundness (#g:env)\n (#e:term)\n (#t:term)\n (d:tot_typing g e t)\n : GTot (RT.tot_typing (elab_env g) (elab_term e) (elab_term t))\n = let E d = d in\n d", "val t_height (#f: _) (#g: src_env) (#t: s_ty) (d: src_ty_ok f g t) : GTot nat (decreases d)\nlet rec height #f #g #e #t (d:src_typing f g e t)\n : GTot nat (decreases d)\n = match d with\n | T_Bool _ _ -> 1\n | T_Var _ _ -> 1\n | T_Lam _ _ _ _ _ ty_ok body -> max (height body) (t_height ty_ok) + 1\n | T_App _ _ _ _ _ _ tl tr ts -> max (max (height tl) (height tr)) (s_height ts) + 1\n | T_If _ _ _ _ _ _ _ _ tb tl tr sl sr st ->\n max (height tb) \n (max (max (height tl) (height tr))\n (max (s_height sl) (max (s_height sr) (t_height st)))) + 1\n \nand t_height #f (#g:src_env) (#t:s_ty) (d:src_ty_ok f g t) \n : GTot nat (decreases d)\n = match d with\n | OK_TBool _ -> 1\n | OK_TArrow _ _ _ d0 d1 -> max (t_height d0) (t_height d1) + 1\n | OK_TRefine _ _ d -> height d + 1", "val src_ty_ok_soundness\n (#f: RT.fstar_top_env)\n (sg: src_env{src_env_ok sg})\n (t: s_ty)\n (dt: src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\nlet rec soundness (#f:RT.fstar_top_env)\n (#sg:src_env { src_env_ok sg } ) \n (#se:src_exp { ln se })\n (#st:s_ty)\n (dd:src_typing f sg se st)\n : GTot (RT.tot_typing (extend_env_l f sg)\n (elab_exp se)\n (elab_ty st))\n (decreases (height dd))\n = match dd with\n | T_Bool _ true ->\n RT.T_Const _ _ _ RT.CT_True\n\n | T_Bool _ false ->\n RT.T_Const _ _ _ RT.CT_False\n\n | T_Var _ x ->\n RT.T_Var _ (R.pack_namedv (RT.make_namedv x))\n\n | T_Lam _ t e t' x dt de ->\n let de : RT.tot_typing (extend_env_l f ((x,Inl t)::sg))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = soundness de\n in \n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x (elab_ty t))\n (elab_exp (open_exp e x))\n (elab_ty t')\n = de\n in\n fresh_is_fresh sg;\n let dt : RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero) =\n src_ty_ok_soundness sg t dt\n in\n freevars_elab_exp e;\n let dd\n : RT.tot_typing (extend_env_l f sg)\n _ //(R.pack_ln (R.Tv_Abs (RT.mk_binder RT.pp_name_default 0 (elab_ty t) R.Q_Explicit) (elab_exp e)))\n (elab_ty (TArrow t t'))\n = RT.close_term_spec (elab_ty t') x;\n RT.T_Abs (extend_env_l f sg)\n x\n (elab_ty t) \n (elab_exp e)\n (T.E_Total, elab_ty t')\n _\n RT.pp_name_default\n R.Q_Explicit\n _\n dt\n de\n in\n dd\n\n | T_App _ e1 e2 t t' t0 d1 d2 st ->\n let dt1 \n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e1)\n (elab_ty (TArrow t t'))\n = soundness d1\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t0)\n = soundness d2\n in\n let st\n : RT.sub_typing (extend_env_l f sg) (elab_ty t0) (elab_ty t)\n = subtyping_soundness st\n in\n let dt2\n : RT.tot_typing (extend_env_l f sg)\n (elab_exp e2)\n (elab_ty t)\n = RT.T_Sub _ _ _ _ dt2 (RT.Relc_typ _ _ _ _ _ st)\n in\n RT.T_App _ _ _ _ (elab_ty t') _ dt1 dt2\n\n | T_If _ b e1 e2 t1 t2 t hyp db d1 d2 s1 s2 dt ->\n let db = soundness db in\n let d1 = soundness d1 in\n let d2 = soundness d2 in\n let s1 = subtyping_soundness s1 in\n let s2 = subtyping_soundness s2 in\n let d1 = RT.T_Sub _ _ _ _ d1 (RT.Relc_typ _ _ _ _ _ s1) in\n let d2 = RT.T_Sub _ _ _ _ d2 (RT.Relc_typ _ _ _ _ _ s2) in \n let dt = src_ty_ok_soundness _ _ dt in\n freevars_elab_exp e1;\n freevars_elab_exp e2;\n RT.T_If (extend_env_l f sg) (elab_exp b) (elab_exp e1) (elab_exp e2) _ _ hyp _ _ db d1 d2 dt\n\n\nand src_ty_ok_soundness (#f:RT.fstar_top_env)\n (sg:src_env { src_env_ok sg })\n (t:s_ty)\n (dt:src_ty_ok f sg t)\n : GTot (RT.tot_typing (extend_env_l f sg) (elab_ty t) (RT.tm_type RT.u_zero))\n (decreases (t_height dt))\n = match dt with\n | OK_TBool _ ->\n RT.T_FVar _ RT.bool_fv\n \n | OK_TArrow _ t1 t2 ok_t1 ok_t2 ->\n let t1_ok = src_ty_ok_soundness sg _ ok_t1 in\n let x = fresh sg in\n fresh_is_fresh sg;\n freevars_elab_ty t2; \n let t2_ok = src_ty_ok_soundness ((x, Inl t1)::sg) _ (src_ty_ok_weakening _ [] _ _ _ ok_t2) in\n let arr_max = RT.T_Arrow _ x (elab_ty t1) (elab_ty t2) _ _ RT.pp_name_default R.Q_Explicit T.E_Total _ _ t1_ok t2_ok in\n RT.simplify_umax arr_max\n \n | OK_TRefine _ e de ->\n let x = fresh sg in\n fresh_is_fresh sg;\n freevars_elab_exp e; \n let sg' = ((fresh sg, Inl TBool)::sg) in\n let de = src_typing_weakening_l [] sg' _ _ de in\n let de : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp e)\n (elab_ty (TArrow TBool TBool)) = soundness de in\n let arg_x = RT.var_as_term x in\n let arg_x_typing\n : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n arg_x\n RT.bool_ty\n = RT.T_Var _ (RT.var_as_namedv x)\n in\n let refinement = apply (elab_exp e) (arg_x, R.Q_Explicit) in\n let dr : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n refinement\n RT.bool_ty\n = RT.T_App (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (elab_exp e)\n (arg_x)\n (RT.mk_simple_binder RT.pp_name_default RT.bool_ty)\n RT.bool_ty\n _\n de\n arg_x_typing\n in\n let dr : RT.tot_typing (RT.extend_env (extend_env_l f sg) x RT.bool_ty)\n (r_b2t refinement)\n (RT.tm_type RT.u_zero)\n = b2t_typing _ _ dr\n in\n apply_refinement_closed e x;\n let refinement' = r_b2t (apply (elab_exp e) (bv_as_arg bv0)) in\n assert (RT.open_term refinement' x == r_b2t refinement);\n let bool_typing\n : RT.tot_typing (extend_env_l f sg) RT.bool_ty (RT.tm_type RT.u_zero)\n = RT.T_FVar _ RT.bool_fv\n in\n freevars_refinement (elab_exp e) bv0;\n RT.T_Refine (extend_env_l f sg) x RT.bool_ty refinement' _ _ _ _ bool_typing dr", "val elab_br\n (#g: env)\n (#c: comp_st)\n (#sc_u: universe)\n (#sc_ty: typ)\n (#sc: term)\n (#p: pattern)\n (#e: st_term)\n (d: br_typing g sc_u sc_ty sc p e c)\n : Tot R.branch (decreases d)\nlet rec elab_st_typing (#g:env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c)\n : Tot R.term (decreases d)\n = match d with\n // | T_Tot _ t _ _ -> elab_term t\n\n | T_Abs _ x qual b _u body _c ty_typing body_typing ->\n let ty = elab_term b.binder_ty in\n let ppname = b.binder_ppname.name in\n let body = elab_st_typing body_typing in\n mk_abs_with_name ppname ty (elab_qual qual) (RT.close_term body x) //this closure should be provably redundant by strengthening the conditions on x\n\n\n | T_STApp _ head _ qual _ arg _ _\n | T_STGhostApp _ head _ qual _ arg _ _ _ _ ->\n let head = elab_term head in\n let arg = elab_term arg in\n R.mk_app head [(arg, elab_qual qual)]\n\n | T_Return _ c use_eq u ty t post _ _ _ _ ->\n let ru = u in\n let rty = elab_term ty in\n let rt = elab_term t in\n let rp = elab_term post in\n let rp = mk_abs rty R.Q_Explicit rp in\n (match c, use_eq with\n | STT, true -> mk_stt_return ru rty rt rp\n | STT, false -> mk_stt_return_noeq ru rty rt rp\n | STT_Atomic, true -> mk_stt_atomic_return ru rty rt rp\n | STT_Atomic, false -> mk_stt_atomic_return_noeq ru rty rt rp\n | STT_Ghost, true -> mk_stt_ghost_return ru rty rt rp\n | STT_Ghost, false -> mk_stt_ghost_return_noeq ru rty rt rp)\n\n | T_Bind _ e1 e2 c1 c2 b x c e1_typing t_typing e2_typing bc ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n elab_bind bc e1 (mk_abs_with_name b.binder_ppname.name ty1 R.Q_Explicit (RT.close_term e2 x))\n\n | T_BindFn _ _ _ c1 c2 b x e1_typing _u t_typing e2_typing c2_typing ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n RT.mk_let RT.pp_name_default e1 ty1 (RT.close_term e2 x)\n \n | T_Frame _ _ c frame _frame_typing e_typing ->\n let e = elab_st_typing e_typing in\n elab_frame c frame e\n \n | T_Equiv _ _ c1 c2 e_typing (ST_TotEquiv _ _ _ _ _ _) ->\n let e = elab_st_typing e_typing in\n e\n\n | T_Equiv _ _ c1 c2 e_typing _ ->\n let e = elab_st_typing e_typing in\n elab_sub c1 c2 e\n\n | T_Sub _ _ c1 c2 e_typing d_sub ->\n let e = elab_st_typing e_typing in\n let (| coercion, _ |) = elab_st_sub d_sub in\n R.mk_e_app coercion [e]\n\n | T_Lift _ _ c1 c2 e_typing lc ->\n let e = elab_st_typing e_typing in\n elab_lift lc e\n\n | T_If _ b _ _ _ _ _ e1_typing e2_typing _c_typing ->\n let rb = elab_term b in\n let re1 = elab_st_typing e1_typing in\n let re2 = elab_st_typing e2_typing in\n RT.mk_if rb re1 re2\n\n | T_Match _ _ _ sc _ _ _ _ _ brty _ ->\n let sc = elab_term sc in\n let brs = elab_branches brty in\n R.pack_ln (R.Tv_Match sc None brs)\n\n | T_IntroPure _ p _ _ ->\n let head = \n tm_pureapp (tm_fvar (as_fv (mk_pulse_lib_core_lid \"intro_pure\")))\n None\n p\n in\n let arg = (`()) in\n R.mk_app (elab_term head) [(arg, elab_qual None)]\n\n | T_ElimExists _ u t p _ d_t d_exists ->\n let ru = u in\n let rt = elab_term t in\n let rp = elab_term p in\n mk_elim_exists ru rt (mk_abs rt R.Q_Explicit rp)\n\n | T_IntroExists _ u b p e _ _ _ ->\n let ru = u in\n let rt = elab_term b.binder_ty in\n let rp = elab_term p in\n let re = elab_term e in\n mk_intro_exists ru rt (mk_abs rt R.Q_Explicit rp) re\n\n | T_While _ inv _ _ _ cond_typing body_typing ->\n let inv = elab_term inv in\n let cond = elab_st_typing cond_typing in\n let body = elab_st_typing body_typing in\n mk_while (mk_abs bool_tm R.Q_Explicit inv) cond body\n\n | T_Par _ eL cL eR cR _ _ _ eL_typing eR_typing ->\n let ru = comp_u cL in\n let raL = elab_term (comp_res cL) in\n let raR = elab_term (comp_res cR) in\n let rpreL = elab_term (comp_pre cL) in\n let rpostL = elab_term (comp_post cL) in\n let rpreR = elab_term (comp_pre cR) in\n let rpostR = elab_term (comp_post cR) in\n let reL = elab_st_typing eL_typing in\n let reR = elab_st_typing eR_typing in\n mk_par ru\n raL\n raR\n rpreL\n (mk_abs raL R.Q_Explicit rpostL)\n rpreR\n (mk_abs raR R.Q_Explicit rpostR)\n reL reR\n\n\t\t\t\t| T_Rewrite _ p q _ _ ->\n\t\t\t\t let rp = elab_term p in\n\t\t\t\t\t\tlet rq = elab_term q in\n\t\t\t\t\t\tmk_rewrite rp rq\n\n | T_WithLocal _ _ init _ init_t c x _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_ref ra) R.Q_Explicit rbody in\n mk_withlocal rret_u ra rinit rpre rret_t rpost rbody\n\n | T_WithLocalArray _ _ init len _ init_t c x _ _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rlen = elab_term len in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_array ra) R.Q_Explicit rbody in\n mk_withlocalarray rret_u ra rinit rlen rpre rret_t rpost rbody\n\n | T_Admit _ {u;res;pre;post} c _ ->\n let ru = u in\n let rres = elab_term res in\n let rpre = elab_term pre in\n let rpost = elab_term post in\n let rpost = mk_abs rres R.Q_Explicit rpost in\n (match c with\n | STT -> mk_stt_admit ru rres rpre rpost\n | STT_Atomic -> mk_stt_atomic_admit ru rres rpre rpost\n | STT_Ghost -> mk_stt_ghost_admit ru rres rpre rpost)\n\n | T_Unreachable _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_Unreachable\")\n\n | T_WithInv _ _ _ _ _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_WithInv\")\n\nand elab_br (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#p:pattern)\n (#e:st_term)\n (d : br_typing g sc_u sc_ty sc p e c)\n : Tot R.branch (decreases d)\n = let TBR _ _ _ _ _ _ _ _ bs _ _ _ ed = d in\n let e = elab_st_typing ed in\n (elab_pat p, e)\nand elab_branches (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#brs:list branch)\n (d : brs_typing g sc_u sc_ty sc brs c)\n : Tot (list R.branch)\n (decreases d)\n = match d with\n | TBRS_0 _ -> []\n | TBRS_1 _ p e bd _ d' ->\n elab_br bd :: elab_branches d'", "val t_height (#f: _) (#g: src_env) (#t: src_ty) (d: src_ty_ok f g t) : GTot nat (decreases d)\nlet rec height #f #g #e #t (d:src_typing f g e t)\n : GTot nat (decreases d)\n = match d with\n | T_Bool _ _ -> 1\n | T_Var _ _ -> 1\n | T_Lam _ _ _ _ _ ty_ok body -> max (height body) (t_height ty_ok) + 1\n | T_App _ _ _ _ _ _ tl tr ts -> max (max (height tl) (height tr)) (s_height ts) + 1\n | T_If _ _ _ _ _ _ _ _ tb tl tr sl sr st ->\n max (height tb) \n (max (max (height tl) (height tr))\n (max (s_height sl) (max (s_height sr) (t_height st)))) + 1\n \nand t_height #f (#g:src_env) (#t:src_ty) (d:src_ty_ok f g t) \n : GTot nat (decreases d)\n = match d with\n | OK_TBool _ -> 1\n | OK_TArrow _ _ _ _ d0 d1 -> max (t_height d0) (t_height d1) + 1\n | OK_TRefine _ _ _ d -> height d + 1", "val progress : #e:exp -> #t:ty -> h:rtyping empty e t ->\n Lemma (requires True) (ensures (is_value e \\/ (Some? (step e)))) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyVar _ -> ()\n | TyAbs _ _ -> ()\n | TyApp h1 h2 -> progress h1; progress h2", "val comp_typing_weakening\n (g: env)\n (g': env{disjoint g g'})\n (#c: comp)\n (#u: universe)\n (d: comp_typing (push_env g g') c u)\n (g1: env{pairwise_disjoint g g1 g'})\n : comp_typing (push_env (push_env g g1) g') c u\nlet comp_typing_weakening (g:env) (g':env { disjoint g g' })\n (#c:comp) (#u:universe) (d:comp_typing (push_env g g') c u)\n (g1:env { pairwise_disjoint g g1 g' })\n : comp_typing (push_env (push_env g g1) g') c u =\n match d with\n | CT_Tot _ t u _ -> CT_Tot _ t u (RU.magic ())\n | CT_ST _ _ d -> CT_ST _ _ (st_comp_typing_weakening g g' d g1)\n | CT_STAtomic _ inames obs _ _ d ->\n CT_STAtomic _ inames obs _ (RU.magic ()) (st_comp_typing_weakening g g' d g1)\n | CT_STGhost _ _ d ->\n CT_STGhost _ _ (st_comp_typing_weakening g g' d g1)", "val bind_soundness\n (#g: stt_env)\n (#t: st_term)\n (#c: comp)\n (d: st_typing g t c {T_Bind? d})\n (soundness: soundness_t d)\n (mk_t_abs: tabs_t d)\n : GTot (RT.tot_typing (elab_env g) (elab_st_typing d) (elab_comp c))\nlet bind_soundness\n (#g:stt_env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c{T_Bind? d})\n (soundness: soundness_t d)\n (mk_t_abs: tabs_t d)\n : GTot (RT.tot_typing (elab_env g)\n (elab_st_typing d)\n (elab_comp c))\n = let T_Bind _ e1 e2 c1 c2 _ x c e1_typing t_typing e2_typing bc = d in\n LN.st_typing_ln e1_typing;\n LN.st_typing_ln e2_typing; \n FV.st_typing_freevars_inv e1_typing x;\n let r1_typing\n : RT.tot_typing _ _ (elab_comp c1)\n = soundness _ _ _ e1_typing\n in\n let r2_typing\n : RT.tot_typing _ _ (elab_term (tm_arrow (null_binder (comp_res c1)) None (close_comp c2 x)))\n = mk_t_abs None _ t_typing e2_typing\n in\n match bc with\n | Bind_comp _ _ _ _ t2_typing y post2_typing ->\n Bind.elab_bind_typing g _ _ _ x _ r1_typing _ r2_typing bc \n (tot_typing_soundness t2_typing)\n (mk_t_abs_tot _ ppname_default t2_typing post2_typing)", "val bind_fn_typing\n (#g:stt_env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c{T_BindFn? d})\n (soundness:soundness_t d)\n : GTot (RT.tot_typing (elab_env g)\n (elab_st_typing d)\n (elab_comp c))\nlet bind_fn_typing #g #t #c d soundness =\n let T_BindFn _ e1 e2 c1 c2 b x e1_typing u t1_typing e2_typing c2_typing = d in\n let t1 = comp_res c1 in\n let g_x = push_binding g x ppname_default t1 in\n\n let re1 = elab_st_typing e1_typing in\n let rt1 = elab_term t1 in\n let re2 = elab_st_typing e2_typing in\n\n let re1_typing : RT.tot_typing (elab_env g) re1 rt1 =\n soundness g e1 c1 e1_typing in\n \n let re2_typing : RT.tot_typing (elab_env g_x) re2 (elab_comp c2) =\n soundness g_x (open_st_term_nv e2 (v_as_nv x)) c2 e2_typing in\n\n RT.well_typed_terms_are_ln _ _ _ re2_typing;\n calc (==) {\n RT.open_term (RT.close_term re2 x) x;\n (==) { RT.open_term_spec (RT.close_term re2 x) x }\n RT.subst_term (RT.close_term re2 x) (RT.open_with_var x 0);\n (==) { RT.close_term_spec re2 x }\n RT.subst_term (RT.subst_term re2 [ RT.ND x 0 ]) (RT.open_with_var x 0);\n (==) { RT.open_close_inverse' 0 re2 x }\n re2;\n };\n let elab_t = RT.mk_let RT.pp_name_default re1 rt1 (RT.close_term re2 x) in\n let res\n : RT.tot_typing (elab_env g) elab_t (RT.open_with (RT.close_term (elab_comp c2) x) re1)\n = RT.T_Let (elab_env g) x re1 rt1 (RT.close_term re2 x) (elab_comp c2) T.E_Total RT.pp_name_default re1_typing re2_typing in\n Pulse.Typing.LN.comp_typing_ln c2_typing;\n Pulse.Elaborate.elab_ln_comp c (-1);\n assert (RT.ln (elab_comp c2));\n open_close_inverse_t (elab_comp c2) x re1;\n assert (RT.open_with (RT.close_term (elab_comp c2) x) re1 == elab_comp c2); \n res", "val parse_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (p2: (t1 -> GTot Type0))\n (prf: parse_strengthen_prf p1 p2)\n : Tot (parser k (x: t1{p2 x}))\nlet parse_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (p2: t1 -> GTot Type0)\n (prf: parse_strengthen_prf p1 p2)\n: Tot (parser k (x: t1 { p2 x } ))\n= bare_parse_strengthen_correct p1 p2 prf;\n bare_parse_strengthen p1 p2 prf", "val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (~ (is_value e)))\n (ensures (fun _ -> True)) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n match e1 with\n | ELam t e1' -> ExIntro (subst (sub_beta e2) e1') (SBeta t e1' e2)\n | _ -> let ExIntro e1' h1' = progress h1 in\n ExIntro (EApp e1' e2) (SApp1 e2 h1')", "val extend : typ -> env -> Tot env\nlet extend t g y = if y = 0 then Some t\n else g (y-1)", "val texpDenote (#t: _) (e: texp t) : Tot (typeDenote t) (decreases e)\nlet rec texpDenote #t (e : texp t) : Tot (typeDenote t) (decreases e) =\n match e with\n | TNConst n -> n\n | TBConst b -> b\n | TBinop b e1 e2 -> (tbinopDenote b) (texpDenote e1) (texpDenote e2)", "val weaken\n (f: RT.fstar_top_env)\n (sg: src_env)\n (hyp: var{None? (lookup sg hyp)})\n (b: s_exp)\n (t0 t1: s_ty)\n : T.Tac\n (t: s_ty &\n sub_typing f ((hyp, Inr (b, EBool true)) :: sg) t0 t &\n sub_typing f ((hyp, Inr (b, EBool false)) :: sg) t1 t)\nlet weaken (f:RT.fstar_top_env) (sg:src_env) (hyp:var { None? (lookup sg hyp) } ) (b:s_exp) (t0 t1:s_ty)\n : T.Tac (t:s_ty &\n sub_typing f ((hyp,Inr(b, EBool true))::sg) t0 t &\n sub_typing f ((hyp,Inr(b, EBool false))::sg) t1 t)\n = if t0 = t1\n then (| t0, S_Refl _ t0, S_Refl _ t1 |)\n else T.fail \"weaken is very dumb\"", "val ghost_typing_soundness (#g: env) (#e #t: term) (d: ghost_typing g e t)\n : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))\nlet ghost_typing_soundness (#g:env)\n (#e:term)\n (#t:term)\n (d:ghost_typing g e t)\n : GTot (RT.ghost_typing (elab_env g) (elab_term e) (elab_term t))\n = let E d = d in\n d", "val lift_comp_subst\n (g: env)\n (x: var)\n (t: typ)\n (g': env{pairwise_disjoint g (singleton_env (fstar_env g) x t) g'})\n (#e: term)\n (e_typing: tot_typing g e t)\n (#c1 #c2: comp)\n (d: lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e))\nlet lift_comp_subst\n (g:env) (x:var) (t:typ) (g':env { pairwise_disjoint g (singleton_env (fstar_env g) x t) g' })\n (#e:term)\n (e_typing:tot_typing g e t)\n (#c1 #c2:comp)\n (d:lift_comp (push_env g (push_env (singleton_env (fstar_env g) x t) g')) c1 c2)\n\n : lift_comp (push_env g (subst_env g' (nt x e)))\n (subst_comp c1 (nt x e))\n (subst_comp c2 (nt x e)) =\n\n let ss = nt x e in\n \n match d with\n | Lift_STAtomic_ST _ c ->\n Lift_STAtomic_ST _ (subst_comp c ss)\n\n | Lift_Ghost_Neutral _ c d_non_informative ->\n Lift_Ghost_Neutral _ (subst_comp c ss)\n (non_informative_c_subst g x t g' e_typing _ d_non_informative)\n \n | Lift_Neutral_Ghost _ c ->\n Lift_Neutral_Ghost _ (subst_comp c ss)\n \n | Lift_Observability _ c o ->\n Lift_Observability _ (subst_comp c ss) o", "val veq_weakening\n (g:env) (g':env { disjoint g g' })\n (#v1 #v2:vprop) (d:vprop_equiv (push_env g g') v1 v2)\n (g1:env { g1 `env_extends` g /\\ disjoint g1 g' })\n : vprop_equiv (push_env g1 g') v1 v2\nlet veq_weakening\n (g:env) (g':env { disjoint g g' })\n (#v1 #v2:vprop) (d:vprop_equiv (push_env g g') v1 v2)\n (g1:env { g1 `env_extends` g /\\ disjoint g1 g' })\n : vprop_equiv (push_env g1 g') v1 v2 =\n\n let g2 = diff g1 g in\n let d = Pulse.Typing.Metatheory.Base.veq_weakening g g' d g2 in\n assert (equal (push_env (push_env g g2) g') (push_env g1 g'));\n d", "val subst_beta : x:var -> v:exp -> e:exp -> Tot exp (decreases e)\nlet rec subst_beta x v e =\n match e with\n | EVar y -> if y = x then v\n else if y < x then EVar y\n else EVar (y-1)\n | EAbs t e1 -> EAbs t (subst_beta (x+1) v e1)\n | EApp e1 e2 -> EApp (subst_beta x v e1) (subst_beta x v e2)", "val weaken\n (f: fstar_top_env)\n (sg: src_env)\n (hyp: var{None? (lookup sg hyp)})\n (b: src_exp)\n (t0 t1: src_ty)\n : T.Tac\n (t: src_ty &\n sub_typing f ((hyp, Inr (b, EBool true)) :: sg) t0 t &\n sub_typing f ((hyp, Inr (b, EBool false)) :: sg) t1 t)\nlet weaken (f:fstar_top_env) (sg:src_env) (hyp:var { None? (lookup sg hyp) } ) (b:src_exp) (t0 t1:src_ty)\n : T.Tac (t:src_ty &\n sub_typing f ((hyp,Inr(b, EBool true))::sg) t0 t &\n sub_typing f ((hyp,Inr(b, EBool false))::sg) t1 t)\n = if t0 = t1\n then (| t0, S_Refl _ t0, S_Refl _ t1 |)\n else T.fail \"weaken is very dumb\"", "val tot_strengthen (k: parser_kind) (#t: Type) (f: tot_bare_parser t)\n : Pure (tot_parser k t) (requires (parser_kind_prop k f)) (ensures (fun _ -> True))\nlet tot_strengthen (k: parser_kind) (#t: Type) (f: tot_bare_parser t) : Pure (tot_parser k t)\n (requires (parser_kind_prop k f))\n (ensures (fun _ -> True))\n= f", "val below : x:var -> e:exp -> Tot bool (decreases e)\nlet rec below x e =\n match e with\n | EVar y -> y < x\n | EApp e1 e2 -> below x e1 && below x e2\n | ELam _ e1 -> below (x+1) e1\n | EUnit -> true", "val bare_parse_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (p2: (t1 -> GTot Type0))\n (prf: parse_strengthen_prf p1 p2)\n : Tot (bare_parser (x: t1{p2 x}))\nlet bare_parse_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (p1: parser k t1)\n (p2: t1 -> GTot Type0)\n (prf: parse_strengthen_prf p1 p2)\n: Tot (bare_parser (x: t1 { p2 x } ))\n= fun (xbytes: bytes) ->\n match parse p1 xbytes with\n | Some (x, consumed) ->\n prf xbytes consumed x;\n let (x' : t1 { p2 x' } ) = x in\n Some (x', consumed)\n | _ -> None", "val typ_depth (t: I.typ) : GTot nat (decreases t)\nlet rec typ_depth (t: I.typ) : GTot nat\n (decreases t)\n= match t with\n | I.T_if_else _ t1 t2 // 2 accounts for the call to parse_then_else_with_branch_trace\n -> 2 + typ_depth t1 + typ_depth t2\n | I.T_pair _ t1 t2\n -> 1 + typ_depth t1 + typ_depth t2\n | I.T_dep_pair _ _ (_, t')\n | I.T_dep_pair_with_refinement _ _ _ (_, t')\n | I.T_with_comment _ t' _\n | I.T_at_most _ _ t'\n | I.T_exact _ _ t'\n | I.T_nlist _ _ t'\n -> 1 + typ_depth t'\n | _\n -> 0", "val jump_weaken\n (k1 #k2: parser_kind)\n (#t: Type)\n (#p2: parser k2 t)\n (v2: jumper p2 {k1 `is_weaker_than` k2})\n : Tot (jumper (weaken k1 p2))\nlet jump_weaken\n (k1: parser_kind)\n (#k2: parser_kind)\n (#t: Type)\n (#p2: parser k2 t)\n (v2: jumper p2 { k1 `is_weaker_than` k2 } )\n: Tot (jumper (weaken k1 p2))\n= fun #rrel #rel sl pos ->\n let h = HST.get () in\n [@inline_let] let _ =\n valid_weaken k1 p2 h sl pos\n in\n v2 sl pos", "val extend_env_l_lookup_bvar (g: R.env) (sg: stlc_env) (x: var)\n : Lemma (requires (forall x. RT.lookup_bvar g x == None))\n (ensures\n (match lookup sg x with\n | Some t -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_ty t)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\nlet rec extend_env_l_lookup_bvar (g:R.env) (sg:stlc_env) (x:var)\n : Lemma \n (requires (forall x. RT.lookup_bvar g x == None))\n (ensures (\n match lookup sg x with\n | Some t -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_ty t)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\n = match sg with\n | [] -> ()\n | hd :: tl -> extend_env_l_lookup_bvar g tl x", "val src_typing_renaming\n (#f: RT.fstar_top_env)\n (sg sg': src_env)\n (x: var{None? (lookup sg x) && None? (lookup sg' x)})\n (y: var{None? (lookup sg y) && None? (lookup sg' y)})\n (b: binding)\n (e: src_exp)\n (t: s_ty)\n (d: src_typing f (sg' @ (x, b) :: sg) e t)\n : GTot\n (d': src_typing f (rename_env sg' x y @ (y, b) :: sg) (rename e x y) t {height d' == height d}\n ) (decreases (height d))\nlet rec src_typing_renaming (#f:RT.fstar_top_env)\n (sg sg':src_env)\n (x:var { None? (lookup sg x) && None? (lookup sg' x) })\n (y:var { None? (lookup sg y) && None? (lookup sg' y) })\n (b:binding)\n (e:src_exp)\n (t:s_ty)\n (d:src_typing f (sg'@(x,b)::sg) e t)\n : GTot (d':src_typing f (rename_env sg' x y@(y,b)::sg) (rename e x y) t { height d' == height d })\n (decreases (height d))\n = let aux (z:var { None? (lookup (sg'@(x,b)::sg) z) })\n (b':binding)\n (e:src_exp)\n (t:s_ty)\n (ds:src_typing f ((z, b')::sg'@(x,b)::sg) e t { height ds < height d })\n : GTot (\n zz:var {\n None? (lookup (rename_env sg' x y@(y,b)::sg) zz) /\\\n (zz <> z ==> ~(zz `Set.mem` freevars e)) /\\\n zz <> x /\\\n zz <> y /\\\n zz == fresh ((y,b)::sg'@(x,b)::sg)\n } &\n ds':src_typing f (rename_env ((zz,b')::sg') x y@(y,b)::sg) (rename (rename e z zz) x y) t { height ds == height ds' }\n )\n = //pick a new opening variable zz\n //that is fresh for both x and y (and sg, sg')\n src_typing_freevars _ _ _ ds;\n assert (freevars_included_in e (((z, b')::sg'@(x,b)::sg)));\n let zz = fresh ((y,b)::sg'@(x,b)::sg) in\n fresh_is_fresh ((y,b)::sg'@(x,b)::sg);\n lookup_append_inverse ((x,b)::sg) ((y,b)::sg') zz;\n //first use the renaming lemma to rewrite the original derivation to replace z with zz\n let ds : src_typing f ((zz, b')::(sg'@(x,b)::sg)) (rename e z zz) t\n = src_typing_renaming _ [] z zz b' _ _ ds\n in\n lookup_append_inverse ((y,b)::sg) (rename_env sg' x y) zz;\n //then use the renaming lemma again t rewrite the variable in the middle, replacing x with y\n let ds\n : src_typing f (rename_env ((zz, b')::sg') x y@(y,b)::sg) (rename (rename e z zz) x y) t\n = src_typing_renaming sg ((zz, b')::sg') x y b _ _ ds\n in\n assert (zz <> z ==> ~(zz `Set.mem` freevars e));\n (| zz, ds |)\n in\n match d with\n | T_Bool _ b ->\n T_Bool _ b\n\n | T_Var _ z -> \n if z = x\n then (\n lookup_middle sg sg' x b;\n lookup_middle sg (rename_env sg' x y) y b; \n T_Var _ y\n )\n else (\n lookup_append_inverse ((x,b)::sg) sg' z;\n lookup_append_inverse ((y,b)::sg) (rename_env sg' x y) z;\n T_Var _ z\n )\n\n\n | T_App _ e1 e2 t t' t0 d1 d2 st ->\n let d1 = src_typing_renaming sg sg' x y b _ _ d1 in\n let d2 = src_typing_renaming sg sg' x y b _ _ d2 in\n let st = sub_typing_renaming sg sg' x y b _ _ st in\n T_App _ _ _ _ _ _ d1 d2 st\n\n | T_Lam g t body t' z dt dbody ->\n let (| zz, dbody |) = aux z (Inl t) _ _ dbody in\n rename_open body z zz; \n rename_open_commute body zz x y;\n let dbody\n : src_typing f (rename_env ((zz, Inl t)::sg') x y@(y,b)::sg) (open_exp (rename body x y) zz) t'\n = dbody\n in\n let dt\n : src_ty_ok f (rename_env sg' x y@(y,b)::sg) t\n = src_ty_ok_renaming sg sg' x y b _ dt\n in\n rename_freevars body x y;\n T_Lam _ t _ _ zz dt dbody\n\n | T_If g eb e1 e2 t1 t2 t hyp db dt1 dt2 st1 st2 dt ->\n let db = src_typing_renaming sg sg' x y b _ _ db in\n let (| hyp', dt1 |) = aux hyp (Inr (eb , EBool true)) _ _ dt1 in\n let (| hyp'', dt2 |) = aux hyp (Inr (eb, EBool false)) _ _ dt2 in \n let dt1 : src_typing _ _ (rename (rename e1 hyp hyp') x y) t1 = dt1 in\n rename_id hyp hyp' e1;\n rename_id hyp hyp' e2; \n assert (hyp' == hyp'');\n fresh_is_fresh ((y,b)::sg'@(x,b)::sg);\n lookup_append_inverse ((x,b)::sg) ((y,b)::sg') hyp;\n let st1 \n : sub_typing f ((hyp', Inr (eb, EBool true))::g) t1 t\n = sub_typing_renaming g [] hyp hyp' (Inr (eb, EBool true)) _ _ st1\n in\n let st1\n : sub_typing f ((hyp', Inr (rename eb x y, EBool true))::(rename_env sg' x y)@(y,b)::sg) t1 t\n = sub_typing_renaming sg ((hyp', Inr (eb, EBool true))::sg') x y b _ _ st1\n in\n let st2\n : sub_typing f ((hyp', Inr (eb, EBool false))::g) t2 t\n = sub_typing_renaming g [] hyp hyp' (Inr (eb, EBool false)) _ _ st2\n in\n let st2\n : sub_typing f ((hyp', Inr (rename eb x y, EBool false))::(rename_env sg' x y)@(y,b)::sg) t2 t\n = sub_typing_renaming sg ((hyp', Inr (eb, EBool false))::sg') x y b _ _ st2\n in\n let dt = src_ty_ok_renaming _ _ _ _ _ _ dt in\n T_If _ _ _ _ _ _ _ _ db dt1 dt2 st1 st2 dt", "val post_hint_for_env_extends (g: env) (p: post_hint_t) (x: var{~(Set.mem x (dom g))}) (b: typ)\n : Lemma (requires post_hint_for_env_p g p)\n (ensures post_hint_for_env_p (push_binding g x ppname_default b) p)\n [SMTPat (post_hint_for_env_p (push_binding g x ppname_default b) p)]\nlet post_hint_for_env_extends (g:env) (p:post_hint_t) (x:var { ~ (Set.mem x (dom g)) }) (b:typ)\n : Lemma\n (requires post_hint_for_env_p g p)\n (ensures post_hint_for_env_p (push_binding g x ppname_default b) p)\n [SMTPat (post_hint_for_env_p (push_binding g x ppname_default b) p)]\n = env_extends_push g x ppname_default b", "val elab_branches\n (#g: env)\n (#c: comp_st)\n (#sc_u: universe)\n (#sc_ty: typ)\n (#sc: term)\n (#brs: list branch)\n (d: brs_typing g sc_u sc_ty sc brs c)\n : Tot (list R.branch) (decreases d)\nlet rec elab_st_typing (#g:env)\n (#t:st_term)\n (#c:comp)\n (d:st_typing g t c)\n : Tot R.term (decreases d)\n = match d with\n // | T_Tot _ t _ _ -> elab_term t\n\n | T_Abs _ x qual b _u body _c ty_typing body_typing ->\n let ty = elab_term b.binder_ty in\n let ppname = b.binder_ppname.name in\n let body = elab_st_typing body_typing in\n mk_abs_with_name ppname ty (elab_qual qual) (RT.close_term body x) //this closure should be provably redundant by strengthening the conditions on x\n\n\n | T_STApp _ head _ qual _ arg _ _\n | T_STGhostApp _ head _ qual _ arg _ _ _ _ ->\n let head = elab_term head in\n let arg = elab_term arg in\n R.mk_app head [(arg, elab_qual qual)]\n\n | T_Return _ c use_eq u ty t post _ _ _ _ ->\n let ru = u in\n let rty = elab_term ty in\n let rt = elab_term t in\n let rp = elab_term post in\n let rp = mk_abs rty R.Q_Explicit rp in\n (match c, use_eq with\n | STT, true -> mk_stt_return ru rty rt rp\n | STT, false -> mk_stt_return_noeq ru rty rt rp\n | STT_Atomic, true -> mk_stt_atomic_return ru rty rt rp\n | STT_Atomic, false -> mk_stt_atomic_return_noeq ru rty rt rp\n | STT_Ghost, true -> mk_stt_ghost_return ru rty rt rp\n | STT_Ghost, false -> mk_stt_ghost_return_noeq ru rty rt rp)\n\n | T_Bind _ e1 e2 c1 c2 b x c e1_typing t_typing e2_typing bc ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n elab_bind bc e1 (mk_abs_with_name b.binder_ppname.name ty1 R.Q_Explicit (RT.close_term e2 x))\n\n | T_BindFn _ _ _ c1 c2 b x e1_typing _u t_typing e2_typing c2_typing ->\n let e1 = elab_st_typing e1_typing in\n let e2 = elab_st_typing e2_typing in\n let ty1 = elab_term (comp_res c1) in\n RT.mk_let RT.pp_name_default e1 ty1 (RT.close_term e2 x)\n \n | T_Frame _ _ c frame _frame_typing e_typing ->\n let e = elab_st_typing e_typing in\n elab_frame c frame e\n \n | T_Equiv _ _ c1 c2 e_typing (ST_TotEquiv _ _ _ _ _ _) ->\n let e = elab_st_typing e_typing in\n e\n\n | T_Equiv _ _ c1 c2 e_typing _ ->\n let e = elab_st_typing e_typing in\n elab_sub c1 c2 e\n\n | T_Sub _ _ c1 c2 e_typing d_sub ->\n let e = elab_st_typing e_typing in\n let (| coercion, _ |) = elab_st_sub d_sub in\n R.mk_e_app coercion [e]\n\n | T_Lift _ _ c1 c2 e_typing lc ->\n let e = elab_st_typing e_typing in\n elab_lift lc e\n\n | T_If _ b _ _ _ _ _ e1_typing e2_typing _c_typing ->\n let rb = elab_term b in\n let re1 = elab_st_typing e1_typing in\n let re2 = elab_st_typing e2_typing in\n RT.mk_if rb re1 re2\n\n | T_Match _ _ _ sc _ _ _ _ _ brty _ ->\n let sc = elab_term sc in\n let brs = elab_branches brty in\n R.pack_ln (R.Tv_Match sc None brs)\n\n | T_IntroPure _ p _ _ ->\n let head = \n tm_pureapp (tm_fvar (as_fv (mk_pulse_lib_core_lid \"intro_pure\")))\n None\n p\n in\n let arg = (`()) in\n R.mk_app (elab_term head) [(arg, elab_qual None)]\n\n | T_ElimExists _ u t p _ d_t d_exists ->\n let ru = u in\n let rt = elab_term t in\n let rp = elab_term p in\n mk_elim_exists ru rt (mk_abs rt R.Q_Explicit rp)\n\n | T_IntroExists _ u b p e _ _ _ ->\n let ru = u in\n let rt = elab_term b.binder_ty in\n let rp = elab_term p in\n let re = elab_term e in\n mk_intro_exists ru rt (mk_abs rt R.Q_Explicit rp) re\n\n | T_While _ inv _ _ _ cond_typing body_typing ->\n let inv = elab_term inv in\n let cond = elab_st_typing cond_typing in\n let body = elab_st_typing body_typing in\n mk_while (mk_abs bool_tm R.Q_Explicit inv) cond body\n\n | T_Par _ eL cL eR cR _ _ _ eL_typing eR_typing ->\n let ru = comp_u cL in\n let raL = elab_term (comp_res cL) in\n let raR = elab_term (comp_res cR) in\n let rpreL = elab_term (comp_pre cL) in\n let rpostL = elab_term (comp_post cL) in\n let rpreR = elab_term (comp_pre cR) in\n let rpostR = elab_term (comp_post cR) in\n let reL = elab_st_typing eL_typing in\n let reR = elab_st_typing eR_typing in\n mk_par ru\n raL\n raR\n rpreL\n (mk_abs raL R.Q_Explicit rpostL)\n rpreR\n (mk_abs raR R.Q_Explicit rpostR)\n reL reR\n\n\t\t\t\t| T_Rewrite _ p q _ _ ->\n\t\t\t\t let rp = elab_term p in\n\t\t\t\t\t\tlet rq = elab_term q in\n\t\t\t\t\t\tmk_rewrite rp rq\n\n | T_WithLocal _ _ init _ init_t c x _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_ref ra) R.Q_Explicit rbody in\n mk_withlocal rret_u ra rinit rpre rret_t rpost rbody\n\n | T_WithLocalArray _ _ init len _ init_t c x _ _ _ _ body_typing ->\n let rret_u = comp_u c in\n let ra = elab_term init_t in\n let rinit = elab_term init in\n let rlen = elab_term len in\n let rret_t = elab_term (comp_res c) in\n let rpre = elab_term (comp_pre c) in\n let rpost = mk_abs rret_t R.Q_Explicit (elab_term (comp_post c)) in\n let rbody = elab_st_typing body_typing in\n let rbody = RT.close_term rbody x in\n let rbody = mk_abs (mk_array ra) R.Q_Explicit rbody in\n mk_withlocalarray rret_u ra rinit rlen rpre rret_t rpost rbody\n\n | T_Admit _ {u;res;pre;post} c _ ->\n let ru = u in\n let rres = elab_term res in\n let rpre = elab_term pre in\n let rpost = elab_term post in\n let rpost = mk_abs rres R.Q_Explicit rpost in\n (match c with\n | STT -> mk_stt_admit ru rres rpre rpost\n | STT_Atomic -> mk_stt_atomic_admit ru rres rpre rpost\n | STT_Ghost -> mk_stt_ghost_admit ru rres rpre rpost)\n\n | T_Unreachable _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_Unreachable\")\n\n | T_WithInv _ _ _ _ _ _ _ _ _ ->\n `(\"IOU: elab_st_typing of T_WithInv\")\n\nand elab_br (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#p:pattern)\n (#e:st_term)\n (d : br_typing g sc_u sc_ty sc p e c)\n : Tot R.branch (decreases d)\n = let TBR _ _ _ _ _ _ _ _ bs _ _ _ ed = d in\n let e = elab_st_typing ed in\n (elab_pat p, e)\nand elab_branches (#g:env)\n (#c:comp_st)\n (#sc_u:universe) (#sc_ty:typ) (#sc:term)\n (#brs:list branch)\n (d : brs_typing g sc_u sc_ty sc brs c)\n : Tot (list R.branch)\n (decreases d)\n = match d with\n | TBRS_0 _ -> []\n | TBRS_1 _ p e bd _ d' ->\n elab_br bd :: elab_branches d'", "val jump_weaken\n (k1 #k2: parser_kind)\n (#t: Type)\n (#p2: parser k2 t)\n (v2: jumper p2)\n (sq: squash (k1 `is_weaker_than` k2))\n : Tot (jumper (weaken k1 p2))\nlet jump_weaken\n (k1: parser_kind)\n (#k2: parser_kind)\n (#t: Type)\n (#p2: parser k2 t)\n (v2: jumper p2)\n (sq: squash (k1 `is_weaker_than` k2))\n: Tot (jumper (weaken k1 p2))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ = valid_facts (weaken k1 p2) h input pos in\n [@inline_let]\n let _ = valid_facts p2 h input pos in\n v2 input pos", "val elim_pure (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt')\nlet elim_pure (#g:env) (#ctxt:term) (ctxt_typing:tot_typing g ctxt tm_vprop)\n : T.Tac (g':env { env_extends g' g } &\n ctxt':term &\n tot_typing g' ctxt' tm_vprop &\n continuation_elaborator g ctxt g' ctxt') =\n let ctxt_emp_typing : tot_typing g (tm_star ctxt tm_emp) tm_vprop = RU.magic () in\n let (| g', ctxt', ctxt'_emp_typing, k |) =\n elim_pure_frame ctxt_emp_typing (mk_env (fstar_env g)) in\n let k = k_elab_equiv k (VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _))\n (VE_Trans _ _ _ _ (VE_Comm _ _ _) (VE_Unit _ _)) in\n (| g', ctxt', star_typing_inversion_l ctxt'_emp_typing, k |)", "val subst_gen_elam : x:var -> v:exp{closed v} -> t_y:typ -> e':exp -> Lemma\n (ensures (subst (sub_beta_gen x v) (ELam t_y e') =\n ELam t_y (subst (sub_beta_gen (x+1) v) e')))\nlet subst_gen_elam x v t_y e' =\n subst_gen_elam_aux_forall x v;\n subst_extensional (sub_elam (sub_beta_gen x v))\n (sub_beta_gen (x+1) v) e';\n assert(subst (sub_beta_gen x v) (ELam t_y e')\n = ELam t_y (subst (sub_elam (sub_beta_gen x v)) e'))", "val check_tot_term (g:env) (e:term) (t:term)\n : T.Tac (e:term &\n tot_typing g e t)\nlet check_tot_term g e t =\n check_term g e T.E_Total t", "val extend_gen_0 : t:typ -> g:env ->\n Lemma (feq (extend_gen 0 t g) (extend t g))\nlet extend_gen_0 t g =\n forall_intro (extend_gen_0_aux t g)", "val add (#t_k: eqtype) (#t_v: Type0) (ll: t t_k t_v) (k: t_k) (x: t_v):\n ST unit\n (requires fun h0 ->\n invariant h0 ll)\n (ensures fun h0 _ h1 ->\n B.modifies (region_of ll) h0 h1 /\\\n invariant h1 ll /\\\n v h1 ll == M.upd (v h0 ll) k (Some x))\nlet add #_ #_ ll k x =\n LL2.push ll (k, x)", "val non_informative_t_subst\n (g: env)\n (x: var)\n (t: typ)\n (g': env{pairwise_disjoint g (singleton_env (fstar_env g) x t) g'})\n (#e: term)\n (e_typing: tot_typing g e t)\n (u: universe)\n (t1: term)\n (d: non_informative_t (push_env g (push_env (singleton_env (fstar_env g) x t) g')) u t1)\n : non_informative_t (push_env g (subst_env g' (nt x e))) u (subst_term t1 (nt x e))\nlet non_informative_t_subst (g:env) (x:var) (t:typ) (g':env { pairwise_disjoint g (singleton_env (fstar_env g) x t) g' })\n (#e:term)\n (e_typing:tot_typing g e t)\n (u:universe) (t1:term)\n (d:non_informative_t (push_env g (push_env (singleton_env (fstar_env g) x t) g')) u t1)\n\n : non_informative_t (push_env g (subst_env g' (nt x e))) u (subst_term t1 (nt x e)) =\n\n let ss = nt x e in\n\n let (| w, _ |) = d in\n (| subst_term w ss, RU.magic #(tot_typing _ _ _) () |)", "val core_check_tot_term (g:env) (e:term) (t:typ)\n : T.Tac (tot_typing g e t)\nlet core_check_tot_term g e t =\n core_check_term g e T.E_Total t", "val serialize_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (p2: (t1 -> GTot Type0))\n (prf: parse_strengthen_prf p1 p2)\n (s: serializer p1)\n : Tot (serializer (parse_strengthen p1 p2 prf))\nlet serialize_strengthen\n (#k: parser_kind)\n (#t1: Type)\n (#p1: parser k t1)\n (p2: t1 -> GTot Type0)\n (prf: parse_strengthen_prf p1 p2)\n (s: serializer p1)\n: Tot (serializer (parse_strengthen p1 p2 prf))\n= Classical.forall_intro (serialize_strengthen_correct p2 prf s);\n serialize_strengthen' p2 prf s", "val non_informative_t_weakening\n (g g': env)\n (g1: env{pairwise_disjoint g g1 g'})\n (u: universe)\n (t: term)\n (d: non_informative_t (push_env g g') u t)\n : non_informative_t (push_env (push_env g g1) g') u t\nlet non_informative_t_weakening (g g':env) (g1:env{ pairwise_disjoint g g1 g' })\n (u:universe) (t:term)\n (d:non_informative_t (push_env g g') u t)\n : non_informative_t (push_env (push_env g g1) g') u t =\n let (| w, _ |) = d in\n (| w, RU.magic #(tot_typing _ _ _) () |)", "val rewrite_soundness\n \t\t(#g:stt_env)\n\t\t(#t:st_term)\n\t\t(#c:comp)\n\t\t(d:st_typing g t c{T_Rewrite? d})\n\t\t: GTot (RT.tot_typing (elab_env g)\n\t\t\t\t\t\t\t (elab_st_typing d)\n\t\t\t\t\t\t\t (elab_comp c))\nlet rewrite_soundness\n \t\t(#g:stt_env)\n\t\t(#t:st_term)\n\t\t(#c:comp)\n\t\t(d:st_typing g t c{T_Rewrite? d})\n\t\t: GTot (RT.tot_typing (elab_env g)\n\t\t\t\t\t\t\t (elab_st_typing d)\n\t\t\t\t\t\t\t (elab_comp c)) =\n\t\t\n\t\tlet T_Rewrite _ p q p_typing equiv_p_q = d in\n\t\tlet rp = elab_term p in\n\t\tlet rq = elab_term q in\n\t\tlet rp_typing : RT.tot_typing _ rp vprop_tm =\n\t\t tot_typing_soundness p_typing in\n\t\tlet rq_typing : RT.tot_typing _ rq vprop_tm =\n\t\t tot_typing_soundness (let f, _ = vprop_equiv_typing equiv_p_q in\n\t\t\t\t f p_typing) in\n\t\tlet d_stt_vprop_equiv =\n\t\t Pulse.Soundness.VPropEquiv.vprop_equiv_unit_soundness\n\t\t\t\t p_typing equiv_p_q in\n\t\t\n\t\tWT.rewrite_typing rp_typing rq_typing d_stt_vprop_equiv", "val extend_env_l_lookup_bvar (g: R.env) (sg: src_env) (x: var)\n : Lemma (requires (forall x. RT.lookup_bvar g x == None))\n (ensures\n (match lookup sg x with\n | Some b -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_binding b)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\nlet rec extend_env_l_lookup_bvar (g:R.env) (sg:src_env) (x:var)\n : Lemma \n (requires (forall x. RT.lookup_bvar g x == None))\n (ensures (\n match lookup sg x with\n | Some b -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_binding b)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\n = match sg with\n | [] -> ()\n | hd :: tl -> extend_env_l_lookup_bvar g tl x", "val extend_env_l_lookup_bvar (g: R.env) (sg: src_env) (x: var)\n : Lemma (requires (forall x. RT.lookup_bvar g x == None))\n (ensures\n (match lookup sg x with\n | Some b -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_binding b)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\nlet rec extend_env_l_lookup_bvar (g:R.env) (sg:src_env) (x:var)\n : Lemma \n (requires (forall x. RT.lookup_bvar g x == None))\n (ensures (\n match lookup sg x with\n | Some b -> RT.lookup_bvar (extend_env_l g sg) x == Some (elab_binding b)\n | None -> RT.lookup_bvar (extend_env_l g sg) x == None))\n (decreases sg)\n [SMTPat (RT.lookup_bvar (extend_env_l g sg) x)]\n = match sg with\n | [] -> ()\n | hd :: tl -> extend_env_l_lookup_bvar g tl x", "val push_bindings (g: env) (bs: list binding {all_fresh g bs})\n : Tot (g': env{env_extends g' g}) (decreases bs)\nlet rec push_bindings (g:env) (bs:list binding{all_fresh g bs}) : Tot (g':env{env_extends g' g}) (decreases bs) =\n match bs with\n | [] -> g\n | (x,t)::bs -> push_bindings (push_binding g x ppname_default t) bs", "val tot_typing_freevars (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\nlet tot_typing_freevars\n (#g:_) (#t:_) (#ty:_)\n (d:tot_typing g t ty)\n : Lemma \n (ensures freevars t `Set.subset` vars_of_env g /\\\n freevars ty `Set.subset` vars_of_env g)\n = tot_or_ghost_typing_freevars d", "val typing_extensional (g g': env) (e: exp)\n : Lemma (requires equal g g') (ensures typing g e == typing g' e)\nlet typing_extensional (g g':env) (e:exp)\n : Lemma\n (requires equal g g')\n (ensures typing g e == typing g' e)\n = context_invariance e g g'", "val weak_kind_glb (w1 w2: weak_kind) : Tot weak_kind\nlet weak_kind_glb (w1 w2: weak_kind) : Tot weak_kind =\r\n if w1 = w2\r\n then w1\r\n else WeakKindWeak", "val sub_typing_renaming\n (#f: RT.fstar_top_env)\n (sg sg': src_env)\n (x: var{None? (lookup sg x) && None? (lookup sg' x)})\n (y: var{None? (lookup sg y) && None? (lookup sg' y)})\n (b: binding)\n (t0 t1: s_ty)\n (d: sub_typing f (sg' @ (x, b) :: sg) t0 t1)\n : GTot (d': sub_typing f (rename_env sg' x y @ (y, b) :: sg) t0 t1 {s_height d' == s_height d})\n (decreases (s_height d))\nlet sub_typing_renaming (#f:RT.fstar_top_env)\n (sg sg':src_env)\n (x:var { None? (lookup sg x) && None? (lookup sg' x) })\n (y:var { None? (lookup sg y) && None? (lookup sg' y) })\n (b:binding)\n (t0 t1:s_ty)\n (d:sub_typing f (sg'@(x,b)::sg) t0 t1)\n : GTot (d':sub_typing f (rename_env sg' x y@(y,b)::sg) t0 t1 { s_height d' == s_height d })\n (decreases (s_height d))\n = match d with\n | S_Refl _ _ -> S_Refl _ _ \n | S_ELab g _ _ d ->\n S_ELab _ _ _ (core_subtyping_renaming sg sg' x y b t0 t1 d)", "val extend\n (#a:eqtype)\n (#b:a -> Type)\n (#inv:DM.t a (opt b) -> Type)\n (#r:HST.erid)\n (t:t r a b inv)\n (x:a)\n (y:b x)\n : Stack unit\n (requires (fun h ->\n ~(defined t x h) /\\\n inv (repr (upd (HS.sel h t) x y))))\n (ensures (fun h0 u h1 ->\n let cur = HS.sel h0 t in\n HS.contains h1 t /\\\n HS.modifies (Set.singleton r) h0 h1 /\\\n HS.modifies_ref r (Set.singleton (HS.as_addr t)) h0 h1 /\\\n HS.sel h1 t == upd cur x y /\\\n witnessed (contains t x y)))\nlet extend #a #b #inv #r t x y =\n recall t;\n let cur = !t in\n t := upd cur x y;\n mr_witness t (contains t x y)", "val norm_st_typing_inverse\n (#g:env) (#e:st_term) (#t0:term)\n (d:st_typing g e (C_Tot t0))\n (#u:_)\n (t1:term)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (st_typing g e (C_Tot t1)))\nlet norm_st_typing_inverse\n (#g:env) (#e:st_term) (#t0:term)\n (d:st_typing g e (C_Tot t0))\n (#u:_)\n (t1:term)\n (d1:tot_typing g t1 (tm_type u))\n (steps:list norm_step)\n : T.Tac (option (st_typing g e (C_Tot t1)))\n = let d1 \n : Ghost.erased (RT.tot_typing (elab_env g) (elab_term t1) (RT.tm_type u))\n = Ghost.hide d1._0\n in\n let (| t1', t1'_typing, related_t1_t1' |) =\n Pulse.RuntimeUtils.norm_well_typed_term d1 steps\n in\n match Pulse.Readback.readback_ty t1' with\n | Some t1_p ->\n if TermEq.term_eq (elab_term t0) t1'\n then (\n let t0_typing \n : Ghost.erased (RT.tot_typing (elab_env g) (elab_term t0) (RT.tm_type u)) =\n rt_equiv_typing #_ #_ #(elab_term t0) related_t1_t1' d1\n in\n let eq\n : Ghost.erased (RT.equiv (elab_env g) (elab_term t0) (elab_term t1))\n = Ghost.hide (RT.Rel_sym _ _ _ related_t1_t1')\n in\n let steq : st_equiv g (C_Tot t0) (C_Tot t1) =\n ST_TotEquiv _ _ _ u (E (Ghost.reveal t0_typing)) eq\n in\n Some (T_Equiv _ _ _ _ d steq)\n )\n else None\n | _ -> None", "val as_type (#nz #wk: _) (#pk: P.parser_kind nz wk) (#l #i #d #b: _) (t: typ pk l i d b)\n : Tot Type0 (decreases t)\nlet rec as_type\r\n #nz #wk (#pk:P.parser_kind nz wk)\r\n #l #i #d #b\r\n (t:typ pk l i d b)\r\n : Tot Type0\r\n (decreases t)\r\n = match t with\r\n | T_false _ -> False\r\n\r\n | T_denoted _ td -> \r\n dtyp_as_type td\r\n\r\n | T_pair _ t1 t2 ->\r\n as_type t1 & as_type t2\r\n\r\n | T_dep_pair _ i t\r\n | T_dep_pair_with_action _ i t _ ->\r\n x:dtyp_as_type i & as_type (t x)\r\n\r\n | T_refine _ base refinement ->\r\n P.refine (dtyp_as_type base) refinement\r\n\r\n | T_refine_with_action _ base refinement _ ->\r\n P.refine (dtyp_as_type base) refinement\r\n\r\n | T_dep_pair_with_refinement _ base refinement t ->\r\n x:P.refine (dtyp_as_type base) refinement & as_type (t x)\r\n\r\n | T_dep_pair_with_refinement_and_action _ base refinement t _ ->\r\n x:P.refine (dtyp_as_type base) refinement & as_type (t x)\r\n\r\n | T_if_else b t0 t1 ->\r\n P.t_ite b (fun _ -> as_type (t0()))\r\n (fun _ -> as_type (t1()))\r\n\r\n | T_cases b t0 t1 ->\r\n P.t_ite b (fun _ -> as_type t0) (fun _ -> as_type t1)\r\n\r\n | T_with_action _ t _\r\n | T_with_comment _ t _ ->\r\n as_type t\r\n\r\n | T_with_dep_action _ i _ ->\r\n dtyp_as_type i\r\n\r\n | T_nlist _ n t ->\r\n P.nlist n (as_type t)\r\n\r\n | T_at_most _ n t ->\r\n P.t_at_most n (as_type t)\r\n\r\n | T_exact _ n t ->\r\n P.t_exact n (as_type t)\r\n\r\n | T_string _ elt_t terminator ->\r\n P.cstring (dtyp_as_type elt_t) terminator", "val elab_st_sub (#g: env) (#c1 #c2: comp) (d_sub: st_sub g c1 c2)\n : Tot (t: R.term & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\nlet elab_st_sub (#g:env) (#c1 #c2 : comp)\n (d_sub : st_sub g c1 c2)\n : Tot (t:R.term\n & RT.tot_typing (elab_env g) t (simple_arr (elab_comp c1) (elab_comp c2)))\n= RU.magic_s \"elab_st_sub\"", "val bind_tot_steelK_\n (a b: Type)\n (#framed: eqtype_as_type bool)\n (#[@@@ framing_implicit]pre: pre_t)\n (#[@@@ framing_implicit]post: post_t b)\n (f: (eqtype_as_type unit -> Tot a))\n (g: (x: a -> steelK b framed pre post))\n : steelK b framed pre post\nlet bind_tot_steelK_ (a:Type) (b:Type)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t b)\n (f:eqtype_as_type unit -> Tot a) (g:(x:a -> steelK b framed pre post))\n: steelK b\n framed\n pre\n post\n = fun #frame #postf (k:(x:b -> SteelT unit (frame `star` post x) (fun _ -> postf))) ->\n let x = f () in\n g x #frame #postf k", "val Pulse.Typing.Env.push_binding_def = \n g: Pulse.Typing.Env.env ->\n x: Pulse.Syntax.Base.var{~(FStar.Set.mem x (Pulse.Typing.Env.dom g))} ->\n t: Pulse.Syntax.Base.typ\n -> g': Pulse.Typing.Env.env{Pulse.Typing.Env.fstar_env g' == Pulse.Typing.Env.fstar_env g}\nlet push_binding_def (g:env) (x:var { ~ (Set.mem x (dom g)) }) (t:typ)\n = push_binding g x ppname_default t", "val elim_one\n (#g: env)\n (ctxt: term)\n (frame p: vprop)\n (ctxt_frame_p_typing: tot_typing g (tm_star (tm_star ctxt frame) p) tm_vprop)\n (nx: ppname)\n (e1: st_term)\n (c1: comp{stateful_comp c1 /\\ comp_pre c1 == p})\n (e1_typing: st_typing g e1 c1)\n (uvs: env{disjoint uvs g})\n : T.Tac\n (g': env{env_extends g' g /\\ disjoint uvs g'} &\n ctxt': term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star (tm_star ctxt frame) p) g' (tm_star ctxt' frame))\nlet elim_one (#g:env)\n (ctxt:term) (frame:vprop) (p:vprop)\n (ctxt_frame_p_typing:tot_typing g (tm_star (tm_star ctxt frame) p) tm_vprop)\n (nx:ppname) (e1:st_term) (c1:comp { stateful_comp c1 /\\ comp_pre c1 == p })\n (e1_typing:st_typing g e1 c1)\n (uvs:env { disjoint uvs g })\n : T.Tac (g':env { env_extends g' g /\\ disjoint uvs g' } &\n ctxt':term &\n tot_typing g' (tm_star ctxt' frame) tm_vprop &\n continuation_elaborator g (tm_star (tm_star ctxt frame) p) g' (tm_star ctxt' frame)) =\n \n let ctxt_frame_typing = star_typing_inversion_l ctxt_frame_p_typing in\n let x = fresh (push_env g uvs) in\n let k =\n continuation_elaborator_with_bind (tm_star ctxt frame) e1_typing ctxt_frame_p_typing (nx, x) in\n let g' = push_binding g x nx (comp_res c1) in\n let ctxt' = tm_star (open_term_nv (comp_post c1) (nx, x)) ctxt in\n let veq\n : vprop_equiv g' (tm_star (open_term_nv (comp_post c1) (nx, x)) (tm_star ctxt frame))\n (tm_star ctxt' frame) = VE_Assoc _ _ _ _ in\n let k\n : continuation_elaborator\n g (tm_star (tm_star ctxt frame) p)\n g' (tm_star ctxt' frame) =\n k_elab_equiv\n #g #g'\n #(tm_star (tm_star ctxt frame) p)\n #(tm_star (tm_star ctxt frame) p)\n #(tm_star (open_term_nv (comp_post c1) (nx, x)) (tm_star ctxt frame))\n #(tm_star ctxt' frame)\n k (VE_Refl g (tm_star (tm_star ctxt frame) p)) veq in\n \n let ctxt'_frame_typing : tot_typing g' (tm_star ctxt' frame) tm_vprop = RU.magic () in\n env_extends_push g x ppname_default (comp_res c1);\n (| g', ctxt', ctxt'_frame_typing, k |)", "val src_ty_ok_renaming\n (#f: RT.fstar_top_env)\n (sg sg': src_env)\n (x: var{None? (lookup sg x) /\\ None? (lookup sg' x)})\n (y: var{None? (lookup sg y) /\\ None? (lookup sg' x)})\n (b: binding)\n (t: s_ty)\n (d: src_ty_ok f (sg' @ (x, b) :: sg) t)\n : GTot (d': src_ty_ok f (rename_env sg' x y @ (y, b) :: sg) t {t_height d' == t_height d})\n (decreases d)\nlet rec src_ty_ok_renaming (#f:RT.fstar_top_env)\n (sg sg':src_env)\n (x:var { None? (lookup sg x) /\\ None? (lookup sg' x) })\n (y:var { None? (lookup sg y) /\\ None? (lookup sg' x) })\n (b:binding)\n (t:s_ty)\n (d:src_ty_ok f (sg'@(x,b)::sg) t)\n : GTot (d':src_ty_ok f (rename_env sg' x y@(y,b)::sg) t { t_height d' == t_height d })\n (decreases d)\n = match d with\n | OK_TBool _ -> OK_TBool _\n | OK_TArrow g t t' d1 d2 ->\n let d1 = src_ty_ok_renaming sg sg' x y _ _ d1 in\n let d2 = src_ty_ok_renaming sg sg' x y _ _ d2 in\n OK_TArrow _ _ _ d1 d2\n | OK_TRefine _ _ d -> OK_TRefine _ _ d", "val tot_typing_ln (#g:_) (#e:_) (#t:_)\n (d:tot_typing g e t)\n : Lemma (ln e /\\ ln t)\nlet tot_typing_ln\n (#g:_) (#e:_) (#t:_)\n (d:tot_typing g e t)\n : Lemma \n (ensures ln e /\\ ln t)\n = tot_or_ghost_typing_ln d", "val tree_invariant' (#pp: Type0) (x: tree' pp) (h: mem) : Tot Type0 (decreases %[depth x])\nlet rec tree_invariant' (#pp:Type0) (x:tree' pp) (h:mem)\n : Tot Type0 (decreases %[depth x]) =\n match x with\n | Leaf p -> Pkg?.package_invariant p h\n | Node p lxs ->\n Pkg?.package_invariant p h /\\\n children_forall lxs (fun x -> tree_invariant' x h) /\\\n disjoint_children h lxs", "val validate_strengthen\n (k2 #k1: parser_kind)\n (#t: Type)\n (#p1: parser k1 t)\n (v1: validator p1)\n (sq: squash (parser_kind_prop k2 p1))\n : Tot (validator (strengthen k2 p1))\nlet validate_strengthen\n (k2: parser_kind)\n (#k1: parser_kind)\n (#t: Type)\n (#p1: parser k1 t)\n (v1: validator p1)\n (sq: squash (parser_kind_prop k2 p1))\n: Tot (validator (strengthen k2 p1))\n= fun #rrel #rel input pos ->\n let h = HST.get () in\n [@inline_let]\n let _ = valid_facts (strengthen k2 p1) h input (uint64_to_uint32 pos) in\n [@inline_let]\n let _ = valid_facts p1 h input (uint64_to_uint32 pos) in\n v1 input pos", "val invariant: #t_k:eqtype -> #t_v:Type0 -> h:HS.mem -> ll:t t_k t_v -> Type0\nlet invariant #_ #_ h ll =\n LL2.invariant h ll" ], "closest_src": [ { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.weakening" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.typing_extensional" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.substitution_preserves_typing" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.substitution_preserves_typing" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.context_invariance" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.context_invariance" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.preservation" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.substitution" }, { "project_name": "steel", "file_name": "Pulse.Checker.Match.fst", "name": "Pulse.Checker.Match.tot_typing_weakening_n" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.tot_typing_weakening_standard" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.tot_typing_weakening_single" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_typing_weakening" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.substitution_beta" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.typing_extensional" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen_typing_conversion" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.typable_below" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.st_typing_weakening_end" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_ty_ok_weakening" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.soundness" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.st_typing_weakening_standard" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_typing_weakening_l" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.preservation" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.soundness" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.preservation" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.st_sub_weakening" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.elab_ty_soundness" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.st_typing_weakening" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.extend" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_st_typing" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.soundness" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.progress" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_weakening" }, { "project_name": "everparse", "file_name": "EverParse3d.Kinds.fsti", "name": "EverParse3d.Kinds.weak_kind_glb" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.free_in_context" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.free_in_context" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.substitution_preserves_typing" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.src_ty_ok_soundness" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.extend" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.veq_weakening_end" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.height" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.height" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Common.fst", "name": "Pulse.Soundness.Common.tot_typing_soundness" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.t_height" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_ty_ok_soundness" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_br" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.t_height" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.progress" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.comp_typing_weakening" }, { "project_name": "steel", "file_name": "Pulse.Soundness.fst", "name": "Pulse.Soundness.bind_soundness" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Bind.fst", "name": "Pulse.Soundness.Bind.bind_fn_typing" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.parse_strengthen" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.progress" }, { "project_name": "FStar", "file_name": "StlcStrongDbParSubst.fst", "name": "StlcStrongDbParSubst.extend" }, { "project_name": "FStar", "file_name": "StackMachine.fst", "name": "StackMachine.texpDenote" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.weaken" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Common.fst", "name": "Pulse.Soundness.Common.ghost_typing_soundness" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.lift_comp_subst" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.fst", "name": "Pulse.Typing.Metatheory.veq_weakening" }, { "project_name": "FStar", "file_name": "StlcCbvDbPntSubstNoLists.fst", "name": "StlcCbvDbPntSubstNoLists.subst_beta" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.weaken" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Base.fsti", "name": "LowParse.Spec.Base.tot_strengthen" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.below" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.bare_parse_strengthen" }, { "project_name": "everparse", "file_name": "Z3TestGen.fst", "name": "Z3TestGen.typ_depth" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.fst", "name": "LowParse.Low.Base.jump_weaken" }, { "project_name": "FStar", "file_name": "STLC.Core.fst", "name": "STLC.Core.extend_env_l_lookup_bvar" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_typing_renaming" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.post_hint_for_env_extends" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_branches" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.jump_weaken" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.ElimPure.fst", "name": "Pulse.Checker.Prover.ElimPure.elim_pure" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.subst_gen_elam" }, { "project_name": "steel", "file_name": "Pulse.Checker.Pure.fst", "name": "Pulse.Checker.Pure.check_tot_term" }, { "project_name": "FStar", "file_name": "StlcCbvDbParSubst.fst", "name": "StlcCbvDbParSubst.extend_gen_0" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.add" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.non_informative_t_subst" }, { "project_name": "steel", "file_name": "Pulse.Checker.Pure.fst", "name": "Pulse.Checker.Pure.core_check_tot_term" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Combinators.fsti", "name": "LowParse.Spec.Combinators.serialize_strengthen" }, { "project_name": "steel", "file_name": "Pulse.Typing.Metatheory.Base.fst", "name": "Pulse.Typing.Metatheory.Base.non_informative_t_weakening" }, { "project_name": "steel", "file_name": "Pulse.Soundness.Rewrite.fst", "name": "Pulse.Soundness.Rewrite.rewrite_soundness" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.extend_env_l_lookup_bvar" }, { "project_name": "FStar", "file_name": "DependentBoolRefinement.fst", "name": "DependentBoolRefinement.extend_env_l_lookup_bvar" }, { "project_name": "steel", "file_name": "Pulse.Typing.fst", "name": "Pulse.Typing.push_bindings" }, { "project_name": "steel", "file_name": "Pulse.Typing.FV.fst", "name": "Pulse.Typing.FV.tot_typing_freevars" }, { "project_name": "FStar", "file_name": "OPLSS2021.STLC.fst", "name": "OPLSS2021.STLC.typing_extensional" }, { "project_name": "everparse", "file_name": "Ast.fst", "name": "Ast.weak_kind_glb" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.sub_typing_renaming" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fst", "name": "FStar.Monotonic.DependentMap.extend" }, { "project_name": "steel", "file_name": "Pulse.Checker.Base.fst", "name": "Pulse.Checker.Base.norm_st_typing_inverse" }, { "project_name": "everparse", "file_name": "EverParse3d.Interpreter.fst", "name": "EverParse3d.Interpreter.as_type" }, { "project_name": "steel", "file_name": "Pulse.Elaborate.Core.fst", "name": "Pulse.Elaborate.Core.elab_st_sub" }, { "project_name": "steel", "file_name": "Steel.Primitive.ForkJoin.Unix.fst", "name": "Steel.Primitive.ForkJoin.Unix.bind_tot_steelK_" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fsti", "name": "Pulse.Typing.Env.push_binding_def" }, { "project_name": "steel", "file_name": "Pulse.Checker.Prover.Base.fst", "name": "Pulse.Checker.Prover.Base.elim_one" }, { "project_name": "FStar", "file_name": "BoolRefinement.fst", "name": "BoolRefinement.src_ty_ok_renaming" }, { "project_name": "steel", "file_name": "Pulse.Typing.LN.fst", "name": "Pulse.Typing.LN.tot_typing_ln" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.KDF.fst", "name": "MiTLS.KDF.tree_invariant'" }, { "project_name": "everparse", "file_name": "LowParse.Low.Combinators.fsti", "name": "LowParse.Low.Combinators.validate_strengthen" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.invariant" } ], "selected_premises": [ "LambdaOmega.tshift_up", "FStar.FunctionalExtensionality.feq", "LambdaOmega.progress", "LambdaOmega.tappears_free_in", "FStar.Constructive.ceq_trans", "FStar.Constructive.false_elim", "LambdaOmega.tcontext_invariance", "LambdaOmega.kinding_extensional", "LambdaOmega.kinding_weakening_tbnd", "FStar.Constructive.cfalse_elim", "LambdaOmega.esub_inc", "FStar.Tactics.Effect.raise", "FStar.Constructive.eq_ind", "FStar.Constructive.ceq_symm", "LambdaOmega.esub_lam_hoist", "FStar.FunctionalExtensionality.on_dom", "LambdaOmega.extend_tvar", "LambdaOmega.esub_lam", "LambdaOmega.kinding_weakening_ebnd", "LambdaOmega.lookup_evar", "LambdaOmega.tsub_beta_gen", "FStar.Pervasives.Native.fst", "LambdaOmega.empty_x", "LambdaOmega.tshift_up_above_lam", "FStar.Pervasives.Native.snd", "LambdaOmega.tsub_inc", "LambdaOmega.extend_evar", "FStar.Constructive.ceq_congruence", "LambdaOmega.tsub_lam_hoist", "LambdaOmega.lookup_tvar", "LambdaOmega.tsub_lam", "LambdaOmega.tsubst_id", "FStar.Pervasives.reveal_opaque", "FStar.Tactics.Types.issues", "LambdaOmega.empty_a", "LambdaOmega.is_tvar", "LambdaOmega.empty", "LambdaOmega.tsubst_extensional", "LambdaOmega.esubst_extensional", "LambdaOmega.tsubst_beta_gen", "FStar.Constructive.false_elim2", "FStar.Tactics.Effect.get", "LambdaOmega.is_value", "LambdaOmega.tsub_inc_above", "FStar.Pervasives.dfst", "FStar.FunctionalExtensionality.on", "FStar.Pervasives.dsnd", "LambdaOmega.tsubst_comp", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "LambdaOmega.tsub_id", "LambdaOmega.esubst_beta", "LambdaOmega.tshift_up_above", "LambdaOmega.esub_beta", "LambdaOmega.is_trenaming", "LambdaOmega.is_evar", "FStar.FunctionalExtensionality.restricted_t", "LambdaOmega.is_erenaming", "LambdaOmega.tsub_lam_comp", "FStar.FunctionalExtensionality.arrow", "LambdaOmega.tsub_comp", "LambdaOmega.tsubst_beta", "FStar.Issue.mk_issue", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.FunctionalExtensionality.is_restricted", "FStar.Pervasives.id", "FStar.Pervasives.st_post_h", "FStar.Tactics.Effect.tactic", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.Issue.issue_level_string", "FStar.FunctionalExtensionality.feq_g", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.FunctionalExtensionality.on_dom_g", "FStar.Pervasives.ex_pre", "FStar.FunctionalExtensionality.efun", "FStar.Monotonic.Pure.is_monotonic", "FStar.FunctionalExtensionality.efun_g", "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.on_g", "FStar.Pervasives.all_post_h", "FStar.Tactics.Effect.tac", "FStar.FunctionalExtensionality.is_restricted_g", "FStar.Pervasives.st_stronger", "FStar.Pervasives.st_pre_h", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.all_post_h'", "FStar.Tactics.Effect.tac_wp_monotonic", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.ex_post'", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Tactics.Effect.tac_close", "FStar.Pervasives.coerce_eq", "Prims.min", "FStar.Pervasives.pure_close_wp", "FStar.Pervasives.ex_post", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.all_bind_wp", "Prims.__cache_version_number__" ], "source_upto_this": "(*\n Copyright 2015\n Simon Forest - Inria and ENS Paris\n Catalin Hritcu - Inria\n Aseem Rastogi - UMD\n Nikhil Swamy - Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule LambdaOmega\n\n#set-options \"--max_fuel 1 --max_ifuel 1 --initial_fuel 1\"\n\nopen FStar.Constructive\nopen FStar.Classical\nopen FStar.FunctionalExtensionality\nopen FStar.StrongExcludedMiddle\n\n(* Chapter 29 of TAPL: \"Type Operators and Kinding\",\n proof follows Chapter 30, but we don't consider polymorphism\n (for extension to System F-omega see f-omega.fst) *)\n\ntype var = nat\n\ntype knd =\n | KTyp : knd\n | KArr : knd -> knd -> knd\n\ntype typ =\n | TVar : var -> typ\n | TLam : knd -> t:typ -> typ\n | TApp : typ -> typ -> typ\n | TArr : typ -> typ -> typ\n\ntype exp =\n | EVar : var -> exp\n | EApp : exp -> exp -> exp\n | ELam : typ -> exp -> exp\n\n(* Substitution on expressions\n (in this calculus doesn't interact with type substitution below) *)\n\ntype esub = var -> Tot exp\ntype erenaming (s:esub) = (forall (x:var). EVar? (s x))\n\nval is_erenaming : s:esub -> GTot (n:int{( erenaming s ==> n=0) /\\\n (~(erenaming s) ==> n=1)})\nlet is_erenaming s = (if strong_excluded_middle (erenaming s) then 0 else 1)\n\nval esub_inc : var -> Tot exp\nlet esub_inc y = EVar (y+1)\n\nlet is_evar (e:exp) : int = if EVar? e then 0 else 1\n\nval esubst : s:esub -> e:exp -> Pure exp (requires True)\n (ensures (fun e' -> erenaming s /\\ EVar? e ==> EVar? e'))\n (decreases %[is_evar e; is_erenaming s; 1; e])\n\nval esub_lam: s:esub -> x:var -> Tot (e:exp{ erenaming s ==> EVar? e})\n (decreases %[1;is_erenaming s; 0; EVar 0])\n\nlet rec esubst s e =\n match e with\n | EVar x -> s x\n | ELam t e -> ELam t (esubst (esub_lam s) e)\n | EApp e1 e2 -> EApp (esubst s e1) (esubst s e2)\nand esub_lam s = fun y ->\n if y = 0 then EVar y\n else esubst esub_inc (s (y-1))\n\nval esub_lam_renaming: s:esub -> Lemma\n (ensures (forall (x:var). erenaming s ==> EVar? (esub_lam s x)))\nlet esub_lam_renaming s = ()\n\n(* Substitution extensional; trivial with the extensionality axiom *)\nval esubst_extensional: s1:esub -> s2:esub{feq s1 s2} -> e:exp ->\n Lemma (requires True) (ensures (esubst s1 e == esubst s2 e))\n\t\t\t (decreases e)\n (*[SMTPat (esubst s1 e); SMTPat (esubst s2 e)]*)\nlet rec esubst_extensional s1 s2 e =\n match e with\n | EVar _ -> ()\n | ELam t e1 ->\n let open FStar.Tactics in\n assert (esubst s1 (ELam t e1) == ELam t (esubst (esub_lam s1) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n assert (esubst s2 (ELam t e1) == ELam t (esubst (esub_lam s2) e1))\n by norm [zeta; iota; delta_only [`%esubst]];\n esubst_extensional (esub_lam s1) (esub_lam s2) e1\n | EApp e1 e2 -> esubst_extensional s1 s2 e1; esubst_extensional s1 s2 e2\n\nval esub_lam_hoist : t:typ -> e:exp -> s:esub -> Lemma (requires True)\n (ensures (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e)))\nlet esub_lam_hoist t e s =\n let open FStar.Tactics in\n assert (esubst s (ELam t e) = ELam t (esubst (esub_lam s) e))\n by (norm [zeta; iota; delta_only [`%esubst]])\n\nval esub_beta : exp -> Tot esub\nlet esub_beta e = fun y -> if y = 0 then e\n else (EVar (y-1))\n\nval esubst_beta : exp -> exp -> Tot exp\nlet esubst_beta e = esubst (esub_beta e)\n\n(* Substitution on types is kind of analogous *)\n(* CH: Now this is more complex: tsub_inc_above, tsubst_beta_gen are\n// still there unfortunately, although they were simplified away for\n// expressions. This seems to be more an artifact of the TAPL proof\n// (via confluence); so we can still hope we can do better for TinyF*.*)\n\ntype tsub = var -> Tot typ\ntype trenaming (s:tsub) = (forall (x:var). TVar? (s x))\n\nval is_trenaming : s:tsub -> GTot (n:int{( trenaming s ==> n=0) /\\\n (~(trenaming s) ==> n=1)})\nlet is_trenaming s = (if strong_excluded_middle (trenaming s) then 0 else 1)\n\nval tsub_inc_above : nat -> var -> Tot typ\nlet tsub_inc_above x y = if y Tot typ\nlet tsub_inc = tsub_inc_above 0\n\nval trenaming_sub_inc : unit -> Lemma (trenaming (tsub_inc))\nlet trenaming_sub_inc _ = ()\n\nlet is_tvar (t:typ) : int = if TVar? t then 0 else 1\n\nval tsubst : s:tsub -> t:typ -> Pure typ (requires True)\n (ensures (fun t' -> trenaming s /\\ TVar? t ==> TVar? t'))\n (decreases %[is_tvar t; is_trenaming s; 1; t])\nval tsub_lam: s:tsub -> x:var -> Tot (t:typ{trenaming s ==> TVar? t})\n (decreases %[1; is_trenaming s; 0; TVar 0])\nlet rec tsubst s t =\n match t with\n | TVar x -> s x\n | TLam k t1 -> TLam k (tsubst (tsub_lam s) t1)\n | TArr t1 t2 -> TArr (tsubst s t1) (tsubst s t2)\n | TApp t1 t2 -> TApp (tsubst s t1) (tsubst s t2)\nand tsub_lam s y =\n if y = 0 then TVar y\n else tsubst tsub_inc (s (y-1))\n\n(* Type substitution extensional; trivial with the extensionality axiom *)\nval tsubst_extensional: s1:tsub -> s2:tsub{feq s1 s2} -> t:typ ->\n Lemma (requires True) (ensures (tsubst s1 t = tsubst s2 t))\n\t\t\t (decreases t)\n(* [SMTPat (tsubst t s1); SMTPat (tsubst t s2)]*)\nlet rec tsubst_extensional s1 s2 t =\n match t with\n | TVar _ -> ()\n | TLam k t1 ->\n let open FStar.Tactics in\n assert (tsubst s1 (TLam k t1) == TLam k (tsubst (tsub_lam s1) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n assert (tsubst s2 (TLam k t1) == TLam k (tsubst (tsub_lam s2) t1))\n by norm [zeta; iota; delta_only [`%tsubst]];\n tsubst_extensional (tsub_lam s1) (tsub_lam s2) t1\n | TArr t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n | TApp t1 t2 -> tsubst_extensional s1 s2 t1; tsubst_extensional s1 s2 t2\n\nval tsub_lam_hoist : k:knd -> t:typ -> s:tsub -> Lemma\n (ensures (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t)))\nlet tsub_lam_hoist k t s =\n let open FStar.Tactics in\n assert (tsubst s (TLam k t) = TLam k (tsubst (tsub_lam s) t))\n by norm [zeta; iota; delta_only [`%tsubst]]\n\n(* Type substitution composition *)\n(* CH: again, we managed to get rid of this for expressions only\n// (it was never used anyway) *)\n\nval tsub_comp : s1:tsub -> s2:tsub -> Tot tsub\nlet tsub_comp s1 s2 x = tsubst s1 (s2 x)\n\nval tsub_comp_inc : s:tsub -> x:var ->\n Lemma (tsub_comp tsub_inc s x = tsub_comp (tsub_lam s) tsub_inc x)\nlet tsub_comp_inc s x = ()\n\nval tsub_lam_renaming: s:tsub -> Lemma\n (ensures (forall (x:var). trenaming s ==> TVar? (tsub_lam s x)))\nlet tsub_lam_renaming s = ()\n\nval tsubst_comp : s1:tsub -> s2:tsub -> t:typ -> Lemma\n (ensures (tsubst s1 (tsubst s2 t) = tsubst (tsub_comp s1 s2) t))\n (decreases %[is_tvar t;\n is_trenaming s1;\n is_trenaming s2;\n t])\nlet rec tsubst_comp s1 s2 t =\n match t with\n | TVar z -> ()\n | TApp t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n | TLam k tbody ->\n let tsub_lam_comp : x:var ->\n Lemma(tsub_lam (tsub_comp s1 s2) x =\n tsub_comp (tsub_lam s1) (tsub_lam s2) x) =\n fun x -> match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n in\n let hoist1 = tsub_lam_hoist k tbody s2 in\n let hoist2 = tsub_lam_hoist k (tsubst (tsub_lam s2) tbody) s1 in\n let h1 =\n tsub_lam_renaming s1;\n tsub_lam_renaming s2;\n tsubst_comp (tsub_lam s1) (tsub_lam s2) tbody in\n\n let h2 =\n forall_intro tsub_lam_comp;\n cut (feq (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))) in\n\n let ext = tsubst_extensional\n (tsub_comp (tsub_lam s1) (tsub_lam s2))\n (tsub_lam (tsub_comp s1 s2))\n tbody in\n\n tsub_lam_hoist k tbody (tsub_comp s1 s2)\n\n | TArr t1 t2 -> tsubst_comp s1 s2 t1; tsubst_comp s1 s2 t2\n\nval tsub_lam_comp : s1:tsub -> s2:tsub -> x:var -> Lemma\n (tsub_lam (tsub_comp s1 s2) x = tsub_comp (tsub_lam s1) (tsub_lam s2) x)\n(* CH: TODO: Quite a bit of duplication here, mutual recursion would\n// have been better than nested one. Can we do that? *)\nlet tsub_lam_comp s1 s2 x =\n match x with\n | 0 -> ()\n | _ -> begin\n let ih1 = trenaming_sub_inc ();\n tsubst_comp tsub_inc s1 (s2 (x-1)) in\n let ext = forall_intro (tsub_comp_inc s1);\n tsubst_extensional (tsub_comp tsub_inc s1)\n (tsub_comp (tsub_lam s1) tsub_inc)\n (s2 (x-1)) in\n let ih2 = tsub_lam_renaming s1;\n trenaming_sub_inc ();\n tsubst_comp (tsub_lam s1) tsub_inc (s2 (x-1))\n in ()\n end\n\n(* Identity substitution *)\n\nval tsub_id : tsub\nlet tsub_id x = TVar x\n\nval tsubst_id : t:typ -> Lemma (tsubst tsub_id t = t)\nlet rec tsubst_id t =\n let open FStar.Tactics in\n match t with\n | TVar z -> ()\n | TLam k t1 ->\n tsub_lam_hoist k t1 tsub_id;\n assert (feq tsub_id (tsub_lam tsub_id))\n by (norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc]]);\n tsubst_extensional tsub_id (tsub_lam tsub_id) t1;\n tsubst_id t1\n | TArr t1 t2\n | TApp t1 t2 -> tsubst_id t1; tsubst_id t2\n\n(* Beta *)\n\nval tsub_beta_gen : var -> typ -> Tot tsub\nlet tsub_beta_gen x t = fun y -> if y < x then (TVar y)\n else if y = x then t\n else (TVar (y-1))\n\nval tsubst_beta_gen : var -> typ -> typ -> Tot typ\nlet tsubst_beta_gen x t' t = tsubst (tsub_beta_gen x t') t\n\nlet tsubst_beta t' t = tsubst_beta_gen 0 t' t\n\n(* Shifting *)\n\nval tshift_up_above : nat -> typ -> Tot typ\nlet tshift_up_above x = tsubst (tsub_inc_above x)\n\nval tshift_up : typ -> Tot typ\nlet tshift_up = tshift_up_above 0\n\n(* Step relation -- going for strong reduction, just because we can *)\n\ntype step : exp -> exp -> Type =\n | SBeta : t:typ ->\n e1:exp ->\n e2:exp ->\n step (EApp (ELam t e1) e2) (esubst_beta e2 e1)\n | SApp1 : #e1:exp ->\n e2:exp ->\n #e1':exp ->\n $hst:(step e1 e1') ->\n step (EApp e1 e2) (EApp e1' e2)\n | SApp2 : e1:exp ->\n #e2:exp ->\n #e2':exp ->\n $hst:(step e2 e2') ->\n step (EApp e1 e2) (EApp e1 e2')\n\n(* Typing environments *)\n\ntype a_env = nat -> Tot (option knd)\ntype x_env = nat -> Tot (option typ)\n\nval empty_a: a_env\nlet empty_a = fun _ -> None\n\nval empty_x: x_env\nlet empty_x = fun _ -> None\n\nnoeq type env =\n | MkEnv: a:a_env -> x:x_env -> env\n\nval lookup_tvar: env -> nat -> Tot (option knd)\nlet lookup_tvar g n = MkEnv?.a g n\n\nval lookup_evar: env -> nat -> Tot (option typ)\nlet lookup_evar g n = MkEnv?.x g n\n\nval empty: env\nlet empty = MkEnv empty_a empty_x\n\nval extend_tvar: g:env -> n:nat -> k:knd -> Tot env\nlet extend_tvar g n k =\n let a_env = fun (a:nat) -> if a < n then lookup_tvar g a\n else if a = n then Some k\n else lookup_tvar g (a - 1) in\n let x_env = fun (x:nat) -> match lookup_evar g x with\n | None -> None\n | Some t -> Some (tshift_up_above n t)\n in\n MkEnv a_env x_env\n\nval extend_evar: g:env -> n:nat -> t:typ -> Tot env\nlet extend_evar g n t =\n let a_env = fun (a:nat) -> lookup_tvar g a in\n let x_env = fun (x:nat) -> if x < n then lookup_evar g x\n else if x = n then Some t\n else lookup_evar g (x - 1) in\n MkEnv a_env x_env\n\n(* Kinding, type equivalence, and typing rules;\n// first 3 kinding and typing rules are analogous *)\n\nnoeq type kinding : env -> typ -> knd -> Type =\n | KiVar : #g:env ->\n a:var{Some? (lookup_tvar g a)} ->\n kinding g (TVar a) (Some?.v (lookup_tvar g a))\n | KiLam : #g:env ->\n k:knd ->\n #t:typ ->\n #k':knd ->\n $hk:kinding (extend_tvar g 0 k) t k' ->\n kinding g (TLam k t) (KArr k k')\n | KiApp : #g:env ->\n #t1:typ ->\n #t2:typ ->\n #k11:knd ->\n #k12:knd ->\n $hk1:kinding g t1 (KArr k11 k12) ->\n $hk2:kinding g t2 k11 ->\n kinding g (TApp t1 t2) k12\n | KiArr : #g:env ->\n #t1:typ ->\n #t2:typ ->\n $hk1:kinding g t1 KTyp ->\n $hk2:kinding g t2 KTyp ->\n kinding g (TArr t1 t2) KTyp\n\ntype tequiv : typ -> typ -> Type =\n | EqRefl : t:typ ->\n tequiv t t\n | EqSymm : #t1:typ ->\n #t2:typ ->\n $he:tequiv t1 t2 ->\n tequiv t2 t1\n | EqTran : #t1:typ ->\n #t2:typ ->\n #t3:typ ->\n $he12:tequiv t1 t2 ->\n $he23:tequiv t2 t3 ->\n tequiv t1 t3\n | EqLam : #t :typ ->\n #t':typ ->\n k :knd ->\n $he:tequiv t t' ->\n tequiv (TLam k t) (TLam k t')\n | EqApp : #t1 :typ ->\n #t1':typ ->\n #t2 :typ ->\n #t2':typ ->\n $he1:tequiv t1 t1' ->\n $he2:tequiv t2 t2' ->\n tequiv (TApp t1 t2) (TApp t1' t2')\n | EqBeta :k:knd ->\n t1:typ ->\n t2:typ ->\n tequiv (TApp (TLam k t1) t2) (tsubst_beta t2 t1)\n | EqArr : #t1 :typ ->\n #t1':typ ->\n #t2 :typ ->\n #t2':typ ->\n $he1:tequiv t1 t1' ->\n $he2:tequiv t2 t2' ->\n tequiv (TArr t1 t2) (TArr t1' t2')\n\nnoeq type typing : env -> exp -> typ -> Type =\n | TyVar : #g:env ->\n x:var{Some? (lookup_evar g x)} ->\n $hk:kinding g (Some?.v (lookup_evar g x)) KTyp ->\n typing g (EVar x) (Some?.v (lookup_evar g x))\n | TyLam : #g:env ->\n t:typ ->\n #e1:exp ->\n #t':typ ->\n $hk:kinding g t KTyp ->\n $ht:typing (extend_evar g 0 t) e1 t' ->\n typing g (ELam t e1) (TArr t t')\n | TyApp : #g:env ->\n #e1:exp ->\n #e2:exp ->\n #t1:typ ->\n #t2:typ ->\n $ht1:typing g e1 (TArr t1 t2) ->\n $ht2:typing g e2 t1 ->\n typing g (EApp e1 e2) t2\n | TyEqu : #g:env ->\n #e:exp ->\n #t1:typ ->\n #t2:typ ->\n $ht:typing g e t1 ->\n $he:tequiv t1 t2 ->\n $hk:kinding g t2 KTyp ->\n typing g e t2\n\n(* Progress proof *)\n\nval is_value : exp -> Tot bool\nlet is_value = ELam?\n\nirreducible val progress : #e:exp -> #t:typ -> h:typing empty e t ->\n Pure (cexists (fun e' -> step e e'))\n (requires (b2t (not (is_value e))))\n (ensures (fun _ -> True)) (decreases h)\nlet rec progress #e #t h =\n match h with\n | TyApp #g #e1 #e2 #t11 #t12 h1 h2 ->\n (match e1 with\n | ELam t e1' -> ExIntro (esubst_beta e2 e1') (SBeta t e1' e2)\n | _ -> (match progress h1 with\n | ExIntro e1' h1' -> ExIntro (EApp e1' e2) (SApp1 e2 h1')))\n (* | TyEqu h1 _ _ -> progress h1 -- used to work *)\n (* | TyEqu #g #e #t1 #t2 h1 _ _ -> progress #e #t1 h1\n// -- explicit annotation doesn't help with Pure annotation *)\n | TyEqu h1 _ _ -> progress h1\n\nval tappears_free_in : x:var -> t:typ -> Tot bool (decreases t)\nlet rec tappears_free_in x t =\n match t with\n | TVar y -> x = y\n | TArr t1 t2\n | TApp t1 t2 -> tappears_free_in x t1 || tappears_free_in x t2\n | TLam _ t1 -> tappears_free_in (x+1) t1\n\ntype envEqualT (t:typ) (g1:env) (g2:env) =\n (forall (x:var). tappears_free_in x t ==>\n lookup_tvar g1 x = lookup_tvar g2 x)\n\nirreducible val tcontext_invariance : #t:typ -> #g:env -> #k:knd ->\n h:(kinding g t k) -> g':env{envEqualT t g g'} ->\n Tot (kinding g' t k) (decreases h)\nlet rec tcontext_invariance #t #g #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (tcontext_invariance h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n | KiArr h1 h2 -> KiArr (tcontext_invariance h1 g') (tcontext_invariance h2 g')\n(* CH: this doesn't directly follow from functional extensionality,\n// because (MkEnv?.x g) and (MkEnv?.x g') are completely unrelated;\n// this is just because we pass this useless argument to kinding. *)\nirreducible val kinding_extensional: #g:env -> #t:typ -> #k:knd -> h:(kinding g t k) ->\n g':env{feq (MkEnv?.a g) (MkEnv?.a g')} ->\n Tot (kinding g' t k) (decreases h)\nlet rec kinding_extensional #g #t #k h g' =\n match h with\n | KiVar a -> KiVar a\n | KiLam k1 h1 -> KiLam k1 (kinding_extensional h1 (extend_tvar g' 0 k1))\n | KiApp h1 h2 -> KiApp (kinding_extensional h1 g') (kinding_extensional h2 g')\n | KiArr h1 h2 -> KiArr (kinding_extensional h1 g') (kinding_extensional h2 g')\n\n(* kinding weakening when a term variable binding is added to env *)\nirreducible val kinding_weakening_ebnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> t':typ ->\n Tot (kinding (extend_evar g x t') t k)\nlet kinding_weakening_ebnd #g #t #k h x t' =\n kinding_extensional h (extend_evar g x t')\n\nval tshift_up_above_lam: n:nat -> k:knd -> t:typ -> Lemma\n (ensures (tshift_up_above n (TLam k t) = TLam k (tshift_up_above (n + 1) t)))\nlet tshift_up_above_lam n k t =\n let open FStar.Tactics in\n assert(tshift_up_above n (TLam k t) = tsubst (tsub_inc_above n) (TLam k t));\n tsub_lam_hoist k t (tsub_inc_above n);\n assert(tshift_up_above n (TLam k t) =\n TLam k (tsubst (tsub_lam (tsub_inc_above n)) t));\n assert (feq (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)))\n by norm [zeta; iota; delta_only [`%tsub_lam; `%tsub_inc_above]];\n tsubst_extensional (tsub_lam (tsub_inc_above n)) (tsub_inc_above (n+1)) t\n\n(* kinding weakening when a type variable binding is added to env *)\nirreducible val kinding_weakening_tbnd : #g:env -> #t:typ -> #k:knd ->\n h:(kinding g t k) -> x:var -> k':knd ->\n Tot (kinding (extend_tvar g x k') (tshift_up_above x t) k) (decreases h)\nlet rec kinding_weakening_tbnd #g #t #k h x k' =\n match h with\n | KiVar a -> if a < x then KiVar a\n else KiVar (a + 1)\n | KiLam #g k'' #t1 #_ h1 ->\n tshift_up_above_lam x k'' t1;\n let h2 = kinding_weakening_tbnd h1 (x + 1) k' in\n KiLam k'' (kinding_extensional h2 (extend_tvar (extend_tvar g x k') 0 k''))\n | KiApp h1 h2 ->\n KiApp (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n | KiArr h1 h2 ->\n KiArr (kinding_weakening_tbnd h1 x k') (kinding_weakening_tbnd h2 x k')\n\n(* kinding strengthening from TAPL (Lemma 30.3.1),\n// just an instance of kinding_extensional; used often *)\nirreducible val kinding_strengthening_ebnd :\n g:env -> x:var -> t_x:typ -> #t:typ -> #k:knd ->\n h:(kinding (extend_evar g x t_x) t k) ->\n Tot (kinding g t k) (decreases h)", "sketch": [ "The `kinding_strengthening_ebnd` function is used to strengthen the kinding relation when a type variable binding is added to the environment. It ensures that the kinding relation for a type `t` and kind `k` in the original environment `g` is preserved when a new type variable binding is added to the environment.", "The `kinding_strengthening_ebnd` function can be implemented by using the `kinding_extensional` function to ensure that the kinding of the type in the original environment is preserved when a new type variable binding is added to the environment.\n\n```fstar\nlet kinding_strengthening_ebnd g x t_x t k h =\n kinding_extensional h (extend_evar g x t_x)\n```" ], "generated_solution": [ "let kinding_strengthening_ebnd g x t_x t k h =\n kinding_extensional h (extend_evar g x t_x)" ] }, { "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.lift_ghost_neutral", "opens_and_abbrevs": [ { "abbrev": "Act", "full_module": "PulseCore.Action" }, { "open": "PulseCore.Observability" }, { "open": "PulseCore.FractionalPermission" }, { "open": "PulseCore.InstantiatedSemantics" }, { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "A", "full_module": "PulseCore.Atomic" }, { "abbrev": "I", "full_module": "PulseCore.InstantiatedSemantics" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "Set", "full_module": "FStar.Set" }, { "abbrev": "G", "full_module": "FStar.Ghost" }, { "abbrev": "U32", "full_module": "FStar.UInt32" }, { "open": "FStar.PCM" }, { "open": "PulseCore.Observability" }, { "open": "PulseCore.FractionalPermission" }, { "open": "FStar.Ghost" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post", "source_definition": "let lift_ghost_neutral = A.lift_ghost_neutral", "source_range": { "start_line": 148, "start_col": 0, "end_line": 148, "end_col": 45 }, "interleaved": false, "definition": "PulseCore.Atomic.lift_ghost_neutral", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "PulseCore.Atomic.lift_ghost_neutral" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "e: Pulse.Lib.Core.stt_ghost a pre post -> reveal_a: Pulse.Lib.Core.non_informative_witness a\n -> Pulse.Lib.Core.stt_atomic a Pulse.Lib.Core.emp_inames pre post", "prompt": "let lift_ghost_neutral =\n ", "expected_response": "A.lift_ghost_neutral", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.Core.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.Core.fst", "checked_file": "dataset/Pulse.Lib.Core.fst.checked", "interface_file": true, "dependencies": [ "dataset/PulseCore.Observability.fst.checked", "dataset/PulseCore.InstantiatedSemantics.fsti.checked", "dataset/PulseCore.FractionalPermission.fst.checked", "dataset/PulseCore.Atomic.fsti.checked", "dataset/PulseCore.Action.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.PropositionalExtensionality.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.Sugar.fsti.checked" ] }, "definitions_in_context": [ "let double_one_half () = ()", "let equate_by_smt = ()", "let one_half =\n half_perm full_perm", "let vprop = slprop", "let emp = emp", "let op_Star_Star = op_Star_Star", "val double_one_half ()\n : Lemma (sum_perm one_half one_half == full_perm)", "let pure = pure", "let op_exists_Star = op_exists_Star", "let vprop_equiv = slprop_equiv", "let elim_vprop_equiv #p #q pf = slprop_equiv_elim p q", "let vprop_post_equiv = slprop_post_equiv", "let prop_squash_idem (p:prop)\n : Tot (squash (squash p == p))\n = FStar.PropositionalExtensionality.apply p (squash p)", "let intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\n = let pf : squash (forall x. vprop_equiv (p x) (q x)) = \n introduce forall x. vprop_equiv (p x) (q x)\n with FStar.Squash.return_squash (pf x)\n in\n coerce_eq (prop_squash_idem _) pf", "let elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n: vprop_equiv (p x) (q x)\n= let pf\n : squash (vprop_equiv (p x) (q x))\n = eliminate forall x. vprop_equiv (p x) (q x) with x\n in\n coerce_eq (prop_squash_idem _) pf", "val equate_by_smt : unit", "val vprop : Type u#2", "val emp : vprop", "let vprop_equiv_refl (v0:vprop) \n : vprop_equiv v0 v0\n = slprop_equiv_refl v0", "val ( ** ) (p q:vprop) : vprop", "val pure (p:prop) : vprop", "val ( exists* ) (#a:Type) (p:a -> vprop) : vprop", "val vprop_equiv (p q:vprop) : prop", "let vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p", "val elim_vprop_equiv (#p #q:_) (_:vprop_equiv p q) : squash (p == q)", "val vprop_post_equiv (#t:Type u#a) (p q: t -> vprop) : prop", "val intro_vprop_post_equiv\n (#t:Type u#a) \n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q", "let vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p", "val elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop) \n (pf:vprop_post_equiv p q)\n (x:t) \n : vprop_equiv (p x) (q x)", "let vprop_equiv_unit (x:vprop)\n : vprop_equiv (emp ** x) x\n = slprop_equiv_unit x", "val vprop_equiv_refl (v0:vprop) : vprop_equiv v0 v0", "let vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)\n = slprop_equiv_comm p1 p2", "val vprop_equiv_sym (v0 v1:vprop) (_:vprop_equiv v0 v1)\n : vprop_equiv v1 v0", "val vprop_equiv_trans (v0 v1 v2:vprop) (_:vprop_equiv v0 v1) (_:vprop_equiv v1 v2)\n : vprop_equiv v0 v2", "let vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv ((p1 ** p2) ** p3) (p1 ** (p2 ** p3))\n = slprop_equiv_assoc p1 p2 p3", "val vprop_equiv_unit (x:vprop) : vprop_equiv (emp ** x) x", "let vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (f: vprop_equiv p1 p3)\n (g: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)\n = slprop_equiv_elim p1 p3;\n slprop_equiv_elim p2 p4;\n vprop_equiv_refl _", "val vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)", "val vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv (p1 ** p2 ** p3) (p1 ** (p2 ** p3))", "val vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (_: vprop_equiv p1 p3)\n (_: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)", "let vprop_equiv_ext p1 p2 _ = vprop_equiv_refl p1", "val vprop_equiv_ext (p1 p2:vprop) (_:p1 == p2)\n : vprop_equiv p1 p2", "let iname = Act.iname", "let join_sub _ _ = ()", "let join_emp is =\n Set.lemma_equal_intro (join_inames is emp_inames) (reveal is);\n Set.lemma_equal_intro (join_inames emp_inames is) (reveal is)", "let inv = Act.inv", "val iname : eqtype", "let name_of_inv = Act.name_of_inv", "let inames = erased (FStar.Set.set iname)", "let emp_inames : inames = Ghost.hide Set.empty", "let add_already_there i is = Set.lemma_equal_intro (add_inv is i) is", "let join_inames (is1 is2 : inames) : inames =\n Set.union is1 is2", "let inames_subset (is1 is2 : inames) : Type0 =\n Set.subset is1 is2", "let stt = I.stt", "let return_stt_noeq = I.return", "let bind_stt = I.bind", "let (/!) (is1 is2 : inames) : Type0 =\n Set.disjoint is1 is2", "let frame_stt = I.frame", "let par_stt = I.par", "let sub_stt = I.sub", "val inv (p:vprop) : Type u#0", "let conv_stt pf1 pf2 = I.conv #_ _ _ _ _ pf1 pf2", "let hide_div = I.hide_div", "val name_of_inv #p (i : inv p) : GTot iname", "let mem_iname (e:inames) (i:iname) : erased bool = elift2 (fun e i -> Set.mem i e) e i", "let mem_inv (#p:vprop) (e:inames) (i:inv p) : erased bool = mem_iname e (name_of_inv i)", "let stt_atomic a #obs inames pre post = A.stt_atomic a #obs inames pre post", "let add_iname (e:inames) (i:iname) : inames = Set.union (Set.singleton i) (reveal e)", "let lift_observability = A.lift_observability", "let add_inv (#p:vprop) (e:inames) (i:inv p) : inames = add_iname e (name_of_inv i)", "let return_neutral = A.return_atomic", "let remove_inv (#p:vprop) (e:inames) (i:inv p) : inames = Set.remove (name_of_inv i) e", "let return_neutral_noeq = A.return_atomic_noeq", "let all_inames : inames = Set.complement Set.empty", "let bind_atomic = A.bind_atomic", "let inv_disjointness_remove_i_i (#p:vprop) (e:inames) (i:inv p)\n: Lemma (not (mem_inv (remove_inv e i) i))\n= ()", "let frame_atomic = A.frame_atomic", "let sub_atomic = A.sub_atomic", "let sub_invs_atomic = A.sub_invs_stt_atomic", "let lift_atomic0 = A.lift_atomic0", "let lift_atomic1 = A.lift_atomic1", "val add_already_there #p (i : inv p) (is : inames)\n : Lemma (requires Set.mem (name_of_inv i) is)\n (ensures add_inv is i == is)\n [SMTPat (add_inv is i)]", "let lift_atomic2 = A.lift_atomic2", "let new_invariant = A.new_invariant", "let with_invariant = A.with_invariant", "let stt_ghost = A.stt_ghost", "let bind_ghost = A.bind_ghost" ], "closest": [ "val lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\nlet lift_neutral_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #Neutral emp_inames pre post)\r\n: stt_ghost a pre post\r\n= Ghost.hide e", "val lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic0\r\n (#a:Type u#0)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift0 e", "val lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic1\r\n (#a:Type u#1)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift1 e", "val lift_ghost_unobservable (#pre #post: _) (f: stt_ghost unit pre post)\n : stt_atomic unit #Unobservable emp_inames pre post\nlet lift_ghost_unobservable #pre #post (f:stt_ghost unit pre post) \n : stt_atomic unit #Unobservable emp_inames pre post\n = lift_observability #_ #_ #Unobservable (lift_ghost_neutral f unit_non_informative)", "val lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\nlet lift_atomic2\r\n (#a:Type u#2)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt a pre post\r\n= A.lift2 e", "val bind_ghost\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_ghost a pre1 post1)\r\n (e2:(x:a -> stt_ghost b (post1 x) post2))\r\n: stt_ghost b pre1 post2\nlet bind_ghost\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_ghost a pre1 post1)\r\n (e2:(x:a -> stt_ghost b (post1 x) post2))\r\n: stt_ghost b pre1 post2\r\n= let e1 = Ghost.reveal e1 in\r\n let e2 = FStar.Ghost.Pull.pull (fun (x:a) -> Ghost.reveal (e2 x)) in\r\n Ghost.hide (A.bind e1 e2)", "val lift_ghost_atomic\n (a:Type)\n (opened:inames)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:pure_pre)\n (#[@@@ framing_implicit] ens:pure_post a)\n (f:STAG.repr a framed opened Unobservable pre post req ens)\n : STAG.repr a framed opened Unobservable pre post req ens\nlet lift_ghost_atomic\n (a:Type)\n (opened:inames)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:Type0)\n (#[@@@ framing_implicit] ens:a -> Type0)\n (f:STAG.repr a framed opened Unobservable pre post req ens)\n : STAG.repr a framed opened Unobservable pre post req ens\n = f", "val lift_observability \r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e1:stt_atomic a #obs opens pre post)\r\n: stt_atomic a #(join_obs obs obs') opens pre post\nlet lift_observability\r\n (#a:Type u#a)\r\n (#obs #obs':_)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n= e", "val lift_ghost_atomic\n (a:Type)\n (opened:inames)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:req_t pre) (#[@@@ framing_implicit] ens:ens_t pre a post)\n (f:repr a framed opened Unobservable pre post req ens)\n : repr a framed opened Unobservable pre post req ens\nlet lift_ghost_atomic a o f = f", "val frame_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_ghost a pre post)\r\n: stt_ghost a (pre ** frame) (fun x -> post x ** frame)\nlet frame_ghost\r\n (#a:Type u#a)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_ghost a pre post)\r\n: stt_ghost a (pre ** frame) (fun x -> post x ** frame)\r\n= Ghost.hide (A.frame (Ghost.reveal e))", "val sub_ghost\r\n (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_ghost a pre1 post1)\r\n: stt_ghost a pre2 post2\nlet sub_ghost pre2 post2 pf1 pf2 e\r\n= Ghost.hide (A.sub pre2 post2 e)", "val coerce_ghost (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a false o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a false o Unobservable p q pre post\nlet coerce_ghost (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a false o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a false o Unobservable p q pre post\n = STG.STGhostBase?.reflect (SA.reify_steel_ghost_comp f)", "val stt_ghost\r\n (a:Type u#a)\r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type u#(max 2 a)\nlet stt_ghost a pre post = Ghost.erased (act a emp_inames pre post)", "val hide_ghost (#a #pre #post: _) (f: stt_ghost a pre post)\n : stt_ghost (erased a) pre (fun x -> post (reveal x))\nlet hide_ghost #a #pre #post \r\n (f:stt_ghost a pre post)\r\n: stt_ghost (erased a) pre (fun x -> post (reveal x))\r\n= let f = Ghost.reveal f in\r\n Ghost.hide <|\r\n A.bind f\r\n (fun (r:a) ->\r\n A.return #(erased a) #(fun (x:erased a) -> post (reveal x))\r\n (hide r))", "val perform_ghost\n (#a #pre #post : _)\n (f : unit -> stt_ghost a pre post)\n : stt_ghost a pre post\nlet perform_ghost f = f ()", "val coerce_ghostF (#a:Type)\n (#o:inames)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelGhostBase a true o Unobservable p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STG.STGhostBase a true o Unobservable p q pre post\nlet coerce_ghostF #a #o #p #q #pre #post f\n = STGhostBase?.reflect (SA.reify_steel_ghost_comp f)", "val lift_ghost_atomic (#g: env) (#e: st_term) (#c: comp_st{C_STGhost? c}) (d: st_typing g e c)\n : T.Tac (st_typing g e (st_ghost_as_atomic c))\nlet lift_ghost_atomic (#g:env) (#e:st_term) (#c:comp_st { C_STGhost? c }) (d:st_typing g e c)\n: T.Tac (st_typing g e (st_ghost_as_atomic c))\n= let w = try_lift_ghost_atomic d in\n match w with\n | None -> \n let open Pulse.PP in\n let t = comp_res c in\n fail_doc g (Some t.range) [\n text \"Expected a term with a non-informative (e.g., erased) type; got\"\n ^/^ pp t\n ]\n | Some d ->\n d", "val stt_atomic\r\n (a:Type u#a)\r\n (#obs:observability)\r\n (opens:inames)\r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type u#(max 2 a)\nlet stt_atomic a #obs opens pre post =\r\n A.act a opens pre post", "val with_invlist_ghost (#pre : vprop) (#post : vprop)\n (is : invlist)\n (f : unit -> stt_ghost unit (invlist_v is ** pre) (fun _ -> invlist_v is ** post))\n : stt_atomic unit #Unobservable (invlist_names is) pre (fun _ -> post)\nlet with_invlist_ghost = __with_invlist_ghost", "val bind_atomic\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#obs1:_)\r\n (#obs2:observability { at_most_one_observable obs1 obs2 })\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_atomic a #obs1 opens pre1 post1)\r\n (e2:(x:a -> stt_atomic b #obs2 opens (post1 x) post2))\r\n: stt_atomic b #(join_obs obs1 obs2) opens pre1 post2\nlet bind_atomic\r\n (#a:Type u#a)\r\n (#b:Type u#b)\r\n (#obs1:_)\r\n (#obs2:observability { at_most_one_observable obs1 obs2 })\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (#post1:a -> slprop)\r\n (#post2:b -> slprop)\r\n (e1:stt_atomic a #obs1 opens pre1 post1)\r\n (e2:(x:a -> stt_atomic b #obs2 opens (post1 x) post2))\r\n= A.bind e1 e2", "val ghost_witness_exists (a:Type u#0) :\n stt_ghost a (pure (exists (x:a). True)) (fun _ -> emp)\nlet ghost_witness_exists = __ghost_witness_exists", "val frame_atomic\r\n (#a:Type u#a)\r\n (#obs: observability)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt_atomic a #obs opens (pre ** frame) (fun x -> post x ** frame)\nlet frame_atomic\r\n (#a:Type u#a)\r\n (#obs: observability)\r\n (#opens:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (frame:slprop)\r\n (e:stt_atomic a #obs opens pre post)\r\n: stt_atomic a #obs opens (pre ** frame) (fun x -> post x ** frame)\r\n= A.frame e", "val witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : STAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n = coerce_atomic (witness' r fact v pf)", "val sub_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_atomic a #obs opens pre1 post1)\r\n: stt_atomic a #obs opens pre2 post2\nlet sub_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens:inames)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1 : slprop_equiv pre1 pre2)\r\n (pf2 : slprop_post_equiv post1 post2)\r\n (e:stt_atomic a #obs opens pre1 post1)\r\n: stt_atomic a #obs opens pre2 post2\r\n= A.sub pre2 post2 e", "val lift_atomic_st\n (a:Type)\n (o:eqtype_as_type observability)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:pure_pre)\n (#[@@@ framing_implicit] ens:pure_post a)\n (f:repr a framed Set.empty o pre post req ens)\n : Steel.ST.Effect.repr a framed pre post req ens\nlet lift_atomic_st\n (a:Type)\n (o:eqtype_as_type observability)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:Type0)\n (#[@@@ framing_implicit] ens:a -> Type0)\n (f:repr a framed Set.empty o pre post req ens)\n : Steel.ST.Effect.repr a framed pre post req ens\n = let ff : Steel.Effect.repr a framed pre post (fun _ -> req) (fun _ x _ -> ens x)\n = SEA.lift_atomic_steel a o #framed #pre #post #(fun _ -> req) #(fun _ x _ -> ens x) f\n in\n ff", "val ghost_witness (a:Type u#0) (_:squash a) :\n stt_ghost a emp (fun _ -> emp)\nlet ghost_witness = __ghost_witness", "val lift_exists (#a:_)\n (#u:_)\n (p:a -> vprop)\n : STGhostT unit u\n (exists_ p)\n (fun _a -> exists_ #(U.raise_t a) (U.lift_dom p))\nlet lift_exists (#a:_) (#u:_) (p:a -> vprop)\n = coerce_ghost (fun _ -> SEA.lift_exists #a #u p)", "val ghost_witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n: stt_ghost\r\n (ghost_witnessed r fact)\r\n (ghost_pts_to r v)\r\n (fun _ -> ghost_pts_to r v)\nlet ghost_witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n= Ghost.hide (A.witness r fact v pf)", "val sub_invs_stt_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens1 #opens2:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens1 pre post)\r\n (_ : squash (inames_subset opens1 opens2))\r\n: stt_atomic a #obs opens2 pre post\nlet sub_invs_stt_atomic\r\n (#a:Type u#a)\r\n (#obs:_)\r\n (#opens1 #opens2:inames)\r\n (#pre:slprop)\r\n (#post:a -> slprop)\r\n (e:stt_atomic a #obs opens1 pre post)\r\n (_ : squash (inames_subset opens1 opens2))\r\n: stt_atomic a #obs opens2 pre post\r\n= assert (Set.equal (Set.union opens1 opens2) opens2);\r\n A.weaken opens2 e", "val Pulse.Reflection.Util.mk_lift_ghost_neutral = \n u328: FStar.Stubs.Reflection.Types.universe ->\n a: FStar.Stubs.Reflection.Types.term ->\n pre: FStar.Stubs.Reflection.Types.term ->\n post: FStar.Stubs.Reflection.Types.term ->\n e: FStar.Stubs.Reflection.Types.term ->\n reveal_a: FStar.Stubs.Reflection.Types.term\n -> FStar.Stubs.Reflection.Types.term\nlet mk_lift_ghost_neutral (u:R.universe) (a pre post e reveal_a:R.term) =\n let open R in\n let lid = mk_pulse_lib_core_lid \"lift_ghost_neutral\" in\n let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in\n let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in\n pack_ln (R.Tv_App t (reveal_a, Q_Explicit))", "val return_atomic' (#a x post: _)\n : stt_atomic a\n #Unobservable\n emp_inames\n (post x ** pure (x == x))\n (fun r -> post r ** pure (r == x))\nlet return_atomic' #a x post\r\n: stt_atomic a #Unobservable emp_inames\r\n (post x ** pure (x == x))\r\n (fun r -> post r ** pure (r == x))\r\n= A.return #a #(fun r -> post r ** pure (r == x)) x", "val coerce_atomic (#a:Type)\n (#o:inames)\n (#obs:observability)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelAtomicBase a false o obs p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STA.STAtomicBase a false o obs p q pre post\nlet coerce_atomic #a #o #obs\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelAtomicBase a false o obs p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STA.STAtomicBase a false o obs p q pre post\n = STA.STAtomicBase?.reflect (SA.reify_steel_atomic_comp f)", "val witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : STAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n = coerce_atomic (witness' r fact v pf)", "val ghost_witness2 (a:Type u#2) (_:squash a) :\n stt_ghost a emp (fun _ -> emp)\nlet ghost_witness2 = __ghost_witness2", "val ghost_recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:ghost_ref pcm)\r\n (v:Ghost.erased a)\r\n (w:ghost_witnessed r fact)\r\n: stt_ghost (v1:Ghost.erased a{compatible pcm v v1})\r\n (ghost_pts_to r v)\r\n (fun v1 -> ghost_pts_to r v ** pure (fact v1))\nlet ghost_recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:ghost_ref pcm)\r\n (v:Ghost.erased a)\r\n (w:ghost_witnessed r fact)\r\n= Ghost.hide (A.recall r v w)", "val ghost_witnessed\r\n (#a:Type u#1)\r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n: Type0\nlet ghost_witnessed \r\n (#a:Type u#1) \r\n (#p:pcm a)\r\n (r:ghost_ref p)\r\n (f:property a)\r\n= witnessed (reveal r) f", "val recall (#inames: _)\n (#a:Type u#0)\n (#q:perm)\n (#p:Preorder.preorder a)\n (fact:property a)\n (r:ref a p)\n (v:erased a)\n (w:witnessed r fact)\n : STAtomicU unit inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n (requires True)\n (ensures fun _ -> fact v)\nlet recall (#inames: _)\n (#a:Type u#0)\n (#q:perm)\n (#p:Preorder.preorder a)\n (fact:property a)\n (r:ref a p)\n (v:erased a)\n (w:witnessed r fact)\n = coerce_atomic (fun _ -> MR.recall #inames #a #q #p fact r v w)", "val lift_ghost_to_atomic (g: env) (e: st_term) (c: comp_st{C_STGhost? c}) (d: st_typing g e c)\n : TacS (c': comp_st & st_typing g e c')\n (requires True)\n (ensures\n fun (| c' , _ |) ->\n st_comp_of_comp c' == st_comp_of_comp c /\\ ctag_of_comp_st c' == STT_Atomic /\\\n tm_emp_inames == C_STAtomic?.inames c')\nlet lift_ghost_to_atomic\n (g : env)\n (e : st_term)\n (c : comp_st{C_STGhost? c})\n (d : st_typing g e c)\n : TacS (c':comp_st & st_typing g e c')\n (requires True)\n (ensures fun (| c', _ |) ->\n st_comp_of_comp c' == st_comp_of_comp c /\\\n ctag_of_comp_st c' == STT_Atomic /\\\n tm_emp_inames == C_STAtomic?.inames c')\n= let C_STGhost c_st = c in\n let w : non_informative_c g c = get_non_informative_witness g (comp_u c) (comp_res c) in\n FStar.Tactics.BreakVC.break_vc(); // somehow this proof is unstable, this helps\n let c' = C_STAtomic tm_emp_inames Neutral c_st in\n let d' : st_typing g e c' =\n T_Lift g e c c' d (Lift_Ghost_Neutral g c w)\n in\n assert (st_comp_of_comp c' == st_comp_of_comp c);\n assert (ctag_of_comp_st c' == STT_Atomic);\n assert (tm_emp_inames == C_STAtomic?.inames c');\n (| c', d' |)", "val ghost_witness_exists2 (a:Type u#2) :\n stt_ghost a (pure (exists (x:a). True)) (fun _ -> emp)\nlet ghost_witness_exists2 = __ghost_witness_exists2", "val return_atomic\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_atomic a #Neutral emp_inames (p x) (fun r -> p r ** pure (r == x))\nlet return_atomic #a x post\r\n: stt_atomic a #Neutral emp_inames\r\n (post x)\r\n (fun r -> post r ** pure (r == x))\r\n= emp_unit_r (post x);\r\n pure_trivial (x == x) ();\r\n coerce_eq () (return_atomic' #a x post)", "val lift (#a:Type u#100) #opens (#pre:slprop) (#post:a -> slprop)\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift (#a:Type u#100) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action (m #emp_inames)", "val recall (#inames: _)\n (#a:Type u#0)\n (#q:perm)\n (#p:Preorder.preorder a)\n (fact:property a)\n (r:erased (ref a p))\n (v:erased a)\n (w:witnessed r fact)\n : STAtomicU unit inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n (requires True)\n (ensures fun _ -> fact v)\nlet recall (#inames: _)\n (#a:Type u#0)\n (#q:perm)\n (#p:Preorder.preorder a)\n (fact:property a)\n (r:erased (ref a p))\n (v:erased a)\n (w:witnessed r fact)\n = coerce_atomic (fun _ -> MR.recall #inames #a #q #p fact r v w)", "val recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:erased (ref a pcm))\r\n (v:Ghost.erased a)\r\n (w:witnessed r fact)\r\n: stt_ghost (v1:Ghost.erased a{compatible pcm v v1})\r\n (pts_to r v)\r\n (fun v1 -> pts_to r v ** pure (fact v1))\nlet recall #a #pcm #fact r v w = Ghost.hide (A.recall r v w)", "val return_atomic_noeq\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_atomic a #Neutral emp_inames (p x) p\nlet return_atomic_noeq #a x post = A.return #a #post x", "val fix_stt_ghost_1 (#a : Type) (#b : a -> Type) (#pre : a -> vprop) (#post : (x:a -> b x -> vprop))\n (ff : (x:a -> (y:a{y << x} -> stt_ghost (b y) (pre y) (post y)) -> stt_ghost (b x) (pre x) (post x)))\n : x:a -> stt_ghost (b x) (pre x) (post x)\nlet fix_stt_ghost_1 (#a : Type) (#b : a -> Type) (#pre : a -> vprop) (#post : (x:a -> b x -> vprop))\n (ff : (x:a -> (y:a{y << x} -> stt_ghost (b y) (pre y) (post y)) -> stt_ghost (b x) (pre x) (post x)))\n : x:a -> stt_ghost (b x) (pre x) (post x)\n = fix_1 #a #(fun x -> stt_ghost (b x) (pre x) (post x)) ff", "val witness\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:erased (ref a pcm))\r\n (fact:stable_property pcm)\r\n (v:Ghost.erased a)\r\n (pf:squash (forall z. compatible pcm v z ==> fact z))\r\n: stt_ghost\r\n (witnessed r fact)\r\n (pts_to r v)\r\n (fun _ -> pts_to r v)\nlet witness #a #pcm r f v pf = Ghost.hide (A.witness r f v pf)", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:Ghost.erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let h = witness_exists #_ #_ #(pts_to_body r q v) () in\n let _ = elim_pure #_ #_ #_ #q r v h in\n\n assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');\n lift_fact_is_stable #a #p fact;\n\n let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () _ in\n\n rewrite_slprop (PR.pts_to r h) (pts_to_body r q v h) (fun m ->\n emp_unit (M.pts_to r h);\n pure_star_interp (M.pts_to r h) (history_val h v q) m);\n\n intro_exists_erased h (pts_to_body r q v);\n return w", "val try_lift_ghost_atomic (#g: env) (#e: st_term) (#c: comp_st{C_STGhost? c}) (d: st_typing g e c)\n : T.Tac (option (st_typing g e (st_ghost_as_atomic c)))\nlet try_lift_ghost_atomic (#g:env) (#e:st_term) (#c:comp_st { C_STGhost? c }) (d:st_typing g e c)\n: T.Tac (option (st_typing g e (st_ghost_as_atomic c)))\n= let w = try_get_non_informative_witness g (comp_u c) (comp_res c) in\n match w with\n | None -> None\n | Some w ->\n let d = T_Lift _ _ _ _ d (Lift_Ghost_Neutral _ c w) in\n Some d", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n = MHR.witness r (lift_property fact) (hide (U.raise_val (reveal v))) ()", "val coerce_atomicF (#a:Type)\n (#o:inames)\n (#obs:observability)\n (#p:vprop)\n (#q:a -> vprop)\n (#pre:Type0)\n (#post: a -> Type0)\n ($f:unit -> SA.SteelAtomicBase a true o obs p q\n (fun _ -> pre)\n (fun _ x _ -> post x))\n : STA.STAtomicBase a true o obs p q pre post\nlet coerce_atomicF #a #o #p #q #pre #post f\n = STA.STAtomicBase?.reflect (SA.reify_steel_atomic_comp f)", "val bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\nlet bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\r\n= fun _ -> Sem.mbind (e1()) (fun x -> e2 x ())", "val return_ghost_noeq\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_ghost a (p x) p\nlet return_ghost_noeq #a x p = Ghost.hide (A.return #_ #p x)", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let w = MHR.witness r (lift_property fact) (U.raise_val (reveal v)) () in\n return w", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val return_ghost\r\n (#a:Type u#a)\r\n (x:a)\r\n (p:a -> slprop)\r\n: stt_ghost a (p x) (fun r -> p r ** pure (r == x))\nlet return_ghost #a x p = Ghost.hide (return_atomic #a x p)", "val witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a) (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness (#inames: _) (#a:Type) (#q:perm) (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (_:squash (fact v))\n : SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = let h = witness_exists #_ #_ #(pts_to_body r q v) () in\n let _ = elim_pure #_ #_ #_ #q r v h in\n\n assert (forall h'. compatible pcm_history h h' ==> lift_fact fact h');\n lift_fact_is_stable #a #p fact;\n\n let w = witness_thunk #_ #_ #(pcm_history #a #p) r (lift_fact fact) h () () in\n\n \n intro_pure_full r v h;\n rewrite_slprop (pts_to _ q _) (pts_to r q v) (fun _ -> ());\n return w", "val elim_forall\n (#a:Type)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* x. p x)\n (fun _ -> p x)\nlet elim_forall\n (#a:Type u#a)\n (#p:a->vprop)\n (x:a)\n: stt_ghost unit\n (forall* (x:a). p x)\n (fun _ -> p x)\n= let m1 = elim_exists #vprop (fun (v:vprop) -> pure (is_forall v p) ** token v) in\n let m2 (v:Ghost.erased vprop)\n : stt_ghost unit \n (pure (is_forall v p) ** token v)\n (fun _ -> p x)\n = bind_ghost\n (frame_ghost \n (token v)\n (elim_pure_explicit (is_forall v p)))\n (fun (pf:squash (is_forall v p)) ->\n let f = extract_q v p pf in\n sub_ghost (emp ** Ghost.reveal v)\n (fun _ -> p x)\n (vprop_equiv_sym _ _ (vprop_equiv_unit _))\n (intro_vprop_post_equiv \n (fun _ -> p x)\n (fun _ -> p x)\n (fun _ -> vprop_equiv_refl (p x)))\n (f x))\n in\n bind_ghost m1 m2", "val Pulse.Reflection.Util.mk_lift_neutral_ghost = \n u338: FStar.Stubs.Reflection.Types.universe ->\n a: FStar.Stubs.Reflection.Types.term ->\n pre: FStar.Stubs.Reflection.Types.term ->\n post: FStar.Stubs.Reflection.Types.term ->\n e: FStar.Stubs.Reflection.Types.term\n -> FStar.Stubs.Reflection.Types.term\nlet mk_lift_neutral_ghost (u:R.universe) (a pre post e:R.term) =\n let open R in\n let lid = mk_pulse_lib_core_lid \"lift_neutral_ghost\" in\n let t = pack_ln (R.Tv_UInst (R.pack_fv lid) [u]) in\n let t = pack_ln (R.Tv_App t (a, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (pre, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (post, Q_Implicit)) in\n let t = pack_ln (R.Tv_App t (e, Q_Explicit)) in\n t", "val write\r\n (#a:Type)\r\n (#p:pcm a)\r\n (r:ref a p)\r\n (x y:Ghost.erased a)\r\n (f:FStar.PCM.frame_preserving_upd p x y)\r\n: stt_atomic unit\r\n #Observable\r\n emp_inames\r\n (pts_to r x)\r\n (fun _ -> pts_to r y)\nlet write = A.write", "val witness (#inames: _) (#a:Type) (#pcm:pcm a)\n (r:ref a pcm)\n (fact:stable_property pcm)\n (v:erased a)\n (_:fact_valid_compat fact v)\n : STAtomicUT (witnessed r fact) inames (pts_to r v)\n (fun _ -> pts_to r v)\nlet witness r fact v vc = C.coerce_atomic (witness' r fact v vc)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : STGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = coerce_ghost (fun _ -> MR.share r f v)", "val lift0 (#a:Type u#0) #opens #pre #post\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift0 (#a:Type u#0) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action0 (m #emp_inames)", "val lift1 (#a:Type u#1) #opens #pre #post\r\n (m:act a opens pre post)\r\n: I.stt a pre post\nlet lift1 (#a:Type u#1) #opens #pre #post\r\n (m:act a opens pre post)\r\n: stt a pre post\r\n= stt_of_action1 (m #emp_inames)", "val witness (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (fact:Steel.Preorder.stable_property pcm)\n (v:erased a)\n (_:squash (Steel.Preorder.fact_valid_compat fact v))\n : SteelAtomicUT (witnessed r fact) o\n (pts_to r v)\n (fun _ -> pts_to r v)\nlet witness (#o:inames)\n (#a:Type)\n (#pcm:pcm a)\n (r:ref a pcm)\n (fact:Steel.Preorder.stable_property pcm)\n (v:erased a)\n (_:squash (Steel.Preorder.fact_valid_compat fact v))\n = P.witness r fact v ()", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val witness':\n #inames: _ ->\n #a: Type ->\n #q: perm ->\n #p: Preorder.preorder a ->\n r: ref a p ->\n fact: stable_property p ->\n v: erased a ->\n pf: squash (fact v) ->\n unit\n -> Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact)\n inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness' (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n (_:unit)\n : Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = MR.witness #inames #a #q #p r fact v pf", "val ghost_alloc (#a:Type0) (#opened:inames) (x:Ghost.erased a)\n : SteelGhost (ghost_ref a) opened\n emp (fun r -> ghost_vptr r)\n (requires fun _ -> True)\n (ensures fun _ r h1 -> ghost_sel r h1 == Ghost.reveal x)\nlet ghost_alloc x =\n let r = ghost_alloc_pt x in\n intro_ghost_vptr r _ x;\n r", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:Ghost.erased a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.split r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (hide (U.raise_val (reveal v)))", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val as_atomic_action_ghost (#a:Type u#a)\n (#opened_invariants:inames)\n (#fp:slprop)\n (#fp': a -> slprop)\n (f:action_except a opened_invariants fp fp')\n : SteelGhostT a opened_invariants (to_vprop fp) (fun x -> to_vprop (fp' x))\nlet as_atomic_action_ghost f = SteelGhost?.reflect f", "val ghost_reveal (a:Type) (x:erased a)\r\n : stt_ghost a emp (fun y -> pure (reveal x == y))\nlet ghost_reveal (a:Type) (x:erased a)\r\n: stt_ghost a emp (fun y -> pure (reveal x == y))\r\n= let m\r\n : stt_ghost a\r\n (pure (reveal x == reveal x))\r\n (fun y -> pure (reveal x == y))\r\n = Ghost.hide (A.return #_ #(fun y -> pure (reveal x == y)) (reveal x))\r\n in\r\n pure_trivial (reveal x == reveal x) ();\r\n m", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\nlet stt (a:Type u#a) \r\n (pre:slprop)\r\n (post:a -> slprop)\r\n: Type0\r\n= lower (Sem.m u#2 u#100 u#a #state a pre (F.on_dom a post))", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read_pt r) in\n return u", "val read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun x -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\nlet read (#a:Type)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : ST a\n (pts_to r p v)\n (fun _ -> pts_to r p v)\n (requires True)\n (ensures fun x -> x == Ghost.reveal v)\n = let u = coerce_steel (fun _ -> R.read r) in\n return u", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\nlet sub (#a:Type u#a)\r\n (#pre1:slprop)\r\n (pre2:slprop)\r\n (#post1:a -> slprop)\r\n (post2:a -> slprop)\r\n (pf1:slprop_equiv pre1 pre2)\r\n (pf2:slprop_post_equiv post1 post2)\r\n (e:stt a pre1 post1)\r\n: stt a pre2 post2\r\n= coerce_eq (conv pre1 pre2 post1 post2 pf1 pf2) e", "val with_invlist (#a:Type0) (#pre : vprop) (#post : a -> vprop)\n (is : invlist)\n (f : unit -> stt_atomic a #Unobservable emp_inames (invlist_v is ** pre) (fun v -> invlist_v is ** post v))\n : stt_atomic a #Unobservable (invlist_names is) pre (fun v -> post v)\nlet with_invlist = __with_invlist", "val free (#a: e_alg)\n : (let a = Ghost.reveal a in\n s: state a\n -> ST unit\n (requires fun h0 -> freeable h0 s /\\ invariant s h0)\n (ensures fun h0 _ h1 -> let open M in modifies (footprint s h0) h0 h1))\nlet free: #a:e_alg -> (\n let a = Ghost.reveal a in\n s:state a -> ST unit\n (requires fun h0 ->\n freeable h0 s /\\\n invariant s h0)\n (ensures fun h0 _ h1 ->\n M.(modifies (footprint s h0) h0 h1)))\n = free_", "val admit_ (#a:Type)\n (#opened:inames)\n (#p:pre_t)\n (#q:post_t a)\n (_:unit)\n : STGhostF a opened p q True (fun _ -> False)\nlet admit_ _ = STGhostF?.reflect (fun _ -> NMSTTotal.nmst_tot_admit ())", "val lift_atomic_steel\n (a:Type)\n (o:eqtype_as_type observability)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t) (#[@@@ framing_implicit] post:post_t a)\n (#[@@@ framing_implicit] req:req_t pre) (#[@@@ framing_implicit] ens:ens_t pre a post)\n (f:repr a framed Set.empty o pre post req ens)\n : Steel.Effect.repr a framed pre post req ens\nlet lift_atomic_steel a o f = f", "val witness':\n #inames: _ ->\n #a: Type ->\n #q: perm ->\n #p: Preorder.preorder a ->\n r: erased (ref a p) ->\n fact: stable_property p ->\n v: erased a ->\n pf: squash (fact v) ->\n unit\n -> Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact)\n inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\nlet witness' (#inames: _)\n (#a:Type)\n (#q:perm)\n (#p:Preorder.preorder a)\n (r:erased (ref a p))\n (fact:stable_property p)\n (v:erased a)\n (pf:squash (fact v))\n (_:unit)\n : Steel.Effect.Atomic.SteelAtomicUT (witnessed r fact) inames\n (pts_to r q v)\n (fun _ -> pts_to r q v)\n = MR.witness #inames #a #q #p r fact v pf", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = MHR.share r f (U.raise_val v)", "val share (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f:perm)\n (v:a)\n : SteelGhostT unit inames\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\nlet share #o (#a:Type) (#p:Preorder.preorder a) (r:ref a p) (f:perm) (v:a)\n : SteelGhostT unit o\n (pts_to r f v)\n (fun _ -> pts_to r (half_perm f) v `star` pts_to r (half_perm f) v)\n = let open Steel.Effect.Atomic in\n elim_pts_to r f v;\n let h : erased (history a p) = witness_exists () in\n elim_pure _;\n let sh = split_current h in\n PR.share r h sh sh;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v;\n intro_pure (history_val sh v (half_perm f));\n intro_exists #(history a p) sh (pts_to_body r (half_perm f) v);\n intro_pts_to r (half_perm f) v", "val atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a)\n (r:ref a)\n : SteelAtomic a opened\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires fun h -> True)\n (ensures fun _ x _ -> x == Ghost.reveal v)\nlet atomic_read (#opened:_) (#a:Type) (#p:perm) (#v:erased a) (r:ref a)\n = let v1 : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop (pts_to r p v) (RP.pts_to r v1 `star` pure (perm_ok p)) (fun _ -> ());\n elim_pure (perm_ok p);\n\n let v2 = RP.atomic_read r v1 in\n rewrite_slprop (RP.pts_to r v1) (pts_to r p v)\n (fun m ->\n emp_unit (hp_of (pts_to_raw r p v));\n pure_star_interp (hp_of (pts_to_raw r p v)) (perm_ok p) m);\n assert (compatible pcm_frac v1 v2);\n let Some (x, _) = v2 in\n rewrite_slprop (pts_to r p v) (pts_to r p x) (fun _ -> ());\n return x", "val recall (#inames: _) (#a:Type u#0) (#q:perm) (#p:Preorder.preorder a)\n (fact:property a)\n (r:ref a p) \n (v:erased a)\n (w:witnessed r fact)\n : SteelAtomicU unit inames (pts_to r q v)\n (fun _ -> pts_to r q v)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> fact v)\nlet recall (#inames: _)\n (#a:Type u#0)\n (#q:perm)\n (#p:Preorder.preorder a)\n (fact:property a)\n (r:ref a p)\n (v:erased a)\n (w:witnessed r fact)\n : SteelAtomicU unit inames (pts_to r q v)\n (fun _ -> pts_to r q v)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> fact v)\n = MHR.recall (lift_property fact) r (U.raise_val (reveal v)) w", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val elim_exists (#a:Type)\n (#opened_invariants:_)\n (#p:a -> vprop)\n (_:unit)\n : STGhostT (Ghost.erased a) opened_invariants\n (exists_ p)\n (fun x -> p x)\nlet elim_exists #a #o #p _\n = coerce_ghost (fun _ -> SEA.witness_exists #a #o #p ())", "val with_invariant_g (#a:Type)\n (#fp:vprop)\n (#fp':a -> vprop)\n (#opened_invariants:inames)\n (#p:vprop)\n (i:inv p{not (mem_inv opened_invariants i)})\n ($f:unit -> STGhostT a (add_inv opened_invariants i)\n (p `star` fp)\n (fun x -> p `star` fp' x))\n : STAtomicUT (erased a) opened_invariants fp (fun x -> fp' x)\nlet with_invariant_g (#a:Type)\n (#fp:vprop)\n (#fp':a -> vprop)\n (#opened_invariants:inames)\n (#p:vprop)\n (i:inv p{not (mem_inv opened_invariants i)})\n ($f:unit -> STGhostT a (add_inv opened_invariants i)\n (p `star` fp)\n (fun x -> p `star` fp' x))\n = let f (x:unit)\n : SEA.SteelGhostT a (add_inv opened_invariants i)\n (p `star` fp)\n (fun x -> p `star` fp' x) \n = f () in\n coerce_atomic (fun _ -> SEA.with_invariant_g i f)", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n : Type0\n = MR.witnessed r fact", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n = MHR.witnessed r (lift_property fact)", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n = MHR.witnessed r (lift_property fact)", "val witnessed (#a:Type u#0) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed (#a:Type u#0)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (fact:property a)\n : Type0\n = MR.witnessed r fact", "val repr (a:Type u#a) //result type\n (already_framed:bool) //framed or not\n (opened_invariants:inames) //which invariants are we relying on\n (g:observability) //is this a ghost computation?\n (pre:pre_t) //expects vprop\n (post:post_t a) //provides a -> vprop\n (req:pure_pre) //a prop refinement as a precondition\n (ens:pure_post a) //an (a -> prop) as a postcondition\n : Type u#(max a 2)\nlet repr (a:Type u#a)\n (already_framed:bool)\n (opened_invariants:inames)\n (g:observability)\n (pre:pre_t)\n (post:post_t a)\n (req:Type0)\n (ens:a -> Type0)\n : Type u#(max a 2)\n = SEA.repr a already_framed opened_invariants g pre post\n (fun _ -> req)\n (fun _ x _ -> ens x)", "val get (#v:Type) \r\n (#c:Type)\r\n (#vp:M.epoch_id -> v -> c -> vprop)\r\n (#init:G.erased c)\r\n (#m:G.erased (repr c))\r\n (#b:G.erased (borrows v))\r\n (a:tbl vp)\r\n (i:M.epoch_id)\r\n : ST (get_result v)\r\n (perm a init m b)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\nlet get #v #c #vp #init #m #b a i =\r\n let w = elim_exists () in\r\n elim_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n let high_value = R.read a.high in\r\n let r = above_high_water_mark high_value i in\r\n if r returns ST _\r\n _\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init)\r\n\r\n then begin\r\n let ret = Fresh in\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n end\r\n else begin\r\n let x = ETbl.get a.etbl i in\r\n match x returns ST _\r\n (ETbl.get_post (repr_to_eht_repr m) b a.etbl i x\r\n `star`\r\n R.pts_to a.high Steel.FractionalPermission.full_perm w)\r\n (get_post init m b a i)\r\n (requires ~ (PartialMap.contains b i))\r\n (ensures fun res -> Fresh? res ==> Map.sel m i == G.reveal init) with\r\n | ETbl.Missing j ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Missing j))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n pure (ETbl.map_contains_prop j (repr_to_eht_repr m)));\r\n elim_pure (ETbl.map_contains_prop j (repr_to_eht_repr m));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Absent ->\r\n let ret = NotFound in\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i ETbl.Absent)\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) b);\r\n intro_pure (high_epoch_id_prop (G.reveal init) m b w);\r\n intro_exists (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m b a.high);\r\n rewrite (ETbl.tperm a.etbl (repr_to_eht_repr m) b\r\n `star`\r\n exists_ (high_epoch_id_pred (G.reveal init) m b a.high))\r\n (get_post init m b a i ret);\r\n return ret\r\n | ETbl.Present x ->\r\n let ret = Found x in\r\n assert (Some? (PartialMap.sel (repr_to_eht_repr m) i));\r\n rewrite (ETbl.get_post (repr_to_eht_repr m) b a.etbl i (ETbl.Present x))\r\n (ETbl.tperm a.etbl (repr_to_eht_repr m) (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i));\r\n intro_pure (high_epoch_id_prop (G.reveal init) m (PartialMap.upd b i x) w);\r\n intro_exists\r\n (G.reveal w)\r\n (high_epoch_id_pred (G.reveal init) m (PartialMap.upd b i x) a.high);\r\n rewrite (perm a init m (PartialMap.upd b i x)\r\n `star`\r\n vp i x (Map.sel m i))\r\n (get_post init m b a i ret);\r\n return ret\r\n end", "val cas_u32 (#uses:inames)\n (v:Ghost.erased U32.t)\n (r:ref U32.t)\n (v_old v_new:U32.t)\n : STAtomicT (b:bool{b <==> (Ghost.reveal v == v_old)})\n uses\n (pts_to r full_perm v)\n (fun b -> if b then pts_to r full_perm v_new else pts_to r full_perm v)\nlet cas_u32 #uses v r v_old v_new =\n coerce_atomic (fun _ -> R.cas_pt_u32 #uses r v v_old v_new)", "val witnessed (#a:Type u#1) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed #a #p r fact =\n M.witnessed r (lift_fact fact)", "val witnessed (#a:Type u#1) (#p:Preorder.preorder a) (r:ref a p) (fact:property a)\n : Type0\nlet witnessed #a #p r fact =\n PR.witnessed r (lift_fact fact)", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res" ], "closest_src": [ { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_neutral_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic0" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic1" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fst", "name": "Pulse.Lib.InvList.lift_ghost_unobservable" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_atomic2" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.bind_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.Ghost.fst", "name": "Steel.ST.Effect.Ghost.lift_ghost_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.lift_observability" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.lift_ghost_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.frame_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.stt_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.hide_ghost" }, { "project_name": "steel", "file_name": "Pulse.Lib.Pervasives.fst", "name": "Pulse.Lib.Pervasives.perform_ghost" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_ghostF" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.lift_ghost_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.stt_atomic" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fst", "name": "Pulse.Lib.InvList.with_invlist_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.bind_atomic" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness_exists" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.frame_atomic" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witness" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_atomic" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.lift_atomic_st" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.lift_exists" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_witness" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.sub_invs_stt_atomic" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_lift_ghost_neutral" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_atomic'" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_atomic" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witness" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness2" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_recall" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.recall" }, { "project_name": "steel", "file_name": "Pulse.JoinComp.fst", "name": "Pulse.JoinComp.lift_ghost_to_atomic" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostWitness.fst", "name": "Pulse.Lib.GhostWitness.ghost_witness_exists2" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_atomic" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.recall" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.recall" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_atomic_noeq" }, { "project_name": "steel", "file_name": "Pulse.Lib.Fixpoints.fst", "name": "Pulse.Lib.Fixpoints.fix_stt_ghost_1" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.witness" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.witness" }, { "project_name": "steel", "file_name": "Pulse.Typing.Combinators.fst", "name": "Pulse.Typing.Combinators.try_lift_ghost_atomic" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.witness" }, { "project_name": "steel", "file_name": "Steel.ST.Coercions.fst", "name": "Steel.ST.Coercions.coerce_atomicF" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.bind" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_ghost_noeq" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.witness" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.share" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.return_ghost" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.witness" }, { "project_name": "steel", "file_name": "Pulse.Lib.Forall.fst", "name": "Pulse.Lib.Forall.elim_forall" }, { "project_name": "steel", "file_name": "Pulse.Reflection.Util.fst", "name": "Pulse.Reflection.Util.mk_lift_neutral_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.write" }, { "project_name": "steel", "file_name": "Steel.ST.PCMReference.fst", "name": "Steel.ST.PCMReference.witness" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift0" }, { "project_name": "steel", "file_name": "PulseCore.Action.fst", "name": "PulseCore.Action.lift1" }, { "project_name": "steel", "file_name": "Steel.GhostPCMReference.fst", "name": "Steel.GhostPCMReference.witness" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witness'" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_alloc" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.as_atomic_action_ghost" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_reveal" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.stt" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.read" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.read" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.sub" }, { "project_name": "steel", "file_name": "Pulse.Lib.InvList.fst", "name": "Pulse.Lib.InvList.with_invlist" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.fsti", "name": "EverCrypt.Hash.free" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.Ghost.fst", "name": "Steel.ST.Effect.Ghost.admit_" }, { "project_name": "steel", "file_name": "Steel.Effect.Atomic.fst", "name": "Steel.Effect.Atomic.lift_atomic_steel" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witness'" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.share" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.atomic_read" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.recall" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.elim_exists" }, { "project_name": "steel", "file_name": "Steel.ST.Util.fst", "name": "Steel.ST.Util.with_invariant_g" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicReference.fst", "name": "Steel.GhostMonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GhostMonotonicReference.fst", "name": "Steel.ST.GhostMonotonicReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.repr" }, { "project_name": "zeta", "file_name": "Zeta.Steel.EpochMap.fst", "name": "Zeta.Steel.EpochMap.get" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.cas_u32" }, { "project_name": "steel", "file_name": "Steel.MonotonicHigherReference.fst", "name": "Steel.MonotonicHigherReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.GhostMonotonicHigherReference.fst", "name": "Steel.GhostMonotonicHigherReference.witnessed" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim'" } ], "selected_premises": [ "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.iname", "Pulse.Lib.Core.stt", "Pulse.Lib.Core.op_exists_Star", "Pulse.Lib.Core.vprop", "Pulse.Lib.Core.op_Star_Star", "PulseCore.Action.emp_inames", "Pulse.Lib.Core.emp", "Pulse.Lib.Core.pure", "PulseCore.Preorder.pcm_history", "PulseCore.Action.inames", "Pulse.Lib.Core.vprop_equiv_ext", "Pulse.Lib.Core.hide_div", "Pulse.Lib.Core.vprop_equiv_sym", "Pulse.Lib.Core.sub_stt", "Pulse.Lib.Core.vprop_equiv_trans", "Pulse.Lib.Core.conv_stt", "Pulse.Lib.Core.vprop_post_equiv", "Pulse.Lib.Core.vprop_equiv_refl", "Pulse.Lib.Core.vprop_equiv", "Pulse.Lib.Core.lift_observability", "Pulse.Lib.Core.stt_atomic", "Pulse.Lib.Core.frame_stt", "Pulse.Lib.Core.inv", "Pulse.Lib.Core.lift_atomic1", "Pulse.Lib.Core.vprop_equiv_unit", "Pulse.Lib.Core.elim_vprop_equiv", "Pulse.Lib.Core.sub_invs_atomic", "FStar.PCM.composable", "Pulse.Lib.Core.stt_ghost", "Pulse.Lib.Core.lift_atomic2", "Pulse.Lib.Core.par_stt", "Pulse.Lib.Core.lift_atomic0", "FStar.Real.one", "Pulse.Lib.Core.frame_atomic", "Pulse.Lib.Core.vprop_equiv_assoc", "Pulse.Lib.Core.intro_vprop_post_equiv", "PulseCore.Preorder.history_val", "Pulse.Lib.Core.vprop_equiv_comm", "FStar.Real.two", "Pulse.Lib.Core.new_invariant", "Pulse.Lib.Core.join_emp", "Pulse.Lib.Core.bind_stt", "Pulse.Lib.Core.vprop_equiv_cong", "Pulse.Lib.Core.sub_atomic", "PulseCore.FractionalPermission.comp_perm", "FStar.PCM.op", "Pulse.Lib.Core.with_invariant", "FStar.PCM.compatible", "PulseCore.FractionalPermission.sum_perm", "FStar.FunctionalExtensionality.feq", "Pulse.Lib.Core.bind_atomic", "Pulse.Lib.Core.elim_vprop_post_equiv", "Pulse.Lib.Core.return_neutral", "FStar.Pervasives.reveal_opaque", "Pulse.Lib.Core.name_of_inv", "Pulse.Lib.Core.return_stt_noeq", "Pulse.Lib.Core.bind_ghost", "Pulse.Lib.Core.return_neutral_noeq", "PulseCore.InstantiatedSemantics.slprop_post_equiv", "FStar.FunctionalExtensionality.on_dom", "PulseCore.Action.join_inames", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "PulseCore.Preorder.induces_preorder", "PulseCore.Preorder.p_op", "PulseCore.FractionalPermission.half_perm", "PulseCore.Action.mem_inv", "Pulse.Lib.Core.add_already_there", "FStar.Real.zero", "PulseCore.Preorder.comm_op", "PulseCore.Action.inames_subset", "PulseCore.Preorder.preorder_of_pcm", "PulseCore.FractionalPermission.lesser_perm", "PulseCore.Preorder.vhist", "PulseCore.Preorder.history_compose", "FStar.Pervasives.dfst", "FStar.Pervasives.dsnd", "PulseCore.FractionalPermission.writeable", "PulseCore.Preorder.fact_valid_compat", "FStar.FunctionalExtensionality.on", "PulseCore.Preorder.extends", "PulseCore.Preorder.history_composable", "PulseCore.Preorder.hval", "PulseCore.Preorder.curval", "PulseCore.Action.add_inv", "FStar.PropositionalExtensionality.apply", "PulseCore.Preorder.extends'", "PulseCore.Preorder.pcm_of_preorder", "PulseCore.Preorder.p_composable", "PulseCore.Preorder.property", "PulseCore.Action.property", "Pulse.Lib.Core.prop_squash_idem", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "PulseCore.Preorder.p", "PulseCore.Preorder.unit_history", "PulseCore.Preorder.flip", "FStar.FunctionalExtensionality.restricted_t", "PulseCore.Preorder.lift_fact", "PulseCore.FractionalPermission.lesser_equal_perm" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule Pulse.Lib.Core\nmodule I = PulseCore.InstantiatedSemantics\nmodule A = PulseCore.Atomic\nmodule T = FStar.Tactics.V2\nmodule F = FStar.FunctionalExtensionality\nopen PulseCore.InstantiatedSemantics\nopen PulseCore.FractionalPermission\nopen PulseCore.Observability\n\nlet double_one_half () = ()\nlet equate_by_smt = ()\nlet vprop = slprop\nlet emp = emp\nlet op_Star_Star = op_Star_Star\nlet pure = pure\nlet op_exists_Star = op_exists_Star\nlet vprop_equiv = slprop_equiv\nlet elim_vprop_equiv #p #q pf = slprop_equiv_elim p q\nlet vprop_post_equiv = slprop_post_equiv\nlet prop_squash_idem (p:prop)\n : Tot (squash (squash p == p))\n = FStar.PropositionalExtensionality.apply p (squash p)\n\nlet intro_vprop_post_equiv\n (#t:Type u#a)\n (p q: t -> vprop)\n (pf: (x:t -> vprop_equiv (p x) (q x)))\n : vprop_post_equiv p q\n = let pf : squash (forall x. vprop_equiv (p x) (q x)) =\n introduce forall x. vprop_equiv (p x) (q x)\n with FStar.Squash.return_squash (pf x)\n in\n coerce_eq (prop_squash_idem _) pf\n\nlet elim_vprop_post_equiv (#t:Type u#a)\n (p q: t -> vprop)\n (pf:vprop_post_equiv p q)\n (x:t)\n: vprop_equiv (p x) (q x)\n= let pf\n : squash (vprop_equiv (p x) (q x))\n = eliminate forall x. vprop_equiv (p x) (q x) with x\n in\n coerce_eq (prop_squash_idem _) pf\n\nlet vprop_equiv_refl (v0:vprop)\n : vprop_equiv v0 v0\n = slprop_equiv_refl v0\n\nlet vprop_equiv_sym (v0 v1:vprop) (p:vprop_equiv v0 v1)\n : vprop_equiv v1 v0\n = slprop_equiv_elim v0 v1; p\n\nlet vprop_equiv_trans\n (v0 v1 v2:vprop)\n (p:vprop_equiv v0 v1)\n (q:vprop_equiv v1 v2)\n : vprop_equiv v0 v2\n = slprop_equiv_elim v0 v1;\n slprop_equiv_elim v1 v2;\n p\n\nlet vprop_equiv_unit (x:vprop)\n : vprop_equiv (emp ** x) x\n = slprop_equiv_unit x\n\nlet vprop_equiv_comm (p1 p2:vprop)\n : vprop_equiv (p1 ** p2) (p2 ** p1)\n = slprop_equiv_comm p1 p2\n\nlet vprop_equiv_assoc (p1 p2 p3:vprop)\n : vprop_equiv ((p1 ** p2) ** p3) (p1 ** (p2 ** p3))\n = slprop_equiv_assoc p1 p2 p3\n\nlet vprop_equiv_cong (p1 p2 p3 p4:vprop)\n (f: vprop_equiv p1 p3)\n (g: vprop_equiv p2 p4)\n : vprop_equiv (p1 ** p2) (p3 ** p4)\n = slprop_equiv_elim p1 p3;\n slprop_equiv_elim p2 p4;\n vprop_equiv_refl _\n\nlet vprop_equiv_ext p1 p2 _ = vprop_equiv_refl p1\n\n(* Invariants, just reexport *)\nmodule Act = PulseCore.Action\nlet iname = Act.iname\n\nlet join_sub _ _ = ()\nlet join_emp is =\n Set.lemma_equal_intro (join_inames is emp_inames) (reveal is);\n Set.lemma_equal_intro (join_inames emp_inames is) (reveal is)\n\nlet inv = Act.inv\nlet name_of_inv = Act.name_of_inv\n\nlet add_already_there i is = Set.lemma_equal_intro (add_inv is i) is\n\n////////////////////////////////////////////////////////////////////\n// stt a pre post: The main type of a pulse computation\n////////////////////////////////////////////////////////////////////\nlet stt = I.stt\nlet return_stt_noeq = I.return\nlet bind_stt = I.bind\nlet frame_stt = I.frame\nlet par_stt = I.par\nlet sub_stt = I.sub\nlet conv_stt pf1 pf2 = I.conv #_ _ _ _ _ pf1 pf2\nlet hide_div = I.hide_div\n\n////////////////////////////////////////////////////////////////////\n// Atomic computations\n////////////////////////////////////////////////////////////////////\nlet stt_atomic a #obs inames pre post = A.stt_atomic a #obs inames pre post\nlet lift_observability = A.lift_observability\nlet return_neutral = A.return_atomic\nlet return_neutral_noeq = A.return_atomic_noeq\nlet bind_atomic = A.bind_atomic\nlet frame_atomic = A.frame_atomic\nlet sub_atomic = A.sub_atomic\nlet sub_invs_atomic = A.sub_invs_stt_atomic\nlet lift_atomic0 = A.lift_atomic0\nlet lift_atomic1 = A.lift_atomic1\nlet lift_atomic2 = A.lift_atomic2\nlet new_invariant = A.new_invariant\nlet with_invariant = A.with_invariant\n\n////////////////////////////////////////////////////////////////////\n// Ghost computations\n////////////////////////////////////////////////////////////////////\nlet stt_ghost = A.stt_ghost\nlet bind_ghost = A.bind_ghost", "sketch": [ "To implement `lift_ghost_neutral`, we need to create an atomic computation that wraps the ghost computation `e`. We will use the non-informative witness `reveal_a` to ensure that the atomic computation has neutral observability. We will also set the invariants to `emp_inames` and use the same pre and post-conditions as the original ghost computation.", "To implement `lift_ghost_neutral`, we need to create an atomic computation with neutral observability using the given ghost computation `e`, pre-condition `pre`, post-condition `post`, and the witness `reveal_a`. We will use the `stt_ghost` and `return_neutral` functions to achieve this.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation, where the ghost computation has a neutral postcondition.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with a pre-condition `pre` and a post-condition `post`, and a witness `reveal_a` for the non-informativeness of the result type `a`. The goal is to construct an atomic computation with the same pre and post-conditions, and the `emp_inames` invariants.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation with neutral observability.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with pre and post-conditions, and a witness `reveal_a` for the non-informativeness of the result type `a`. It then constructs an atomic computation with neutral observability, pre and post-conditions.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation, where the ghost computation has a neutral post-condition.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with a pre-condition `pre` and a post-condition that depends on a value of type `a`. It then converts this ghost computation to an atomic computation with the same pre-condition and post-condition, using a witness `reveal_a` to show that the value `a` is non-informative.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation with neutral observability.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with pre and post conditions, along with a witness `reveal_a` for the non-informative type `a`, and producing an atomic computation with neutral observability and the same pre and post conditions.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation with neutral observability.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with pre and post conditions, and a witness `reveal_a` for the non-informative type `a`. It then constructs an atomic computation with neutral observability, using the pre and post conditions of the ghost computation.", "The `lift_ghost_neutral` function is implemented by taking the input ghost computation `e` and the witness `reveal_a`, and using them to construct an atomic computation with the same post condition. The pre condition is set to `emp` and the invariants are set to `emp_inames`.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation with neutral observability.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with pre and post conditions, and a witness `reveal_a` for the non-informative type `a`. It then returns an atomic computation with neutral observability, pre-condition `emp`, and the same post-condition as the ghost computation.", "The definition `lift_ghost_neutral` is about lifting a ghost computation to an atomic computation, where the ghost computation has a neutral post-condition.\n\nThe implementation of `lift_ghost_neutral` involves taking a ghost computation `e` with a pre-condition `pre` and a post-condition `post`, and a witness `reveal_a` for the non-informativeness of the result type `a`. The goal is to construct an atomic computation with the same pre and post-conditions, and the `emp_inames` invariants." ], "generated_solution": [ "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_observability (A.stt_ghost e) reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= stt_ghost (bind_ghost e (fun x -> return_neutral x)) reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= (* Your implementation here *)", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a", "let lift_ghost_neutral\n (a:Type u#a)\n (pre:vprop)\n (post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral a pre post e reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a", "let lift_ghost_neutral\n (#a:Type u#a)\n (#pre:vprop)\n (#post:a -> vprop)\n (e:stt_ghost a pre post)\n (reveal_a:non_informative_witness a)\n: stt_atomic a #Neutral emp_inames pre post\n= A.lift_ghost_neutral e reveal_a" ] }, { "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.struct_upd", "opens_and_abbrevs": [ { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "DM", "full_module": "FStar.DependentMap" }, { "open": "FStar.HyperStack.ST" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HH", "full_module": "FStar.HyperStack" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f)\n : Tot (struct l)", "source_definition": "let struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v", "source_range": { "start_line": 274, "start_col": 0, "end_line": 275, "end_col": 14 }, "interleaved": false, "definition": "fun s f v -> FStar.DependentMap.upd s f v <: FStar.Pointer.Base.struct l", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.Pointer.Base.struct_typ", "FStar.Pointer.Base.struct", "FStar.Pointer.Base.struct_field", "FStar.Pointer.Base.type_of_struct_field", "FStar.DependentMap.upd", "FStar.Pointer.Base.type_of_struct_field'", "FStar.Pointer.Base.typ", "Prims.precedes", "FStar.Pointer.Base.type_of_typ'" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n s: FStar.Pointer.Base.struct l ->\n f: FStar.Pointer.Base.struct_field l ->\n v: FStar.Pointer.Base.type_of_struct_field l f\n -> FStar.Pointer.Base.struct l", "prompt": "let struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f)\n : Tot (struct l) =\n ", "expected_response": "DM.upd s f v", "source": { "project_name": "FStar", "file_name": "ulib/legacy/FStar.Pointer.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Pointer.Base.fst", "checked_file": "dataset/FStar.Pointer.Base.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.UInt16.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.ModifiesGen.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Int8.fsti.checked", "dataset/FStar.Int64.fsti.checked", "dataset/FStar.Int32.fsti.checked", "dataset/FStar.Int16.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.DependentMap.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Char.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "base_typ", "TUInt", "TUInt", "TUInt", "TUInt8", "TUInt8", "TUInt8", "TUInt16", "TUInt16", "TUInt16", "TUInt32", "TUInt32", "TUInt32", "TUInt64", "TUInt64", "TUInt64", "TInt", "TInt", "TInt", "TInt8", "TInt8", "TInt8", "TInt16", "TInt16", "TInt16", "TInt32", "TInt32", "TInt32", "step", "TInt64", "TInt64", "TInt64", "StepField", "StepField", "StepField", "TChar", "TChar", "TChar", "l", "l", "TBool", "TBool", "TBool", "fd", "fd", "TUnit", "TUnit", "TUnit", "StepUField", "StepUField", "StepUField", "l", "l", "array_length_t", "fd", "fd", "typ", "StepCell", "StepCell", "StepCell", "TBase", "TBase", "TBase", "length", "length", "b", "b", "value", "value", "index", "index", "TStruct", "TStruct", "TStruct", "l", "l", "path", "TUnion", "TUnion", "TUnion", "PathBase", "PathBase", "PathBase", "l", "l", "PathStep", "PathStep", "PathStep", "TArray", "TArray", "TArray", "through", "through", "length", "length", "to", "to", "t", "t", "p", "p", "s", "s", "TPointer", "TPointer", "TPointer", "t", "t", "let step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()", "TNPointer", "TNPointer", "TNPointer", "t", "t", "TBuffer", "TBuffer", "TBuffer", "t", "t", "struct_typ'", "struct_typ", "struct_typ", "let rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s", "name", "name", "fields", "fields", "union_typ", "let struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "let struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "let union_field = struct_field", "let typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "let typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "_npointer", "Pointer", "Pointer", "Pointer", "from", "from", "contents", "contents", "let typ_of_union_field\n (l: union_typ)\n (f: union_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field l f", "p", "p", "NullPtr", "NullPtr", "NullPtr", "let npointer (t: typ): Tot Type0 =\n _npointer t", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let nullptr (#t: typ): Tot (npointer t) = NullPtr", "let g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false", "let g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()", "let not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true", "let rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "buffer_root", "BufferRootSingleton", "BufferRootSingleton", "BufferRootSingleton", "p", "p", "BufferRootArray", "BufferRootArray", "BufferRootArray", "max_length", "max_length", "p", "p", "let buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len", "_buffer", "Buffer", "Buffer", "Buffer", "broot", "broot", "bidx", "bidx", "blength", "blength", "let buffer (t: typ): Tot Type0 = _buffer t", "val npointer (t: typ) : Tot Type0", "val nullptr (#t: typ): Tot (npointer t)", "val g_is_null (#t: typ) (p: npointer t) : GTot bool", "val g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n [SMTPat (g_is_null (nullptr #t))]", "let gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )", "let pointer (t: typ) : Tot Type0 = (p: npointer t { g_is_null p == false } )", "let _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u", "val buffer (t: typ): Tot Type0", "let gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u", "let type_of_base_typ\n (t: base_typ)\n: Tot Type0\n= match t with\n | TUInt -> nat\n | TUInt8 -> FStar.UInt8.t\n | TUInt16 -> FStar.UInt16.t\n | TUInt32 -> FStar.UInt32.t\n | TUInt64 -> FStar.UInt64.t\n | TInt -> int\n | TInt8 -> FStar.Int8.t\n | TInt16 -> FStar.Int16.t\n | TInt32 -> FStar.Int32.t\n | TInt64 -> FStar.Int64.t\n | TChar -> FStar.Char.char\n | TBool -> bool\n | TUnit -> unit", "let gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v", "let gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)", "array", "let type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "let gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()", "let type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "val struct (l: struct_typ) : Tot Type0", "val union (l: union_typ) : Tot Type0", "let rec type_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t", "let rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()", "let type_of_typ_array\n (len: array_length_t)\n (t: typ)\n: Lemma\n (type_of_typ (TArray len t) == array len (type_of_typ t))\n [SMTPat (type_of_typ (TArray len t))]\n= ()", "let _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v", "let struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f" ], "closest": [ "val typ_of_struct_field (l: struct_typ) (f: struct_field l) : Tot (t: typ{t << l})\nlet typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "val typ_of_struct_field' (l: struct_typ') (f: struct_field' l) : Tot (t: typ{t << l})\nlet typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "val type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (t: typ{t << l} -> Tot Type0))\n (f: struct_field l)\n : Tot Type0\nlet type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "val type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (t: typ{t << l} -> Tot Type0))\n (f: struct_field' l)\n : Tot Type0\nlet type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "val struct_field' (l: struct_typ') : Tot eqtype\nlet struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "val struct_field (l: struct_typ) : Tot eqtype\nlet struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "val type_of_struct_field (l: struct_typ) : Tot (struct_field l -> Tot Type0)\nlet type_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l (fun (x:typ{x << l}) -> type_of_typ x)", "val set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f)\n : Tot t\nlet set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) : Tot t =\n sd.mk (set_aux sd x f v)", "val set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f)\n : Tot t\nlet set (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) : Tot t =\n sd.mk (set_aux sd x f v)", "val typ_of_union_field (l: union_typ) (f: union_field l) : Tot (t: typ{t << l})\nlet typ_of_union_field\n (l: union_typ)\n (f: union_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field l f", "val dfst_struct_field (s: struct_typ) (p: (x: struct_field s & type_of_struct_field s x))\n : Tot string\nlet dfst_struct_field\n (s: struct_typ)\n (p: (x: struct_field s & type_of_struct_field s x))\n: Tot string\n=\n let (| f, _ |) = p in\n f", "val typ_depth_typ_of_struct_field (l: struct_typ') (f: struct_field' l)\n : Lemma (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l)) (decreases l)\nlet rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "val set_aux\n (#t: Type)\n (sd: struct_def t)\n (x: t)\n (f: field_t sd.fields)\n (v: sd.field_desc.fd_type f)\n (f': field_t sd.fields)\n : Tot (sd.field_desc.fd_type f')\nlet set_aux\n (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f': field_t sd.fields)\n: Tot (sd.field_desc.fd_type f')\n= if f = f' then v else sd.get x f'", "val set_aux\n (#t: Type)\n (sd: struct_def t)\n (x: t)\n (f: field_t sd.fields)\n (v: sd.field_desc.fd_type f)\n (f': field_t sd.fields)\n : Tot (sd.field_desc.fd_type f')\nlet set_aux\n (#t: Type) (sd: struct_def t) (x: t) (f: field_t sd.fields) (v: sd.field_desc.fd_type f) (f': field_t sd.fields)\n: Tot (sd.field_desc.fd_type f')\n= if f = f' then v else sd.get x f'", "val struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n : stt (ref #(norm norm_field_steps (sd.field_desc.fd_type field))\n (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' ->\n (has_struct_field r field r' **\n pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field)))) **\n pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field))\nlet struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n: stt (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' -> has_struct_field r field r' ** pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))) ** pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field))\n= struct_field0\n (norm norm_field_steps (sd.field_desc.fd_type field))\n r\n field\n (sd.field_desc.fd_typedef field)", "val struct_literal (s: struct_typ) : Tot Type0\nlet struct_literal (s: struct_typ) : Tot Type0 = list (x: struct_field s & type_of_struct_field s x)", "val struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool\nlet struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool =\n List.Tot.sortWith FStar.String.compare (List.Tot.map fst s.fields) =\n List.Tot.sortWith FStar.String.compare\n (List.Tot.map (dfst_struct_field s) l)", "val fun_of_list (s: struct_typ) (l: struct_literal s) (f: struct_field s)\n : Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\nlet fun_of_list\n (s: struct_typ)\n (l: struct_literal s)\n (f: struct_field s)\n: Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n=\n let f' : string = f in\n let phi (p: (x: struct_field s & type_of_struct_field s x)) : Tot bool =\n dfst_struct_field s p = f'\n in\n match List.Tot.find phi l with\n | Some p -> let (| _, v |) = p in v\n | _ ->\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map fst s.fields);\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map (dfst_struct_field s) l);\n List.Tot.mem_memP f' (List.Tot.map fst s.fields);\n List.Tot.mem_count (List.Tot.map fst s.fields) f';\n List.Tot.mem_count (List.Tot.map (dfst_struct_field s) l) f';\n List.Tot.mem_memP f' (List.Tot.map (dfst_struct_field s) l);\n List.Tot.memP_map_elim (dfst_struct_field s) f' l;\n Classical.forall_intro (Classical.move_requires (List.Tot.find_none phi l));\n false_elim ()", "val union_field (l: P.union_typ) : P.struct_field (typ_l l)\nlet union_field (l: P.union_typ) : P.struct_field (typ_l l) = \"union\"", "val struct_field:\n #tn: Type0 ->\n #tf: Type0 ->\n #n: string ->\n #fields: nonempty_field_description_t tf ->\n #v: Ghost.erased (struct_t0 tn n fields) ->\n r: ref (struct0 tn n fields) ->\n field: field_t fields ->\n #t': Type0 ->\n #td': typedef t' ->\n (#[norm_fields ()] sq_t': squash (t' == fields.fd_type field)) ->\n (#[norm_fields ()] sq_td': squash (td' == fields.fd_typedef field)) ->\n Prims.unit\n -> stt (ref td')\n (pts_to r v)\n (fun r' ->\n (pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) **\n pts_to r' (struct_get_field v field)) **\n has_struct_field r field r')\nlet struct_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (# [ norm_fields () ] sq_t': squash (t' == fields.fd_type field))\n (# [ norm_fields () ] sq_td': squash (td' == fields.fd_typedef field))\n ()\n: stt (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) ** pts_to r' (struct_get_field v field) ** has_struct_field r field r')\n= struct_field0\n t'\n r\n field\n td'", "val tag_of_field' (#l: P.struct_typ') (tgs: tags' l) (f: P.struct_field' l)\n : Pure UInt32.t (requires True) (ensures (fun t -> List.Tot.mem t tgs))\nlet rec tag_of_field'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (f: P.struct_field' l)\n: Pure UInt32.t\n (requires True)\n (ensures (fun t -> List.Tot.mem t tgs))\n= let ((f', _) :: l') = l in\n let (t :: tgs') = tgs in\n if f = f' then t\n else (\n assert (Cons? l');\n let ff : string = f in\n tag_of_field' #l' tgs' ff\n )", "val struct_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : stt (ref td')\n (pts_to r v)\n (fun r' ->\n (pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) **\n pts_to r' (struct_get_field v field)) **\n has_struct_field r field r')\nlet struct_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: stt (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) ** pts_to r' (struct_get_field v field) ** has_struct_field r field r')\n= struct_field0 t' r field td'", "val tags' (l: P.struct_typ') : Tot Type0\nlet tags' (l: P.struct_typ') : Tot Type0 =\n tl: list UInt32.t {\n List.Tot.length tl == List.Tot.length l /\\\n List.Tot.noRepeats tl\n }", "val struct_field:\n #tn: Type0 ->\n #tf: Type0 ->\n #n: string ->\n #fields: nonempty_field_description_t tf ->\n #v: Ghost.erased (struct_t0 tn n fields) ->\n r: ref (struct0 tn n fields) ->\n field: field_t fields ->\n #t': Type0 ->\n #td': typedef t' ->\n (#[norm_fields ()] sq_t': squash (t' == fields.fd_type field)) ->\n (#[norm_fields ()] sq_td': squash (td' == fields.fd_typedef field)) ->\n Prims.unit\n -> STT (ref td')\n (pts_to r v)\n (fun r' ->\n ((pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v))\n `star`\n (pts_to r' (struct_get_field v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#t': Type0)\n (#td': typedef t')\n (# [ norm_fields () ] sq_t': squash (t' == fields.fd_type field))\n (# [ norm_fields () ] sq_td': squash (td' == fields.fd_typedef field))\n ()\n: STT (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) `star` pts_to r' (struct_get_field v field) `star` has_struct_field r field r')\n= struct_field0\n t'\n r\n field\n td'", "val struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n : STT\n (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' ->\n ((pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))))\n `star`\n (pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n: STT (ref #(norm norm_field_steps (sd.field_desc.fd_type field)) (sd.field_desc.fd_typedef field))\n (pts_to r v)\n (fun r' -> pts_to r (set sd v field (unknown (sd.field_desc.fd_typedef field))) `star` pts_to #(norm norm_field_steps (sd.field_desc.fd_type field)) r' (sd.get v field) `star` has_struct_field r field r')\n= struct_field0\n (norm norm_field_steps (sd.field_desc.fd_type field))\n r\n field\n (sd.field_desc.fd_typedef field)", "val upd (#key: eqtype) (#value: (key -> Tot Type)) (m: t key value) (k: key) (v: value k)\n : Tot (t key value)\nlet upd (#key: eqtype) (#value: (key -> Tot Type)) (m: t key value) (k: key) (v: value k)\n : Tot (t key value) =\n { mappings = F.on_domain key (fun k' -> if k' = k then v else m.mappings k') }", "val field_matches_tag\n (#l: P.union_typ) (tgs: tags l)\n (f: P.struct_field l) (t: UInt32.t)\n: Tot Type0\nlet field_matches_tag\n (#l: P.union_typ) (tgs: tags l)\n (f: P.struct_field l) (t: UInt32.t)\n: Tot Type0\n= tag_of_field tgs f == t", "val upd' (#a: Type) (s: seq a) (n: nat{n < length s}) (v: a) : Tot (seq a) (decreases (length s))\nlet rec upd' (#a:Type) (s:seq a) (n:nat{n < length s}) (v:a)\n : Tot (seq a)\n (decreases (length s))\n = if n = 0 then _cons v (tl s) else _cons (hd s) (upd' (tl s) (n - 1) v)", "val field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)\n : Pure (P.struct_field' l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))\nlet rec field_of_tag'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (t: UInt32.t)\n: Pure (P.struct_field' l)\n (requires (List.Tot.mem t tgs))\n (ensures (fun _ -> True))\n= let ((f, _) :: l') = l in\n let (t' :: tgs') = tgs in\n if t = t' then f\n else (\n assert (Cons? l');\n let ff' : string = field_of_tag' #l' tgs' t in\n ff'\n )", "val gfield\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: GTot (p': P.pointer (P.typ_of_struct_field l f) { P.includes p p' })\nlet gfield\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: GTot (p': P.pointer (P.typ_of_struct_field l f) { P.includes p p' })\n= P.gufield (P.gfield p (union_field l)) f", "val struct\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot (typedef (struct_t0 tn n fields))\nlet struct (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot (typedef (struct_t0 tn n fields))\n= struct0 tn #tf n fields", "val struct\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot (typedef (struct_t0 tn n fields))\nlet struct (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot (typedef (struct_t0 tn n fields))\n= struct0 tn #tf n fields", "val tag_field (l: P.union_typ) : P.struct_field (typ_l l)\nlet tag_field (l: P.union_typ) : P.struct_field (typ_l l) = \"tag\"", "val tag_of_field (#l: P.union_typ) (tgs: tags l) (f: P.struct_field l)\n : Pure UInt32.t (requires True) (ensures (fun t -> List.Tot.mem t tgs))\nlet tag_of_field\n (#l: P.union_typ)\n (tgs: tags l)\n (f: P.struct_field l)\n: Pure UInt32.t\n (requires True)\n (ensures (fun t -> List.Tot.mem t tgs))\n= tag_of_field' tgs f", "val raw_get_field (#l: P.union_typ) (tu: raw l): GTot (P.struct_field l)\nlet raw_get_field (#l: P.union_typ) (tu: raw l)\n: GTot (P.struct_field l)\n=\n P.union_get_key #l (P.struct_sel #(typ_l l) tu (union_field l))", "val struct_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : STT (ref td')\n (pts_to r v)\n (fun r' ->\n ((pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v))\n `star`\n (pts_to r' (struct_get_field v field)))\n `star`\n (has_struct_field r field r'))\nlet struct_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: STT (ref td')\n (pts_to r v)\n (fun r' -> pts_to r (struct_set_field field (unknown (fields.fd_typedef field)) v) `star` pts_to r' (struct_get_field v field) `star` has_struct_field r field r')\n= struct_field0 t' r field td'", "val get_field (#l: P.union_typ) (#tgs: tags l) (tu: t l tgs) : GTot (P.struct_field l)\nlet get_field (#l: P.union_typ) (#tgs: tags l) (tu: t l tgs)\n: GTot (P.struct_field l)\n=\n raw_get_field tu", "val array_upd (#t: Type) (a: array t) : Tot (Gen.array_upd_t (array_pts_to a))\nlet array_upd\n (#t: Type)\n (a: array t)\n: Tot (Gen.array_upd_t (array_pts_to a))\n= fun s n i x ->\n upd a i x;\n return _", "val upd (f:flag) (v:flag_val_t) (m:t) : t\nlet upd (r:flag) (v:flag_val_t) (m:t) : t =\n reveal_opaque (`%t) t;\n Map.upd m r v", "val define_struct\n (n: string)\n (#tf #tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet define_struct (n: string) (#tf: Type0) (#tn: Type0) (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= define_struct0 tn #tf n fields", "val define_struct\n (n: string)\n (#tf #tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet define_struct (n: string) (#tf: Type0) (#tn: Type0) (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= define_struct0 tn #tf n fields", "val struct_typ_depth (l: list (string * typ)) : GTot nat\nlet rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "val get_value (#l: P.union_typ) (#tgs: tags l) (tu: t l tgs) (f: P.struct_field l)\n : Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (get_field tu == f))\n (ensures (fun _ -> True))\nlet get_value\n (#l: P.union_typ) (#tgs: tags l)\n (tu: t l tgs)\n (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (get_field tu == f))\n (ensures (fun _ -> True))\n=\n raw_get_value #l tu f", "val upd_tot (#a: Type) (#rel: preorder a) (m: mem) (r: mreference a rel {m `contains` r}) (v: a)\n : Tot mem\nlet upd_tot (#a:Type) (#rel:preorder a) (m:mem) (r:mreference a rel{m `contains` r}) (v:a)\n :Tot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf r in\n let i_h = h `Map.sel` i in\n let i_h = Heap.upd_tot i_h (as_ref r) v in\n let h = Map.upd h i i_h in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val struct_t\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet struct_t (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= struct_t0 tn #tf n fields", "val struct_t\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: nonempty_field_description_t tf)\n : Tot Type0\nlet struct_t (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: nonempty_field_description_t tf) : Tot Type0\n= struct_t0 tn #tf n fields", "val field_of_tag (#l: P.union_typ) (tgs: tags l) (t: UInt32.t)\n : Pure (P.struct_field l) (requires (List.Tot.mem t tgs)) (ensures (fun _ -> True))\nlet field_of_tag\n (#l: P.union_typ)\n (tgs: tags l)\n (t: UInt32.t)\n: Pure (P.struct_field l)\n (requires (List.Tot.mem t tgs))\n (ensures (fun _ -> True))\n= field_of_tag' tgs t", "val upd: #a:Type -> s:seq a -> n:nat{n < length s} -> a -> Tot (seq a)\nlet upd = upd'", "val update: s:seq 'a -> i:nat{length s > i} -> v:'a -> Tot (seq 'a)\nlet update (Seq c j k) i v = Seq (__update__ c (i + j) v) j k", "val raw_get_value (#l: P.union_typ) (tu: raw l) (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (raw_get_field tu == f))\n (ensures (fun _ -> True))\nlet raw_get_value (#l: P.union_typ) (tu: raw l) (f: P.struct_field l)\n: Pure (P.type_of_typ (P.typ_of_struct_field l f))\n (requires (raw_get_field tu == f))\n (ensures (fun _ -> True))\n=\n let u : P.union l = P.struct_sel #(typ_l l) tu (union_field l) in\n P.union_get_value u f", "val type_of_typ_struct (l: struct_typ)\n : Lemma (type_of_typ (TStruct l) == struct l) [SMTPat (type_of_typ (TStruct l))]\nlet type_of_typ_struct\n (l: struct_typ)\n: Lemma\n (type_of_typ (TStruct l) == struct l)\n [SMTPat (type_of_typ (TStruct l))]\n= assert_norm (type_of_typ (TStruct l) == struct l)", "val struct_get_field_pat\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n : Lemma\n (struct_get_field (struct_set_field field v s) field' ==\n (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\nlet struct_get_field_pat\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n: Lemma\n (struct_get_field (struct_set_field field v s) field' == (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\n= if field' = field\n then ()\n else struct_get_field_other s field v field'", "val struct_get_field_pat\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n : Lemma\n (struct_get_field (struct_set_field field v s) field' ==\n (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\nlet struct_get_field_pat\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (s: struct_t0 tn n fields)\n (field: field_t fields)\n (v: fields.fd_type field)\n (field': field_t fields)\n: Lemma\n (struct_get_field (struct_set_field field v s) field' == (if field' = field then v else struct_get_field s field'))\n [SMTPat (struct_get_field (struct_set_field field v s) field')]\n= if field' = field\n then ()\n else struct_get_field_other s field v field'", "val struct_create (s: struct_typ) (l: struct_literal s)\n : Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\nlet struct_create\n (s: struct_typ)\n (l: struct_literal s)\n: Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n= struct_create_fun s (fun_of_list s l)", "val upd (#t: Type) (a: array t) (i: US.t) (v: t)\n : Steel unit\n (varray a)\n (fun _ -> varray a)\n (fun _ -> US.v i < length a)\n (fun h _ h' -> US.v i < length a /\\ asel a h' == Seq.upd (asel a h) (US.v i) v)\nlet upd\n (#t: Type)\n (a: array t)\n (i: US.t)\n (v: t)\n: Steel unit\n (varray a)\n (fun _ -> varray a)\n (fun _ -> US.v i < length a)\n (fun h _ h' ->\n US.v i < length a /\\\n asel a h' == Seq.upd (asel a h) (US.v i) v\n )\n= let s = elim_varray a in\n A.pts_to_length a _;\n A.upd a i v;\n intro_varray a _", "val const (#t: Type0) (v: t) : Tot (exp t)\nlet const (#t: Type0) (v: t) : Tot (exp t) = fun _ -> v", "val union_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : stt (ref td')\n (pts_to r v)\n (fun r' -> has_union_field r field r' ** pts_to r' (union_get_field v field))\nlet union_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: stt (ref td')\n (pts_to r v)\n (fun r' -> has_union_field r field r' ** pts_to r' (union_get_field v field))\n= union_field0 t' r field td'", "val upd (r: reg) (v: t_reg r) (m: t) : t\nlet upd (r:reg) (v:t_reg r) (m:t) : t =\n match m with (m0, m1) ->\n match r with Reg rf i ->\n match rf with\n | 0 -> (upd16 m0 i v, m1)\n | 1 -> (m0, upd16 m1 i v)", "val upd\n (#a: Type)\n (#rel: preorder a)\n (m: mem)\n (s: mreference a rel {live_region m (frameOf s)})\n (v: a)\n : GTot mem\nlet upd (#a:Type) (#rel:preorder a) (m:mem) (s:mreference a rel{live_region m (frameOf s)}) (v:a)\n :GTot mem\n = let h, rid_ctr, tip = get_hmap m, get_rid_ctr m, get_tip m in\n lemma_is_wf_ctr_and_tip_elim m;\n let i = frameOf s in\n let h = Map.upd h i (Heap.upd (Map.sel h i) (as_ref s) v) in\n lemma_is_wf_ctr_and_tip_intro h rid_ctr tip;\n mk_mem rid_ctr h tip", "val field_of_tag_of_field' (#l: P.struct_typ') (tgs: tags' l) (f: P.struct_field' l)\n : Lemma (field_of_tag' #l tgs (tag_of_field' #l tgs f) == f)\n [SMTPat (field_of_tag' #l tgs (tag_of_field' #l tgs f))]\nlet rec field_of_tag_of_field'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (f: P.struct_field' l)\n: Lemma (field_of_tag' #l tgs (tag_of_field' #l tgs f) == f)\n [SMTPat (field_of_tag' #l tgs (tag_of_field' #l tgs f))]\n= let ((f', _) :: l') = l in\n let (t' :: tgs') = tgs in\n if f = f' then ()\n else (\n let ff : string = f in\n field_of_tag_of_field' #l' tgs' ff\n )", "val upd_map: #a:eqtype -> #b:Type -> (a -> Tot b) -> a -> b -> a -> Tot b\nlet upd_map #a #b f i v = fun j -> if i=j then v else f j", "val upd (#a: Type0) (h: heap) (r: ref a) (v: a) : GTot heap\nlet upd (#a:Type0) (h:heap) (r:ref a) (v:a) :GTot heap\n = Heap.upd h r v", "val tag_of_field_of_tag' (#l: P.struct_typ') (tgs: tags' l) (t: UInt32.t)\n : Lemma (requires (List.Tot.mem t tgs))\n (ensures (List.Tot.mem t tgs /\\ tag_of_field' #l tgs (field_of_tag' #l tgs t) == t))\n [SMTPat (tag_of_field' #l tgs (field_of_tag' #l tgs t))]\nlet rec tag_of_field_of_tag'\n (#l: P.struct_typ')\n (tgs: tags' l)\n (t: UInt32.t)\n: Lemma\n (requires (List.Tot.mem t tgs))\n (ensures (\n List.Tot.mem t tgs /\\\n tag_of_field' #l tgs (field_of_tag' #l tgs t) == t\n ))\n [SMTPat (tag_of_field' #l tgs (field_of_tag' #l tgs t))]\n= let ((f', _) :: l') = l in\n let (t' :: tgs') = tgs in\n if t = t' then ()\n else (\n tag_of_field_of_tag' #l' tgs' t\n )", "val field_t (s: Set.set string) : Tot eqtype\nlet field_t (s: Set.set string) : Tot eqtype =\n (f: string { Set.mem f s })", "val field_t (s: Set.set string) : Tot eqtype\nlet field_t (s: Set.set string) : Tot eqtype =\n (f: string { Set.mem f s })", "val upd (#a: eqtype) (#b: _) (m: map' a b) (x: a) (y: b x) : Tot (map' a b)\nlet upd (#a:eqtype) #b (m:map' a b) (x:a) (y:b x)\n : Tot (map' a b)\n = fun z -> if x = z then Some y else m z", "val union_field1\n (#tn #tf t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n : STT (ref td')\n (pts_to r v)\n (fun r' -> (has_union_field r field r') `star` (pts_to r' (union_get_field v field)))\nlet union_field1\n (#tn: Type0)\n (#tf: Type0)\n (t': Type0)\n (#n: string)\n (#fields: field_description_t tf)\n (#v: Ghost.erased (union_t0 tn n fields))\n (r: ref (union0 tn n fields))\n (field: field_t fields {union_get_case v == Some field})\n (td': typedef t')\n (sq_t': squash (t' == fields.fd_type field))\n (sq_td': squash (td' == fields.fd_typedef field))\n: STT (ref td')\n (pts_to r v)\n (fun r' -> has_union_field r field r' `star` pts_to r' (union_get_field v field))\n= union_field0 t' r field td'", "val upd (s: store) (l: loc) (x: int) : store\nlet upd (s:store) (l:loc) (x:int) : store = Map.upd s l x", "val upd (s: store) (l: loc) (x: int) : store\nlet upd (s:store) (l:loc) (x:int) : store = Map.upd s l x", "val upd (s: store) (l: loc) (x: int) : store\nlet upd (s:store) (l:loc) (x:int) : store = Map.upd s l x", "val upd: #key:eqtype -> #value:Type -> t key value -> key -> value -> Tot (t key value)\nlet upd #key #value m k v = {\n mappings = F.on key (fun x -> if x = k then v else m.mappings x);\n domain = S.union m.domain (singleton k)\n}", "val upd (#k:eqtype) (#v:Type) (m:t k v) (x:k) (y:v) : t k v\nlet upd m x y = on_dom _ (fun x1 -> if x1 = x then Some y else m x1)", "val struct_typ_supported (l: list (string * P.typ)) : Tot bool\nlet rec supported\n (t : P.typ)\n: Tot bool\n= match t with\n | P.TBase _ -> true\n | P.TStruct l -> struct_typ_supported l.P.fields\n | _ -> false\n\nand struct_typ_supported\n (l: list (string * P.typ))\n: Tot bool\n= match l with\n | [] -> true\n | (_, t) :: l' -> supported t && struct_typ_supported l'", "val upd_tot : #a:Type -> h0:heap -> r:ref a{h0 `contains_a_well_typed` r} -> x:a -> Tot heap\nlet upd_tot #a h0 r x =\n { h0 with memory = F.on_dom nat (fun r' -> if r.addr = r'\n\t\t\t then Some (| a, x |)\n else h0.memory r') }", "val field\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack (P.pointer (P.typ_of_struct_field l f))\n (requires (fun h ->\n valid h tgs p /\\\n gread_tag h tgs p == normalize_term (tag_of_field tgs f)\n ))\n (ensures (fun h0 p' h1 ->\n h0 == h1 /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n p' == gfield tgs p f\n ))\nlet field\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n: HST.Stack (P.pointer (P.typ_of_struct_field l f))\n (requires (fun h ->\n valid h tgs p /\\\n gread_tag h tgs p == normalize_term (tag_of_field tgs f)\n ))\n (ensures (fun h0 p' h1 ->\n h0 == h1 /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n p' == gfield tgs p f\n ))\n= P.ufield (P.field p (union_field l)) f", "val v_: #t_k:eqtype -> #t_v:Type0 -> l:list (t_k & t_v) -> Tot (map t_k t_v)\nlet v_ #_ #t_v l =\n List.Tot.fold_right (fun (k, v) m -> M.upd m k (Some v)) l (M.const (None #t_v))", "val update:\n #a:Type\n -> #l:len_t\n -> v:raw a l\n -> i:index_t v\n -> x:a\n -> Tot (raw a l)\nlet update #a #l v i x = Seq.upd v (U32.v i) x", "val __update__: contents 'a -> int -> 'a -> Tot (contents 'a)\nlet rec __update__ c i v = match c with\n | Const _\n | Upd _ _ _ -> Upd i v c\n | Append s1 s2 ->\n if i < length s1\n then Append (Seq (__update__ (Seq?.c s1) i v) (Seq?.start_i s1) (Seq?.end_i s1)) s2\n else Append s1 (Seq (__update__ (Seq?.c s2) (i - length s1) v) (Seq?.start_i s2) (Seq?.end_i s2))", "val union\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: field_description_t tf)\n : Tot (typedef (union_t0 tn n fields))\nlet union (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: field_description_t tf) : Tot (typedef (union_t0 tn n fields))\n= union0 tn #tf n fields", "val union\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: field_description_t tf)\n : Tot (typedef (union_t0 tn n fields))\nlet union (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: field_description_t tf) : Tot (typedef (union_t0 tn n fields))\n= union0 tn #tf n fields", "val upd (#k #v: _) (m: t k v) (key: k) (value: v) : t k v\nlet upd #k #v (m: t k v) (key: k) (value: v) : t k v = \n FStar.FunctionalExtensionality.on_domain k (fun key' -> if key = key' then value else m key')", "val write\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (#s: serializer p {k.parser_kind_subkind == Some ParserStrong})\n (#h0: HS.mem)\n (#sout:\n slice (srel_of_buffer_srel (B.trivial_preorder _))\n (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (w: writer s h0 sout pout_from0)\n : Tot (fwriter s h0 sout pout_from0 (wvalue w))\nlet write\n (#k: parser_kind)\n (#t: Type)\n (#p: parser k t)\n (#s: serializer p { k.parser_kind_subkind == Some ParserStrong } )\n (#h0: HS.mem)\n (#sout: slice (srel_of_buffer_srel (B.trivial_preorder _)) (srel_of_buffer_srel (B.trivial_preorder _)))\n (#pout_from0: U32.t)\n (w: writer s h0 sout pout_from0)\n: Tot (fwriter s h0 sout pout_from0 (wvalue w))\n= match w with | Writer _ f -> f", "val unstruct_field_alt\n (#opened: _)\n (#tn #tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#v': Ghost.erased (fields.fd_type field))\n (r': ref (fields.fd_typedef field))\n : STGhost (Ghost.erased (struct_t0 tn n fields))\n opened\n (((has_struct_field r field r') `star` (pts_to r v)) `star` (pts_to r' v'))\n (fun s' -> (has_struct_field r field r') `star` (pts_to r s'))\n (struct_get_field v field == unknown (fields.fd_typedef field))\n (fun s' -> Ghost.reveal s' == struct_set_field field v' v)\nlet unstruct_field_alt\n (#opened: _)\n (#tn: Type0)\n (#tf: Type0)\n (#n: string)\n (#fields: nonempty_field_description_t tf)\n (#v: Ghost.erased (struct_t0 tn n fields))\n (r: ref (struct0 tn n fields))\n (field: field_t fields)\n (#v': Ghost.erased (fields.fd_type field))\n (r': ref (fields.fd_typedef field))\n: STGhost (Ghost.erased (struct_t0 tn n fields)) opened\n (has_struct_field r field r' `star` pts_to r v `star` pts_to r' v')\n (fun s' -> has_struct_field r field r' `star` pts_to r s')\n (\n struct_get_field v field == unknown (fields.fd_typedef field)\n )\n (fun s' -> \n Ghost.reveal s' == struct_set_field field v' v\n )\n= unstruct_field r field r'", "val upd (#a: Type) (m: map16 a) (n: int) (v: a) : map16 a\nlet upd (#a:Type) (m:map16 a) (n:int) (v:a) : map16 a =\n upd16 m n v", "val union_t\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: field_description_t tf)\n : Tot Type0\nlet union_t (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: field_description_t tf) : Tot Type0\n= union_t0 tn #tf n fields", "val union_t\n (#tf: Type0)\n (n: string)\n (#tn: Type0)\n (#[solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn)))\n (fields: field_description_t tf)\n : Tot Type0\nlet union_t (#tf: Type0) (n: string) (#tn: Type0) (# [solve_mk_string_t ()] prf: squash (norm norm_typestring (mk_string_t n == tn))) (fields: field_description_t tf) : Tot Type0\n= union_t0 tn #tf n fields", "val upd (r: loc) (v: int) : AlgWP unit (fun h0 p -> p ((), Map.upd h0 r v))\nlet upd (r:loc) (v:int) : AlgWP unit (fun h0 p -> p ((), Map.upd h0 r v)) =\n let h = get2 () in\n put2 (Map.upd h r v)", "val heap_upd (#a: Type0) (h: heap) (r: array a) (v: seq a) : GTot heap\nlet heap_upd (#a:Type0) (h:heap) (r:array a) (v:seq a) : GTot heap = Heap.upd h (as_ref r) v", "val upd\n (#t: Type)\n (a: array t)\n (#s: Ghost.erased (Seq.seq t))\n (i: US.t{US.v i < Seq.length s})\n (v: t)\n : STT unit (pts_to a P.full_perm s) (fun res -> pts_to a P.full_perm (Seq.upd s (US.v i) v))\nlet upd\n (#t: Type)\n (a: array t)\n (#s: Ghost.erased (Seq.seq t))\n (i: US.t { US.v i < Seq.length s })\n (v: t)\n: STT unit\n (pts_to a P.full_perm s)\n (fun res -> pts_to a P.full_perm (Seq.upd s (US.v i) v))\n= rewrite\n (pts_to _ _ _)\n (pts_to (| ptr_of a, (dsnd a) |) _ s);\n upd_ptr (ptr_of a) i v;\n rewrite\n (pts_to _ _ _)\n (pts_to _ _ _)", "val tags (l: P.union_typ) : Tot Type0\nlet tags (l: P.union_typ) : Tot Type0 =\n tags' l.P.fields", "val upd:\n #a:Type\n -> #len:size_nat\n -> s:lseq a len\n -> n:size_nat{n < len}\n -> x:a ->\n Tot (o:lseq a len{to_seq o == Seq.upd (to_seq s) n x /\\ index o n == x /\\ (forall (i:size_nat).\n {:pattern (index s i)} (i < len /\\ i <> n) ==> index o i == index s i)})\nlet upd #a #len s n x = Seq.upd #a s n x", "val va_upd_reg (r: reg) (v: nat64) (s: state) : state\nlet va_upd_reg (r:reg) (v:nat64) (s:state) : state = update_reg r v s", "val unstruct_field_alt\n (#opened: _)\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n (#v': Ghost.erased (sd.field_desc.fd_type field))\n (r': ref (sd.field_desc.fd_typedef field))\n : STGhost (Ghost.erased t)\n opened\n (((has_struct_field r field r') `star` (pts_to r v)) `star` (pts_to r' v'))\n (fun s' -> (has_struct_field r field r') `star` (pts_to r s'))\n (sd.get v field == unknown (sd.field_desc.fd_typedef field))\n (fun s' -> Ghost.reveal s' == set sd v field v')\nlet unstruct_field_alt\n (#opened: _)\n (#t: Type)\n (#sd: struct_def t)\n (#v: Ghost.erased t)\n (r: ref (struct_typedef sd))\n (field: field_t sd.fields)\n (#v': Ghost.erased (sd.field_desc.fd_type field))\n (r': ref (sd.field_desc.fd_typedef field))\n: STGhost (Ghost.erased t) opened\n (has_struct_field r field r' `star` pts_to r v `star` pts_to r' v')\n (fun s' -> has_struct_field r field r' `star` pts_to r s')\n (\n sd.get v field == unknown (sd.field_desc.fd_typedef field)\n )\n (fun s' -> Ghost.reveal s' == set sd v field v')\n= unstruct_field r field r';\n _", "val le_to_n_S\n (#t: Type)\n (#tot: nat)\n (#u: uinttype t tot)\n (#len: nat{len + 1 <= tot})\n (ih: le_to_n_t u len)\n : Tot (le_to_n_t u (len + 1))\nlet le_to_n_S\n (#t: Type)\n (#tot: nat)\n (#u: uinttype t tot)\n (#len: nat { len + 1 <= tot })\n (ih: le_to_n_t u len)\n: Tot (le_to_n_t u (len + 1))\n= fun x ->\n assert_norm (pow2 8 == 256);\n E.reveal_le_to_n (B.reveal x);\n pow2_le_compat (8 * tot) (8 * (len + 1));\n pow2_le_compat (8 * (len + 1)) (8 * len);\n pow2_plus (8 * len) 8;\n [@inline_let]\n let ulen = U32.uint_to_t len in\n let last = B.get x 0ul in\n let first = B.slice x 1ul (ulen `U32.add` 1ul) in\n let n = ih first in\n E.lemma_le_to_n_is_bounded (B.reveal first);\n assert (u.v n * 256 < 256 * pow2 (8 * len));\n assert (0 <= u.v n * 256);\n assert (u.v n * 256 < pow2 (8 * tot));\n let blast = u.from_byte last in\n blast `u.add` u.mul256 n", "val upd_ (#a: Type) (#len: flen) (s: ntuple a len) (i: nat{i < len}) (x: a) : ntuple_ a len\nlet rec upd_ (#a:Type) (#len:flen) (s:ntuple a len) (i:nat{i < len}) (x:a) : ntuple_ a len =\n if i = 0 then\n if len = 1 then x\n else x,rest s\n else fst s,upd_ #a #(len-1) (rest s) (i-1) x", "val id (#t: Type) (x: t) : Tot t\nlet id (#t: Type) (x: t) : Tot t = x", "val id (#t: Type) (x: t) : Tot t\nlet id\n (#t: Type)\n (x: t)\n: Tot t\n= x", "val field_t (#t: Type0) (fd: field_description_t t) : Tot eqtype\nlet field_t (#t: Type0) (fd: field_description_t t) : Tot eqtype = (s: string { fd.fd_def s })", "val field_t (#t: Type0) (fd: field_description_t t) : Tot eqtype\nlet field_t (#t: Type0) (fd: field_description_t t) : Tot eqtype = (s: string { fd.fd_def s })", "val be_to_n_S\n (#t: Type)\n (#tot: nat)\n (#u: uinttype t tot)\n (#len: nat{len + 1 <= tot})\n (ih: be_to_n_t u len)\n : Tot (be_to_n_t u (len + 1))\nlet be_to_n_S\n (#t: Type)\n (#tot: nat)\n (#u: uinttype t tot)\n (#len: nat { len + 1 <= tot })\n (ih: be_to_n_t u len)\n: Tot (be_to_n_t u (len + 1))\n= fun x ->\n assert_norm (pow2 8 == 256);\n E.reveal_be_to_n (B.reveal x);\n pow2_le_compat (8 * tot) (8 * (len + 1));\n pow2_le_compat (8 * (len + 1)) (8 * len);\n pow2_plus (8 * len) 8;\n [@inline_let]\n let ulen = U32.uint_to_t len in\n let last = B.get x ulen in\n let first = B.slice x 0ul ulen in\n let n = ih first in\n E.lemma_be_to_n_is_bounded (B.reveal first);\n assert (u.v n * 256 < 256 * pow2 (8 * len));\n assert (0 <= u.v n * 256);\n assert (u.v n * 256 < pow2 (8 * tot));\n let blast = u.from_byte last in\n blast `u.add` u.mul256 n" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_of_struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_of_struct_field'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field''" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_field'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_struct_field" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.set" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.set" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_of_union_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.dfst_struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.typ_depth_typ_of_struct_field" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.set_aux" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.set_aux" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.struct_field" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_literal" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_literal_wf" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.fun_of_list" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.union_field" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.tag_of_field'" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_field1" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.tags'" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_field" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.struct_field" }, { "project_name": "FStar", "file_name": "FStar.DependentMap.fst", "name": "FStar.DependentMap.upd" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field_matches_tag" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.upd'" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.field_of_tag'" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.gfield" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.tag_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.tag_of_field" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.raw_get_field" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_field1" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.get_field" }, { "project_name": "steel", "file_name": "Steel.ST.Array.Swap.fst", "name": "Steel.ST.Array.Swap.array_upd" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Flags.fst", "name": "Vale.X64.Flags.upd" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.define_struct" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.define_struct" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_typ_depth" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.get_value" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.upd_tot" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_t" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_t" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.field_of_tag" }, { "project_name": "FStar", "file_name": "FStar.Seq.Base.fst", "name": "FStar.Seq.Base.upd" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.update" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.raw_get_value" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.type_of_typ_struct" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Struct.fsti", "name": "Pulse.C.Types.Struct.struct_get_field_pat" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.struct_get_field_pat" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fsti", "name": "FStar.Pointer.Base.struct_create" }, { "project_name": "steel", "file_name": "Steel.Array.fsti", "name": "Steel.Array.upd" }, { "project_name": "FStar", "file_name": "Benton2004.fst", "name": "Benton2004.const" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.union_field1" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Regs.fsti", "name": "Vale.X64.Regs.upd" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.upd" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field_of_tag_of_field'" }, { "project_name": "FStar", "file_name": "GC.fst", "name": "GC.upd_map" }, { "project_name": "FStar", "file_name": "FStar.Ref.fst", "name": "FStar.Ref.upd" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.tag_of_field_of_tag'" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.field_t" }, { "project_name": "steel", "file_name": "Pulse.C.Types.UserStruct.fsti", "name": "Pulse.C.Types.UserStruct.field_t" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Map.fst", "name": "FStar.Monotonic.Map.upd" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Union.fsti", "name": "Steel.ST.C.Types.Union.union_field1" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.upd" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.upd" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.upd" }, { "project_name": "FStar", "file_name": "FStar.Map.fst", "name": "FStar.Map.upd" }, { "project_name": "FStar", "file_name": "FStar.PartialMap.fst", "name": "FStar.PartialMap.upd" }, { "project_name": "FStar", "file_name": "FStar.BufferNG.fst", "name": "FStar.BufferNG.struct_typ_supported" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Heap.fst", "name": "FStar.DM4F.Heap.upd_tot" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.field" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.v_" }, { "project_name": "FStar", "file_name": "FStar.Vector.Base.fst", "name": "FStar.Vector.Base.update" }, { "project_name": "FStar", "file_name": "ArrayRealized.fst", "name": "ArrayRealized.__update__" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Union.fsti", "name": "Steel.ST.C.Types.Union.union" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.union" }, { "project_name": "Armada", "file_name": "Spec.Map.fst", "name": "Spec.Map.upd" }, { "project_name": "everparse", "file_name": "LowParse.Low.Writers.fst", "name": "LowParse.Low.Writers.write" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Struct.fsti", "name": "Steel.ST.C.Types.Struct.unstruct_field_alt" }, { "project_name": "hacl-star", "file_name": "Vale.Lib.Map16.fsti", "name": "Vale.Lib.Map16.upd" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Union.fsti", "name": "Pulse.C.Types.Union.union_t" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Union.fsti", "name": "Steel.ST.C.Types.Union.union_t" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.upd" }, { "project_name": "FStar", "file_name": "FStar.Array.fsti", "name": "FStar.Array.heap_upd" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fsti", "name": "Steel.ST.HigherArray.upd" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fsti", "name": "FStar.TaggedUnion.tags" }, { "project_name": "hacl-star", "file_name": "Lib.Sequence.fst", "name": "Lib.Sequence.upd" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Decls.fsti", "name": "Vale.PPC64LE.Decls.va_upd_reg" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.UserStruct.fsti", "name": "Steel.ST.C.Types.UserStruct.unstruct_field_alt" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Endianness.fst", "name": "LowParse.SLow.Endianness.le_to_n_S" }, { "project_name": "hacl-star", "file_name": "Lib.NTuple.fst", "name": "Lib.NTuple.upd_" }, { "project_name": "everparse", "file_name": "EverParse3d.Prelude.fsti", "name": "EverParse3d.Prelude.id" }, { "project_name": "everparse", "file_name": "LowParse.Spec.BitSum.fst", "name": "LowParse.Spec.BitSum.id" }, { "project_name": "steel", "file_name": "Pulse.C.Types.Fields.fsti", "name": "Pulse.C.Types.Fields.field_t" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Fields.fsti", "name": "Steel.ST.C.Types.Fields.field_t" }, { "project_name": "everparse", "file_name": "LowParse.SLow.Endianness.fst", "name": "LowParse.SLow.Endianness.be_to_n_S" } ], "selected_premises": [ "FStar.Pointer.Base.struct_sel", "FStar.Pointer.Base.struct", "FStar.Pointer.Base.type_of_typ'", "FStar.Pointer.Base.type_of_typ'_eq", "FStar.Pointer.Base.buffer", "FStar.Pointer.Base.step_typ_depth", "FStar.Pervasives.Native.snd", "FStar.Pervasives.Native.fst", "FStar.Pointer.Base.npointer", "FStar.Heap.trivial_preorder", "FStar.Pointer.Base.union", "FStar.Monotonic.HyperStack.sel", "FStar.Pointer.Base.g_is_null", "FStar.Pointer.Base.gtdata", "FStar.Pointer.Base.path_typ_depth", "FStar.Pointer.Base.not_an_array_cell", "FStar.Pointer.Base.buffer_root_length", "FStar.Pointer.Base.nullptr", "FStar.Monotonic.HyperStack.live_region", "FStar.UInt.size", "FStar.Pointer.Base._union_get_key", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Pointer.Base._gtdata_get_key", "FStar.Monotonic.HyperStack.mreference", "FStar.Pervasives.dfst", "FStar.HyperStack.ST.is_eternal_region", "FStar.Monotonic.HyperStack.as_addr", "FStar.Pervasives.dsnd", "FStar.Pointer.Base.gtdata_get_value", "FStar.Pointer.Base.gtdata_create", "FStar.Monotonic.HyperStack.frameOf", "FStar.Pointer.Base.gtdata_get_key", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Mul.op_Star", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Pervasives.reveal_opaque", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.HyperStack.contains", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Int.size", "FStar.Monotonic.HyperStack.is_in", "FStar.Monotonic.HyperStack.is_above", "FStar.Heap.trivial_rel", "FStar.Preorder.preorder_rel", "FStar.ModifiesGen.loc_all_regions_from", "FStar.Monotonic.HyperHeap.modifies", "FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip", "FStar.Calc.calc_chain_related", "FStar.Monotonic.HyperStack.is_eternal_region_hs", "FStar.ModifiesGen.loc_region_only", "FStar.Monotonic.HyperHeap.disjoint", "FStar.Monotonic.HyperStack.remove_elt", "FStar.Monotonic.Heap.mref", "FStar.Set.as_set'", "FStar.Map.const_on", "FStar.Monotonic.HyperHeap.disjoint_regions", "FStar.Ghost.tot_to_gtot", "FStar.Monotonic.HyperStack.poppable", "FStar.Set.as_set", "FStar.Monotonic.HyperStack.norm_steps", "FStar.ModifiesGen.loc_disjoint_addresses", "FStar.Monotonic.HyperStack.mk_mreference", "FStar.Monotonic.HyperStack.modifies_transitively", "FStar.Monotonic.HyperStack.top_frame", "FStar.Monotonic.HyperStack.popped", "FStar.Int.op_At_Percent", "FStar.HyperStack.ST.contains_region", "FStar.UInt.max_int", "FStar.HyperStack.ST.is_freeable_heap_region", "FStar.Monotonic.Heap.set", "FStar.Set.subset", "FStar.Monotonic.HyperStack.is_eternal_region", "FStar.Pervasives.id", "FStar.Monotonic.HyperStack.mods", "FStar.Monotonic.HyperStack.mmmref", "FStar.Math.Lib.signed_modulo", "FStar.Monotonic.HyperStack.sel_tot", "FStar.Char.char_of_int", "FStar.Monotonic.HyperStack.mref", "FStar.HyperStack.ST.equal_heap_dom", "FStar.HyperStack.ref", "FStar.Monotonic.Heap.modifies", "FStar.Monotonic.HyperStack.alloc", "FStar.BitVector.logor_vec", "FStar.ModifiesGen.modifies_only_live_addresses", "FStar.Calc.calc_chain_compatible", "FStar.Monotonic.HyperStack.contains_ref_in_its_region", "FStar.Monotonic.Heap.tset", "FStar.Monotonic.HyperHeap.rid_last_component", "FStar.HyperStack.ST.equal_domains", "FStar.UInt.one_extend_vec", "FStar.Int32.n", "FStar.UInt32.n", "FStar.Monotonic.HyperStack.empty_mem", "FStar.Ghost.return", "FStar.Int.max_int", "FStar.Set.add", "FStar.Map.disjoint_dom", "FStar.ModifiesGen.loc_freed_mreference" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Pointer.Base\n\nmodule DM = FStar.DependentMap\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\n(*** Definitions *)\n\n(** Pointers to data of type t.\n\n This defines two main types:\n - `npointer (t: typ)`, a pointer that may be \"NULL\";\n - `pointer (t: typ)`, a pointer that cannot be \"NULL\"\n (defined as a refinement of `npointer`).\n\n `nullptr #t` (of type `npointer t`) represents the \"NULL\" value.\n*)\n\n#set-options \"--initial_fuel 1 --initial_ifuel 1 --max_fuel 1 --max_ifuel 1\"\n\ntype step: (from: typ) -> (to: typ) -> Tot Type0 =\n | StepField:\n (l: struct_typ) ->\n (fd: struct_field l) ->\n step (TStruct l) (typ_of_struct_field l fd)\n | StepUField:\n (l: union_typ) ->\n (fd: struct_field l) ->\n step (TUnion l) (typ_of_struct_field l fd)\n | StepCell:\n (length: UInt32.t) ->\n (value: typ) ->\n (index: UInt32.t { UInt32.v index < UInt32.v length } ) ->\n step (TArray length value) value\n\ntype path (from: typ) : (to: typ) -> Tot Type0 =\n | PathBase:\n path from from\n | PathStep:\n (through: typ) ->\n (to: typ) ->\n (p: path from through) ->\n (s: step through to) ->\n path from to\n\nlet step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()\n\nlet rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s\n\n(*\nprivate\nlet not_cell\n (#from #to: typ)\n (p: path from to)\n: GTot bool\n= match p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nprivate type array_path (from: typ) (to_elem: typ) : (length: UInt32.t) -> Tot Type0 =\n| PSingleton:\n (p: path from to_elem { not_cell p } ) ->\n array_path from to_elem 1ul\n| PArray:\n length: UInt32.t ->\n path from (TArray length to_elem) ->\n array_path from to_elem length\n\nprivate let path' (from: typ) (to: typ) : Tot Type0 =\n if TArray? to\n then\n let length = TArray?.length to in\n (array_path from (TArray?.t to) length * (offset: UInt32.t & (length': UInt32.t {UInt32.v offset + UInt32.v length' <= UInt32.v length})))\n else path from to\n*)\n\nnoeq type _npointer (to : typ): Type0 =\n | Pointer:\n (from: typ) ->\n (contents: HS.aref) ->\n (p: path from to) ->\n _npointer to\n | NullPtr\n\nlet npointer (t: typ): Tot Type0 =\n _npointer t\n\n(** The null pointer *)\n\nlet nullptr (#t: typ): Tot (npointer t) = NullPtr\n\nlet g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false\n\nlet g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()\n\n(** Buffers *)\n\nlet not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nnoeq type buffer_root (t: typ) =\n| BufferRootSingleton:\n (p: pointer t { not_an_array_cell p } ) ->\n buffer_root t\n| BufferRootArray:\n (#max_length: array_length_t) ->\n (p: pointer (TArray max_length t)) ->\n buffer_root t\n\nlet buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len\n\nnoeq type _buffer (t: typ) =\n| Buffer:\n (broot: buffer_root t) ->\n (bidx: UInt32.t) ->\n (blength: UInt32.t { UInt32.v bidx + UInt32.v blength <= UInt32.v (buffer_root_length broot) } ) ->\n _buffer t\nlet buffer (t: typ): Tot Type0 = _buffer t\n\n(** Helper for the interpretation of unions.\n\n A C union is interpreted as a dependent pair of a key and a value (which\n depends on the key). The intent is for the key to be ghost, as it will not\n exist at runtime (C unions are untagged).\n\n Therefore,\n - `gtdata_get_key` (defined below) is in `GTot`, and\n - `gtdata_get_value` asks for the key `k` to read, and a proof that `k`\n matches the ghost key.\n*)\n\nlet gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )\n\nlet _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u\n\nlet gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u\n\nlet gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v\n\nlet gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)\n\nlet gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()\n\n(* Interprets a type code (`typ`) as a FStar type (`Type0`). *)\nlet rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\n\nlet rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()\n\n(** Interpretation of unions, as ghostly-tagged data\n (see `gtdata` for more information).\n*)\nlet _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v\n\nlet struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f\n", "sketch": [ "The `struct_upd` function takes a struct `s`, a field `f`, and a new value `v`. It creates a new struct with the same fields as `s`, but with the field `f` updated to the new value `v`.\n\n```fstar\nlet struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f)\n : Tot (struct l) =\n let updated_field = DM.upd s f v in\n updated_field\n```" ], "generated_solution": [] }, { "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.i_restricted_g_t", "opens_and_abbrevs": [ { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "", "source_definition": "let i_restricted_g_t = F.restricted_g_t", "source_range": { "start_line": 37, "start_col": 0, "end_line": 37, "end_col": 39 }, "interleaved": false, "definition": "FStar.FunctionalExtensionality.restricted_g_t", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "FStar.FunctionalExtensionality.restricted_g_t" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": true, "is_type": true, "type": "a: Type -> b: (_: a -> Type) -> Type", "prompt": "let i_restricted_g_t =\n ", "expected_response": "F.restricted_g_t", "source": { "project_name": "FStar", "file_name": "ulib/FStar.ModifiesGen.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.ModifiesGen.fst", "checked_file": "dataset/FStar.ModifiesGen.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Tactics.SMT.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.GSet.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "aloc", "ALoc", "ALoc", "ALoc", "aloc_t", "region", "region", "addr", "addr", "loc", "loc", "cls", "Cls", "Cls", "Cls", "aloc_includes", "aloc_includes", "let aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))" ], "closest": [ "val FStar.FunctionalExtensionality.restricted_g_t = a: Type -> b: (_: a -> Type) -> Type\nlet restricted_g_t (a: Type) (b: (a -> Type)) = f: arrow_g a b {is_restricted_g a f}", "val FStar.FunctionalExtensionality.restricted_t = a: Type -> b: (_: a -> Type) -> Type\nlet restricted_t (a: Type) (b: (a -> Type)) = f: arrow a b {is_restricted a f}", "val FStar.FunctionalExtensionality.is_restricted_g = a: Type -> f: FStar.FunctionalExtensionality.arrow_g a b -> Prims.logical\nlet is_restricted_g (a: Type) (#b: (a -> Type)) (f: arrow_g a b) = on_domain_g a f == f", "val FStar.FunctionalExtensionality.is_restricted = a: Type -> f: FStar.FunctionalExtensionality.arrow a b -> Prims.logical\nlet is_restricted (a: Type) (#b: (a -> Type)) (f: arrow a b) = on_domain a f == f", "val FStar.FunctionalExtensionality.arrow_g = a: Type -> b: (_: a -> Type) -> Type\nlet arrow_g (a: Type) (b: (a -> Type)) = x: a -> GTot (b x)", "val FStar.FunctionalExtensionality.efun_g = a: Type -> b: (_: a -> Type) -> Type\nlet efun_g (a: Type) (b: (a -> Type)) = arrow_g a b", "val FStar.ST.gst_post = a: Type -> Type\nlet gst_post (a:Type) = st_post_h heap a", "val FStar.ST.gst_wp = a: Type -> Type\nlet gst_wp (a:Type) = st_wp_h heap a", "val FStar.FunctionalExtensionality.arrow = a: Type -> b: (_: a -> Type) -> Type\nlet arrow (a: Type) (b: (a -> Type)) = x: a -> Tot (b x)", "val FStar.ST.gst_post' = a: Type -> pre: Type -> Type\nlet gst_post' (a:Type) (pre:Type) = st_post_h' heap a pre", "val FStar.ReflexiveTransitiveClosure.binrel = a: Type -> Type\nlet binrel (a:Type) = a -> a -> Type", "val FStar.FunctionalExtensionality.efun = a: Type -> b: (_: a -> Type) -> Type\nlet efun (a: Type) (b: (a -> Type)) = arrow a b", "val FStar.ST.st_post = a: Type -> Type\nlet st_post = gst_post", "val FStar.Tactics.Effect.tac = a: Type -> b: Type -> Type\nlet tac a b = a -> Tac b", "val FStar.WellFounded.well_founded_relation = a: Type -> Type\nlet well_founded_relation (a:Type) = rel:binrel a{is_well_founded rel}", "val FStar.Pervasives.ex_post = a: Type -> Type\nlet ex_post (a: Type) = ex_post' a True", "val FStar.HyperStack.ST.gst_wp = a: Type -> Type\nlet gst_wp (a:Type) = st_wp_h mem a", "val FStar.DM4F.IFC.ifc = a: Type -> Type\nlet ifc (a:Type) = label -> M (option (a * label))", "val FStar.ReflexiveTransitiveClosure.predicate = a: Type -> Type\nlet predicate (a:Type u#a) = a -> Type0", "val FStar.DM4F.MonadLaws.ifc = a: Type -> Type\nlet ifc (a:Type) = label -> Tot (option (a * label))", "val FStar.HyperStack.ST.gst_post = a: Type -> Type\nlet gst_post (a:Type) = st_post_h mem a", "val FStar.PredicateExtensionality.predicate = a: Type -> Type\nlet predicate (a:Type) = a -> Tot prop", "val FStar.Stubs.Tactics.V2.Builtins.ret_t = a: Type -> Type\nlet ret_t (a:Type) = option a & issues", "val FStar.ST.st_wp = a: Type -> Type\nlet st_wp = gst_wp", "val FStar.Monotonic.DependentMap.partial_dependent_map = a: Prims.eqtype -> b: (_: a -> Type) -> Type\nlet partial_dependent_map (a:eqtype) (b:a -> Type) =\n DM.t a (opt b)", "val FStar.HyperStack.ST.gst_post' = a: Type -> pre: Type -> Type\nlet gst_post' (a:Type) (pre:Type) = st_post_h' mem a pre", "val FStar.Relational.Comp.st2_Post = a: Type -> Type\nlet st2_Post (a:Type) = st_post_h heap2 a", "val FStar.DM4F.IntST.wp = a: Type -> Type\nlet wp = STINT?.wp", "val FStar.ST.st_post' = a: Type -> pre: Type -> Type\nlet st_post' = gst_post'", "val FStar.DM4F.StExn.stexn = a: Type -> Type\nlet stexn a =\n int -> M (option a * int)", "val FStar.DM4F.Id.id = a: Type -> Type\nlet id (a:Type) = unit -> M a", "val FStar.Pervasives.ex_post' = a: Type -> pre: Type -> Type\nlet ex_post' (a pre: Type) = _: result a {pre} -> GTot Type0", "val FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater = a: Type -> b: Type -> Type\nlet op_Hat_Subtraction_Greater_Greater (a b: Type) = restricted_g_t a (fun _ -> b)", "val FStar.WellFounded.binrel = a: Type -> Type\nlet binrel (a:Type) = a -> a -> Type", "val FStar.DM4F.IntST.post = a: Type -> Type\nlet post = STINT?.post", "val FStar.Relational.Comp.st2_WP = a: Type -> Type\nlet st2_WP (a:Type) = st_wp_h heap2 a", "val FStar.DM4F.StExnC.stexnc = a: Type -> Type\nlet stexnc a =\n int -> M (option a * (int * int))", "val FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater = a: Type -> b: Type -> Type\nlet op_Hat_Subtraction_Greater (a b: Type) = restricted_t a (fun _ -> b)", "val FStar.ST.lift_gst_state = a: Type -> wp: FStar.ST.gst_wp a -> FStar.ST.gst_wp a\nlet lift_gst_state (a:Type) (wp:gst_wp a) = wp", "val FStar.HyperStack.ref = a: Type0 -> Type0\nlet ref (a:Type) = mref a (Heap.trivial_preorder a)", "val FStar.All.all_post = a: Type -> Type\nlet all_post (a : Type) = all_post_h heap a", "val FStar.DM4F.ST.st = s: Type -> a: Type -> Type\nlet st (s:Type) (a:Type) = s -> M (a * s)", "val FStar.PCM.symrel = a: Type -> Type\nlet symrel (a: Type u#a) = c:(a -> a -> prop) { (forall x y. c x y <==> c y x) }", "val FStar.DM4F.IntST.repr = a: Type -> wp_a: (_: Prims.int -> _: (_: (a * Prims.int) -> Type0) -> Type0) -> Type\nlet repr = STINT?.repr", "val FStar.HyperStack.mmref = a: Type0 -> Type0\nlet mmref (a:Type) = mmmref a (Heap.trivial_preorder a)", "val FStar.Pervasives.ex_wp = a: Type -> Type\nlet ex_wp (a: Type) = ex_post a -> GTot ex_pre", "val FStar.MRef.spred = rel: FStar.Preorder.preorder a -> Type\nlet spred (#a:Type) (rel:preorder a) = p:(a -> Type){Preorder.stable p rel}", "val FStar.DM4F.ExnSt.stint = a: Type -> Type\nlet stint (a:Type)= FStar.DM4F.ST.st int a", "val FStar.Relational.Comp.st2_Post' = a: Type -> pre: Type -> Type\nlet st2_Post' (a:Type) (pre:Type) = st_post_h' heap2 a pre", "val FStar.List.Tot.Properties.llist = a: Type -> n: Prims.nat -> Type\nlet llist a (n:nat) = l:list a {length l = n}", "val FStar.Tactics.CanonCommMonoidSimple.amap = a: Type -> Type\nlet amap (a:Type) = list (atom * a) * a", "val FStar.DM4F.IntStoreFixed.wp = a: Type -> Type\nlet wp = INT_STORE?.wp", "val FStar.Tactics.Effect.tactic = a: Type -> Type0\nlet tactic a = tac unit a", "val FStar.Tactics.CanonCommMonoid.vmap = a: Type -> b: Type -> Type\nlet vmap (a b:Type) = list (var * (a*b)) * (a * b)", "val FStar.HyperStack.ST.st_post = a: Type -> Type\nlet st_post = gst_post", "val FStar.DM4F.ExnSt.exnst = a: Type -> Type\nlet exnst a = int -> M (option (a * int))", "val FStar.HyperStack.stackref = a: Type0 -> Type0\nlet stackref (a:Type) = mstackref a (Heap.trivial_preorder a)", "val FStar.All.all_post' = a: Type -> pre: Type -> Type\nlet all_post' (a : Type) (pre:Type) = all_post_h' heap a pre", "val FStar.HyperStack.ST.lift_gst_state = a: Type -> wp: FStar.HyperStack.ST.gst_wp a -> FStar.HyperStack.ST.gst_wp a\nlet lift_gst_state (a:Type) (wp:gst_wp a) = wp", "val FStar.Monotonic.Seq.i_seq = r: FStar.Monotonic.Seq.rid -> a: Type0 -> p: (_: FStar.Seq.Base.seq a -> Type) -> Type0\nlet i_seq (r:rid) (a:Type) (p:seq a -> Type) = m_rref r (s:seq a{p s}) (grows_p p)", "val FStar.All.all_wp = a: Type -> Type\nlet all_wp (a : Type) = all_wp_h heap a", "val FStar.Monotonic.DependentMap.opt = b: (_: a -> Type) -> x: a -> Type\nlet opt (#a:eqtype) (b:a -> Type) = fun (x:a) -> option (b x)", "val FStar.Tactics.PatternMatching.pm_goal = a: Type -> Prims.eqtype\nlet pm_goal (a: Type) = unit", "val FStar.DM4F.MonadLaws.st = s: Type -> a: Type -> Type\nlet st (s:Type) (a:Type) = s -> Tot (a * s)", "val FStar.Reflection.V2.Arith.tm = a: Type -> Type0\nlet tm a = st -> Tac (either string (a * st))", "val FStar.DM4F.IntStoreFixed.post = a: Type -> Type\nlet post = INT_STORE?.post", "val FStar.HyperStack.All.all_post = a: Type -> Type\nlet all_post (a:Type) = all_post_h HyperStack.mem a", "val FStar.HyperStack.ST.st_wp = a: Type -> Type\nlet st_wp = gst_wp", "val FStar.HyperStack.mmstackref = a: Type0 -> Type0\nlet mmstackref (a:Type) = mmmstackref a (Heap.trivial_preorder a)", "val Util.Relation.relation_t = a: Type -> b: Type -> Type\nlet relation_t (a: Type) (b: Type) = a -> b -> GTot bool", "val FStar.TwoLevelHeap.st_post = a: Type -> Type\nlet st_post (a:Type) = st_post_h t a", "val FStar.Monotonic.Heap.tset = a: Type -> Type\nlet tset = TSet.set", "val FStar.Tactics.CanonCommMonoid.permute = b: Type -> Type\nlet permute (b:Type) = a:Type -> vmap a b -> list var -> list var", "val FStar.DM4F.Exceptions.ex = a: Type -> Type\nlet ex (a:Type) = unit -> M (either a exn)", "val FStar.Tactics.CanonCommMonoidSimple.Equiv.amap = a: Type -> Type\nlet amap (a:Type) = list (atom * a) * a", "val LowStar.Lens.get_t = a: Type -> b: Type -> Type\nlet get_t a b = a -> GTot b", "val FStar.Monotonic.HyperStack.mref = a: Type0 -> rel: FStar.Preorder.preorder a -> Type0\nlet mref (a:Type) (rel:preorder a) =\n s:mreference a rel{ is_eternal_region_hs (frameOf s) && not (is_mm s) }", "val FStar.Monotonic.HyperStack.mreference = a: Type0 -> rel: FStar.Preorder.preorder a -> Type0\nlet mreference a rel = mreference' a rel", "[@@ FStar.Tactics.Typeclasses.tcinstance]\nval is (a: Type) (i1 i2: c a) : c (s a)\ninstance is (a:Type) (i1 : c a) (i2 : c a) : c (s a) = { x = Y }", "val FStar.TwoLevelHeap.st_wp = a: Type -> Type\nlet st_wp (a:Type) = st_wp_h t a", "val FStar.HyperStack.All.all_wp = a: Type -> Type\nlet all_wp (a:Type) = all_wp_h HyperStack.mem a", "val FStar.MRef.p_pred = r: FStar.ST.mref a b -> p: (_: a -> Type0) -> h: FStar.Monotonic.Heap.heap -> Prims.logical\nlet p_pred (#a:Type) (#b:preorder a) (r:mref a b) (p:(a -> Type))\n = fun h -> h `contains` r /\\ p (sel h r)", "val FStar.HyperStack.ST.st_post' = a: Type -> pre: Type -> Type\nlet st_post' = gst_post'", "val FStar.Monotonic.DependentMap.t = \n r: FStar.HyperStack.ST.erid ->\n a: Prims.eqtype ->\n b: (_: a -> Type0) ->\n inv: (_: FStar.DependentMap.t a (FStar.Monotonic.DependentMap.opt b) -> Type)\n -> Type0\nlet t (r:HST.erid) (a:eqtype) (b:a -> Type) (inv:DM.t a (opt b) -> Type) =\n m_rref r (imap a b inv) grows", "val FStar.Monotonic.DependentMap.imap = \n a: Prims.eqtype ->\n b: (_: a -> Type) ->\n inv: (_: FStar.DependentMap.t a (FStar.Monotonic.DependentMap.opt b) -> Type)\n -> Type\nlet imap (a:eqtype) (b: a -> Type) (inv:DM.t a (opt b) -> Type) =\n r:map a b{inv (repr r)}", "val Lib.LoopCombinators.fixed_a = a: Type -> i: Prims.nat -> Type\nlet fixed_a (a:Type) (i:nat) = a", "val FStar.InteractiveHelpers.ParseTest.test5 = a: Type0 -> Type0\nlet test5 a =\n f1 #(list a)", "val FStar.InteractiveHelpers.ExploreTerm.explorer = a: Type -> Type\nlet explorer (a : Type) =\n a -> genv -> list (genv & term_view) -> option typ_or_comp -> term_view ->\n Tac (a & ctrl_flag)", "val FStar.Pervasives.st_post_h = heap: Type -> a: Type -> Type\nlet st_post_h (heap a: Type) = st_post_h' heap a True", "val modifies_1_preserves_mreferences\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n (h1 h2: HS.mem)\n : GTot Type0\nlet modifies_1_preserves_mreferences (#a:Type0) (#rrel:srel a) (#rel:srel a) (b:mbuffer a rrel rel) (h1 h2:HS.mem)\n :GTot Type0\n = forall (a':Type) (pre:Preorder.preorder a') (r':HS.mreference a' pre).\n ((frameOf b <> HS.frameOf r' \\/ as_addr b <> HS.as_addr r') /\\ h1 `HS.contains` r') ==>\n (h2 `HS.contains` r' /\\ HS.sel h1 r' == HS.sel h2 r')", "val FStar.Tactics.PatternMatching.hyp = a: Type -> Type0\nlet hyp (a: Type) = binding", "val FStar.Int128.op_Star_Hat = a: FStar.Int128.t -> b: FStar.Int128.t -> Prims.Pure FStar.Int128.t\nlet op_Star_Hat = mul", "val MRefST.st = a: Type -> Type\nlet st (a: Type) = heap -> M (a * heap)", "val Sec1.GST.gst = a: Type -> t: Sec1.GST.tag -> Type\nlet gst (a:Type) (t:tag) =\n match t with\n | R -> (state -> a)\n | RW -> (state -> a * state)", "val FStar.Tactics.Effect.tac_repr = a: Type -> wp: FStar.Tactics.Effect.tac_wp_t a -> Type0\nlet tac_repr (a:Type) (wp:tac_wp_t a) =\n ps0:proofstate -> DIV (__result a) (as_pure_wp (wp ps0))", "[@@ FStar.Tactics.Typeclasses.tcinstance]\nval n_arrow_arr (a b: Type) {| _: n_arrows_t b |} : n_arrows_t (a -> b)\ninstance n_arrow_arr (a b : Type) {| _ : n_arrows_t b |} : n_arrows_t (a -> b) = {ff=1 + n_arrows b}", "val on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b)\nlet on_g (a #b: Type) (f: (a -> GTot b)) : (a ^->> b) = on_dom_g a f", "val FStar.Tactics.CanonCommSemiring.vmap = a: Type -> Type\nlet vmap a = list (var * a) * a", "val Lib.Buffer.modifies1 = \n b: Lib.Buffer.buffer_t Lib.Buffer.MUT a ->\n h1: FStar.Monotonic.HyperStack.mem ->\n h2: FStar.Monotonic.HyperStack.mem\n -> Type0\nlet modifies1 (#a:Type0) (b:buffer_t MUT a) (h1 h2:HS.mem) =\n modifies (loc b) h1 h2", "val FStar.Pervasives.all_post_h = h: Type -> a: Type -> Type\nlet all_post_h (h a: Type) = all_post_h' h a True" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.restricted_g_t" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.restricted_t" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.is_restricted_g" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.is_restricted" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.arrow_g" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.efun_g" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.gst_post" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.gst_wp" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.arrow" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.gst_post'" }, { "project_name": "FStar", "file_name": "FStar.ReflexiveTransitiveClosure.fsti", "name": "FStar.ReflexiveTransitiveClosure.binrel" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.efun" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_post" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.tac" }, { "project_name": "FStar", "file_name": "FStar.WellFounded.fst", "name": "FStar.WellFounded.well_founded_relation" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.ex_post" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.gst_wp" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IFC.fst", "name": "FStar.DM4F.IFC.ifc" }, { "project_name": "FStar", "file_name": "FStar.ReflexiveTransitiveClosure.fsti", "name": "FStar.ReflexiveTransitiveClosure.predicate" }, { "project_name": "FStar", "file_name": "FStar.DM4F.MonadLaws.fst", "name": "FStar.DM4F.MonadLaws.ifc" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.gst_post" }, { "project_name": "FStar", "file_name": "FStar.PredicateExtensionality.fst", "name": "FStar.PredicateExtensionality.predicate" }, { "project_name": "FStar", "file_name": "FStar.Stubs.Tactics.V2.Builtins.fsti", "name": "FStar.Stubs.Tactics.V2.Builtins.ret_t" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_wp" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fsti", "name": "FStar.Monotonic.DependentMap.partial_dependent_map" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.gst_post'" }, { "project_name": "FStar", "file_name": "FStar.Relational.Comp.fst", "name": "FStar.Relational.Comp.st2_Post" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.wp" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.st_post'" }, { "project_name": "FStar", "file_name": "FStar.DM4F.StExn.fst", "name": "FStar.DM4F.StExn.stexn" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Id.fst", "name": "FStar.DM4F.Id.id" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.ex_post'" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater" }, { "project_name": "FStar", "file_name": "FStar.WellFounded.fst", "name": "FStar.WellFounded.binrel" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.post" }, { "project_name": "FStar", "file_name": "FStar.Relational.Comp.fst", "name": "FStar.Relational.Comp.st2_WP" }, { "project_name": "FStar", "file_name": "FStar.DM4F.StExnC.fst", "name": "FStar.DM4F.StExnC.stexnc" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater" }, { "project_name": "FStar", "file_name": "FStar.ST.fst", "name": "FStar.ST.lift_gst_state" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.ref" }, { "project_name": "FStar", "file_name": "FStar.All.fst", "name": "FStar.All.all_post" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ST.fst", "name": "FStar.DM4F.ST.st" }, { "project_name": "FStar", "file_name": "FStar.PCM.fst", "name": "FStar.PCM.symrel" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntST.fst", "name": "FStar.DM4F.IntST.repr" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.mmref" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.ex_wp" }, { "project_name": "FStar", "file_name": "FStar.MRef.fsti", "name": "FStar.MRef.spred" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ExnSt.fst", "name": "FStar.DM4F.ExnSt.stint" }, { "project_name": "FStar", "file_name": "FStar.Relational.Comp.fst", "name": "FStar.Relational.Comp.st2_Post'" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.llist" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.amap" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntStoreFixed.fst", "name": "FStar.DM4F.IntStoreFixed.wp" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.tactic" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.vmap" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.st_post" }, { "project_name": "FStar", "file_name": "FStar.DM4F.ExnSt.fst", "name": "FStar.DM4F.ExnSt.exnst" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.stackref" }, { "project_name": "FStar", "file_name": "FStar.All.fst", "name": "FStar.All.all_post'" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.lift_gst_state" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Seq.fst", "name": "FStar.Monotonic.Seq.i_seq" }, { "project_name": "FStar", "file_name": "FStar.All.fst", "name": "FStar.All.all_wp" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fsti", "name": "FStar.Monotonic.DependentMap.opt" }, { "project_name": "FStar", "file_name": "FStar.Tactics.PatternMatching.fst", "name": "FStar.Tactics.PatternMatching.pm_goal" }, { "project_name": "FStar", "file_name": "FStar.DM4F.MonadLaws.fst", "name": "FStar.DM4F.MonadLaws.st" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.Arith.fst", "name": "FStar.Reflection.V2.Arith.tm" }, { "project_name": "FStar", "file_name": "FStar.DM4F.IntStoreFixed.fst", "name": "FStar.DM4F.IntStoreFixed.post" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.All.fst", "name": "FStar.HyperStack.All.all_post" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.st_wp" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.fst", "name": "FStar.HyperStack.mmstackref" }, { "project_name": "Armada", "file_name": "Util.Relation.fst", "name": "Util.Relation.relation_t" }, { "project_name": "FStar", "file_name": "FStar.TwoLevelHeap.fst", "name": "FStar.TwoLevelHeap.st_post" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fsti", "name": "FStar.Monotonic.Heap.tset" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoid.fst", "name": "FStar.Tactics.CanonCommMonoid.permute" }, { "project_name": "FStar", "file_name": "FStar.DM4F.Exceptions.fst", "name": "FStar.DM4F.Exceptions.ex" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.fst", "name": "FStar.Tactics.CanonCommMonoidSimple.Equiv.amap" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.get_t" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.mref" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fsti", "name": "FStar.Monotonic.HyperStack.mreference" }, { "project_name": "FStar", "file_name": "Big.fst", "name": "Big.is" }, { "project_name": "FStar", "file_name": "FStar.TwoLevelHeap.fst", "name": "FStar.TwoLevelHeap.st_wp" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.All.fst", "name": "FStar.HyperStack.All.all_wp" }, { "project_name": "FStar", "file_name": "FStar.MRef.fst", "name": "FStar.MRef.p_pred" }, { "project_name": "FStar", "file_name": "FStar.HyperStack.ST.fsti", "name": "FStar.HyperStack.ST.st_post'" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fsti", "name": "FStar.Monotonic.DependentMap.t" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.DependentMap.fsti", "name": "FStar.Monotonic.DependentMap.imap" }, { "project_name": "hacl-star", "file_name": "Lib.LoopCombinators.fsti", "name": "Lib.LoopCombinators.fixed_a" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ParseTest.fst", "name": "FStar.InteractiveHelpers.ParseTest.test5" }, { "project_name": "FStar", "file_name": "FStar.InteractiveHelpers.ExploreTerm.fst", "name": "FStar.InteractiveHelpers.ExploreTerm.explorer" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.st_post_h" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_1_preserves_mreferences" }, { "project_name": "FStar", "file_name": "FStar.Tactics.PatternMatching.fst", "name": "FStar.Tactics.PatternMatching.hyp" }, { "project_name": "FStar", "file_name": "FStar.Int128.fsti", "name": "FStar.Int128.op_Star_Hat" }, { "project_name": "FStar", "file_name": "MRefST.fst", "name": "MRefST.st" }, { "project_name": "FStar", "file_name": "Sec1.GST.fst", "name": "Sec1.GST.gst" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.tac_repr" }, { "project_name": "FStar", "file_name": "NArrows.fst", "name": "NArrows.n_arrow_arr" }, { "project_name": "FStar", "file_name": "FStar.FunctionalExtensionality.fsti", "name": "FStar.FunctionalExtensionality.on_g" }, { "project_name": "FStar", "file_name": "FStar.Tactics.CanonCommSemiring.fst", "name": "FStar.Tactics.CanonCommSemiring.vmap" }, { "project_name": "hacl-star", "file_name": "Lib.Buffer.fsti", "name": "Lib.Buffer.modifies1" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.all_post_h" } ], "selected_premises": [ "FStar.Reflection.V2.Data.var", "FStar.FunctionalExtensionality.feq", "FStar.Tactics.SMT.get_rlimit", "FStar.FunctionalExtensionality.on_dom", "FStar.Tactics.SMT.get_initial_fuel", "FStar.Tactics.V2.Builtins.ret_t", "FStar.Tactics.SMT.get_max_fuel", "FStar.Tactics.Effect.raise", "FStar.Heap.trivial_preorder", "FStar.Sealed.Inhabited.seal", "FStar.Pervasives.reveal_opaque", "FStar.Tactics.SMT.get_initial_ifuel", "FStar.Tactics.SMT.get_max_ifuel", "FStar.Pervasives.Native.fst", "FStar.Reflection.V2.Data.ppname_t", "FStar.Pervasives.Native.snd", "FStar.Monotonic.HyperStack.live_region", "FStar.Tactics.SMT.smt_sync", "FStar.Monotonic.HyperStack.sel", "FStar.HyperStack.ST.is_eternal_region", "FStar.Reflection.Const.cons_qn", "FStar.Tactics.Types.issues", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Tactics.SMT.smt_sync'", "FStar.Reflection.Const.squash_qn", "FStar.FunctionalExtensionality.on_dom_g", "FStar.Reflection.Const.nil_qn", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Tactics.SMT.set_rlimit", "FStar.Tactics.SMT.set_fuel", "FStar.Sealed.Inhabited.sealed", "FStar.Tactics.SMT.set_max_fuel", "FStar.Tactics.SMT.set_initial_fuel", "FStar.Monotonic.HyperStack.mreference", "FStar.FunctionalExtensionality.on", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Tactics.SMT.set_ifuel", "FStar.ModifiesGen.aloc_domain", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.Reflection.Const.prop_qn", "FStar.Tactics.Effect.get", "FStar.Pervasives.dfst", "FStar.Reflection.V2.Data.as_ppname", "FStar.Pervasives.dsnd", "FStar.Reflection.Const.string_lid", "FStar.Tactics.SMT.set_max_ifuel", "FStar.Tactics.SMT.set_initial_ifuel", "FStar.Monotonic.HyperStack.is_eternal_region_hs", "FStar.Sealed.Inhabited.sealed_", "FStar.FunctionalExtensionality.restricted_t", "FStar.Sealed.Inhabited.is_sealed", "FStar.Monotonic.HyperStack.as_addr", "FStar.Reflection.Const.unit_lid", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Reflection.Const.or_qn", "FStar.FunctionalExtensionality.feq_g", "FStar.Monotonic.HyperStack.is_eternal_region", "FStar.Reflection.Const.eq2_qn", "FStar.Monotonic.HyperStack.frameOf", "FStar.Reflection.Const.mktuple8_qn", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Reflection.Const.mult_qn", "FStar.HyperStack.ST.is_freeable_heap_region", "FStar.Monotonic.HyperStack.modifies_one", "FStar.FunctionalExtensionality.arrow", "FStar.Reflection.Const.imp_qn", "FStar.FunctionalExtensionality.is_restricted_g", "FStar.Reflection.Const.mult'_qn", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.FunctionalExtensionality.is_restricted", "FStar.Reflection.Const.and_qn", "FStar.HyperStack.ST.contains_region", "FStar.Ghost.tot_to_gtot", "FStar.FunctionalExtensionality.on_g", "FStar.Reflection.Const.eq1_qn", "FStar.Reflection.Const.bool_lid", "FStar.Reflection.Const.b2t_qn", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Monotonic.HyperStack.is_in", "FStar.Reflection.Const.forall_qn", "FStar.Reflection.Const.mktuple7_qn", "FStar.Reflection.Const.mod_qn", "FStar.Reflection.Const.lsub_qn", "FStar.Reflection.Const.neg_qn", "FStar.Monotonic.HyperStack.is_wf_with_ctr_and_tip", "FStar.Reflection.Const.mktuple3_qn", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Tactics.Effect.tactic", "FStar.Reflection.Const.add_qn", "FStar.Reflection.Const.mktuple4_qn", "FStar.Reflection.Const.mktuple6_qn", "FStar.Monotonic.Pure.is_monotonic", "FStar.HyperStack.ST.contained_region", "FStar.Monotonic.HyperHeap.disjoint", "FStar.Monotonic.HyperStack.contains", "FStar.Reflection.Const.mktuple5_qn", "FStar.Pervasives.ex_pre", "FStar.Issue.mk_issue", "FStar.Universe.lift_codom" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.ModifiesGen\n\n#set-options \"--split_queries no\"\n#set-options \"--using_facts_from '*,-FStar.Tactics,-FStar.Reflection,-FStar.List'\"\n\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\nnoeq\ntype aloc (#al: aloc_t) (c: cls al) = | ALoc:\n (region: HS.rid) ->\n (addr: nat) ->\n (loc: option (al region addr)) ->\n aloc c\n\nlet aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))\n\nmodule F = FStar.FunctionalExtensionality\n\n[@@(unifier_hint_injective)]", "sketch": [ "The definition `i_restricted_g_t` is a type that takes two type parameters `a` and `b`. It represents a type that is parameterized by a function from `a` to another type.\n\nStep 1: The definition represents a type that is restricted by a function from type `a` to another type `b`.\n\nStep 2: The implementation involves defining a type that takes two type parameters and represents a type that is restricted by a function from type `a` to type `b`.", "The definition `i_restricted_g_t` is a type that takes two type parameters `a` and `b`. It represents a type that depends on a value of type `a` and a function that takes a value of type `a` and returns a type.\n\nStep 1: The `i_restricted_g_t` type represents a type that depends on a value of type `a` and a function that takes a value of type `a` and returns a type.\n\nStep 2: The implementation of `i_restricted_g_t` involves defining a type that takes two type parameters `a` and `b`, representing a type that depends on a value of type `a` and a function that takes a value of type `a` and returns a type.", "The implementation of the definition `i_restricted_g_t` is a simple type definition that takes two type parameters `a` and `b` and returns a type.", "The implementation of the definition involves creating a dependent function type that takes a value of type `a` and returns a type based on the result of applying the function `b` to the input value. The result type is restricted by a predicate.", "The definition is implemented by creating a type `i_restricted_g_t` that takes two type parameters `a` and `b`, and represents a restricted dependent function type where the result type depends on the input value.", "The definition `i_restricted_g_t` is a dependent type that takes two arguments `a` and `b`. It represents a type that depends on a value of type `a` and a function that takes a value of type `a` and returns a type.\n\nStep 1: The definition `i_restricted_g_t` represents a dependent type that is parameterized by a type `a` and a function that takes a value of type `a` and returns a type.\n\nStep 2: The implementation of the definition involves using dependent types to represent the type that depends on the value of type `a` and the function that takes a value of type `a` and returns a type.", "The definition `i_restricted_g_t` represents a dependent type that takes a type `a` and a function `_` that maps values of type `a` to types. \n\nStep 1: The definition represents a dependent type that is parameterized by a type `a` and a function that maps values of type `a` to types.\n\nStep 2: The implementation involves defining the dependent type `i_restricted_g_t` with the specified parameters `a` and `b`.", "The definition `i_restricted_g_t` is a type that takes two type parameters `a` and `b`. It represents a type that is parameterized by a function from `a` to another type.\n\nStep 1: The definition represents a type that is parameterized by a function from type `a` to another type.\n\nStep 2: The implementation involves defining a type with two type parameters `a` and `b`, where `b` is a function from `a` to another type.", "The implementation of the definition involves creating a dependent function type that takes a value of type `a` and returns a type based on the input value, restricted by the predicate defined by the function `b`.", "The implementation of the definition involves defining a type `i_restricted_g_t` that takes two type parameters `a` and `b`. The second parameter `b` is a function that takes a value of type `a` and returns a type. The implementation should ensure that the result type depends on the input value and is restricted to a certain condition." ], "generated_solution": [ "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type", "val i_restricted_g_t : a: Type -> b: (_: a -> Type) -> Type" ] }, { "file_name": "GenericPartialDM4A.fst", "name": "GenericPartialDM4A.iw_bind", "opens_and_abbrevs": [ { "open": "FStar.Preorder" }, { "abbrev": "T", "full_module": "FStar.Tactics.V2" }, { "abbrev": "W", "full_module": "FStar.WellFounded" }, { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "open": "FStar.FunctionalExtensionality" }, { "open": "FStar.Calc" }, { "open": "FStar.Tactics.V2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val iw_bind:\n #a: Type ->\n #b: Type ->\n pre_v: Type0 ->\n pre_f: (a -> Type0) ->\n wp_v: (squash pre_v -> w a) ->\n wp_f: (x: a -> squash (pre_f x) -> w b) ->\n squash (pre_v /\\ (forall x. pre_f x))\n -> w b", "source_definition": "let iw_bind (#a : Type) (#b : Type)\n (pre_v : Type0) (pre_f : a -> Type0)\n (wp_v : squash pre_v -> w a) (wp_f: (x:a -> squash (pre_f x) -> w b))\n : squash (pre_v /\\ (forall x. pre_f x)) -> w b\n = fun pf -> w_bind (wp_v ()) (fun x -> let pf' = and_elim_2 pf in\n let pf'' = fa_elim pf' x in\n wp_f x ())", "source_range": { "start_line": 59, "start_col": 0, "end_line": 65, "end_col": 45 }, "interleaved": false, "definition": "fun pre_v pre_f wp_v wp_f ->\n (fun pf ->\n GenericPartialDM4A.w_bind (wp_v ())\n (fun x ->\n [@@ FStar.Pervasives.inline_let ]let pf' = GenericPartialDM4A.and_elim_2 pf in\n [@@ FStar.Pervasives.inline_let ]let pf'' = GenericPartialDM4A.fa_elim pf' x in\n wp_f x ()))\n <:\n _: Prims.squash (pre_v /\\ (forall (x: a). pre_f x)) -> GenericPartialDM4A.w b", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Prims.squash", "GenericPartialDM4A.w", "Prims.l_and", "Prims.l_Forall", "GenericPartialDM4A.w_bind", "GenericPartialDM4A.fa_elim", "GenericPartialDM4A.and_elim_2" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "\n pre_v: Type0 ->\n pre_f: (_: a -> Type0) ->\n wp_v: (_: Prims.squash pre_v -> GenericPartialDM4A.w a) ->\n wp_f: (x: a -> _: Prims.squash (pre_f x) -> GenericPartialDM4A.w b) ->\n _: Prims.squash (pre_v /\\ (forall (x: a). pre_f x))\n -> GenericPartialDM4A.w b", "prompt": "let iw_bind\n (#a #b: Type)\n (pre_v: Type0)\n (pre_f: (a -> Type0))\n (wp_v: (squash pre_v -> w a))\n (wp_f: (x: a -> squash (pre_f x) -> w b))\n : squash (pre_v /\\ (forall x. pre_f x)) -> w b =\n ", "expected_response": "fun pf ->\n w_bind (wp_v ())\n (fun x ->\n let pf' = and_elim_2 pf in\n let pf'' = fa_elim pf' x in\n wp_f x ())", "source": { "project_name": "FStar", "file_name": "examples/layeredeffects/GenericPartialDM4A.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "GenericPartialDM4A.fst", "checked_file": "dataset/GenericPartialDM4A.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.WellFounded.fst.checked", "dataset/FStar.Tactics.V2.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Monotonic.Pure.fst.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "val m (a : Type u#a) : Type u#a", "val m_return (#a : Type) : a -> m a", "val m_bind (#a #b : Type) : m a -> (a -> m b) -> m b", "val w (a : Type u#a) : Type u#(1 + a)", "val w_return (#a : Type) : a -> w a", "val w_bind (#a #b : Type) : w a -> (a -> w b) -> w b", "val stronger : (#a:Type) -> preorder (w a)", "let equiv #a (w1 w2 : w a) = w1 `stronger` w2 /\\ w2 `stronger` w1", "val bind_is_monotonic\n (#a #b : Type)\n (w1 w2 : w a) \n (f1 f2 : a -> w b)\n : Lemma (requires (w1 `stronger` w2 /\\ (forall x. f1 x `stronger` f2 x)))\n (ensures (w_bind w1 f1 `stronger` w_bind w2 f2))", "let (<<=) = stronger", "val interp (#a : Type) : m a -> w a", "val interp_ret (#a:Type) (x:a)\n : Lemma (interp (m_return x) `equiv` w_return x)", "val interp_bind (#a #b:Type)\n (c : m a) (f : a -> m b)\n : Lemma (interp (m_bind c f) `equiv` w_bind (interp c) (fun x -> interp (f x)))", "let repr (a : Type) (pre:Type0) (w: squash pre -> w a) =\n squash pre -> c:(m a){w () `stronger` interp c}", "let return (a:Type) (x:a) : repr a True (fun _ -> w_return x) =\n fun _ ->\n interp_ret x;\n m_return x", "let and_elim_2 (s : squash ('p /\\ 'q)) : squash 'q = ()", "let fa_elim #a #p (s : squash (forall x. p x)) (x:a) : squash (p x) =\n Squash.bind_squash s (fun (f : (forall x. p x)) ->\n Squash.bind_squash f (fun (f : (x:a -> GTot (p x))) ->\n Squash.return_squash (f x)))" ], "closest": [ "val bind\n (a b: Type)\n (wp_v: wp0 a)\n (wp_f: (a -> wp0 b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind (a b : Type) (wp_v : wp0 a) (wp_f: a -> wp0 b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= let vf (p : erased (b -> Type0)) (_ : squash (bind_wp wp_v wp_f p)) : v:b{reveal p v} =\n let x = snd v (fun x -> wp_f x p) () in\n snd (f x) p ()\n in\n let l () : Lemma (monotonic (bind_wp wp_v wp_f)) =\n fst v;\n let aux (x:a) : Lemma (monotonic (wp_f x)) =\n fst (f x)\n in\n Classical.forall_intro aux\n in\n l ();\n (_, vf)", "val ibind\n (a b: Type)\n (wp_v: w a)\n (wp_f: (a -> w b))\n (v: irepr a wp_v)\n (f: (x: a -> irepr b (wp_f x)))\n : irepr b (w_bind wp_v wp_f)\nlet ibind (a : Type) (b : Type) (wp_v : w a) (wp_f: a -> w b) (v : irepr a wp_v) (f : (x:a -> irepr b (wp_f x))) : irepr b (w_bind wp_v wp_f) =\n fun p _ -> let l1 = v (fun x -> wp_f x p) () in\n let l2 = pmap #_ #(list b) #(fun x -> wp_f x p) #(fun l -> forall x. memP x l ==> p x) (fun x -> f x p ()) l1 in\n let l2 = unref l2 in\n let l2f = List.Tot.flatten l2 in\n l2f", "val bind (a b: Type) (wp_v: w a) (wp_f: (a -> w b)) (v: repr a wp_v) (f: (x: a -> repr b (wp_f x)))\n : repr b (w_bind wp_v wp_f)\nlet bind (a : Type) (b : Type)\n (wp_v : w a) (wp_f: a -> w b)\n (v : repr a wp_v) (f : (x:a -> repr b (wp_f x)))\n : repr b (w_bind wp_v wp_f) =\n let r = m_bind v f in\n (* Proof that stronger holds *)\n calc (<<=) {\n w_bind wp_v wp_f;\n <<= { bind_is_monotonic wp_v (interp v) wp_f (fun x -> interp (f x)) (* from the refinement *) }\n w_bind (interp v) (fun x -> interp (f x));\n <<= { interp_bind v f }\n interp (m_bind v f);\n };\n r", "val bind (a b: Type) (wp_v: w a) (wp_f: (a -> w b)) (v: repr a wp_v) (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind (a b : Type) (wp_v : w a) (wp_f: a -> w b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= f v", "val bind\n (a b: Type)\n (wp_v: wp a)\n (wp_f: (a -> wp b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind (a b : Type) (wp_v : wp a) (wp_f: a -> wp b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= fun p _ -> let x = v (fun x -> wp_f x p) () in\n f x p ()", "val bind\n (a b: Type)\n (wp_v: wp a)\n (wp_f: (a -> wp b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind (a b : Type) (wp_v : wp a) (wp_f: a -> wp b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n: repr b (bind_wp wp_v wp_f)\n= fun p _ -> let x = v (fun x -> wp_f x p) () in\n f x p ()", "val bind\n (a b: Type)\n (st: Type0)\n (wp_c: wp st a)\n (wp_f: (a -> wp st b))\n (c: repr a st wp_c)\n (f: (x: a -> repr b st (wp_f x)))\n : repr b st (bind_wp wp_c wp_f)\nlet bind (a:Type) (b:Type) (st:Type0)\n (wp_c : wp st a)\n (wp_f : a -> wp st b)\n (c : repr a st wp_c)\n (f : (x:a -> repr b st (wp_f x)))\n: repr b st (bind_wp wp_c wp_f)\n by (explode ();\n let w = nth_var 3 in\n apply_lemma (`(wp_squash_lem (`#(binding_to_term w))));\n dump \"\")\n= fun s0 ->\n let (y, s1) = c s0 in\n f y s1", "val bind\n (a b: Type)\n (st: Type0)\n (wp_c: wp st a)\n (wp_f: (a -> wp st b))\n (c: repr a st wp_c)\n (f: (x: a -> repr b st (wp_f x)))\n : repr b st (bind_wp wp_c wp_f)\nlet bind (a:Type) (b:Type) (st:Type0)\n (wp_c : wp st a)\n (wp_f : a -> wp st b)\n (c : repr a st wp_c)\n (f : (x:a -> repr b st (wp_f x)))\n: repr b st (bind_wp wp_c wp_f)\n= fun s0 -> let (y, s1) = c s0 in\n f y s1", "val bind\n (a b: Type)\n (st: Type0)\n (wp_c: wp st a)\n (wp_f: (a -> wp st b))\n (c: repr a st wp_c)\n (f: (x: a -> repr b st (wp_f x)))\n : repr b st (bind_wp wp_c wp_f)\nlet bind (a:Type) (b:Type) (st:Type0)\n (wp_c : wp st a)\n (wp_f : a -> wp st b)\n (c : repr a st wp_c)\n (f : (x:a -> repr b st (wp_f x)))\n : repr b st (bind_wp wp_c wp_f)\n = fun s0 -> let (y, s1) = c s0 in\n f y s1", "val bind\n (a b: Type)\n (st: Type0)\n (wp_c: wp st a)\n (wp_f: (a -> wp st b))\n (c: repr a st wp_c)\n (f: (x: a -> repr b st (wp_f x)))\n : repr b st (bind_wp wp_c wp_f)\nlet bind (a:Type) (b:Type) (st:Type0)\n (wp_c : wp st a)\n (wp_f : a -> wp st b)\n (c : repr a st wp_c)\n (f : (x:a -> repr b st (wp_f x)))\n: repr b st (bind_wp wp_c wp_f)\n= fun s0 ->\n //let (y, s1) = c s0 in\n //f y s1\n // GM: argh! using the match above introduces noise in the VC, a true precondition\n // that becomes a pain since we don't have monotonicity nor even extensionality\n let r = c s0 in\n f (fst r) (snd r)", "val bind (a b: Type) (i: idx) (wc: wp a) (wf: (a -> wp b)) (c: m a i wc) (f: (x: a -> m b i (wf x)))\n : m b i (bind_wp wc wf)\nlet bind (a b : Type) (i:idx) (wc:wp a) (wf:a -> wp b) (c : m a i wc) (f : (x:a -> m b i (wf x))) : m b i (bind_wp wc wf) =\n elim_pure_wp_monotonicity_forall ();\n match i with\n | T -> t_bind #_ #_ #wc #wf c f\n | G -> g_bind #_ #_ #wc #wf c f\n | D -> coerce (d_bind #_ #_ #wc #wf (coerce c) f)", "val bind\n (a b: Type)\n (wp_v: pure_wp a)\n (wp_f: (a -> pure_wp b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (pure_bind_wp a b wp_v wp_f)\nlet bind (a b : Type)\n (wp_v : pure_wp a) (wp_f: a -> pure_wp b)\n (v : repr a wp_v)\n (f : (x:a -> repr b (wp_f x)))\n : repr b (pure_bind_wp a b wp_v wp_f)\n // Fun fact: using () instead of _ below makes us\n // lose the refinement and then this proof fails.\n // Keep that in mind all ye who enter here.\n = elim_pure_wp_monotonicity_forall ();\n fun _ -> f (v ()) ()", "val bind\n (a b: Type)\n (#wp_v: st_wp a)\n (#wp_f: (a -> st_wp b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind (a : Type) (b : Type)\n (#wp_v : st_wp a) (#wp_f: a -> st_wp b)\n (v : repr a wp_v) (f : (x:a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f) =\n interp_bind v f wp_v wp_f;\n tbind v f", "val bind2\n (a b: Type)\n (wp_v: st_wp a)\n (wp_f: (a -> st_wp b))\n (v: repr a wp_v)\n (f: (x: a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f)\nlet bind2 (a : Type) (b : Type)\n (wp_v : st_wp a) (wp_f: a -> st_wp b)\n (v : repr a wp_v) (f : (x:a -> repr b (wp_f x)))\n : repr b (bind_wp wp_v wp_f) =\n interp_bind v f wp_v wp_f;\n tbind v f", "val bind\n (a b: Type)\n (wp_f: wp_t a)\n (wp_g: (a -> wp_t b))\n (f: repr a wp_f)\n (g: (x: a -> repr b (wp_g x)))\n : repr b (bind_wp a b wp_f wp_g)\nlet bind (a:Type) (b:Type)\n (wp_f:wp_t a) (wp_g:a -> wp_t b)\n (f:repr a wp_f) (g:(x:a -> repr b (wp_g x)))\n: repr b (bind_wp a b wp_f wp_g)\n= fun n ->\n let r = f n in\n g (fst r) (snd r)", "val bind\n (a b: Type)\n (wp_f: wp_t a)\n (wp_g: (a -> wp_t b))\n (f: repr a wp_f)\n (g: (x: a -> repr b (wp_g x)))\n : repr b (fun p -> wp_f (fun x -> (wp_g x) p))\nlet bind (a:Type) (b:Type)\n (wp_f:wp_t a)\n (wp_g:a -> wp_t b)\n (f:repr a wp_f) (g:(x:a -> repr b (wp_g x)))\n: repr b (fun p -> wp_f (fun x -> (wp_g x) p))\n= fun m ->\n let (x, m) = f m in\n (g x) m", "val IST.st_bind_wp = \n a: Type ->\n b: Type ->\n wp1: IST.st_wp a ->\n wp2: (_: a -> Prims.GTot (IST.st_wp b)) ->\n s: Type0 ->\n post: IST.st_post s b ->\n s0: s\n -> Type0\nlet st_bind_wp (a:Type) (b:Type)\n (wp1:st_wp a) (wp2:(a -> GTot (st_wp b)))\n (s:Type0) (post:st_post s b) (s0:s) \n = wp1 s (fun a s1 -> wp2 a s post s1) s0", "val bind_wp (#a #b: _) (wp_v: wp0 a) (wp_f: (x: a -> wp0 b)) : wp0 b\nlet bind_wp #a #b\n (wp_v : wp0 a)\n (wp_f : (x:a -> wp0 b))\n : wp0 b\n = elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))", "val bind_wp (#a #b: Type) (#st: Type0) (wp_c: wp st a) (wp_f: (a -> wp st b)) : wp st b\nlet bind_wp (#a #b:Type) (#st:Type0) (wp_c:wp st a) (wp_f:a -> wp st b) : wp st b =\n fun s0 p -> wp_c s0 (fun (y, s1) -> wp_f y s1 p)", "val bind_wp (#a #b: Type) (#st: Type0) (wp_c: wp st a) (wp_f: (a -> wp st b)) : wp st b\nlet bind_wp (#a #b:Type) (#st:Type0)\n (wp_c:wp st a)\n (wp_f:a -> wp st b)\n : wp st b\n = fun s0 p ->\n wp_c s0\n //push the postcondition of the continuation\n //through the WP transformer of c\n (fun (y, s1) ->\n //push the postcondition p\n //through the WP transformer of f applied to the\n //result value and state of c\n wp_f y s1 p)", "val w_bind (#a #b : Type) : w a -> (a -> w b) -> w b\nlet w_bind wp1 k =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp1 (fun x -> k x p))", "val bind_wp (#a #b: _) (wp_v: w a) (wp_f: (a -> w b)) : w b\nlet bind_wp #a #b (wp_v:w a) (wp_f:a -> w b) : w b =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))", "val bind_wp (#a #b: _) (wp_v: wp a) (wp_f: (x: a -> wp b)) : wp b\nlet bind_wp #a #b\n (wp_v : wp a)\n (wp_f : (x:a -> wp b))\n : wp b\n = elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))", "val bind_wp (#a #b: _) (wp_v: wp a) (wp_f: (x: a -> wp b)) : wp b\nlet bind_wp #a #b\n (wp_v : wp a)\n (wp_f : (x:a -> wp b))\n : wp b\n = elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp_v (fun x -> wp_f x p))", "val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b\nlet bind_wp (#a:Type) (#b:Type) (#st:Type0)\n (w1 : wp st a) (w2 : a -> wp st b) : wp st b =\n fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)", "val bind_wp (#a #b: Type) (#st: Type0) (w1: wp st a) (w2: (a -> wp st b)) : wp st b\nlet bind_wp (#a:Type) (#b:Type) (#st:Type0)\n (w1 : wp st a) (w2 : a -> wp st b) : wp st b =\n fun s0 p -> w1 s0 (fun y s1 -> w2 y s1 p)", "val bind_wp (a b: Type) (wp_f: wp_t a) (wp_g: (a -> wp_t b)) : wp_t b\nlet bind_wp (a:Type) (b:Type) (wp_f:wp_t a) (wp_g:a -> wp_t b) : wp_t b\n= fun p n0 ->\n wp_f (fun r ->\n match r with\n | None -> p None\n | Some (x, n1) -> (wp_g x) p n1) n0", "val bind_wp (#a #b: _) (wc: wp a) (wf: (a -> wp b)) : wp b\nlet bind_wp #a #b (wc : wp a) (wf : a -> wp b) : wp b =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wc (fun x -> wf x p))", "val IMST.st_bind = \n a: Type ->\n b: Type ->\n wp1: IMST.st_wp a ->\n wp2: (_: a -> IMST.st_wp b) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMST.st_post s b ->\n s0: s\n -> Type0\nlet st_bind (a:Type) (b:Type)\n (wp1:st_wp a) (wp2: (a -> Tot (st_wp b))) \n (s:Type0) (rel:preorder s) (post:st_post s b) (s0:s) \n = wp1 s rel (fun x s1 -> wp2 x s rel post s1) s0", "val bind\n (a b: Type)\n (#l1: rwops)\n (#wp_v: st_wp a)\n (#l2: rwops)\n (#wp_f: (a -> st_wp b))\n (v: repr a l1 wp_v)\n (f: (x: a -> repr b l2 (wp_f x)))\n : repr b (l1 @@ l2) (bind_wp wp_v wp_f)\nlet bind (a : Type) (b : Type)\n (#l1 : rwops) (#wp_v : st_wp a)\n (#l2 : rwops) (#wp_f: a -> st_wp b)\n (v : repr a l1 wp_v) (f : (x:a -> repr b l2 (wp_f x)))\n : repr b (l1@@l2) (bind_wp wp_v wp_f)\n = interp_bind v f wp_v wp_f;\n tbind v f", "val bind\n (a b: Type)\n (wp1: pure_wp a)\n (wp2: (a -> pure_wp b))\n (f: repr a wp1)\n (g: (x: a -> repr b (wp2 x)))\n : repr b (bind_wp wp1 wp2)\nlet bind (a b:Type) (wp1:pure_wp a) (wp2:a -> pure_wp b)\n (f:repr a wp1)\n (g:(x:a -> repr b (wp2 x)))\n : repr b (bind_wp wp1 wp2)\n = FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();\n fun () ->\n let x = f () in\n g x ()", "val bind_wp (#a #b: _) (w: st_wp a) (wf: (a -> st_wp b)) : st_wp b\nlet bind_wp #a #b (w : st_wp a) (wf : a -> st_wp b)\n : st_wp b\n = fun s0 p -> w s0 (fun (y, s1) -> wf y s1 p)", "val bind_wp (#a #b: _) (w: st_wp a) (wf: (a -> st_wp b)) : st_wp b\nlet bind_wp #a #b (w : st_wp a) (wf : a -> st_wp b)\n : st_wp b\n = fun s0 p -> w s0 (fun (y, s1) -> wf y s1 p)", "val bind_wp (#a #b: _) (w: st_wp a) (wf: (a -> st_wp b)) : st_wp b\nlet bind_wp #a #b (w : st_wp a) (wf : a -> st_wp b)\n : st_wp b\n = fun s0 p -> w s0 (fun (y, s1) -> wf y s1 p)", "val IMSTsub.st_bind = \n a: Type ->\n b: Type ->\n wp1: IMSTsub.st_wp a ->\n wp2: (_: a -> IMSTsub.st_wp b) ->\n s: Type0 ->\n rel: FStar.Preorder.preorder s ->\n post: IMSTsub.st_post s b ->\n s0: s\n -> Type0\nlet st_bind (a:Type) (b:Type)\n (wp1:st_wp a) (wp2: (a -> Tot (st_wp b))) \n (s:Type0) (rel:preorder s) (post:st_post s b) (s0:s) \n = wp1 s rel (fun x s1 -> wp2 x s rel post s1) s0", "val tac_bind_wp (#a #b: Type) (wp_f: tac_wp_t a) (wp_g: (a -> tac_wp_t b)) : tac_wp_t b\nlet tac_bind_wp (#a #b:Type) (wp_f:tac_wp_t a) (wp_g:a -> tac_wp_t b) : tac_wp_t b =\n fun ps post ->\n wp_f ps (fun r ->\n match r with\n | Success x ps -> wp_g x ps post\n | Failed ex ps -> post (Failed ex ps))", "val bind\n (a b: Type)\n (pre_f: pre_t)\n (post_f: post_t a)\n (pre_g: (a -> pre_t))\n (post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (pre_f:pre_t) (post_f:post_t a) (pre_g:a -> pre_t) (post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val bind\n (a b: Type)\n (wp_f: wp_t a)\n (wp_g: (a -> wp_t b))\n (f: repr a wp_f)\n (g: (x: a -> repr b (wp_g x)))\n : repr b\n (fun p ->\n wp_f (function\n | Error e -> p (Error e)\n | Success x -> (wp_g x) p))\nlet bind (a:Type) (b:Type)\n (wp_f:wp_t a) (wp_g:a -> wp_t b)\n (f:repr a wp_f) (g:(x:a -> repr b (wp_g x)))\n: repr b\n (fun p -> wp_f (fun x ->\n match x with\n | Error e -> p (Error e)\n | Success x -> (wp_g x) p))\n= fun s0 ->\n let x, s1 = f s0 in\n match x with\n | Error e -> Error e, s1\n | Success x -> (g x) s1", "val pure_bind_wp (#a #b: Type) (w1: ID5.wp a) (w2: (a -> ID5.wp b)) : ID5.wp b\nlet pure_bind_wp (#a #b : Type) (w1 : ID5.wp a) (w2 : a -> ID5.wp b) : ID5.wp b =\n ID5.bind_wp w1 w2", "val interp_bind (#a #b:Type)\n (c : rwtree a) (f : a -> rwtree b)\n (w1 : st_wp a) (w2 : a -> st_wp b)\n : Lemma (requires w1 <<= interp_as_wp c /\\ (forall x. w2 x <<= interp_as_wp (f x)))\n (ensures bind_wp w1 w2 `stronger` interp_as_wp (tbind c f))\nlet interp_bind #a #b c f w1 w2 =\n let aux (p: (b & state -> Type0)) (s0:state) : Lemma (bind_wp w1 w2 s0 p ==> interp_as_wp (tbind c f) s0 p) =\n calc (==>) {\n bind_wp w1 w2 s0 p;\n ==> {}\n w1 s0 (fun (y, s1) -> w2 y s1 p);\n ==> { (* hyp *)}\n interp_as_wp c s0 (fun (y, s1) -> w2 y s1 p);\n ==> { interp_monotonic c }\n interp_as_wp c s0 (fun (y, s1) -> interp_as_wp (f y) s1 p);\n ==> { interp_morph c f p s0 }\n interp_as_wp (tbind c f) s0 p;\n }\n in\n Classical.forall_intro_2 aux", "val interp_bind (#a #b:Type)\n (c : rwtree a) (f : a -> rwtree b)\n (w1 : st_wp a) (w2 : a -> st_wp b)\n : Lemma (requires w1 <<= interp_as_wp c /\\ (forall x. w2 x <<= interp_as_wp (f x)))\n (ensures bind_wp w1 w2 `stronger` interp_as_wp (tbind c f))\nlet interp_bind #a #b c f w1 w2 =\n let aux (p: (b & state -> Type0)) (s0:state) : Lemma (bind_wp w1 w2 s0 p ==> interp_as_wp (tbind c f) s0 p) =\n calc (==>) {\n bind_wp w1 w2 s0 p;\n ==> {}\n w1 s0 (fun (y, s1) -> w2 y s1 p);\n ==> { (* hyp *)}\n interp_as_wp c s0 (fun (y, s1) -> w2 y s1 p);\n ==> { interp_monotonic c }\n interp_as_wp c s0 (fun (y, s1) -> interp_as_wp (f y) s1 p);\n ==> { interp_morph c f p s0 }\n interp_as_wp (tbind c f) s0 p;\n }\n in\n Classical.forall_intro_2 aux", "val bind\n (a b: Type)\n (r0 w0: label)\n (fs0: flows)\n (p: pre)\n (q: post a)\n (r1 w1: label)\n (fs1: flows)\n (r: (a -> pre))\n (s: (a -> post b))\n (x: hifc a r0 w0 fs0 p q)\n (y: (x: a -> hifc b r1 w1 fs1 (r x) (s x)))\n : hifc b\n (union r0 r1)\n (union w0 w1)\n (fs0 @ add_source r0 ((bot, w1) :: fs1))\n (fun s0 -> p s0 /\\ (forall x s1. q s0 x s1 /\\ modifies w0 s0 s1 ==> r x s1))\n (fun s0 r s2 ->\n (exists x s1. (q s0 x s1 /\\ modifies w0 s0 s1) /\\ (s x s1 r s2 /\\ modifies w1 s1 s2)))\nlet bind (a b:Type)\n (r0 w0:label)\n (fs0:flows)\n (p:pre) (q:post a)\n (r1 w1:label) (fs1:flows)\n (r:a -> pre) (s:a -> post b)\n (x:hifc a r0 w0 fs0 p q)\n (y: (x:a -> hifc b r1 w1 fs1 (r x) (s x)))\n : hifc b (union r0 r1) (union w0 w1) (fs0 @ add_source r0 ((bot, w1)::fs1))\n (fun s0 -> p s0 /\\ (forall x s1. q s0 x s1 /\\ modifies w0 s0 s1 ==> r x s1))\n (fun s0 r s2 -> (exists x s1. (q s0 x s1 /\\ modifies w0 s0 s1) /\\ (s x s1 r s2 /\\ modifies w1 s1 s2)))\n = (pre_bind _ _ _ _ _ _ _ _ (frame _ _ _ _ x) (fun a -> frame _ _ _ _ (y a)))", "val bind\n (a b: Type)\n (i: idx)\n (pre: st_pre)\n (post: st_bpost a)\n (i': idx)\n (pre': (a -> st_pre))\n (post': (a -> st_bpost b))\n (c: m a i pre post)\n (f: (x: a -> m b i' (pre' x) (post' x)))\n : Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))\nlet bind (a b : Type)\n (i:idx) (pre:st_pre) (post:st_bpost a)\n (i':idx)\n (pre':a -> st_pre) (post':a -> st_bpost b)\n (c : m a i pre post)\n (f : (x:a -> m b i' (pre' x) (post' x)))\n : Tot (m b (join i i') (bind_pre i i' pre pre' post) (bind_post i i' pre post post'))\n = fun () -> let x = c () in f x ()", "val bind\n (a b: Type)\n (#pre_f: pre_t)\n (#post_f: post_t a)\n (#pre_g: (a -> pre_t))\n (#post_g: (a -> post_t b))\n (f: repr a pre_f post_f)\n (g: (x: a -> repr b (pre_g x) (post_g x)))\n : repr b\n (fun h0 -> pre_f h0 /\\ (forall (x: a) (h1: heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x: a) (h1: heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\nlet bind (a:Type) (b:Type)\n (#pre_f:pre_t) (#post_f:post_t a) (#pre_g:a -> pre_t) (#post_g:a -> post_t b)\n (f:repr a pre_f post_f) (g:(x:a -> repr b (pre_g x) (post_g x)))\n: repr b\n (fun h0 -> pre_f h0 /\\ (forall (x:a) (h1:heap). post_f h0 x h1 ==> pre_g x h1))\n (fun h0 y h2 -> exists (x:a) (h1:heap). pre_f h0 /\\ post_f h0 x h1 /\\ post_g x h1 y h2)\n= fun _ ->\n let x = f () in\n g x ()", "val FStar.Pervasives.st_bind_wp = \n heap: Type ->\n a: Type ->\n b: Type ->\n wp1: FStar.Pervasives.st_wp_h heap a ->\n wp2: (_: a -> Prims.GTot (FStar.Pervasives.st_wp_h heap b)) ->\n p: FStar.Pervasives.st_post_h heap b ->\n h0: heap\n -> Type0\nlet st_bind_wp\n (heap: Type)\n (a b: Type)\n (wp1: st_wp_h heap a)\n (wp2: (a -> GTot (st_wp_h heap b)))\n (p: st_post_h heap b)\n (h0: heap)\n = wp1 (fun a h1 -> wp2 a p h1) h0", "val all_bind_wp\n (heap a b: Type)\n (wp1: all_wp_h heap a)\n (wp2: (a -> GTot (all_wp_h heap b)))\n (p: all_post_h heap b)\n (h0: heap)\n : GTot Type0\nlet all_bind_wp\n (heap: Type)\n (a b: Type)\n (wp1: all_wp_h heap a)\n (wp2: (a -> GTot (all_wp_h heap b)))\n (p: all_post_h heap b)\n (h0: heap)\n : GTot Type0 =\n wp1 (fun ra h1 ->\n (match ra with\n | V v -> wp2 v p h1\n | E e -> p (E e) h1\n | Err msg -> p (Err msg) h1))\n h0", "val pre_bind\n (a b: Type)\n (w0 r0 w1 r1: label)\n (fs0 fs1: flows)\n (#p #q #r #s: _)\n (x: hifc a r0 w0 fs0 p q)\n (y: (x: a -> hifc b r1 w1 fs1 (r x) (s x)))\n : hifc b\n (union r0 r1)\n (union w0 w1)\n (fs0 @ add_source r0 ((bot, w1) :: fs1))\n (fun s0 -> p s0 /\\ (forall x s1. q s0 x s1 ==> r x s1))\n (fun s0 r s2 -> (exists x s1. q s0 x s1 /\\ s x s1 r s2))\nlet pre_bind (a b:Type)\n (w0 r0 w1 r1:label) (fs0 fs1:flows)\n #p #q #r #s\n (x:hifc a r0 w0 fs0 p q)\n (y: (x:a -> hifc b r1 w1 fs1 (r x) (s x)))\n : hifc b (union r0 r1) (union w0 w1) (fs0 @ add_source r0 ((bot, w1)::fs1))\n (fun s0 -> p s0 /\\ (forall x s1. q s0 x s1 ==> r x s1))\n (fun s0 r s2 -> (exists x s1. q s0 x s1 /\\ s x s1 r s2))\n = let f = bind_ifc' x y in\n bind_ifc_reads_ok x y;\n bind_ifc_writes_ok x y;\n bind_ifc_flows_ok x y;\n f", "val iex_bind_wp (a b: Type) (wp1: iex_wp a) (wp2: (a -> GTot (iex_wp b))) (es: exns) (p: iex_post b)\n : GTot Type0\nlet iex_bind_wp (a:Type) (b:Type)\n (wp1:iex_wp a)\n (wp2:(a -> GTot (iex_wp b))) (es:exns) (p:iex_post b)\n : GTot Type0 =\n forall (k:iex_post b).\n (forall (rb:result b).{:pattern (guard_free (k rb))} p rb ==> k rb)\n ==> (wp1 es (function\n | V ra1 -> wp2 ra1 es k\n | E e -> k (E e)))", "val t_bind (#a #b #wc #wf: _) (c: m a T wc) (f: (x: a -> m b T (wf x))) : m b T (bind_wp wc wf)\nlet t_bind #a #b #wc #wf (c : m a T wc) (f : (x:a -> m b T (wf x))) : m b T (bind_wp wc wf) = elim_pure_wp_monotonicity_forall (); fun () -> f (c ()) ()", "val bind\n (a b: Type)\n (r_in_f [@@@ refl_implicit]r_out_f: parser)\n (pre_f: pre_t r_in_f)\n (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n ([@@@ refl_implicit]l_f: memory_invariant)\n ([@@@ refl_implicit]r_in_g r_out_g: parser)\n (pre_g: (x: a -> pre_t r_in_g))\n (post_g: (x: a -> post_t b r_in_g r_out_g (pre_g x)))\n (post_err_g: (x: a -> post_err_t r_in_g (pre_g x)))\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr: squash (l_f == l_g))\n ([@@@ refl_implicit]pr': squash (r_out_f == r_in_g))\n (f_bind: repr a r_in_f r_out_f pre_f post_f post_err_f l_f)\n (g: (x: a -> repr b (r_in_g) r_out_g (pre_g x) (post_g x) (post_err_g x) l_g))\n : Tot\n (repr b\n r_in_f\n r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out. post_f v_in x v_out ==> pre_g x v_out))\n (fun v_in y v_out ->\n exists x v_out_f. pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out)\n (fun v_in ->\n pre_f v_in /\\\n (post_err_f v_in \\/ (exists x v_out_f. post_f v_in x v_out_f /\\ post_err_g x v_out_f)))\n l_g)\nlet bind (a:Type) (b:Type)\n (r_in_f:parser) ([@@@ refl_implicit] r_out_f: parser)\n (pre_f: pre_t r_in_f) (post_f: post_t a r_in_f r_out_f pre_f)\n (post_err_f: post_err_t r_in_f pre_f)\n ([@@@ refl_implicit] l_f: memory_invariant)\n ([@@@ refl_implicit] r_in_g:parser)\n (r_out_g: parser)\n (pre_g: (x:a) -> pre_t r_in_g) (post_g: (x:a) -> post_t b r_in_g r_out_g (pre_g x))\n (post_err_g: (x:a) -> post_err_t r_in_g (pre_g x))\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr:squash (l_f == l_g))\n ([@@@ refl_implicit] pr':squash (r_out_f == r_in_g))\n (f_bind : repr a r_in_f r_out_f pre_f post_f post_err_f l_f)\n (g : (x: a -> repr b (r_in_g) r_out_g (pre_g x) (post_g x) (post_err_g x) l_g))\n: Tot (repr b r_in_f r_out_g\n (fun v_in -> pre_f v_in /\\ (forall (x: a) v_out . post_f v_in x v_out ==> pre_g x v_out)) // (bind_pre a r_in_f r_out_f pre_f post_f pre_g)\n (fun v_in y v_out -> exists x v_out_f . pre_f v_in /\\ post_f v_in x v_out_f /\\ post_g x v_out_f y v_out) // (bind_post a b r_in_f r_out_f pre_f post_f r_out_g pre_g post_g)\n (fun v_in -> \n pre_f v_in /\\ (\n post_err_f v_in \\/ (\n exists x v_out_f . post_f v_in x v_out_f /\\ post_err_g x v_out_f\n ))) // (bind_post_err a r_in_f r_out_f pre_f post_f post_err_f pre_g post_err_g))\n l_g\n )\n= Repr (bind_spec a b r_in_f r_out_f pre_f post_f post_err_f r_out_g pre_g post_g post_err_g (Repr?.spec f_bind) (fun x -> Repr?.spec (g x))) (bind_impl a b r_in_f r_out_f pre_f post_f post_err_f r_out_g pre_g post_g post_err_g (Repr?.spec f_bind) (fun x -> Repr?.spec (g x)) l_g (Repr?.impl f_bind) (fun x -> Repr?.impl (g x)))", "val bind_wp (#a #b: Type) (wp1: pure_wp a) (wp2: (a -> pure_wp b)) : pure_wp b\nlet bind_wp (#a #b:Type) (wp1:pure_wp a) (wp2:a -> pure_wp b) : pure_wp b =\n elim_pure_wp_monotonicity_forall ();\n as_pure_wp (fun p -> wp1 (fun x -> wp2 x p))", "val ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b) : GTot Type0\nlet ex_bind_wp (a b: Type) (wp1: ex_wp a) (wp2: (a -> GTot (ex_wp b))) (p: ex_post b)\n : GTot Type0 =\n forall (k: ex_post b).\n (forall (rb: result b). {:pattern (guard_free (k rb))} p rb ==> k rb) ==>\n (wp1 (function\n | V ra1 -> wp2 ra1 k\n | E e -> k (E e)\n | Err m -> k (Err m)))", "val bind_pre\n (a: Type)\n (pre1: pre_t)\n (post1: post_t a)\n (b: Type)\n (pre2: (a -> pre_t))\n (post2: (a -> post_t b))\n : pre_t\nlet bind_pre\n (a:Type) (pre1:pre_t) (post1:post_t a)\n (b:Type) (pre2:a -> pre_t) (post2:a -> post_t b)\n : pre_t\n = fun s0 -> pre1 s0 /\\ (forall y s1. post1 s0 (Some y) s1 ==> pre2 y s1)", "val ebind\n (a b: Type)\n (wp_f: ewp_t a)\n (wp_g: (a -> ewp_t b))\n (f: erepr a wp_f)\n (g: (x: a -> erepr b (wp_g x)))\n : erepr b\n (fun (p: epost_t b) ->\n wp_f (fun (r: option a) ->\n match r with\n | None -> p None\n | Some x -> wp_g x p))\nlet ebind (a:Type) (b:Type)\n (wp_f:ewp_t a) (wp_g:a -> ewp_t b)\n (f:erepr a wp_f) (g:(x:a -> erepr b (wp_g x)))\n: erepr b\n (fun (p:epost_t b) ->\n wp_f (fun (r:option a) ->\n match r with\n | None -> p None\n | Some x -> wp_g x p))\n= fun _ ->\n let r = f () in\n match r with\n | None -> None\n | Some x -> g x ()", "val bind\n (a b: Type)\n (pre1 post1: _)\n (labs1: list eff_label)\n (pre2 post2: _)\n (labs2: list eff_label)\n (c: repr a pre1 post1 labs1)\n (f: (x: a -> repr b (pre2 x) (post2 x) labs2))\n : Tot\n (repr b\n (bind_pre a pre1 post1 b pre2 post2)\n (bind_post a pre1 post1 b pre2 post2)\n (labs1 @ labs2))\nlet bind (a b : Type)\n pre1 post1\n (labs1 : list eff_label)\n pre2 post2\n (labs2 : list eff_label)\n (c : repr a pre1 post1 labs1)\n (f : (x:a -> repr b (pre2 x) (post2 x) labs2))\n : Tot (repr b (bind_pre a pre1 post1 b pre2 post2)\n (bind_post a pre1 post1 b pre2 post2)\n (labs1@labs2))\n = let pre = bind_pre a pre1 post1 b pre2 post2 in\n let post = bind_post a pre1 post1 b pre2 post2 in\n let r (s0:state{pre s0}) : Tot (r:(option b & state){post s0 (fst r) (snd r)}) =\n match c s0 with\n | Some x, s1 ->\n assert (post1 s0 (Some x) s1);\n assert (pre2 x s1);\n f x s1\n | None, s1 -> None, s1\n in\n r", "val pure_bind_wp (a b: Type) (wp1: pure_wp a) (wp2: (a -> Tot (pure_wp b))) : Tot (pure_wp b)\nlet pure_bind_wp (a b:Type) (wp1:pure_wp a) (wp2:(a -> Tot (pure_wp b))) : Tot (pure_wp b) =\n reveal_opaque (`%pure_wp_monotonic) pure_wp_monotonic;\n pure_bind_wp0 a b wp1 wp2", "val wp_Bind\n (#a #b: Type0)\n (cs: codes)\n (qcs: (va_state -> a -> GTot (quickCodes b cs)))\n (mods: mods_t)\n (k: (va_state -> b -> Type0))\n : Tot (wp_Bind_t a) (decreases %[cs;1;qcs])\nlet rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :\n Tot Type0 (decreases %[cs; 0; qcs])\n =\n match qcs with\n | QEmpty g -> k s0 g\n | QSeq r msg qc qcs ->\n let c::cs = cs in\n label r msg (mods_contains mods qc.mods /\\ wp_proc c qc s0 (wp_Seq cs qcs mods k))\n | QBind r msg qc qcs ->\n let c::cs = cs in\n label r msg (mods_contains mods qc.mods /\\ wp_proc c qc s0 (wp_Bind cs qcs mods k))\n | QGetState f ->\n let c::cs = cs in\n wp cs (f s0) mods k s0\n | QPURE r msg pre l qcs ->\n // REVIEW: rather than just applying 'pre' directly to k,\n // we define this in a roundabout way so that:\n // - it works even if 'pre' isn't known to be monotonic\n // - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)\n (forall (p:unit -> GTot Type0).//{:pattern (pre p)}\n (forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())\n ==>\n label r msg (pre p))\n(*\n | QBindPURE b r msg pre l qcs ->\n let c::cs = cs in\n (forall (p:b -> GTot Type0).//{:pattern (pre p)}\n (forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)\n ==>\n label r msg (pre p))\n*)\n | QLemma r msg pre post l qcs ->\n label r msg pre /\\ (post () ==> wp cs qcs mods k s0)\n | QGhost b r msg pre post l qcs ->\n let c::cs = cs in\n label r msg pre /\\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)\n | QAssertBy r msg p qcsBy qcs ->\n empty_list_is_small cs;\n wp [] qcsBy mods (k_AssertBy p) s0 /\\ (p ==> wp cs qcs mods k s0)\n// Hoist lambdas out of main definition to avoid issues with function equality\nand wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :\n Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])\n =\n let f s0 _ = wp cs qcs mods k s0 in f\nand wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :\n Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])\n =\n let f s0 g = wp cs (qcs s0 g) mods k s0 in f", "val wp_Bind\n (#a #b: Type0)\n (cs: codes)\n (qcs: (va_state -> a -> GTot (quickCodes b cs)))\n (mods: mods_t)\n (k: (va_state -> b -> Type0))\n : Tot (wp_Bind_t a) (decreases %[cs;1;qcs])\nlet rec wp (#a:Type0) (cs:codes) (qcs:quickCodes a cs) (mods:mods_t) (k:va_state -> a -> Type0) (s0:va_state) :\n Tot Type0 (decreases %[cs; 0; qcs])\n =\n match qcs with\n | QEmpty g -> k s0 g\n | QSeq r msg qc qcs ->\n let c::cs = cs in\n label r msg (mods_contains mods qc.mods /\\ wp_proc c qc s0 (wp_Seq cs qcs mods k))\n | QBind r msg qc qcs ->\n let c::cs = cs in\n label r msg (mods_contains mods qc.mods /\\ wp_proc c qc s0 (wp_Bind cs qcs mods k))\n | QGetState f ->\n let c::cs = cs in\n wp cs (f s0) mods k s0\n | QPURE r msg pre l qcs ->\n // REVIEW: rather than just applying 'pre' directly to k,\n // we define this in a roundabout way so that:\n // - it works even if 'pre' isn't known to be monotonic\n // - F*'s error reporting uses 'guard_free' to process labels inside (wp cs qcs mods k s0)\n (forall (p:unit -> GTot Type0).//{:pattern (pre p)}\n (forall (u:unit).{:pattern (guard_free (p u))} wp cs qcs mods k s0 ==> p ())\n ==>\n label r msg (pre p))\n(*\n | QBindPURE b r msg pre l qcs ->\n let c::cs = cs in\n (forall (p:b -> GTot Type0).//{:pattern (pre p)}\n (forall (g:b).{:pattern (guard_free (p g))} wp cs (qcs s0 g) mods k s0 ==> p g)\n ==>\n label r msg (pre p))\n*)\n | QLemma r msg pre post l qcs ->\n label r msg pre /\\ (post () ==> wp cs qcs mods k s0)\n | QGhost b r msg pre post l qcs ->\n let c::cs = cs in\n label r msg pre /\\ (forall (g:b). post g ==> wp cs (qcs g) mods k s0)\n | QAssertBy r msg p qcsBy qcs ->\n empty_list_is_small cs;\n wp [] qcsBy mods (k_AssertBy p) s0 /\\ (p ==> wp cs qcs mods k s0)\n// Hoist lambdas out of main definition to avoid issues with function equality\nand wp_Seq (#a:Type0) (#b:Type0) (cs:codes) (qcs:quickCodes b cs) (mods:mods_t) (k:va_state -> b -> Type0) :\n Tot (wp_Seq_t a) (decreases %[cs; 1; qcs])\n =\n let f s0 _ = wp cs qcs mods k s0 in f\nand wp_Bind (#a:Type0) (#b:Type0) (cs:codes) (qcs:va_state -> a -> GTot (quickCodes b cs)) (mods:mods_t) (k:va_state -> b -> Type0) :\n Tot (wp_Bind_t a) (decreases %[cs; 1; qcs])\n =\n let f s0 g = wp cs (qcs s0 g) mods k s0 in f", "val interp_bind (#a #b:Type) (#l1 #l2 : rwops)\n (c : rwtree a l1) (f : a -> rwtree b l2)\n (w1 : st_wp a) (w2 : a -> st_wp b)\n : Lemma (requires w1 <<= interp_as_wp c /\\ (forall x. w2 x <<= interp_as_wp (f x)))\n (ensures bind_wp w1 w2 `stronger` interp_as_wp (tbind c f))\nlet interp_bind #a #b c f w1 w2 =\n let aux (p: (b & state -> Type0)) (s0:state) : Lemma (bind_wp w1 w2 s0 p ==> interp_as_wp (tbind c f) s0 p) =\n calc (==>) {\n bind_wp w1 w2 s0 p;\n ==> {}\n w1 s0 (fun (y, s1) -> w2 y s1 p);\n ==> { (* hyp *)}\n interp_as_wp c s0 (fun (y, s1) -> w2 y s1 p);\n ==> { interp_monotonic c }\n interp_as_wp c s0 (fun (y, s1) -> interp_as_wp (f y) s1 p);\n ==> { interp_morph c f p s0 }\n interp_as_wp (tbind c f) s0 p;\n }\n in\n Classical.forall_intro_2 aux", "val bind\n (a b: Type)\n (f_p: pre)\n (f_q: post a)\n (g_p: (a -> pre))\n (g_q: (a -> post b))\n (f: repr a f_p f_q)\n (g: (x: a -> repr b (g_p x) (g_q x)))\n : repr b (act_p f_p f_q g_p) (act_q f_q g_q)\nlet rec bind (a b:Type)\n (f_p:pre) (f_q:post a)\n (g_p:a -> pre) (g_q:a -> post b)\n (f:repr a f_p f_q) (g:(x:a -> repr b (g_p x) (g_q x)))\n : repr b (act_p f_p f_q g_p) (act_q f_q g_q)\n = fun _ ->\n let f = f () in\n match f with\n | Ret x -> Weaken (g x ())\n | Act #_ #c #a_p #a_q act #_ #_ #_ k ->\n let k' = fun (x:c) -> (bind _ _ _ _ _ _ (fun _ -> k x) g) () in\n Weaken (Act #_ #c #a_p #a_q act #b #_ #_ k')\n | Weaken f -> Weaken ((bind _ _ _ _ _ _ (fun _ -> f) g) ())\n | Strengthen #_ #_ #phi #p #q f ->\n let f : squash phi -> Dv (m st b (act_p p q g_p) (act_q q g_q)) =\n fun _ -> (bind _ _ _ _ _ _ (fun _ -> f ()) g) () in\n let f : m st b (strengthen_pre (act_p p q g_p) phi) (act_q q g_q) =\n Strengthen f in\n Weaken f", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: (a -> pre_t state))\n (ens_g: (a -> post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:a -> pre_t state)\n (ens_g:a -> post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun s0 ->\n let x, s1 = f s0 in\n (g x) s1", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: pre_t state)\n (ens_f: post_t state a)\n (req_g: (a -> pre_t state))\n (ens_g: (a -> post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:pre_t state)\n (ens_f:post_t state a)\n (req_g:a -> pre_t state)\n (ens_g:a -> post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun s0 ->\n let x, s1 = f s0 in\n (g x) s1", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: (a -> M.pre_t state))\n (ens_g: (a -> M.post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:a -> M.pre_t state)\n (ens_g:a -> M.post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun (t, n) ->\n let x, n1 = f (t, n) in\n (g x) (t, n1)", "val bind\n (a b: Type)\n (state: Type u#2)\n (rel: P.preorder state)\n (req_f: M.pre_t state)\n (ens_f: M.post_t state a)\n (req_g: (a -> M.pre_t state))\n (ens_g: (a -> M.post_t state b))\n (f: repr a state rel req_f ens_f)\n (g: (x: a -> repr b state rel (req_g x) (ens_g x)))\n : repr b\n state\n rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\nlet bind\n (a:Type)\n (b:Type)\n (state:Type u#2)\n (rel:P.preorder state)\n (req_f:M.pre_t state)\n (ens_f:M.post_t state a)\n (req_g:a -> M.pre_t state)\n (ens_g:a -> M.post_t state b)\n (f:repr a state rel req_f ens_f)\n (g:(x:a -> repr b state rel (req_g x) (ens_g x)))\n : repr b state rel\n (fun s0 -> req_f s0 /\\ (forall x s1. ens_f s0 x s1 ==> (req_g x) s1))\n (fun s0 r s2 -> req_f s0 /\\ (exists x s1. ens_f s0 x s1 /\\ (req_g x) s1 /\\ (ens_g x) s1 r s2))\n =\n fun (t, n) ->\n let x, n1 = f (t, n) in\n (g x) (t, n1)", "val bind\n (a b: Type)\n (req_f: Type0)\n (ens_f req_g: (a -> Type0))\n (ens_g: (a -> (b -> Type0)))\n (f: repr a req_f ens_f)\n (g: (x: a -> repr b (req_g x) (ens_g x)))\n : repr b\n (req_f /\\ (forall (x: a). ens_f x ==> req_g x))\n (fun y -> exists x. ens_f x /\\ ens_g x y)\nlet bind (a:Type) (b:Type)\n (req_f:Type0) (ens_f:a -> Type0)\n (req_g:a -> Type0) (ens_g:a -> (b -> Type0))\n (f:repr a req_f ens_f) (g:(x:a -> repr b (req_g x) (ens_g x)))\n: repr b\n (req_f /\\ (forall (x:a). ens_f x ==> req_g x))\n (fun y -> exists x. ens_f x /\\ ens_g x y)\n= fun _ ->\n let x = f () in\n g x ()", "val bind_wp (#a #b #s: _) (wp_f: wp_t s a) (wp_g: (a -> wp_t s b)) : wp_t s b\nlet bind_wp #a #b #s (wp_f:wp_t s a) (wp_g: (a -> wp_t s b))\n : wp_t s b\n = F.on _ (fun s0 post -> wp_f s0 (fun (x, s1) -> wp_g x s1 post))", "val g_bind (#a #b #wc #wf: _) (c: m a G wc) (f: (x: a -> m b G (wf x))) : m b G (bind_wp wc wf)\nlet g_bind #a #b #wc #wf (c : m a G wc) (f : (x:a -> m b G (wf x))) : m b G (bind_wp wc wf) = elim_pure_wp_monotonicity_forall (); fun () -> f (c ()) ()", "val d_bind (#a #b #wc #wf: _) (c: m a D wc) (f: (x: a -> m b D (wf x))) : m b D (bind_wp wc wf)\nlet d_bind #a #b #wc #wf (c : m a D wc) (f : (x:a -> m b D (wf x))) : m b D (bind_wp wc wf) =\n raise_val (fun () -> let y = downgrade_val c () in // cannot inline this\n downgrade_val (f y) ())", "val bind_post\n (a: Type)\n (pre1: pre_t)\n (post1: post_t a)\n (b: Type)\n (pre2: (a -> pre_t))\n (post2: (a -> post_t b))\n : post_t b\nlet bind_post\n (a:Type) (pre1:pre_t) (post1:post_t a)\n (b:Type) (pre2:a -> pre_t) (post2:a -> post_t b)\n : post_t b\n = fun s0 z s2 -> (exists s1 y. post1 s0 (Some y) s1 /\\ post2 y s1 z s2)\n \\/ (post1 s0 None s2)", "val bind_pure_st_ (a:Type) (b:Type)\n (#[@@@ framing_implicit] wp:pure_wp a)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] req:a -> pure_pre)\n (#[@@@ framing_implicit] ens:a -> pure_post b)\n (f:eqtype_as_type unit -> PURE a wp)\n (g:(x:a -> repr b framed pre post (req x) (ens x)))\n: repr b\n framed\n pre\n post\n (bind_pure_st_req wp req)\n (bind_pure_st_ens wp ens)\nlet bind_pure_st_ (a:Type) (b:Type)\n (#[@@@ framing_implicit] wp:pure_wp a)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] req:a -> Type0)\n (#[@@@ framing_implicit] ens:a -> b -> Type0)\n (f:eqtype_as_type unit -> PURE a wp)\n (g:(x:a -> repr b framed pre post (req x) (ens x)))\n : repr b\n framed\n pre\n post\n (bind_pure_st_req wp req)\n (bind_pure_st_ens wp ens)\n = let c\n : Steel.Effect.repr b\n framed\n pre\n post\n (bind_pure_steel__req wp (fun x _ -> req x))\n (bind_pure_steel__ens wp (fun x _ y _ -> ens x y))\n =(Steel.Effect.bind_pure_steel_ a b\n #wp\n #framed\n #pre\n #post\n #(fun x _ -> req x)\n #(fun x _ y _ -> ens x y)\n f\n g)\n in\n FStar.Monotonic.Pure.elim_pure_wp_monotonicity #a wp;\n weaken_repr _ _ _ _ _ _ _ _ c () ()", "val bind\n (a b: Type)\n (w0 r0 w1 r1: label)\n (fs0 fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : ist b (union w0 w1) (union r0 r1) (fs0 @ add_source r0 ((bot, w1) :: fs1))\nlet bind (a b:Type)\n (w0 r0 w1 r1:label) (fs0 fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : ist b\n (union w0 w1) // union the writes\n (union r0 r1) // union the reads\n (fs0 @ // flows of x\n add_source r0 ((bot, w1) // plus flows from whatever x reads to whatever y writes\n ::fs1)) //plus the flows of y\n = let f = fun s0 -> let v, s1 = x s0 in y v s1 in\n bind_comp_reads_ok x y;\n bind_comp_reads_ok x y;\n bind_comp_flows_ok x y;\n f", "val bind_div_nmst\n (a b: Type)\n (wp: pure_wp a)\n (state: Type u#2)\n (rel: P.preorder state)\n (req: (a -> M.pre_t state))\n (ens: (a -> M.post_t state b))\n (f: (eqtype_as_type unit -> DIV a wp))\n (g: (x: a -> repr b state rel (req x) (ens x)))\n : repr b\n state\n rel\n (fun s0 -> wp (fun _ -> True) /\\ (forall x. req x s0))\n (fun s0 y s1 -> exists x. (ens x) s0 y s1)\nlet bind_div_nmst (a:Type) (b:Type)\n (wp:pure_wp a)\n (state:Type u#2) (rel:P.preorder state) (req:a -> M.pre_t state) (ens:a -> M.post_t state b)\n (f:eqtype_as_type unit -> DIV a wp) (g:(x:a -> repr b state rel (req x) (ens x)))\n: repr b state rel\n (fun s0 -> wp (fun _ -> True) /\\ (forall x. req x s0))\n (fun s0 y s1 -> exists x. (ens x) s0 y s1)\n= elim_pure_wp_monotonicity wp;\n fun s0 ->\n let x = f () in\n (g x) s0", "val bind : (a:Type) -> (b:Type) ->\n (m:stexnc a) -> (f:a -> stexnc b) -> stexnc b\nlet bind a b m f =\n fun s0 ->\n let r0 = m s0 in\n match r0 with\n | None, (s1, c1) -> None, (s1, c1)\n | Some r, (s1, c1) -> let res, (s, c2) = f r s1\n in res, (s, c1 + c2)", "val bind_div_mst\n (a b: Type)\n (wp: pure_wp a)\n (state: Type u#2)\n (rel: P.preorder state)\n (req: (a -> pre_t state))\n (ens: (a -> post_t state b))\n (f: (eqtype_as_type unit -> DIV a wp))\n (g: (x: a -> repr b state rel (req x) (ens x)))\n : repr b\n state\n rel\n (fun s0 -> wp (fun _ -> True) /\\ (forall x. req x s0))\n (fun s0 y s1 -> exists x. (ens x) s0 y s1)\nlet bind_div_mst (a:Type) (b:Type)\n (wp:pure_wp a)\n (state:Type u#2) (rel:P.preorder state) (req:a -> pre_t state) (ens:a -> post_t state b)\n (f:eqtype_as_type unit -> DIV a wp) (g:(x:a -> repr b state rel (req x) (ens x)))\n: repr b state rel\n (fun s0 -> wp (fun _ -> True) /\\ (forall x. req x s0))\n (fun s0 y s1 -> exists x. (ens x) s0 y s1)\n= elim_pure_wp_monotonicity wp;\n fun s0 ->\n let x = f () in\n (g x) s0", "val bind\n (a b: Type)\n (w0 r0: label)\n (fs0: flows)\n (w1 r1: label)\n (fs1: flows)\n (x: ist a w0 r0 fs0)\n (y: (a -> ist b w1 r1 fs1))\n : ist b (union w0 w1) (union r0 r1) (fs0 @ add_source r0 ((bot, w1) :: fs1))\nlet bind (a b:Type)\n (w0 r0:label) (fs0:flows)\n (w1 r1:label) (fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : ist b (union w0 w1) (union r0 r1) (fs0 @ add_source r0 ((bot, w1)::fs1))\n = let f = fun s0 -> let v, s1 = x s0 in y v s1 in\n bind_comp_reads_ok x y;\n bind_comp_reads_ok x y;\n bind_comp_flows_ok x y;\n f", "val bind_hoarest_pure\n (a b: Type)\n (req: pre_t)\n (ens: post_t a)\n (wp: (a -> pure_wp b))\n (f: repr a req ens)\n (g: (x: a -> unit -> PURE b (wp x)))\n : repr b\n (fun h -> req h /\\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))\n (fun h0 r h1 -> exists x. ens h0 x h1 /\\ (~((wp x) (fun y -> y =!= r))))\nlet bind_hoarest_pure (a:Type) (b:Type) (req:pre_t) (ens:post_t a) (wp:a -> pure_wp b)\n (f:repr a req ens) (g:(x:a -> unit -> PURE b (wp x)))\n: repr b\n (fun h -> req h /\\ (forall x h1. ens h x h1 ==> (wp x) (fun _ -> True)))\n (fun h0 r h1 -> exists x. ens h0 x h1 /\\ (~ ((wp x) (fun y -> y =!= r))))\n= FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall ();\n fun _ ->\n let x = f () in\n (g x) ()", "val read_bind_spec\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g: (x: a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n : Tot\n (read_repr_spec b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ()))))\nlet read_bind_spec\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n: Tot (read_repr_spec b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n )\n= fun _ ->\n match f_bind_spec () with\n | Correct a -> g a ()\n | Error e -> Error e", "val read_bind_spec\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g: (x: a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n : Tot\n (read_repr_spec b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ()))))\nlet read_bind_spec\n (a:Type) (b:Type)\n (pre_f: pure_pre) (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (f_bind_spec: read_repr_spec a pre_f post_f post_err_f)\n (g:(x:a -> read_repr_spec b (pre_g x) (post_g x) (post_err_g x)))\n: Tot (read_repr_spec b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n )\n= fun _ ->\n match f_bind_spec () with\n | Correct a -> g a ()\n | Error e -> Error e", "val bind\n (a b: Type)\n (r_in_f [@@@ refl_implicit]r_out_f: parser)\n ([@@@ refl_implicit]l_f: memory_invariant)\n ([@@@ refl_implicit]r_in_g r_out_g: parser)\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr1: squash (r_out_f == r_in_g))\n ([@@@ refl_implicit]pr2: squash (l_f == l_g))\n (f_bind: repr a r_in_f r_out_f l_f)\n (g: (x: a -> repr b (r_in_g) r_out_g l_g))\n : Tot (repr b r_in_f r_out_g l_g)\nlet bind (a:Type) (b:Type)\n (r_in_f:parser)\n ([@@@ refl_implicit] r_out_f: parser)\n ([@@@ refl_implicit] l_f: memory_invariant)\n ([@@@ refl_implicit] r_in_g:parser)\n (r_out_g: parser)\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr1:squash (r_out_f == r_in_g))\n ([@@@ refl_implicit] pr2:squash (l_f == l_g))\n (f_bind : repr a r_in_f r_out_f l_f)\n (g : (x: a -> repr b (r_in_g) r_out_g l_g))\n: Tot (repr b r_in_f r_out_g l_g)\n= 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)", "val bind (a:Type) (b:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t) (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:req_t pre_f) (#[@@@ framing_implicit] ens_f:ens_t pre_f a post_f)\n (#[@@@ framing_implicit] pre_g:a -> pre_t) (#[@@@ framing_implicit] post_g:a -> post_t b)\n (#[@@@ framing_implicit] req_g:(x:a -> req_t (pre_g x))) (#[@@@ framing_implicit] ens_g:(x:a -> ens_t (pre_g x) b (post_g x)))\n (#[@@@ framing_implicit] frame_f:vprop) (#[@@@ framing_implicit] frame_g:a -> vprop)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f))\n (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g))\n (#[@@@ framing_implicit] pr:a -> prop)\n (#[@@@ framing_implicit] p1:squash (can_be_split_forall_dep pr\n (fun x -> post_f x `star` frame_f) (fun x -> pre_g x `star` frame_g x)))\n (#[@@@ framing_implicit] p2:squash (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x)))\n: repr b\n true\n (pre_f `star` frame_f)\n post\n (bind_req req_f ens_f req_g frame_f frame_g p1)\n (bind_ens req_f ens_f ens_g frame_f frame_g post p1 p2)\nlet bind a b #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #frame_f #frame_g #post #_ #_ #p #p2 f g\n = norm_repr (bind_opaque a b #framed_f #framed_g #pre_f #post_f #req_f #ens_f #pre_g #post_g #req_g #ens_g #frame_f #frame_g #post #_ #_ #p #p2 f g)", "val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q\nlet vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)", "val vbind : (#p:Type) -> (#q:Type) -> squash p -> (p -> squash q) -> Lemma q\nlet vbind #p #q sq f = FStar.Classical.give_witness_from_squash (FStar.Squash.bind_squash sq f)", "val bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\nlet bind\r\n (#a:Type u#a) (#b:Type u#b)\r\n (#pre1:slprop) (#post1:a -> slprop) (#post2:b -> slprop)\r\n (e1:stt a pre1 post1)\r\n (e2:(x:a -> stt b (post1 x) post2))\r\n: stt b pre1 post2\r\n= fun _ -> Sem.mbind (e1()) (fun x -> e2 x ())", "val bind (a:Type) (b:Type)\n (opened_invariants:inames)\n (o1:eqtype_as_type observability)\n (o2:eqtype_as_type observability)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:pure_pre)\n (#[@@@ framing_implicit] ens_f:pure_post a)\n (#[@@@ framing_implicit] pre_g:a -> pre_t)\n (#[@@@ framing_implicit] post_g:a -> post_t b)\n (#[@@@ framing_implicit] req_g:a -> pure_pre)\n (#[@@@ framing_implicit] ens_g:(a -> pure_post b))\n (#[@@@ framing_implicit] frame_f:vprop)\n (#[@@@ framing_implicit] frame_g:a -> vprop)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f))\n (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g))\n (#[@@@ framing_implicit] pr:a -> prop)\n (#[@@@ framing_implicit] p1:squash\n (can_be_split_forall_dep pr\n (fun x -> post_f x `star` frame_f)\n (fun x -> pre_g x `star` frame_g x)))\n (#[@@@ framing_implicit] p2:squash\n (can_be_split_post\n (fun x y -> post_g x y `star` frame_g x) post))\n (f:repr a framed_f opened_invariants o1 pre_f post_f req_f ens_f)\n (g:(x:a -> repr b framed_g opened_invariants o2 (pre_g x) (post_g x) (req_g x) (ens_g x)))\n : Pure (repr b\n true\n opened_invariants\n (join_obs o1 o2)\n (pre_f `star` frame_f)\n post\n (STF.bind_req a req_f ens_f pr req_g)\n (STF.bind_ens a b ens_f ens_g))\n (requires obs_at_most_one o1 o2)\n (ensures fun _ -> True)\nlet bind (a:Type) (b:Type)\n (opened_invariants:inames)\n (o1:eqtype_as_type observability)\n (o2:eqtype_as_type observability)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:Type0)\n (#[@@@ framing_implicit] ens_f:a -> Type0)\n (#[@@@ framing_implicit] pre_g:a -> pre_t)\n (#[@@@ framing_implicit] post_g:a -> post_t b)\n (#[@@@ framing_implicit] req_g:(a -> Type0))\n (#[@@@ framing_implicit] ens_g:(a -> b -> Type0))\n (#[@@@ framing_implicit] frame_f:vprop)\n (#[@@@ framing_implicit] frame_g:a -> vprop)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] _x1 : squash (maybe_emp framed_f frame_f))\n (#[@@@ framing_implicit] _x2 : squash (maybe_emp_dep framed_g frame_g))\n (#[@@@ framing_implicit] pr:a -> prop)\n (#[@@@ framing_implicit] p1:squash\n (can_be_split_forall_dep pr\n (fun x -> post_f x `star` frame_f)\n (fun x -> pre_g x `star` frame_g x)))\n (#[@@@ framing_implicit] p2:squash\n (can_be_split_post\n (fun x y -> post_g x y `star` frame_g x) post))\n (f:repr a framed_f opened_invariants o1 pre_f post_f req_f ens_f)\n (g:(x:a -> repr b framed_g opened_invariants o2 (pre_g x) (post_g x) (req_g x) (ens_g x)))\n = weaken_repr (SEA.bind a b opened_invariants o1 o2\n #framed_f\n #framed_g\n #pre_f\n #post_f\n #(fun _ -> req_f)\n #(fun _ x _ -> ens_f x)\n #pre_g\n #post_g\n #(fun x _ -> req_g x)\n #(fun x _ y _ -> ens_g x y)\n #frame_f\n #frame_g\n #post\n #_x1\n #_x2\n #pr\n #p1\n #p2\n f g) () ()", "val bind (a:Type) (b:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:pure_pre)\n (#[@@@ framing_implicit] ens_f:pure_post a)\n (#[@@@ framing_implicit] pre_g:a -> pre_t)\n (#[@@@ framing_implicit] post_g:a -> post_t b)\n (#[@@@ framing_implicit] req_g:a -> pure_pre)\n (#[@@@ framing_implicit] ens_g:(a -> pure_post b))\n (#[@@@ framing_implicit] frame_f:vprop)\n (#[@@@ framing_implicit] frame_g:a -> vprop)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] _ : squash (maybe_emp framed_f frame_f))\n (#[@@@ framing_implicit] _ : squash (maybe_emp_dep framed_g frame_g))\n (#[@@@ framing_implicit] pr:a -> prop)\n (#[@@@ framing_implicit] p1:squash\n (can_be_split_forall_dep pr\n (fun x -> post_f x `star` frame_f)\n (fun x -> pre_g x `star` frame_g x)))\n (#[@@@ framing_implicit] p2:squash\n (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x)))\n: repr b\n true\n (pre_f `star` frame_f)\n post\n (bind_req a req_f ens_f pr req_g)\n (bind_ens a b ens_f ens_g)\nlet bind (a:Type) (b:Type)\n (#framed_f:eqtype_as_type bool)\n (#framed_g:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre_f:pre_t)\n (#[@@@ framing_implicit] post_f:post_t a)\n (#[@@@ framing_implicit] req_f:Type0)\n (#[@@@ framing_implicit] ens_f:a -> Type0)\n (#[@@@ framing_implicit] pre_g:a -> pre_t)\n (#[@@@ framing_implicit] post_g:a -> post_t b)\n (#[@@@ framing_implicit] req_g:(a -> Type0))\n (#[@@@ framing_implicit] ens_g:(a -> b -> Type0))\n (#[@@@ framing_implicit] frame_f:vprop)\n (#[@@@ framing_implicit] frame_g:a -> vprop)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] _x1: squash (maybe_emp framed_f frame_f))\n (#[@@@ framing_implicit] _x2: squash (maybe_emp_dep framed_g frame_g))\n (#[@@@ framing_implicit] pr:a -> prop)\n (#[@@@ framing_implicit] p1:squash\n (can_be_split_forall_dep pr\n (fun x -> post_f x `star` frame_f)\n (fun x -> pre_g x `star` frame_g x)))\n (#[@@@ framing_implicit] p2:squash\n (can_be_split_post (fun x y -> post_g x y `star` frame_g x) post))\n (f:repr a framed_f pre_f post_f req_f ens_f)\n (g:(x:a -> repr b framed_g (pre_g x) (post_g x) (req_g x) (ens_g x)))\n = let c = Steel.Effect.bind a b #framed_f #framed_g\n #pre_f\n #post_f\n #(fun _ -> req_f)\n #(fun _ x _ -> ens_f x)\n #pre_g\n #post_g\n #(fun x _ -> req_g x)\n #(fun x _ y _ -> ens_g x y)\n #frame_f\n #frame_g\n #post\n #_x1\n #_x2\n #pr\n #p1\n #p2\n f g\n in\n weaken_repr _ _ _ _ _ _ _ _ c () ()", "val read_bind\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n ([@@@ refl_implicit]l_f: memory_invariant)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n ([@@@ refl_implicit]l_g: memory_invariant)\n ([@@@ refl_implicit]pr: squash (l_f == l_g))\n (f_bind: read_repr a pre_f post_f post_err_f l_f)\n (g: (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l_g))\n : Tot\n (read_repr b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ())))\n l_g)\nlet read_bind\n (a:Type) (b:Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n ([@@@ refl_implicit] l_f:memory_invariant)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n ([@@@ refl_implicit] l_g: memory_invariant)\n ([@@@ refl_implicit] pr:squash (l_f == l_g))\n (f_bind : read_repr a pre_f post_f post_err_f l_f)\n (g : (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l_g))\n: Tot (read_repr b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n l_g\n )\n= ReadRepr _ (read_bind_impl a b pre_f post_f post_err_f pre_g post_g post_err_g (ReadRepr?.spec f_bind) (fun x -> ReadRepr?.spec (g x)) l_g (ReadRepr?.impl f_bind) (fun x -> ReadRepr?.impl (g x)) )", "val read_bind\n (a b: Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x: a -> pure_pre))\n (post_g: (x: a -> pure_post' b (pre_g x)))\n (post_err_g: (x: a -> pure_post_err (pre_g x)))\n (l: memory_invariant)\n (f_bind: read_repr a pre_f post_f post_err_f l)\n (g: (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l))\n : Tot\n (read_repr b\n (pre_f /\\ (forall (x: a). post_f x ==> pre_g x))\n (fun y -> exists (x: a). pre_f /\\ post_f x /\\ post_g x y)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a). post_f x /\\ post_err_g x ())))\n l)\nlet read_bind\n (a:Type) (b:Type)\n (pre_f: pure_pre)\n (post_f: pure_post' a pre_f)\n (post_err_f: pure_post_err pre_f)\n (pre_g: (x:a) -> pure_pre) (post_g: (x:a) -> pure_post' b (pre_g x))\n (post_err_g: (x: a) -> pure_post_err (pre_g x))\n (l: memory_invariant)\n (f_bind : read_repr a pre_f post_f post_err_f l)\n (g : (x: a -> read_repr b (pre_g x) (post_g x) (post_err_g x) l))\n: Tot (read_repr b\n (pre_f /\\ (forall (x: a) . post_f x ==> pre_g x)) //(read_bind_pre a pre_f post_f pre_g)\n (fun y -> exists (x: a) . pre_f /\\ post_f x /\\ post_g x y) // (read_bind_post a b pre_f post_f pre_g post_g)\n (fun _ -> pre_f /\\ (post_err_f () \\/ (exists (x: a) . post_f x /\\ post_err_g x ()))) // (read_bind_post_err a pre_f post_f post_err_f pre_g post_err_g)\n l\n )\n= ReadRepr (read_bind_spec a b pre_f post_f post_err_f pre_g post_g post_err_g (ReadRepr?.spec f_bind) (fun x -> ReadRepr?.spec (g x)))", "val bind_conv:\n a: Type ->\n b: Type ->\n r_in_f: parser ->\n r_out_f: parser ->\n l_f: memory_invariant ->\n r_in_g: parser ->\n r_out_g: parser ->\n l_g: memory_invariant ->\n squash (r_out_f == r_in_g) ->\n squash (l_f == l_g) ->\n f_bind: repr a r_in_f r_out_f l_f ->\n g: (x: a -> repr b r_in_g r_out_g l_g) ->\n Prims.unit\n -> EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g\nlet bind_conv (a:Type) (b:Type)\n (r_in_f:parser)\n (r_out_f: parser)\n (l_f:memory_invariant)\n (r_in_g:parser)\n (r_out_g: parser)\n (l_g: memory_invariant)\n (_:squash (r_out_f == r_in_g))\n (_:squash (l_f == l_g))\n (f_bind : repr a r_in_f r_out_f l_f)\n (g : (x: a -> repr b r_in_g r_out_g l_g))\n ()\n: EWrite b r_in_f r_out_g (fun _ -> True) (fun _ _ _ -> True) (fun _ -> True) l_g\n= let x = EWrite?.reflect f_bind in\n EWrite?.reflect (g x)", "val rwi_subtype (a b: Type) (inj: (a -> b)) (i: idx) (pre: _) (post: st_bpost a) (c: m a i pre post)\n : Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\\ post h0 x0 h1))\nlet rwi_subtype (a b : Type) (inj : a -> b)\n (i:idx)\n (pre:_) (post:st_bpost a)\n (c : m a i pre post)\n : Tot (m b i pre (fun h0 x h1 -> exists x0. x == inj x0 /\\ post h0 x0 h1)) =\n bind _ _ _ _ _ _ _ _ c (fun (x:a) -> return _ (inj x))", "val GMST.gmst_bind = \n s: Type ->\n a: Type ->\n b: Type ->\n wp1: GMST.gmst_wp s a ->\n wp2: (_: a -> Prims.GTot (GMST.gmst_wp s b)) ->\n s0: s ->\n p: GMST.gmst_post s b s0\n -> Type0\nlet gmst_bind (s:Type) (a:Type) (b:Type)\n (wp1:gmst_wp s a) (wp2: (a -> GTot (gmst_wp s b)))\n (s0:s) (p:gmst_post s b s0) \n = wp1 s0 (fun rel1 x s1 -> wp2 x s1 (fun rel2 -> p (rel2 @ rel1)))", "val bind_wp_lem' (#a: Type u#aa) (#b: Type u#bb) (#s: _) (f: m s a) (g: (a -> m s b))\n : Lemma ((wp_of (bind_m f g)) `F.feq` (bind_wp (wp_of f) (wp_of *. g)))\nlet rec bind_wp_lem' (#a:Type u#aa) (#b:Type u#bb) (#s:_) (f:m s a) (g: (a -> m s b))\n : Lemma (wp_of (bind_m f g) `F.feq` bind_wp (wp_of f) (wp_of *. g))\n = match f with\n | Ret x ->\n assert (bind_m f g == g x);\n assert_norm (wp_of #a #s (Ret x) `F.feq` (fun s0 post -> post (x, s0)));\n assert (wp_of (bind_m (Ret x) g) `F.feq` bind_wp (wp_of (Ret x)) (wp_of *. g))\n by (T.norm [zeta; iota; delta];\n let x = T.forall_intro () in\n T.mapply (quote (eta u#(max bb 1) u#1)))\n\n | Put s k ->\n bind_wp_lem' k g;\n assert_norm (wp_put (bind_wp (wp_of k) (wp_of *. g)) s `F.feq`\n bind_wp (wp_put (wp_of k) s) (wp_of *. g))\n\n | Get k ->\n let aux (x:s)\n : Lemma\n (ensures (wp_of (bind_m (k x) g) `F.feq`\n bind_wp (wp_of (k x)) (wp_of *. g)))\n [SMTPat (k x)]\n = bind_wp_lem' (k x) g\n in\n assert_norm (wp_of (bind_m (Get k) g) ==\n wp_of (Get (fun x -> bind_m (k x) g)));\n assert_norm (wp_of (Get (fun x -> bind_m (k x) g)) ==\n F.on _ (fun s0 -> (wp_of (bind_m (k s0) g)) s0));\n\n assert ((fun s0 -> (wp_of (bind_m (k s0) g)) s0) `F.feq`\n (fun s0 -> bind_wp (wp_of (k s0)) (wp_of *. g) s0));\n assert_norm (bind_wp (wp_of (Get k)) (wp_of *. g) ==\n bind_wp (F.on _ (fun s0 -> wp_of (k s0) s0))\n (wp_of *. g));\n assert_norm (bind_wp (F.on _ (fun s0 -> wp_of (k s0) s0)) (wp_of *. g) ==\n F.on _ (fun s0 -> bind_wp (wp_of (k s0)) (wp_of *. g) s0))", "val bind_lpre\n (#st: st)\n (#a: Type)\n (#pre: st.hprop)\n (#post_a: post_t st a)\n (lpre_a: l_pre pre)\n (lpost_a: l_post pre post_a)\n (lpre_b: (x: a -> l_pre (post_a x)))\n : l_pre pre\nlet bind_lpre\n (#st:st)\n (#a:Type)\n (#pre:st.hprop)\n (#post_a:post_t st a)\n (lpre_a:l_pre pre)\n (lpost_a:l_post pre post_a)\n (lpre_b:(x:a -> l_pre (post_a x)))\n : l_pre pre\n =\n fun h -> lpre_a h /\\ (forall (x:a) h1. lpost_a h x h1 ==> lpre_b x h1)", "val tbind: #a: _ -> #b: _ -> rwtree a -> (a -> rwtree b) -> rwtree b\nlet tbind : #a:_ -> #b:_ -> rwtree a -> (a -> rwtree b) -> rwtree b = fun c f -> Alg.bind _ _ c f", "val tbind: #a: _ -> #b: _ -> rwtree a -> (a -> rwtree b) -> rwtree b\nlet tbind : #a:_ -> #b:_ -> rwtree a -> (a -> rwtree b) -> rwtree b = fun c f -> bind _ _ c f", "val lift_pure_rwi (a: Type) (wp: pure_wp a) (f: (unit -> PURE a wp))\n : m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\\ h1 == h0)\nlet lift_pure_rwi\n (a:Type)\n (wp : pure_wp a)\n (f :unit -> PURE a wp)\n // with the index-polymorphic bind above, this has to be in RO,\n // or unification will usually not find the index here\n : m a RO (fun _ -> wp (fun _ -> True)) (fun h0 x h1 -> sp wp x /\\ h1 == h0)\n = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;\n fun () -> f ()", "val bind_pure_stag (a:Type) (b:Type)\n (opened_invariants:inames)\n (o:eqtype_as_type observability)\n (#[@@@ framing_implicit] wp:pure_wp a)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] req:a -> pure_pre)\n (#[@@@ framing_implicit] ens:a -> pure_post b)\n (f:eqtype_as_type unit -> PURE a wp)\n (g:(x:a -> repr b framed opened_invariants o pre post (req x) (ens x)))\n: repr b\n framed opened_invariants o\n pre\n post\n (STF.bind_pure_st_req wp req)\n (STF.bind_pure_st_ens wp ens)\nlet bind_pure_stag (a:Type) (b:Type)\n (opened_invariants:inames)\n (o:eqtype_as_type observability)\n (#[@@@ framing_implicit] wp:pure_wp a)\n (#framed:eqtype_as_type bool)\n (#[@@@ framing_implicit] pre:pre_t)\n (#[@@@ framing_implicit] post:post_t b)\n (#[@@@ framing_implicit] req:a -> Type0)\n (#[@@@ framing_implicit] ens:a -> b -> Type0)\n (f:eqtype_as_type unit -> PURE a wp)\n (g:(x:a -> repr b framed opened_invariants o pre post (req x) (ens x)))\n = FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;\n weaken_repr (SEA.bind_pure_steela_ a b opened_invariants o #wp #framed #pre #post #(fun x _ -> req x) #(fun x _ y _ -> ens x y) f g) () ()", "val bind_pure_hoarest\n (a b: Type)\n (wp: pure_wp a)\n (req: (a -> pre_t))\n (ens: (a -> post_t b))\n (f: (unit -> PURE a wp))\n (g: (x: a -> repr b (req x) (ens x)))\n : repr b\n (fun h -> wp (fun x -> req x h))\n (fun h0 r h1 -> exists x. (~(wp (fun r -> r =!= x))) /\\ ens x h0 r h1)\nlet bind_pure_hoarest (a:Type) (b:Type) (wp:pure_wp a) (req:a -> pre_t) (ens:a -> post_t b)\n (f:unit -> PURE a wp) (g:(x:a -> repr b (req x) (ens x)))\n: repr b\n (fun h -> wp (fun x -> req x h))\n (fun h0 r h1 -> exists x. (~ (wp (fun r -> r =!= x))) /\\ ens x h0 r h1)\n= FStar.Monotonic.Pure.elim_pure_wp_monotonicity wp;\n fun _ ->\n let x = f () in\n g x ()", "val bind_explicit_univs\n (a b: Type u#a)\n (pre_f: pre_t)\n (post_f: post_t a)\n (req_f: req_t pre_f)\n (ens_f: ens_t pre_f a post_f)\n (post_g: post_t b)\n (req_g: (x: a -> req_t (post_f x)))\n (ens_g: (x: a -> ens_t (post_f x) b post_g))\n (f: repr a pre_f post_f req_f ens_f)\n (g: (x: a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n : repr u#a b pre_f post_g (Sem.bind_lpre req_f ens_f req_g) (Sem.bind_lpost req_f ens_f ens_g)\nlet bind_explicit_univs (a:Type u#a) (b:Type u#a)\n (pre_f:pre_t) (post_f:post_t a) (req_f:req_t pre_f) (ens_f:ens_t pre_f a post_f)\n (post_g:post_t b) (req_g:(x:a -> req_t (post_f x))) (ens_g:(x:a -> ens_t (post_f x) b post_g))\n (f:repr a pre_f post_f req_f ens_f) (g:(x:a -> repr b (post_f x) post_g (req_g x) (ens_g x)))\n: repr u#a b pre_f post_g\n (Sem.bind_lpre req_f ens_f req_g)\n (Sem.bind_lpost req_f ens_f ens_g)\n= Sem.Bind f g", "val post_a (a b: Type) (wp_g: (a -> wp_t b)) (p: post_t b) : post_t a\nlet post_a (a:Type) (b:Type) (wp_g:a -> wp_t b) (p:post_t b) : post_t a =\n fun r ->\n match r with\n | None -> p None\n | Some r -> wp_g (Mktuple2?._1 r) p (Mktuple2?._2 r)", "val bind (a b: Type) (i: idx) (c: m a i) (f: (a -> m b i)) : m b i\nlet bind (a b : Type) (i:idx) (c : m a i) (f : a -> m b i) : m b i =\n match i with\n | T -> t_bind #a #b c f\n | D -> coerce (d_bind #a #b c f) // GM: wow... still needs a coerce, how can that be?\n | G -> g_bind #a #b c f" ], "closest_src": [ { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.bind" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.ibind" }, { "project_name": "FStar", "file_name": "GenericTotalDM4A.fst", "name": "GenericTotalDM4A.bind" }, { "project_name": "FStar", "file_name": "ID3.fst", "name": "ID3.bind" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.bind" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.bind" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.bind" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.bind" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.bind" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.bind" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.bind" }, { "project_name": "FStar", "file_name": "ID2.fst", "name": "ID2.bind" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.bind" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.bind2" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.bind" }, { "project_name": "FStar", "file_name": "Locals.Effect.fst", "name": "Locals.Effect.bind" }, { "project_name": "FStar", "file_name": "IST.fst", "name": "IST.st_bind_wp" }, { "project_name": "FStar", "file_name": "ID4.fst", "name": "ID4.bind_wp" }, { "project_name": "FStar", "file_name": "DM4F.fst", "name": "DM4F.bind_wp" }, { "project_name": "FStar", "file_name": "OPLSS2021.DijkstraMonads.fst", "name": "OPLSS2021.DijkstraMonads.bind_wp" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.w_bind" }, { "project_name": "FStar", "file_name": "ID3.fst", "name": "ID3.bind_wp" }, { "project_name": "FStar", "file_name": "ID1.fst", "name": "ID1.bind_wp" }, { "project_name": "FStar", "file_name": "ID5.fst", "name": "ID5.bind_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.bind_wp" }, { "project_name": "FStar", "file_name": "DM4F_layered.fst", "name": "DM4F_layered.bind_wp" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.bind_wp" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.bind_wp" }, { "project_name": "FStar", "file_name": "IMST.fst", "name": "IMST.st_bind" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.bind" }, { "project_name": "FStar", "file_name": "IteSoundness.fst", "name": "IteSoundness.bind" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.bind_wp" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.bind_wp" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.bind_wp" }, { "project_name": "FStar", "file_name": "IMSTsub.fst", "name": "IMSTsub.st_bind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.Effect.fsti", "name": "FStar.Tactics.Effect.tac_bind_wp" }, { "project_name": "FStar", "file_name": "HoareST.fst", "name": "HoareST.bind" }, { "project_name": "FStar", "file_name": "MSeqExn.fst", "name": "MSeqExn.bind" }, { "project_name": "FStar", "file_name": "DM4F_layered5.fst", "name": "DM4F_layered5.pure_bind_wp" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.interp_bind" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.interp_bind" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.bind" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.bind" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.st_bind_wp" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.all_bind_wp" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.pre_bind" }, { "project_name": "FStar", "file_name": "IEXN.fst", "name": "IEXN.iex_bind_wp" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.t_bind" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.bind" }, { "project_name": "FStar", "file_name": "IteSoundness.fst", "name": "IteSoundness.bind_wp" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.ex_bind_wp" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.bind_pre" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.ebind" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.bind" }, { "project_name": "FStar", "file_name": "FStar.Pervasives.fsti", "name": "FStar.Pervasives.pure_bind_wp" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.QuickCodes.fsti", "name": "Vale.PPC64LE.QuickCodes.wp_Bind" }, { "project_name": "hacl-star", "file_name": "Vale.X64.QuickCodes.fsti", "name": "Vale.X64.QuickCodes.wp_Bind" }, { "project_name": "FStar", "file_name": "AlgWP.fst", "name": "AlgWP.interp_bind" }, { "project_name": "FStar", "file_name": "HoareSTFree.fst", "name": "HoareSTFree.bind" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.bind" }, { "project_name": "FStar", "file_name": "FStar.MSTTotal.fst", "name": "FStar.MSTTotal.bind" }, { "project_name": "FStar", "file_name": "FStar.NMSTTotal.fst", "name": "FStar.NMSTTotal.bind" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.bind" }, { "project_name": "FStar", "file_name": "HoareDiv.fst", "name": "HoareDiv.bind" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.bind_wp" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.g_bind" }, { "project_name": "FStar", "file_name": "GTWP.fst", "name": "GTWP.d_bind" }, { "project_name": "FStar", "file_name": "LatticeSpec.fst", "name": "LatticeSpec.bind_post" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.fst", "name": "Steel.ST.Effect.bind_pure_st_" }, { "project_name": "FStar", "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.bind" }, { "project_name": "FStar", "file_name": "FStar.NMST.fst", "name": "FStar.NMST.bind_div_nmst" }, { "project_name": "FStar", "file_name": "FStar.DM4F.StExnC.fst", "name": "FStar.DM4F.StExnC.bind" }, { "project_name": "FStar", "file_name": "FStar.MST.fst", "name": "FStar.MST.bind_div_mst" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.bind" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind_hoarest_pure" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_bind_spec" }, { "project_name": "FStar", "file_name": "BUGSLowParseWriters.fst", "name": "BUGSLowParseWriters.read_bind_spec" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.bind" }, { "project_name": "steel", "file_name": "Steel.Effect.fst", "name": "Steel.Effect.bind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V2.Logic.fst", "name": "FStar.Tactics.V2.Logic.vbind" }, { "project_name": "FStar", "file_name": "FStar.Tactics.V1.Logic.fst", "name": "FStar.Tactics.V1.Logic.vbind" }, { "project_name": "steel", "file_name": "PulseCore.InstantiatedSemantics.fst", "name": "PulseCore.InstantiatedSemantics.bind" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.bind" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.fst", "name": "Steel.ST.Effect.bind" }, { "project_name": "FStar", "file_name": "LowParseWriters.fsti", "name": "LowParseWriters.read_bind" }, { "project_name": "FStar", "file_name": "BUGSLowParseWriters.fst", "name": "BUGSLowParseWriters.read_bind" }, { "project_name": "FStar", "file_name": "LowParseWriters.NoHoare.fst", "name": "LowParseWriters.NoHoare.bind_conv" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.rwi_subtype" }, { "project_name": "FStar", "file_name": "GMST.fst", "name": "GMST.gmst_bind" }, { "project_name": "FStar", "file_name": "DijkstraStateMonad.fst", "name": "DijkstraStateMonad.bind_wp_lem'" }, { "project_name": "steel", "file_name": "Steel.Semantics.Hoare.MST.fst", "name": "Steel.Semantics.Hoare.MST.bind_lpre" }, { "project_name": "FStar", "file_name": "AlgForAll.fst", "name": "AlgForAll.tbind" }, { "project_name": "FStar", "file_name": "AlgHeap.fst", "name": "AlgHeap.tbind" }, { "project_name": "FStar", "file_name": "RW.fst", "name": "RW.lift_pure_rwi" }, { "project_name": "steel", "file_name": "Steel.ST.Effect.AtomicAndGhost.fst", "name": "Steel.ST.Effect.AtomicAndGhost.bind_pure_stag" }, { "project_name": "FStar", "file_name": "HoareSTPolyBind.fst", "name": "HoareSTPolyBind.bind_pure_hoarest" }, { "project_name": "steel", "file_name": "Steel.Effect.M.fst", "name": "Steel.Effect.M.bind_explicit_univs" }, { "project_name": "FStar", "file_name": "LL.fst", "name": "LL.post_a" }, { "project_name": "FStar", "file_name": "GT.fst", "name": "GT.bind" } ], "selected_premises": [ "FStar.FunctionalExtensionality.feq", "GenericPartialDM4A.return", "GenericPartialDM4A.fa_elim", "FStar.Tactics.Effect.raise", "FStar.FunctionalExtensionality.on_dom", "FStar.WellFounded.fix_F", "FStar.Pervasives.reveal_opaque", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "GenericPartialDM4A.repr", "FStar.Tactics.Types.issues", "GenericPartialDM4A.equiv", "FStar.WellFounded.well_founded", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity", "FStar.Tactics.Effect.get", "FStar.Pervasives.dfst", "FStar.FunctionalExtensionality.on", "FStar.Pervasives.dsnd", "FStar.WellFounded.inverse_image", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.WellFounded.fix", "FStar.WellFounded.binrel", "FStar.FunctionalExtensionality.restricted_t", "FStar.FunctionalExtensionality.arrow", "FStar.Monotonic.Pure.elim_pure_wp_monotonicity_forall", "FStar.Monotonic.Pure.intro_pure_wp_monotonicity", "FStar.WellFounded.is_well_founded", "FStar.WellFounded.inverse_image_wf", "FStar.Pervasives.st_post_h", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater_Greater", "FStar.Classical.Sugar.implies_elim", "FStar.FunctionalExtensionality.feq_g", "FStar.FunctionalExtensionality.on_dom_g", "FStar.FunctionalExtensionality.is_restricted", "FStar.Tactics.Effect.tactic", "FStar.FunctionalExtensionality.restricted_g_t", "FStar.Pervasives.ex_pre", "FStar.Issue.mk_issue", "FStar.Pervasives.st_pre_h", "FStar.WellFounded.subrelation_squash_wf", "Prims.auto_squash", "FStar.Pervasives.id", "FStar.FunctionalExtensionality.efun", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.all_post_h", "FStar.Issue.issue_level_string", "FStar.FunctionalExtensionality.efun_g", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.all_pre_h", "FStar.Preorder.preorder_rel", "FStar.Monotonic.Pure.is_monotonic", "FStar.FunctionalExtensionality.arrow_g", "FStar.FunctionalExtensionality.on_g", "FStar.Pervasives.all_post_h'", "FStar.WellFounded.subrelation_wf", "FStar.Pervasives.all_wp_h", "FStar.Pervasives.coerce_eq", "FStar.FunctionalExtensionality.is_restricted_g", "FStar.Monotonic.Pure.as_pure_wp", "FStar.Pervasives.st_stronger", "FStar.WellFounded.well_founded_relation", "FStar.Pervasives.ex_post'", "FStar.Pervasives.pure_ite_wp", "FStar.Tactics.Effect.tac_bind_wp", "FStar.Pervasives.pure_bind_wp", "FStar.Pervasives.all_stronger", "FStar.Pervasives.pure_close_wp", "FStar.Tactics.Effect.tac_close", "FStar.Tactics.Effect.tac_wp_monotonic", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.ex_post", "FStar.Pervasives.ex_wp", "Prims.pure_pre", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.st_bind_wp", "FStar.Tactics.Effect.tac_if_then_else_wp", "FStar.Tactics.Effect.lift_div_tac", "FStar.Pervasives.st_return", "FStar.Tactics.Effect.tac", "FStar.Tactics.Effect.tac_wp_compact", "FStar.Tactics.Effect.lift_div_tac_wp", "FStar.Tactics.Effect.tac_repr", "FStar.Pervasives.st_trivial", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.all_ite_wp", "Prims.as_requires", "FStar.Pervasives.all_trivial", "FStar.Pervasives.all_return", "FStar.Pervasives.ex_trivial", "FStar.Pervasives.st_close_wp", "FStar.Pervasives.ex_bind_wp", "Prims.pure_wp'", "Prims.subtype_of", "Prims.pure_trivial", "Prims.pure_wp_monotonic", "Prims.pure_post'", "Prims.returnM", "FStar.Tactics.Effect.tac_return_wp", "FStar.Pervasives.all_if_then_else" ], "source_upto_this": "module GenericPartialDM4A\n\nopen FStar.Tactics.V2\nopen FStar.Calc\nopen FStar.FunctionalExtensionality\nmodule F = FStar.FunctionalExtensionality\nmodule W = FStar.WellFounded\nmodule T = FStar.Tactics.V2\nopen FStar.Preorder\n\n// m is a monad.\nassume val m (a : Type u#a) : Type u#a\nassume val m_return (#a : Type) : a -> m a\nassume val m_bind (#a #b : Type) : m a -> (a -> m b) -> m b\n\n// w is an ordered monad\n[@@erasable]\nassume val w (a : Type u#a) : Type u#(1 + a)\nassume val w_return (#a : Type) : a -> w a\nassume val w_bind (#a #b : Type) : w a -> (a -> w b) -> w b\nassume val stronger : (#a:Type) -> preorder (w a)\n\nlet equiv #a (w1 w2 : w a) = w1 `stronger` w2 /\\ w2 `stronger` w1\n\nassume val bind_is_monotonic\n (#a #b : Type)\n (w1 w2 : w a)\n (f1 f2 : a -> w b)\n : Lemma (requires (w1 `stronger` w2 /\\ (forall x. f1 x `stronger` f2 x)))\n (ensures (w_bind w1 f1 `stronger` w_bind w2 f2))\n\nlet (<<=) = stronger\n\n// a morphism between them, satisfying appropriate laws\nassume val interp (#a : Type) : m a -> w a\n\nassume val interp_ret (#a:Type) (x:a)\n : Lemma (interp (m_return x) `equiv` w_return x)\n\nassume val interp_bind (#a #b:Type)\n (c : m a) (f : a -> m b)\n : Lemma (interp (m_bind c f) `equiv` w_bind (interp c) (fun x -> interp (f x)))\n\n(* Note the #57-like trick *)\nlet repr (a : Type) (pre:Type0) (w: squash pre -> w a) =\n squash pre -> c:(m a){w () `stronger` interp c}\n\nlet return (a:Type) (x:a) : repr a True (fun _ -> w_return x) =\n fun _ ->\n interp_ret x;\n m_return x\n\nlet and_elim_2 (s : squash ('p /\\ 'q)) : squash 'q = ()\nlet fa_elim #a #p (s : squash (forall x. p x)) (x:a) : squash (p x) =\n Squash.bind_squash s (fun (f : (forall x. p x)) ->\n Squash.bind_squash f (fun (f : (x:a -> GTot (p x))) ->\n Squash.return_squash (f x)))\n", "sketch": [ "To implement `iw_bind`, we will first use the `repr` function to represent the input values in a way that is compatible with the ordering constraints of the ordered monad `w`. Then, we will use the `bind` operation of the ordered monad `w` to combine the represented values and functions. Finally, we will ensure that the resulting value satisfies the ordering constraints of the ordered monad `w`.", "The `iw_bind` function is about defining a new bind operation for the ordered monad `w`. It takes a value of type `a`, a predicate on `a`, a function from `a` to a predicate on `b`, and a proof that the value and the function satisfy the given predicates.\n\nThe `iw_bind` function is implemented by using the provided proof to ensure that the resulting computation using the bind operation satisfies the given predicates.", "The `iw_bind` function is about defining a new bind operation for the ordered monad `w`. It takes a value of type `a`, a predicate over `a`, a function from `a` to a predicate over `b`, and a proof that the value and function satisfy the given predicates.\n\nThe `iw_bind` function is implemented by using the existing `w_bind` operation and the provided proofs to ensure that the resulting value satisfies the combined predicates.", "The `iw_bind` function is about defining a new bind operation for the ordered monad `w`. It takes a value `wp_v` of type `squash pre_v -> w a` and a function `wp_f` of type `x: a -> squash (pre_f x) -> w b`, and combines them to produce a new value of type `w b`.\n\nThe `iw_bind` function is implemented by using the `wp_v` and `wp_f` functions to construct a new value of type `w b`, while ensuring that the ordering properties of the ordered monad `w` are preserved.", "The `iw_bind` function is about defining a new bind operation for the ordered monad `w`. It takes a value of type `a`, a predicate on `a`, a function from `a` to a predicate on `b`, and a proof that the value and the function satisfy the given predicates.\n\nThe `iw_bind` function is implemented by using the existing `w_bind` operation and the provided proofs to ensure that the resulting computation satisfies the given predicates.", "To implement `iw_bind`, we will first extract the value of `pre_v` and `pre_f` from the input. Then, we will use the extracted values to construct a new value of type `w b` by appropriately combining `wp_v` and `wp_f`. We will ensure that the resulting value satisfies the ordering properties of the ordered monad `w`.", "The `iw_bind` function is implemented by taking the value and function, applying the predicates to them, and using the provided proof to ensure that the resulting computation in the ordered monad `w` satisfies the given predicates.\n\n```fstar\nlet iw_bind (a:Type) (b:Type) (pre_v:Type0) (pre_f:a -> Type0)\n (wp_v:squash pre_v -> w a) (wp_f:(x:a) -> squash (pre_f x) -> w b)\n (pf:squash (pre_v /\\ (forall x. pre_f x)))\n : w b =\n let v = Squash.bind_squash pf (fun (pfv:pre_v) -> wp_v pfv) in\n let f = fun (x:a) -> Squash.bind_squash pf (fun (pfv:pre_v) -> wp_f x (Squash.return_squash pfv)) in\n w_bind v f\n```" ], "generated_solution": [ "let iw_bind (a:Type) (b:Type) (pre_v:Type0) (pre_f:a -> Type0)\n (wp_v:squash pre_v -> w a) (wp_f:(x:a) -> squash (pre_f x) -> w b)\n (s:squash (pre_v /\\ (forall x. pre_f x)))\n : w b =\n let rep_v = repr a pre_v wp_v in\n let rep_f (x:a) (s':squash (pre_f x)) = repr b (pre_f x) (fun _ -> wp_f x s') in\n let res = w_bind (rep_v s) (fun x -> rep_f x (fa_elim s x)) in\n and_elim_2 s;\n res", "let iw_bind (a:Type) (b:Type) (pre_v:Type0) (pre_f:a -> Type0)\n (wp_v:squash pre_v -> w a) (wp_f:(x:a) -> squash (pre_f x) -> w b)\n (pf:squash (pre_v /\\ (forall x. pre_f x)))\n : w b =\n let (v, pf_f) = Squash.untuple2 pf in\n let v_wp = wp_v v in\n let f_wp = wp_f v (Squash.bind_squash pf_f (fun f -> f)) in\n w_bind v_wp (fun x -> f_wp)", "let iw_bind (a:Type) (b:Type) (pre_v:Type0) (pre_f:a -> Type0)\n (wp_v:squash pre_v -> w a) (wp_f:(x:a) -> squash (pre_f x) -> w b)\n (pf:squash (pre_v /\\ (forall x. pre_f x))) : w b =\n w_bind (wp_v (Squash.and_elim_1 pf)) (fun x -> wp_f x (fa_elim pf x))", "let iw_bind (a: Type) (b: Type) (pre_v: Type0) (pre_f: a -> Type0)\n (wp_v: squash pre_v -> w a) (wp_f: a -> squash (pre_f a) -> w b)\n (s: squash (pre_v /\\ (forall x. pre_f x))) : w b =\n let v = wp_v (Squash.and_elim_1 s) in\n let f x = wp_f x (Squash.fa_elim s x) in\n w_bind v f", "let iw_bind (a: Type) (b: Type) (pre_v: Type0) (pre_f: a -> Type0)\n (wp_v: squash pre_v -> w a) (wp_f: a -> squash (pre_f a) -> w b)\n (proof: squash (pre_v /\\ (forall x. pre_f x))) : w b =\n let v = wp_v (fst proof) in\n let f = wp_f (fst (snd proof)) (fa_elim a pre_f (snd proof)) in\n w_bind v f", "let iw_bind (a:Type) (b:Type) (pre_v:Type0) (pre_f:a -> Type0)\n (wp_v:squash pre_v -> w a) (wp_f:(x:a) -> squash (pre_f x) -> w b)\n (pf:squash (pre_v /\\ (forall x. pre_f x))) : w b =\n let (v, f) = pf in\n let wv = wp_v v in\n let wf x = wp_f x (f x) in\n w_bind wv wf" ] }, { "file_name": "Pulse.Lib.HigherGhostReference.fst", "name": "Pulse.Lib.HigherGhostReference.gather2", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Pulse.Lib.PCM.Fraction" }, { "open": "FStar.PCM" }, { "open": "Pulse.Main" }, { "open": "Pulse.Lib.Core" }, { "open": "FStar.Ghost" }, { "open": "PulseCore.FractionalPermission" }, { "open": "Pulse.Lib.Core" }, { "open": "FStar.Tactics" }, { "open": "Pulse.Lib" }, { "open": "Pulse.Lib" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))", "source_definition": "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r #x0 #x1 #one_half #one_half", "source_range": { "start_line": 137, "start_col": 0, "end_line": 137, "end_col": 89 }, "interleaved": false, "definition": "fun r -> Pulse.Lib.HigherGhostReference.gather r", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Pulse.Lib.HigherGhostReference.ref", "FStar.Ghost.erased", "Pulse.Lib.HigherGhostReference.gather", "Pulse.Lib.Core.one_half", "Pulse.Lib.Core.stt_ghost", "Prims.unit", "Pulse.Lib.Core.op_Star_Star", "Pulse.Lib.HigherGhostReference.pts_to", "FStar.Ghost.reveal", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.pure", "Prims.eq2", "Pulse.Lib.Core.vprop" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "r: Pulse.Lib.HigherGhostReference.ref a\n -> Pulse.Lib.Core.stt_ghost Prims.unit\n (Pulse.Lib.HigherGhostReference.pts_to r (FStar.Ghost.reveal x0) **\n Pulse.Lib.HigherGhostReference.pts_to r (FStar.Ghost.reveal x1))\n (fun _ ->\n Pulse.Lib.HigherGhostReference.pts_to r (FStar.Ghost.reveal x0) **\n Pulse.Lib.Core.pure (x0 == x1))", "prompt": "let gather2 (#a: Type) (r: ref a) (#x0 #x1: erased a) =\n ", "expected_response": "gather r #x0 #x1 #one_half #one_half", "source": { "project_name": "steel", "file_name": "share/steel/examples/pulse/lib/Pulse.Lib.HigherGhostReference.fst", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Pulse.Lib.HigherGhostReference.fst", "checked_file": "dataset/Pulse.Lib.HigherGhostReference.fst.checked", "interface_file": true, "dependencies": [ "dataset/Pulse.Main.fsti.checked", "dataset/Pulse.Lib.PCM.Fraction.fst.checked", "dataset/Pulse.Lib.Core.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.PCM.fst.checked" ] }, "definitions_in_context": [ "let ref (a:Type u#1) = ghost_pcm_ref (pcm_frac #a)", "val ref ([@@@unused] a:Type u#1) : Type u#0", "let gref_non_informative (a:Type u#1) : non_informative_witness (ref a) = fun x -> reveal x", "val gref_non_informative (a:Type u#1) : non_informative_witness (ref a)", "let pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= ghost_pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)", "val pts_to (#a:Type)\n (r:ref a)\n (#[exact (`full_perm)] [@@@equate_by_smt] p:perm)\n ([@@@equate_by_smt] n:a)\n: vprop", "```pulse\nghost\nfn full_values_compatible (#a:Type u#1) (x:a)\nrequires emp\nensures pure (compatible pcm_frac (Some (x, full_perm)) (Some (x, full_perm)))\n{\n assert pure (FStar.PCM.composable pcm_frac (Some(x, full_perm)) None);\n}\n```", "val alloc (#a:Type) (x:a)\n : stt_ghost (ref a) emp (fun r -> pts_to r x)", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "```pulse\nghost\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.ghost_alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```", "val ( ! ) (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))", "val ( := ) (#a:Type) (r:ref a) (x:erased a) (#n:erased a)\n : stt_ghost unit\n (pts_to r n) \n (fun _ -> pts_to r x)", "let alloc = alloc'", "let write = ( := )", "let read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)", "```pulse\nghost\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:erased a\nensures pts_to r #p n ** pure (n == x)\n{\n unfold pts_to r #p n;\n with w. assert (ghost_pcm_pts_to r w);\n let x = Pulse.Lib.Core.ghost_read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (ghost_pcm_pts_to r w);\n fold (pts_to r #p n);\n hide (fst (Some?.v x))\n}\n```", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)", "let read = read'", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))", "let ( ! ) #a = read #a", "```pulse\nghost\nfn write' (#a:Type u#1) (r:ref a) (x:erased a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures pts_to r #full_perm x\n{\n unfold pts_to r #full_perm n;\n with w. assert (ghost_pcm_pts_to r w);\n Pulse.Lib.Core.ghost_write r _ _ (mk_frame_preserving_upd n x);\n fold pts_to r #full_perm x;\n}\n```", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))", "val pts_to_perm_bound (#a:_) (#p:_) (r:ref a) (#v:a)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ -> pts_to r #p v ** pure (p `lesser_equal_perm` full_perm))", "let ( := ) #a = write' #a", "```pulse\nghost\nfn free' #a (r:ref a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures emp\n{\n unfold pts_to r #full_perm n;\n Pulse.Lib.Core.ghost_write r _ _ (mk_frame_preserving_upd_none n);\n Pulse.Lib.Core.drop_ _;\n}\n```", "let free = free'", "```pulse\nghost\nfn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite ghost_pcm_pts_to r (Some (reveal v, p))\n as ghost_pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.ghost_share r (Some (reveal v, half_perm p)) _; //writing an underscore for the first arg also causes a crash\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}\n```", "let share = share'", "```pulse\nghost\nfn gather' #a (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\nrequires pts_to r #p0 x0 ** pts_to r #p1 x1\nensures pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1)\n{ \n unfold pts_to r #p0 x0;\n unfold pts_to r #p1 x1;\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, p0)) (Some (reveal x1, p1));\n fold (pts_to r #(sum_perm p0 p1) x0)\n}\n```", "let gather = gather'", "let share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm" ], "closest": [ "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n: stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun () -> pts_to r x0 ** pure (x0 == x1))\n= gather r", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r #x0 #x1 #one_half #one_half", "val gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) = gather r", "val gather2 (#a:Type) (r:box a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))\nlet gather2 b = R.gather2 b", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val gather (#a:Type) (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather = gather'", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share #a r #v", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "val share2 (#a:Type) (r:ref a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 (#a:Type) (r:ref a) (#v:erased a)\n: stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\n= share #a r #v", "val gather (#a:Type) (r:box a) (#x0 #x1:erased a) (#p0 #p1:perm)\n : stt_ghost unit\n (pts_to r #p0 x0 ** pts_to r #p1 x1)\n (fun _ -> pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1))\nlet gather b = R.gather b", "val gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\nlet gather (#a:Type)\n (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p0 x0 `star` pts_to r p1 x1)\n (fun _ -> pts_to r (sum_perm p0 p1) x0)\n (requires True)\n (ensures fun _ -> x0 == x1)\n = coerce_ghost (fun _ -> R.ghost_gather_pt #a #u #p0 #p1 #x0 #x1 r)", "val share2 (#a:Type) (r:box a) (#v:erased a)\n : stt_ghost unit\n (pts_to r v)\n (fun _ -> pts_to r #one_half v ** pts_to r #one_half v)\nlet share2 b = R.share2 b", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather\n p1 r\n= RST.gather p1 r.reveal", "val gather (#a:Type)\n (#uses:_) \n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet gather (#a:Type)\n (#uses:_)\n (#p0 p1:perm)\n (#v0 #v1:erased a)\n (r:ref a)\n : STGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost (fun _ -> R.gather #a #uses #p0 #p1 #v0 #v1 r)", "val ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather_pt (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> true)\n (ensures fun _ _ _ -> x0 == x1)\n = H.ghost_gather r", "val ghost_gather (#a:Type) (#u:_)\n (#p0 #p1:perm)\n (#x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r (sum_perm p0 p1) x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather r = gather (reveal r)", "val gather (#a:Type) (#uses:_) (#p0:perm) (#p1:perm) (#v0 #v1:erased a) (r:ref a)\n : SteelGhost unit uses\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r (sum_perm p0 p1) v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet gather (#a:Type) (#uses:_) (#p0:perm) (#p1:perm) (#v0 #v1:erased a) (r:ref a)\n = let v0_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v0, p0)) in\n let v1_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v1, p1)) in\n rewrite_slprop\n (pts_to r p0 v0)\n (pts_to_raw r p0 v0 `star` pure (perm_ok p0))\n (fun _ -> ());\n rewrite_slprop\n (pts_to r p1 v1)\n (pts_to_raw r p1 v1 `star` pure (perm_ok p1))\n (fun _ -> ());\n elim_pure (perm_ok p0);\n elim_pure (perm_ok p1);\n let _ = gather_atomic_raw r v0 v1 in\n intro_pts_to (sum_perm p0 p1) r", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val share (#a:Type) (r:ref a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share = share'", "val gather\n (#a:Type)\n (v:vec a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n : stt_ghost unit\n (requires pts_to v #p0 s0 ** pts_to v #p1 s1)\n (ensures fun _ -> pts_to v #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather v = A.gather v", "val ghost_gather\n (#a: Type)\n (#u: _)\n (#p0 #p1: perm)\n (#p: perm{p == sum_perm p0 p1})\n (x0 #x1: erased a)\n (r: ghost_ref a)\n : SteelGhost unit\n u\n ((ghost_pts_to r p0 x0) `star` (ghost_pts_to r p1 x1))\n (fun _ -> ghost_pts_to r p x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\nlet ghost_gather (#a:Type) (#u:_)\n (#p0 #p1:perm) (#p:perm{p == sum_perm p0 p1})\n (x0 #x1:erased a)\n (r:ghost_ref a)\n : SteelGhost unit u\n (ghost_pts_to r p0 x0 `star`\n ghost_pts_to r p1 x1)\n (fun _ -> ghost_pts_to r p x0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> x0 == x1)\n = let _ = ghost_gather_pt #a #u #p0 #p1 r in ()", "val gather\n (#a:Type)\n (arr:array a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n: stt_ghost unit\n (requires pts_to arr #p0 s0 ** pts_to arr #p1 s1)\n (ensures fun _ -> pts_to arr #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather = gather'", "val gather\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ref a pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a)\r\n: stt_ghost (squash (composable pcm v0 v1))\r\n (pts_to r v0 ** pts_to r v1)\r\n (fun _ -> pts_to r (op pcm v0 v1))\nlet gather #a #pcm r v0 v1 = Ghost.hide (A.gather r v0 v1)", "val share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\nlet share (#a:Type)\n (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r p x)\n (fun _ -> pts_to r (half_perm p) x `star`\n pts_to r (half_perm p) x)\n = coerce_ghost (fun _ -> R.ghost_share_pt r)", "val gather\n (#a:Type)\n (arr:array a)\n (#s0 #s1:Ghost.erased (Seq.seq a))\n (#p0 #p1:perm)\n : stt_ghost unit\n (requires pts_to arr #p0 s0 ** pts_to arr #p1 s1)\n (ensures fun _ -> pts_to arr #(sum_perm p0 p1) s0 ** pure (s0 == s1))\nlet gather = gather'", "val ghost_gather (#uses: inames) (v1 #v2: G.erased int) (r: ghost_ref int)\n : SteelGhost unit\n uses\n ((ghost_pts_to r (P.half_perm full_perm) v1)\n `star`\n (ghost_pts_to r (P.half_perm full_perm) v2))\n (fun _ -> ghost_pts_to r full_perm v1)\n (fun _ -> True)\n (fun _ _ _ -> v1 == v2)\nlet ghost_gather (#uses:inames) (v1 #v2:G.erased int) (r:ghost_ref int)\n : SteelGhost unit uses\n (ghost_pts_to r (P.half_perm full_perm) v1 `star`\n ghost_pts_to r (P.half_perm full_perm) v2)\n (fun _ -> ghost_pts_to r full_perm v1)\n (fun _ -> True)\n (fun _ _ _ -> v1 == v2)\n = ghost_gather_pt #_ #_ #_ #_ #v1 #v2 r;\n rewrite_slprop\n (ghost_pts_to _ (sum_perm (half_perm full_perm) (half_perm full_perm)) _)\n (ghost_pts_to _ full_perm _)\n (fun _ -> ())", "val share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (pts_to r p x)\n (fun _ -> pts_to r p1 x `star`\n pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\n = let v_old : erased (fractional a) = Ghost.hide (Some (Ghost.reveal v, p)) in\n rewrite_slprop\n (pts_to r p v)\n (pts_to' r p v)\n (fun _ -> ());\n elim_pure (perm_ok p);\n share_atomic_raw_gen r v p1 p2;\n intro_pts_to p1 r;\n intro_pts_to p2 r", "val gather\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (#x1: Seq.seq elt) (p1: P.perm)\n (#x2: Seq.seq elt) (p2: P.perm)\n: STGhost unit opened\n (pts_to a p1 x1 `star` pts_to a p2 x2)\n (fun _ -> pts_to a (p1 `P.sum_perm` p2) x1)\n (True)\n (fun _ -> x1 == x2)\nlet gather\n #_ #_ a #x1 p1 #x2 p2\n= rewrite\n (pts_to a p1 _)\n (H.pts_to a p1 (seq_map raise x1));\n rewrite\n (pts_to a p2 _)\n (H.pts_to a p2 (seq_map raise x2));\n H.gather a p1 p2;\n rewrite\n (H.pts_to a _ _)\n (pts_to _ _ _)", "val gather\n (#opened: _)\n (#elt: Type)\n (a: array elt)\n (#x1: Seq.seq elt) (p1: P.perm)\n (#x2: Seq.seq elt) (p2: P.perm)\n: STGhost unit opened\n (pts_to a p1 x1 `star` pts_to a p2 x2)\n (fun _ -> pts_to a (p1 `P.sum_perm` p2) x1)\n (True)\n (fun _ -> x1 == x2)\nlet gather\n a #x1 p1 #x2 p2\n= elim_pts_to a p1 x1;\n elim_pts_to a p2 x2;\n let _ = R.gather (ptr_of a).base\n (mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 p1)\n (mk_carrier (US.v (ptr_of a).base_len) ((ptr_of a).offset) x2 p2)\n in\n mk_carrier_gather (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 x2 p1 p2;\n mk_carrier_valid_sum_perm (US.v (ptr_of a).base_len) ((ptr_of a).offset) x1 p1 p2;\n intro_pts_to a (p1 `P.sum_perm` p2) x1", "val write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n (x:erased a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_write_pt r x)", "val share (#a:Type) (r:box a) (#v:erased a) (#p:perm)\n : stt_ghost unit\n (pts_to r #p v)\n (fun _ ->\n pts_to r #(half_perm p) v **\n pts_to r #(half_perm p) v)\nlet share b = R.share b", "val free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\nlet free (#a:Type0)\n (#u:_)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit u\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_ghost (fun _ -> R.ghost_free_pt r)", "val share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share_pt r)", "val read (#a:Type) (r:ref a) (#n:erased a) (#p:perm)\n : stt_ghost (erased a)\n (pts_to r #p n)\n (fun x -> pts_to r #p n ** pure (n == x))\nlet read = read'", "val ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n = H.ghost_share #_ #_ #_ #(raise_erased x) r", "val ghost_share (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n : SteelGhostT unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r (half_perm p) x `star`\n ghost_pts_to r (half_perm p) x)\nlet ghost_share r = share (reveal r)", "val gather (#o:inames)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:a)\n (v1:a)\n : STGhostT (_:unit{composable p v0 v1}) o\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\nlet gather (#o:inames)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:a)\n (v1:a)\n : STGhostT (_:unit{composable p v0 v1}) o\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\n = let _ = coerce_ghost (fun _ -> G.gather r (raise_val v0) (raise_val v1)) in\n ()", "val write (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STGhostT unit opened\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write\n #_ #a #v r x\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_write gr x);\n weaken (R.ghost_pts_to gr full_perm x) (pts_to r full_perm x) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm x\n )", "val read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t))\n : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p. Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1\n )\nlet read (#t: Type) (#v: Ghost.erased (scalar_t t)) (r: ref (scalar t)) : ST t\n (pts_to r v)\n (fun _ -> pts_to r v)\n (exists v0 p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p)\n (fun v1 -> forall v0 p . (* {:pattern (mk_fraction (scalar t) (mk_scalar v0) p)} *) Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p ==> v0 == v1)\n= let v0 = FStar.IndefiniteDescription.indefinite_description_tot _ (fun v0 -> exists p . Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0) p) in\n let p = FStar.IndefiniteDescription.indefinite_description_tot _ (fun p -> Ghost.reveal v == mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p) in\n let prf v0' p' : Lemma\n (requires (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p'))\n (ensures (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = mk_scalar_inj (Ghost.reveal v0) v0' p p'\n in\n let prf' v0' p' : Lemma\n (Ghost.reveal v == mk_fraction (scalar t) (mk_scalar v0') p' ==> (v0' == Ghost.reveal v0 /\\ p' == Ghost.reveal p))\n = Classical.move_requires (prf v0') p'\n in\n Classical.forall_intro_2 prf';\n rewrite (pts_to _ _) (pts_to r (mk_fraction (scalar t) (mk_scalar (Ghost.reveal v0)) p));\n let v1 = read0 r in\n rewrite (pts_to _ _) (pts_to r v);\n return v1", "val share\n (#a:Type)\n (v:vec a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to v #p s)\n (ensures fun _ -> pts_to v #(half_perm p) s ** pts_to v #(half_perm p) s)\nlet share v = A.share v", "val gather (#inames: _)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:erased a)\n (v1:erased a)\n : STGhostT (_:unit{composable p v0 v1}) inames\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\nlet gather r v0 v1 = C.coerce_ghost (fun _ -> P.gather r v0 v1)", "val gather (#inames: _)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:erased a)\n (v1:erased a)\n : SteelGhostT (_:unit{composable p v0 v1}) inames\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\nlet gather r v0 v1 =\n rewrite_slprop (pts_to r v0 `star` pts_to r v1)\n (to_vprop Mem.(pts_to r v0 `star` pts_to r v1))\n (fun _ -> ());\n gather' r v0 v1", "val ghost_share_gen_pt (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen_pt\n #_ #_ #_ #x r p1 p2\n= H.ghost_share_gen #_ #_ #_ #(raise_erased x) r p1 p2", "val gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\nlet gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\n = let _ = gather_gen r _ _ in\n change_equal_slprop\n (vptrp r _)\n (vptrp r p)", "val gather (#a: Type0) (#uses: _) (#p: perm) (r: ref a)\n : SteelGhost unit uses\n (vptrp r (half_perm p) `star` vptrp r (half_perm p))\n (fun _ -> vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (vptrp r p) == h (vptrp r (half_perm p))\n )\nlet gather\n #_ #_ #p r\n= let p' = gather_gen r (half_perm p) (half_perm p) in\n change_equal_slprop\n (vptrp r p')\n (vptrp r p)", "val gather (#o:inames)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:a)\n (v1:a)\n : SteelGhostT (_:unit{composable p v0 v1}) o\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\nlet gather (#o:inames)\n (#a:Type)\n (#p:FStar.PCM.pcm a)\n (r:ref a p)\n (v0:a)\n (v1:a)\n : SteelGhostT (_:unit{composable p v0 v1}) o\n (pts_to r v0 `star` pts_to r v1)\n (fun _ -> pts_to r (op p v0 v1))\n = P.gather r v0 v1", "val swap2 (#a: Type) (r0 r1: reference a) (v0 v1: erased a)\n : SteelT unit\n ((pts_to r0 full_perm v0) `star` (pts_to r1 full_perm v1))\n (fun _ -> (pts_to r0 full_perm v1) `star` (pts_to r1 full_perm v0))\nlet swap2 (#a:Type) (r0 r1:reference a) (v0 v1:erased a)\n : SteelT unit (pts_to r0 full_perm v0 `star` pts_to r1 full_perm v1)\n (fun _ -> pts_to r0 full_perm v1 `star` pts_to r1 full_perm v0)\n = let u0 = rread r0 in\n let u1 = rread r1 in\n rwrite r0 u1;\n rwrite r1 u0;\n rewrite_eq (pts_to r1 full_perm) (Ghost.hide u0) v0;\n rewrite_eq (pts_to r0 full_perm) (Ghost.hide u1) v1", "val alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\nlet alloc (#a:Type)\n (#u:_)\n (x:erased a)\n : STGhostT (ref a) u\n emp\n (fun r -> pts_to r full_perm x)\n = coerce_ghost (fun _ -> R.ghost_alloc_pt x)", "val test_ite_g2 (#o: _) (r: rref bool) (v: erased bool)\n : STGhostT unit o (pts_to r v) (fun _ -> pts_to r v)\nlet test_ite_g2 (#o:_) (r:rref bool) (v:erased bool)\n : STGhostT unit o (pts_to r v) (fun _ -> pts_to r v)\n = let x = gread r _ in\n if x\n then (\n rewrite (pts_to r v) (pts_to r true);\n gtrue r;\n rewrite (pts_to r true) (pts_to r v)\n )\n else (\n rewrite (pts_to r v) (pts_to r false);\n gfalse r;\n rewrite (pts_to r false) (pts_to r v)\n )", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n = coerce_ghost (fun _ -> R.share r)", "val share (#a:Type)\n (#uses:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share\n r\n= RST.share r.reveal", "val ghost_share_gen (#a:Type) (#u:_)\n (#p:perm)\n (#x:erased a)\n (r:ghost_ref a)\n (p1 p2: perm)\n : SteelGhost unit u\n (ghost_pts_to r p x)\n (fun _ -> ghost_pts_to r p1 x `star`\n ghost_pts_to r p2 x)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet ghost_share_gen r p1 p2 = share_gen (reveal r) p1 p2", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))\nlet pts_to_injective_eq = pts_to_injective_eq'", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))\nlet pts_to_injective_eq = pts_to_injective_eq'", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))\nlet pts_to_injective_eq = pts_to_injective_eq'", "val free (#a:Type) (r:ref a) (#n:erased a)\n : stt_ghost unit (pts_to r n) (fun _ -> emp)\nlet free = free'", "val share\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ref a pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\r\n: stt_ghost unit\r\n (pts_to r (v0 `op pcm` v1))\r\n (fun _ -> pts_to r v0 ** pts_to r v1)\nlet share #a #pcm r v0 v1 = Ghost.hide (A.share r v0 v1)", "val swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t))\n : STT unit\n ((r1 `pts_to` (mk_scalar (Ghost.reveal v1)))\n `star`\n (r2 `pts_to` (mk_scalar (Ghost.reveal v2))))\n (fun _ ->\n (r1 `pts_to` (mk_scalar (Ghost.reveal v2)))\n `star`\n (r2 `pts_to` (mk_scalar (Ghost.reveal v1))))\nlet swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t)) : STT unit\n ((r1 `pts_to` mk_scalar (Ghost.reveal v1)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v2)))\n (fun _ -> (r1 `pts_to` mk_scalar (Ghost.reveal v2)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v1)))\n= let x1 = read r1 in\n let x2 = read r2 in\n write r1 x2;\n write r2 x1;\n return ()", "val swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t))\n : STT unit\n ((r1 `pts_to` (mk_scalar (Ghost.reveal v1)))\n `star`\n (r2 `pts_to` (mk_scalar (Ghost.reveal v2))))\n (fun _ ->\n (r1 `pts_to` (mk_scalar (Ghost.reveal v2)))\n `star`\n (r2 `pts_to` (mk_scalar (Ghost.reveal v1))))\nlet swap (#v1 #v2: Ghost.erased U32.t) (r1 r2: ref (scalar U32.t)) : STT unit\n ((r1 `pts_to` mk_scalar (Ghost.reveal v1)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v2)))\n (fun _ -> (r1 `pts_to` mk_scalar (Ghost.reveal v2)) `star` (r2 `pts_to` mk_scalar (Ghost.reveal v1)))\n= let x1 = read r1 in\n let x2 = read r2 in\n write r1 x2;\n write r2 x1;\n return ()", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n: stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share #a arr #s #p = H.share arr #(raise_seq s) #p", "val share_gen (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : STGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n r p1 p2\n= coerce_ghost (fun _ -> R.share_gen_pt r p1 p2)", "val swap (#a: _) (#v0 #v1: erased a) (x0 x1: rref a)\n : STT unit\n ((pts_to x0 v0) `star` (pts_to x1 v1))\n (fun _ -> (pts_to x0 v1) `star` (pts_to x1 v0))\nlet swap #a (#v0 #v1: erased a) (x0 x1:rref a)\n : STT unit\n (pts_to x0 v0 `star` pts_to x1 v1)\n (fun _ -> pts_to x0 v1 `star` pts_to x1 v0)\n = let u0 = !x0 in\n let u1 = !x1 in\n x0 := u1;\n x1 := u0;\n ()", "val ghost_gather (#a: Type0) (#uses: _) (#p: perm) (r: ghost_ref a)\n : SteelGhost unit\n uses\n ((ghost_vptrp r (half_perm p)) `star` (ghost_vptrp r (half_perm p)))\n (fun _ -> ghost_vptrp r p)\n (fun _ -> True)\n (fun h _ h' -> h' (ghost_vptrp r p) == h (ghost_vptrp r (half_perm p)))\nlet ghost_gather (#a: Type0) (#uses: _) (#p: perm) (r: ghost_ref a)\n : SteelGhost unit uses\n (ghost_vptrp r (half_perm p) `star` ghost_vptrp r (half_perm p))\n (fun _ -> ghost_vptrp r p)\n (fun _ -> True)\n (fun h _ h' ->\n h' (ghost_vptrp r p) == h (ghost_vptrp r (half_perm p))\n )\n= let _ = ghost_gather_gen r _ _ in\n change_equal_slprop\n (ghost_vptrp r _)\n (ghost_vptrp r p)", "val free (#opened: _) (#a:Type)\n (#v:erased a)\n (r:ref a)\n : STGhostT unit opened\n (pts_to r full_perm v) (fun _ -> emp)\nlet free\n #_ #a #v r\n= let gr : R.ghost_ref a = coerce_eq (R.reveal_ghost_ref a) (Ghost.hide r.reveal) in\n weaken (pts_to r full_perm v) (R.ghost_pts_to gr full_perm v) (fun _ ->\n R.reveal_ghost_pts_to_sl gr full_perm v\n );\n STC.coerce_ghost (fun _ -> R.ghost_free gr)", "val share_pt (#a:Type0) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share_pt #a #uses #p #v r =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share r;\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ());\n rewrite_slprop (H.pts_to r (half_perm p) v') (pts_to r (half_perm p) v) (fun _ -> ())", "val share_gen_pt (#a:Type0)\n (#uses:_)\n (#p:perm)\n (#v: a)\n (r:ref a)\n (p1 p2: perm)\n : SteelGhost unit uses\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (fun _ -> p == p1 `sum_perm` p2)\n (fun _ _ _ -> True)\nlet share_gen_pt #a #uses #p #v r p1 p2 =\n let v' = Ghost.hide (U.raise_val (Ghost.reveal v)) in\n rewrite_slprop (pts_to r p v) (H.pts_to r p v') (fun _ -> ());\n H.share_gen r p1 p2;\n rewrite_slprop (H.pts_to r p1 v') (pts_to r p1 v) (fun _ -> ());\n rewrite_slprop (H.pts_to r p2 v') (pts_to r p2 v) (fun _ -> ())", "val ghost_gather\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a)\r\n: stt_ghost (squash (composable pcm v0 v1))\r\n (ghost_pts_to r v0 ** ghost_pts_to r v1)\r\n (fun _ -> ghost_pts_to r (op pcm v0 v1))\nlet ghost_gather r v0 v1 = Ghost.hide (A.gather r v0 v1)", "val gather\n (#a:Type)\n (#pcm:pcm a)\n (r:pcm_ref pcm)\n (v0:FStar.Ghost.erased a)\n (v1:FStar.Ghost.erased a)\n: stt_ghost (squash (composable pcm v0 v1))\n (pcm_pts_to r v0 ** pcm_pts_to r v1)\n (fun _ -> pcm_pts_to r (op pcm v0 v1))\nlet gather = A.gather", "val higher_ref_pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: erased a)\n (r: ref a)\n : SteelGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r =\n extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1)\n (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m);\n rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ())", "val incr_ghost_contrib (#v1 #v2: G.erased int) (r: ghost_ref int)\n : Steel unit\n ((ghost_pts_to r half_perm v1) `star` (ghost_pts_to r half_perm v2))\n (fun _ -> (ghost_pts_to r half_perm (v1 + 1)) `star` (ghost_pts_to r half_perm (v2 + 1)))\n (fun _ -> True)\n (fun _ _ _ -> v1 == v2)\nlet incr_ghost_contrib (#v1 #v2:G.erased int) (r:ghost_ref int)\n : Steel unit\n (ghost_pts_to r half_perm v1 `star`\n ghost_pts_to r half_perm v2)\n (fun _ -> ghost_pts_to r half_perm (v1+1) `star`\n ghost_pts_to r half_perm (v2+1))\n (fun _ -> True)\n (fun _ _ _ -> v1 == v2)\n = ghost_gather_pt #_ #_ #half_perm #half_perm #v1 #v2 r;\n rewrite_perm r (sum_perm half_perm half_perm) full_perm;\n ghost_write_pt r (v1+1);\n ghost_share_pt r;\n rewrite_slprop (ghost_pts_to r (P.half_perm P.full_perm) (v1+1) `star`\n ghost_pts_to r (P.half_perm P.full_perm) (v1+1))\n (ghost_pts_to r half_perm (v1+1) `star`\n ghost_pts_to r half_perm (v2+1))\n (fun _ -> ())", "val v2' (#p: Ghost.erased nat) (al err: ptr)\n : STT unit\n ((pts_to1 al p) `star` (pts_to1 err 0))\n (fun _ -> exists_ (fun p -> exists_ (fun v -> (pts_to1 al p) `star` (pts_to1 err v))))\nlet v2' (#p: Ghost.erased nat) (al: ptr) (err: ptr) : STT unit\n (pts_to1 al p `star` pts_to1 err 0)\n (fun _ -> exists_ (fun p -> exists_ (fun v -> pts_to1 al p `star` pts_to1 err v)))\n= let ar = split al in\n let _ = gen_elim () in\n let _ = v1 ar err in\n let _ = elim_exists () in\n// let _ = elim_pure _ in\n let _ = noop () in\n let _ = join al ar in\n return ()", "val share (#a:Type) (#uses:_) (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\nlet share (#a:Type) #uses (#p:perm) (#v:erased a) (r:ref a)\n : SteelGhostT unit uses\n (pts_to r p v)\n (fun _ -> pts_to r (half_perm p) v `star` pts_to r (half_perm p) v)\n= share_gen r (half_perm p) (half_perm p)", "val ghost_write (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write r x =\n ghost_write_aux (reveal r) (reveal x);\n rewrite_slprop\n (pts_to (reveal r) full_perm (hide (reveal x)))\n (ghost_pts_to r full_perm x)\n (fun _ -> ())", "val share\n (#a:Type)\n (arr:array a)\n (#s:Ghost.erased (Seq.seq a))\n (#p:perm)\n : stt_ghost unit\n (requires pts_to arr #p s)\n (ensures fun _ -> pts_to arr #(half_perm p) s ** pts_to arr #(half_perm p) s)\nlet share = share'", "val ghost_share (#uses: inames) (v1 #v2: G.erased int) (r: ghost_ref int)\n : SteelGhost unit\n uses\n (ghost_pts_to r full_perm v1)\n (fun _ ->\n (ghost_pts_to r (P.half_perm full_perm) v1)\n `star`\n (ghost_pts_to r (P.half_perm full_perm) v2))\n (fun _ -> v1 == v2)\n (fun _ _ _ -> True)\nlet ghost_share (#uses:inames) (v1 #v2:G.erased int) (r:ghost_ref int)\n : SteelGhost unit uses\n (ghost_pts_to r full_perm v1)\n (fun _ -> ghost_pts_to r (P.half_perm full_perm) v1 `star`\n ghost_pts_to r (P.half_perm full_perm) v2)\n (fun _ -> v1 == v2)\n (fun _ _ _ -> True)\n = ghost_share_pt #_ #_ #_ #v1 r; ()", "val ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\nlet ghost_write_pt (#a:Type) (#u:_) (#v:erased a) (r:ghost_ref a) (x:erased a)\n : SteelGhostT unit u\n (ghost_pts_to r full_perm v)\n (fun _ -> ghost_pts_to r full_perm x)\n = H.ghost_write r (raise_erased x)", "val pts_to_injective_eq (#a:_)\n (#u:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p v0 `star` pts_to r q v1)\n (fun _ -> pts_to r p v0 `star` pts_to r q v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq (#a:_)\n (#u:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:ref a)\n : STGhost unit u\n (pts_to r p v0 `star` pts_to r q v1)\n (fun _ -> pts_to r p v0 `star` pts_to r q v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost\n (fun _ -> R.ghost_pts_to_injective_eq #a #u #p #q r (hide v0) (hide v1))", "val v2 (#p: Ghost.erased nat) (al err: ptr)\n : STT unit\n ((pts_to1 al p) `star` (pts_to1 err 0))\n (fun _ -> exists_ (fun p -> exists_ (fun v -> (pts_to1 al p) `star` (pts_to1 err v))))\nlet v2 (#p: Ghost.erased nat) (al: ptr) (err: ptr) : STT unit\n (pts_to1 al p `star` pts_to1 err 0)\n (fun _ -> exists_ (fun p -> exists_ (fun v -> pts_to1 al p `star` pts_to1 err v)))\n= let ar = split al in\n let _ = gen_elim () in\n let _ = v1 ar err in\n let _ = gen_elim () in\n let _ = join al ar in\n intro_exists _ (fun v -> pts_to1 al _ `star` pts_to1 err v);\n intro_exists _ (fun p -> exists_ (fun v -> pts_to1 al p `star` pts_to1 err v));\n return ()", "val ghost_share\r\n (#a:Type)\r\n (#pcm:pcm a)\r\n (r:ghost_ref pcm)\r\n (v0:FStar.Ghost.erased a)\r\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\r\n: stt_ghost unit\r\n (ghost_pts_to r (v0 `op pcm` v1))\r\n (fun _ -> ghost_pts_to r v0 ** ghost_pts_to r v1)\nlet ghost_share r v0 v1 = Ghost.hide (A.share r v0 v1)", "val pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: erased a)\n (r: ref a)\n : SteelGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires fun _ -> True)\n (ensures fun _ _ _ -> v0 == v1)\nlet pts_to_injective_eq #a #opened #p0 #p1 #v0 #v1 r =\n extract_info_raw (pts_to r p0 v0 `star` pts_to r p1 v1) (v0 == v1)\n (fun m -> pts_to_ref_injective r p0 p1 v0 v1 m);\n rewrite_slprop (pts_to r p1 v1) (pts_to r p1 v0) (fun _ -> ())", "val alloc (#a:Type) (x:a)\n : stt_ghost (ref a) emp (fun r -> pts_to r x)\nlet alloc = alloc'", "val share\n (#a:Type)\n (#pcm:pcm a)\n (r:pcm_ref pcm)\n (v0:FStar.Ghost.erased a)\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\n: stt_ghost unit\n (pcm_pts_to r (v0 `op pcm` v1))\n (fun _ -> pcm_pts_to r v0 ** pcm_pts_to r v1)\nlet share = A.share", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1:a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost\n (fun _ -> R.pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1:a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\n = coerce_ghost\n (fun _ -> R.higher_ref_pts_to_injective_eq #a #opened #p0 #p1 #(hide v0) #(hide v1) r)", "val pts_to_injective_eq (#a: Type)\n (#opened:inames)\n (#p0 #p1:perm)\n (#v0 #v1: a)\n (r: ref a)\n : STGhost unit opened\n (pts_to r p0 v0 `star` pts_to r p1 v1)\n (fun _ -> pts_to r p0 v0 `star` pts_to r p1 v0)\n (requires True)\n (ensures fun _ -> v0 == v1)\nlet pts_to_injective_eq\n #_ #_ #p0 #p1 #v0 #v1 r\n= rewrite (pts_to r p0 v0) (RST.pts_to r.reveal p0 v0);\n rewrite (pts_to r p1 v1) (RST.pts_to r.reveal p1 v1);\n RST.pts_to_injective_eq #_ #_ #_ #_ #v0 #v1 r.reveal;\n rewrite (RST.pts_to r.reveal p0 v0) (pts_to r p0 v0);\n rewrite (RST.pts_to r.reveal p1 v0) (pts_to r p1 v0)", "val gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\nlet gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : STGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\n = coerce_ghost (fun _ -> MR.gather #inames #a #p r f g v)", "val pts_to_injective_eq (#a:_)\n (#p #q:_)\n (#v0 #v1:a)\n (r:box a)\n : stt_ghost unit\n (pts_to r #p v0 ** pts_to r #q v1)\n (fun _ -> pts_to r #p v0 ** pts_to r #q v1 ** pure (v0 == v1))\nlet pts_to_injective_eq b = R.pts_to_injective_eq b", "val write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\nlet write (#a:Type0)\n (#v:erased a)\n (r:ref a)\n (x:a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> pts_to r full_perm x)\n = coerce_steel (fun _ -> R.write_pt r x);\n return ()", "val share_gen\n (#t: Type)\n (#opened: _)\n (#p: perm)\n (#v: t)\n (r: ref t)\n (p1 p2: perm)\n: STGhost unit opened\n (pts_to r p v)\n (fun _ -> pts_to r p1 v `star` pts_to r p2 v)\n (p == p1 `sum_perm` p2)\n (fun _ -> True)\nlet share_gen\n #_ #_ #_ #v r p1 p2\n= coerce_ghost (fun _ -> R.ghost_share_gen_pt #_ #_ #_ #v r p1 p2)", "val ghost_free_pt (#a:Type0) (#u:_) (#v:erased a) (r:ghost_ref a)\n : SteelGhostT unit u (ghost_pts_to r full_perm v) (fun _ -> emp)\nlet ghost_free_pt r = H.ghost_free r", "val read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\nlet read (#a:Type)\n (#u:_)\n (#p:perm)\n (#v:erased a)\n (r:ref a)\n : STGhost (erased a) u\n (pts_to r p v)\n (fun x -> pts_to r p x)\n (requires True)\n (ensures fun x -> x == v)\n = let y = coerce_ghost (fun _ -> R.ghost_read_pt r) in\n y", "val gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\nlet gather (#inames:_)\n (#a:Type)\n (#p:Preorder.preorder a)\n (r:ref a p)\n (f g:perm)\n (v:Ghost.erased a)\n : SteelGhostT unit inames\n (pts_to r f v `star` pts_to r g v)\n (fun _ -> pts_to r (sum_perm f g) v)\n = MHR.gather r f g (hide (U.raise_val (reveal v)))", "val free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v) (fun _ -> emp)\nlet free (#a:Type0)\n (#v:erased a)\n (r:ref a)\n : STT unit\n (pts_to r full_perm v)\n (fun _ -> emp)\n = coerce_steel(fun _ -> R.free_pt r);\n return ()", "val recall\r\n (#a:Type u#1)\r\n (#pcm:pcm a)\r\n (#fact:property a)\r\n (r:erased (ref a pcm))\r\n (v:Ghost.erased a)\r\n (w:witnessed r fact)\r\n: stt_ghost (v1:Ghost.erased a{compatible pcm v v1})\r\n (pts_to r v)\r\n (fun v1 -> pts_to r v ** pure (fact v1))\nlet recall #a #pcm #fact r v w = Ghost.hide (A.recall r v w)", "val gather_gen (#a:Type0) (#uses:_) (r:ref a) (p0:perm) (p1:perm)\n : SteelGhost perm uses\n (vptrp r p0 `star` vptrp r p1)\n (fun res -> vptrp r res)\n (fun _ -> True)\n (fun h res h' ->\n res == sum_perm p0 p1 /\\\n h' (vptrp r res) == h (vptrp r p0) /\\\n h' (vptrp r res) == h (vptrp r p1)\n )\nlet gather_gen\n r p0 p1\n= elim_vptrp r p0;\n elim_vptrp r p1;\n A.gather r p0 p1;\n let s = sum_perm p0 p1 in\n change_equal_slprop\n (A.varrayp r (sum_perm p0 p1))\n (A.varrayp r s);\n intro_vptrp' r s;\n s", "val ghost_gather_gen (#a:Type0) (#uses:_) (r:ghost_ref a) (p0:perm) (p1:perm)\n : SteelGhost perm uses\n (ghost_vptrp r p0 `star` ghost_vptrp r p1)\n (fun res -> ghost_vptrp r res)\n (fun _ -> True)\n (fun h res h' ->\n res == sum_perm p0 p1 /\\\n h' (ghost_vptrp r res) == h (ghost_vptrp r p0) /\\\n h' (ghost_vptrp r res) == h (ghost_vptrp r p1)\n )\nlet ghost_gather_gen #a #_ r p0 p1 =\n let x1 = elim_ghost_vptr r p1 in\n let x0 = elim_ghost_vptr r p0 in\n ghost_gather_pt #_ #_ #p0 #p1 #x0 #x1 r;\n intro_ghost_vptr r (sum_perm p0 p1) x0;\n sum_perm p0 p1", "val replace (#a:Type0) (r:ref a) (x:a) (#v:erased a)\n : stt a\n (pts_to r v)\n (fun res -> pts_to r x ** pure (res == reveal v))\nlet replace = replace'", "val ghost_share\n (#a:Type)\n (#pcm:pcm a)\n (r:ghost_pcm_ref pcm)\n (v0:FStar.Ghost.erased a)\n (v1:FStar.Ghost.erased a{composable pcm v0 v1})\n: stt_ghost unit\n (ghost_pcm_pts_to r (v0 `op pcm` v1))\n (fun _ -> ghost_pcm_pts_to r v0 ** ghost_pcm_pts_to r v1)\nlet ghost_share = A.ghost_share" ], "closest_src": [ { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.gather2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share2" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share2" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_gather_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.gather" }, { "project_name": "steel", "file_name": "TwoLockQueue.fst", "name": "TwoLockQueue.ghost_gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.gather" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.gather" }, { "project_name": "steel", "file_name": "OWGCounterInv.fst", "name": "OWGCounterInv.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.ST.Array.fst", "name": "Steel.ST.Array.gather" }, { "project_name": "steel", "file_name": "Steel.ST.HigherArray.fst", "name": "Steel.ST.HigherArray.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.write" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.free" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.read" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_pt" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostPCMReference.fst", "name": "Steel.ST.GhostPCMReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.write" }, { "project_name": "steel", "file_name": "Steel.ST.C.Types.Scalar.fsti", "name": "Steel.ST.C.Types.Scalar.read" }, { "project_name": "steel", "file_name": "Pulse.Lib.Vec.fst", "name": "Pulse.Lib.Vec.share" }, { "project_name": "steel", "file_name": "Steel.ST.PCMReference.fst", "name": "Steel.ST.PCMReference.gather" }, { "project_name": "steel", "file_name": "Steel.PCMReference.fst", "name": "Steel.PCMReference.gather" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_share_gen_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.gather" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.gather" }, { "project_name": "steel", "file_name": "Steel.GhostPCMReference.fst", "name": "Steel.GhostPCMReference.gather" }, { "project_name": "steel", "file_name": "NewCanon.fst", "name": "NewCanon.swap2" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.alloc" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.test_ite_g2" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_share_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherReference.fst", "name": "Pulse.Lib.HigherReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.free" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.share" }, { "project_name": "steel", "file_name": "PointStructDirectDef.fst", "name": "PointStructDirectDef.swap" }, { "project_name": "steel", "file_name": "PointStruct.fst", "name": "PointStruct.swap" }, { "project_name": "steel", "file_name": "Pulse.Lib.Array.Core.fst", "name": "Pulse.Lib.Array.Core.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.share_gen" }, { "project_name": "steel", "file_name": "SteelSTFramingTestSuite.fst", "name": "SteelSTFramingTestSuite.swap" }, { "project_name": "steel", "file_name": "Steel.Reference.fsti", "name": "Steel.Reference.ghost_gather" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.free" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_pt" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.share_gen_pt" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.gather" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.higher_ref_pts_to_injective_eq" }, { "project_name": "steel", "file_name": "OWGCounter.fst", "name": "OWGCounter.incr_ghost_contrib" }, { "project_name": "steel", "file_name": "SteelTableJoin.fst", "name": "SteelTableJoin.v2'" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.share" }, { "project_name": "steel", "file_name": "Steel.HigherReference.fst", "name": "Steel.HigherReference.ghost_write" }, { "project_name": "steel", "file_name": "Pulse.Lib.HigherArray.fst", "name": "Pulse.Lib.HigherArray.share" }, { "project_name": "steel", "file_name": "OWGCounterInv.fst", "name": "OWGCounterInv.ghost_share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_write_pt" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "SteelTableJoin.fst", "name": "SteelTableJoin.v2" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.ghost_share" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Pulse.Lib.GhostReference.fst", "name": "Pulse.Lib.GhostReference.alloc" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.share" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.HigherReference.fst", "name": "Steel.ST.HigherReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.GhostHigherReference.fst", "name": "Steel.ST.GhostHigherReference.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.MonotonicReference.fst", "name": "Steel.ST.MonotonicReference.gather" }, { "project_name": "steel", "file_name": "Pulse.Lib.Box.fst", "name": "Pulse.Lib.Box.pts_to_injective_eq" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.write" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.share_gen" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_free_pt" }, { "project_name": "steel", "file_name": "Steel.ST.GhostReference.fst", "name": "Steel.ST.GhostReference.read" }, { "project_name": "steel", "file_name": "Steel.MonotonicReference.fst", "name": "Steel.MonotonicReference.gather" }, { "project_name": "steel", "file_name": "Steel.ST.Reference.fst", "name": "Steel.ST.Reference.free" }, { "project_name": "steel", "file_name": "PulseCore.Atomic.fst", "name": "PulseCore.Atomic.recall" }, { "project_name": "steel", "file_name": "Steel.ArrayRef.fst", "name": "Steel.ArrayRef.gather_gen" }, { "project_name": "steel", "file_name": "Steel.Reference.fst", "name": "Steel.Reference.ghost_gather_gen" }, { "project_name": "steel", "file_name": "Pulse.Lib.Reference.fst", "name": "Pulse.Lib.Reference.replace" }, { "project_name": "steel", "file_name": "Pulse.Lib.Core.fst", "name": "Pulse.Lib.Core.ghost_share" } ], "selected_premises": [ "Pulse.Lib.Core.mem_iname", "Pulse.Lib.Core.erased_non_informative", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd", "Pulse.Lib.PCM.Fraction.mk_frame_preserving_upd_none", "Pulse.Lib.HigherGhostReference.ref", "Pulse.Lib.Core.inames", "FStar.Real.one", "FStar.PCM.compatible", "FStar.Ghost.return", "FStar.PCM.frame_compatible", "Pulse.Lib.Core.all_inames", "Pulse.Lib.PCM.Fraction.composable", "Pulse.Lib.Core.mem_inv", "Pulse.Lib.PCM.Fraction.compose", "FStar.PCM.op", "FStar.PCM.composable", "FStar.Real.two", "Pulse.Lib.HigherGhostReference.gref_non_informative", "PulseCore.FractionalPermission.sum_perm", "Pulse.Lib.PCM.Fraction.fractional", "Pulse.Lib.Core.one_half", "PulseCore.FractionalPermission.full_perm", "Pulse.Lib.Core.emp_inames", "FStar.Ghost.op_let_At", "PulseCore.FractionalPermission.writeable", "FStar.Ghost.elift2_pq", "FStar.Ghost.push_refinement", "Pulse.Lib.Core.squash_non_informative", "FStar.Ghost.bind", "Pulse.Lib.PCM.Fraction.pcm_frac", "FStar.Ghost.elift1", "Pulse.Lib.HigherGhostReference.gather", "Pulse.Lib.Core.prop_non_informative", "FStar.Ghost.elift2", "FStar.Real.zero", "FStar.Pervasives.Native.snd", "Pulse.Lib.HigherGhostReference.read", "Pulse.Lib.Core.add_iname", "FStar.Ghost.elift1_pq", "PulseCore.FractionalPermission.comp_perm", "FStar.Pervasives.Native.fst", "Pulse.Lib.PCM.Fraction.full_values_compatible", "FStar.Ghost.elift1_p", "Pulse.Lib.HigherGhostReference.read_compat", "FStar.UInt.size", "FStar.Ghost.elift2_p", "FStar.PCM.frame_preserving_val_to_fp_upd", "Pulse.Lib.HigherGhostReference.share", "FStar.Ghost.elift3", "Pulse.Lib.Core.join_inames", "Pulse.Lib.Core.unit_non_informative", "Pulse.Lib.Core.inames_subset", "Pulse.Lib.HigherGhostReference.share2", "Pulse.Lib.HigherGhostReference.free", "FStar.Preorder.preorder_rel", "PulseCore.FractionalPermission.lesser_perm", "FStar.Pervasives.reveal_opaque", "FStar.Mul.op_Star", "PulseCore.Observability.at_most_one_observable", "PulseCore.FractionalPermission.half_perm", "Pulse.Lib.HigherGhostReference.alloc", "FStar.Pervasives.dfst", "Pulse.Lib.HigherGhostReference.pts_to", "Pulse.Lib.Core.remove_inv", "FStar.PCM.lem_commutative", "FStar.Preorder.stable", "FStar.PCM.lem_assoc_l", "FStar.Pervasives.dsnd", "PulseCore.Observability.join_obs", "FStar.Preorder.reflexive", "FStar.PCM.exclusive", "Pulse.Lib.Core.add_inv", "FStar.PCM.compose_frame_preserving_updates", "PulseCore.FractionalPermission.lesser_equal_perm", "FStar.Preorder.transitive", "FStar.BitVector.logor_vec", "FStar.Calc.calc_chain_related", "FStar.UInt32.op_Subtraction_Hat", "FStar.PCM.compatible_trans", "FStar.Pervasives.st_post_h", "FStar.PCM.lem_assoc_r", "FStar.PCM.compatible_elim", "FStar.BitVector.logand_vec", "FStar.UInt.zero_extend_vec", "FStar.UInt32.op_Subtraction_Percent_Hat", "FStar.PCM.frame_preserving", "FStar.Pervasives.id", "FStar.UInt32.op_Percent_Hat", "FStar.PCM.frame_preserving_subframe", "FStar.BitVector.is_superset_vec", "FStar.BitVector.is_subset_vec", "FStar.Math.Lemmas.cancel_fraction", "FStar.BitVector.logxor_vec", "FStar.BitVector.zero_vec", "FStar.UInt.one_extend_vec", "FStar.BitVector.shift_right_vec", "FStar.BitVector.lognot_vec", "FStar.UInt.to_vec", "FStar.BitVector.elem_vec", "FStar.Pervasives.pure_null_wp" ], "source_upto_this": "(*\n Copyright 2023 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\n\nmodule Pulse.Lib.HigherGhostReference\nopen Pulse.Lib.Core\nopen Pulse.Main\nopen FStar.PCM\nopen Pulse.Lib.PCM.Fraction\nmodule T = FStar.Tactics\nlet ref (a:Type u#1) = ghost_pcm_ref (pcm_frac #a)\nlet gref_non_informative (a:Type u#1) : non_informative_witness (ref a) = fun x -> reveal x\n\nlet pts_to (#a:Type) (r:ref a) (#[T.exact (`full_perm)] p:perm) (n:a)\n= ghost_pcm_pts_to r (Some (n, p)) ** pure (perm_ok p)\n\n```pulse\nghost\nfn full_values_compatible (#a:Type u#1) (x:a)\nrequires emp\nensures pure (compatible pcm_frac (Some (x, full_perm)) (Some (x, full_perm)))\n{\n assert pure (FStar.PCM.composable pcm_frac (Some(x, full_perm)) None);\n}\n```\n\n```pulse\nghost\nfn alloc' (#a:Type u#1) (x:a)\nrequires emp\nreturns r:ref a\nensures pts_to r x\n{\n full_values_compatible x;\n let r = Pulse.Lib.Core.ghost_alloc #_ #(pcm_frac #a) (Some (x, full_perm));\n fold (pts_to r #full_perm x);\n r\n}\n```\nlet alloc = alloc'\n\nlet read_compat (#a:Type u#1) (x:fractional a)\n (v:fractional a { compatible pcm_frac x v })\n : GTot (y:fractional a { compatible pcm_frac y v /\\\n FStar.PCM.frame_compatible pcm_frac x v y })\n = x\n\n```pulse\nghost\nfn read' (#a:Type u#1) (r:ref a) (#n:erased a) (#p:perm)\nrequires pts_to r #p n\nreturns x:erased a\nensures pts_to r #p n ** pure (n == x)\n{\n unfold pts_to r #p n;\n with w. assert (ghost_pcm_pts_to r w);\n let x = Pulse.Lib.Core.ghost_read r w (fun _ -> w);\n assert pure (compatible pcm_frac w x);\n assert (ghost_pcm_pts_to r w);\n fold (pts_to r #p n);\n hide (fst (Some?.v x))\n}\n```\nlet read = read'\nlet ( ! ) #a = read #a\n\n```pulse\nghost\nfn write' (#a:Type u#1) (r:ref a) (x:erased a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures pts_to r #full_perm x\n{\n unfold pts_to r #full_perm n;\n with w. assert (ghost_pcm_pts_to r w);\n Pulse.Lib.Core.ghost_write r _ _ (mk_frame_preserving_upd n x);\n fold pts_to r #full_perm x;\n}\n```\nlet ( := ) #a = write' #a\n\n```pulse\nghost\nfn free' #a (r:ref a) (#n:erased a)\nrequires pts_to r #full_perm n\nensures emp\n{\n unfold pts_to r #full_perm n;\n Pulse.Lib.Core.ghost_write r _ _ (mk_frame_preserving_upd_none n);\n Pulse.Lib.Core.drop_ _;\n}\n```\nlet free = free'\n\n```pulse\nghost\nfn share' #a (r:ref a) (#v:erased a) (#p:perm)\nrequires pts_to r #p v\nensures pts_to r #(half_perm p) v ** pts_to r #(half_perm p) v\n{\n unfold pts_to r #p v;\n rewrite ghost_pcm_pts_to r (Some (reveal v, p))\n as ghost_pcm_pts_to r (Some (reveal v, half_perm p) `op pcm_frac` Some(reveal v, half_perm p));\n Pulse.Lib.Core.ghost_share r (Some (reveal v, half_perm p)) _; //writing an underscore for the first arg also causes a crash\n fold (pts_to r #(half_perm p) v);\n fold (pts_to r #(half_perm p) v);\n}\n```\nlet share = share'\n\n```pulse\nghost\nfn gather' #a (r:ref a) (#x0 #x1:erased a) (#p0 #p1:perm)\nrequires pts_to r #p0 x0 ** pts_to r #p1 x1\nensures pts_to r #(sum_perm p0 p1) x0 ** pure (x0 == x1)\n{\n unfold pts_to r #p0 x0;\n unfold pts_to r #p1 x1;\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, p0)) (Some (reveal x1, p1));\n fold (pts_to r #(sum_perm p0 p1) x0)\n}\n```\nlet gather = gather'\n\nlet share2 (#a:Type) (r:ref a) (#v:erased a) = share r #v #full_perm", "sketch": [ "To implement the `gather2` function, we first unfold the points-to assertions for `x0` and `x1` on reference `r`. Then, we use the `ghost_gather` function to combine the permissions of `x0` and `x1` on `r` and fold the resulting points-to assertion for the sum of the permissions.", "To implement `gather2`, we will first unfold the points-to assertions for `r` and `x0` and `x1`. Then, we will use the `ghost_gather` function from the Pulse library to gather the values `x0` and `x1` into the reference `r` with half permission each. Finally, we will fold the points-to assertion for `r` with the sum of permissions `p0` and `p1` and add a pure assertion that `x0` is equal to `x1`.", "The `gather2` function is implemented by unfolding the points-to assertions for the two values, using the `ghost_gather` function to gather the values, and then folding the points-to assertion for the combined permission.", "To implement the `gather2` function, we first unfold the permissions for `r` and `x0` and `x1`. Then, we use the `ghost_gather` function to combine the permissions for `x0` and `x1` into a single permission for `r`. Finally, we fold the combined permission for `r` and ensure that the values `x0` and `x1` are equal.", "To implement `gather2`, we first unfold the points-to assertions for `r`, `x0`, and `x1`. Then we use the `ghost_gather` function to gather the permissions of `x0` and `x1` on `r` and combine them to form a new permission. Finally, we fold the points-to assertion for `r` with the combined permission and ensure that the values `x0` and `x1` are equal.", "To implement the `gather2` function, we first unfold the points-to assertions for `r`, `x0`, and `x1`. Then we use the `ghost_gather` function to combine the permissions for `x0` and `x1` in the reference `r`. Finally, we fold the points-to assertion for `r` with the combined permission and ensure that `x0` and `x1` are equal.", "To implement the `gather2` function, we first unfold the points-to assertions for `r`, `x0`, and `x1`. Then we use the `ghost_gather` function to combine the permissions for `x0` and `x1` at reference `r`. Finally, we fold the points-to assertion for `r` with the combined permission and ensure that `x0` and `x1` are equal.", "To implement gather2, we first unfold the points-to assertions for r, x0, and x1. Then we use the ghost_gather function to combine the permissions of x0 and x1 and update the state of r accordingly. Finally, we fold the points-to assertion for the combined permission of x0 and x1.", "To implement the `gather2` function, we will first unfold the points-to assertions for `r` and `x0` and `x1`. Then we will use the `ghost_gather` function to gather the values `x0` and `x1` from the reference `r` and split the permission `one_half` between them. Finally, we will fold the points-to assertion for `r` with the combined permission and ensure that the values `x0` and `x1` are equal.", "The `gather2` function first unfolds the permissions for `r` and `x0` and `x1`. Then it uses the `ghost_gather` function to combine the permissions for `x0` and `x1` into a single permission. Finally, it folds the combined permission for `x0` and `x1` and ensures that the values `x0` and `x1` are equal." ], "generated_solution": [ "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) =\n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r one_half (reveal x0));", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a) : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) =\n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r #(sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) = \n unfold pts_to r #one_half x0;\n unfold pts_to r #one_half x1;\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) = \n unfold pts_to r #one_half x0;\n unfold pts_to r #one_half x1;\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) = \n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1))", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) =\n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) =\n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) =\n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r x0);\n pure (x0 == x1)", "let gather2 (#a:Type) (r:ref a) (#x0 #x1:erased a)\n : stt_ghost unit\n (pts_to r #one_half x0 ** pts_to r #one_half x1)\n (fun _ -> pts_to r x0 ** pure (x0 == x1)) = \n unfold (pts_to r #one_half x0);\n unfold (pts_to r #one_half x1);\n Pulse.Lib.Core.ghost_gather r (Some (reveal x0, one_half)) (Some (reveal x1, one_half));\n fold (pts_to r (sum_perm one_half one_half) x0)" ] }, { "file_name": "Steel.ST.GenElim.Base.fsti", "name": "Steel.ST.GenElim.Base.compute_gen_elim_nondep_post", "opens_and_abbrevs": [ { "abbrev": "T", "full_module": "FStar.Tactics" }, { "open": "Steel.ST.Util" }, { "open": "Steel.ST.GenElim" }, { "open": "Steel.ST.GenElim" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n : Tot prop", "source_definition": "let compute_gen_elim_nondep_post (i0: gen_elim_i) (i: gen_elim_nondep_t) (x: Ghost.erased (compute_gen_elim_nondep_a i0 i)) : Tot prop =\n compute_gen_elim_nondep_post0 i0 i (Ghost.reveal x)", "source_range": { "start_line": 296, "start_col": 0, "end_line": 297, "end_col": 53 }, "interleaved": false, "definition": "fun i0 i x ->\n Steel.ST.GenElim.Base.compute_gen_elim_nondep_post0 i0 i (FStar.Ghost.reveal x) <: Prims.prop", "effect": "Prims.Tot", "effect_flags": [ "total" ], "mutual_with": [], "premises": [ "Steel.ST.GenElim.Base.gen_elim_i", "Steel.ST.GenElim.Base.gen_elim_nondep_t", "FStar.Ghost.erased", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_a", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_post0", "FStar.Ghost.reveal", "Prims.prop" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": true, "type": "\n i0: Steel.ST.GenElim.Base.gen_elim_i ->\n i: Steel.ST.GenElim.Base.gen_elim_nondep_t ->\n x: FStar.Ghost.erased (Steel.ST.GenElim.Base.compute_gen_elim_nondep_a i0 i)\n -> Prims.prop", "prompt": "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n : Tot prop =\n ", "expected_response": "compute_gen_elim_nondep_post0 i0 i (Ghost.reveal x)", "source": { "project_name": "steel", "file_name": "lib/steel/Steel.ST.GenElim.Base.fsti", "git_rev": "f984200f79bdc452374ae994a5ca837496476c41", "git_url": "https://github.com/FStarLang/steel.git" }, "dependencies": { "source_file": "Steel.ST.GenElim.Base.fsti", "checked_file": "dataset/Steel.ST.GenElim.Base.fsti.checked", "interface_file": false, "dependencies": [ "dataset/Steel.ST.Util.fsti.checked", "dataset/Steel.Effect.Common.fsti.checked", "dataset/prims.fst.checked", "dataset/FStar.Tactics.fst.checked", "dataset/FStar.Reflection.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Ghost.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "let is_fvar = Reflection.is_fvar", "let is_any_fvar = Reflection.is_any_fvar", "gen_unit_elim_i", "GUEId", "GUEId", "GUEId", "v", "v", "GUEPure", "GUEPure", "GUEPure", "p", "p", "GUEStar", "GUEStar", "GUEStar", "left", "left", "right", "right", "gen_elim_i", "GEUnit", "GEUnit", "GEUnit", "i", "i", "GEStarL", "GEStarL", "GEStarL", "left", "left", "right", "right", "GEStarR", "GEStarR", "GEStarR", "left", "left", "right", "right", "GEStar", "GEStar", "GEStar", "left", "left", "right", "right", "GEExistsNoAbs", "GEExistsNoAbs", "GEExistsNoAbs", "a", "a", "body", "body", "GEExistsUnit", "GEExistsUnit", "GEExistsUnit", "a", "a", "body", "body", "GEExists", "GEExists", "GEExists", "a", "a", "body", "body", "val gen_elim_reduce: unit", "let rec compute_gen_unit_elim_p\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure p -> pure p\n | GUEStar left right -> compute_gen_unit_elim_p left `star` compute_gen_unit_elim_p right", "let rec compute_gen_unit_elim_q\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure _ -> emp\n | GUEStar left right -> compute_gen_unit_elim_q left `star` compute_gen_unit_elim_q right", "let rec compute_gen_unit_elim_post\n (x: gen_unit_elim_i)\n: Tot prop\n= match x with\n | GUEId _ -> True\n | GUEPure p -> p\n | GUEStar left right -> compute_gen_unit_elim_post left /\\ compute_gen_unit_elim_post right", "let rec compute_gen_elim_p\n (x: gen_elim_i)\n: Tot vprop\n= match x with\n | GEUnit i -> compute_gen_unit_elim_p i\n | GEStarL left right -> compute_gen_elim_p left `star` compute_gen_unit_elim_p right\n | GEStarR left right -> compute_gen_unit_elim_p left `star` compute_gen_elim_p right\n | GEStar left right -> compute_gen_elim_p left `star` compute_gen_elim_p right\n | GEExistsNoAbs #a p -> exists_ p\n | GEExistsUnit #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists #a body -> exists_ (fun x -> compute_gen_elim_p (body x))", "let compute_gen_elim_p' = compute_gen_elim_p", "let rec compute_gen_elim_a\n (x: gen_elim_i)\n: Tot Type0\n= match x with\n | GEUnit _ -> unit\n | GEStarL left _ -> compute_gen_elim_a left\n | GEStarR _ right -> compute_gen_elim_a right\n | GEStar left right -> (compute_gen_elim_a left & compute_gen_elim_a right)\n | GEExistsNoAbs #a _\n | GEExistsUnit #a _ -> a\n | GEExists #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))", "let dfstp #a #b t = dfst #a #b t", "let dsndp #a #b t = dsnd #a #b t", "let fstp #a #b t = fst #a #b t", "let sndp #a #b t = snd #a #b t", "let coerce_with_trefl (#tfrom #tto: Type) (x: tfrom) : Pure tto (requires (T.with_tactic T.trefl (tfrom == tto))) (ensures (fun _ -> True)) = x", "let rec compute_gen_elim_q\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot vprop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot vprop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_q u\n | GEStarL left right -> fun v -> compute_gen_elim_q left (coerce_with_trefl v) `star` compute_gen_unit_elim_q right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_q left `star` compute_gen_elim_q right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_q left (fstp #tleft #tright v') `star` compute_gen_elim_q right (sndp #tleft #tright v')\n | GEExistsNoAbs #a p -> p\n | GEExistsUnit #a p -> fun v -> compute_gen_unit_elim_q (p v)\n | GEExists #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_q\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')", "let rec compute_gen_elim_post\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot prop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot prop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_post u\n | GEStarL left right -> fun v -> compute_gen_elim_post left (coerce_with_trefl v) /\\ compute_gen_unit_elim_post right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_post left /\\ compute_gen_elim_post right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_post left (fstp #tleft #tright v') /\\ compute_gen_elim_post right (sndp #tleft #tright v')\n | GEExistsNoAbs #a p -> fun _ -> True\n | GEExistsUnit #a p -> fun v -> compute_gen_unit_elim_post (p v)\n | GEExists #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_post\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')", "gen_elim_tele", "TRet", "TRet", "TRet", "TExists", "TExists", "TExists", "ty", "ty", "let rec tele_star_vprop (i: gen_elim_tele) (v: vprop) (p: prop) : Tot gen_elim_tele (decreases i) =\n match i with\n | TRet v' p' -> TRet (v `star` v') (p /\\ p')\n | TExists ty f -> TExists ty (fun x -> tele_star_vprop (f x) v p)", "let rec tele_star (i1 i2: gen_elim_tele) : Tot gen_elim_tele =\n match i1, i2 with\n | TRet v1 p1, _ -> tele_star_vprop i2 v1 p1\n | _, TRet v2 p2 -> tele_star_vprop i1 v2 p2\n | TExists ty1 f1, TExists ty2 f2 -> TExists ty1 (fun x1 -> TExists ty2 (fun x2 -> tele_star (f1 x1) (f2 x2)))", "let rec compute_gen_elim_tele (x: gen_elim_i) : Tot gen_elim_tele =\n match x with\n | GEUnit v -> TRet (compute_gen_unit_elim_q v) (compute_gen_unit_elim_post v)\n | GEStarL l ru -> tele_star_vprop (compute_gen_elim_tele l) (compute_gen_unit_elim_q ru) (compute_gen_unit_elim_post ru)\n | GEStarR lu r -> tele_star_vprop (compute_gen_elim_tele r) (compute_gen_unit_elim_q lu) (compute_gen_unit_elim_post lu)\n | GEStar l r -> tele_star (compute_gen_elim_tele l) (compute_gen_elim_tele r)\n | GEExistsNoAbs #ty body -> TExists ty (fun x -> TRet (body x) True)\n | GEExistsUnit #ty body -> TExists ty (fun x -> TRet (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_post (body x)))\n | GEExists #ty f -> TExists ty (fun x -> compute_gen_elim_tele (f x))", "let rec curried_function_type (x: list (Type u#a)) (ret_t: Type u#(max a b)) : Tot (Type u#(max a b)) =\n match x with\n | [] -> ret_t\n | t1 :: q -> t1 -> Tot (curried_function_type q ret_t)", "gen_elim_nondep_t", "GENonDep", "GENonDep", "GENonDep", "ty", "ty", "GEDep", "GEDep", "GEDep", "let mk_gen_elim_nondep\n (ty: list Type0)\n (tvprop: Type)\n (q: tvprop)\n (tprop: Type)\n (post: tprop)\n: Pure gen_elim_nondep_t\n (requires (\n tvprop == curried_function_type ty vprop /\\\n tprop == curried_function_type ty prop\n ))\n (ensures (fun _ -> True))\n= GENonDep ty q post", "let mk_gen_elim_nondep_by_tac\n (ty: list Type0)\n (tvprop: Type)\n (q: tvprop)\n (tprop: Type)\n (post: tprop)\n: Pure gen_elim_nondep_t\n (requires (\n T.with_tactic (fun _ -> T.norm [delta_attr [(`%gen_elim_reduce)]; iota; zeta]) (tvprop == curried_function_type ty vprop) /\\\n T.with_tactic (fun _ -> T.norm [delta_attr [(`%gen_elim_reduce)]; iota; zeta]) (tprop == curried_function_type ty prop)\n ))\n (ensures (fun _ -> True))\n= GENonDep ty q post", "let rec gen_elim_nondep_sem (ty: list Type0) : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot gen_elim_tele) =\n match ty as ty' returns curried_function_type ty' vprop -> curried_function_type ty' prop -> Tot gen_elim_tele with\n | [] -> fun q post -> TRet q post\n | t :: tq -> fun q post -> TExists t (fun x -> gen_elim_nondep_sem tq (q x) (post x))", "let check_gen_elim_nondep_sem (i: gen_elim_i) (nd: gen_elim_nondep_t) : Tot prop =\n match nd with\n | GENonDep ty q post -> compute_gen_elim_tele i == gen_elim_nondep_sem ty q post\n | GEDep -> True", "let compute_gen_elim_nondep_a' (ty: list Type0) : Tot Type0 =\n match ty with\n | [] -> unit\n | [t1] -> t1\n | [t1; t2] -> tuple2 t1 t2\n | [t1; t2; t3] -> tuple3 t1 t2 t3\n | [t1; t2; t3; t4] -> tuple4 t1 t2 t3 t4\n | [t1; t2; t3; t4; t5] -> tuple5 t1 t2 t3 t4 t5\n | [t1; t2; t3; t4; t5; t6] -> tuple6 t1 t2 t3 t4 t5 t6\n | [t1; t2; t3; t4; t5; t6; t7] -> tuple7 t1 t2 t3 t4 t5 t6 t7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> tuple8 t1 t2 t3 t4 t5 t6 t7 t8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> tuple9 t1 t2 t3 t4 t5 t6 t7 t8 t9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> tuple10 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> tuple11 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> tuple12 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> tuple13 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> tuple14 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14\n | _ -> unit", "let compute_gen_elim_nondep_a (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot Type0 =\n match i with\n | GENonDep ty q post -> compute_gen_elim_nondep_a' ty\n | GEDep -> compute_gen_elim_a i0", "let compute_uncurry (ret_type: Type u#a) (def: ret_type) (ty: list Type0) : curried_function_type ty ret_type -> compute_gen_elim_nondep_a' ty -> ret_type =\n match ty as ty' returns (curried_function_type ty' ret_type -> compute_gen_elim_nondep_a' ty' -> ret_type) with\n | [] -> fun q _ -> q\n | [t1] -> fun q -> q\n | [t1; t2] -> fun q x -> q (fstp x) (sndp x)\n | [t1; t2; t3] -> fun q x -> q x._1 x._2 x._3\n | [t1; t2; t3; t4] -> fun q x -> q x._1 x._2 x._3 x._4\n | [t1; t2; t3; t4; t5] -> fun q x -> q x._1 x._2 x._3 x._4 x._5\n | [t1; t2; t3; t4; t5; t6] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6\n | [t1; t2; t3; t4; t5; t6; t7] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12 x._13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12 x._13 x._14\n | _ -> fun _ _ -> def", "let compute_gen_elim_nondep_q0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> vprop) =\n match i with\n | GENonDep ty q post -> compute_uncurry vprop (compute_gen_elim_p' i0) ty q\n // that default value does not reduce, on purpose, to make the tactic fail if the type list is too long\n | GEDep -> compute_gen_elim_q i0", "let compute_gen_elim_nondep_q (i0: gen_elim_i) (i: gen_elim_nondep_t) (x: Ghost.erased (compute_gen_elim_nondep_a i0 i)) : Tot vprop =\n compute_gen_elim_nondep_q0 i0 i (Ghost.reveal x)", "let compute_gen_elim_nondep_post0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> prop) =\n match i with\n | GENonDep ty q post -> compute_uncurry prop True ty post\n | GEDep -> compute_gen_elim_post i0" ], "closest": [ "val compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n : Tot prop\nlet compute_gen_elim_nondep_post (i0: gen_elim_i) (i: gen_elim_nondep_t) (x: Ghost.erased (compute_gen_elim_nondep_a i0 i)) : Tot prop =\n compute_gen_elim_nondep_post0 i0 i (Ghost.reveal x)", "val compute_gen_elim_nondep_q\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n : Tot vprop\nlet compute_gen_elim_nondep_q (i0: gen_elim_i) (i: gen_elim_nondep_t) (x: Ghost.erased (compute_gen_elim_nondep_a i0 i)) : Tot vprop =\n compute_gen_elim_nondep_q0 i0 i (Ghost.reveal x)", "val compute_gen_elim_nondep_post0 (i0: gen_elim_i) (i: gen_elim_nondep_t)\n : Tot (compute_gen_elim_nondep_a i0 i -> prop)\nlet compute_gen_elim_nondep_post0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> prop) =\n match i with\n | GENonDep ty q post -> fun x -> compute_uncurry _ (fun _ -> True) ty post x (U.raise_val ())\n | GEDep -> compute_gen_elim_post i0", "val compute_gen_elim_nondep_q0 (i0: gen_elim_i) (i: gen_elim_nondep_t)\n : Tot (compute_gen_elim_nondep_a i0 i -> vprop)\nlet compute_gen_elim_nondep_q0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> vprop) =\n match i with\n | GENonDep ty q post -> fun x -> compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) ty q x (U.raise_val ())\n // that default value does not reduce, on purpose, to make the tactic fail if the type list is too long\n | GEDep -> compute_gen_elim_q i0", "val compute_gen_elim_nondep_correct\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (sq: squash (check_gen_elim_nondep_sem i0 i))\n : Tot\n (gen_elim_f (compute_gen_elim_p i0)\n (Ghost.erased (compute_gen_elim_nondep_a i0 i))\n (compute_gen_elim_nondep_q i0 i)\n (compute_gen_elim_nondep_post i0 i))\nlet compute_gen_elim_nondep_correct\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (sq: squash (check_gen_elim_nondep_sem i0 i))\n: Tot (gen_elim_f\n (compute_gen_elim_p i0)\n (Ghost.erased (compute_gen_elim_nondep_a i0 i))\n (compute_gen_elim_nondep_q i0 i)\n (compute_gen_elim_nondep_post i0 i)\n )\n= fun _ ->\n let res0 = compute_gen_elim_nondep_correct_0 i0 i sq _ in\n let res = Ghost.hide res0 in\n rewrite (compute_gen_elim_nondep_q0 i0 i res0) (compute_gen_elim_nondep_q i0 i res);\n res", "val compute_gen_elim_nondep_correct\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (sq: squash (check_gen_elim_nondep_sem i0 i))\n : Tot\n (gen_elim_f (compute_gen_elim_p i0)\n (Ghost.erased (compute_gen_elim_nondep_a i0 i))\n (compute_gen_elim_nondep_q i0 i)\n (compute_gen_elim_nondep_post i0 i))\nlet compute_gen_elim_nondep_correct\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (sq: squash (check_gen_elim_nondep_sem i0 i))\n: Tot (gen_elim_f\n (compute_gen_elim_p i0)\n (Ghost.erased (compute_gen_elim_nondep_a i0 i))\n (compute_gen_elim_nondep_q i0 i)\n (compute_gen_elim_nondep_post i0 i)\n )\n= fun _ ->\n let res0 = compute_gen_elim_nondep_correct_0 i0 i sq _ in\n let res = Ghost.hide res0 in\n rewrite (compute_gen_elim_nondep_q0 i0 i res0) (compute_gen_elim_nondep_q i0 i res);\n res", "val compute_gen_elim_nondep_correct0 (i0: gen_elim_i)\n : Tot (compute_gen_elim_nondep_correct_t i0 [])\nlet compute_gen_elim_nondep_correct0\n (i0: gen_elim_i)\n: Tot (compute_gen_elim_nondep_correct_t i0 [])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (q (U.raise_val ()) `star` pure (post (U.raise_val ())));\n let res = U.raise_val () in\n elim_pure _;\n rewrite_with_trefl (q (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct0 (i0: gen_elim_i)\n : Tot (compute_gen_elim_nondep_correct_t i0 [])\nlet compute_gen_elim_nondep_correct0\n (i0: gen_elim_i)\n: Tot (compute_gen_elim_nondep_correct_t i0 [])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (_ `star` pure post);\n let res = () in\n elim_pure _;\n rewrite_with_trefl q (compute_uncurry vprop _ _ _ res);\n res", "val compute_gen_elim_post (x: gen_elim_i) : Tot (compute_gen_elim_a x -> Tot prop) (decreases x)\nlet rec compute_gen_elim_post\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot prop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot prop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_post u\n | GEStarL left right -> fun v -> compute_gen_elim_post left (coerce_with_trefl v) /\\ compute_gen_unit_elim_post right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_post left /\\ compute_gen_elim_post right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_post left (fstp #tleft #tright v') /\\ compute_gen_elim_post right (sndp #tleft #tright v')\n | GEExistsNoAbs0 #a p -> fun _ -> True\n | GEExistsUnit0 #a p -> fun v -> compute_gen_unit_elim_post (p (U.downgrade_val v))\n | GEExists0 #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_post\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')\n | GEExistsNoAbs1 #a p -> fun _ -> True\n | GEExistsUnit1 #a p -> fun v -> compute_gen_unit_elim_post (p v)\n | GEExists1 #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_post\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')", "val compute_gen_elim_p (x: gen_elim_i) : Tot vprop\nlet rec compute_gen_elim_p\n (x: gen_elim_i)\n: Tot vprop\n= match x with\n | GEUnit i -> compute_gen_unit_elim_p i\n | GEStarL left right -> compute_gen_elim_p left `star` compute_gen_unit_elim_p right\n | GEStarR left right -> compute_gen_unit_elim_p left `star` compute_gen_elim_p right\n | GEStar left right -> compute_gen_elim_p left `star` compute_gen_elim_p right\n | GEExistsNoAbs0 #a p -> exists_ p\n | GEExistsUnit0 #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists0 #a body -> exists_ (fun x -> compute_gen_elim_p (body x))\n | GEExistsNoAbs1 #a p -> exists_ p\n | GEExistsUnit1 #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists1 #a body -> exists_ (fun x -> compute_gen_elim_p (body x))", "val compute_gen_unit_elim_post (x: gen_unit_elim_i) : Tot prop\nlet rec compute_gen_unit_elim_post\n (x: gen_unit_elim_i)\n: Tot prop\n= match x with\n | GUEId _ -> True\n | GUEPure p -> p\n | GUEStar left right -> compute_gen_unit_elim_post left /\\ compute_gen_unit_elim_post right", "val compute_gen_elim_nondep_correct' (i0: gen_elim_i) (ty: list Type0)\n : Tot (compute_gen_elim_nondep_correct_t i0 ty)\nlet compute_gen_elim_nondep_correct'\n (i0: gen_elim_i)\n (ty: list Type0)\n: Tot (compute_gen_elim_nondep_correct_t i0 ty)\n= match ty returns compute_gen_elim_nondep_correct_t i0 ty with\n | [] -> compute_gen_elim_nondep_correct0 i0\n | [t1] -> compute_gen_elim_nondep_correct1 i0 t1\n | [t1; t2] -> compute_gen_elim_nondep_correct2 i0 t1 t2\n | [t1; t2; t3] -> compute_gen_elim_nondep_correct3 i0 t1 t2 t3\n | [t1; t2; t3; t4] -> compute_gen_elim_nondep_correct4 i0 t1 t2 t3 t4\n | [t1; t2; t3; t4; t5] -> compute_gen_elim_nondep_correct5 i0 t1 t2 t3 t4 t5\n | [t1; t2; t3; t4; t5; t6] -> compute_gen_elim_nondep_correct6 i0 t1 t2 t3 t4 t5 t6\n | [t1; t2; t3; t4; t5; t6; t7] -> compute_gen_elim_nondep_correct7 i0 t1 t2 t3 t4 t5 t6 t7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> compute_gen_elim_nondep_correct8 i0 t1 t2 t3 t4 t5 t6 t7 t8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> compute_gen_elim_nondep_correct9 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> compute_gen_elim_nondep_correct10 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> compute_gen_elim_nondep_correct11 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> compute_gen_elim_nondep_correct12 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> compute_gen_elim_nondep_correct13 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> compute_gen_elim_nondep_correct14 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 \n | t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq -> compute_gen_elim_nondep_correct_default i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 tq", "val compute_gen_elim_nondep_correct' (i0: gen_elim_i) (ty: list Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 ty)\nlet compute_gen_elim_nondep_correct'\n (i0: gen_elim_i)\n (ty: list Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 ty)\n= match ty returns compute_gen_elim_nondep_correct_t i0 ty with\n | [] -> compute_gen_elim_nondep_correct0 i0\n | [t1] -> compute_gen_elim_nondep_correct1 i0 t1\n | [t1; t2] -> compute_gen_elim_nondep_correct2 i0 t1 t2\n | [t1; t2; t3] -> compute_gen_elim_nondep_correct3 i0 t1 t2 t3\n | [t1; t2; t3; t4] -> compute_gen_elim_nondep_correct4 i0 t1 t2 t3 t4\n | [t1; t2; t3; t4; t5] -> compute_gen_elim_nondep_correct5 i0 t1 t2 t3 t4 t5\n | [t1; t2; t3; t4; t5; t6] -> compute_gen_elim_nondep_correct6 i0 t1 t2 t3 t4 t5 t6\n | [t1; t2; t3; t4; t5; t6; t7] -> compute_gen_elim_nondep_correct7 i0 t1 t2 t3 t4 t5 t6 t7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> compute_gen_elim_nondep_correct8 i0 t1 t2 t3 t4 t5 t6 t7 t8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> compute_gen_elim_nondep_correct9 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> compute_gen_elim_nondep_correct10 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> compute_gen_elim_nondep_correct11 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> compute_gen_elim_nondep_correct12 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> compute_gen_elim_nondep_correct13 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> compute_gen_elim_nondep_correct14 i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 \n | t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq -> compute_gen_elim_nondep_correct_default i0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 tq", "val gen_elim_prop_elim\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Ghost (gen_elim_i & gen_elim_nondep_t)\n (requires gen_elim_prop enable_nondep_opt p a q post)\n (ensures (fun (i, j) ->\n p == compute_gen_elim_p i /\\\n check_gen_elim_nondep_sem i j /\\\n a == compute_gen_elim_nondep_a i j /\\\n q == compute_gen_elim_nondep_q i j /\\\n post == compute_gen_elim_nondep_post i j\n ))\nlet gen_elim_prop_elim enable_nondep_opt p a q post =\n FStar.IndefiniteDescription.indefinite_description_ghost _ (gen_elim_pred enable_nondep_opt p a q post)", "val gen_elim_pred\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: (Ghost.erased a -> Tot vprop))\n (post: (Ghost.erased a -> Tot prop))\n (ij: (gen_elim_i & gen_elim_nondep_t))\n : Tot prop\nlet gen_elim_pred\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (ij: (gen_elim_i & gen_elim_nondep_t))\n: Tot prop\n= let (i, j) = ij in\n p == compute_gen_elim_p i /\\\n check_gen_elim_nondep_sem i j /\\ \n a == compute_gen_elim_nondep_a i j /\\\n post == compute_gen_elim_nondep_post i j /\\\n q == compute_gen_elim_nondep_q i j", "val gen_elim_prop_intro'\n (i: gen_elim_i)\n (j: gen_elim_nondep_t)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq_p: squash (p == compute_gen_elim_p i))\n (sq_j: squash (check_gen_elim_nondep_sem i j))\n (sq_a: squash (a == compute_gen_elim_nondep_a i j))\n (sq_q: squash (q == compute_gen_elim_nondep_q i j))\n (sq_post: squash (post == compute_gen_elim_nondep_post i j))\n: Lemma\n (gen_elim_prop enable_nondep_opt p a q post)\nlet gen_elim_prop_intro'\n i j enable_nondep_opt p a q post sq_p sq_j sq_a sq_q sq_post\n= assert (gen_elim_pred enable_nondep_opt p a q post (i, j))", "val gen_elim_prop_elim\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Ghost (gen_elim_i & gen_elim_nondep_t)\n (requires gen_elim_prop enable_nondep_opt p a q post)\n (ensures (fun (i, j) ->\n p == compute_gen_elim_p i /\\\n check_gen_elim_nondep_sem i j /\\\n a == compute_gen_elim_nondep_a i j /\\\n q == compute_gen_elim_nondep_q i j /\\\n post == compute_gen_elim_nondep_post i j\n ))\nlet gen_elim_prop_elim enable_nondep_opt p a q post =\n FStar.IndefiniteDescription.indefinite_description_ghost _ (gen_elim_pred enable_nondep_opt p a q post)", "val gen_elim_prop_intro'\n (i: gen_elim_i)\n (j: gen_elim_nondep_t)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq_p: squash (p == compute_gen_elim_p i))\n (sq_j: squash (check_gen_elim_nondep_sem i j))\n (sq_a: squash (a == compute_gen_elim_nondep_a i j))\n (sq_q: squash (q == compute_gen_elim_nondep_q i j))\n (sq_post: squash (post == compute_gen_elim_nondep_post i j))\n: Lemma\n (gen_elim_prop enable_nondep_opt p a q post)\nlet gen_elim_prop_intro'\n i j enable_nondep_opt p a q post sq_p sq_j sq_a sq_q sq_post\n= assert (gen_elim_pred enable_nondep_opt p a q post (i, j))", "val compute_gen_unit_elim_p (x: gen_unit_elim_i) : Tot vprop\nlet rec compute_gen_unit_elim_p\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure p -> pure p\n | GUEStar left right -> compute_gen_unit_elim_p left `star` compute_gen_unit_elim_p right", "val compute_gen_elim_nondep_correct12\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12])\nlet compute_gen_elim_nondep_correct12\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 (U.raise_val ())))))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let x10 = elim_exists' () in\n let x11 = elim_exists' () in\n let x12 = elim_exists' () in\n let res = Mktuple12 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct14\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)\n : Tot\n (compute_gen_elim_nondep_correct_t i0\n [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14])\nlet compute_gen_elim_nondep_correct14\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> exists_ (fun x13 -> exists_ (fun x14 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 (U.raise_val ())))))))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let x10 = elim_exists' () in\n let x11 = elim_exists' () in\n let x12 = elim_exists' () in\n let x13 = elim_exists' () in\n let x14 = elim_exists' () in\n let res = Mktuple14 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val gen_elim_prop_intro\n (i: gen_elim_i)\n (ty: list (Type u#1))\n (tvprop: Type)\n (q0: tvprop)\n (tprop: Type)\n (post0: tprop)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: (Ghost.erased a -> Tot vprop))\n (post: (Ghost.erased a -> Tot prop))\n (sq_tvprop: squash (tvprop == curried_function_type u#1 u#2 ty (U.raise_t unit -> vprop)))\n (sq_tprop: squash (tprop == curried_function_type u#1 u#2 ty (U.raise_t u#_ u#2 unit -> prop))\n )\n (sq_p: squash (p == compute_gen_elim_p i))\n (sq_j: squash (check_gen_elim_nondep_sem i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n (sq_a: squash (a == compute_gen_elim_nondep_a i (mk_gen_elim_nondep ty tvprop q0 tprop post0))\n )\n (sq_q: squash (q == compute_gen_elim_nondep_q i (mk_gen_elim_nondep ty tvprop q0 tprop post0))\n )\n (sq_post:\n squash (post ==\n compute_gen_elim_nondep_post i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n : Lemma (gen_elim_prop enable_nondep_opt p a q post)\nlet gen_elim_prop_intro\n (i: gen_elim_i)\n (ty: list (Type u#1))\n (tvprop: Type)\n (q0: tvprop)\n (tprop: Type)\n (post0: tprop)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq_tvprop: squash (tvprop == curried_function_type u#1 u#2 ty (U.raise_t unit -> vprop)))\n (sq_tprop: squash (tprop == curried_function_type u#1 u#2 ty (U.raise_t u#_ u#2 unit -> prop)))\n (sq_p: squash (p == compute_gen_elim_p i))\n (sq_j: squash (check_gen_elim_nondep_sem i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n (sq_a: squash (a == compute_gen_elim_nondep_a i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n (sq_q: squash (q == compute_gen_elim_nondep_q i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n (sq_post: squash (post == compute_gen_elim_nondep_post i (mk_gen_elim_nondep ty tvprop q0 tprop post0)))\n: Lemma\n (gen_elim_prop enable_nondep_opt p a q post)\n= gen_elim_prop_intro' i (mk_gen_elim_nondep ty tvprop q0 tprop post0) enable_nondep_opt p a q post sq_p sq_j sq_a sq_q sq_post", "val compute_gen_elim_nondep_correct2 (i0: gen_elim_i) (t1 t2: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])\nlet compute_gen_elim_nondep_correct2\n (i0: gen_elim_i)\n (t1 t2: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> q x1 x2 (U.raise_val ()) `star` pure (post x1 x2 (U.raise_val ())))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let res = Mktuple2 x1 x2 in\n elim_pure _;\n rewrite_with_trefl (q _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct13\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)\n : Tot\n (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13])\nlet compute_gen_elim_nondep_correct13\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> exists_ (fun x12 -> exists_ (fun x13 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 (U.raise_val ()))))))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let x10 = elim_exists' () in\n let x11 = elim_exists' () in\n let x12 = elim_exists' () in\n let x13 = elim_exists' () in\n let res = Mktuple13 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct8 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])\nlet compute_gen_elim_nondep_correct8\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> q x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 (U.raise_val ())))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let res = Mktuple8 x1 x2 x3 x4 x5 x6 x7 x8 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct1 (i0: gen_elim_i) (t1: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1])\nlet compute_gen_elim_nondep_correct1\n (i0: gen_elim_i)\n (t1: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> q x1 (U.raise_val ()) `star` pure (post x1 (U.raise_val ()))));\n let res = elim_exists' () in\n elim_pure _;\n rewrite_with_trefl (q _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct7 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])\nlet compute_gen_elim_nondep_correct7\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> q x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 (U.raise_val ()))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let res = Mktuple7 x1 x2 x3 x4 x5 x6 x7 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct6 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])\nlet compute_gen_elim_nondep_correct6\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> q x1 x2 x3 x4 x5 x6 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 (U.raise_val ())))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let res = Mktuple6 x1 x2 x3 x4 x5 x6 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij", "val compute_gen_elim_nondep_correct_default\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15: Type0)\n (tq: list Type0)\n : Tot\n (compute_gen_elim_nondep_correct_t i0\n (t1 ::\n t2 ::\n t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq))\nlet compute_gen_elim_nondep_correct_default\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15: Type0) (tq: list Type0)\n: Tot (compute_gen_elim_nondep_correct_t i0 (t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq))\n= fun q post intro _ ->\n // default case: no exists is opened\n let res : compute_gen_elim_nondep_a' (t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq) = coerce_with_trefl () in\n rewrite_with_trefl (compute_gen_elim_p i0) (compute_uncurry vprop _ _ _ res);\n res", "val compute_gen_elim_nondep_correct4 (i0: gen_elim_i) (t1 t2 t3 t4: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])\nlet compute_gen_elim_nondep_correct4\n (i0: gen_elim_i)\n (t1 t2 t3 t4: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> q x1 x2 x3 x4 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 (U.raise_val ())))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let res = Mktuple4 x1 x2 x3 x4 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct11 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])\nlet compute_gen_elim_nondep_correct11\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> exists_ (fun x11 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 (U.raise_val ()))))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let x10 = elim_exists' () in\n let x11 = elim_exists' () in\n let res = Mktuple11 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_f (i: gen_elim_i) : GTot (gen_elim_t i)\nlet rec compute_gen_elim_f\n (i: gen_elim_i)\n: GTot (gen_elim_t i)\n= match i returns (gen_elim_t i) with\n | GEUnit i -> compute_gen_elim_f_unit i\n | GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2\n | GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)\n | GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)\n | GEExistsNoAbs0 body -> compute_gen_elim_f_exists_no_abs0 _ body\n | GEExistsUnit0 body -> compute_gen_elim_f_exists_unit0 _ body\n | GEExists0 body -> compute_gen_elim_f_exists0 _ body (fun x -> compute_gen_elim_f (body x))\n | GEExistsNoAbs1 body -> compute_gen_elim_f_exists_no_abs1 _ body\n | GEExistsUnit1 body -> compute_gen_elim_f_exists_unit1 _ body\n | GEExists1 body -> compute_gen_elim_f_exists1 _ body (fun x -> compute_gen_elim_f (body x))", "val compute_gen_elim_f (i: gen_elim_i) : GTot (gen_elim_t i)\nlet rec compute_gen_elim_f\n (i: gen_elim_i)\n: GTot (gen_elim_t i)\n= match i returns (gen_elim_t i) with\n | GEUnit i -> compute_gen_elim_f_unit i\n | GEStarL i1 i2 -> compute_gen_elim_f_star_l i1 (compute_gen_elim_f i1) i2\n | GEStarR i1 i2 -> compute_gen_elim_f_star_r i1 i2 (compute_gen_elim_f i2)\n | GEStar i1 i2 -> compute_gen_elim_f_star i1 (compute_gen_elim_f i1) i2 (compute_gen_elim_f i2)\n | GEExistsNoAbs body -> compute_gen_elim_f_exists_no_abs _ body\n | GEExistsUnit body -> compute_gen_elim_f_exists_unit _ body\n | GEExists body -> compute_gen_elim_f_exists _ body (fun x -> compute_gen_elim_f (body x))", "val compute_gen_elim_q (x: gen_elim_i) : Tot (compute_gen_elim_a x -> Tot vprop) (decreases x)\nlet rec compute_gen_elim_q\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot vprop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot vprop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_q u\n | GEStarL left right -> fun v -> compute_gen_elim_q left (coerce_with_trefl v) `star` compute_gen_unit_elim_q right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_q left `star` compute_gen_elim_q right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_q left (fstp #tleft #tright v') `star` compute_gen_elim_q right (sndp #tleft #tright v')\n | GEExistsNoAbs0 #a p -> fun v -> p (U.downgrade_val v)\n | GEExistsUnit0 #a p -> fun v -> compute_gen_unit_elim_q (p (U.downgrade_val v))\n | GEExists0 #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_q\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')\n | GEExistsNoAbs1 #a p -> p\n | GEExistsUnit1 #a p -> fun v -> compute_gen_unit_elim_q (p v)\n | GEExists1 #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_q\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')", "val compute_gen_elim_a (x: gen_elim_i) : Tot (Type u#1)\nlet rec compute_gen_elim_a\n (x: gen_elim_i)\n: Tot (Type u#1)\n= match x with\n | GEUnit _ -> U.raise_t unit\n | GEStarL left _ -> compute_gen_elim_a left\n | GEStarR _ right -> compute_gen_elim_a right\n | GEStar left right -> (compute_gen_elim_a left & compute_gen_elim_a right)\n | GEExistsNoAbs0 #a _\n | GEExistsUnit0 #a _ -> U.raise_t a\n | GEExists0 #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))\n | GEExistsNoAbs1 #a _\n | GEExistsUnit1 #a _ -> a\n | GEExists1 #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))", "val compute_gen_elim_nondep_correct5 (i0: gen_elim_i) (t1 t2 t3 t4 t5: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])\nlet compute_gen_elim_nondep_correct5\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> q x1 x2 x3 x4 x5 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 (U.raise_val ()))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let res = Mktuple5 x1 x2 x3 x4 x5 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct10 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])\nlet compute_gen_elim_nondep_correct10\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> exists_ (fun x10 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 (U.raise_val ())))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let x10 = elim_exists' () in\n let res = Mktuple10 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct_default\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15: Type)\n (tq: list Type)\n : Tot\n (compute_gen_elim_nondep_correct_t i0\n (t1 ::\n t2 ::\n t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq))\nlet compute_gen_elim_nondep_correct_default\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15: Type) (tq: list Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 (t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq))\n= fun q post intro _ ->\n // default case: no exists is opened\n let res : compute_gen_elim_nondep_a' (t1 :: t2 :: t3 :: t4 :: t5 :: t6 :: t7 :: t8 :: t9 :: t10 :: t11 :: t12 :: t13 :: t14 :: t15 :: tq) = (U.raise_val ()) in\n rewrite_with_trefl (compute_gen_elim_p i0) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_nondep_correct3 (i0: gen_elim_i) (t1 t2 t3: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])\nlet compute_gen_elim_nondep_correct3\n (i0: gen_elim_i)\n (t1 t2 t3: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> q x1 x2 x3 (U.raise_val ()) `star` pure (post x1 x2 x3 (U.raise_val ()))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let res = Mktuple3 x1 x2 x3 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_unit_elim_q (x: gen_unit_elim_i) : Tot vprop\nlet rec compute_gen_unit_elim_q\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure _ -> emp\n | GUEStar left right -> compute_gen_unit_elim_q left `star` compute_gen_unit_elim_q right", "val gen_elim_prop\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\nlet gen_elim_prop\n enable_nondep_opt p a q post\n= exists ij . gen_elim_pred enable_nondep_opt p a q post ij", "val compute_gen_elim_nondep_correct9 (i0: gen_elim_i) (t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)\n : Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])\nlet compute_gen_elim_nondep_correct9\n (i0: gen_elim_i)\n (t1 t2 t3 t4 t5 t6 t7 t8 t9: Type)\n: Tot (compute_gen_elim_nondep_correct_t i0 [t1; t2; t3; t4; t5; t6; t7; t8; t9])\n= fun q post intro _ ->\n intro _;\n rewrite_with_trefl (gen_elim_nondep_p _ _ _) (exists_ (fun x1 -> exists_ (fun x2 -> exists_ (fun x3 -> exists_ (fun x4 -> exists_ (fun x5 -> exists_ (fun x6 -> exists_ (fun x7 -> exists_ (fun x8 -> exists_ (fun x9 -> q x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()) `star` pure (post x1 x2 x3 x4 x5 x6 x7 x8 x9 (U.raise_val ()))))))))))));\n let x1 = elim_exists' () in\n let x2 = elim_exists' () in\n let x3 = elim_exists' () in\n let x4 = elim_exists' () in\n let x5 = elim_exists' () in\n let x6 = elim_exists' () in\n let x7 = elim_exists' () in\n let x8 = elim_exists' () in\n let x9 = elim_exists' () in\n let res = Mktuple9 x1 x2 x3 x4 x5 x6 x7 x8 x9 in\n elim_pure _;\n rewrite_with_trefl (q _ _ _ _ _ _ _ _ _ (U.raise_val ())) (compute_uncurry _ (fun _ -> compute_gen_elim_p' i0) _ _ res (U.raise_val ()));\n res", "val compute_gen_elim_tele (x: gen_elim_i) : Tot (gen_elim_tele u#1)\nlet rec compute_gen_elim_tele (x: gen_elim_i) : Tot (gen_elim_tele u#1) =\n match x with\n | GEUnit v -> TRet (compute_gen_unit_elim_q v) (compute_gen_unit_elim_post v)\n | GEStarL l ru -> tele_star_vprop (compute_gen_elim_tele l) (compute_gen_unit_elim_q ru) (compute_gen_unit_elim_post ru)\n | GEStarR lu r -> tele_star_vprop (compute_gen_elim_tele r) (compute_gen_unit_elim_q lu) (compute_gen_unit_elim_post lu)\n | GEStar l r -> tele_star (compute_gen_elim_tele l) (compute_gen_elim_tele r)\n | GEExistsNoAbs0 #ty body -> TExists (U.raise_t ty) (fun x -> TRet (body (U.downgrade_val x)) True)\n | GEExistsUnit0 #ty body -> TExists (U.raise_t ty) (fun x -> TRet (compute_gen_unit_elim_q (body (U.downgrade_val x))) (compute_gen_unit_elim_post (body (U.downgrade_val x))))\n | GEExists0 #ty f -> TExists (U.raise_t ty) (fun x -> compute_gen_elim_tele (f (U.downgrade_val x)))\n | GEExistsNoAbs1 #ty body -> TExists ty (fun x -> TRet (body x) True)\n | GEExistsUnit1 #ty body -> TExists ty (fun x -> TRet (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_post (body x)))\n | GEExists1 #ty f -> TExists ty (fun x -> compute_gen_elim_tele (f x))", "val gen_elim_prop_placeholder\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: (Ghost.erased a -> Tot vprop))\n (post: (Ghost.erased a -> Tot prop))\n : Tot prop\nlet gen_elim_prop_placeholder\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type u#1)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n: Tot prop\n= True", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type0)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val check_gen_elim_nondep_sem (i: gen_elim_i) (nd: gen_elim_nondep_t u#1) : Tot prop\nlet check_gen_elim_nondep_sem (i: gen_elim_i) (nd: gen_elim_nondep_t u#1) : Tot prop =\n match nd with\n | GENonDep ty q post -> compute_gen_elim_tele i == gen_elim_nondep_sem ty q post\n | GEDep -> True", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val gen_elim'\n (#opened: _)\n (enable_nondep_opt: bool)\n (p: vprop)\n (a: Type)\n (q: Ghost.erased a -> Tot vprop)\n (post: Ghost.erased a -> Tot prop)\n (sq: squash (gen_elim_prop_placeholder enable_nondep_opt p a q post))\n (_: unit)\n: STGhost (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) (gen_elim_prop enable_nondep_opt p a q post) post\nlet gen_elim'\n #opened enable_nondep_opt p a q post _ ()\n=\n let (i, j) = gen_elim_prop_elim enable_nondep_opt p a q post in\n rewrite p (compute_gen_elim_p i);\n let res' = compute_gen_elim_nondep_correct i j () _ in\n let res : Ghost.erased a = Ghost.hide (coerce_with_smt (Ghost.reveal res')) in\n rewrite (compute_gen_elim_nondep_q i j res') (guard_vprop (q res));\n res", "val compute_gen_elim_nondep_a' (ty: list (Type u#a)) : Tot (Type u#a)\nlet compute_gen_elim_nondep_a' (ty: list (Type u#a)) : Tot (Type u#a) =\n match ty with\n | [] -> U.raise_t unit\n | [t1] -> t1\n | [t1; t2] -> tuple2 t1 t2\n | [t1; t2; t3] -> tuple3 t1 t2 t3\n | [t1; t2; t3; t4] -> tuple4 t1 t2 t3 t4\n | [t1; t2; t3; t4; t5] -> tuple5 t1 t2 t3 t4 t5\n | [t1; t2; t3; t4; t5; t6] -> tuple6 t1 t2 t3 t4 t5 t6\n | [t1; t2; t3; t4; t5; t6; t7] -> tuple7 t1 t2 t3 t4 t5 t6 t7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> tuple8 t1 t2 t3 t4 t5 t6 t7 t8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> tuple9 t1 t2 t3 t4 t5 t6 t7 t8 t9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> tuple10 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> tuple11 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> tuple12 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> tuple13 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> tuple14 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14\n | _ -> U.raise_t unit", "val gen_elim_dep\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder false p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop false p a q post))) post\nlet gen_elim_dep\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val Steel.ST.GenElim.compute_gen_elim_nondep_correct_0 = i0: Steel.ST.GenElim.Base.gen_elim_i -> i: Steel.ST.GenElim.Base.gen_elim_nondep_t\n -> Prims.GTot\n (sq: Prims.squash (Steel.ST.GenElim.Base.check_gen_elim_nondep_sem i0 i)\n -> Prims.GTot\n (Steel.ST.GenElim.gen_elim_f (Steel.ST.GenElim.Base.compute_gen_elim_p i0)\n (Steel.ST.GenElim.Base.compute_gen_elim_nondep_a i0 i)\n (Steel.ST.GenElim.Base.compute_gen_elim_nondep_q0 i0 i)\n (Steel.ST.GenElim.Base.compute_gen_elim_nondep_post0 i0 i)))\nlet compute_gen_elim_nondep_correct_0\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n= match i returns \n (sq: squash (check_gen_elim_nondep_sem i0 i)) ->\n GTot (gen_elim_f\n (compute_gen_elim_p i0)\n (compute_gen_elim_nondep_a i0 i)\n (compute_gen_elim_nondep_q0 i0 i)\n (compute_gen_elim_nondep_post0 i0 i)\n )\n with\n | GEDep -> fun _ -> compute_gen_elim_f i0\n | GENonDep ty q post -> fun _ ->\n let intro : vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post) = fun _ ->\n compute_gen_elim_tele_correct i0 _;\n rewrite (tele_p _) (tele_p (gen_elim_nondep_sem ty q post));\n gen_elim_nondep_sem_correct ty q post;\n rewrite_equiv (tele_p _) (gen_elim_nondep_p _ _ _)\n in\n compute_gen_elim_nondep_correct' i0 ty q post intro", "val compute_gen_elim_tele_correct_exists0\n (ty: _)\n (body: (ty -> gen_elim_i))\n (ih: (x: ty -> GTot (ge_to_tele_t (body x))))\n : Tot (ge_to_tele_t (GEExists0 #ty body))\nlet compute_gen_elim_tele_correct_exists0\n (ty: _)\n (body: ty -> gen_elim_i)\n (ih: (x: ty) -> GTot (ge_to_tele_t (body x)))\n: Tot (ge_to_tele_t (GEExists0 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let x = elim_exists' () in\n ih x _;\n rewrite (tele_p (compute_gen_elim_tele (body x))) (tele_p (compute_gen_elim_tele (body (U.downgrade_val (U.raise_val u#0 u#1 x)))));\n intro_exists (U.raise_val u#0 u#1 x) (fun x -> tele_p (compute_gen_elim_tele (body (U.downgrade_val u#0 u#1 x))));\n rewrite_with_trefl (exists_ _) (tele_p _)", "val compute_gen_unit_elim_f (i: gen_unit_elim_i) : GTot (gen_unit_elim_t i)\nlet rec compute_gen_unit_elim_f\n (i: gen_unit_elim_i)\n: GTot (gen_unit_elim_t i)\n= match i returns (gen_unit_elim_t i) with\n | GUEId v -> compute_gen_unit_elim_f_id v\n | GUEPure p -> compute_gen_unit_elim_f_pure p\n | GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)", "val compute_gen_unit_elim_f (i: gen_unit_elim_i) : GTot (gen_unit_elim_t i)\nlet rec compute_gen_unit_elim_f\n (i: gen_unit_elim_i)\n: GTot (gen_unit_elim_t i)\n= match i returns (gen_unit_elim_t i) with\n | GUEId v -> compute_gen_unit_elim_f_id v\n | GUEPure p -> compute_gen_unit_elim_f_pure p\n | GUEStar i1 i2 -> compute_gen_unit_elim_f_star i1 i2 (compute_gen_unit_elim_f i1) (compute_gen_unit_elim_f i2)", "val compute_gen_elim_tele_correct (x: gen_elim_i) : GTot (ge_to_tele_t x)\nlet rec compute_gen_elim_tele_correct\n (x: gen_elim_i)\n: GTot (ge_to_tele_t x)\n= match x returns ge_to_tele_t x with\n | GEUnit v -> compute_gen_elim_tele_correct_unit v\n | GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru\n | GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)\n | GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)\n | GEExistsNoAbs #ty body -> compute_gen_elim_tele_correct_exists_no_abs ty body\n | GEExistsUnit #ty body -> compute_gen_elim_tele_correct_exists_unit ty body\n | GEExists #ty body -> compute_gen_elim_tele_correct_exists ty body (fun x -> compute_gen_elim_tele_correct (body x))", "val compute_gen_elim_tele_correct (x: gen_elim_i) : GTot (ge_to_tele_t x)\nlet rec compute_gen_elim_tele_correct\n (x: gen_elim_i)\n: GTot (ge_to_tele_t x)\n= match x returns ge_to_tele_t x with\n | GEUnit v -> compute_gen_elim_tele_correct_unit v\n | GEStarL l ru -> compute_gen_elim_tele_correct_star_l l (compute_gen_elim_tele_correct l) ru\n | GEStarR lu r -> compute_gen_elim_tele_correct_star_r lu r (compute_gen_elim_tele_correct r)\n | GEStar l r -> compute_gen_elim_tele_correct_star l (compute_gen_elim_tele_correct l) r (compute_gen_elim_tele_correct r)\n | GEExistsNoAbs0 #ty body -> compute_gen_elim_tele_correct_exists_no_abs0 ty body\n | GEExistsUnit0 #ty body -> compute_gen_elim_tele_correct_exists_unit0 ty body\n | GEExists0 #ty body -> compute_gen_elim_tele_correct_exists0 ty body (fun x -> compute_gen_elim_tele_correct (body x))\n | GEExistsNoAbs1 #ty body -> compute_gen_elim_tele_correct_exists_no_abs1 ty body\n | GEExistsUnit1 #ty body -> compute_gen_elim_tele_correct_exists_unit1 ty body\n | GEExists1 #ty body -> compute_gen_elim_tele_correct_exists1 ty body (fun x -> compute_gen_elim_tele_correct (body x))", "val Steel.ST.GenElim1.compute_gen_elim_nondep_correct_0 = i0: Steel.ST.GenElim1.Base.gen_elim_i -> i: Steel.ST.GenElim1.Base.gen_elim_nondep_t\n -> Prims.GTot\n (sq: Prims.squash (Steel.ST.GenElim1.Base.check_gen_elim_nondep_sem i0 i)\n -> Prims.GTot\n (Steel.ST.GenElim1.gen_elim_f (Steel.ST.GenElim1.Base.compute_gen_elim_p i0)\n (Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a i0 i)\n (Steel.ST.GenElim1.Base.compute_gen_elim_nondep_q0 i0 i)\n (Steel.ST.GenElim1.Base.compute_gen_elim_nondep_post0 i0 i)))\nlet compute_gen_elim_nondep_correct_0\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n= match i returns \n (sq: squash (check_gen_elim_nondep_sem i0 i)) ->\n GTot (gen_elim_f\n (compute_gen_elim_p i0)\n (compute_gen_elim_nondep_a i0 i)\n (compute_gen_elim_nondep_q0 i0 i)\n (compute_gen_elim_nondep_post0 i0 i)\n )\n with\n | GEDep -> fun _ -> compute_gen_elim_f i0\n | GENonDep ty q post -> fun _ ->\n let intro : vprop_rewrite (compute_gen_elim_p i0) (gen_elim_nondep_p ty q post) = fun _ ->\n compute_gen_elim_tele_correct i0 _;\n rewrite (tele_p _) (tele_p (gen_elim_nondep_sem ty q post));\n gen_elim_nondep_sem_correct ty q post;\n rewrite_equiv (tele_p _) (gen_elim_nondep_p _ _ _)\n in\n compute_gen_elim_nondep_correct' i0 ty q post intro", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type0)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val compute_gen_elim_tele_correct_exists\n (ty: _)\n (body: (ty -> gen_elim_i))\n (ih: (x: ty -> GTot (ge_to_tele_t (body x))))\n : Tot (ge_to_tele_t (GEExists #ty body))\nlet compute_gen_elim_tele_correct_exists\n (ty: _)\n (body: ty -> gen_elim_i)\n (ih: (x: ty) -> GTot (ge_to_tele_t (body x)))\n: Tot (ge_to_tele_t (GEExists #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let x = elim_exists' () in\n ih x _;\n intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));\n rewrite_with_trefl (exists_ _) (tele_p _)", "val gen_elim_nondep_sem_correct (ty: list Type0)\n : Tot\n (q: curried_function_type ty vprop -> post: curried_function_type ty prop\n -> Lemma ((tele_p (gen_elim_nondep_sem ty q post)) `equiv` (gen_elim_nondep_p ty q post)))\nlet rec gen_elim_nondep_sem_correct\n (ty: list Type0)\n: Tot ((q: curried_function_type ty vprop) -> (post: curried_function_type ty prop) -> Lemma\n (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)\n )\n= match ty returns ((q: curried_function_type ty vprop) -> (post: curried_function_type ty prop) -> Lemma\n (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)\n )\n with\n | [] -> fun q post -> equiv_refl (q `star` pure post)\n | ta :: tq -> fun q post ->\n let phi\n (x: ta)\n : Lemma\n (tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))\n = gen_elim_nondep_sem_correct tq (q x) (post x)\n in\n Classical.forall_intro phi;\n let prf () : Lemma\n (exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))\n =\n exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))\n in\n assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));\n assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));\n prf ()", "val compute_gen_elim_f_unit (i: gen_unit_elim_i) : GTot (gen_elim_t (GEUnit i))\nlet compute_gen_elim_f_unit\n (i: gen_unit_elim_i)\n: GTot (gen_elim_t (GEUnit i))\n= compute_gen_unit_elim_f i", "val compute_gen_elim_f_unit (i: gen_unit_elim_i) : GTot (gen_elim_t (GEUnit i))\nlet compute_gen_elim_f_unit\n (i: gen_unit_elim_i)\n: GTot (gen_elim_t (GEUnit i))\n= compute_gen_unit_elim_f i", "val compute_gen_elim_f_exists0\n (a: Type0)\n (body: (a -> gen_elim_i))\n (f: (x: a -> GTot (gen_elim_t (body x))))\n : Tot (gen_elim_t (GEExists0 body))\nlet compute_gen_elim_f_exists0\n (a: Type0)\n (body: a -> gen_elim_i)\n (f: (x: a) -> GTot (gen_elim_t (body x)))\n: Tot (gen_elim_t (GEExists0 body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p (GEExists0 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let gres1 = elim_exists () in\n let gres2 = f gres1 _ in\n let res : compute_gen_elim_a (GEExists0 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in\n rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists0 body) res);\n res", "val gen_elim\n (#opened: _)\n (#[@@@ framing_implicit] p: vprop)\n (#[@@@ framing_implicit] a: Type)\n (#[@@@ framing_implicit] q: Ghost.erased a -> Tot vprop)\n (#[@@@ framing_implicit] post: Ghost.erased a -> Tot prop)\n (#[@@@ framing_implicit] sq: squash (gen_elim_prop_placeholder true p a q post))\n (_: unit)\n: STGhostF (Ghost.erased a) opened p (fun x -> guard_vprop (q x)) ( (T.with_tactic solve_gen_elim_prop) (squash (gen_elim_prop true p a q post))) post\nlet gen_elim\n #opened #p #a #q #post #sq _\n= gen_elim' #opened _ p a q post sq ()", "val compute_gen_elim_tele_correct_exists1\n (ty: _)\n (body: (ty -> gen_elim_i))\n (ih: (x: ty -> GTot (ge_to_tele_t (body x))))\n : Tot (ge_to_tele_t (GEExists1 #ty body))\nlet compute_gen_elim_tele_correct_exists1\n (ty: _)\n (body: ty -> gen_elim_i)\n (ih: (x: ty) -> GTot (ge_to_tele_t (body x)))\n: Tot (ge_to_tele_t (GEExists1 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let x = elim_exists' () in\n ih x _;\n intro_exists x (fun x -> tele_p (compute_gen_elim_tele (body x)));\n rewrite_with_trefl (exists_ _) (tele_p _)", "val compute_gen_elim_f_star\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n : GTot (gen_elim_t (GEStar i1 i2))\nlet compute_gen_elim_f_star\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n: GTot (gen_elim_t (GEStar i1 i2))\n= fun _ ->\n rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);\n let res1 = f1 _ in\n let res2 = f2 _ in\n let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in\n rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);\n res", "val compute_gen_elim_f_star\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n : GTot (gen_elim_t (GEStar i1 i2))\nlet compute_gen_elim_f_star\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n: GTot (gen_elim_t (GEStar i1 i2))\n= fun _ ->\n rewrite (compute_gen_elim_p (GEStar i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_elim_p i2);\n let res1 = f1 _ in\n let res2 = f2 _ in\n let res : compute_gen_elim_a (GEStar i1 i2) = coerce_with_trefl (res1, res2) in\n rewrite (compute_gen_elim_q i1 res1 `star` compute_gen_elim_q i2 res2) (compute_gen_elim_q (GEStar i1 i2) res);\n res", "val compute_gen_elim_f_exists_no_abs0 (a: Type0) (body: (a -> vprop))\n : GTot (gen_elim_t (GEExistsNoAbs0 body))\nlet compute_gen_elim_f_exists_no_abs0\n (a: Type0)\n (body: (a -> vprop))\n: GTot (gen_elim_t (GEExistsNoAbs0 body))\n= fun _ ->\n rewrite (compute_gen_elim_p (GEExistsNoAbs0 body)) (exists_ body);\n let gres = elim_exists () in\n let res : compute_gen_elim_a (GEExistsNoAbs0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in\n rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs0 body) res);\n res", "val compute_gen_elim_f_exists\n (a: Type0)\n (body: (a -> gen_elim_i))\n (f: (x: a -> GTot (gen_elim_t (body x))))\n : Tot (gen_elim_t (GEExists body))\nlet compute_gen_elim_f_exists\n (a: Type0)\n (body: a -> gen_elim_i)\n (f: (x: a) -> GTot (gen_elim_t (body x)))\n: Tot (gen_elim_t (GEExists body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p (GEExists body)) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let gres1 = elim_exists () in\n let gres2 = f gres1 _ in\n let res : compute_gen_elim_a (GEExists body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in\n rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists body) res);\n res", "val compute_gen_elim_f_exists_no_abs (a: Type0) (body: (a -> vprop))\n : GTot (gen_elim_t (GEExistsNoAbs body))\nlet compute_gen_elim_f_exists_no_abs\n (a: Type0)\n (body: (a -> vprop))\n: GTot (gen_elim_t (GEExistsNoAbs body))\n= fun _ ->\n rewrite (compute_gen_elim_p (GEExistsNoAbs body)) (exists_ body);\n let gres = elim_exists () in\n let res : compute_gen_elim_a (GEExistsNoAbs body) = coerce_with_trefl (Ghost.reveal gres) in\n rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs body) res);\n res", "val gen_elim_nondep_sem_correct (ty: list (Type u#a))\n : Tot\n (q: curried_function_type ty _ -> post: curried_function_type ty _\n -> Lemma ((tele_p (gen_elim_nondep_sem ty q post)) `equiv` (gen_elim_nondep_p ty q post)))\nlet rec gen_elim_nondep_sem_correct\n (ty: list (Type u#a))\n: Tot ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma\n (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)\n )\n= match ty returns ((q: curried_function_type ty _) -> (post: curried_function_type ty _) -> Lemma\n (tele_p (gen_elim_nondep_sem ty q post) `equiv` gen_elim_nondep_p ty q post)\n )\n with\n | [] -> fun q post -> equiv_refl (q (U.raise_val ()) `star` pure (post (U.raise_val ())))\n | ta :: tq -> fun q post ->\n let phi\n (x: ta)\n : Lemma\n (tele_p (gen_elim_nondep_sem tq (q x) (post x)) `equiv` gen_elim_nondep_p tq (q x) (post x))\n = gen_elim_nondep_sem_correct tq (q x) (post x)\n in\n Classical.forall_intro phi;\n let prf () : Lemma\n (exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) `equiv` exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)))\n =\n exists_equiv (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))) (fun x -> gen_elim_nondep_p tq (q x) (post x))\n in\n assert_norm (tele_p (gen_elim_nondep_sem (ta :: tq) q post) == exists_ (fun x -> tele_p (gen_elim_nondep_sem tq (q x) (post x))));\n assert_norm (gen_elim_nondep_p (ta :: tq) q post == exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x)));\n prf ()", "val compute_gen_elim_f_star_l (i1: gen_elim_i) (f1: gen_elim_t i1) (i2: gen_unit_elim_i)\n : GTot (gen_elim_t (GEStarL i1 i2))\nlet compute_gen_elim_f_star_l\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_unit_elim_i)\n: GTot (gen_elim_t (GEStarL i1 i2))\n= let f2 = compute_gen_unit_elim_f i2 in\n fun _ ->\n rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);\n let res = f1 _ in\n f2 _;\n let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in\n rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');\n res'", "val compute_gen_elim_f_star_l (i1: gen_elim_i) (f1: gen_elim_t i1) (i2: gen_unit_elim_i)\n : GTot (gen_elim_t (GEStarL i1 i2))\nlet compute_gen_elim_f_star_l\n (i1: gen_elim_i)\n (f1: gen_elim_t i1)\n (i2: gen_unit_elim_i)\n: GTot (gen_elim_t (GEStarL i1 i2))\n= let f2 = compute_gen_unit_elim_f i2 in\n fun _ ->\n rewrite (compute_gen_elim_p (GEStarL i1 i2)) (compute_gen_elim_p i1 `star` compute_gen_unit_elim_p i2);\n let res = f1 _ in\n let _ = f2 _ in\n let res' : compute_gen_elim_a (GEStarL i1 i2) = coerce_with_trefl res in\n rewrite (compute_gen_elim_q i1 res `star` compute_gen_unit_elim_q i2) (compute_gen_elim_q (GEStarL i1 i2) res');\n res'", "val Steel.ST.GenElim1.Base.compute_gen_elim_p' = x: Steel.ST.GenElim1.Base.gen_elim_i -> Steel.Effect.Common.vprop\nlet compute_gen_elim_p' = compute_gen_elim_p", "val compute_gen_elim_tele_correct_exists_no_abs0 (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs0\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs0 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n rewrite (body x) (body (U.downgrade_val (U.raise_val x)));\n intro_exists (U.raise_val u#0 u#1 x) (fun x -> body (U.downgrade_val x) `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)", "val gen_elim_nondep_p (ty: list (Type u#a))\n : Tot\n (\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) ->\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop)\n -> Tot vprop)\nlet rec gen_elim_nondep_p (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop) =\n match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot vprop with\n | [] -> fun q post -> q (U.raise_val ()) `star` pure (post (U.raise_val ()))\n | t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))", "val compute_gen_unit_elim_f_star\n (i1 i2: gen_unit_elim_i)\n (f1: gen_unit_elim_t i1)\n (f2: gen_unit_elim_t i2)\n : Tot (gen_unit_elim_t (GUEStar i1 i2))\nlet compute_gen_unit_elim_f_star\n (i1 i2: gen_unit_elim_i)\n (f1: gen_unit_elim_t i1)\n (f2: gen_unit_elim_t i2)\n: Tot (gen_unit_elim_t (GUEStar i1 i2))\n= fun _ ->\n rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);\n let _ = f1 _ in\n let _ = f2 _ in\n rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2));\n U.raise_val ()", "val compute_gen_unit_elim_f_star\n (i1 i2: gen_unit_elim_i)\n (f1: gen_unit_elim_t i1)\n (f2: gen_unit_elim_t i2)\n : Tot (gen_unit_elim_t (GUEStar i1 i2))\nlet compute_gen_unit_elim_f_star\n (i1 i2: gen_unit_elim_i)\n (f1: gen_unit_elim_t i1)\n (f2: gen_unit_elim_t i2)\n: Tot (gen_unit_elim_t (GUEStar i1 i2))\n= fun _ ->\n rewrite (compute_gen_unit_elim_p (GUEStar i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_unit_elim_p i2);\n f1 _; f2 _;\n rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_unit_elim_q i2) (compute_gen_unit_elim_q (GUEStar i1 i2))", "val gen_elim_nondep_sem (ty: list (Type u#a))\n : Tot\n (\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) ->\n curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop)\n -> Tot (gen_elim_tele u#a))\nlet rec gen_elim_nondep_sem (ty: list (Type u#a)) : Tot (curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot (gen_elim_tele u#a)) =\n match ty as ty' returns curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> vprop) -> curried_function_type ty' (U.raise_t u#_ u#(max 2 a) unit -> prop) -> Tot gen_elim_tele with\n | [] -> fun q post -> TRet (q (U.raise_val ())) (post (U.raise_val ()))\n | t :: tq -> fun q post -> TExists t (fun x -> gen_elim_nondep_sem tq (q x) (post x))", "val compute_gen_elim_f_exists_no_abs1 (a: Type) (body: (a -> vprop))\n : GTot (gen_elim_t (GEExistsNoAbs1 body))\nlet compute_gen_elim_f_exists_no_abs1\n (a: Type)\n (body: (a -> vprop))\n: GTot (gen_elim_t (GEExistsNoAbs1 body))\n= fun _ ->\n rewrite (compute_gen_elim_p (GEExistsNoAbs1 body)) (exists_ body);\n let gres = elim_exists () in\n let res : compute_gen_elim_a (GEExistsNoAbs1 body) = coerce_with_trefl (Ghost.reveal gres) in\n rewrite (body gres) (compute_gen_elim_q (GEExistsNoAbs1 body) res);\n res", "val gen_elim_nondep_p (ty: list Type0)\n : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot vprop)\nlet rec gen_elim_nondep_p (ty: list Type0) : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot vprop) =\n match ty as ty' returns curried_function_type ty' vprop -> curried_function_type ty' prop -> Tot vprop with\n | [] -> fun q post -> q `star` pure post\n | t :: tq -> fun q post -> exists_ (fun x -> gen_elim_nondep_p tq (q x) (post x))", "val compute_gen_elim_f_star_r (i1: gen_unit_elim_i) (i2: gen_elim_i) (f2: gen_elim_t i2)\n : GTot (gen_elim_t (GEStarR i1 i2))\nlet compute_gen_elim_f_star_r\n (i1: gen_unit_elim_i)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n: GTot (gen_elim_t (GEStarR i1 i2))\n= let f1 = compute_gen_unit_elim_f i1 in\n fun _ ->\n rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);\n f1 _;\n let res = f2 _ in\n let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in\n rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');\n res'", "val compute_gen_elim_f_star_r (i1: gen_unit_elim_i) (i2: gen_elim_i) (f2: gen_elim_t i2)\n : GTot (gen_elim_t (GEStarR i1 i2))\nlet compute_gen_elim_f_star_r\n (i1: gen_unit_elim_i)\n (i2: gen_elim_i)\n (f2: gen_elim_t i2)\n: GTot (gen_elim_t (GEStarR i1 i2))\n= let f1 = compute_gen_unit_elim_f i1 in\n fun _ ->\n rewrite (compute_gen_elim_p (GEStarR i1 i2)) (compute_gen_unit_elim_p i1 `star` compute_gen_elim_p i2);\n let _ = f1 _ in\n let res = f2 _ in\n let res' : compute_gen_elim_a (GEStarR i1 i2) = coerce_with_trefl res in\n rewrite (compute_gen_unit_elim_q i1 `star` compute_gen_elim_q i2 res) (compute_gen_elim_q (GEStarR i1 i2) res');\n res'", "val compute_gen_elim_tele_correct_exists_no_abs (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n intro_exists x (fun x -> body x `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)", "val tele_p (x: gen_elim_tele) : Tot vprop\nlet rec tele_p (x: gen_elim_tele) : Tot vprop =\n match x with\n | TRet v p -> v `star` pure p\n | TExists ty body -> exists_ (fun x -> tele_p (body x))", "val tele_p (x: gen_elim_tele) : Tot vprop\nlet rec tele_p (x: gen_elim_tele) : Tot vprop =\n match x with\n | TRet v p -> v `star` pure p\n | TExists ty body -> exists_ (fun x -> tele_p (body x))", "val compute_gen_elim_tele_correct_exists_no_abs1 (ty: _) (body: (ty -> vprop))\n : Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))\nlet compute_gen_elim_tele_correct_exists_no_abs1\n (ty: _)\n (body: ty -> vprop)\n: Tot (ge_to_tele_t (GEExistsNoAbs1 #ty body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (exists_ body);\n let x = elim_exists' () in\n intro_pure True;\n intro_exists x (fun x -> body x `star` pure True);\n rewrite_with_trefl (exists_ _) (tele_p _)", "val v_c_dep\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (nllist:\n (n': Ghost.erased nat -> r: t a {Ghost.reveal n' < Ghost.reveal n}\n -> Pure vprop (requires True) (ensures (fun y -> t_of y == list a))))\n (c: normal (t_of (vrefine (vptr r) (v_c n r))))\n : Tot vprop\nlet v_c_dep\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (nllist: (n': Ghost.erased nat) -> (r: t a { Ghost.reveal n' < Ghost.reveal n }) -> Pure vprop (requires True) (ensures (fun y -> t_of y == list a)))\n (c: normal (t_of (vrefine (vptr r) (v_c n r))))\n: Tot vprop\n= nllist c.tail_fuel c.next", "val v_c_dep\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (nllist:\n (n': Ghost.erased nat -> r: t a {Ghost.reveal n' < Ghost.reveal n}\n -> Pure vprop (requires True) (ensures (fun y -> t_of y == list a))))\n (c: normal (t_of (vrefine (vptr r) (v_c n r))))\n : Tot vprop\nlet v_c_dep\n (n: Ghost.erased nat)\n (#a: Type0)\n (r: t a)\n (nllist: (n': Ghost.erased nat) -> (r: t a { Ghost.reveal n' < Ghost.reveal n }) -> Pure vprop (requires True) (ensures (fun y -> t_of y == list a)))\n (c: normal (t_of (vrefine (vptr r) (v_c n r))))\n: Tot vprop\n= nllist c.tail_fuel c.next", "val compute_gen_elim_tele_correct_star\n (l: gen_elim_i)\n (ihl: ge_to_tele_t l)\n (r: gen_elim_i)\n (ihr: ge_to_tele_t r)\n : Tot (ge_to_tele_t (GEStar l r))\nlet compute_gen_elim_tele_correct_star\n (l: gen_elim_i)\n (ihl: ge_to_tele_t l)\n (r: gen_elim_i)\n (ihr: ge_to_tele_t r)\n: Tot (ge_to_tele_t (GEStar l r))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);\n ihl _;\n ihr _;\n tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;\n rewrite_with_trefl (tele_p _) (tele_p _)", "val compute_gen_elim_tele_correct_star\n (l: gen_elim_i)\n (ihl: ge_to_tele_t l)\n (r: gen_elim_i)\n (ihr: ge_to_tele_t r)\n : Tot (ge_to_tele_t (GEStar l r))\nlet compute_gen_elim_tele_correct_star\n (l: gen_elim_i)\n (ihl: ge_to_tele_t l)\n (r: gen_elim_i)\n (ihr: ge_to_tele_t r)\n: Tot (ge_to_tele_t (GEStar l r))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p _) (compute_gen_elim_p l `star` compute_gen_elim_p r);\n ihl _;\n ihr _;\n tele_star_correct (compute_gen_elim_tele l) (compute_gen_elim_tele r) _;\n rewrite_with_trefl (tele_p _) (tele_p _)", "val mk_gen_elim_nondep (ty: list (Type u#a)) (tvprop: Type) (q: tvprop) (tprop: Type) (post: tprop)\n : Pure (gen_elim_nondep_t u#a)\n (requires\n (tvprop == curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) /\\\n tprop == curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop)))\n (ensures (fun _ -> True))\nlet mk_gen_elim_nondep\n (ty: list (Type u#a))\n (tvprop: Type)\n (q: tvprop)\n (tprop: Type)\n (post: tprop)\n: Pure (gen_elim_nondep_t u#a)\n (requires (\n tvprop == curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> vprop) /\\\n tprop == curried_function_type ty (U.raise_t u#_ u#(max 2 a) unit -> prop)\n ))\n (ensures (fun _ -> True))\n= GENonDep ty q post", "val compute_gen_elim_f_exists_unit0 (a: Type0) (body: (a -> gen_unit_elim_i))\n : Tot (gen_elim_t (GEExistsUnit0 body))\nlet compute_gen_elim_f_exists_unit0\n (a: Type0)\n (body: a -> gen_unit_elim_i)\n: Tot (gen_elim_t (GEExistsUnit0 body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit0 body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));\n let gres = elim_exists () in\n let _ = compute_gen_unit_elim_f (body gres) _ in\n let res : compute_gen_elim_a (GEExistsUnit0 body) = U.raise_val (Ghost.reveal gres) in // coerce_with_trefl (Ghost.reveal gres) in\n rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit0 body) res);\n res", "val compute_gen_elim_f_exists1\n (a: Type)\n (body: (a -> gen_elim_i))\n (f: (x: a -> GTot (gen_elim_t (body x))))\n : Tot (gen_elim_t (GEExists1 body))\nlet compute_gen_elim_f_exists1\n (a: Type)\n (body: a -> gen_elim_i)\n (f: (x: a) -> GTot (gen_elim_t (body x)))\n: Tot (gen_elim_t (GEExists1 body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p (GEExists1 body)) (exists_ (fun x -> compute_gen_elim_p (body x)));\n let gres1 = elim_exists () in\n let gres2 = f gres1 _ in\n let res : compute_gen_elim_a (GEExists1 body) = coerce_with_trefl (Mkdtuple2 #a #(fun x -> compute_gen_elim_a (body x)) (Ghost.reveal gres1) (Ghost.reveal gres2)) in\n rewrite (compute_gen_elim_q (body gres1) gres2) (compute_gen_elim_q (GEExists1 body) res);\n res", "val compute_gen_elim_f_exists_unit (a: Type0) (body: (a -> gen_unit_elim_i))\n : Tot (gen_elim_t (GEExistsUnit body))\nlet compute_gen_elim_f_exists_unit\n (a: Type0)\n (body: a -> gen_unit_elim_i)\n: Tot (gen_elim_t (GEExistsUnit body))\n= fun _ ->\n rewrite_with_trefl (compute_gen_elim_p (GEExistsUnit body)) (exists_ (fun x -> compute_gen_unit_elim_p (body x)));\n let gres = elim_exists () in\n compute_gen_unit_elim_f (body gres) _;\n let res : compute_gen_elim_a (GEExistsUnit body) = coerce_with_trefl (Ghost.reveal gres) in\n rewrite (compute_gen_unit_elim_q (body gres)) (compute_gen_elim_q (GEExistsUnit body) res);\n res", "val queue_head_dep1\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n : Tot vprop\nlet queue_head_dep1\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n: Tot vprop\n= vptr (cllist_tail x) `vrefine` queue_head_refine x l hd ptl", "val queue_head_refine\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n (tl: ref (ccell_ptrvalue a))\n : Tot prop\nlet queue_head_refine\n (#a: Type)\n (x: t a)\n (l: Ghost.erased (list a))\n (hd: ccell_ptrvalue a)\n (ptl: t_of (llist_fragment_head l (cllist_head x) hd))\n (tl: ref (ccell_ptrvalue a))\n: Tot prop\n= let ptl : (ref (ccell_ptrvalue a) & ccell_ptrvalue a) = ptl in\n tl == fst ptl /\\ ccell_ptrvalue_is_null (snd ptl) == true", "val compute_gen_unit_elim_f_pure (p: prop) : Tot (gen_unit_elim_t (GUEPure p))\nlet compute_gen_unit_elim_f_pure\n (p: prop)\n: Tot (gen_unit_elim_t (GUEPure p))\n= fun _ ->\n rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);\n elim_pure p;\n U.raise_val ()", "val compute_gen_unit_elim_f_pure (p: prop) : Tot (gen_unit_elim_t (GUEPure p))\nlet compute_gen_unit_elim_f_pure\n (p: prop)\n: Tot (gen_unit_elim_t (GUEPure p))\n= fun _ ->\n rewrite (compute_gen_unit_elim_p (GUEPure p)) (pure p);\n elim_pure p" ], "closest_src": [ { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_post" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_q" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_post0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_q0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_nondep_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_nondep_correct0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_post" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_unit_elim_post" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_nondep_correct'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_prop_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_pred" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_prop_intro'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop_intro'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_unit_elim_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct12" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct14" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.gen_elim_prop_intro" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct2" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct13" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct8" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct1" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct7" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct6" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.Base.fst", "name": "Steel.ST.GenElim.Base.gen_elim_prop" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_nondep_correct_default" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct4" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct11" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_q" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_a" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct5" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct10" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct_default" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct3" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_unit_elim_q" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fst", "name": "Steel.ST.GenElim1.Base.gen_elim_prop" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct9" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_tele" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.gen_elim_prop_placeholder" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.check_gen_elim_nondep_sem" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_nondep_a'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_nondep_correct_0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_unit_elim_f" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_unit_elim_f" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_tele_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_nondep_correct_0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_tele_correct_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_nondep_sem_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_unit" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_unit" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_exists0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists1" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_exists_no_abs0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_exists" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_exists_no_abs" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_nondep_sem_correct" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_star_l" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_star_l" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.compute_gen_elim_p'" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists_no_abs0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.gen_elim_nondep_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_unit_elim_f_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_unit_elim_f_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.gen_elim_nondep_sem" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_exists_no_abs1" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.gen_elim_nondep_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_star_r" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_star_r" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_tele_correct_exists_no_abs" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.tele_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.tele_p" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_exists_no_abs1" }, { "project_name": "steel", "file_name": "Selectors.LList3.fst", "name": "Selectors.LList3.v_c_dep" }, { "project_name": "steel", "file_name": "Selectors.LList2.fst", "name": "Selectors.LList2.v_c_dep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_tele_correct_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_tele_correct_star" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.Base.fsti", "name": "Steel.ST.GenElim1.Base.mk_gen_elim_nondep" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_exists_unit0" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_elim_f_exists1" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_elim_f_exists_unit" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.queue_head_dep1" }, { "project_name": "steel", "file_name": "CQueue.fst", "name": "CQueue.queue_head_refine" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim1.fst", "name": "Steel.ST.GenElim1.compute_gen_unit_elim_f_pure" }, { "project_name": "steel", "file_name": "Steel.ST.GenElim.fst", "name": "Steel.ST.GenElim.compute_gen_unit_elim_f_pure" } ], "selected_premises": [ "Steel.ST.GenElim.Base.compute_gen_unit_elim_post", "Steel.Effect.Common.to_vprop", "Steel.Effect.Common.to_vprop'", "Steel.Memory.full_mem", "Steel.Effect.Common.rmem", "Steel.ST.GenElim.Base.check_gen_elim_nondep_sem", "Steel.Memory.inames", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_q0", "Steel.FractionalPermission.full_perm", "Steel.ST.Util.emp_inames", "Steel.Effect.Common.rm", "Steel.Preorder.pcm_history", "Steel.Effect.Common.star", "Steel.ST.GenElim.Base.compute_gen_elim_p", "Steel.ST.GenElim.Base.compute_gen_elim_p'", "FStar.List.Tot.Base.map", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_post0", "FStar.List.Tot.Base.length", "Steel.Effect.Common.hp_of", "Steel.ST.GenElim.Base.compute_gen_unit_elim_p", "Steel.Effect.Common.guard_vprop", "Steel.Memory.hmem", "Steel.ST.GenElim.Base.compute_gen_unit_elim_q", "Steel.ST.Util.op_At_Equals_Equals_Greater", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_q", "Steel.ST.GenElim.Base.compute_gen_elim_q", "Steel.Effect.Common.req", "Steel.ST.GenElim.Base.gen_elim_nondep_sem", "Steel.ST.GenElim.Base.tele_star_vprop", "Steel.Effect.Common.t_of", "Steel.ST.GenElim.Base.tele_star", "Steel.Effect.Common.mk_rmem", "Steel.Effect.Common.normal", "Steel.ST.GenElim.Base.curried_function_type", "Steel.Effect.Common.pure", "Steel.Effect.Common.vrefine'", "Steel.Effect.Common.hmem", "Steel.Preorder.history_val", "FStar.Reflection.V2.Derived.mk_app", "Steel.Effect.Common.normal_steps", "Steel.ST.GenElim.Base.is_fvar", "Steel.ST.GenElim.Base.fstp", "FStar.PCM.composable", "Steel.ST.GenElim.Base.compute_gen_elim_post", "Steel.ST.GenElim.Base.compute_gen_elim_tele", "Steel.Effect.Common.rmem'", "Steel.ST.GenElim.Base.dsndp", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_a", "Steel.Effect.Common.inv", "FStar.Reflection.V2.Derived.mk_e_app", "FStar.Reflection.V2.Data.var", "Steel.ST.GenElim.Base.compute_gen_elim_a", "Steel.Effect.Common.vrefine", "FStar.Real.one", "Steel.ST.GenElim.Base.sndp", "Steel.ST.GenElim.Base.dfstp", "FStar.PCM.op", "Steel.Effect.Common.focus_rmem_refl", "FStar.List.Tot.Base.op_At", "FStar.Real.two", "FStar.UInt.size", "Steel.FractionalPermission.comp_perm", "FStar.PCM.compatible", "Steel.Effect.Common.sel_of", "Steel.FractionalPermission.sum_perm", "Steel.Effect.Common.return_pre", "Steel.ST.GenElim.Base.is_any_fvar", "Steel.Effect.Common.vc_norm", "Steel.ST.GenElim.Base.compute_uncurry", "Steel.Effect.Common.extract_contexts", "FStar.Mul.op_Star", "Steel.ST.Util.elim_implies", "Steel.ST.Util.intro_implies", "Steel.ST.Util.wand_is_implies", "Steel.ST.GenElim.Base.mk_gen_elim_nondep", "Steel.Effect.Common.mk_rmem'", "Steel.Effect.Common.focus_rmem", "FStar.Reflection.V2.Derived.u_unk", "Steel.ST.Util.rewrite_with_implies", "FStar.FunctionalExtensionality.feq", "Steel.Effect.Common.unfold_guard", "FStar.List.Tot.Base.rev", "FStar.Tactics.CanonCommMonoidSimple.Equiv.term_eq", "FStar.List.Tot.Base.mem", "FStar.Reflection.V2.Derived.flatten_name", "Steel.ST.Util.implies_join_gen", "FStar.List.Tot.Base.tl", "FStar.Pervasives.reveal_opaque", "Steel.Effect.Common.selector'", "Steel.ST.Util.implies_trans_gen", "Steel.ST.Util.implies_uncurry_gen", "FStar.Heap.trivial_preorder", "Steel.Effect.Common.norm_return_pre", "Steel.Effect.Common.sel_depends_only_on", "Steel.Effect.Common.try_open_existentials", "Steel.ST.Util.implies_consumes_r", "Steel.Effect.Common.print_goals", "Steel.ST.GenElim.Base.compute_gen_elim_nondep_a'", "Steel.Effect.Common.visit_br", "FStar.NMSTTotal.get" ], "source_upto_this": "module Steel.ST.GenElim.Base\ninclude Steel.ST.Util\n\nmodule T = FStar.Tactics\n\nlet is_fvar = Reflection.is_fvar\nlet is_any_fvar = Reflection.is_any_fvar\n\n/// A tactic to automatically generate a unique binder\n\n[@@erasable]\nnoeq\ntype gen_unit_elim_i\n= | GUEId: (v: vprop) -> gen_unit_elim_i\n | GUEPure: (p: prop) -> gen_unit_elim_i\n | GUEStar: (left: gen_unit_elim_i) -> (right: gen_unit_elim_i) -> gen_unit_elim_i\n\n[@@erasable]\nnoeq\ntype gen_elim_i =\n | GEUnit: (i: gen_unit_elim_i) -> gen_elim_i\n | GEStarL: (left: gen_elim_i) -> (right: gen_unit_elim_i) -> gen_elim_i\n | GEStarR: (left: gen_unit_elim_i) -> (right: gen_elim_i) -> gen_elim_i\n | GEStar: (left: gen_elim_i) -> (right: gen_elim_i) -> gen_elim_i\n | GEExistsNoAbs: (#a: Type0) -> (body: (a -> vprop)) -> gen_elim_i // FIXME: generalize the universe\n | GEExistsUnit: (#a: Type0) -> (body: (a -> gen_unit_elim_i)) -> gen_elim_i\n | GEExists: (#a: Type0) -> (body: (a -> gen_elim_i)) -> gen_elim_i\n\nval gen_elim_reduce: unit\n\n[@@ gen_elim_reduce]\nlet rec compute_gen_unit_elim_p\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure p -> pure p\n | GUEStar left right -> compute_gen_unit_elim_p left `star` compute_gen_unit_elim_p right\n\n[@@ gen_elim_reduce]\nlet rec compute_gen_unit_elim_q\n (x: gen_unit_elim_i)\n: Tot vprop\n= match x with\n | GUEId v -> v\n | GUEPure _ -> emp\n | GUEStar left right -> compute_gen_unit_elim_q left `star` compute_gen_unit_elim_q right\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet rec compute_gen_unit_elim_post\n (x: gen_unit_elim_i)\n: Tot prop\n= match x with\n | GUEId _ -> True\n | GUEPure p -> p\n | GUEStar left right -> compute_gen_unit_elim_post left /\\ compute_gen_unit_elim_post right\n\n[@@gen_elim_reduce]\nlet rec compute_gen_elim_p\n (x: gen_elim_i)\n: Tot vprop\n= match x with\n | GEUnit i -> compute_gen_unit_elim_p i\n | GEStarL left right -> compute_gen_elim_p left `star` compute_gen_unit_elim_p right\n | GEStarR left right -> compute_gen_unit_elim_p left `star` compute_gen_elim_p right\n | GEStar left right -> compute_gen_elim_p left `star` compute_gen_elim_p right\n | GEExistsNoAbs #a p -> exists_ p\n | GEExistsUnit #a p -> exists_ (fun x -> compute_gen_unit_elim_p (p x))\n | GEExists #a body -> exists_ (fun x -> compute_gen_elim_p (body x))\n\nlet compute_gen_elim_p' = compute_gen_elim_p\n\n[@@ gen_elim_reduce; __steel_reduce__; noextract_to \"Plugin\"]\nlet rec compute_gen_elim_a\n (x: gen_elim_i)\n: Tot Type0\n= match x with\n | GEUnit _ -> unit\n | GEStarL left _ -> compute_gen_elim_a left\n | GEStarR _ right -> compute_gen_elim_a right\n | GEStar left right -> (compute_gen_elim_a left & compute_gen_elim_a right)\n | GEExistsNoAbs #a _\n | GEExistsUnit #a _ -> a\n | GEExists #a body -> dtuple2 a (fun x -> compute_gen_elim_a (body x))\n\n[@@noextract_to \"Plugin\"]\nlet dfstp #a #b t = dfst #a #b t\n[@@noextract_to \"Plugin\"]\nlet dsndp #a #b t = dsnd #a #b t\n[@@noextract_to \"Plugin\"]\nlet fstp #a #b t = fst #a #b t\n[@@noextract_to \"Plugin\"]\nlet sndp #a #b t = snd #a #b t\n\n[@@gen_elim_reduce; __steel_reduce__; noextract_to \"Plugin\"]\nlet coerce_with_trefl (#tfrom #tto: Type) (x: tfrom) : Pure tto (requires (T.with_tactic T.trefl (tfrom == tto))) (ensures (fun _ -> True)) = x\n\n[@@gen_elim_reduce]\nlet rec compute_gen_elim_q\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot vprop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot vprop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_q u\n | GEStarL left right -> fun v -> compute_gen_elim_q left (coerce_with_trefl v) `star` compute_gen_unit_elim_q right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_q left `star` compute_gen_elim_q right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_q left (fstp #tleft #tright v') `star` compute_gen_elim_q right (sndp #tleft #tright v')\n | GEExistsNoAbs #a p -> p\n | GEExistsUnit #a p -> fun v -> compute_gen_unit_elim_q (p v)\n | GEExists #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_q\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet rec compute_gen_elim_post\n (x: gen_elim_i)\n: Tot (compute_gen_elim_a x -> Tot prop)\n (decreases x)\n= match x as x' returns (compute_gen_elim_a x' -> Tot prop) with\n | GEUnit u -> fun _ -> compute_gen_unit_elim_post u\n | GEStarL left right -> fun v -> compute_gen_elim_post left (coerce_with_trefl v) /\\ compute_gen_unit_elim_post right\n | GEStarR left right -> fun v -> compute_gen_unit_elim_post left /\\ compute_gen_elim_post right (coerce_with_trefl v)\n | GEStar left right ->\n let tleft = compute_gen_elim_a left in\n let tright = compute_gen_elim_a right in\n fun v ->\n let v' : (tleft & tright) = coerce_with_trefl v in\n compute_gen_elim_post left (fstp #tleft #tright v') /\\ compute_gen_elim_post right (sndp #tleft #tright v')\n | GEExistsNoAbs #a p -> fun _ -> True\n | GEExistsUnit #a p -> fun v -> compute_gen_unit_elim_post (p v)\n | GEExists #a body ->\n let dept = (fun x -> compute_gen_elim_a (body x)) in\n fun v ->\n let v' : dtuple2 a dept = coerce_with_trefl v in\n compute_gen_elim_post\n (body (dfstp #a #dept v'))\n (dsndp #a #dept v')\n\n[@@erasable]\nnoeq\ntype gen_elim_tele =\n | TRet: vprop -> prop -> gen_elim_tele\n | TExists: (ty: Type u#0) -> (ty -> gen_elim_tele) -> gen_elim_tele\n\n[@@gen_elim_reduce]\nlet rec tele_star_vprop (i: gen_elim_tele) (v: vprop) (p: prop) : Tot gen_elim_tele (decreases i) =\n match i with\n | TRet v' p' -> TRet (v `star` v') (p /\\ p')\n | TExists ty f -> TExists ty (fun x -> tele_star_vprop (f x) v p)\n\n[@@gen_elim_reduce]\nlet rec tele_star (i1 i2: gen_elim_tele) : Tot gen_elim_tele =\n match i1, i2 with\n | TRet v1 p1, _ -> tele_star_vprop i2 v1 p1\n | _, TRet v2 p2 -> tele_star_vprop i1 v2 p2\n | TExists ty1 f1, TExists ty2 f2 -> TExists ty1 (fun x1 -> TExists ty2 (fun x2 -> tele_star (f1 x1) (f2 x2)))\n\n[@@gen_elim_reduce]\nlet rec compute_gen_elim_tele (x: gen_elim_i) : Tot gen_elim_tele =\n match x with\n | GEUnit v -> TRet (compute_gen_unit_elim_q v) (compute_gen_unit_elim_post v)\n | GEStarL l ru -> tele_star_vprop (compute_gen_elim_tele l) (compute_gen_unit_elim_q ru) (compute_gen_unit_elim_post ru)\n | GEStarR lu r -> tele_star_vprop (compute_gen_elim_tele r) (compute_gen_unit_elim_q lu) (compute_gen_unit_elim_post lu)\n | GEStar l r -> tele_star (compute_gen_elim_tele l) (compute_gen_elim_tele r)\n | GEExistsNoAbs #ty body -> TExists ty (fun x -> TRet (body x) True)\n | GEExistsUnit #ty body -> TExists ty (fun x -> TRet (compute_gen_unit_elim_q (body x)) (compute_gen_unit_elim_post (body x)))\n | GEExists #ty f -> TExists ty (fun x -> compute_gen_elim_tele (f x))\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet rec curried_function_type (x: list (Type u#a)) (ret_t: Type u#(max a b)) : Tot (Type u#(max a b)) =\n match x with\n | [] -> ret_t\n | t1 :: q -> t1 -> Tot (curried_function_type q ret_t)\n\n[@@erasable]\nnoeq\ntype gen_elim_nondep_t =\n| GENonDep: (ty: list Type0) -> curried_function_type ty vprop -> curried_function_type ty prop -> gen_elim_nondep_t\n| GEDep\n\n[@@gen_elim_reduce]\nlet mk_gen_elim_nondep\n (ty: list Type0)\n (tvprop: Type)\n (q: tvprop)\n (tprop: Type)\n (post: tprop)\n: Pure gen_elim_nondep_t\n (requires (\n tvprop == curried_function_type ty vprop /\\\n tprop == curried_function_type ty prop\n ))\n (ensures (fun _ -> True))\n= GENonDep ty q post\n\n[@@gen_elim_reduce]\nlet mk_gen_elim_nondep_by_tac\n (ty: list Type0)\n (tvprop: Type)\n (q: tvprop)\n (tprop: Type)\n (post: tprop)\n: Pure gen_elim_nondep_t\n (requires (\n T.with_tactic (fun _ -> T.norm [delta_attr [(`%gen_elim_reduce)]; iota; zeta]) (tvprop == curried_function_type ty vprop) /\\\n T.with_tactic (fun _ -> T.norm [delta_attr [(`%gen_elim_reduce)]; iota; zeta]) (tprop == curried_function_type ty prop)\n ))\n (ensures (fun _ -> True))\n= GENonDep ty q post\n\n[@@gen_elim_reduce]\nlet rec gen_elim_nondep_sem (ty: list Type0) : Tot (curried_function_type ty vprop -> curried_function_type ty prop -> Tot gen_elim_tele) =\n match ty as ty' returns curried_function_type ty' vprop -> curried_function_type ty' prop -> Tot gen_elim_tele with\n | [] -> fun q post -> TRet q post\n | t :: tq -> fun q post -> TExists t (fun x -> gen_elim_nondep_sem tq (q x) (post x))\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet check_gen_elim_nondep_sem (i: gen_elim_i) (nd: gen_elim_nondep_t) : Tot prop =\n match nd with\n | GENonDep ty q post -> compute_gen_elim_tele i == gen_elim_nondep_sem ty q post\n | GEDep -> True\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet compute_gen_elim_nondep_a' (ty: list Type0) : Tot Type0 =\n match ty with\n | [] -> unit\n | [t1] -> t1\n | [t1; t2] -> tuple2 t1 t2\n | [t1; t2; t3] -> tuple3 t1 t2 t3\n | [t1; t2; t3; t4] -> tuple4 t1 t2 t3 t4\n | [t1; t2; t3; t4; t5] -> tuple5 t1 t2 t3 t4 t5\n | [t1; t2; t3; t4; t5; t6] -> tuple6 t1 t2 t3 t4 t5 t6\n | [t1; t2; t3; t4; t5; t6; t7] -> tuple7 t1 t2 t3 t4 t5 t6 t7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> tuple8 t1 t2 t3 t4 t5 t6 t7 t8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> tuple9 t1 t2 t3 t4 t5 t6 t7 t8 t9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> tuple10 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> tuple11 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> tuple12 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> tuple13 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> tuple14 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14\n | _ -> unit // unsupported\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet compute_gen_elim_nondep_a (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot Type0 =\n match i with\n | GENonDep ty q post -> compute_gen_elim_nondep_a' ty\n | GEDep -> compute_gen_elim_a i0\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet compute_uncurry (ret_type: Type u#a) (def: ret_type) (ty: list Type0) : curried_function_type ty ret_type -> compute_gen_elim_nondep_a' ty -> ret_type =\n match ty as ty' returns (curried_function_type ty' ret_type -> compute_gen_elim_nondep_a' ty' -> ret_type) with\n | [] -> fun q _ -> q\n | [t1] -> fun q -> q\n | [t1; t2] -> fun q x -> q (fstp x) (sndp x)\n | [t1; t2; t3] -> fun q x -> q x._1 x._2 x._3\n | [t1; t2; t3; t4] -> fun q x -> q x._1 x._2 x._3 x._4\n | [t1; t2; t3; t4; t5] -> fun q x -> q x._1 x._2 x._3 x._4 x._5\n | [t1; t2; t3; t4; t5; t6] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6\n | [t1; t2; t3; t4; t5; t6; t7] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7\n | [t1; t2; t3; t4; t5; t6; t7; t8] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12 x._13\n | [t1; t2; t3; t4; t5; t6; t7; t8; t9; t10; t11; t12; t13; t14] -> fun q x -> q x._1 x._2 x._3 x._4 x._5 x._6 x._7 x._8 x._9 x._10 x._11 x._12 x._13 x._14\n | _ -> fun _ _ -> def\n\n[@@gen_elim_reduce]\nlet compute_gen_elim_nondep_q0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> vprop) =\n match i with\n | GENonDep ty q post -> compute_uncurry vprop (compute_gen_elim_p' i0) ty q\n // that default value does not reduce, on purpose, to make the tactic fail if the type list is too long\n | GEDep -> compute_gen_elim_q i0\n\n[@@gen_elim_reduce]\nlet compute_gen_elim_nondep_q (i0: gen_elim_i) (i: gen_elim_nondep_t) (x: Ghost.erased (compute_gen_elim_nondep_a i0 i)) : Tot vprop =\n compute_gen_elim_nondep_q0 i0 i (Ghost.reveal x)\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]\nlet compute_gen_elim_nondep_post0 (i0: gen_elim_i) (i: gen_elim_nondep_t) : Tot (compute_gen_elim_nondep_a i0 i -> prop) =\n match i with\n | GENonDep ty q post -> compute_uncurry prop True ty post\n | GEDep -> compute_gen_elim_post i0\n\n[@@gen_elim_reduce; noextract_to \"Plugin\"]", "sketch": [ "The `compute_gen_elim_nondep_post` function takes a `gen_elim_i` value `i0`, a `gen_elim_nondep_t` value `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It computes and returns a value of type `prop`.\n\nStep 1: This function computes the postcondition of a non-dependent elimination rule.\n\nStep 2: The function pattern matches on the `gen_elim_nondep_t` value `i` to determine whether it is a non-dependent elimination rule with a list of types and corresponding postcondition. It then uses the `compute_uncurry` function to compute the postcondition based on the types and the provided postcondition. If the `gen_elim_nondep_t` value is `GEDep`, it simply computes the postcondition using the `compute_gen_elim_post` function.", "The `compute_gen_elim_nondep_post` function calculates the postcondition for a non-dependent elimination rule in a generalized elimination structure.\n\nThe function takes a generalized elimination rule `i0`, a non-dependent type `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It returns a proposition representing the postcondition.", "The `compute_gen_elim_nondep_post` function takes a `gen_elim_i` value `i0`, a `gen_elim_nondep_t` value `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It computes and returns a value of type `prop`.\n\nStep 1: This function computes the postcondition of a non-dependent elimination rule in a generalized elimination structure.\n\nStep 2: The implementation first matches the `gen_elim_nondep_t` value `i` to determine the type of the elimination rule. Then, it uses the `compute_uncurry` function to compute the postcondition based on the type of the elimination rule and the ghost-erased value `x`.", "The `compute_gen_elim_nondep_post` function takes a `gen_elim_i` value `i0`, a `gen_elim_nondep_t` value `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It computes and returns a `prop`.\n\nThe function computes the post-condition of a non-dependent elimination rule, which is used in the context of generalized elimination rules.", "The `compute_gen_elim_nondep_post` function calculates the post-condition of a non-dependent elimination rule in a generic elimination structure.\n\nThe function takes a generic elimination rule `i0`, a non-dependent elimination type `i`, and a ghost-erased value `x` representing the argument to the non-dependent elimination type.", "The `compute_gen_elim_nondep_post` function takes a `gen_elim_i` value `i0`, a `gen_elim_nondep_t` value `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It computes and returns a value of type `prop`.\n\nStep 1: This function computes the post-condition of a non-dependent elimination rule in a generalized elimination structure.\n\nStep 2: The function implementation involves using pattern matching to handle the different cases of the `gen_elim_nondep_t` value `i` and then computing the post-condition based on the type information and the provided ghost-erased value `x`.", "The `compute_gen_elim_nondep_post` function calculates the post-condition of a non-dependent elimination rule in a generic elimination structure.\n\nThe function takes a generic elimination rule `i0`, a non-dependent elimination type `i`, and a ghost value `x` representing the non-dependent elimination argument.", "The `compute_gen_elim_nondep_post` function calculates the post-condition of a non-dependent elimination rule in a generic elimination structure.\n\nStep 1: This function takes a generic elimination rule `i0`, a non-dependent elimination type `i`, and a ghost value `x` representing the non-dependent elimination argument.\n\nStep 2: The function computes the post-condition based on the non-dependent elimination type and the ghost value `x`.", "The `compute_gen_elim_nondep_post` function takes a `gen_elim_i` value `i0`, a `gen_elim_nondep_t` value `i`, and a ghost-erased value `x` of type `compute_gen_elim_nondep_a i0 i`. It computes and returns a value of type `prop`.\n\nStep 1: This function computes the post-condition of a non-dependent elimination rule for a generalized elimination structure.\n\nStep 2: The function implementation will involve using pattern matching on the `gen_elim_nondep_t` value `i` to determine the type of the elimination rule. Then, it will use the `compute_uncurry` function to compute the post-condition based on the type of the elimination rule and the erased value `x`.", "The `compute_gen_elim_nondep_post` function calculates the post-condition of a non-dependent elimination rule in a generic elimination structure.\n\nStep 1: The `compute_gen_elim_nondep_post` function takes a generic elimination rule `i0`, a non-dependent elimination type `i`, and a ghost-erased value `x` as input.\n\nStep 2: The function implementation involves computing the post-condition based on the non-dependent elimination type and the provided ghost-erased value." ], "generated_solution": [ "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n match i with\n | GENonDep ty q post -> compute_uncurry prop True ty post (Ghost.reveal x)\n | GEDep -> compute_gen_elim_post i0", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n // Implementation goes here", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n match i with\n | GENonDep ty q post -> compute_uncurry prop True ty post x\n | GEDep -> compute_gen_elim_post i0", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop\n= compute_gen_elim_nondep_post0 i0 i (Ghost.reveal x)", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n // Implementation goes here", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n match i with\n | GENonDep ty _ post -> compute_uncurry prop True ty post (Ghost.reveal x)\n | GEDep -> compute_gen_elim_post i0", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n // Implementation goes here", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n compute_gen_elim_nondep_post0 i0 i (Ghost.reveal x)", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n match i with\n | GENonDep ty q post -> compute_uncurry prop True ty post x\n | GEDep -> compute_gen_elim_post i0", "let compute_gen_elim_nondep_post\n (i0: gen_elim_i)\n (i: gen_elim_nondep_t)\n (x: Ghost.erased (compute_gen_elim_nondep_a i0 i))\n: Tot prop =\n // Implementation goes here" ] }, { "file_name": "OPLSS2021.IFC.fst", "name": "OPLSS2021.IFC.memP_append_or", "opens_and_abbrevs": [ { "open": "FStar.Map" }, { "open": "FStar.Set" }, { "open": "FStar.List.Tot" }, { "open": "OPLSS2021" }, { "open": "OPLSS2021" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "source_definition": "let rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "source_range": { "start_line": 233, "start_col": 0, "end_line": 239, "end_col": 37 }, "interleaved": false, "definition": "fun x l0 l1 ->\n (match l0 with\n | Prims.Nil #_ -> ()\n | Prims.Cons #_ _ tl -> OPLSS2021.IFC.memP_append_or x tl l1)\n <:\n FStar.Pervasives.Lemma\n (ensures\n FStar.List.Tot.Base.memP x (l0 @ l1) <==>\n FStar.List.Tot.Base.memP x l0 \\/ FStar.List.Tot.Base.memP x l1)", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma", "" ], "mutual_with": [], "premises": [ "Prims.list", "OPLSS2021.IFC.memP_append_or", "Prims.unit", "Prims.l_True", "Prims.squash", "Prims.l_iff", "FStar.List.Tot.Base.memP", "FStar.List.Tot.Base.op_At", "Prims.l_or", "Prims.Nil", "FStar.Pervasives.pattern" ], "proof_features": [ "recursion" ], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "x: a -> l0: Prims.list a -> l1: Prims.list a\n -> FStar.Pervasives.Lemma\n (ensures\n FStar.List.Tot.Base.memP x (l0 @ l1) <==>\n FStar.List.Tot.Base.memP x l0 \\/ FStar.List.Tot.Base.memP x l1) (decreases l0)", "prompt": "let rec memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0) =\n ", "expected_response": "match l0 with\n| [] -> ()\n| _ :: tl -> memP_append_or x tl l1", "source": { "project_name": "FStar", "file_name": "examples/oplss2021/OPLSS2021.IFC.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "OPLSS2021.IFC.fst", "checked_file": "dataset/OPLSS2021.IFC.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "let loc = int", "let store = m:Map.t loc int{forall l. contains m l}", "let sel (s:store) (l:loc) : int = Map.sel s l", "let upd (s:store) (l:loc) (x:int) : store = Map.upd s l x", "let label = Set.set loc", "let label_inclusion (l0 l1:label) = Set.subset l0 l1", "let bot : label = Set.empty", "let single (l:loc) : label = Set.singleton l", "let union (l0 l1:label) = Set.union l0 l1", "let comp a = store -> a & store", "let havoc s l x = upd s l x", "let writes_ok #a (f:comp a) (writes:Set.set loc) =\n forall (l:loc). ~(Set.mem l writes) ==>\n (forall (s0:store).\n let x1, s0' = f s0 in\n sel s0 l == sel s0' l)", "let does_not_read_loc_v #a (f:comp a) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in //s0 and s0' agree except on l\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in // run f twice, once on s0, once on s0'\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same in both runs\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))", "let does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v", "let reads_ok #a (f:comp a) (reads:label) =\n forall (l:loc) (s:store). ~(Set.mem l reads) ==> does_not_read_loc f l s", "let flow = label & label", "let flows = list flow", "let has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f", "let has_flow (from to:loc) (fs:flows) = exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs", "let no_leakage_k #a (f:comp a) (from to:loc) (k:int) =\n forall s0.{:pattern (havoc s0 from k)}\n sel (snd (f s0)) to == sel (snd (f (havoc s0 from k))) to", "let no_leakage #a (f:comp a) (from to:loc) = forall k. no_leakage_k f from to k", "let respects_flows #a (f:comp a) (fs:flows) =\n forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to", "let ist a (writes:label) (reads:label) (fs:flows) =\n f:comp a {\n reads_ok f reads /\\\n writes_ok f writes /\\\n respects_flows f fs\n }", "let iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s", "let iwrite (l:loc) (x:int) : ist unit (single l) bot [] = fun s -> (), upd s l x", "let return (a:Type) (x:a) : ist a bot bot [] = fun s -> x,s", "let add_source (r:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> union r r0, w0) fs", "let add_sink (w:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> r0, union w w0) fs", "let flows_included_in (fs0 fs1:flows) =\n forall f0. f0 `List.Tot.memP` fs0 ==>\n (forall from to. has_flow_1 from to f0 /\\ from <> to ==> (exists f1. f1 `List.Tot.memP` fs1 /\\ has_flow_1 from to f1))", "let flows_equiv (fs0 fs1:flows) = fs0 `flows_included_in` fs1 /\\ fs1 `flows_included_in` fs0", "let flows_equiv_refl fs\n : Lemma (fs `flows_equiv` fs)\n = ()", "let flows_equiv_trans fs0 fs1 fs2\n : Lemma (fs0 `flows_equiv` fs1 /\\ fs1 `flows_equiv` fs2 ==> fs0 `flows_equiv` fs2)\n = ()", "let flows_included_in_union_distr_dest (a b c:label)\n : Lemma (flows_equiv [a, union b c] [a, b; a, c])\n = ()", "let flows_included_in_union_distr_src (a b c:label)\n : Lemma (flows_equiv [union a b, c] [a, c; b, c])\n = ()", "let flows_included_in_union (a b c:label)\n : Lemma (flows_equiv ([a, union b c; union a b, c])\n ([a, b; union a b, c]))\n = ()", "let bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1", "let bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x l s0);\n assert (does_not_read_loc_v x l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()", "let bind_comp_writes_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (writes_ok (bind_comp x y) (union w0 w1))\n = ()" ], "closest": [ "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\nlet rec memP_append_or (#a:Type) (x:a) (l0 l1:list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==>\n (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n = match l0 with\n | [] -> ()\n | _::tl -> memP_append_or x tl l1", "val append_memP (#a: _) (x: a) (l0 l1: list a)\n : Lemma (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1))\nlet rec append_memP #a (x:a) (l0 l1:list a)\n : Lemma (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1))\n = match l0 with\n | [] -> ()\n | hd::tl -> append_memP x tl l1", "val append_memP (#a: Type) (l1 l2: list a) (x: a)\n : Lemma (L.memP x (l1 @ l2) <==> (L.memP x l1 \\/ L.memP x l2)) [SMTPat (L.memP x (l1 @ l2))]\nlet rec append_memP (#a:Type) (l1 l2:list a) (x:a)\n : Lemma (L.memP x (l1 @ l2) <==> (L.memP x l1 \\/ L.memP x l2))\n [SMTPat (L.memP x (l1 @ l2))] =\n match l1 with\n | [] -> ()\n | _::tl -> append_memP tl l2 x", "val memP_append (#a: _) (x: a) (l: list a)\n : Lemma\n (ensures\n (List.memP x l ==> (exists (l12: (list a * list a)). l == (fst l12) @ (x :: (snd l12)))))\nlet memP_append #a (x: a) (l: list a) :\n Lemma\n (ensures (List.memP x l ==>\n (exists (l12: (list a * list a)). l == (fst l12) @ (x :: (snd l12))))) =\n FStar.Classical.move_requires (memP_append_aux x) l", "val memP_append_aux (#a: _) (x: a) (l: list a)\n : Lemma (requires (List.memP x l))\n (ensures (exists (l12: (list a * list a)). l == fst l12 @ x :: snd l12))\nlet rec memP_append_aux #a (x: a) (l: list a) :\n Lemma\n (requires (List.memP x l))\n (ensures (exists (l12: (list a * list a)). l == fst l12 @ x :: snd l12))\n = let goal = exists l12. l == fst l12 @ x :: snd l12 in\n let x : squash goal =\n match l with\n | [] -> ()\n | h :: t ->\n let pf : squash (x == h \\/ List.memP x t) = () in\n p <-- FStar.Squash.join_squash pf ;\n match p with \n | Prims.Left x_eq_h -> \n let l12 = [], t in\n assert (l == (fst l12) @ (x :: snd l12)) //trigger\n | Prims.Right mem_x_t -> \n FStar.Classical.exists_elim \n goal\n (pure_as_squash (memP_append_aux x) t)\n (fun l12' -> \n let l12 = h::fst l12', snd l12' in\n assert (l == (fst l12) @ (x :: snd l12))) //trigger\n in\n FStar.Squash.give_proof x", "val append_memP: #t:Type -> l1:list t\n -> l2:list t\n -> a:t\n -> Lemma (requires True)\n (ensures (memP a (l1@l2) <==> (memP a l1 \\/ memP a l2)))\nlet rec append_memP #t l1 l2 a = match l1 with\n | [] -> ()\n | hd::tl -> append_memP tl l2 a", "val append_memP: #t:Type -> l1:list t\n -> l2:list t\n -> a:t\n -> Lemma (requires True)\n (ensures (memP a (l1 `append` l2) <==> (memP a l1 \\/ memP a l2)))\nlet rec append_memP #t l1 l2 a = match l1 with\n | [] -> ()\n | hd::tl -> append_memP tl l2 a", "val append_memP_forall: #a:Type -> l1:list a\n -> l2:list a\n -> Lemma (requires True)\n (ensures (forall a. memP a (l1 `append` l2) <==> (memP a l1 \\/ memP a l2)))\nlet rec append_memP_forall #a l1 l2 = match l1 with\n | [] -> ()\n | hd::tl -> append_memP_forall tl l2", "val list_mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (FStar.List.Tot.mem x l <==> FStar.List.Tot.memP x l)\nlet rec list_mem_memP (#a:eqtype) (x:a) (l:list a)\n: Lemma (FStar.List.Tot.mem x l <==> FStar.List.Tot.memP x l)\n= match l with\n | [] -> ()\n | hd::tl -> if hd = x then () else list_mem_memP x tl", "val mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (ensures (mem x l <==> memP x l)) [SMTPat (memP x l); SMTPat (mem x l)]\nlet mem_memP\n (#a: eqtype)\n (x: a)\n (l: list a)\n: Lemma (ensures (mem x l <==> memP x l))\n [SMTPat (memP x l); SMTPat (mem x l)]\n= FStar.List.Tot.Properties.mem_memP x l", "val mem_memP (#a: eqtype) (x: a) (l: list a)\n : Lemma (ensures (mem x l <==> memP x l)) [SMTPat (mem x l); SMTPat (memP x l)]\nlet rec mem_memP\n (#a: eqtype)\n (x: a)\n (l: list a)\n: Lemma (ensures (mem x l <==> memP x l))\n [SMTPat (mem x l); SMTPat (memP x l)]\n= match l with\n | [] -> ()\n | a :: q -> mem_memP x q", "val no_repeats_p_append_elim (#a: Type) (l1 l2: list a)\n : Lemma (requires (no_repeats_p (l1 `append` l2)))\n (ensures (no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x. memP x l1 ==> ~(memP x l2))))\n (decreases l1)\nlet rec no_repeats_p_append_elim\n (#a: Type)\n (l1 l2: list a)\n: Lemma\n (requires (no_repeats_p (l1 `append` l2)))\n (ensures (no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x . memP x l1 ==> ~ (memP x l2))))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | x :: q1 ->\n append_memP q1 l2 x;\n no_repeats_p_append_elim q1 l2", "val list_in_listP_append (#a:Type) (ls0 ls1 : list a) (x : a) :\n Lemma\n (requires (list_in_listP ls0 ls1))\n (ensures (list_in_listP ls0 (x::ls1)))\n (decreases ls0)\nlet rec list_in_listP_append #dt ls0 ls1 x =\n match ls0 with\n | [] -> ()\n | x0 :: ls0' ->\n list_in_listP_append ls0' ls1 x", "val memP_precedes (#a: Type) (x: a) (l: list a)\n : Lemma (requires True) (ensures (memP x l ==> x << l)) (decreases l)\nlet rec memP_precedes\n (#a: Type)\n (x: a)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP x l ==> x << l))\n (decreases l)\n= match l with\n | [] -> ()\n | y :: q ->\n FStar.Classical.or_elim\n #(x == y)\n #(memP x q)\n #(fun _ -> x << l)\n (fun _ -> ())\n (fun _ -> memP_precedes x q)", "val no_repeats_p_append_intro (#a: Type) (l1 l2: list a)\n : Lemma\n (requires (no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x. memP x l1 ==> ~(memP x l2))))\n (ensures (no_repeats_p (l1 `append` l2)))\n (decreases l1)\nlet rec no_repeats_p_append_intro\n (#a: Type)\n (l1 l2: list a)\n: Lemma\n (requires (no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x . memP x l1 ==> ~ (memP x l2))))\n (ensures (no_repeats_p (l1 `append` l2)))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | x :: q1 ->\n append_memP q1 l2 x;\n no_repeats_p_append_intro q1 l2", "val concatlemma (#a:Type) (l1 l2 :list a) (x:a) : Lemma (memP x (l1@l2) <==> memP x l1 \\/ memP x l2)\nlet rec concatlemma #a l1 l2 x =\n match l1 with\n | [] -> ()\n | h::t -> concatlemma t l2 x", "val memP_dec (#a: _) (x: a) (l: list a)\n : Lemma (requires L.memP x l) (ensures x << l) [SMTPat (L.memP x l)]\nlet rec memP_dec #a (x : a) (l : list a)\n : Lemma (requires L.memP x l)\n (ensures x << l)\n [SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_dec x ys", "val memP (#a: Type) (x: a) (l: list a) : Tot Type0\nlet rec memP (#a: Type) (x: a) (l: list a) : Tot Type0 =\n match l with\n | [] -> False\n | y :: q -> x == y \\/ memP x q", "val memP_allP0 (#a: _) (pred: (a -> Type)) (x: a) (l: list a)\n : Lemma (requires allP0 pred l /\\ L.memP x l)\n (ensures pred x)\n [SMTPat (allP0 pred l); SMTPat (L.memP x l)]\nlet rec memP_allP0 #a (pred : a -> Type) (x : a) (l : list a)\n : Lemma (requires allP0 pred l /\\ L.memP x l)\n (ensures pred x)\n [SMTPat (allP0 pred l); SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_allP0 pred x ys", "val assoc_append_elim_l (#a: eqtype) (#b: Type) (x: a) (l1 l2: list (a * b))\n : Lemma (requires (assoc x l1 == None))\n (ensures (assoc x (l1 @ l2) == assoc x l2))\n (decreases l1)\nlet rec assoc_append_elim_l\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l1 l2: list (a * b))\n: Lemma\n (requires (assoc x l1 == None))\n (ensures (assoc x (l1 @ l2) == assoc x l2))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | (x', _) :: q -> if x = x' then assert False else assoc_append_elim_l x q l2", "val assoc_append_elim_r (#a: eqtype) (#b: Type) (x: a) (l1 l2: list (a * b))\n : Lemma (requires (assoc x l2 == None \\/ ~(assoc x l1 == None)))\n (ensures (assoc x (l1 @ l2) == assoc x l1))\n (decreases l1)\nlet rec assoc_append_elim_r\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l1 l2: list (a * b))\n: Lemma\n (requires (assoc x l2 == None \\/ ~ (assoc x l1 == None)))\n (ensures (assoc x (l1 @ l2) == assoc x l1))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | (x', _) :: q -> if x = x' then () else assoc_append_elim_r x q l2", "val no_repeats_p_append (#a: Type) (l1 l2: list a)\n : Lemma\n (no_repeats_p (l1 `append` l2) <==>\n ((no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x. memP x l1 ==> ~(memP x l2)))))\nlet no_repeats_p_append\n (#a: Type)\n (l1 l2: list a)\n: Lemma\n (no_repeats_p (l1 `append` l2) <==> (\n (no_repeats_p l1 /\\ no_repeats_p l2 /\\ (forall x . memP x l1 ==> ~ (memP x l2)))\n ))\n= FStar.Classical.move_requires (no_repeats_p_append_intro l1) l2;\n FStar.Classical.move_requires (no_repeats_p_append_elim l1) l2", "val memP_map_intro (#a #b: Type) (f: (a -> Tot b)) (x: a) (l: list a)\n : Lemma (requires True) (ensures (memP x l ==> memP (f x) (map f l))) (decreases l)\nlet rec memP_map_intro\n (#a #b: Type)\n (f: a -> Tot b)\n (x: a)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP x l ==> memP (f x) (map f l)))\n (decreases l)\n= match l with\n | [] -> ()\n | _ :: q -> memP_map_intro f x q", "val memP_app_intro_l (#a x: _) (l1 l2: list a) : Lemma (memP x l1 ==> memP x (l1 @ l2))\nlet rec memP_app_intro_l #a x (l1 l2: list a) :\n Lemma (memP x l1 ==> memP x (l1 @ l2)) =\n match l1 with\n | [] -> ()\n | h :: t -> memP_app_intro_l x t l2", "val memP_list_in_listP_implies_memP (#a : Type) (x : a) (ls0 ls1 : list a) :\n Lemma\n (requires (\n memP x ls0 /\\\n list_in_listP ls0 ls1))\n (ensures (memP x ls1))\nlet rec memP_list_in_listP_implies_memP #a x ls0 ls1 =\n match ls0 with\n | [] -> ()\n | x' :: ls0' ->\n if FStar.IndefiniteDescription.strong_excluded_middle (x == x') then ()\n else memP_list_in_listP_implies_memP x ls0' ls1", "val memP_app_intro_r (#a x: _) (l1 l2: list a) : Lemma (memP x l2 ==> memP x (l1 @ l2))\nlet rec memP_app_intro_r #a x (l1 l2: list a) :\n Lemma (memP x l2 ==> memP x (l1 @ l2)) =\n match l1 with\n | [] -> ()\n | h :: t -> memP_app_intro_r x t l2", "val rev_memP : #a:Type -> l:list a -> x:a ->\n Lemma (requires True)\n (ensures (memP x (rev l) <==> memP x l))\nlet rev_memP #a l x = rev_acc_memP l [] x", "val append_mem: #t:eqtype -> l1:list t\n -> l2:list t\n -> a:t\n -> Lemma (requires True)\n (ensures (mem a (l1@l2) = (mem a l1 || mem a l2)))\nlet rec append_mem #t l1 l2 a = match l1 with\n | [] -> ()\n | hd::tl -> append_mem tl l2 a", "val assoc_memP_none (#a: eqtype) (#b: Type) (x: a) (l: list (a * b))\n : Lemma (requires (assoc x l == None)) (ensures (forall y. ~(memP (x, y) l))) (decreases l)\nlet rec assoc_memP_none\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l: list (a * b))\n: Lemma\n (requires (assoc x l == None))\n (ensures (forall y . ~ (memP (x, y) l)))\n (decreases l)\n= match l with\n | [] -> ()\n | (x', _) :: q -> if x = x' then assert False else assoc_memP_none x q", "val memP_map_elim (#a #b: Type) (f: (a -> Tot b)) (y: b) (l: list a)\n : Lemma (requires True)\n (ensures (memP y (map f l) ==> (exists (x: a). memP x l /\\ f x == y)))\n (decreases l)\nlet rec memP_map_elim\n (#a #b: Type)\n (f: a -> Tot b)\n (y: b)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (memP y (map f l) ==> (exists (x : a) . memP x l /\\ f x == y)))\n (decreases l)\n= match l with\n | [] -> ()\n | _ :: q -> memP_map_elim f y q", "val precedes_append_cons_r (#a: Type) (l1: list a) (x: a) (l2: list a)\n : Lemma (requires True) (ensures (x << append l1 (x :: l2))) [SMTPat (x << append l1 (x :: l2))]\nlet rec precedes_append_cons_r\n (#a: Type)\n (l1: list a)\n (x: a)\n (l2: list a)\n: Lemma\n (requires True)\n (ensures (x << append l1 (x :: l2)))\n [SMTPat (x << append l1 (x :: l2))]\n= match l1 with\n | [] -> ()\n | _ :: q -> precedes_append_cons_r q x l2", "val memP_concatMap_intro (#a #b: _) (x: a) (y: b) (f: (a -> list b)) (l: list a)\n : Lemma (List.memP x l ==> List.memP y (f x) ==> List.memP y (List.Tot.concatMap f l))\nlet memP_concatMap_intro #a #b (x: a) (y: b) (f:a -> list b) (l: list a) :\n Lemma (List.memP x l ==>\n List.memP y (f x) ==>\n List.memP y (List.Tot.concatMap f l)) =\n concatMap_flatten_map f l;\n memP_map_intro f x l;\n memP_flatten_intro y (f x) (List.Tot.map f l)", "val list_forallp_mem (#t: eqtype) (p: (t -> GTot Type0)) (l: list t)\n : Lemma (list_forallp p l <==> (forall x. L.mem x l ==> p x))\nlet rec list_forallp_mem (#t: eqtype) (p: t -> GTot Type0) (l: list t) : Lemma\n (list_forallp p l <==> (forall x . L.mem x l ==> p x))\n= match l with\n | [] -> ()\n | _ :: q -> list_forallp_mem p q", "val rev_acc_memP : #a:Type -> l:list a -> acc:list a -> x:a ->\n Lemma (requires True)\n (ensures (memP x (rev_acc l acc) <==> (memP x l \\/ memP x acc)))\nlet rec rev_acc_memP #a l acc x = match l with\n | [] -> ()\n | hd::tl -> rev_acc_memP tl (hd::acc) x", "val memP_flatten_intro (#a: _) (x: a) (l: list a) (ls: list (list a))\n : Lemma (List.memP x l ==> List.memP l ls ==> List.memP x (List.Tot.flatten ls))\nlet memP_flatten_intro #a (x: a) (l: list a) (ls: list (list a)) :\n Lemma (List.memP x l ==>\n List.memP l ls ==>\n List.memP x (List.Tot.flatten ls)) =\n FStar.Classical.arrow_to_impl\n #(List.memP x l)\n #(List.memP l ls ==>\n List.memP x (List.Tot.flatten ls))\n (fun memP_x_l_proof ->\n FStar.Classical.arrow_to_impl\n #(List.memP l ls)\n #(List.memP x (List.Tot.flatten ls))\n (fun memP_l_ls_proof ->\n memP_append x l;\n FStar.Squash.bind_squash\n (FStar.Squash.get_proof (List.memP x l ==>\n (exists l12. l == (fst l12) @ (x :: (snd l12)))))\n (fun memP_x_l_split ->\n let l_split_pr = FStar.Classical.impl_to_arrow\n #(List.memP x l)\n #(exists l12. l == (fst l12) @ (x :: (snd l12)))\n memP_x_l_split memP_x_l_proof in\n FStar.Classical.exists_elim\n (List.memP x (List.Tot.flatten ls))\n #_\n #(fun l12 -> l == (fst l12) @ (x :: (snd l12)))\n l_split_pr\n (fun l12 -> memP_append l ls;\n FStar.Squash.bind_squash\n (FStar.Squash.get_proof (List.memP l ls ==>\n (exists ls12. ls == (fst ls12) @ (l :: (snd ls12)))))\n (fun memP_l_ls_split ->\n let ls_split_pr = FStar.Classical.impl_to_arrow\n #(List.memP l ls)\n #(exists ls12. ls == (fst ls12) @ (l :: (snd ls12)))\n memP_l_ls_split memP_l_ls_proof in\n FStar.Classical.exists_elim\n (List.memP x (List.Tot.flatten ls))\n #_\n #(fun ls12 -> ls == (fst ls12) @ (l :: (snd ls12)))\n ls_split_pr\n (fun ls12 ->\n let (l1, l2) = l12 in\n let (ls1, ls2) = ls12 in\n flatten_app ls1 (l :: ls2);\n memP_app_intro_r x (flatten ls1) ((l1 @ x :: l2) @ flatten ls2);\n memP_app_intro_l x (l1 @ x :: l2) (flatten ls2);\n memP_app_intro_r x l1 (x :: l2)))))))", "val flatten_mem_lem (#a: _) (l: list (list a)) (x: a)\n : Lemma (memP x (flatten l) <==> (exists l0. memP l0 l /\\ memP x l0))\n [SMTPat (memP x (flatten l))]\nlet rec flatten_mem_lem #a (l : list (list a)) (x:a)\n : Lemma (memP x (flatten l) <==> (exists l0. memP l0 l /\\ memP x l0))\n [SMTPat (memP x (flatten l))]\n = match l with\n | [] -> ()\n | l1::ls -> (append_memP l1 (flatten ls) x; flatten_mem_lem ls x)", "val assoc_memP_some (#a: eqtype) (#b: Type) (x: a) (y: b) (l: list (a * b))\n : Lemma (requires (assoc x l == Some y)) (ensures (memP (x, y) l)) (decreases l)\nlet rec assoc_memP_some\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (y: b)\n (l: list (a * b))\n: Lemma\n (requires (assoc x l == Some y))\n (ensures (memP (x, y) l))\n (decreases l)\n= match l with\n | [] -> ()\n | (x', _) :: q -> if x = x' then () else assoc_memP_some x y q", "val lemma_mem_append : #a:eqtype -> s1:seq a -> s2:seq a\n -> Lemma (ensures (forall x. mem x (append s1 s2) <==> (mem x s1 || mem x s2)))\nlet lemma_mem_append #_ s1 s2 = lemma_append_count s1 s2", "val memP_existsb: #a: Type -> f:(a -> Tot bool) -> xs:list a ->\n Lemma(ensures (existsb f xs <==> (exists (x:a). (f x = true /\\ memP x xs))))\nlet rec memP_existsb #a f xs =\n match xs with\n | [] -> ()\n | hd::tl -> memP_existsb f tl", "val append_mem_forall: #a:eqtype -> l1:list a\n -> l2:list a\n -> Lemma (requires True)\n (ensures (forall a. mem a (l1@l2) = (mem a l1 || mem a l2)))\nlet rec append_mem_forall #a l1 l2 = match l1 with\n | [] -> ()\n | hd::tl -> append_mem_forall tl l2", "val no_repeats_p_append_swap (#a: Type) (l1 l2: list a)\n : Lemma (no_repeats_p (l1 `append` l2) <==> no_repeats_p (l2 `append` l1))\nlet no_repeats_p_append_swap\n (#a: Type)\n (l1 l2: list a)\n: Lemma\n (no_repeats_p (l1 `append` l2) <==> no_repeats_p (l2 `append` l1))\n= no_repeats_p_append l1 l2;\n no_repeats_p_append l2 l1", "val assoc_mem (#a: eqtype) (#b: Type) (x: a) (l: list (a * b))\n : Lemma (ensures (mem x (map fst l) <==> (exists y. assoc x l == Some y)))\nlet assoc_mem\n (#a: eqtype)\n (#b: Type)\n (x: a)\n (l: list (a * b))\n: Lemma\n (ensures (mem x (map fst l) <==> (exists y . assoc x l == Some y)))\n= match assoc x l with\n | None ->\n assoc_memP_none x l;\n mem_memP x (map fst l);\n memP_map_elim fst x l\n | Some y ->\n assoc_memP_some x y l;\n memP_map_intro fst (x, y) l;\n mem_memP x (map fst l)", "val memP_allP (#a #b: _) (top: b) (pred: (x: a{x << top} -> Type)) (x: a) (l: list a {l << top})\n : Lemma (requires allP top pred l /\\ L.memP x l)\n (ensures x << top /\\ pred x)\n [SMTPat (allP top pred l); SMTPat (L.memP x l)]\nlet rec memP_allP #a #b (top:b) (pred : (x:a{x << top}) -> Type) (x : a) (l : list a{l << top})\n : Lemma (requires allP top pred l /\\ L.memP x l)\n (ensures x << top /\\ pred x)\n [SMTPat (allP top pred l); SMTPat (L.memP x l)]\n = match l with\n | [] -> ()\n | y::ys ->\n if StrongExcludedMiddle.strong_excluded_middle (x == y) then () else memP_allP top pred x ys", "val my_append (#t: Type) (l1 l2: list t)\n : Pure (list t)\n (requires True)\n (ensures (fun res -> res == l1 `List.Tot.append` l2))\n (decreases l1)\nlet rec my_append (#t: Type) (l1 l2: list t) : Pure (list t)\n (requires True)\n (ensures (fun res -> res == l1 `List.Tot.append` l2))\n (decreases l1)\n= match l1 with\n | [] -> l2\n | a :: q -> a :: my_append q l2", "val splitAtFirstElem_append_lem (#a:eqtype) (x:a) (l:list a) :\n Lemma\n (requires True)\n (ensures (\n let l1, l2 = splitAtFirstElem x l in\n l = append l1 l2))\n (decreases l)\nlet rec splitAtFirstElem_append_lem #a x l =\n match l with\n | [] -> ()\n | x' :: l' -> splitAtFirstElem_append_lem x l'", "val noRepeats_append_elim (#a: eqtype) (l1 l2: list a)\n : Lemma (requires (noRepeats (l1 @ l2)))\n (ensures (noRepeats l1 /\\ noRepeats l2 /\\ (forall x. mem x l1 ==> ~(mem x l2))))\n (decreases l1)\nlet rec noRepeats_append_elim\n (#a: eqtype)\n (l1 l2: list a)\n: Lemma\n (requires (noRepeats (l1 @ l2)))\n (ensures (noRepeats l1 /\\ noRepeats l2 /\\ (forall x . mem x l1 ==> ~ (mem x l2))))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | x :: q1 ->\n append_mem q1 l2 x;\n noRepeats_append_elim q1 l2", "val _lemma_insertion_maintains_memP (l1 l2: list 'a) (x0 x1 x: 'a)\n : Lemma\n (requires\n ((x0 `L.memP` l1) /\\\n ((l2 == DLL._l_insert_before x0 l1 x1) \\/ (l2 == DLL._l_insert_after x0 l1 x1)) /\\\n (x `L.memP` l1 \\/ x == x1))) (ensures (x `L.memP` l2))\nlet rec _lemma_insertion_maintains_memP (l1 l2:list 'a) (x0 x1 x:'a) :\n Lemma\n (requires ((x0 `L.memP` l1) /\\\n ((l2 == DLL._l_insert_before x0 l1 x1) \\/\n (l2 == DLL._l_insert_after x0 l1 x1)) /\\\n (x `L.memP` l1 \\/ x == x1)))\n (ensures (x `L.memP` l2)) =\n match l1 with\n | [_] -> ()\n | x0' :: l1' ->\n FStar.Classical.or_elim #_ #_ #(fun () -> x `L.memP` l2)\n (fun (_:unit{x0' == x0 \\/ x0' == x}) -> ())\n (fun (_:unit{x0' =!= x0 /\\ x0' =!= x}) ->\n _lemma_insertion_maintains_memP l1' (L.tl l2) x0 x1 x)", "val list_sorted_append_elim (#t: Type) (order: (t -> t -> bool)) (l1 l2: list t)\n : Lemma (requires (List.Tot.sorted order (l1 `List.Tot.append` l2)))\n (ensures (List.Tot.sorted order l1 /\\ List.Tot.sorted order l2))\n (decreases l1)\nlet rec list_sorted_append_elim\n (#t: Type)\n (order: t -> t -> bool)\n (l1 l2: list t)\n: Lemma\n (requires (List.Tot.sorted order (l1 `List.Tot.append` l2)))\n (ensures (\n List.Tot.sorted order l1 /\\\n List.Tot.sorted order l2\n ))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | [_] -> ()\n | a :: b :: q ->\n list_sorted_append_elim order (b :: q) l2", "val mem_cons\n (#a:eqtype)\n (x:a)\n (s:seq a)\n: Lemma\n (ensures (forall y. mem y (cons x s) <==> mem y s \\/ x=y))\nlet mem_cons #_ x s = lemma_append_count (create 1 x) s", "val noRepeats_append_intro (#a: eqtype) (l1 l2: list a)\n : Lemma (requires (noRepeats l1 /\\ noRepeats l2 /\\ (forall x. mem x l1 ==> ~(mem x l2))))\n (ensures (noRepeats (l1 @ l2)))\n (decreases l1)\nlet rec noRepeats_append_intro\n (#a: eqtype)\n (l1 l2: list a)\n: Lemma\n (requires (noRepeats l1 /\\ noRepeats l2 /\\ (forall x . mem x l1 ==> ~ (mem x l2))))\n (ensures (noRepeats (l1 @ l2)))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | x :: q1 ->\n append_mem q1 l2 x;\n noRepeats_append_intro q1 l2", "val list_memP_map_forall (#t1 #t2: Type) (f: (t1 -> t2)) (l: list t1)\n : Lemma\n (forall y. List.Tot.memP y (List.Tot.map f l) <==> (exists x. List.Tot.memP x l /\\ y == f x))\nlet list_memP_map_forall\n (#t1 #t2: Type)\n (f: t1 -> t2)\n (l: list t1)\n: Lemma\n (forall y . List.Tot.memP y (List.Tot.map f l) <==> (exists x . List.Tot.memP x l /\\ y == f x))\n= Classical.forall_intro (fun y -> List.Tot.memP_map_elim f y l);\n Classical.forall_intro (fun x -> List.Tot.memP_map_intro f x l)", "val concatmaplemma : (#a:Type) -> (#b:Type) -> l:list a -> (f:(a -> list b)) -> x:b ->\n Lemma (memP x (concatMap f l) <==> (exists a. memP a l /\\ memP x (f a)))\n [SMTPat (memP x (concatMap f l))]\nlet rec concatmaplemma #a #b l f x =\n match l with\n | [] -> ()\n | h::t ->\n concatlemma (f h) (concatMap f t) x;\n concatmaplemma t f x", "val for_all_mem (#a: Type) (f: (a -> Tot bool)) (l: list a)\n : Lemma (for_all f l <==> (forall x. memP x l ==> f x))\nlet rec for_all_mem\n (#a: Type)\n (f: (a -> Tot bool))\n (l: list a)\n: Lemma\n (for_all f l <==> (forall x . memP x l ==> f x))\n= match l with\n | [] -> ()\n | _ :: q -> for_all_mem f q", "val memP_at (l1 l2: ops) (l: op)\n : Lemma (memP l (l1 @ l2) <==> (memP l l1 \\/ memP l l2)) [SMTPat (memP l (l1 @ l2))]\nlet rec memP_at (l1 l2 : ops) (l : op)\n : Lemma (memP l (l1@l2) <==> (memP l l1 \\/ memP l l2))\n [SMTPat (memP l (l1@l2))]\n = match l1 with\n | [] -> ()\n | _::l1 -> memP_at l1 l2 l", "val mem_count (#a: eqtype) (l: list a) (x: a) : Lemma (mem x l <==> count x l > 0)\nlet rec mem_count\n (#a: eqtype)\n (l: list a)\n (x: a)\n: Lemma\n (mem x l <==> count x l > 0)\n= match l with\n | [] -> ()\n | x' :: l' -> mem_count l' x", "val list_sorted_order_elim\n (#t: Type)\n (order: (t -> t -> bool))\n (l0: list t)\n (a1: t)\n (l1: list t)\n (a2: t)\n (l2: list t)\n : Lemma\n (requires\n ((forall x y z. (order x y /\\ order y z) ==> order x z) /\\\n List.Tot.sorted order (l0 `List.Tot.append` (a1 :: (l1 `List.Tot.append` (a2 :: l2))))))\n (ensures (order a1 a2 == true))\n (decreases (List.Tot.length l0 + List.Tot.length l1))\nlet rec list_sorted_order_elim\n (#t: Type)\n (order: t -> t -> bool)\n (l0: list t)\n (a1: t)\n (l1: list t)\n (a2: t)\n (l2: list t)\n: Lemma\n (requires (\n (forall x y z . (order x y /\\ order y z) ==> order x z) /\\\n List.Tot.sorted order (l0 `List.Tot.append` (a1 :: (l1 `List.Tot.append` (a2 :: l2))))\n ))\n (ensures (order a1 a2 == true))\n (decreases (List.Tot.length l0 + List.Tot.length l1))\n= match l0 with\n | [] ->\n begin match l1 with\n | [] -> ()\n | a1' :: l1' ->\n list_sorted_order_elim order [] a1' l1' a2 l2 // and transitivity\n end\n | a0 :: l0' ->\n list_sorted_order_elim order l0' a1 l1 a2 l2", "val stable_append_l: #a:eqtype ->\n (l: list a) ->\n (r: list a) ->\n (r': list a) ->\n k:(a -> Tot int) ->\n Lemma (ensures (stable r r' k ==> stable (l@r) (l@r') k))\nlet rec stable_append_l #a l r r' k =\n match l with\n | [] -> ()\n | hd::tl -> stable_append_l tl r r' k", "val stable_append_r: #a:eqtype ->\n (l: list a) ->\n (l': list a) ->\n (r: list a) ->\n k:(a -> Tot int) ->\n Lemma (requires (stable l l' k))\n (ensures(stable (l@r) (l'@r) k))\nlet rec stable_append_r #a l l' r k =\n filter_eq_append l r k;\n filter_eq_append l' r k", "val precedes_append_cons_prod_r (#a #b: Type) (l1: list (a * b)) (x: a) (y: b) (l2: list (a * b))\n : Lemma (ensures x << (append l1 ((x, y) :: l2)) /\\ y << (append l1 ((x, y) :: l2)))\nlet precedes_append_cons_prod_r\n (#a #b: Type)\n (l1: list (a * b))\n (x: a)\n (y: b)\n (l2: list (a * b))\n: Lemma\n (ensures\n x << (append l1 ((x, y) :: l2)) /\\\n y << (append l1 ((x, y) :: l2)))\n= precedes_append_cons_r l1 (x, y) l2", "val fragment_append (#a: Type0) (pstart: ref (cell a)) (l1 l2: list (ref (cell a) & cell a))\n : Lemma\n (ensures\n (((fragment pstart l1) `star` (fragment (next_last pstart l1) l2))\n `equiv`\n (fragment pstart (l1 `L.append` l2)))) (decreases l1)\nlet rec fragment_append\n (#a: Type0)\n (pstart: ref (cell a))\n (l1: list (ref (cell a) & cell a))\n (l2: list (ref (cell a) & cell a))\n: Lemma\n (ensures ((\n fragment pstart l1 `star` fragment (next_last pstart l1) l2\n ) `equiv` (\n fragment pstart (l1 `L.append` l2)\n )))\n (decreases l1)\n= match l1 with\n | [] -> ()\n | (pa, a) :: q ->\n assert ((\n (pts_to pa (Ghost.hide a) `star` fragment a.next q `star` pure (pstart == pa)) `star` fragment (next_last pstart l1) l2\n ) `equiv` (\n pts_to pa (Ghost.hide a) `star` (fragment a.next q `star` fragment (next_last pstart l1) l2) `star` pure (pstart == pa)\n )) by canon ();\n fragment_append a.next q l2;\n assert ((\n pts_to pa a `star` (fragment a.next q `star` fragment (next_last pstart l1) l2) `star` pure (pstart == pa)\n ) `equiv` (\n (fragment a.next q `star` fragment (next_last pstart l1) l2) `star` (pts_to pa a `star` pure (pstart == pa))\n\n )) by canon ();\n star_congruence\n (fragment a.next q `star` fragment (next_last pstart l1) l2)\n (pts_to pa a `star` pure (pstart == pa))\n (fragment a.next (q `L.append` l2))\n (pts_to pa a `star` pure (pstart == pa));\n\n assert ((\n (fragment a.next (q `L.append` l2)) `star` (pts_to pa a `star` pure (pstart == pa))\n ) `equiv` (\n pts_to pa a `star` fragment a.next (q `L.append` l2) `star` pure (pstart == pa)\n )) by canon ()", "val lemma_append_last (#a: Type) (l1 l2: list a)\n : Lemma (requires (length l2 > 0)) (ensures (last (l1 @ l2) == last l2))\nlet rec lemma_append_last (#a:Type) (l1 l2:list a) :\n Lemma\n (requires (length l2 > 0))\n (ensures (last (l1 @ l2) == last l2)) =\n match l1 with\n | [] -> ()\n | _ :: l1' -> lemma_append_last l1' l2", "val lemma_unsnoc_append (#a: Type) (l1 l2: list a)\n : Lemma (requires (length l2 > 0))\n (ensures\n (let al, a = unsnoc (l1 @ l2) in\n let bl, b = unsnoc l2 in\n al == l1 @ bl /\\ a == b))\nlet rec lemma_unsnoc_append (#a:Type) (l1 l2:list a) :\n Lemma\n (requires (length l2 > 0)) // the [length l2 = 0] is trivial\n (ensures (\n let al, a = unsnoc (l1 @ l2) in\n let bl, b = unsnoc l2 in\n al == l1 @ bl /\\ a == b)) =\n match l1 with\n | [] -> ()\n | _ :: l1' -> lemma_unsnoc_append l1' l2", "val fold_left_invar (#a #b: Type) (f: (a -> b -> Tot a)) (l: list b) (p: (a -> Tot Type0))\n : Lemma (requires forall (x: a) (y: b). p x ==> memP y l ==> p (f x y))\n (ensures forall (x: a). p x ==> p (fold_left f x l))\nlet rec fold_left_invar\n (#a #b: Type)\n (f: (a -> b -> Tot a))\n (l: list b)\n (p: (a -> Tot Type0))\n : Lemma\n (requires forall (x: a) (y: b) . p x ==> memP y l ==> p (f x y) )\n (ensures forall (x: a) . p x ==> p (fold_left f x l))\n=\n match l with\n | [] -> ()\n | y :: q -> fold_left_invar f q p", "val partition_mem: #a:eqtype -> f:(a -> Tot bool)\n -> l:list a\n -> x:a\n -> Lemma (requires True)\n (ensures (let l1, l2 = partition f l in\n mem x l = (mem x l1 || mem x l2)))\nlet rec partition_mem #a f l x = match l with\n | [] -> ()\n | hd::tl -> partition_mem f tl x", "val append_injective (#a: _) (l0 l0' l1 l1': list a)\n : Lemma\n (ensures\n (length l0 == length l0' \\/ length l1 == length l1') /\\ append l0 l1 == append l0' l1' ==>\n l0 == l0' /\\ l1 == l1')\nlet append_injective #a (l0 l0':list a)\n (l1 l1':list a)\n : Lemma\n (ensures\n (length l0 == length l0' \\/ length l1 == length l1') /\\\n append l0 l1 == append l0' l1' ==>\n l0 == l0' /\\ l1 == l1')\n = introduce\n ((length l0 == length l0' \\/ length l1 == length l1') /\\\n append l0 l1 == append l0' l1')\n ==>\n (l0 == l0' /\\ l1 == l1')\n with _. eliminate (length l0 == length l0') \\/\n (length l1 == length l1')\n returns _\n with _. append_length_inv_head l0 l1 l0' l1'\n and _. append_length_inv_tail l0 l1 l0' l1'", "val mem_seq_of_list\n (#a: eqtype)\n (x: a)\n (l: list a)\n: Lemma\n (requires True)\n (ensures (mem x (seq_of_list l) == List.Tot.mem x l))\n [SMTPat (mem x (seq_of_list l))]\nlet rec mem_seq_of_list #_ x l\n= lemma_seq_of_list_induction l;\n match l with\n | [] -> ()\n | y :: q ->\n let _ : squash (head (seq_of_list l) == y) = () in\n let _ : squash (tail (seq_of_list l) == seq_of_list q) = seq_of_list_tl l in\n let _ : squash (mem x (seq_of_list l) == (x = y || mem x (seq_of_list q))) =\n lemma_mem_inversion (seq_of_list l)\n in\n mem_seq_of_list x q", "val list_append_rev_cons (#t: Type) (l1: list t) (x: t) (l2: list t)\n : Lemma (L.append (L.rev l1) (x :: l2) == L.append (L.rev (x :: l1)) l2)\nlet list_append_rev_cons (#t: Type) (l1: list t) (x: t) (l2: list t) : Lemma\n (L.append (L.rev l1) (x :: l2) == L.append (L.rev (x :: l1)) l2)\n= list_rev_cons x l1;\n L.append_assoc (L.rev l1) [x] l2", "val map_append (#a #b: Type) (f: (a -> Tot b)) (l1 l2: list a)\n : Lemma (ensures map f (l1 @ l2) == map f l1 @ map f l2)\nlet rec map_append\n (#a #b: Type)\n (f: a -> Tot b)\n (l1 l2: list a)\n:\n Lemma\n (ensures map f (l1 @ l2) == map f l1 @ map f l2)\n=\n match l1 with\n | [] -> ()\n | x :: q -> map_append f q l2", "val no_repeats_p_append_permut (#a: Type) (l1 l2 l3 l4 l5: list a)\n : Lemma\n ((no_repeats_p (l1 `append` (l2 `append` (l3 `append` (l4 `append` l5))))) <==>\n no_repeats_p (l1 `append` (l4 `append` (l3 `append` (l2 `append` l5)))))\nlet no_repeats_p_append_permut\n (#a: Type)\n (l1 l2 l3 l4 l5: list a)\n: Lemma\n ((no_repeats_p (l1 `append` (l2 `append` (l3 `append` (l4 `append` l5))))) <==> no_repeats_p (l1 `append` (l4 `append` (l3 `append` (l2 `append` l5)))))\n= no_repeats_p_append l1 (l2 `append` (l3 `append` (l4 `append` l5)));\n append_memP_forall l2 (l3 `append` (l4 `append` l5));\n append_memP_forall l3 (l4 `append` l5);\n append_memP_forall l4 l5;\n no_repeats_p_append l2 (l3 `append` (l4 `append` l5));\n no_repeats_p_append l3 (l4 `append` l5);\n no_repeats_p_append l4 l5;\n no_repeats_p_append l2 l5;\n no_repeats_p_append l3 (l2 `append` l5);\n append_memP_forall l2 l5;\n no_repeats_p_append l4 (l3 `append` (l2 `append` l5));\n append_memP_forall l3 (l2 `append` l5);\n no_repeats_p_append l1 (l4 `append` (l3 `append` (l2 `append` l5)));\n append_memP_forall l4 (l3 `append` (l2 `append` l5))", "val lemma_shift_append: #a:eqtype -> l:list a -> x:a -> m:list a -> Lemma\n (ensures ( (l@(x::m)) = ((l@[x])@m)))\nlet rec lemma_shift_append #a l x m = match l with\n | [] -> ()\n | hd::tl -> lemma_shift_append tl x m", "val if_in_append_but_not_first_of_either_then_in_append_tails (#a: Type) (x: a) (l1 l2: list a)\n : Lemma\n (requires\n contains_ubool x (list_append l1 l2) /\\\n (match l1, l2 with\n | hd1 :: tl1, hd2 :: tl2 -> neqb x hd1 /\\ neqb x hd2\n | _, _ -> False))\n (ensures\n (match l1, l2 with\n | hd1 :: tl1, hd2 :: tl2 -> contains_ubool x (list_append tl1 tl2)\n | _ -> False))\nlet if_in_append_but_not_first_of_either_then_in_append_tails\n (#a: Type)\n (x: a)\n (l1: list a)\n (l2: list a)\n : Lemma (requires contains_ubool x (list_append l1 l2)\n /\\ (match l1, l2 with\n | hd1 :: tl1, hd2 :: tl2 -> neqb x hd1 /\\ neqb x hd2\n | _, _ -> False))\n (ensures (match l1, l2 with\n | hd1 :: tl1, hd2 :: tl2 -> contains_ubool x (list_append tl1 tl2)\n | _ -> False)) =\n match l1, l2 with\n | hd1 :: tl1, hd2 :: tl2 ->\n contains_ubool_append x l1 l2;\n contains_ubool_append x tl1 tl2", "val rev_mem : #a:eqtype -> l:list a -> x:a ->\n Lemma (requires True)\n (ensures (mem x (rev l) <==> mem x l))\nlet rev_mem l x = rev_memP l x", "val lemma_reduce_append (#a:Type) (#b:Type) (b0:b) (f: a -> b -> b) (s: seq a) (x:a):\n Lemma (reduce b0 f (append1 s x) == f x (reduce b0 f s))\nlet lemma_reduce_append (#a:Type) (#b:Type) (b0:b) (f: a -> b -> b) (s: seq a) (x:a):\n Lemma (reduce b0 f (append1 s x) == f x (reduce b0 f s)) =\n lemma_prefix_append s (create 1 x)", "val init_last_def (#a: Type) (l: list a) (x: a)\n : Lemma\n (let l' = append l [x] in\n init l' == l /\\ last l' == x)\nlet rec init_last_def (#a: Type) (l: list a) (x: a) : Lemma\n (let l' = append l [x] in\n init l' == l /\\ last l' == x)\n= match l with\n | [] -> ()\n | y :: q -> init_last_def q x", "val memP_gfilter :\n #a: Type\n -> f: (a -> GTot bool)\n -> x: a\n -> l: list a ->\n Lemma (requires (memP x l /\\ f x))\n (ensures (memP x (gfilter f l)))\nlet rec memP_gfilter #a f x l =\n match l with\n | [] -> ()\n | hd::tl ->\n if FStar.IndefiniteDescription.strong_excluded_middle (x == hd) then ()\n else memP_gfilter f x tl", "val lemma_split_using (#t: Type) (l: list t) (x: t{x `memP` l})\n : Lemma\n (ensures\n (let l1, l2 = split_using l x in\n length l2 > 0 /\\ ~(x `memP` l1) /\\ hd l2 == x /\\ append l1 l2 == l))\nlet rec lemma_split_using (#t:Type) (l:list t) (x:t{x `memP` l}) :\n Lemma\n (ensures (\n let l1, l2 = split_using l x in\n length l2 > 0 /\\\n ~(x `memP` l1) /\\\n hd l2 == x /\\\n append l1 l2 == l)) =\n match l with\n | [_] -> ()\n | a :: rest ->\n let goal =\n let l1, l2 = split_using l x in\n length l2 > 0 /\\\n ~(x `memP` l1) /\\\n hd l2 == x /\\\n append l1 l2 == l\n in\n FStar.Classical.or_elim\n #_ #_\n #(fun () -> goal)\n (fun (_:squash (a == x)) -> ())\n (fun (_:squash (x `memP` rest)) -> lemma_split_using rest x)", "val fold_left_append (#a #b: Type) (f: (a -> b -> Tot a)) (l1 l2: list b)\n : Lemma (ensures forall x. fold_left f x (l1 @ l2) == fold_left f (fold_left f x l1) l2)\nlet rec fold_left_append\n (#a #b: Type)\n (f: a -> b -> Tot a)\n (l1 l2: list b)\n : Lemma\n (ensures forall x . fold_left f x (l1 @ l2) == fold_left f (fold_left f x l1) l2)\n= match l1 with\n | [] -> ()\n | x :: q -> fold_left_append f q l2", "val contains_ubool_append (#a: Type) (x: a) (l1 l2: list a)\n : Lemma\n (ensures contains_ubool x l1 \\/ contains_ubool x l2 <==> contains_ubool x (append l1 l2))\nlet rec contains_ubool_append (#a: Type) (x: a) (l1: list a) (l2: list a)\n : Lemma (ensures contains_ubool x l1 \\/ contains_ubool x l2 <==> contains_ubool x (append l1 l2)) =\n match l1 with\n | [] -> ()\n | hd :: tl -> if eqb x hd then () else contains_ubool_append x tl l2", "val no_repeats_p_false_intro (#a: Type) (l1 l l2 l3: list a)\n : Lemma (requires (Cons? l))\n (ensures (~(no_repeats_p (l1 `append` (l `append` (l2 `append` (l `append` l3)))))))\nlet no_repeats_p_false_intro\n (#a: Type)\n (l1 l l2 l3: list a)\n: Lemma\n (requires (Cons? l))\n (ensures (~ (no_repeats_p (l1 `append` (l `append` (l2 `append` (l `append` l3)))))))\n= let x = hd l in\n assert (memP x l);\n no_repeats_p_append l1 (l `append` (l2 `append` (l `append` l3)));\n no_repeats_p_append l (l2 `append` (l `append` l3));\n append_memP l2 (l `append` l3) x;\n append_memP l l3 x", "val append_assoc_singleton (l1 l2: list 'a) (x: 'a)\n : Lemma (ensures l1 @ (x :: l2) == (l1 @ [x]) @ l2) [SMTPat (l1 @ (x :: l2))]\nlet append_assoc_singleton (l1 l2:list 'a) (x:'a) \n: Lemma \n (ensures l1@(x::l2) == (l1 @ [x])@l2)\n [SMTPat (l1@(x::l2))]\n= List.Tot.Properties.append_assoc l1 [x] l2", "val partition_mem_p_forall: #a:eqtype -> p:(a -> Tot bool)\n -> l:list a\n -> Lemma (requires True)\n (ensures (let l1, l2 = partition p l in\n (forall x. mem x l1 ==> p x) /\\ (forall x. mem x l2 ==> not (p x))))\nlet rec partition_mem_p_forall #a p l = match l with\n | [] -> ()\n | hd::tl -> partition_mem_p_forall p tl", "val big_or'_exists (#a: Type) (f: (a -> Type)) (l: list a)\n : Lemma (big_or' f l <==> (exists x. L.memP x l /\\ f x))\nlet rec big_or'_exists (#a:Type) (f:a -> Type) (l:list a)\n = match l with\n | [] -> big_or'_nil f; ()\n | hd::tl -> big_or'_cons f hd tl; big_or'_exists f tl", "val unref (#a #p: _) (l: list (v: a{p v})) : l: (list a){forall x. memP x l ==> p x}\nlet rec unref #a #p (l : list (v:a{p v})) : l:(list a){forall x. memP x l ==> p x} =\n match l with\n | [] -> []\n | x :: xs -> x :: unref xs", "val pairwise_or'_exists (#a: Type) (f: (a -> a -> Type)) (l: list a)\n : Lemma (requires symmetric f /\\ anti_reflexive f)\n (ensures (pairwise_or' f l <==> (exists x y. L.memP x l /\\ L.memP y l /\\ f x y)))\nlet rec pairwise_or'_exists (#a:Type) (f: a -> a -> Type) (l:list a)\n = match l with\n | [] -> pairwise_or'_nil f\n | hd::tl ->\n pairwise_or'_cons f hd tl;\n pairwise_or'_exists f tl;\n big_or'_exists (f hd) tl", "val list_length_append (#t: Type) (l1 l2: list t)\n : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2)\nlet list_length_append (#t: Type) (l1 l2: list t) : Lemma (L.length (l1 `L.append` l2) == L.length l1 + L.length l2) = L.append_length l1 l2", "val append_nil_r (#a: _) (l: list a) : Lemma (l @ [] == l)\nlet rec append_nil_r #a (l:list a)\n : Lemma (l @ [] == l)\n = match l with\n | [] -> ()\n | _::tl -> append_nil_r tl", "val append_nil_r (#a: _) (l: list a) : Lemma (l @ [] == l)\nlet rec append_nil_r #a (l:list a)\n : Lemma (l @ [] == l)\n = match l with\n | [] -> ()\n | _::tl -> append_nil_r tl", "val append_init_last (#a: Type) (l: list a {Cons? l}) : Lemma (l == append (init l) [last l])\nlet rec append_init_last (#a: Type) (l: list a { Cons? l }) : Lemma\n (l == append (init l) [last l])\n= match l with\n | a :: q ->\n if Cons? q\n then\n append_init_last q\n else\n ()", "val _lemma_append_contains (h0: HS.mem) (l1 l2: list (node 'a))\n : Lemma\n (ensures\n ((DLL.nodelist_contained h0 (l1 `L.append` l2)) <==>\n (DLL.nodelist_contained h0 l1 /\\ DLL.nodelist_contained h0 l2)))\nlet rec _lemma_append_contains (h0:HS.mem) (l1 l2:list (node 'a)) :\n Lemma\n (ensures (\n (DLL.nodelist_contained h0 (l1 `L.append` l2)) <==>\n (DLL.nodelist_contained h0 l1 /\\ DLL.nodelist_contained h0 l2))) =\n match l1 with\n | [] -> ()\n | h :: t -> _lemma_append_contains h0 t l2", "val mem_implies_f (#a #f: _) (s: ordset a f) (x: a)\n : Lemma (requires mem x s) (ensures f (Cons?.hd s) x)\nlet mem_implies_f #a #f (s: ordset a f) (x:a)\n : Lemma (requires mem x s) (ensures f (Cons?.hd s) x) \n = simple_induction (fun s -> mem x s ==> f (head s) x) s", "val list_flatten_map_append\n (#a #b: Type)\n (f: a -> Tot (list b))\n (l1 l2: list a)\n: Lemma\n (L.flatten (L.map f (l1 `L.append` l2)) == L.flatten (L.map f l1) `L.append` L.flatten (L.map f l2))\nlet list_flatten_map_append\n (#a #b: Type)\n (f: a -> Tot (list b))\n (l1 l2: list a)\n: Lemma\n (L.flatten (L.map f (l1 `L.append` l2)) == L.flatten (L.map f l1) `L.append` L.flatten (L.map f l2))\n= L.map_append f l1 l2;\n list_flatten_append (L.map f l1) (L.map f l2)", "val lemma_index_memP (#t: Type) (l: list t) (i: nat{i < length l})\n : Lemma (ensures ((index l i) `memP` l)) [SMTPat ((index l i) `memP` l)]\nlet rec lemma_index_memP (#t:Type) (l:list t) (i:nat{i < length l}) :\n Lemma\n (ensures (index l i `memP` l))\n [SMTPat (index l i `memP` l)] =\n match i with\n | 0 -> ()\n | _ -> lemma_index_memP (tl l) (i - 1)", "val strict_suffix_of_or_eq_exists_append (#a: Type) (l1 l2: list a)\n : Lemma (ensures ((strict_suffix_of l1 l2 \\/ l1 == l2) ==> (exists l3. l2 == append l3 l1)))\nlet strict_suffix_of_or_eq_exists_append\n (#a: Type)\n (l1 l2: list a)\n: Lemma\n (ensures ((strict_suffix_of l1 l2 \\/ l1 == l2) ==> (exists l3 . l2 == append l3 l1)))\n= FStar.Classical.or_elim\n #(strict_suffix_of l1 l2)\n #(l1 == l2)\n #(fun _ -> exists l3 . l2 == append l3 l1)\n (fun _ ->\n strict_suffix_of_exists_append l1 l2)\n (fun _ ->\n FStar.Classical.exists_intro\n (fun l3 -> l2 == append l3 l1)\n [] )", "val strict_suffix_of_nil (#a: Type) (x: a) (l: list a)\n : Lemma (requires True) (ensures (strict_suffix_of [] (x :: l))) (decreases l)\nlet rec strict_suffix_of_nil (#a: Type) (x: a) (l: list a)\n: Lemma\n (requires True)\n (ensures (strict_suffix_of [] (x::l)))\n (decreases l)\n= match l with\n | [] -> ()\n | a' :: q -> strict_suffix_of_nil a' q", "val append_l_cons: hd:'a -> tl:list 'a -> l:list 'a ->\n Lemma (requires True)\n (ensures ((l@(hd::tl)) == ((l@[hd])@tl)))\nlet rec append_l_cons hd tl l = match l with\n | [] -> ()\n | hd'::tl' -> append_l_cons hd tl tl'", "val mem_count: #a:eqtype -> x:a -> l:list a ->\n Lemma (requires True)\n\t(ensures (mem x l = (count x l > 0)))\n\t(decreases l)\n [SMTPat (mem x l)]\nlet rec mem_count #a x = function\n | [] -> ()\n | _::tl -> mem_count x tl", "val mem (#a: eqtype) (x: a) (l: seq a) : Tot bool\nlet mem (#a:eqtype) (x:a) (l:seq a) : Tot bool = count x l > 0", "val last_cons (#a: Type) (x: a) (l: list a)\n : Lemma (requires Cons? l) (ensures L.last (x :: l) == L.last l) [SMTPat (L.last (x :: l))]\nlet rec last_cons (#a:Type) (x:a) (l:list a)\n : Lemma\n (requires Cons? l)\n (ensures L.last (x::l) == L.last l)\n [SMTPat (L.last (x::l))] =\n\n match l with\n | [_] -> ()\n | _::tl -> last_cons x tl", "val list_sorted_append_chunk_elim (#t: Type) (order: (t -> t -> bool)) (l1 l2 l3: list t)\n : Lemma\n (requires\n ((forall x y z. (order x y /\\ order y z) ==> order x z) /\\\n List.Tot.sorted order (l1 `List.Tot.append` (l2 `List.Tot.append` l3))))\n (ensures (List.Tot.sorted order (l1 `List.Tot.append` l3)))\n (decreases l1)\nlet rec list_sorted_append_chunk_elim\n (#t: Type)\n (order: t -> t -> bool)\n (l1 l2 l3: list t)\n: Lemma\n (requires (\n (forall x y z . (order x y /\\ order y z) ==> order x z) /\\\n List.Tot.sorted order (l1 `List.Tot.append` (l2 `List.Tot.append` l3))\n ))\n (ensures (\n List.Tot.sorted order (l1 `List.Tot.append` l3)\n ))\n (decreases l1)\n= match l1 with\n | [] -> list_sorted_append_elim order l2 l3\n | [a] ->\n begin match l3 with\n | [] -> ()\n | b :: q ->\n list_sorted_append_elim order l2 l3;\n list_sorted_order_elim order [] a l2 b q\n end\n | _ :: l1' -> list_sorted_append_chunk_elim order l1' l2 l3" ], "closest_src": [ { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.memP_append_or" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.memP_append_or" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.append_memP" }, { "project_name": "steel", "file_name": "Pulse.Typing.Env.fst", "name": "Pulse.Typing.Env.append_memP" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_append" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_append_aux" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.append_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_memP_forall" }, { "project_name": "dice-star", "file_name": "ASN1.Spec.Value.OID.fst", "name": "ASN1.Spec.Value.OID.list_mem_memP" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.mem_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.mem_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_append_elim" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.list_in_listP_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_precedes" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_append_intro" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.concatlemma" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_dec" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.memP" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_allP0" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_append_elim_l" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_append_elim_r" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_map_intro" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_app_intro_l" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.memP_list_in_listP_implies_memP" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_app_intro_r" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.rev_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_mem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_memP_none" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_map_elim" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.precedes_append_cons_r" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_concatMap_intro" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Enum.fst", "name": "LowParse.Spec.Enum.list_forallp_mem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.rev_acc_memP" }, { "project_name": "FStar", "file_name": "BinaryTreesEnumeration.fsti", "name": "BinaryTreesEnumeration.memP_flatten_intro" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.flatten_mem_lem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_memP_some" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.lemma_mem_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.memP_existsb" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_mem_forall" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_append_swap" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.assoc_mem" }, { "project_name": "FStar", "file_name": "FStar.Reflection.V2.TermEq.fst", "name": "FStar.Reflection.V2.TermEq.memP_allP" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fsti", "name": "Steel.Effect.Common.my_append" }, { "project_name": "noise-star", "file_name": "Spec.Noise.API.State.Definitions.fst", "name": "Spec.Noise.API.State.Definitions.splitAtFirstElem_append_lem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.noRepeats_append_elim" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fst", "name": "DoublyLinkedListIface._lemma_insertion_maintains_memP" }, { "project_name": "steel", "file_name": "CBOR.Spec.Map.fst", "name": "CBOR.Spec.Map.list_sorted_append_elim" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.mem_cons" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.noRepeats_append_intro" }, { "project_name": "steel", "file_name": "CBOR.Spec.Map.fst", "name": "CBOR.Spec.Map.list_memP_map_forall" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.concatmaplemma" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Base.fst", "name": "FStar.List.Tot.Base.for_all_mem" }, { "project_name": "FStar", "file_name": "Alg.fst", "name": "Alg.memP_at" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.mem_count" }, { "project_name": "steel", "file_name": "CBOR.Spec.Map.fst", "name": "CBOR.Spec.Map.list_sorted_order_elim" }, { "project_name": "FStar", "file_name": "GenericStability.fst", "name": "GenericStability.stable_append_l" }, { "project_name": "FStar", "file_name": "GenericStability.fst", "name": "GenericStability.stable_append_r" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.precedes_append_cons_prod_r" }, { "project_name": "steel", "file_name": "Queue.fst", "name": "Queue.fragment_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.lemma_append_last" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.lemma_unsnoc_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.fold_left_invar" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.partition_mem" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_injective" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fst", "name": "FStar.Seq.Properties.mem_seq_of_list" }, { "project_name": "everparse", "file_name": "LowParse.Spec.Enum.fst", "name": "LowParse.Spec.Enum.list_append_rev_cons" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.map_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_append_permut" }, { "project_name": "FStar", "file_name": "Unification.fst", "name": "Unification.lemma_shift_append" }, { "project_name": "Armada", "file_name": "Strategies.VarIntro.Initialization.fst", "name": "Strategies.VarIntro.Initialization.if_in_append_but_not_first_of_either_then_in_append_tails" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.rev_mem" }, { "project_name": "zeta", "file_name": "Zeta.SeqAux.fst", "name": "Zeta.SeqAux.lemma_reduce_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.init_last_def" }, { "project_name": "noise-star", "file_name": "Spec.Noise.Map.fst", "name": "Spec.Noise.Map.memP_gfilter" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.lemma_split_using" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.fold_left_append" }, { "project_name": "Armada", "file_name": "Util.List.fst", "name": "Util.List.contains_ubool_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.no_repeats_p_false_intro" }, { "project_name": "steel", "file_name": "Pulse.Lib.LinkedList.fst", "name": "Pulse.Lib.LinkedList.append_assoc_singleton" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.partition_mem_p_forall" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.big_or'_exists" }, { "project_name": "FStar", "file_name": "ND.fst", "name": "ND.unref" }, { "project_name": "FStar", "file_name": "FStar.BigOps.fst", "name": "FStar.BigOps.pairwise_or'_exists" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.list_length_append" }, { "project_name": "FStar", "file_name": "Sec2.IFC.fst", "name": "Sec2.IFC.append_nil_r" }, { "project_name": "FStar", "file_name": "Sec2.HIFC.fst", "name": "Sec2.HIFC.append_nil_r" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_init_last" }, { "project_name": "FStar", "file_name": "DoublyLinkedListIface.fst", "name": "DoublyLinkedListIface._lemma_append_contains" }, { "project_name": "FStar", "file_name": "FStar.OrdSet.fst", "name": "FStar.OrdSet.mem_implies_f" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fst", "name": "LowParse.Low.Base.Spec.list_flatten_map_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.lemma_index_memP" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.strict_suffix_of_or_eq_exists_append" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.strict_suffix_of_nil" }, { "project_name": "FStar", "file_name": "FStar.List.Tot.Properties.fst", "name": "FStar.List.Tot.Properties.append_l_cons" }, { "project_name": "FStar", "file_name": "QuickSort.List.fst", "name": "QuickSort.List.mem_count" }, { "project_name": "FStar", "file_name": "FStar.Seq.Properties.fsti", "name": "FStar.Seq.Properties.mem" }, { "project_name": "FStar", "file_name": "BinomialQueue.fst", "name": "BinomialQueue.last_cons" }, { "project_name": "steel", "file_name": "CBOR.Spec.Map.fst", "name": "CBOR.Spec.Map.list_sorted_append_chunk_elim" } ], "selected_premises": [ "OPLSS2021.IFC.sel", "OPLSS2021.IFC.upd", "OPLSS2021.IFC.flows", "OPLSS2021.IFC.single", "FStar.Pervasives.Native.fst", "OPLSS2021.IFC.flow", "OPLSS2021.IFC.label", "FStar.Pervasives.Native.snd", "OPLSS2021.IFC.has_flow", "OPLSS2021.IFC.iread", "OPLSS2021.IFC.iwrite", "OPLSS2021.IFC.ist", "OPLSS2021.IFC.flows_equiv", "OPLSS2021.IFC.bot", "OPLSS2021.IFC.return", "OPLSS2021.IFC.does_not_read_loc_v", "OPLSS2021.IFC.union", "OPLSS2021.IFC.writes_ok", "OPLSS2021.IFC.flows_included_in", "OPLSS2021.IFC.has_flow_1", "OPLSS2021.IFC.add_source", "OPLSS2021.IFC.respects_flows", "OPLSS2021.IFC.label_inclusion", "OPLSS2021.IFC.no_leakage_k", "OPLSS2021.IFC.no_leakage", "OPLSS2021.IFC.loc", "OPLSS2021.IFC.does_not_read_loc", "FStar.Pervasives.dfst", "OPLSS2021.IFC.havoc", "OPLSS2021.IFC.reads_ok", "OPLSS2021.IFC.add_sink", "FStar.Pervasives.dsnd", "OPLSS2021.IFC.comp", "FStar.Set.as_set'", "FStar.Preorder.preorder_rel", "FStar.Set.as_set", "OPLSS2021.IFC.bind_comp", "FStar.Calc.calc_chain_related", "FStar.Pervasives.reveal_opaque", "OPLSS2021.IFC.bind_comp_reads_ok", "FStar.Pervasives.st_post_h", "FStar.Map.const_on", "FStar.Calc.calc_chain_compatible", "FStar.Preorder.stable", "OPLSS2021.IFC.store", "Prims.abs", "FStar.Pervasives.id", "FStar.Set.subset", "FStar.Pervasives.st_stronger", "FStar.Preorder.reflexive", "Prims.min", "FStar.Pervasives.st_post_h'", "FStar.Pervasives.ex_pre", "FStar.Map.has_dom", "FStar.Pervasives.all_post_h'", "FStar.Map.disjoint_dom", "FStar.Pervasives.ex_post'", "FStar.Pervasives.st_pre_h", "FStar.Preorder.transitive", "FStar.Pervasives.all_pre_h", "FStar.Pervasives.all_post_h", "FStar.Pervasives.ex_post", "FStar.Pervasives.st_trivial", "FStar.Set.add", "FStar.Pervasives.trivial_pure_post", "Prims.pure_post'", "Prims.pow2", "FStar.Pervasives.pure_close_wp", "Prims.pure_wp", "FStar.Pervasives.st_return", "FStar.Pervasives.pure_ite_wp", "FStar.Pervasives.st_ite_wp", "FStar.Pervasives.all_return", "FStar.Pervasives.st_wp_h", "FStar.Pervasives.all_bind_wp", "FStar.Pervasives.pure_bind_wp", "Prims.__cache_version_number__", "FStar.Pervasives.div_hoare_to_wp", "FStar.Pervasives.st_if_then_else", "FStar.Pervasives.all_stronger", "FStar.Pervasives.ex_stronger", "FStar.Pervasives.all_trivial", "Prims.subtype_of", "Prims.pure_wp_monotonic0", "FStar.Pervasives.pure_null_wp", "FStar.Pervasives.st_bind_wp", "FStar.Pervasives.all_close_wp", "FStar.Pervasives.ex_bind_wp", "FStar.Pervasives.st_close_wp", "Prims.pure_post", "FStar.Pervasives.ex_wp", "Prims.pure_wp_monotonic", "Prims.pure_trivial", "Prims.purewp_id", "FStar.Pervasives.ex_if_then_else", "FStar.Pervasives.all_if_then_else", "Prims.as_requires", "Prims.pure_wp'", "FStar.Pervasives.all_ite_wp", "FStar.Pervasives.pure_return" ], "source_upto_this": "(*\n Copyright 2021 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule OPLSS2021.IFC\nopen FStar.List.Tot\nopen FStar.Set\nopen FStar.Map\n\n(* This module defines another abstraction for reasoning about\n information flows in stateful computations reading and writing to\n an integer store.\n\n The main computation type it defines at the end is `IST a w r fs`,\n where\n - `a` is the result type\n - `w` is the set of memory locations written\n - `r` is the set of memory locations read\n - `fs` is a set of flows, ordered pairs of sets of locations\n between bounding the information flows in the program\n\n The point is to illustrate that you can choose whatever abstraction\n you like to reason about your programs, not necessarily a Hoare\n logic.\n\n This turns out to be an instance of Katsumata's graded monads.\n\n Read more about it in this paper:\n https://www.fstar-lang.org/papers/layeredeffects/\n*)\n\n/// The type of memory locations\nlet loc = int\n\n/// A store itself is a total map from locations to integers\nlet store = m:Map.t loc int{forall l. contains m l}\n\n/// Two functions to read and write the store\nlet sel (s:store) (l:loc) : int = Map.sel s l\nlet upd (s:store) (l:loc) (x:int) : store = Map.upd s l x\n\n/// Our abstraction to reason about information flows is based on\n/// labels, sets of memory locations\nlet label = Set.set loc\n\n/// An ordering on labels, just set inclusion\nlet label_inclusion (l0 l1:label) = Set.subset l0 l1\n\n/// A bottom for the label lattice\nlet bot : label = Set.empty\n\n/// A singleton label\nlet single (l:loc) : label = Set.singleton l\n\n/// A join for our lattice: just set union\nlet union (l0 l1:label) = Set.union l0 l1\n\n/// comp a: A computation monad representing our stateful computations\nlet comp a = store -> a & store\n\n/// havoc, or mess up, a single memory location in s by updating it\nlet havoc s l x = upd s l x\n\n/// Now, we're going to have to (slowly) define what it means for a\n/// program to have or not have certain kinds of information flows.\n\n/// Defining what it means for f's mutations to be confined to\n/// `writes` is easy\n/// -- all locations not in writes do not change\nlet writes_ok #a (f:comp a) (writes:Set.set loc) =\n forall (l:loc). ~(Set.mem l writes) ==>\n (forall (s0:store).\n let x1, s0' = f s0 in\n sel s0 l == sel s0' l)\n\n/// Definiting what it means for `f` to not read a location `l`\n/// is trickier. It involves a \"relational\" property, relating\n/// multiple executions of `f`\nlet does_not_read_loc_v #a (f:comp a) (l:loc) (s0:store) v =\n let s0' = havoc s0 l v in //s0 and s0' agree except on l\n let x1, s1 = f s0 in\n let x1', s1' = f s0' in // run f twice, once on s0, once on s0'\n x1 == x1' /\\ //result does not depend on l\n (forall l'. l' <> l ==> //for every location l' not equal to l\n sel s1 l' == sel s1' l') /\\ //its value in the two states is the same\n (sel s1 l == sel s1' l \\/ //and l is itself may be written, in which case its value is the same in both final states\n //or its not, but then its values in the initial and final states are the same in both runs\n (sel s1 l == sel s0 l /\\\n sel s1' l == sel s0' l))\n\n/// does_not_read_loc: Lifting the prior property to all values for\n/// the havoc'd location l\nlet does_not_read_loc #a (f:comp a) (l:loc) (s0:store) =\n forall v. does_not_read_loc_v f l s0 v\n\n/// A reads label is ok for `f` if it is a bound on the set of\n/// locations that `f` reads\nlet reads_ok #a (f:comp a) (reads:label) =\n forall (l:loc) (s:store). ~(Set.mem l reads) ==> does_not_read_loc f l s\n\n/// Now for the flows index\nlet flow = label & label //from, to\nlet flows = list flow\n\n/// `has_flow from to fs` defines when the edge `from -> to` is includes in\n/// the flows `fs`\nlet has_flow_1 (from to:loc) (f:flow) = from `Set.mem` fst f /\\ to `Set.mem` snd f\nlet has_flow (from to:loc) (fs:flows) = exists rs. rs `List.Tot.memP` fs /\\ has_flow_1 from to rs\n\n/// Now, as with reads and writes, we have to give an interpretation\n/// to flows tying it to the computational representation\n\n/// `f` leaks no info along the flow edge `from -> to`\n/// --- This is a textbook definition of noninterference\nlet no_leakage_k #a (f:comp a) (from to:loc) (k:int) =\n forall s0.{:pattern (havoc s0 from k)}\n sel (snd (f s0)) to == sel (snd (f (havoc s0 from k))) to\nlet no_leakage #a (f:comp a) (from to:loc) = forall k. no_leakage_k f from to k\n/// A computation `f` respects all the flows in `fs`\n/// if it there is no leakage along any of the flow-edges in `f`\nlet respects_flows #a (f:comp a) (fs:flows) =\n forall from to. {:pattern (no_leakage f from to)} ~(has_flow from to fs) /\\ from<>to ==> no_leakage f from to\n\n/// Now, we can define our representation type, a refinement of the\n/// comp type where the refinement \"gives a meaning\" to the labels\n/// involved\nlet ist a (writes:label) (reads:label) (fs:flows) =\n f:comp a {\n reads_ok f reads /\\\n writes_ok f writes /\\\n respects_flows f fs\n }\n\n/// Now, proving that this representation is stable is going to take\n/// some work.\n\n/// Some basic actions to read and write and a return are easy enough\nlet iread (l:loc) : ist int bot (single l) [] = fun s -> sel s l, s\nlet iwrite (l:loc) (x:int) : ist unit (single l) bot [] = fun s -> (), upd s l x\nlet return (a:Type) (x:a) : ist a bot bot [] = fun s -> x,s\n\n/// But, proving that ist computations can be sequentially composed is\n/// a bit challenging\n\n/// First, some auxiliary notions defining a small algebra on flows\nlet add_source (r:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> union r r0, w0) fs\nlet add_sink (w:label) (fs:flows) : flows = List.Tot.map (fun (r0, w0) -> r0, union w w0) fs\nlet flows_included_in (fs0 fs1:flows) =\n forall f0. f0 `List.Tot.memP` fs0 ==>\n (forall from to. has_flow_1 from to f0 /\\ from <> to ==> (exists f1. f1 `List.Tot.memP` fs1 /\\ has_flow_1 from to f1))\nlet flows_equiv (fs0 fs1:flows) = fs0 `flows_included_in` fs1 /\\ fs1 `flows_included_in` fs0\nlet flows_equiv_refl fs\n : Lemma (fs `flows_equiv` fs)\n = ()\nlet flows_equiv_trans fs0 fs1 fs2\n : Lemma (fs0 `flows_equiv` fs1 /\\ fs1 `flows_equiv` fs2 ==> fs0 `flows_equiv` fs2)\n = ()\nlet flows_included_in_union_distr_dest (a b c:label)\n : Lemma (flows_equiv [a, union b c] [a, b; a, c])\n = ()\nlet flows_included_in_union_distr_src (a b c:label)\n : Lemma (flows_equiv [union a b, c] [a, c; b, c])\n = ()\nlet flows_included_in_union (a b c:label)\n : Lemma (flows_equiv ([a, union b c; union a b, c])\n ([a, b; union a b, c]))\n = ()\n\n\n\nlet bind_comp (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : comp b\n = fun s0 -> let v, s1 = x s0 in y v s1\n\nlet bind_comp_reads_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (reads_ok (bind_comp x y) (union r0 r1))\n = let f = bind_comp x y in\n let reads = union r0 r1 in\n let f_reads_ok (l:loc) (s0:store)\n : Lemma (requires (~(Set.mem l reads)))\n (ensures (does_not_read_loc f l s0))\n [SMTPat (does_not_read_loc f l s0)]\n = let aux (k:_)\n : Lemma (ensures (does_not_read_loc_v f l s0 k))\n [SMTPat (does_not_read_loc_v f l s0 k)]\n = let v, s1 = x s0 in\n let v', s1' = x (havoc s0 l k) in\n assert (does_not_read_loc x l s0);\n assert (does_not_read_loc_v x l s0 k);\n assert (v == v');\n assert (does_not_read_loc (y v) l s1);\n let u, s2 = y v s1 in\n let u', s2' = y v s1' in\n assert (forall l'. l' <> l ==> sel s1 l' == sel s1' l');\n if sel s1 l = sel s1' l\n then (assert (forall l. sel s1 l == sel s1' l);\n assert (Map.equal s1 s1'))\n else (assert (sel s1 l == sel s0 l /\\\n sel (havoc s0 l k) l == sel s1' l);\n assert (Map.equal s1' (havoc s1 l k)))\n in\n ()\n in\n ()\n\nlet bind_comp_writes_ok (#a #b:Type)\n (#w0 #r0 #w1 #r1:label)\n (#fs0 #fs1:flows)\n (x:ist a w0 r0 fs0)\n (y: a -> ist b w1 r1 fs1)\n : Lemma (writes_ok (bind_comp x y) (union w0 w1))\n = ()\n", "sketch": [ "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0` to establish the base case when `l0` is empty. \nStep 2: We will then consider the induction step, where we assume the lemma holds for the list `l0` and then prove it for the list `l0'` obtained by adding an element to the front of `l0`. \nStep 3: Finally, we will use the associativity property of list concatenation to show that the membership of `x` in `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0`.\nStep 2: In the base case where `l0` is an empty list, we will use the definition of list concatenation to simplify the goal.\nStep 3: In the inductive case, we will assume the lemma holds for the list `l0` and then use the definition of list concatenation to simplify the goal.\nStep 4: We will use the lemma assumption and the properties of list membership to establish the equivalence between the membership of `x` in `l0 @ l1` and the disjunction of the membership of `x` in `l0` and `l1`.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenation of `l0` and `l1` is equivalent to the membership of `x` in `l0` or `l1`. To prove this, we will use induction on the list `l0`. \n- Base case: If `l0` is an empty list, then the concatenation of `l0` and `l1` is simply `l1`. We can then show that the membership of `x` in `l1` is equivalent to the membership of `x` in `l1`, which is trivially true.\n- Inductive step: Assuming the lemma holds for some list `l0`, we want to show that it also holds for the list `x :: l0`. We will consider the two cases: \n 1. If `x` is a member of `l0`, then the membership of `x` in the concatenation of `x :: l0` and `l1` is equivalent to the membership of `x` in `x :: l0`, which is true by construction.\n 2. If `x` is not a member of `l0`, then the membership of `x` in the concatenation of `x :: l0` and `l1` is equivalent to the membership of `x` in `l1`, which is true by assumption.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0` to establish the base case when `l0` is empty. \nStep 2: In the inductive step, we will assume the lemma holds for the list `l0` and then show that it holds for the list `x :: l0`. \nStep 3: We will use the associativity property of list concatenation to rewrite the membership of `x` in `x :: l0 @ l1` as the membership of `x` in `x :: (l0 @ l1)`. \nStep 4: We will then use the definition of list membership to simplify the expression and apply the induction hypothesis to complete the proof.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0` to establish the base case when `l0` is empty. \nStep 2: We will then consider the inductive case when `l0` is non-empty, and we will use the induction hypothesis to complete the proof.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0` to establish the base case when `l0` is empty. \nStep 2: We will then consider the inductive case when `l0` is non-empty. \nStep 3: In the inductive case, we will use the induction hypothesis to split the problem into two cases: when the head of `l0` is equal to `x` and when it is not. \nStep 4: We will then use the associativity property of list concatenation to rewrite the membership of `x` in `l0 @ l1` as the membership of `x` in `l0` or the membership of `x` in `l1`.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. To prove this, we will use induction on the list `l0`. \n- Base case: If `l0` is an empty list, then the lemma holds trivially as the concatenation of an empty list with `l1` is simply `l1`, and the membership of `x` in `l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`.\n- Inductive step: Assuming the lemma holds for some list `l0`, we will show that it also holds for the list `x :: l0`. We will consider two cases:\n 1. If `x` is a member of `l0`, then the membership of `x` in `l0 @ l1` is equivalent to the membership of `x` in `l0`, which by the inductive hypothesis is equivalent to the disjunction of the membership of `x` in `l0` and `l1`.\n 2. If `x` is not a member of `l0`, then the membership of `x` in `l0 @ l1` is equivalent to the membership of `x` in `l1`, which is equivalent to the disjunction of the membership of `x` in `l0` and `l1`.", "We want to prove that for any element x and two lists l0 and l1, the membership of x in the concatenation of l0 and l1 is equivalent to the membership of x in either l0 or l1. To prove this, we will use induction on the list l0. \n- Base case: If l0 is an empty list, then the concatenation of l0 and l1 is just l1, and the lemma holds trivially.\n- Inductive step: Assume the lemma holds for some list l0. We want to show that it also holds for the list (cons x' l0), where x' is the head of l0 and l0 is the tail. We will consider two cases:\n 1. If x equals x', then x is a member of the concatenation of (cons x' l0) and l1 if and only if x is a member of l1, which is true by the definition of list concatenation.\n 2. If x is not equal to x', then x is a member of the concatenation of (cons x' l0) and l1 if and only if x is a member of l0 or x is a member of l1, which is true by the inductive hypothesis.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. We will prove this by induction on the list `l0`. \n\nBase case: If `l0` is an empty list, then the concatenation `l0 @ l1` is equivalent to `l1`. We will show that `List.Tot.memP x l1` is equivalent to `List.Tot.memP x l1`, which is trivially true.\n\nInductive step: Assume the lemma holds for some list `l0`. We want to show that it also holds for the list `x :: l0`. We will consider two cases:\n1. If `x` is a member of `l0`, then by the induction hypothesis, `List.Tot.memP x (l0 @ l1)` is equivalent to `List.Tot.memP x l0` or `List.Tot.memP x l1`, which implies `List.Tot.memP x (x :: l0 @ l1)` is equivalent to `true` or `List.Tot.memP x l1`.\n2. If `x` is not a member of `l0`, then by the induction hypothesis, `List.Tot.memP x (l0 @ l1)` is equivalent to `false` or `List.Tot.memP x l1`, which implies `List.Tot.memP x (x :: l0 @ l1)` is equivalent to `true` or `List.Tot.memP x l1`.", "We want to prove that for any element `x` and two lists `l0` and `l1`, the membership of `x` in the concatenated list `l0 @ l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`. \n\nStep 1: We will perform induction on the list `l0`. \n - Base case: If `l0` is an empty list, then the lemma holds trivially as the concatenation of an empty list with `l1` is just `l1`, and the membership of `x` in `l1` is equivalent to the disjunction of the membership of `x` in `l0` and `l1`.\n - Inductive case: We assume the lemma holds for some list `l0` and then show that it holds for the list `x :: l0`. \n\nStep 2: We will use the definition of list concatenation to rewrite the membership of `x` in `x :: l0 @ l1` as a disjunction of the membership of `x` in `x :: l0` and `l1`." ], "generated_solution": [ "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n= (fun l0 l1 ->\n match l0 with\n | [] -> ()\n | hd :: tl -> ()\n )", "let rec memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0) =\n match l0 with\n | [] -> ()\n | hd :: tl ->\n let rec_ind = memP_append_or a x tl l1 in\n ()", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "let memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n= ()", "val memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)", "let memP_append_or (#a: Type) (x: a) (l0 l1: list a)\n : Lemma (ensures (List.Tot.memP x (l0 @ l1) <==> (List.Tot.memP x l0 \\/ List.Tot.memP x l1)))\n (decreases l0)\n= ()" ] }, { "file_name": "Hacl.P256.fst", "name": "Hacl.P256.compressed_to_raw", "opens_and_abbrevs": [ { "abbrev": "P", "full_module": "Hacl.Impl.P256.Point" }, { "abbrev": "BN", "full_module": "Hacl.Impl.P256.Bignum" }, { "abbrev": "S", "full_module": "Spec.P256" }, { "abbrev": "BSeq", "full_module": "Lib.ByteSequence" }, { "abbrev": "LSeq", "full_module": "Lib.Sequence" }, { "open": "Hacl.Impl.P256.Verify" }, { "open": "Hacl.Impl.P256.Sign" }, { "open": "Hacl.Hash.SHA2" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.Buffer" }, { "open": "Lib.IntTypes" }, { "abbrev": "ST", "full_module": "FStar.HyperStack.ST" }, { "open": "FStar.HyperStack" }, { "open": "FStar.HyperStack.All" }, { "open": "FStar.Mul" }, { "abbrev": "BSeq", "full_module": "Lib.ByteSequence" }, { "abbrev": "S", "full_module": "Spec.P256" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.Buffer" }, { "open": "Lib.IntTypes" }, { "abbrev": "ST", "full_module": "FStar.HyperStack.ST" }, { "open": "FStar.HyperStack" }, { "open": "FStar.HyperStack.All" }, { "open": "FStar.Mul" }, { "open": "Hacl" }, { "open": "Hacl" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 30, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val compressed_to_raw: pk:lbuffer uint8 33ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))", "source_definition": "let compressed_to_raw pk pk_raw =\n Hacl.Impl.P256.Compression.compressed_to_raw pk pk_raw", "source_range": { "start_line": 132, "start_col": 0, "end_line": 133, "end_col": 56 }, "interleaved": false, "definition": "fun pk pk_raw -> Hacl.Impl.P256.Compression.compressed_to_raw pk pk_raw", "effect": "FStar.HyperStack.ST.Stack", "effect_flags": [], "mutual_with": [], "premises": [ "Lib.Buffer.lbuffer", "Lib.IntTypes.uint8", "FStar.UInt32.__uint_to_t", "Hacl.Impl.P256.Compression.compressed_to_raw", "Prims.bool" ], "proof_features": [], "is_simple_lemma": false, "is_div": true, "is_proof": false, "is_simply_typed": false, "is_type": false, "type": "pk: Lib.Buffer.lbuffer Lib.IntTypes.uint8 33ul -> pk_raw: Lib.Buffer.lbuffer Lib.IntTypes.uint8 64ul\n -> FStar.HyperStack.ST.Stack Prims.bool", "prompt": "let compressed_to_raw pk pk_raw =\n ", "expected_response": "Hacl.Impl.P256.Compression.compressed_to_raw pk pk_raw", "source": { "project_name": "hacl-star", "file_name": "code/ecdsap256/Hacl.P256.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.P256.fst", "checked_file": "dataset/Hacl.P256.fst.checked", "interface_file": true, "dependencies": [ "dataset/Spec.P256.fst.checked", "dataset/Spec.Hash.Definitions.fst.checked", "dataset/prims.fst.checked", "dataset/LowStar.Ignore.fsti.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.ByteSequence.fsti.checked", "dataset/Lib.Buffer.fsti.checked", "dataset/Hacl.Streaming.SHA2.fst.checked", "dataset/Hacl.Impl.P256.Verify.fst.checked", "dataset/Hacl.Impl.P256.Sign.fst.checked", "dataset/Hacl.Impl.P256.Scalar.fsti.checked", "dataset/Hacl.Impl.P256.Point.fsti.checked", "dataset/Hacl.Impl.P256.DH.fsti.checked", "dataset/Hacl.Impl.P256.Compression.fsti.checked", "dataset/Hacl.Impl.P256.Bignum.fsti.checked", "dataset/Hacl.Hash.SHA2.fsti.checked", "dataset/Hacl.Hash.Definitions.fst.checked", "dataset/Hacl.Bignum.Base.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.All.fst.checked", "dataset/FStar.HyperStack.fst.checked" ] }, "definitions_in_context": [ "let ecdsa_sign_p256_st (alg:S.hash_alg_ecdsa) =\n signature:lbuffer uint8 64ul\n -> msg_len:size_t{v msg_len >= S.min_input_length alg}\n -> msg:lbuffer uint8 msg_len\n -> private_key:lbuffer uint8 32ul\n -> nonce:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h signature /\\ live h msg /\\ live h private_key /\\ live h nonce /\\\n disjoint signature msg /\\ disjoint signature private_key /\\ disjoint signature nonce)\n (ensures fun h0 flag h1 -> modifies (loc signature) h0 h1 /\\\n (let sgnt = S.ecdsa_signature_agile alg (v msg_len)\n (as_seq h0 msg) (as_seq h0 private_key) (as_seq h0 nonce) in\n (flag <==> Some? sgnt) /\\ (flag ==> (as_seq h1 signature == Some?.v sgnt))))", "val msg_as_felem:\n alg:S.hash_alg_ecdsa\n -> msg_len:size_t{v msg_len >= S.min_input_length alg}\n -> msg:lbytes msg_len\n -> res:BN.felem ->\n Stack unit\n (requires fun h ->\n live h msg /\\ live h res /\\ disjoint msg res)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n (let hashM = S.hash_ecdsa alg (v msg_len) (as_seq h0 msg) in\n BN.as_nat h1 res = BSeq.nat_from_bytes_be (LSeq.sub hashM 0 32) % S.order))", "let ecdsa_verify_p256_st (alg:S.hash_alg_ecdsa) =\n msg_len:size_t{v msg_len >= S.min_input_length alg}\n -> msg:lbuffer uint8 msg_len\n -> public_key:lbuffer uint8 64ul\n -> signature_r:lbuffer uint8 32ul\n -> signature_s:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h signature_r /\\ live h signature_s /\\ live h msg)\n (ensures fun h0 res h1 -> modifies0 h0 h1 /\\\n res == S.ecdsa_verification_agile alg (v msg_len) (as_seq h0 msg)\n (as_seq h0 public_key) (as_seq h0 signature_r) (as_seq h0 signature_s))", "let msg_as_felem alg msg_len msg res =\n push_frame ();\n\n [@inline_let] let sz: size_t =\n match alg with\n | S.NoHash -> 32ul\n | S.Hash a -> Hacl.Hash.Definitions.hash_len a in\n\n let mHash = create sz (u8 0) in\n\n begin\n match alg with\n | S.NoHash -> copy mHash (sub msg 0ul 32ul)\n | S.Hash a -> match a with\n | SHA2_256 -> Hacl.Streaming.SHA2.hash_256 mHash msg msg_len\n | SHA2_384 -> Hacl.Streaming.SHA2.hash_384 mHash msg msg_len\n | SHA2_512 -> Hacl.Streaming.SHA2.hash_512 mHash msg msg_len\n end;\n LowStar.Ignore.ignore msg_len;\n let mHash32 = sub mHash 0ul 32ul in\n BN.bn_from_bytes_be4 res mHash32;\n Hacl.Impl.P256.Scalar.qmod_short res res;\n pop_frame ()", "val ecdsa_signature: alg:S.hash_alg_ecdsa -> ecdsa_sign_p256_st alg", "let ecdsa_signature alg signature msg_len msg private_key nonce =\n push_frame ();\n let m_q = BN.create_felem () in\n msg_as_felem alg msg_len msg m_q;\n let res = ecdsa_sign_msg_as_qelem signature m_q private_key nonce in\n pop_frame ();\n res", "val ecdsa_verification: alg:S.hash_alg_ecdsa -> ecdsa_verify_p256_st alg", "let ecdsa_verification alg msg_len msg public_key signature_r signature_s =\n push_frame ();\n let m_q = BN.create_felem () in\n msg_as_felem alg msg_len msg m_q;\n let res = ecdsa_verify_msg_as_qelem m_q public_key signature_r signature_s in\n pop_frame ();\n res", "val ecdsa_sign_p256_sha2: ecdsa_sign_p256_st (S.Hash SHA2_256)", "let ecdsa_sign_p256_sha2 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_256) signature msg_len msg private_key nonce", "let ecdsa_sign_p256_sha384 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_384) signature msg_len msg private_key nonce", "let ecdsa_sign_p256_sha512 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_512) signature msg_len msg private_key nonce", "let ecdsa_sign_p256_without_hash signature msg_len msg private_key nonce =\n ecdsa_signature S.NoHash signature msg_len msg private_key nonce", "val ecdsa_sign_p256_sha384: ecdsa_sign_p256_st (S.Hash SHA2_384)", "let ecdsa_verif_p256_sha2 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_256) msg_len msg public_key signature_r signature_s", "let ecdsa_verif_p256_sha384 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_384) msg_len msg public_key signature_r signature_s", "let ecdsa_verif_p256_sha512 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_512) msg_len msg public_key signature_r signature_s", "let ecdsa_verif_without_hash msg_len msg public_key signature_r signature_s =\n ecdsa_verification S.NoHash msg_len msg public_key signature_r signature_s", "val ecdsa_sign_p256_sha512: ecdsa_sign_p256_st (S.Hash SHA2_512)", "let validate_public_key public_key =\n push_frame ();\n let point_jac = P.create_point () in\n let res = P.load_point_vartime point_jac public_key in\n pop_frame ();\n res", "let validate_private_key private_key =\n push_frame ();\n let bn_sk = BN.create_felem () in\n BN.bn_from_bytes_be4 bn_sk private_key;\n let res = Hacl.Impl.P256.Scalar.bn_is_lt_order_and_gt_zero_mask4 bn_sk in\n pop_frame ();\n Hacl.Bignum.Base.unsafe_bool_of_limb res", "let uncompressed_to_raw pk pk_raw =\n Hacl.Impl.P256.Compression.uncompressed_to_raw pk pk_raw" ], "closest": [ "val compressed_to_raw: pk:lbuffer uint8 33ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))\nlet compressed_to_raw pk pk_raw =\n push_frame ();\n let xa = create_felem () in\n let ya = create_felem () in\n let pk_xb = sub pk 1ul 32ul in\n let b = P.aff_point_decompress_vartime xa ya pk in\n\n if b then begin\n let h0 = ST.get () in\n update_sub pk_raw 0ul 32ul pk_xb;\n let h1 = ST.get () in\n update_sub_f h1 pk_raw 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (as_nat h1 ya))\n (fun _ -> bn_to_bytes_be4 (sub pk_raw 32ul 32ul) ya);\n let h2 = ST.get () in\n LSeq.eq_intro (as_seq h2 pk_raw)\n (LSeq.concat #_ #32 #32 (as_seq h0 pk_xb) (BSeq.nat_to_bytes_be 32 (as_nat h0 ya))) end;\n pop_frame ();\n b", "val uncompressed_to_raw: pk:lbuffer uint8 65ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_uncompressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_uncompressed_to_raw (as_seq h0 pk)))))\nlet uncompressed_to_raw pk pk_raw =\n let pk0 = pk.(0ul) in\n if Lib.RawIntTypes.u8_to_UInt8 pk0 <> 0x04uy then false\n else begin\n copy pk_raw (sub pk 1ul 64ul);\n true end", "val public_key_compressed_to_raw: pk_raw:lbytes 64ul -> pk:lbytes 33ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))\nlet public_key_compressed_to_raw pk_raw pk =\n push_frame ();\n let xa = create_felem () in\n let ya = create_felem () in\n let pk_xb = sub pk 1ul 32ul in\n let b = P.aff_point_decompress_vartime xa ya pk in\n\n if b then begin\n let h0 = ST.get () in\n update_sub pk_raw 0ul 32ul pk_xb;\n let h1 = ST.get () in\n update_sub_f h1 pk_raw 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (feval h1 ya))\n (fun _ -> store_felem (sub pk_raw 32ul 32ul) ya);\n let h2 = ST.get () in\n LSeq.eq_intro (as_seq h2 pk_raw)\n (LSeq.concat #_ #32 #32(as_seq h0 pk_xb) (BSeq.nat_to_bytes_be 32 (feval h0 ya))) end;\n pop_frame ();\n b", "val raw_to_compressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 33ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_compressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_compressed pk_raw pk =\n let h0 = ST.get () in\n let pk_x = sub pk_raw 0ul 32ul in\n let pk_y = sub pk_raw 32ul 32ul in\n pk.(0ul) <- raw_to_compressed_get_pk0 pk_y;\n update_sub pk 1ul 32ul pk_x;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_compressed_from_raw (as_seq h0 pk_raw))", "val public_key_uncompressed_to_raw: pk_raw:lbytes 64ul -> pk:lbytes 65ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_uncompressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_uncompressed_to_raw (as_seq h0 pk)))))\nlet public_key_uncompressed_to_raw pk_raw pk =\n let pk0 = pk.(0ul) in\n if Lib.RawIntTypes.u8_to_UInt8 pk0 <> 0x04uy then false\n else begin\n copy pk_raw (sub pk 1ul 64ul);\n true end", "val raw_to_uncompressed: pk_raw:lbuffer uint8 64ul -> pk:lbuffer uint8 65ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_uncompressed_from_raw (as_seq h0 pk_raw))\nlet raw_to_uncompressed pk_raw pk =\n let h0 = ST.get () in\n pk.(0ul) <- u8 0x04;\n update_sub pk 1ul 64ul pk_raw;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_uncompressed_from_raw (as_seq h0 pk_raw))", "val public_key_compressed_from_raw: pk:lbytes 33ul -> pk_raw:lbytes 64ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_compressed_from_raw (as_seq h0 pk_raw))\nlet public_key_compressed_from_raw pk pk_raw =\n let h0 = ST.get () in\n let pk_x = sub pk_raw 0ul 32ul in\n let pk_y = sub pk_raw 32ul 32ul in\n let is_pk_y_odd = is_nat_from_bytes_be_odd_vartime pk_y in\n pk.(0ul) <- if is_pk_y_odd then u8 0x03 else u8 0x02;\n update_sub pk 1ul 32ul pk_x;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_compressed_from_raw (as_seq h0 pk_raw))", "val public_key_uncompressed_from_raw: pk:lbytes 65ul -> pk_raw:lbytes 64ul -> Stack unit\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 _ h1 -> modifies (loc pk) h0 h1 /\\\n as_seq h1 pk == S.pk_uncompressed_from_raw (as_seq h0 pk_raw))\nlet public_key_uncompressed_from_raw pk pk_raw =\n let h0 = ST.get () in\n pk.(0ul) <- u8 0x04;\n update_sub pk 1ul 64ul pk_raw;\n let h1 = ST.get () in\n LSeq.eq_intro (as_seq h1 pk) (S.pk_uncompressed_from_raw (as_seq h0 pk_raw))", "val raw_to_compressed_get_pk0: f:lbuffer uint8 32ul -> Stack uint8\n (requires fun h -> live h f)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n v b == (if (BSeq.nat_from_bytes_be (as_seq h0 f) % 2 = 1) then 0x03 else 0x02))\nlet raw_to_compressed_get_pk0 f =\n push_frame ();\n let bn_f = create_felem () in\n bn_from_bytes_be4 bn_f f;\n let is_odd_f = bn_is_odd4 bn_f in\n pop_frame ();\n to_u8 is_odd_f +! u8 0x02", "val test_public_key_compressed: pk:lbuffer uint8 64ul -> Stack unit\n (requires fun h -> live h pk)\n (ensures fun h0 _ h1 -> modifies0 h0 h1)\nlet test_public_key_compressed pk =\n push_frame ();\n let pk_c = create 33ul (u8 0) in\n let pk_raw_c = create 64ul (u8 0) in\n\n K256.public_key_compressed_from_raw pk_c pk;\n let b = K256.public_key_compressed_to_raw pk_raw_c pk_c in\n\n C.String.print (C.String.of_literal \"\\n Test K256 pk_compressed:\\n\");\n if b\n then (if not (result_compare_display 64ul (to_const pk) (to_const pk_raw_c)) then C.exit 255l)\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l);\n pop_frame ()", "val test_public_key_uncompressed: pk:lbuffer uint8 64ul -> Stack unit\n (requires fun h -> live h pk)\n (ensures fun h0 _ h1 -> modifies0 h0 h1)\nlet test_public_key_uncompressed pk =\n push_frame ();\n let pk_u = create 65ul (u8 0) in\n let pk_raw_u = create 64ul (u8 0) in\n\n K256.public_key_uncompressed_from_raw pk_u pk;\n let b = K256.public_key_uncompressed_to_raw pk_raw_u pk_u in\n\n C.String.print (C.String.of_literal \"\\n Test K256 pk_uncompressed:\\n\");\n if b\n then (if not (result_compare_display 64ul (to_const pk) (to_const pk_raw_u)) then C.exit 255l)\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l);\n pop_frame ()", "val secret_to_public: public_key:lbytes 64ul -> private_key:lbytes 32ul -> Stack bool\n (requires fun h ->\n live h public_key /\\ live h private_key /\\\n disjoint public_key private_key)\n (ensures fun h0 b h1 -> modifies (loc public_key) h0 h1 /\\\n (let public_key_s = S.secret_to_public (as_seq h0 private_key) in\n (b <==> Some? public_key_s) /\\ (b ==> (as_seq h1 public_key == Some?.v public_key_s))))\nlet secret_to_public public_key private_key =\n push_frame ();\n let tmp = create 19ul (u64 0) in\n let pk = sub tmp 0ul 15ul in\n let sk = sub tmp 15ul 4ul in\n\n let is_sk_valid = load_qelem_conditional sk private_key in\n PM.point_mul_g pk sk; // pk = [sk]G\n P.point_store public_key pk;\n pop_frame ();\n BB.unsafe_bool_of_limb is_sk_valid", "val box_beforenm:\n k:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul ->\n Stack size_t\n (requires fun h -> live h k /\\ live h pk /\\ live h sk /\\\n disjoint k pk /\\ disjoint k sk)\n (ensures fun h0 r h1 -> modifies (loc k) h0 h1 /\\\n (let key = Spec.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in\n match r with\n | 0ul -> Some? key /\\ as_seq h1 k == Some?.v key\n | _ -> None? key))\nlet box_beforenm k pk sk =\n push_frame();\n let n0 = create 16ul (u8 0) in\n let r = Hacl.Curve25519_51.ecdh k sk pk in\n let res =\n if r then (\n Hacl.Salsa20.hsalsa20 k k n0;\n 0ul)\n else\n 0xfffffffful in\n pop_frame();\n res", "val crypto_box_beforenm:\n k:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul ->\n Stack size_t\n (requires fun h -> live h k /\\ live h pk /\\ live h sk /\\\n disjoint k pk /\\ disjoint k sk)\n (ensures fun h0 r h1 -> modifies1 k h0 h1 /\\\n (let key = SB.box_beforenm (as_seq h0 pk) (as_seq h0 sk) in\n match r with\n | 0ul -> Some? key /\\ as_seq h1 k == Some?.v key\n | _ -> None? key))\nlet crypto_box_beforenm k pk sk =\n Hacl.Impl.Box.box_beforenm k pk sk", "val test_secret_to_public:\n sk:lbuffer uint8 32ul\n -> pk:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h -> live h sk /\\ live h pk)\n (ensures fun h0 _ h1 -> modifies0 h0 h1)\nlet test_secret_to_public sk pk =\n push_frame ();\n let pk_comp = create 64ul (u8 0) in\n let b = K256.secret_to_public pk_comp sk in\n\n C.String.print (C.String.of_literal \"\\n Test K256 secret_to_public: \");\n let is_eq = result_compare_display 64ul (to_const pk) (to_const pk_comp) in\n if (is_eq && b) then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l);\n pop_frame ()", "val pk_compressed_from_raw (pk: lbytes 64) : lbytes 33\nlet pk_compressed_from_raw (pk:lbytes 64) : lbytes 33 =\n let pk_x = sub pk 0 32 in\n let pk_y = sub pk 32 32 in\n let is_pk_y_odd = nat_from_bytes_be pk_y % 2 = 1 in // <==> pk_y % 2 = 1\n let pk0 = if is_pk_y_odd then u8 0x03 else u8 0x02 in\n concat (create 1 pk0) pk_x", "val pk_compressed_from_raw (pk: lbytes 64) : lbytes 33\nlet pk_compressed_from_raw (pk:lbytes 64) : lbytes 33 =\n let pk_x = sub pk 0 32 in\n let pk_y = sub pk 32 32 in\n let is_pk_y_odd = nat_from_bytes_be pk_y % 2 = 1 in // <==> pk_y % 2 = 1\n let pk0 = if is_pk_y_odd then u8 0x03 else u8 0x02 in\n concat (create 1 pk0) pk_x", "val point_decompress: s:lbuffer uint8 32ul -> out:F51.point ->\n Stack bool\n (requires fun h ->\n live h out /\\ live h s /\\ disjoint s out)\n (ensures fun h0 b h1 -> modifies (loc out) h0 h1 /\\\n (b ==> F51.point_inv_t h1 out /\\ F51.inv_ext_point (as_seq h1 out)) /\\\n (b <==> Some? (SE.point_decompress (as_seq h0 s))) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (SE.point_decompress (as_seq h0 s)))))\nlet point_decompress s out =\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.point_decompress_lemma (as_seq h0 s);\n Hacl.Impl.Ed25519.PointDecompress.point_decompress out s", "val test_secret_to_public:\n sk:lbuffer uint8 32ul\n -> expected_pk:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h -> live h sk /\\ live h expected_pk)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_secret_to_public sk expected_pk =\n push_frame ();\n let pk = create 32ul (u8 0) in\n Ed25519.secret_to_public pk sk;\n\n C.String.print (C.String.of_literal \"Test Ed25519 Secret_to_public:\\n\");\n if not (result_compare_display 32ul (to_const pk) (to_const expected_pk)) then C.exit 255l;\n pop_frame ()", "val pk_compressed_to_raw (pk: lbytes 33) : option (lbytes 64)\nlet pk_compressed_to_raw (pk:lbytes 33) : option (lbytes 64) =\n let pk_x = sub pk 1 32 in\n match (aff_point_decompress pk) with\n | Some (x, y) -> Some (concat #_ #32 #32 pk_x (nat_to_bytes_be 32 y))\n | None -> None", "val pk_compressed_to_raw (pk: lbytes 33) : option (lbytes 64)\nlet pk_compressed_to_raw (pk:lbytes 33) : option (lbytes 64) =\n let pk_x = sub pk 1 32 in\n match (aff_point_decompress pk) with\n | Some (x, y) -> Some (concat #_ #32 #32 pk_x (nat_to_bytes_be 32 y))\n | None -> None", "val secp256k1_ecdsa_signature_normalize: signature: lbytes 64ul -> Stack bool\n (requires fun h -> live h signature)\n (ensures fun h0 b h1 -> modifies (loc signature) h0 h1 /\\\n (let sgnt = S.secp256k1_ecdsa_signature_normalize (as_seq h0 signature) in\n (b <==> Some? sgnt) /\\ (b ==> (as_seq h1 signature == Some?.v sgnt))))\nlet secp256k1_ecdsa_signature_normalize signature =\n push_frame ();\n let s_q = create_qelem () in\n let s = sub signature 32ul 32ul in\n let is_sk_valid = load_qelem_vartime s_q s in\n let b =\n if not is_sk_valid then false\n else begin\n let is_sk_lt_q_halved = is_qelem_le_q_halved_vartime s_q in\n qnegate_conditional_vartime s_q (not is_sk_lt_q_halved);\n\n let h1 = ST.get () in\n update_sub_f h1 signature 32ul 32ul\n (fun h -> BSeq.nat_to_bytes_be 32 (qas_nat h1 s_q))\n (fun _ -> store_qelem (sub signature 32ul 32ul) s_q);\n true end in\n pop_frame ();\n b", "val verify_valid_pk:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul\n -> a':point ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h msg /\\ live h signature /\\ live h a' /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\ point_inv_full_t h a' /\\\n (F51.point_eval h a' == Some?.v (Spec.Ed25519.point_decompress (as_seq h public_key))))\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n z == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify_valid_pk public_key msg_len msg signature a' =\n push_frame ();\n let r' = create 20ul (u64 0) in\n let rs = sub signature 0ul 32ul in\n let h0 = ST.get () in\n Spec.Ed25519.Lemmas.point_decompress_lemma (as_seq h0 rs);\n let b' = Hacl.Impl.Ed25519.PointDecompress.point_decompress r' rs in\n let res = if b' then verify_valid_pk_rs public_key msg_len msg signature a' r' else false in\n pop_frame ();\n res", "val verify_sb: sb:lbuffer uint8 32ul -> Stack bool\n (requires fun h -> live h sb)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (b <==> (BSeq.nat_from_bytes_le (as_seq h0 sb) >= Spec.Ed25519.q)))\nlet verify_sb sb =\n push_frame ();\n let tmp = create 5ul (u64 0) in\n Hacl.Impl.Load56.load_32_bytes tmp sb;\n let b = Hacl.Impl.Ed25519.PointEqual.gte_q tmp in\n pop_frame ();\n b", "val point_compress: p:F51.point -> out:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h out /\\ live h p /\\ disjoint p out /\\\n F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == SE.point_compress (F51.point_eval h0 p))\nlet point_compress p out =\n Hacl.Impl.Ed25519.PointCompress.point_compress out p", "val verify_valid_pk_rs:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul\n -> a':point\n -> r':point ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h msg /\\ live h signature /\\ live h a' /\\ live h r' /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\ point_inv_full_t h a' /\\\n (F51.point_eval h a' == Some?.v (Spec.Ed25519.point_decompress (as_seq h public_key))) /\\\n (Some? (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))) /\\ point_inv_full_t h r' /\\\n (F51.point_eval h r' == Some?.v (Spec.Ed25519.point_decompress (as_seq h (gsub signature 0ul 32ul)))))\n (ensures fun h0 z h1 -> modifies0 h0 h1 /\\\n z == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify_valid_pk_rs public_key msg_len msg signature a' r' =\n push_frame ();\n let hb = create 32ul (u8 0) in\n let rs = sub signature 0ul 32ul in\n let sb = sub signature 32ul 32ul in\n\n let b = verify_sb sb in\n let res =\n if b then false\n else begin\n Hacl.Impl.SHA512.ModQ.store_sha512_modq_pre_pre2 hb rs public_key msg_len msg;\n verify_all_valid_hb sb hb a' r' end in\n pop_frame ();\n res", "val point_decompress_:\n out:point\n -> s:lbuffer uint8 32ul\n -> tmp:lbuffer uint64 10ul ->\n Stack bool\n (requires fun h ->\n live h out /\\ live h s /\\ live h tmp /\\\n disjoint s tmp /\\ disjoint out tmp /\\\n F51.mul_inv_t h (gsub tmp 5ul 5ul)\n )\n (ensures fun h0 b h1 -> modifies (loc out |+| loc tmp) h0 h1 /\\\n (b <==> Some? (SE.point_decompress (as_seq h0 s))) /\\\n (b ==> F51.point_inv_t h1 out) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (SE.point_decompress (as_seq h0 s))))\n )\nlet point_decompress_ out s tmp =\n let y = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let sign = most_significant_bit s in\n load_51 y s;\n let z = Hacl.Impl.Ed25519.RecoverX.recover_x x y sign in\n\n let res =\n if z = false then false\n else (\n let outx = getx out in\n let outy = gety out in\n let outz = getz out in\n let outt = gett out in\n copy outx x;\n copy outy y;\n make_one outz;\n fmul outt x y;\n true\n ) in\n res", "val store_56:\n out:lbuffer uint8 32ul\n -> b:lbuffer uint64 5ul ->\n Stack unit\n (requires fun h -> live h out /\\ live h b /\\\n (let s = as_seq h b in\n v (Seq.index s 0) < pow2 56 /\\\n v (Seq.index s 1) < pow2 56 /\\\n v (Seq.index s 2) < pow2 56 /\\\n v (Seq.index s 3) < pow2 56 /\\\n v (Seq.index s 4) < pow2 32)\n )\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n (assert_norm (pow2 56 < pow2 64); assert_norm (pow2 32 < pow2 64);\n assert_norm (S56.as_nat5 (u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 56 - 1), u64 (pow2 32 - 1)) < pow2 256);\n nat_to_bytes_le 32 (F56.as_nat h0 b) == as_seq h1 out)\n )\nlet store_56 out b =\n let b0 = b.(0ul) in\n let b1 = b.(1ul) in\n let b2 = b.(2ul) in\n let b3 = b.(3ul) in\n let b4 = b.(4ul) in\n let b4' = to_u32 b4 in\n\n hstore56_le out 0ul b0;\n hstore56_le out 7ul b1;\n hstore56_le out 14ul b2;\n hstore56_le out 21ul b3;\n uint_to_bytes_le (sub out 28ul 4ul) b4';\n let h1 = ST.get() in\n assert (Seq.equal (Seq.slice (as_seq h1 out) 0 7) (as_seq h1 (gsub out 0ul 7ul)));\n assert (Seq.equal (Seq.slice (as_seq h1 out) 7 14) (as_seq h1 (gsub out 7ul 7ul)));\n assert (Seq.equal (Seq.slice (as_seq h1 out) 14 21) (as_seq h1 (gsub out 14ul 7ul)));\n assert (Seq.equal (Seq.slice (as_seq h1 out) 21 28) (as_seq h1 (gsub out 21ul 7ul)));\n assert (Seq.equal (Seq.slice (as_seq h1 out) 28 32) (as_seq h1 (gsub out 28ul 4ul)));\n lemma_uint_to_bytes_le_preserves_value b4';\n lemma_store_56_bytes (as_seq h1 out) b0 b1 b2 b3 b4;\n lemma_nat_from_to_bytes_le_preserves_value (as_seq h1 out) 32", "val point_decompress:\n out:point\n -> s:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h -> live h out /\\ live h s)\n (ensures fun h0 b h1 -> modifies (loc out) h0 h1 /\\\n (b ==> F51.point_inv_t h1 out) /\\\n (b <==> Some? (Spec.Ed25519.point_decompress (as_seq h0 s))) /\\\n (b ==> (F51.point_eval h1 out == Some?.v (Spec.Ed25519.point_decompress (as_seq h0 s))))\n )\nlet point_decompress out s =\n push_frame();\n let tmp = create 10ul (u64 0) in\n let res = point_decompress_ out s tmp in\n pop_frame();\n res", "val test_verify:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 32ul\n -> sig:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h ->\n live h msg /\\ live h pk /\\ live h sig)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_verify msg_len msg pk sig =\n let res = Ed25519.verify pk msg_len msg sig in\n\n C.String.print (C.String.of_literal \"Test Ed25519 Verify:\\n\");\n if res then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l)", "val ecp256dh_i:\n public_key:lbuffer uint8 64ul\n -> private_key:lbuffer uint8 32ul ->\n Stack bool\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 r h1 -> modifies (loc public_key) h0 h1 /\\\n (let pk = S.secret_to_public (as_seq h0 private_key) in\n (r <==> Some? pk) /\\ (r ==> (as_seq h1 public_key == Some?.v pk))))\nlet ecp256dh_i public_key private_key =\n push_frame ();\n let tmp = create 16ul (u64 0) in\n let sk = sub tmp 0ul 4ul in\n let pk = sub tmp 4ul 12ul in\n\n let is_sk_valid = load_qelem_conditional sk private_key in\n point_mul_g pk sk;\n point_store public_key pk;\n pop_frame ();\n Hacl.Bignum.Base.unsafe_bool_of_limb is_sk_valid", "val aff_point_load_vartime: res:aff_point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.aff_point_load (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (aff_point_inv h1 res /\\ as_aff_point_nat h1 res == Some?.v ps))))\nlet aff_point_load_vartime p b =\n let p_x = sub b 0ul 32ul in\n let p_y = sub b 32ul 32ul in\n\n let bn_p_x = aff_getx p in\n let bn_p_y = aff_gety p in\n bn_from_bytes_be4 bn_p_x p_x;\n bn_from_bytes_be4 bn_p_y p_y;\n let is_xy_valid = is_xy_valid_vartime p in\n if not is_xy_valid then false\n else is_on_curve_vartime p", "val expand_keys:\n expanded_keys:lbuffer uint8 96ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h expanded_keys /\\ live h private_key /\\ disjoint expanded_keys private_key)\n (ensures fun h0 _ h1 -> modifies (loc expanded_keys) h0 h1 /\\\n (let public_key, s, prefix = Spec.Ed25519.expand_keys (as_seq h0 private_key) in\n as_seq h1 (gsub expanded_keys 0ul 32ul) == public_key /\\\n as_seq h1 (gsub expanded_keys 32ul 32ul) == s /\\\n as_seq h1 (gsub expanded_keys 64ul 32ul) == prefix))\nlet expand_keys expanded_keys private_key =\n Hacl.Ed25519.expand_keys expanded_keys private_key", "val expand_keys:\n expanded_keys:lbuffer uint8 96ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h expanded_keys /\\ live h private_key /\\ disjoint expanded_keys private_key)\n (ensures fun h0 _ h1 -> modifies (loc expanded_keys) h0 h1 /\\\n (let public_key, s, prefix = Spec.Ed25519.expand_keys (as_seq h0 private_key) in\n as_seq h1 (gsub expanded_keys 0ul 32ul) == public_key /\\\n as_seq h1 (gsub expanded_keys 32ul 32ul) == s /\\\n as_seq h1 (gsub expanded_keys 64ul 32ul) == prefix))\nlet expand_keys expanded_keys private_key =\n let public_key = sub expanded_keys 0ul 32ul in\n let s_prefix = sub expanded_keys 32ul 64ul in\n let s = sub expanded_keys 32ul 32ul in\n secret_expand s_prefix private_key;\n Hacl.Impl.Ed25519.Sign.point_mul_g_compress public_key s", "val secret_expand: expanded:lbuffer uint8 64ul -> secret:lbuffer uint8 32ul -> Stack unit\n (requires fun h -> live h expanded /\\ live h secret /\\ disjoint expanded secret)\n (ensures fun h0 _ h1 -> modifies (loc expanded) h0 h1 /\\\n (let a, prefix = S.secret_expand (as_seq h0 secret) in\n as_seq h1 (gsub expanded 0ul 32ul) == a /\\\n as_seq h1 (gsub expanded 32ul 32ul) == prefix))\nlet secret_expand expanded secret =\n assert_norm (pow2 32 <= pow2 125 - 1);\n Hacl.Streaming.SHA2.hash_512 expanded secret 32ul;\n let h_low = sub expanded 0ul 32ul in\n let h_low0 = h_low.( 0ul) in\n let h_low31 = h_low.(31ul) in\n h_low.( 0ul) <- h_low0 &. u8 0xf8;\n h_low.(31ul) <- (h_low31 &. u8 127) |. u8 64", "val point_compress:\n out:lbuffer uint8 32ul\n -> p:point ->\n Stack unit\n (requires fun h -> live h out /\\ live h p /\\ F51.point_inv_t h p)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == Spec.Ed25519.point_compress (F51.point_eval h0 p)\n )\nlet point_compress z p =\n push_frame();\n let tmp = create 15ul (u64 0) in\n let zinv = sub tmp 0ul 5ul in\n let x = sub tmp 5ul 5ul in\n let out = sub tmp 10ul 5ul in\n\n point_compress_ tmp p;\n let b = x_mod_2 x in\n store_51 z out;\n add_sign z b;\n\n (**) let h3 = ST.get() in\n (**) lemma_nat_from_to_bytes_le_preserves_value (as_seq h3 z) 32;\n (**) lemma_nat_to_from_bytes_le_preserves_value (as_seq h3 z) 32 (F51.fevalh h3 out);\n\n pop_frame()", "val load_qelem_vartime: f:qelem -> b:lbuffer uint8 32ul -> Stack bool\n (requires fun h ->\n live h f /\\ live h b /\\ disjoint f b)\n (ensures fun h0 m h1 -> modifies (loc f) h0 h1 /\\\n (let b_nat = BSeq.nat_from_bytes_be (as_seq h0 b) in\n qas_nat h1 f == b_nat /\\ m = (0 < b_nat && b_nat < S.q)))\nlet load_qelem_vartime f b =\n load_qelem f b;\n\n let h = ST.get () in\n KL.qas_nat4_is_qas_nat (as_seq h f);\n let is_zero = is_qelem_zero_vartime f in\n let (a0,a1,a2,a3) = (f.(0ul), f.(1ul), f.(2ul), f.(3ul)) in\n let is_lt_q_b = is_qelem_lt_q_vartime4 (a0,a1,a2,a3) in\n KL.is_qelem_lt_q_vartime4_lemma (a0,a1,a2,a3);\n not is_zero && is_lt_q_b", "val aff_point_load_vartime: res:aff_point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.aff_point_load (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (aff_point_inv h1 res /\\ aff_point_eval h1 res == Some?.v ps))))\nlet aff_point_load_vartime p b =\n let px = sub b 0ul 32ul in\n let py = sub b 32ul 32ul in\n let bn_px = aff_getx p in\n let bn_py = aff_gety p in\n\n let h0 = ST.get () in\n let is_x_valid = load_felem_lt_prime_vartime bn_px px in\n let is_y_valid = load_felem_lt_prime_vartime bn_py py in\n let h1 = ST.get () in\n assert (as_nat h1 bn_px == BSeq.nat_from_bytes_be (as_seq h0 (gsub b 0ul 32ul)));\n assert (as_nat h1 bn_py == BSeq.nat_from_bytes_be (as_seq h0 (gsub b 32ul 32ul)));\n assert (inv_lazy_reduced1 h1 bn_px);\n assert (inv_lazy_reduced1 h1 bn_py);\n\n if is_x_valid && is_y_valid then begin\n assert (inv_fully_reduced h1 bn_px);\n assert (inv_fully_reduced h1 bn_py);\n is_on_curve_vartime p end\n else false", "val mk_ext_g_pow2_64: unit -> StackInline (lbuffer uint64 20ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 ext_g_pow2_64_lseq)\nlet mk_ext_g_pow2_64 () =\n createL ext_g_pow2_64_list", "val pk_uncompressed_to_raw (pk: lbytes 65) : option (lbytes 64)\nlet pk_uncompressed_to_raw (pk:lbytes 65) : option (lbytes 64) =\n if Lib.RawIntTypes.u8_to_UInt8 pk.[0] <> 0x04uy then None else Some (sub pk 1 64)", "val pk_uncompressed_to_raw (pk: lbytes 65) : option (lbytes 64)\nlet pk_uncompressed_to_raw (pk:lbytes 65) : option (lbytes 64) =\n if Lib.RawIntTypes.u8_to_UInt8 pk.[0] <> 0x04uy then None else Some (sub pk 1 64)", "val load_qelem_conditional: res:qelem -> b:lbuffer uint8 32ul -> Stack uint64\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 m h1 -> modifies (loc res) h0 h1 /\\\n (let b_nat = BSeq.nat_from_bytes_be (as_seq h0 b) in\n let is_b_valid = 0 < b_nat && b_nat < S.q in\n (v m = ones_v U64 \\/ v m = 0) /\\ (v m = ones_v U64) = is_b_valid /\\\n qas_nat h1 res == (if is_b_valid then b_nat else 1)))\nlet load_qelem_conditional res b =\n push_frame ();\n let is_b_valid = load_qelem_check res b in\n let oneq = create_one () in\n let h0 = ST.get () in\n Lib.ByteBuffer.buf_mask_select res oneq is_b_valid res;\n let h1 = ST.get () in\n assert (as_seq h1 res == (if (v is_b_valid = 0) then as_seq h0 oneq else as_seq h0 res));\n pop_frame ();\n is_b_valid", "val test:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul\n -> expected_sig:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h ->\n live h msg /\\ live h expected_sig /\\ live h pk /\\ live h sk)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test msg_len msg pk sk expected_sig =\n test_verify msg_len msg pk expected_sig;\n test_sign msg_len msg sk expected_sig;\n test_secret_to_public sk pk", "val convert_scalar: scalar:lbuffer uint8 32ul -> bscalar:lbuffer uint64 4ul ->\n Stack unit\n (requires fun h -> live h scalar /\\ live h bscalar /\\ disjoint scalar bscalar)\n (ensures fun h0 _ h1 -> modifies (loc bscalar) h0 h1 /\\\n BD.bn_v h1 bscalar == BSeq.nat_from_bytes_le (as_seq h0 scalar))\nlet convert_scalar scalar bscalar =\n let h0 = ST.get () in\n Hacl.Spec.Bignum.Convert.bn_from_bytes_le_lemma #U64 32 (as_seq h0 scalar);\n Hacl.Bignum.Convert.mk_bn_from_bytes_le true 32ul scalar bscalar", "val pk_uncompressed_from_raw (pk: lbytes 64) : lbytes 65\nlet pk_uncompressed_from_raw (pk:lbytes 64) : lbytes 65 =\n concat (create 1 (u8 0x04)) pk", "val pk_uncompressed_from_raw (pk: lbytes 64) : lbytes 65\nlet pk_uncompressed_from_raw (pk:lbytes 64) : lbytes 65 =\n concat (create 1 (u8 0x04)) pk", "val load_point_vartime: res:point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.load_point (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (point_inv h1 res /\\ point_eval h1 res == Some?.v ps))))\nlet load_point_vartime p b =\n push_frame ();\n let p_aff = create_aff_point () in\n let res = aff_point_load_vartime p_aff b in\n if res then to_proj_point p p_aff;\n pop_frame ();\n res", "val mk_proj_g_pow2_64: unit -> StackInline (lbuffer uint64 15ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_64_lseq)\nlet mk_proj_g_pow2_64 () =\n createL proj_g_pow2_64_list", "val ecp256dh_r_: is_pk_valid:bool -> ss:lbuffer uint8 64ul -> pk:point -> sk:felem -> Stack unit\n (requires fun h ->\n live h ss /\\ live h pk /\\ live h sk /\\\n disjoint ss pk /\\ disjoint ss sk /\\ disjoint pk sk /\\\n as_nat h sk < S.order /\\ (is_pk_valid ==> point_inv h pk))\n (ensures fun h0 _ h1 -> modifies (loc ss) h0 h1 /\\\n as_seq h1 ss == (if is_pk_valid\n then S.point_store (S.point_mul (as_nat h0 sk) (from_mont_point (as_point_nat h0 pk)))\n else as_seq h0 ss))\nlet ecp256dh_r_ is_pk_valid ss pk sk =\n push_frame ();\n let ss_proj = create_point () in\n if is_pk_valid then begin\n point_mul ss_proj sk pk;\n point_store ss ss_proj end;\n pop_frame ()", "val is_private_key_valid: private_key:lbuffer uint8 32ul -> Stack bool\n (requires fun h -> live h private_key)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\\n (let s = BSeq.nat_from_bytes_be (as_seq h0 private_key) in\n r <==> (0 < s && s < S.q)))\nlet is_private_key_valid private_key =\n push_frame ();\n let s_q = create_qelem () in\n let res = load_qelem_check s_q private_key in\n pop_frame ();\n BB.unsafe_bool_of_limb res", "val test_verify_hashed:\n msgHash:lbuffer uint8 32ul\n -> pk:lbuffer uint8 64ul\n -> sgnt:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h -> live h msgHash /\\ live h pk /\\ live h sgnt)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_verify_hashed msgHash pk sgnt =\n let b = K256.ecdsa_verify_hashed_msg msgHash pk sgnt in\n\n C.String.print (C.String.of_literal \"\\n Test K256 ecdsa verification: \");\n if b then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l)", "val mk_ext_g_pow2_192: unit -> StackInline (lbuffer uint64 20ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 ext_g_pow2_192_lseq)\nlet mk_ext_g_pow2_192 () =\n createL ext_g_pow2_192_list", "val mk_proj_g_pow2_192: unit -> StackInline (lbuffer uint64 15ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_192_lseq)\nlet mk_proj_g_pow2_192 () =\n createL proj_g_pow2_192_list", "val mk_ext_g_pow2_128: unit -> StackInline (lbuffer uint64 20ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 ext_g_pow2_128_lseq)\nlet mk_ext_g_pow2_128 () =\n createL ext_g_pow2_128_list", "val mk_proj_g_pow2_64: unit -> StackInline (lbuffer uint64 12ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_64_lseq)\nlet mk_proj_g_pow2_64 () =\n createL proj_g_pow2_64_list", "val secp256k1_ecdsa_is_signature_normalized: signature: lbytes 64ul -> Stack bool\n (requires fun h -> live h signature)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n b == S.secp256k1_ecdsa_is_signature_normalized (as_seq h0 signature))\nlet secp256k1_ecdsa_is_signature_normalized signature =\n push_frame ();\n let s_q = create_qelem () in\n let s = sub signature 32ul 32ul in\n let is_s_valid = load_qelem_vartime s_q s in\n let is_s_lt_q_halved = is_qelem_le_q_halved_vartime s_q in\n pop_frame ();\n is_s_valid && is_s_lt_q_halved", "val mk_proj_g_pow2_128: unit -> StackInline (lbuffer uint64 15ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_128_lseq)\nlet mk_proj_g_pow2_128 () =\n createL proj_g_pow2_128_list", "val load_point_vartime: res:point -> b:lbuffer uint8 64ul -> Stack bool\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 r h1 -> modifies (loc res) h0 h1 /\\\n (let ps = S.load_point (as_seq h0 b) in\n (r <==> Some? ps) /\\ (r ==> (point_inv h1 res /\\\n from_mont_point (as_point_nat h1 res) == Some?.v ps))))\nlet load_point_vartime p b =\n push_frame ();\n let p_aff = create_aff_point () in\n let res = aff_point_load_vartime p_aff b in\n if res then to_proj_point p p_aff;\n pop_frame ();\n res", "val store_qelem: b:lbuffer uint8 32ul -> f:qelem -> Stack unit\n (requires fun h ->\n live h b /\\ live h f /\\ disjoint f b /\\\n qe_lt_q h f)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == BSeq.nat_to_bytes_be 32 (qas_nat h0 f))\nlet store_qelem b f =\n let h0 = ST.get () in\n Hacl.Spec.Bignum.Convert.bn_to_bytes_be_lemma #U64 32 (as_seq h0 f);\n Hacl.Bignum.Convert.mk_bn_to_bytes_be true 32ul f b", "val load_qelem_modq: f:qelem -> b:lbuffer uint8 32ul -> Stack unit\n (requires fun h ->\n live h f /\\ live h b /\\ disjoint f b)\n (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\\\n qas_nat h1 f == BSeq.nat_from_bytes_be (as_seq h0 b) % S.q /\\\n qe_lt_q h1 f)\nlet load_qelem_modq f b =\n push_frame ();\n let tmp = create_qelem () in\n load_qelem f b;\n copy tmp f;\n modq_short f tmp;\n pop_frame ()", "val mk_proj_g_pow2_192: unit -> StackInline (lbuffer uint64 12ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_192_lseq)\nlet mk_proj_g_pow2_192 () =\n createL proj_g_pow2_192_list", "val load_qelem_check: f:qelem -> b:lbuffer uint8 32ul -> Stack uint64\n (requires fun h ->\n live h f /\\ live h b /\\ disjoint f b)\n (ensures fun h0 m h1 -> modifies (loc f) h0 h1 /\\\n (let b_nat = BSeq.nat_from_bytes_be (as_seq h0 b) in\n qas_nat h1 f == b_nat /\\ (v m = ones_v U64 \\/ v m = 0) /\\\n (v m = ones_v U64) = (0 < b_nat && b_nat < S.q)))\nlet load_qelem_check f b =\n push_frame ();\n let n = create_qelem () in\n make_u64_4 n (make_order_k256 ());\n load_qelem f b;\n\n let h0 = ST.get () in\n let is_zero = is_qelem_zero f in\n assert (v is_zero == (if qas_nat h0 f = 0 then ones_v U64 else 0));\n let is_lt_q = BN.bn_lt_mask qnlimb f n in\n SN.bn_lt_mask_lemma (as_seq h0 f) (as_seq h0 n);\n assert (v is_lt_q == (if qas_nat h0 f < S.q then ones_v U64 else 0));\n let m = logand (lognot is_zero) is_lt_q in\n lognot_lemma is_zero;\n logand_lemma (lognot is_zero) is_lt_q;\n pop_frame ();\n m", "val uints64_to_bytes_le:\n b:lbuffer uint8 16ul\n -> lo:uint64\n -> hi:uint64 ->\n Stack unit\n (requires fun h -> live h b)\n (ensures fun h0 _ h1 ->\n modifies (loc b) h0 h1 /\\\n as_seq h1 b == BSeq.nat_to_bytes_le 16 (v hi * pow2 64 + v lo))\nlet uints64_to_bytes_le b r0 r1 =\n let h0 = ST.get () in\n update_sub_f h0 b 0ul 8ul\n (fun h -> BSeq.uint_to_bytes_le #U64 r0)\n (fun _ -> uint_to_bytes_le (sub b 0ul 8ul) r0);\n let h1 = ST.get () in\n update_sub_f h1 b 8ul 8ul\n (fun h -> BSeq.uint_to_bytes_le #U64 r1)\n (fun _ -> uint_to_bytes_le (sub b 8ul 8ul) r1);\n //uint_to_bytes_le (sub b 0ul 8ul) r0;\n //uint_to_bytes_le (sub b 8ul 8ul) r1;\n let h2 = ST.get () in\n uints64_to_bytes_le_lemma r0 r1;\n LSeq.eq_intro (LSeq.sub (as_seq h2 b) 0 8) (BSeq.uint_to_bytes_le #U64 r0);\n LSeq.lemma_concat2\n 8 (BSeq.uint_to_bytes_le #U64 r0)\n 8 (BSeq.uint_to_bytes_le #U64 r1) (as_seq h2 b)", "val mk_proj_g_pow2_128: unit -> StackInline (lbuffer uint64 12ul)\n (requires fun _ -> True)\n (ensures fun h0 b h1 -> live h1 b /\\ stack_allocated b h0 h1 proj_g_pow2_128_lseq)\nlet mk_proj_g_pow2_128 () =\n createL proj_g_pow2_128_list", "val secret_to_public:\n pub:lbuffer uint8 32ul\n -> priv:lbuffer uint8 32ul\n -> Stack unit\n (requires fun h0 ->\n live h0 pub /\\ live h0 priv /\\ disjoint pub priv)\n (ensures fun h0 _ h1 -> modifies (loc pub) h0 h1 /\\\n as_seq h1 pub == Spec.Curve25519.secret_to_public (as_seq h0 priv))\nlet secret_to_public pub priv =\n if EverCrypt.TargetConfig.hacl_can_compile_vale then\n let has_bmi2 = EverCrypt.AutoConfig2.has_bmi2 () in\n let has_adx = EverCrypt.AutoConfig2.has_adx () in\n if (has_bmi2 && has_adx) then\n Hacl.Curve25519_64.secret_to_public pub priv\n else\n Hacl.Curve25519_51.secret_to_public pub priv\n else\n Hacl.Curve25519_51.secret_to_public pub priv", "val lbuffers_uint_eq :\n #t:inttype{unsigned t /\\ t <> U1}\n -> #l:secrecy_level\n -> #len:size_t\n -> b1:lbuffer (uint_t t l) len\n -> b2:lbuffer (uint_t t l) len ->\n Stack bool\n (requires (fun h ->\n live h b1 /\\ live h b2))\n (ensures (fun h0 b h1 ->\n modifies0 h0 h1 /\\\n (b <==> Seq.equal (as_seq h0 b1) (as_seq h0 b2))))\nlet lbuffers_uint_eq #t #l #len b1 b2 =\n let h0 = ST.get () in\n push_frame ();\n let accp = B.alloca (zeros t l) 1ul in\n lbuffers_uint_eq_aux b1 b2 accp;\n let r = B.index accp 0ul in\n pop_frame ();\n uint_is_zero r", "val secret_to_public:\n public_key:lbuffer uint8 32ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\\\n as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key))\nlet secret_to_public public_key private_key =\n Hacl.Ed25519.secret_to_public public_key private_key", "val secret_to_public:\n public_key:lbuffer uint8 32ul\n -> private_key:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h ->\n live h public_key /\\ live h private_key /\\ disjoint public_key private_key)\n (ensures fun h0 _ h1 -> modifies (loc public_key) h0 h1 /\\\n as_seq h1 public_key == Spec.Ed25519.secret_to_public (as_seq h0 private_key))\nlet secret_to_public public_key private_key =\n push_frame ();\n let expanded_secret = create 64ul (u8 0) in\n secret_expand expanded_secret private_key;\n let a = sub expanded_secret 0ul 32ul in\n Hacl.Impl.Ed25519.Sign.point_mul_g_compress public_key a;\n pop_frame ()", "val store_state:\n b:lbuffer uint8 64ul\n -> st:state ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == Lib.ByteSequence.uints_to_bytes_le (as_seq h0 st))\nlet store_state st b =\n uints_to_bytes_le 16ul st b", "val store_state:\n b:lbuffer uint8 64ul\n -> st:state ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == Lib.ByteSequence.uints_to_bytes_le (as_seq h0 st))\nlet store_state st b =\n uints_to_bytes_le 16ul st b", "val load_qelem_conditional: res:felem -> b:lbuffer uint8 32ul -> Stack uint64\n (requires fun h ->\n live h res /\\ live h b /\\ disjoint res b)\n (ensures fun h0 m h1 -> modifies (loc res) h0 h1 /\\\n (let b_nat = BSeq.nat_from_bytes_be (as_seq h0 b) in\n let is_b_valid = 0 < b_nat && b_nat < S.order in\n (v m = ones_v U64 \\/ v m = 0) /\\ (v m = ones_v U64) = is_b_valid /\\\n as_nat h1 res == (if is_b_valid then b_nat else 1)))\nlet load_qelem_conditional res b =\n push_frame ();\n bn_from_bytes_be4 res b;\n let is_b_valid = bn_is_lt_order_and_gt_zero_mask4 res in\n\n let oneq = create_felem () in\n bn_set_one4 oneq;\n let h0 = ST.get () in\n Lib.ByteBuffer.buf_mask_select res oneq is_b_valid res;\n let h1 = ST.get () in\n assert (as_seq h1 res == (if (v is_b_valid = 0) then as_seq h0 oneq else as_seq h0 res));\n pop_frame ();\n is_b_valid", "val check_bound: b:Lib.Buffer.lbuffer uint8 32ul -> Stack bool\n (requires fun h -> Lib.Buffer.live h b)\n (ensures fun h0 r h1 ->\n h0 == h1 /\\\n r == \n (\n\t(Lib.ByteSequence.nat_from_bytes_be (Lib.Buffer.as_seq h0 b) > 0) &&\n\t(Lib.ByteSequence.nat_from_bytes_be (Lib.Buffer.as_seq h0 b) <\n Spec.P256.order)))\nlet check_bound b =\n let open FStar.Mul in\n let open Lib.ByteSequence in\n let open Spec.P256 in\n [@inline_let]\n let q1 = normalize_term (order % pow2 64) in \n [@inline_let]\n let q2 = normalize_term ((order / pow2 64) % pow2 64) in\n [@inline_let]\n let q3 = normalize_term ((order / pow2 128) % pow2 64) in\n [@inline_let]\n let q4 = normalize_term (((order / pow2 128) / pow2 64) % pow2 64) in\n assert_norm (pow2 128 * pow2 64 == pow2 192);\n assert (order == q1 + pow2 64 * q2 + pow2 128 * q3 + pow2 192 * q4); \n\n let zero = mk_int #U64 #PUB 0 in\n \n let q1 = mk_int #U64 #PUB q1 in\n let q2 = mk_int #U64 #PUB q2 in\n let q3 = mk_int #U64 #PUB q3 in\n let q4 = mk_int #U64 #PUB q4 in\n\n let h0 = get () in\n let x1 = Lib.ByteBuffer.uint_from_bytes_be #U64 (Lib.Buffer.sub b 0ul 8ul) in\n let x2 = Lib.ByteBuffer.uint_from_bytes_be #U64 (Lib.Buffer.sub b 8ul 8ul) in\n let x3 = Lib.ByteBuffer.uint_from_bytes_be #U64 (Lib.Buffer.sub b 16ul 8ul) in\n let x4 = Lib.ByteBuffer.uint_from_bytes_be #U64 (Lib.Buffer.sub b 24ul 8ul) in\n\n nat_from_intseq_be_slice_lemma (Lib.Buffer.as_seq h0 b) 8;\n lemma_reveal_uint_to_bytes_be #U64 (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 0 8);\n\n nat_from_intseq_be_slice_lemma (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 8 32) 8;\n lemma_reveal_uint_to_bytes_be #U64 (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 8 16);\n\n nat_from_intseq_be_slice_lemma (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 16 32) 8;\n lemma_reveal_uint_to_bytes_be #U64 (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 16 24);\n\n nat_from_intseq_be_slice_lemma (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 24 32) 8;\n lemma_reveal_uint_to_bytes_be #U64 (Lib.Sequence.slice (Lib.Buffer.as_seq h0 b) 24 32);\n\n let x1 = Lib.RawIntTypes.u64_to_UInt64 x1 in\n let x2 = Lib.RawIntTypes.u64_to_UInt64 x2 in\n let x3 = Lib.RawIntTypes.u64_to_UInt64 x3 in\n let x4 = Lib.RawIntTypes.u64_to_UInt64 x4 in \n\n let r = x1 <. q4 || (x1 =. q4 &&\n (x2 <. q3 || (x2 =. q3 &&\n (x3 <. q2 || (x3 =. q2 && x4 <. q1))))) in \n\n let r1 = x1 = zero && x2 = zero && x3 = zero && x4 = zero in \n r && not r1", "val poly1305_encode_r:\n #s:field_spec\n -> p:precomp_r s\n -> b:lbuffer uint8 16ul ->\n Stack unit\n (requires fun h ->\n live h b /\\ live h p /\\ disjoint b p)\n (ensures fun h0 _ h1 ->\n modifies (loc p) h0 h1 /\\\n F32xN.load_precompute_r_post #(width s) h1 p /\\\n (feval h1 (gsub p 0ul 5ul)).[0] == S.poly1305_encode_r (as_seq h0 b))\nlet poly1305_encode_r #s p b =\n let lo = uint_from_bytes_le (sub b 0ul 8ul) in\n let hi = uint_from_bytes_le (sub b 8ul 8ul) in\n let mask0 = u64 0x0ffffffc0fffffff in\n let mask1 = u64 0x0ffffffc0ffffffc in\n let lo = lo &. mask0 in\n let hi = hi &. mask1 in\n load_precompute_r p lo hi", "val box_open_easy:\n mlen:size_t{v mlen + 16 <= max_size_t}\n -> m:lbuffer uint8 mlen\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul\n -> n:lbuffer uint8 24ul\n -> c:lbuffer uint8 (mlen +! 16ul) ->\n Stack size_t\n (requires fun h ->\n live h c /\\ live h m /\\ live h pk /\\ live h sk /\\ live h n /\\\n disjoint m c /\\ disjoint m n /\\ disjoint c n)\n (ensures fun h0 r h1 -> modifies (loc m) h0 h1 /\\\n (let msg = Spec.box_open_easy (as_seq h0 pk) (as_seq h0 sk) (as_seq h0 n) (as_seq h0 c) in\n match r with\n | 0ul -> Some? msg /\\ as_seq h1 m == Some?.v msg\n | _ -> None? msg))\nlet box_open_easy mlen m pk sk n c =\n let tag = sub c 0ul 16ul in\n let cip = sub c 16ul mlen in\n box_open_detached mlen m pk sk n cip tag", "val load_qelem: f:qelem -> b:lbuffer uint8 32ul -> Stack unit\n (requires fun h ->\n live h f /\\ live h b /\\ disjoint f b)\n (ensures fun h0 _ h1 -> modifies (loc f) h0 h1 /\\\n qas_nat h1 f == BSeq.nat_from_bytes_be (as_seq h0 b))\nlet load_qelem f b =\n let h0 = ST.get () in\n Hacl.Spec.Bignum.Convert.bn_from_bytes_be_lemma #U64 32 (as_seq h0 b);\n Hacl.Bignum.Convert.mk_bn_from_bytes_be true 32ul b f", "val lbytes_eq: #n:size_t -> b1:buffer uint8 -> b2:buffer uint8 -> Stack bool\n (requires fun h -> len b1 == n /\\ len b2 == n /\\ live h b1 /\\ live h b2)\n (ensures fun h0 r h1 -> \n modifies loc_none h0 h1 /\\ \n (r <==> Seq.equal (as_seq h0 b1) (as_seq h0 b2)))\nlet lbytes_eq #n b1 b2 =\n let open LowStar.BufferOps in\n let h0 = get() in\n let inv h i b =\n modifies loc_none h0 h /\\\n i <= U32.v n /\\\n (if b then \n 0 < i /\\ Seq.index (as_seq h0 b1) (i-1) <> Seq.index (as_seq h0 b2) (i-1)\n else\n forall (j:nat).j < i ==> Seq.index (as_seq h0 b1) j == Seq.index (as_seq h0 b2) j)\n in\n let _, b = C.Loops.interruptible_for 0ul n inv (fun i -> b1.(i) <> b2.(i)) in\n not b", "val load_state:\n st:state\n -> b:lbuffer uint8 64ul ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\\\n as_seq h1 st == Lib.ByteSequence.uints_from_bytes_le (as_seq h0 b))\nlet load_state st b =\n uints_from_bytes_le st b", "val load_state:\n st:state\n -> b:lbuffer uint8 64ul ->\n Stack unit\n (requires fun h -> live h st /\\ live h b /\\ disjoint st b)\n (ensures fun h0 _ h1 -> modifies (loc st) h0 h1 /\\\n as_seq h1 st == Lib.ByteSequence.uints_from_bytes_le (as_seq h0 b))\nlet load_state st b =\n uints_from_bytes_le st b", "val load_felem_lt_prime_vartime: f:felem -> b:lbuffer uint8 32ul -> Stack bool\n (requires fun h ->\n live h f /\\ live h b /\\ disjoint f b)\n (ensures fun h0 m h1 -> modifies (loc f) h0 h1 /\\\n (let b_nat = BSeq.nat_from_bytes_be (as_seq h0 b) in\n as_nat h1 f == b_nat /\\ m = (b_nat < S.prime) /\\\n inv_lazy_reduced1 h1 f))\nlet load_felem_lt_prime_vartime f b =\n load_felem f b;\n let h0 = ST.get () in\n let is_ge_p = BI.is_felem_ge_prime_vartime5 (f.(0ul),f.(1ul),f.(2ul),f.(3ul),f.(4ul)) in\n BL.is_felem_ge_prime_vartime5_lemma (as_felem5 h0 f);\n not is_ge_p", "val ecdsa_verification_cmpr: r:felem -> pk:point -> u1:felem -> u2:felem -> Stack bool\n (requires fun h ->\n live h r /\\ live h pk /\\ live h u1 /\\ live h u2 /\\\n disjoint r u1 /\\ disjoint r u2 /\\ disjoint r pk /\\\n disjoint pk u1 /\\ disjoint pk u2 /\\\n point_inv h pk /\\ as_nat h u1 < S.order /\\ as_nat h u2 < S.order /\\\n 0 < as_nat h r /\\ as_nat h r < S.order)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let _X, _Y, _Z = S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2)\n (from_mont_point (as_point_nat h0 pk)) in\n b <==> (if S.is_point_at_inf (_X, _Y, _Z) then false\n else S.fmul _X (S.finv _Z) % S.order = as_nat h0 r)))\nlet ecdsa_verification_cmpr r pk u1 u2 =\n push_frame ();\n let res = create_point () in\n let h0 = ST.get () in\n point_mul_double_g res u1 u2 pk;\n let h1 = ST.get () in\n assert (S.to_aff_point (from_mont_point (as_point_nat h1 res)) ==\n S.to_aff_point (S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2)\n (from_mont_point (as_point_nat h0 pk))));\n\n SL.lemma_aff_is_point_at_inf (from_mont_point (as_point_nat h1 res));\n SL.lemma_aff_is_point_at_inf\n (S.point_mul_double_g (as_nat h0 u1) (as_nat h0 u2) (from_mont_point (as_point_nat h0 pk)));\n\n let b =\n if is_point_at_inf_vartime res then false\n else ecdsa_verify_finv res r in\n pop_frame ();\n b", "val point_mul_g_compress (out s:lbuffer uint8 32ul) : Stack unit\n (requires fun h ->\n live h out /\\ live h s /\\ disjoint s out)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n as_seq h1 out == Spec.Ed25519.point_compress (Spec.Ed25519.point_mul_g (as_seq h0 s)))\nlet point_mul_g_compress out s =\n push_frame ();\n let tmp = create 20ul (u64 0) in\n Hacl.Impl.Ed25519.Ladder.point_mul_g tmp s;\n Hacl.Impl.Ed25519.PointCompress.point_compress out tmp;\n pop_frame ()", "val lbytes_eq: #len:size_t -> b1:lbuffer uint8 len -> b2:lbuffer uint8 len -> Stack bool\n (requires fun h -> live h b1 /\\ live h b2)\n (ensures fun h0 r h1 -> modifies0 h0 h1 /\\ r == BS.lbytes_eq (as_seq h0 b1) (as_seq h0 b2))\nlet lbytes_eq #len b1 b2 =\n push_frame();\n let res = create 1ul (u8 255) in\n let z = buf_eq_mask b1 b2 len res in\n pop_frame();\n Raw.u8_to_UInt8 z = 255uy", "val is_point_valid: b:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h b)\n (ensures fun h0 res h1 -> modifies0 h0 h1 /\\\n res <==> (S.point_inv_bytes (as_seq h0 b)))\nlet is_point_valid b =\n push_frame ();\n let p = P.create_aff_point () in\n let res = P.aff_point_load_vartime p b in\n pop_frame ();\n res", "val ecdsa_verify_cmpr: r:QA.qelem -> pk:point -> u1:QA.qelem -> u2:QA.qelem -> Stack bool\n (requires fun h ->\n live h r /\\ live h pk /\\ live h u1 /\\ live h u2 /\\\n disjoint r u1 /\\ disjoint r u2 /\\ disjoint r pk /\\\n disjoint pk u1 /\\ disjoint pk u2 /\\\n point_inv h pk /\\ QA.qas_nat h u1 < S.q /\\ QA.qas_nat h u2 < S.q /\\\n 0 < QA.qas_nat h r /\\ QA.qas_nat h r < S.q)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n (let _X, _Y, _Z = S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk) in\n b <==> (if S.is_proj_point_at_inf (_X, _Y, _Z) then false\n else S.fmul _X (S.finv _Z) % S.q = QA.qas_nat h0 r)))\nlet ecdsa_verify_cmpr r pk u1 u2 =\n push_frame ();\n let res = create_point () in\n let h0 = ST.get () in\n point_mul_g_double_split_lambda_vartime res u1 u2 pk;\n let h1 = ST.get () in\n assert (S.to_aff_point (point_eval h1 res) ==\n S.to_aff_point (S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk)));\n\n KL.lemma_aff_is_point_at_inf (point_eval h1 res);\n KL.lemma_aff_is_point_at_inf (S.point_mul_double_g (QA.qas_nat h0 u1) (QA.qas_nat h0 u2)\n (point_eval h0 pk));\n\n let b =\n if is_proj_point_at_inf_vartime res then false\n else ecdsa_verify_avoid_finv res r in\n pop_frame ();\n b", "val uints64_from_bytes_le: b:lbuffer uint8 16ul ->\n Stack (uint64 & uint64)\n (requires fun h -> live h b)\n (ensures fun h0 (lo, hi) h1 -> h0 == h1 /\\\n v hi * pow2 64 + v lo == BSeq.nat_from_bytes_le (as_seq h0 b))\nlet uints64_from_bytes_le b =\n let h0 = ST.get () in\n let lo = uint_from_bytes_le #U64 (sub b 0ul 8ul) in\n let hi = uint_from_bytes_le #U64 (sub b 8ul 8ul) in\n uint_from_bytes_le_lemma (as_seq h0 b);\n lo, hi", "val box_detached:\n mlen:size_t\n -> c:lbuffer uint8 mlen\n -> tag:lbuffer uint8 16ul\n -> sk:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> n:lbuffer uint8 24ul\n -> m:lbuffer uint8 mlen ->\n Stack size_t\n (requires fun h ->\n live h c /\\ live h m /\\ live h sk /\\ live h pk /\\ live h n /\\ live h tag /\\\n disjoint tag c /\\ disjoint tag m /\\ eq_or_disjoint m c /\\ disjoint n m /\\ disjoint n c)\n (ensures fun h0 r h1 ->\n modifies (loc c |+| loc tag) h0 h1 /\\\n (let tag_cipher = Spec.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq h0 m) in\n match r with\n | 0ul -> Some? tag_cipher /\\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq h1 c) == (tag_s, cipher_s))\n | _ -> None? tag_cipher))\nlet box_detached mlen c tag sk pk n m =\n push_frame();\n let k = create 32ul (u8 0) in\n let r = box_beforenm k pk sk in\n let res =\n if r =. size 0 then\n box_detached_afternm mlen c tag k n m\n else 0xfffffffful in\n pop_frame ();\n res", "val aff_point_decompress_vartime (x y:felem) (s:lbuffer uint8 33ul) : Stack bool\n (requires fun h ->\n live h x /\\ live h y /\\ live h s /\\\n disjoint x y /\\ disjoint x s /\\ disjoint y s)\n (ensures fun h0 b h1 -> modifies (loc x |+| loc y) h0 h1 /\\\n (b <==> Some? (S.aff_point_decompress (as_seq h0 s))) /\\\n (b ==> (let (xa, ya) = Some?.v (S.aff_point_decompress (as_seq h0 s)) in\n as_nat h1 x < S.prime /\\ as_nat h1 y < S.prime /\\ as_nat h1 x == xa /\\ as_nat h1 y == ya)))\nlet aff_point_decompress_vartime x y s =\n let s0 = s.(0ul) in\n let s0 = Lib.RawIntTypes.u8_to_UInt8 s0 in\n if not (s0 = 0x02uy || s0 = 0x03uy) then false\n else begin\n let xb = sub s 1ul 32ul in\n bn_from_bytes_be4 x xb;\n let is_x_valid = bn_is_lt_prime_mask4 x in\n let is_x_valid = Hacl.Bignum.Base.unsafe_bool_of_limb is_x_valid in\n let is_y_odd = s0 = 0x03uy in\n\n if not is_x_valid then false\n else recover_y_vartime y x is_y_odd end", "val is_public_key_valid: public_key:lbytes 64ul -> Stack bool\n (requires fun h -> live h public_key)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n b <==> S.validate_public_key (as_seq h0 public_key))\nlet is_public_key_valid public_key =\n push_frame ();\n let p = P.create_point () in\n let is_pk_valid = P.load_point_vartime p public_key in\n pop_frame ();\n is_pk_valid", "val felem_load: b:lbuffer uint8 32ul -> out:F.felem -> Stack unit\n (requires fun h -> live h b /\\ live h out /\\ disjoint b out)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F.inv_lazy_reduced2 h1 out /\\\n F.feval h1 out == BSeq.nat_from_bytes_be (as_seq h0 b) % S.prime)\nlet felem_load b out =\n F.load_felem out b", "val box_easy:\n mlen:size_t{v mlen + 16 <= max_size_t}\n -> c:lbuffer uint8 (mlen +! 16ul)\n -> sk:lbuffer uint8 32ul\n -> pk:lbuffer uint8 32ul\n -> n:lbuffer uint8 24ul\n -> m:lbuffer uint8 mlen ->\n Stack size_t\n (requires fun h ->\n live h c /\\ live h m /\\ live h pk /\\ live h sk /\\ live h n /\\\n disjoint m c /\\ disjoint n m /\\ disjoint n c)\n (ensures fun h0 r h1 -> modifies (loc c) h0 h1 /\\\n (let cipher = Spec.box_easy (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq h0 m) in\n match r with\n | 0ul -> Some? cipher /\\ as_seq h1 c == Some?.v cipher\n | _ -> None? cipher))\nlet box_easy mlen c sk pk n m =\n let tag = sub c 0ul 16ul in\n let cip = sub c 16ul mlen in\n let res = box_detached mlen cip tag sk pk n m in\n let h1 = ST.get () in\n FStar.Seq.Properties.lemma_split (as_seq h1 c) 16;\n res", "val bn_from_bytes_be4: res:felem -> b:lbuffer uint8 32ul -> Stack unit\n (requires fun h -> live h b /\\ live h res /\\ disjoint b res)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n as_nat h1 res == BSeq.nat_from_bytes_be (as_seq h0 b))\nlet bn_from_bytes_be4 res b =\n let h0 = ST.get () in\n Hacl.Spec.Bignum.Convert.bn_from_bytes_be_lemma #U64 32 (as_seq h0 b);\n Hacl.Bignum.Convert.mk_bn_from_bytes_be true 32ul b res", "val crypto_box_detached:\n c:buffer uint8\n -> tag:lbuffer uint8 16ul\n -> m:buffer uint8\n -> mlen:size_t{length c = v mlen /\\ length m = v mlen}\n -> n:lbuffer uint8 24ul\n -> pk:lbuffer uint8 32ul\n -> sk:lbuffer uint8 32ul ->\n Stack size_t\n (requires fun h ->\n live h c /\\ live h m /\\ live h sk /\\ live h pk /\\ live h n /\\ live h tag /\\\n disjoint tag c /\\ eq_or_disjoint (m <: lbuffer uint8 mlen) (c <: lbuffer uint8 mlen) /\\\n disjoint tag m /\\ disjoint n m /\\ disjoint n c)\n (ensures fun h0 r h1 -> modifies2 c tag h0 h1 /\\\n (let tag_cipher = SB.box_detached (as_seq h0 sk) (as_seq h0 pk) (as_seq h0 n) (as_seq #MUT #uint8 #mlen h0 m) in\n match r with\n | 0ul -> Some? tag_cipher /\\ (let (tag_s, cipher_s) = Some?.v tag_cipher in (as_seq h1 tag, as_seq #MUT #uint8 #mlen h1 c) == (tag_s, cipher_s))\n | _ -> None? tag_cipher))\nlet crypto_box_detached c tag m mlen n pk sk =\n Hacl.Impl.Box.box_detached mlen c tag sk pk n m", "val load_32_bytes:\n out:lbuffer uint64 5ul\n -> b:lbuffer uint8 32ul ->\n Stack unit\n (requires fun h -> live h out /\\ live h b)\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n F56.as_nat h1 out == nat_from_bytes_le (as_seq h0 b) /\\\n F56.qelem_fits h1 out (1, 1, 1, 1, 1)\n )\nlet load_32_bytes out b =\n let h0 = ST.get() in\n let b0 = hload56_le' b 0ul in\n let b1 = hload56_le' b 7ul in\n let b2 = hload56_le' b 14ul in\n let b3 = hload56_le' b 21ul in\n let b4 = uint_from_bytes_le #U32 (sub b 28ul 4ul) in\n let b4 = to_u64 b4 in\n lemma_reveal_uint_to_bytes_le #U32 (as_seq h0 (gsub b 28ul 4ul));\n lemma_load_32_bytes (as_seq h0 b) b0 b1 b2 b3 b4;\n Hacl.Bignum25519.make_u64_5 out b0 b1 b2 b3 b4", "val test_verify_sha256:\n msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> pk:lbuffer uint8 64ul\n -> sgnt:lbuffer uint8 64ul\n -> Stack unit\n (requires fun h -> live h msg /\\ live h pk /\\ live h sgnt)\n (ensures fun h0 r h1 -> modifies0 h0 h1)\nlet test_verify_sha256 msg_len msg pk sgnt =\n let b = K256.ecdsa_verify_sha256 msg_len msg pk sgnt in\n\n C.String.print (C.String.of_literal \"\\n Test K256 ecdsa verification: \");\n if b then C.String.print (C.String.of_literal \"Success!\\n\")\n else (C.String.print (C.String.of_literal \"Failure :(\\n\"); C.exit 255l)", "val verify:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul ->\n Stack bool\n (requires fun h -> live h public_key /\\ live h msg /\\ live h signature)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n b == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify public_key msg_len msg signature =\n Hacl.Impl.Ed25519.Verify.verify public_key msg_len msg signature", "val verify:\n public_key:lbuffer uint8 32ul\n -> msg_len:size_t\n -> msg:lbuffer uint8 msg_len\n -> signature:lbuffer uint8 64ul ->\n Stack bool\n (requires fun h -> live h public_key /\\ live h msg /\\ live h signature)\n (ensures fun h0 b h1 -> modifies0 h0 h1 /\\\n b == Spec.Ed25519.verify (as_seq h0 public_key) (as_seq h0 msg) (as_seq h0 signature))\nlet verify public_key msg_len msg signature =\n Hacl.Ed25519.verify public_key msg_len msg signature", "val aff_point_decompress_vartime (x y:felem) (s:lbuffer uint8 33ul) : Stack bool\n (requires fun h ->\n live h x /\\ live h y /\\ live h s /\\\n disjoint x y /\\ disjoint x s /\\ disjoint y s)\n (ensures fun h0 b h1 -> modifies (loc x |+| loc y) h0 h1 /\\\n (b <==> Some? (S.aff_point_decompress (as_seq h0 s))) /\\\n (b ==> (let (xa, ya) = Some?.v (S.aff_point_decompress (as_seq h0 s)) in\n inv_fully_reduced h1 x /\\ inv_fully_reduced h1 y /\\ feval h1 x == xa /\\ feval h1 y == ya)))\nlet aff_point_decompress_vartime x y s =\n let s0 = s.(0ul) in\n let s0 = Lib.RawIntTypes.u8_to_UInt8 s0 in\n if not (s0 = 0x02uy || s0 = 0x03uy) then false\n else begin\n let xb = sub s 1ul 32ul in\n let is_x_valid = load_felem_lt_prime_vartime x xb in\n let is_y_odd = s0 = 0x03uy in\n\n if not is_x_valid then false\n else recover_y_vartime y x is_y_odd end", "val store_felem: b:lbuffer uint8 32ul -> f:felem -> Stack unit\n (requires fun h ->\n live h b /\\ live h f /\\ disjoint f b /\\\n inv_fully_reduced h f)\n (ensures fun h0 _ h1 -> modifies (loc b) h0 h1 /\\\n as_seq h1 b == BSeq.nat_to_bytes_be 32 (as_nat h0 f))\nlet store_felem b f =\n push_frame ();\n let tmp = create 4ul (u64 0) in\n let h0 = ST.get () in\n make_u64_4 tmp (BI.store_felem5 (f.(0ul),f.(1ul),f.(2ul),f.(3ul),f.(4ul)));\n let h1 = ST.get () in\n BL.store_felem5_lemma (as_felem5 h0 f);\n assert (as_nat4 (as_felem4 h1 tmp) == as_nat5 (as_felem5 h0 f));\n BDL.unfold_nat_from_uint64_four (as_seq h1 tmp);\n BSeq.lemma_nat_from_to_intseq_be_preserves_value 4 (as_seq h1 tmp);\n assert (BSeq.nat_to_intseq_be 4 (BSeq.nat_from_intseq_be (as_seq h1 tmp)) == as_seq h1 tmp);\n assert (BSeq.nat_to_intseq_be 4 (as_nat5 (as_felem5 h0 f)) == as_seq h1 tmp);\n uints_to_bytes_be 4ul b tmp;\n let h2 = ST.get () in\n assert (as_seq h2 b == BSeq.uints_to_bytes_be (as_seq h1 tmp));\n assert (as_seq h2 b == BSeq.uints_to_bytes_be #_ #_ #4 (BSeq.nat_to_intseq_be #U64 4 (as_nat5 (as_felem5 h0 f))));\n BSeq.uints_to_bytes_be_nat_lemma #U64 #SEC 4 (as_nat5 (as_felem5 h0 f));\n pop_frame ()", "val point_load: b:lbuffer uint8 64ul -> out:P.point -> Stack unit\n (requires fun h ->\n live h out /\\ live h b /\\ disjoint b out /\\\n S.point_inv_bytes (as_seq h b))\n (ensures fun h0 _ h1 -> modifies (loc out) h0 h1 /\\\n P.point_inv h1 out /\\\n P.point_eval h1 out == S.load_point_nocheck (as_seq h0 b))\nlet point_load b out =\n P.load_point_nocheck out b", "val from_bytes (b: bytes{length b <> 0})\n : StackInline uint8_p\n (requires (fun h0 -> True))\n (ensures\n (fun h0 buf h1 ->\n LB.(modifies loc_none h0 h1) /\\ LB.live h1 buf /\\ LB.unused_in buf h0 /\\\n LB.length buf = length b /\\ (Bytes.reveal b) `Seq.equal` (LB.as_seq h1 buf)))\nlet from_bytes (b:bytes{length b <> 0}) : StackInline uint8_p\n (requires (fun h0 -> True))\n (ensures (fun h0 buf h1 ->\n LB.(modifies loc_none h0 h1) /\\\n LB.live h1 buf /\\\n LB.unused_in buf h0 /\\\n LB.length buf = length b /\\\n Bytes.reveal b `Seq.equal` LB.as_seq h1 buf))\n =\n let h0 = get () in\n let len = FStar.UInt32.uint_to_t (length b) in\n let lb = LB.alloca 0uy len in\n FStar.Bytes.store_bytes b lb;\n let h1 = get () in\n LB.(modifies_only_not_unused_in loc_none h0 h1);\n lb" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.raw_to_compressed" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.raw_to_uncompressed" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_compressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.public_key_uncompressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Compression.fst", "name": "Hacl.Impl.P256.Compression.raw_to_compressed_get_pk0" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_public_key_compressed" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_public_key_uncompressed" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Box.fst", "name": "Hacl.Impl.Box.box_beforenm" }, { "project_name": "hacl-star", "file_name": "Hacl.NaCl.fst", "name": "Hacl.NaCl.crypto_box_beforenm" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_secret_to_public" }, { "project_name": "hacl-star", "file_name": "Spec.K256.fst", "name": "Spec.K256.pk_compressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Spec.P256.fst", "name": "Spec.P256.pk_compressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_decompress" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test_secret_to_public" }, { "project_name": "hacl-star", "file_name": "Spec.K256.fst", "name": "Spec.K256.pk_compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Spec.P256.fst", "name": "Spec.P256.pk_compressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.secp256k1_ecdsa_signature_normalize" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_valid_pk" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_sb" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.Ed25519.fst", "name": "Hacl.EC.Ed25519.point_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Verify.fst", "name": "Hacl.Impl.Ed25519.Verify.verify_valid_pk_rs" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDecompress.fst", "name": "Hacl.Impl.Ed25519.PointDecompress.point_decompress_" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Store56.fst", "name": "Hacl.Impl.Store56.store_56" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointDecompress.fst", "name": "Hacl.Impl.Ed25519.PointDecompress.point_decompress" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test_verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.DH.fst", "name": "Hacl.Impl.P256.DH.ecp256dh_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.aff_point_load_vartime" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Ed25519.fst", "name": "EverCrypt.Ed25519.expand_keys" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.expand_keys" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.secret_expand" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.PointCompress.fst", "name": "Hacl.Impl.Ed25519.PointCompress.point_compress" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.load_qelem_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.aff_point_load_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fst", "name": "Hacl.Ed25519.PrecompTable.mk_ext_g_pow2_64" }, { "project_name": "hacl-star", "file_name": "Spec.P256.fst", "name": "Spec.P256.pk_uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Spec.K256.fst", "name": "Spec.K256.pk_uncompressed_to_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.load_qelem_conditional" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.Ed25519.fst", "name": "Hacl.Test.Ed25519.test" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Ladder.fst", "name": "Hacl.Impl.Ed25519.Ladder.convert_scalar" }, { "project_name": "hacl-star", "file_name": "Spec.P256.fst", "name": "Spec.P256.pk_uncompressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Spec.K256.fst", "name": "Spec.K256.pk_uncompressed_from_raw" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.load_point_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fst", "name": "Hacl.K256.PrecompTable.mk_proj_g_pow2_64" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.DH.fst", "name": "Hacl.Impl.P256.DH.ecp256dh_r_" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.is_private_key_valid" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_verify_hashed" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fst", "name": "Hacl.Ed25519.PrecompTable.mk_ext_g_pow2_192" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fst", "name": "Hacl.K256.PrecompTable.mk_proj_g_pow2_192" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.PrecompTable.fst", "name": "Hacl.Ed25519.PrecompTable.mk_ext_g_pow2_128" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fst", "name": "Hacl.P256.PrecompTable.mk_proj_g_pow2_64" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.secp256k1_ecdsa_is_signature_normalized" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.PrecompTable.fst", "name": "Hacl.K256.PrecompTable.mk_proj_g_pow2_128" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.load_point_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.store_qelem" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.load_qelem_modq" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fst", "name": "Hacl.P256.PrecompTable.mk_proj_g_pow2_192" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.load_qelem_check" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Poly1305.Bignum128.fst", "name": "Hacl.Impl.Poly1305.Bignum128.uints64_to_bytes_le" }, { "project_name": "hacl-star", "file_name": "Hacl.P256.PrecompTable.fst", "name": "Hacl.P256.PrecompTable.mk_proj_g_pow2_128" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Curve25519.fst", "name": "EverCrypt.Curve25519.secret_to_public" }, { "project_name": "noise-star", "file_name": "Impl.Noise.BufferEquality.fst", "name": "Impl.Noise.BufferEquality.lbuffers_uint_eq" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Ed25519.fst", "name": "EverCrypt.Ed25519.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.secret_to_public" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32.fst", "name": "Hacl.Impl.Chacha20.Core32.store_state" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Salsa20.Core32.fst", "name": "Hacl.Impl.Salsa20.Core32.store_state" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Scalar.fst", "name": "Hacl.Impl.P256.Scalar.load_qelem_conditional" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.ECDSA.fst", "name": "Hacl.Test.ECDSA.check_bound" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Poly1305.fst", "name": "Hacl.Impl.Poly1305.poly1305_encode_r" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Box.fst", "name": "Hacl.Impl.Box.box_open_easy" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Scalar.fst", "name": "Hacl.K256.Scalar.load_qelem" }, { "project_name": "merkle-tree", "file_name": "Lib.RawBuffer.fst", "name": "Lib.RawBuffer.lbytes_eq" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Chacha20.Core32.fst", "name": "Hacl.Impl.Chacha20.Core32.load_state" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Salsa20.Core32.fst", "name": "Hacl.Impl.Salsa20.Core32.load_state" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Field.fst", "name": "Hacl.K256.Field.load_felem_lt_prime_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Verify.fst", "name": "Hacl.Impl.P256.Verify.ecdsa_verification_cmpr" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Ed25519.Sign.fst", "name": "Hacl.Impl.Ed25519.Sign.point_mul_g_compress" }, { "project_name": "hacl-star", "file_name": "Lib.ByteBuffer.fst", "name": "Lib.ByteBuffer.lbytes_eq" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.is_point_valid" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Verify.fst", "name": "Hacl.Impl.K256.Verify.ecdsa_verify_cmpr" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Poly1305.Bignum128.fst", "name": "Hacl.Impl.Poly1305.Bignum128.uints64_from_bytes_le" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Box.fst", "name": "Hacl.Impl.Box.box_detached" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Point.fst", "name": "Hacl.Impl.P256.Point.aff_point_decompress_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.ECDSA.fst", "name": "Hacl.K256.ECDSA.is_public_key_valid" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.felem_load" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Box.fst", "name": "Hacl.Impl.Box.box_easy" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.P256.Bignum.fst", "name": "Hacl.Impl.P256.Bignum.bn_from_bytes_be4" }, { "project_name": "hacl-star", "file_name": "Hacl.NaCl.fst", "name": "Hacl.NaCl.crypto_box_detached" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.Load56.fst", "name": "Hacl.Impl.Load56.load_32_bytes" }, { "project_name": "hacl-star", "file_name": "Hacl.Test.K256.fst", "name": "Hacl.Test.K256.test_verify_sha256" }, { "project_name": "hacl-star", "file_name": "Hacl.Ed25519.fst", "name": "Hacl.Ed25519.verify" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Ed25519.fst", "name": "EverCrypt.Ed25519.verify" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.K256.Point.fst", "name": "Hacl.Impl.K256.Point.aff_point_decompress_vartime" }, { "project_name": "hacl-star", "file_name": "Hacl.K256.Field.fst", "name": "Hacl.K256.Field.store_felem" }, { "project_name": "hacl-star", "file_name": "Hacl.EC.K256.fst", "name": "Hacl.EC.K256.point_load" }, { "project_name": "mitls-fstar", "file_name": "MiTLS.AEADProvider.fsti", "name": "MiTLS.AEADProvider.from_bytes" } ], "selected_premises": [ "Hacl.Impl.P256.Point.getx", "Lib.Buffer.lbuffer_t", "Lib.Buffer.lbuffer", "Hacl.Impl.P256.Point.gety", "Hacl.Bignum.Definitions.blocks0", "Lib.Sequence.lseq", "Lib.IntTypes.int_t", "Hacl.Bignum.Definitions.blocks", "Hacl.Spec.Bignum.Definitions.blocks", "Lib.IntTypes.uint_t", "Hacl.Spec.Bignum.Definitions.blocks0", "Lib.NTuple.ntuple", "FStar.Integers.op_Greater_Equals", "Lib.Buffer.gsub", "Hacl.Impl.P256.Point.getz", "Hacl.Bignum.Definitions.lbignum", "FStar.Integers.op_Less_Equals", "Lib.MultiBuffer.as_seq_multi", "FStar.Integers.op_Less", "FStar.Integers.op_Greater", "Hacl.Spec.Bignum.Definitions.lbignum", "Hacl.Bignum.Definitions.bn_v", "LowStar.Buffer.trivial_preorder", "Lib.IntTypes.range", "Hacl.Impl.P256.Bignum.felem", "Spec.P256.PointOps.felem", "Lib.NTuple.flen", "Lib.Sequence.to_seq", "Hacl.Bignum.Definitions.limb", "Spec.P256.PointOps.order", "Lib.Buffer.as_seq", "FStar.Integers.op_Plus", "Hacl.Impl.P256.Point.as_point_nat_seq", "Lib.Sequence.op_String_Access", "Hacl.Spec.Bignum.Base.carry", "Hacl.Impl.P256.Sign.lbytes", "Hacl.Impl.P256.Verify.lbytes", "Spec.P256.PointOps.prime", "Hacl.Impl.P256.Bignum.as_nat", "LowStar.Monotonic.Buffer.length", "FStar.Seq.Properties.seq_of_list", "Lib.MultiBuffer.multibuf", "Hacl.P256.validate_public_key", "Spec.P256.PointOps.proj_point", "Lib.IntTypes.size", "Hacl.Impl.P256.Sign.ecdsa_sign_s", "FStar.Integers.op_Percent", "FStar.Seq.Properties.head", "FStar.Integers.op_Subtraction", "FStar.Int.Cast.uint64_to_uint32", "FStar.UInt.size", "Hacl.Hash.Definitions.m_spec", "Hacl.Impl.P256.Point.as_point_nat", "Spec.SHA2.Constants.k384_512", "FStar.List.Tot.Base.length", "Hacl.Impl.P256.Point.point_seq", "FStar.Seq.Properties.tail", "Lib.Buffer.op_Array_Assignment", "Hacl.P256.validate_private_key", "Hacl.Streaming.MD.hacl_md", "Lib.IntTypes.u64", "Spec.P256.PointOps.base_point", "Lib.Sequence.length", "Lib.MultiBuffer.live_multi", "FStar.Seq.Properties.cons", "Hacl.Spec.Bignum.Definitions.bn_v", "Lib.Buffer.op_Array_Access", "Lib.NTuple.ntuple_", "Hacl.Impl.P256.Point.point_inv_seq", "FStar.Integers.op_Slash", "Spec.P256.PointOps.qelem", "Spec.P256.PointOps.b_coeff", "Hacl.P256.uncompressed_to_raw", "Hacl.Impl.P256.Scalar.qmont_as_nat", "Hacl.Impl.P256.Point.from_mont_point", "Hacl.Spec.P256.Montgomery.from_qmont", "FStar.Seq.Properties.replace_subseq", "Lib.MultiBuffer.op_Lens_Access", "Lib.NTuple.op_Lens_Access", "Hacl.Streaming.MD.state_t", "Lib.NTuple.ntup8", "Hacl.Spec.Bignum.Definitions.limb", "Hacl.Streaming.SHA2.hash_384", "Lib.MultiBuffer.multiseq", "FStar.List.Tot.Base.map", "Hacl.Spec.P256.Montgomery.to_qmont", "LowStar.BufferOps.op_Bang_Star", "Hacl.Impl.P256.Bignum.widefelem", "Lib.IntTypes.u8", "Hacl.Spec.SHA2.Vec.words_state'", "Hacl.Streaming.Interface.optional_key", "Hacl.Streaming.SHA2.hacl_sha2_224", "FStar.Int.Cast.uint32_to_uint64", "Hacl.Streaming.Functor.uint32", "Hacl.Streaming.Interface.uint32", "Hacl.Streaming.MD.uint32", "FStar.Seq.Properties.split", "FStar.Int.Cast.Full.uint64_to_uint128", "Hacl.Hash.Definitions.prev_len_v", "FStar.Seq.Properties.last" ], "source_upto_this": "module Hacl.P256\n\nopen FStar.Mul\nopen FStar.HyperStack.All\nopen FStar.HyperStack\nmodule ST = FStar.HyperStack.ST\n\nopen Lib.IntTypes\nopen Lib.Buffer\n\nopen Spec.Hash.Definitions\nopen Hacl.Hash.SHA2\n\nopen Hacl.Impl.P256.Sign\nopen Hacl.Impl.P256.Verify\n\nmodule LSeq = Lib.Sequence\nmodule BSeq = Lib.ByteSequence\n\nmodule S = Spec.P256\nmodule BN = Hacl.Impl.P256.Bignum\nmodule P = Hacl.Impl.P256.Point\n\n#set-options \"--z3rlimit 30 --fuel 0 --ifuel 0\"\n\ninline_for_extraction noextract\nval msg_as_felem:\n alg:S.hash_alg_ecdsa\n -> msg_len:size_t{v msg_len >= S.min_input_length alg}\n -> msg:lbytes msg_len\n -> res:BN.felem ->\n Stack unit\n (requires fun h ->\n live h msg /\\ live h res /\\ disjoint msg res)\n (ensures fun h0 _ h1 -> modifies (loc res) h0 h1 /\\\n (let hashM = S.hash_ecdsa alg (v msg_len) (as_seq h0 msg) in\n BN.as_nat h1 res = BSeq.nat_from_bytes_be (LSeq.sub hashM 0 32) % S.order))\n\nlet msg_as_felem alg msg_len msg res =\n push_frame ();\n\n [@inline_let] let sz: size_t =\n match alg with\n | S.NoHash -> 32ul\n | S.Hash a -> Hacl.Hash.Definitions.hash_len a in\n\n let mHash = create sz (u8 0) in\n\n begin\n match alg with\n | S.NoHash -> copy mHash (sub msg 0ul 32ul)\n | S.Hash a -> match a with\n | SHA2_256 -> Hacl.Streaming.SHA2.hash_256 mHash msg msg_len\n | SHA2_384 -> Hacl.Streaming.SHA2.hash_384 mHash msg msg_len\n | SHA2_512 -> Hacl.Streaming.SHA2.hash_512 mHash msg msg_len\n end;\n LowStar.Ignore.ignore msg_len;\n let mHash32 = sub mHash 0ul 32ul in\n BN.bn_from_bytes_be4 res mHash32;\n Hacl.Impl.P256.Scalar.qmod_short res res;\n pop_frame ()\n\n\ninline_for_extraction noextract\nval ecdsa_signature: alg:S.hash_alg_ecdsa -> ecdsa_sign_p256_st alg\nlet ecdsa_signature alg signature msg_len msg private_key nonce =\n push_frame ();\n let m_q = BN.create_felem () in\n msg_as_felem alg msg_len msg m_q;\n let res = ecdsa_sign_msg_as_qelem signature m_q private_key nonce in\n pop_frame ();\n res\n\n\ninline_for_extraction noextract\nval ecdsa_verification: alg:S.hash_alg_ecdsa -> ecdsa_verify_p256_st alg\nlet ecdsa_verification alg msg_len msg public_key signature_r signature_s =\n push_frame ();\n let m_q = BN.create_felem () in\n msg_as_felem alg msg_len msg m_q;\n let res = ecdsa_verify_msg_as_qelem m_q public_key signature_r signature_s in\n pop_frame ();\n res\n\n\nlet ecdsa_sign_p256_sha2 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_256) signature msg_len msg private_key nonce\n\nlet ecdsa_sign_p256_sha384 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_384) signature msg_len msg private_key nonce\n\nlet ecdsa_sign_p256_sha512 signature msg_len msg private_key nonce =\n ecdsa_signature (S.Hash SHA2_512) signature msg_len msg private_key nonce\n\nlet ecdsa_sign_p256_without_hash signature msg_len msg private_key nonce =\n ecdsa_signature S.NoHash signature msg_len msg private_key nonce\n\n\nlet ecdsa_verif_p256_sha2 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_256) msg_len msg public_key signature_r signature_s\n\nlet ecdsa_verif_p256_sha384 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_384) msg_len msg public_key signature_r signature_s\n\nlet ecdsa_verif_p256_sha512 msg_len msg public_key signature_r signature_s =\n ecdsa_verification (S.Hash SHA2_512) msg_len msg public_key signature_r signature_s\n\nlet ecdsa_verif_without_hash msg_len msg public_key signature_r signature_s =\n ecdsa_verification S.NoHash msg_len msg public_key signature_r signature_s\n\n\nlet validate_public_key public_key =\n push_frame ();\n let point_jac = P.create_point () in\n let res = P.load_point_vartime point_jac public_key in\n pop_frame ();\n res\n\n\nlet validate_private_key private_key =\n push_frame ();\n let bn_sk = BN.create_felem () in\n BN.bn_from_bytes_be4 bn_sk private_key;\n let res = Hacl.Impl.P256.Scalar.bn_is_lt_order_and_gt_zero_mask4 bn_sk in\n pop_frame ();\n Hacl.Bignum.Base.unsafe_bool_of_limb res\n\n\nlet uncompressed_to_raw pk pk_raw =\n Hacl.Impl.P256.Compression.uncompressed_to_raw pk pk_raw\n", "sketch": [ "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw uncompressed public key.\n\nStep 1: The function takes a 33-byte buffer representing a compressed public key and a 64-byte buffer where the raw uncompressed public key will be stored.\nStep 2: It then calls the S.pk_compressed_to_raw function to perform the conversion and returns a boolean indicating whether the conversion was successful.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nStep 1: The function takes a 33-byte buffer representing a compressed public key and a 64-byte buffer where the raw public key will be stored.\nStep 2: It then calls the S.pk_compressed_to_raw function to perform the conversion and returns true if the conversion is successful, and false otherwise.", "The compressed_to_raw function checks if the input buffer contains a valid compressed public key. If it does, the function uses the Hacl library to decompress the public key and stores the result in the output buffer.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nStep 1: The function takes a 33-byte buffer representing a compressed public key and a 64-byte buffer to store the raw public key.\nStep 2: It then calls the S.pk_compressed_to_raw function to perform the conversion and returns true if the conversion is successful, and false otherwise.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw uncompressed public key.\n\nStep 1: The function takes a 33-byte buffer representing a compressed public key and a 64-byte buffer where the raw uncompressed public key will be stored.\nStep 2: It then calls the S.pk_compressed_to_raw function to perform the conversion and returns a boolean indicating whether the conversion was successful.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nThe implementation involves calling the S.pk_compressed_to_raw function to perform the conversion and returning a boolean indicating whether the conversion was successful.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nStep 1: The function takes a 33-byte buffer as input and produces a 64-byte buffer as output.\nStep 2: It first ensures that the input and output buffers are live and disjoint. Then, it calls the S.pk_compressed_to_raw function to perform the conversion.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nThe implementation involves calling the S.pk_compressed_to_raw function to perform the conversion from the compressed public key to the raw public key.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nStep 1: The function takes a 33-byte buffer as input and produces a 64-byte buffer as output.\nStep 2: It involves calling the S.pk_compressed_to_raw function to perform the conversion from compressed to raw public key representation.", "The compressed_to_raw function takes a 33-byte buffer representing a compressed public key and converts it to a 64-byte buffer representing the raw public key.\n\nStep 1: The function takes a 33-byte buffer representing a compressed public key and a 64-byte buffer where the raw public key will be stored.\nStep 2: It then calls the S.pk_compressed_to_raw function to perform the conversion and returns true if the conversion is successful, and false otherwise." ], "generated_solution": [ "let compressed_to_raw pk pk_raw =\n let success = S.pk_compressed_to_raw (as_seq pk) in\n match success with\n | Some raw_pk ->\n copy pk_raw (of_seq raw_pk);\n true\n | None -> false", "let compressed_to_raw pk pk_raw =\n let success = S.pk_compressed_to_raw (as_seq pk) in\n match success with\n | Some raw -> copy pk_raw raw; true\n | None -> false", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let res = S.pk_compressed_to_raw pk in\n match res with\n | Some raw_pk ->\n copy pk_raw raw_pk;\n pop_frame ();\n true\n | None ->\n pop_frame ();\n false", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let result = S.pk_compressed_to_raw (as_seq h0 pk) in\n let success = match result with\n | Some raw -> (\n copy pk_raw (of_seq raw);\n true\n )\n | None -> false in\n pop_frame ();\n success", "let compressed_to_raw pk pk_raw =\n let success = S.pk_compressed_to_raw (as_seq h0 pk) in\n match success with\n | Some raw_pk ->\n copy pk_raw (of_seq raw_pk);\n true\n | None -> false", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let result = S.pk_compressed_to_raw pk in\n match result with\n | Some raw -> copy pk_raw raw; true\n | None -> false;\n pop_frame ()", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let result = S.pk_compressed_to_raw (as_seq h0 pk) in\n let b = match result with\n | Some raw -> (pk_raw == raw)\n | None -> false in\n pop_frame ();\n b", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let result = S.pk_compressed_to_raw (as_seq h0 pk) in\n match result with\n | Some raw_pk ->\n copy pk_raw (BSeq.byte_seq_of_bytes_be raw_pk);\n pop_frame ();\n true\n | None ->\n pop_frame ();\n false", "val compressed_to_raw: pk:lbuffer uint8 33ul -> pk_raw:lbuffer uint8 64ul -> Stack bool\n (requires fun h -> live h pk /\\ live h pk_raw /\\ disjoint pk pk_raw)\n (ensures fun h0 b h1 -> modifies (loc pk_raw) h0 h1 /\\\n (b <==> Some? (S.pk_compressed_to_raw (as_seq h0 pk))) /\\\n (b ==> (as_seq h1 pk_raw == Some?.v (S.pk_compressed_to_raw (as_seq h0 pk)))))", "let compressed_to_raw pk pk_raw =\n push_frame ();\n let result = S.pk_compressed_to_raw (as_seq h0 pk) in\n let success = match result with\n | Some raw -> (\n copy pk_raw (of_seq raw);\n true\n )\n | None -> false in\n pop_frame ();\n success" ] }, { "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.live_region_frameOf", "opens_and_abbrevs": [ { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "DM", "full_module": "FStar.DependentMap" }, { "open": "FStar.HyperStack.ST" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HH", "full_module": "FStar.HyperStack" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pointer" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 1, "max_fuel": 1, "initial_ifuel": 1, "max_ifuel": 1, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 16, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]", "source_definition": "let live_region_frameOf #value h p =\n let content = greference_of p in\n assert (HS.contains h content)", "source_range": { "start_line": 2073, "start_col": 0, "end_line": 2075, "end_col": 32 }, "interleaved": false, "definition": "fun h p ->\n let content = FStar.Pointer.Base.greference_of p in\n assert (FStar.Monotonic.HyperStack.contains h content)", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "FStar.Pointer.Base.typ", "FStar.Monotonic.HyperStack.mem", "FStar.Pointer.Base.pointer", "Prims._assert", "FStar.Monotonic.HyperStack.contains", "FStar.Pointer.Base.pointer_ref_contents", "FStar.Heap.trivial_preorder", "FStar.HyperStack.reference", "FStar.Pointer.Base.greference_of", "Prims.unit" ], "proof_features": [], "is_simple_lemma": true, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "h: FStar.Monotonic.HyperStack.mem -> p: FStar.Pointer.Base.pointer value\n -> FStar.Pervasives.Lemma (requires FStar.Pointer.Base.live h p)\n (ensures FStar.Monotonic.HyperStack.live_region h (FStar.Pointer.Base.frameOf p))\n [\n SMTPatOr [\n [SMTPat (FStar.Monotonic.HyperStack.live_region h (FStar.Pointer.Base.frameOf p))];\n [SMTPat (FStar.Pointer.Base.live h p)]\n ]\n ]", "prompt": "let live_region_frameOf #value h p =\n ", "expected_response": "let content = greference_of p in\nassert (HS.contains h content)", "source": { "project_name": "FStar", "file_name": "ulib/legacy/FStar.Pointer.Base.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.Pointer.Base.fst", "checked_file": "dataset/FStar.Pointer.Base.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.UInt8.fsti.checked", "dataset/FStar.UInt64.fsti.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.UInt16.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Squash.fsti.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.ModifiesGen.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.List.Tot.fst.checked", "dataset/FStar.Int8.fsti.checked", "dataset/FStar.Int64.fsti.checked", "dataset/FStar.Int32.fsti.checked", "dataset/FStar.Int16.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.DependentMap.fsti.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Char.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "", "", "", "", "", "", "base_typ", "TUInt", "TUInt", "TUInt", "TUInt8", "TUInt8", "TUInt8", "TUInt16", "TUInt16", "TUInt16", "TUInt32", "TUInt32", "TUInt32", "TUInt64", "TUInt64", "TUInt64", "TInt", "TInt", "TInt", "TInt8", "TInt8", "TInt8", "TInt16", "TInt16", "TInt16", "TInt32", "TInt32", "TInt32", "step", "TInt64", "TInt64", "TInt64", "StepField", "StepField", "StepField", "TChar", "TChar", "TChar", "l", "l", "TBool", "TBool", "TBool", "fd", "fd", "TUnit", "TUnit", "TUnit", "StepUField", "StepUField", "StepUField", "l", "l", "array_length_t", "fd", "fd", "typ", "StepCell", "StepCell", "StepCell", "TBase", "TBase", "TBase", "length", "length", "b", "b", "value", "value", "index", "index", "TStruct", "TStruct", "TStruct", "l", "l", "path", "TUnion", "TUnion", "TUnion", "PathBase", "PathBase", "PathBase", "l", "l", "PathStep", "PathStep", "PathStep", "TArray", "TArray", "TArray", "through", "through", "length", "length", "to", "to", "t", "t", "p", "p", "s", "s", "TPointer", "TPointer", "TPointer", "t", "t", "let step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()", "TNPointer", "TNPointer", "TNPointer", "t", "t", "TBuffer", "TBuffer", "TBuffer", "t", "t", "struct_typ'", "struct_typ", "struct_typ", "let rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s", "name", "name", "fields", "fields", "union_typ", "let struct_field'\n (l: struct_typ')\n: Tot eqtype\n= (s: string { List.Tot.mem s (List.Tot.map fst l) } )", "let struct_field\n (l: struct_typ)\n: Tot eqtype\n= struct_field' l.fields", "let union_field = struct_field", "let typ_of_struct_field'\n (l: struct_typ')\n (f: struct_field' l)\n: Tot (t: typ {t << l})\n= List.Tot.assoc_mem f l;\n let y = Some?.v (List.Tot.assoc f l) in\n List.Tot.assoc_precedes f l y;\n y", "let typ_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field' l.fields f", "_npointer", "Pointer", "Pointer", "Pointer", "from", "from", "contents", "contents", "let typ_of_union_field\n (l: union_typ)\n (f: union_field l)\n: Tot (t: typ {t << l})\n= typ_of_struct_field l f", "p", "p", "NullPtr", "NullPtr", "NullPtr", "let npointer (t: typ): Tot Type0 =\n _npointer t", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let rec typ_depth\n (t: typ)\n: GTot nat\n= match t with\n | TArray _ t -> 1 + typ_depth t\n | TUnion l\n | TStruct l -> 1 + struct_typ_depth l.fields\n | _ -> 0\nand struct_typ_depth\n (l: list (string * typ))\n: GTot nat\n= match l with\n | [] -> 0\n | h :: l ->\n let (_, t) = h in // matching like this prevents needing two units of ifuel\n let n1 = typ_depth t in\n let n2 = struct_typ_depth l in\n if n1 > n2 then n1 else n2", "let nullptr (#t: typ): Tot (npointer t) = NullPtr", "let g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false", "let g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()", "let not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true", "let rec typ_depth_typ_of_struct_field\n (l: struct_typ')\n (f: struct_field' l)\n: Lemma\n (ensures (typ_depth (typ_of_struct_field' l f) <= struct_typ_depth l))\n (decreases l)\n= let ((f', _) :: l') = l in\n if f = f'\n then ()\n else begin\n let f: string = f in\n assert (List.Tot.mem f (List.Tot.map fst l'));\n List.Tot.assoc_mem f l';\n typ_depth_typ_of_struct_field l' f\n end", "buffer_root", "BufferRootSingleton", "BufferRootSingleton", "BufferRootSingleton", "p", "p", "BufferRootArray", "BufferRootArray", "BufferRootArray", "max_length", "max_length", "p", "p", "let buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len", "_buffer", "Buffer", "Buffer", "Buffer", "broot", "broot", "bidx", "bidx", "blength", "blength", "let buffer (t: typ): Tot Type0 = _buffer t", "val npointer (t: typ) : Tot Type0", "val nullptr (#t: typ): Tot (npointer t)", "val g_is_null (#t: typ) (p: npointer t) : GTot bool", "val g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n [SMTPat (g_is_null (nullptr #t))]", "let gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )", "let pointer (t: typ) : Tot Type0 = (p: npointer t { g_is_null p == false } )", "let _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u", "val buffer (t: typ): Tot Type0", "let gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u", "let type_of_base_typ\n (t: base_typ)\n: Tot Type0\n= match t with\n | TUInt -> nat\n | TUInt8 -> FStar.UInt8.t\n | TUInt16 -> FStar.UInt16.t\n | TUInt32 -> FStar.UInt32.t\n | TUInt64 -> FStar.UInt64.t\n | TInt -> int\n | TInt8 -> FStar.Int8.t\n | TInt16 -> FStar.Int16.t\n | TInt32 -> FStar.Int32.t\n | TInt64 -> FStar.Int64.t\n | TChar -> FStar.Char.char\n | TBool -> bool\n | TUnit -> unit", "let gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v", "let gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)", "array", "let type_of_struct_field''\n (l: struct_typ')\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field' l)\n: Tot Type0 =\n List.Tot.assoc_mem f l;\n let y = typ_of_struct_field' l f in\n List.Tot.assoc_precedes f l y;\n type_of_typ y", "let gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()", "let type_of_struct_field'\n (l: struct_typ)\n (type_of_typ: (\n (t: typ { t << l } ) ->\n Tot Type0\n ))\n (f: struct_field l)\n: Tot Type0\n= type_of_struct_field'' l.fields type_of_typ f", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "let rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))", "val struct (l: struct_typ) : Tot Type0", "val union (l: union_typ) : Tot Type0", "let rec type_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t", "let rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()", "let type_of_typ_array\n (len: array_length_t)\n (t: typ)\n: Lemma\n (type_of_typ (TArray len t) == array len (type_of_typ t))\n [SMTPat (type_of_typ (TArray len t))]\n= ()", "let _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v", "let struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f", "let type_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l (fun (x:typ{x << l}) -> type_of_typ x)", "let struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v", "let type_of_typ_struct\n (l: struct_typ)\n: Lemma\n (type_of_typ (TStruct l) == struct l)\n [SMTPat (type_of_typ (TStruct l))]\n= assert_norm (type_of_typ (TStruct l) == struct l)", "let struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f", "let struct_sel_struct_create_fun l f fd = ()", "let union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v", "let type_of_typ_type_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (type_of_typ (typ_of_struct_field l f) == type_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "let union_get_value #l v fd = gtdata_get_value v fd", "let union_create l fd v = gtdata_create fd v", "val struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f)", "let rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul", "let dfst_struct_field\n (s: struct_typ)\n (p: (x: struct_field s & type_of_struct_field s x))\n: Tot string\n=\n let (| f, _ |) = p in\n f", "let struct_literal (s: struct_typ) : Tot Type0 = list (x: struct_field s & type_of_struct_field s x)", "let struct_literal_wf (s: struct_typ) (l: struct_literal s) : Tot bool =\n List.Tot.sortWith FStar.String.compare (List.Tot.map fst s.fields) =\n List.Tot.sortWith FStar.String.compare\n (List.Tot.map (dfst_struct_field s) l)", "let fun_of_list\n (s: struct_typ)\n (l: struct_literal s)\n (f: struct_field s)\n: Pure (type_of_struct_field s f)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n=\n let f' : string = f in\n let phi (p: (x: struct_field s & type_of_struct_field s x)) : Tot bool =\n dfst_struct_field s p = f'\n in\n match List.Tot.find phi l with\n | Some p -> let (| _, v |) = p in v\n | _ ->\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map fst s.fields);\n List.Tot.sortWith_permutation FStar.String.compare (List.Tot.map (dfst_struct_field s) l);\n List.Tot.mem_memP f' (List.Tot.map fst s.fields);\n List.Tot.mem_count (List.Tot.map fst s.fields) f';\n List.Tot.mem_count (List.Tot.map (dfst_struct_field s) l) f';\n List.Tot.mem_memP f' (List.Tot.map (dfst_struct_field s) l);\n List.Tot.memP_map_elim (dfst_struct_field s) f' l;\n Classical.forall_intro (Classical.move_requires (List.Tot.find_none phi l));\n false_elim ()", "val struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l)", "let struct_create\n (s: struct_typ)\n (l: struct_literal s)\n: Pure (struct s)\n (requires (normalize_term (struct_literal_wf s l) == true))\n (ensures (fun _ -> True))\n= struct_create_fun s (fun_of_list s l)", "val struct_sel_struct_create_fun\n (l: struct_typ)\n (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd)))\n (fd: struct_field l)\n: Lemma\n (struct_sel (struct_create_fun l f) fd == f fd)\n [SMTPat (struct_sel (struct_create_fun l f) fd)]", "let rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)", "let type_of_typ_union\n (l: union_typ)\n: Lemma\n (type_of_typ (TUnion l) == union l)\n [SMTPat (type_of_typ (TUnion l))]\n= assert_norm (type_of_typ (TUnion l) == union l)", "val union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l)", "val union_get_value\n (#l: union_typ)\n (v: union l)\n (fd: struct_field l)\n: Pure (type_of_struct_field l fd)\n (requires (union_get_key v == fd))\n (ensures (fun _ -> True))", "let otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ", "val union_create\n (l: union_typ)\n (fd: struct_field l)\n (v: type_of_struct_field l fd)\n: Tot (union l)", "let otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()", "val equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))", "let otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()", "val as_addr (#t: typ) (p: pointer t): GTot (x: nat { x > 0 } )", "let otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()", "val unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0", "val live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0", "let ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))", "let ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f", "let ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)", "val nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0", "let ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)", "let otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)", "val live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (nlive h p <==> live h p)\n [SMTPat (nlive h p)]", "let ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))", "val g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n: Lemma\n (requires (g_is_null p))\n (ensures (nlive h p))\n [SMTPat (g_is_null p); SMTPat (nlive h p)]", "let ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)", "let ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd", "val live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (ensures (live h p /\\ p `unused_in` h ==> False))\n [SMTPat (live h p); SMTPat (p `unused_in` h)]", "let ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)", "val gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)", "let otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)", "val frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid", "let struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true", "val live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]", "val disjoint_roots_intro_pointer_vs_pointer\n (#value1 value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 =!= as_addr p2))", "let rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v", "val disjoint_roots_intro_pointer_vs_reference\n (#value1: typ)\n (#value2: Type)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ p2 `HS.unused_in` h))\n (ensures (frameOf p1 <> HS.frameOf p2 \\/ as_addr p1 =!= HS.as_addr p2))", "val disjoint_roots_intro_reference_vs_pointer\n (#value1: Type)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ p2 `unused_in` h))\n (ensures (HS.frameOf p1 <> frameOf p2 \\/ HS.as_addr p1 =!= as_addr p2))", "val is_mm\n (#value: typ)\n (p: pointer value)\n: GTot bool", "val gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: GTot (pointer (typ_of_struct_field l fd))", "let ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)", "val as_addr_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (as_addr (gfield p fd) == as_addr p))\n [SMTPat (as_addr (gfield p fd))]", "let ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v", "val unused_in_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (unused_in (gfield p fd) h <==> unused_in p h))\n [SMTPat (unused_in (gfield p fd) h)]", "val live_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (live h (gfield p fd) <==> live h p))\n [SMTPat (live h (gfield p fd))]", "let ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in (\n Some? v /\\\n ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)\n )))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= let (v: ostruct l) = v in\n assert_norm (ovalue_is_readable (TStruct l) v == List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n assert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n assert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))", "val gread_gfield\n (h: HS.mem)\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (gread h (gfield p fd) == struct_sel (gread h p) fd))\n [SMTPatOr [[SMTPat (gread h (gfield p fd))]; [SMTPat (struct_sel (gread h p) fd)]]]", "val frameOf_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (frameOf (gfield p fd) == frameOf p))\n [SMTPat (frameOf (gfield p fd))]", "let ovalue_is_readable_array_elim\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n: Lemma\n (requires (ovalue_is_readable (TArray len t) v))\n (ensures (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n )))\n= ()", "val is_mm_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (is_mm (gfield p fd) <==> is_mm p))\n [SMTPat (is_mm (gfield p fd))]", "let ovalue_is_readable_array_intro\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n: Lemma\n (requires (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\ (\n forall (i: UInt32.t { UInt32.v i < UInt32.v len } ) .\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n ))))\n (ensures (ovalue_is_readable (TArray len t) v))\n= let (v: option (array len (otype_of_typ t))) = v in\n let (v: array len (otype_of_typ t)) = Some?.v v in\n let f\n (i: nat { i < UInt32.v len } )\n : Lemma\n (ovalue_is_readable t (Seq.index v i))\n = let (j : UInt32.t { UInt32.v j < UInt32.v len } ) = UInt32.uint_to_t i in\n assert (ovalue_is_readable t (Seq.index v (UInt32.v j)))\n in\n Classical.forall_intro f", "val gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot (pointer (typ_of_struct_field l fd))", "val as_addr_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (as_addr (gufield p fd) == as_addr p))\n [SMTPat (as_addr (gufield p fd))]", "val unused_in_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (unused_in (gufield p fd) h <==> unused_in p h))\n [SMTPat (unused_in (gufield p fd) h)]", "let ostruct_field_of_struct_field\n (l: struct_typ)\n (ovalue_of_value: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Pure (otype_of_typ t)\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: struct l)\n (f: struct_field l)\n: Tot (otype_of_struct_field l f)\n= ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)", "val live_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (live h (gufield p fd) <==> live h p))\n [SMTPat (live h (gufield p fd))]", "val gread_gufield\n (h: HS.mem)\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (union_get_key (gread h p) == fd))\n (ensures (\n union_get_key (gread h p) == fd /\\\n gread h (gufield p fd) == union_get_value (gread h p) fd\n ))\n [SMTPatOr [[SMTPat (gread h (gufield p fd))]; [SMTPat (union_get_value (gread h p) fd)]]]", "let seq_init_index\n (#a:Type) (len:nat) (contents:(i:nat { i < len } -> Tot a)) (i: nat)\n: Lemma\n (requires (i < len))\n (ensures (i < len /\\ Seq.index (Seq.init len contents) i == contents i))\n [SMTPat (Seq.index (Seq.init len contents) i)]\n= Seq.init_index len contents", "let rec ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Tot (otype_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let oval\n (t' : typ)\n (v' : type_of_typ t')\n : Pure (otype_of_typ t')\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_of_value t' v'\n in\n ostruct_create l (ostruct_field_of_struct_field l oval v)\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n assert (UInt32.v len == Seq.length v);\n let f\n (i: nat {i < UInt32.v len})\n : Tot (otype_of_typ t)\n = ovalue_of_value t (Seq.index v i)\n in\n let (v': array len (otype_of_typ t)) = Seq.init (UInt32.v len) f in\n Some v'\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ounion_create l k (ovalue_of_value (typ_of_struct_field l k) (union_get_value v k))\n | _ -> Some v", "val frameOf_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (frameOf (gufield p fd) == frameOf p))\n [SMTPat (frameOf (gufield p fd))]", "val is_mm_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (is_mm (gufield p fd) <==> is_mm p))\n [SMTPat (is_mm (gufield p fd))]", "val gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Ghost (pointer value)\n (requires (UInt32.v i < UInt32.v length))\n (ensures (fun _ -> True))", "val as_addr_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ as_addr (gcell p i) == as_addr p))\n [SMTPat (as_addr (gcell p i))]", "let ovalue_is_readable_ostruct_field_of_struct_field\n (l: struct_typ)\n (ih: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n ))\n (v: struct l)\n (f: struct_field l)\n: Lemma\n (ovalue_is_readable (typ_of_struct_field l f) (ostruct_field_of_struct_field l ovalue_of_value v f))\n= ih (typ_of_struct_field l f) (struct_sel #l v f)", "val unused_in_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ (unused_in (gcell p i) h <==> unused_in p h)))\n [SMTPat (unused_in (gcell p i) h)]", "let rec ovalue_is_readable_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (requires True)\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n (decreases t)\n [SMTPat (ovalue_is_readable t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let (v: struct l) = v in\n let (v': ostruct l) = ovalue_of_value (TStruct l) v in\n let phi\n (t: typ)\n (v: type_of_typ t)\n : Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n = ovalue_is_readable_ovalue_of_value t v\n in\n Classical.forall_intro (ovalue_is_readable_ostruct_field_of_struct_field l phi v);\n ovalue_is_readable_struct_intro l v'\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n let (v': otype_of_typ (TArray len t)) = ovalue_of_value (TArray len t) v in\n let (v': array len (otype_of_typ t)) = Some?.v v' in\n let phi\n (i: nat { i < Seq.length v' } )\n : Lemma\n (ovalue_is_readable t (Seq.index v' i))\n = ovalue_is_readable_ovalue_of_value t (Seq.index v i)\n in\n Classical.forall_intro phi\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ovalue_is_readable_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()", "val live_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ (live h (gcell p i) <==> live h p)))\n [SMTPat (live h (gcell p i))]", "val gread_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ gread h (gcell p i) == Seq.index (gread h p) (UInt32.v i)))\n [SMTPat (gread h (gcell p i))]", "val frameOf_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ frameOf (gcell p i) == frameOf p))\n [SMTPat (frameOf (gcell p i))]", "val is_mm_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ is_mm (gcell p i) == is_mm p))\n [SMTPat (is_mm (gcell p i))]", "let rec value_of_ovalue\n (t: typ)\n (v: otype_of_typ t)\n: Tot (type_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n if Some? v\n then\n let phi\n (f: struct_field l)\n : Tot (type_of_struct_field l f)\n = value_of_ovalue (typ_of_struct_field l f) (ostruct_sel v f)\n in\n struct_create_fun l phi\n else dummy_val t\n | TArray len t' ->\n let (v: option (array len (otype_of_typ t'))) = v in\n begin match v with\n | None -> dummy_val t\n | Some v ->\n let phi\n (i: nat { i < UInt32.v len } )\n : Tot (type_of_typ t')\n = value_of_ovalue t' (Seq.index v i)\n in\n Seq.init (UInt32.v len) phi\n end\n | TUnion l ->\n let (v: ounion l) = v in\n begin match v with\n | None -> dummy_val t\n | _ ->\n let k = ounion_get_key v in\n union_create l k (value_of_ovalue (typ_of_struct_field l k) (ounion_get_value v k))\n end\n | TBase b ->\n let (v: option (type_of_base_typ b)) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TPointer t' ->\n let (v: option (pointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TNPointer t' ->\n let (v: option (npointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TBuffer t' ->\n let (v: option (buffer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end", "val includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool", "val includes_refl\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (includes p p))\n [SMTPat (includes p p)]", "val includes_trans\n (#t1 #t2 #t3: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n (p3: pointer t3)\n: Lemma\n (requires (includes p1 p2 /\\ includes p2 p3))\n (ensures (includes p1 p3))", "val includes_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (includes p (gfield p fd)))", "val includes_gufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (includes p (gufield p fd)))", "val includes_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ includes p (gcell p i)))", "val readable\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: GTot Type0", "let ovalue_of_value_array_index\n (#len: array_length_t)\n (t' : typ)\n (v: array len (type_of_typ t'))\n (sv: array len (otype_of_typ t'))\n: Lemma\n (requires (ovalue_of_value (TArray len t') v == Some sv))\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index sv i == ovalue_of_value t' (Seq.index v i)))\n= ()", "val readable_live\n (#a: typ)\n (h: HS.mem)\n (b: pointer a)\n: Lemma\n (requires (readable h b))\n (ensures (live h b))\n [SMTPatOr [\n [SMTPat (readable h b)];\n [SMTPat (live h b)];\n ]]", "let value_of_ovalue_array_index\n (#len: array_length_t)\n (t': typ)\n (sv: array len (otype_of_typ t'))\n: Lemma\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index (value_of_ovalue (TArray len t') (Some sv)) i == value_of_ovalue t' (Seq.index sv i)))\n= ()", "val readable_gfield\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (readable h p))\n (ensures (readable h (gfield p fd)))\n [SMTPat (readable h (gfield p fd))]", "let rec value_of_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (value_of_ovalue t (ovalue_of_value t v) == v)\n [SMTPat (value_of_ovalue t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let v : struct l = v in\n let v' : struct l = value_of_ovalue t (ovalue_of_value t v) in\n let phi\n (f: struct_field l)\n : Lemma\n (struct_sel #l v' f == struct_sel #l v f)\n = value_of_ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n in\n Classical.forall_intro phi;\n DM.equal_intro v' v;\n DM.equal_elim #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) v' v\n | TArray len t' ->\n let (v: array len (type_of_typ t')) = v in\n let ov : option (array len (otype_of_typ t')) = ovalue_of_value (TArray len t') v in\n assert (Some? ov);\n let sv : array len (otype_of_typ t') = Some?.v ov in\n assert (Seq.length sv == UInt32.v len);\n// assert (forall (i : nat { i < UInt32.v len } ) . Seq.index sv i == ovalue_of_value t' (Seq.index v i));\n ovalue_of_value_array_index t' v sv;\n let v' : array len (type_of_typ t') = value_of_ovalue t ov in\n assert (Seq.length v' == UInt32.v len);\n// assert (forall (i: nat { i < UInt32.v len } ) . Seq.index v' i == value_of_ovalue t' (Seq.index sv i));\n value_of_ovalue_array_index t' sv;\n let phi\n (i: nat { i < UInt32.v len } )\n : Lemma\n (value_of_ovalue t' (ovalue_of_value t' (Seq.index v i)) == Seq.index v i)\n = value_of_ovalue_of_value t' (Seq.index v i)\n in\n Classical.forall_intro phi;\n Seq.lemma_eq_intro v' v;\n Seq.lemma_eq_elim v' v\n | TUnion l ->\n let v : union l = v in\n let k = _union_get_key v in\n value_of_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()", "val readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ))\n (ensures (readable h p))", "val readable_struct_forall_mem\n (#l: struct_typ)\n (p: pointer (TStruct l))\n: Lemma (forall\n (h: HS.mem)\n . (\n forall (f: struct_field l) .\n readable h (gfield p f)\n ) ==>\n readable h p\n )", "val readable_struct_fields\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (s: list string)\n: GTot Type0", "val readable_struct_fields_nil\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (readable_struct_fields h p [])\n [SMTPat (readable_struct_fields h p [])]", "val readable_struct_fields_cons\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n (f: string)\n (q: list string)\n: Lemma\n (requires (readable_struct_fields h p q /\\ (List.Tot.mem f (List.Tot.map fst l.fields) ==> (let f : struct_field l = f in readable h (gfield p f)))))\n (ensures (readable_struct_fields h p (f::q)))\n [SMTPat (readable_struct_fields h p (f::q))]", "let none_ovalue\n (t: typ)\n: Tot (otype_of_typ t)\n= match t with\n | TStruct l -> (None <: ostruct l)\n | TArray len t' -> (None <: option (array len (otype_of_typ t')))\n | TUnion l -> (None <: ounion l)\n | TBase b -> (None <: option (type_of_base_typ b))\n | TPointer t' -> (None <: option (pointer t'))\n | TNPointer t' -> (None <: option (npointer t'))\n | TBuffer t' -> (None <: option (buffer t'))", "val readable_struct_fields_readable_struct\n (#l: struct_typ)\n (h: HS.mem)\n (p: pointer (TStruct l))\n: Lemma\n (requires (readable_struct_fields h p (normalize_term (List.Tot.map fst l.fields))))\n (ensures (readable h p))", "let not_ovalue_is_readable_none_ovalue\n (t: typ)\n: Lemma\n (ovalue_is_readable t (none_ovalue t) == false)\n= ()", "val readable_gcell\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length /\\ readable h p))\n (ensures (UInt32.v i < UInt32.v length /\\ readable h (gcell p i)))\n [SMTPat (readable h (gcell p i))]", "let step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n= match s with\n | StepField l fd ->\n let (m': ostruct l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ -> ostruct_sel m' fd\n end\n | StepUField l fd ->\n let (m' : ounion l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ ->\n if fd = ounion_get_key m'\n then ounion_get_value m' fd\n else none_ovalue to\n end\n | StepCell length value i ->\n let (m': option (array length (otype_of_typ to))) = m' in\n begin match m' with\n | None -> none_ovalue to\n | Some m' -> Seq.index m' (UInt32.v i)\n end", "val readable_array\n (#length: array_length_t)\n (#value: typ)\n (h: HS.mem)\n (p: pointer (TArray length value))\n: Lemma\n (requires (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v length ==>\n readable h (gcell p i)\n ))\n (ensures (readable h p))", "val readable_gufield\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires True)\n (ensures (readable h (gufield p fd) <==> (readable h p /\\ union_get_key (gread h p) == fd)))\n [SMTPat (readable h (gufield p fd))]", "val is_active_union_field\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: GTot Type0", "val is_active_union_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (live h p))\n [SMTPat (is_active_union_field h p fd)]", "let ovalue_is_readable_step_sel_cell\n (#length: array_length_t)\n (#value: typ)\n (m': otype_of_typ (TArray length value))\n (index: UInt32.t { UInt32.v index < UInt32.v length } )\n: Lemma\n (requires (ovalue_is_readable (TArray length value) m'))\n (ensures (ovalue_is_readable value (step_sel m' (StepCell length value index))))\n [SMTPat (ovalue_is_readable value (step_sel m' (StepCell length value index)))]\n= ()", "val is_active_union_field_live\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (live h (gufield p fd)))\n [SMTPat (is_active_union_field h p fd)]", "let ovalue_is_readable_step_sel_field\n (#l: struct_typ)\n (m: ostruct l)\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) m))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd)))]\n= ()", "val is_active_union_field_eq\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd1 /\\ is_active_union_field h p fd2))\n (ensures (fd1 == fd2))\n [SMTPat (is_active_union_field h p fd1); SMTPat (is_active_union_field h p fd2)]", "let ovalue_is_readable_step_sel_union_same\n (#l: union_typ)\n (m: ounion l)\n (fd: struct_field l)\n: Lemma\n (requires (\n ovalue_is_readable (TUnion l) m /\\\n ounion_get_key m == fd\n ))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepUField l fd))))\n= ()", "val is_active_union_field_get_key\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd))\n (ensures (union_get_key (gread h p) == fd))\n [SMTPat (is_active_union_field h p fd)]", "let step_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (s: step from to)\n: Lemma\n (step_sel (none_ovalue from) s == none_ovalue to)\n= ()", "val is_active_union_field_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Lemma\n (requires (is_active_union_field h p fd /\\ readable h (gufield p fd)))\n (ensures (readable h p))\n [SMTPat (is_active_union_field h p fd); SMTPat (readable h (gufield p fd))]", "let rec path_sel\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n: Tot (otype_of_typ to)\n (decreases p)\n= match p with\n | PathBase -> m\n | PathStep through' to' p' s ->\n let (m': otype_of_typ through') = path_sel m p' in\n step_sel m' s", "val is_active_union_field_includes_readable\n (#l: union_typ)\n (h: HS.mem)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n (#t': typ)\n (p' : pointer t')\n: Lemma\n (requires (includes (gufield p fd) p' /\\ readable h p'))\n (ensures (is_active_union_field h p fd))", "let rec path_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_sel (none_ovalue from) p == none_ovalue to))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' s ->\n path_sel_none_ovalue p'", "let equal_values #a h (b:pointer a) h' (b':pointer a) : GTot Type0 =\n (live h b ==> live h' b') /\\ (\n readable h b ==> (\n readable h' b' /\\\n gread h b == gread h' b'\n ))", "let step_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases s)\n= match s with\n | StepField l fd ->\n let (m: ostruct l) = m in\n begin match m with\n | None ->\n (* whole structure does not exist yet,\n so create one with only one field initialized,\n and all others uninitialized *)\n let phi\n (fd' : struct_field l)\n : Tot (otype_of_struct_field l fd')\n = if fd' = fd\n then v\n else none_ovalue (typ_of_struct_field l fd')\n in\n ostruct_create l phi\n | Some _ -> ostruct_upd m fd v\n end\n | StepCell len _ i ->\n let (m: option (array len (otype_of_typ to))) = m in\n begin match m with\n | None ->\n (* whole array does not exist yet,\n so create one with only one cell initialized,\n and all others uninitialized *)\n let phi\n (j: nat { j < UInt32.v len } )\n : Tot (otype_of_typ to)\n = if j = UInt32.v i\n then v\n else none_ovalue to\n in\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.init (UInt32.v len) phi)\n in\n m'\n | Some m ->\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.upd m (UInt32.v i) v)\n in\n m'\n end\n | StepUField l fd ->\n (* overwrite the whole union with the new field *)\n ounion_create l fd v", "val gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: GTot (buffer t)", "val singleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gsingleton_buffer_of_pointer p))", "val gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: GTot (buffer t)", "val buffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: HST.Stack (buffer t)\n (requires (fun h -> live h p))\n (ensures (fun h b h' -> h' == h /\\ b == gbuffer_of_array_pointer p))", "val buffer_length\n (#t: typ)\n (b: buffer t)\n: GTot UInt32.t", "val buffer_length_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_length (gsingleton_buffer_of_pointer p) == 1ul))\n [SMTPat (buffer_length (gsingleton_buffer_of_pointer p))]", "val buffer_length_gbuffer_of_array_pointer\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_length (gbuffer_of_array_pointer p) == len))\n [SMTPat (buffer_length (gbuffer_of_array_pointer p))]", "val buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0", "let step_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Lemma\n (step_sel (step_upd m s v) s == v)\n= ()", "val buffer_live_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_live h (gsingleton_buffer_of_pointer p) <==> live h p ))\n [SMTPat (buffer_live h (gsingleton_buffer_of_pointer p))]", "let rec path_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases p)\n= match p with\n | PathBase -> v\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n path_upd m p' (step_upd s st v)", "val buffer_live_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_live h (gbuffer_of_array_pointer p) <==> live h p))\n [SMTPat (buffer_live h (gbuffer_of_array_pointer p))]", "val buffer_unused_in\n (#t: typ)\n (b: buffer t)\n (h: HS.mem)\n: GTot Type0", "let rec path_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_sel (path_upd m p v) p == v))\n (decreases p)\n [SMTPat (path_sel (path_upd m p v) p)]\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n step_sel_upd_same s st v;\n let s' = step_upd s st v in\n path_sel_upd_same m p' s'", "val buffer_live_not_unused_in\n (#t: typ)\n (b: buffer t)\n (h: HS.mem)\n: Lemma\n ((buffer_live h b /\\ buffer_unused_in b h) ==> False)", "val buffer_unused_in_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (h: HS.mem)\n: Lemma\n (ensures (buffer_unused_in (gsingleton_buffer_of_pointer p) h <==> unused_in p h ))\n [SMTPat (buffer_unused_in (gsingleton_buffer_of_pointer p) h)]", "val buffer_unused_in_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n (h: HS.mem)\n: Lemma\n (requires True)\n (ensures (buffer_unused_in (gbuffer_of_array_pointer p) h <==> unused_in p h))\n [SMTPat (buffer_unused_in (gbuffer_of_array_pointer p) h)]", "let rec path_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Pure (path from to)\n (requires True)\n (ensures (fun _ -> True))\n (decreases q)\n= match q with\n | PathBase -> p\n | PathStep through' to' q' st -> PathStep through' to' (path_concat p q') st", "val frameOf_buffer\n (#t: typ)\n (b: buffer t)\n: GTot HS.rid", "let path_concat_base_r\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (ensures (path_concat p PathBase == p))\n= ()", "val frameOf_buffer_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (frameOf_buffer (gsingleton_buffer_of_pointer p) == frameOf p))\n [SMTPat (frameOf_buffer (gsingleton_buffer_of_pointer p))]", "val frameOf_buffer_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: Lemma\n (ensures (frameOf_buffer (gbuffer_of_array_pointer p) == frameOf p))\n [SMTPat (frameOf_buffer (gbuffer_of_array_pointer p))]", "let rec path_concat_base_l\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_concat PathBase p == p))\n (decreases p)\n [SMTPat (path_concat PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' _ -> path_concat_base_l p'", "val live_region_frameOf_buffer\n (#value: typ)\n (h: HS.mem)\n (p: buffer value)\n: Lemma\n (requires (buffer_live h p))\n (ensures (HS.live_region h (frameOf_buffer p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf_buffer p))];\n [SMTPat (buffer_live h p)]\n ]]", "let rec path_concat_assoc\n (#t0 #t1 #t2 #t3: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n (p23: path t2 t3)\n: Lemma\n (requires True)\n (ensures (path_concat (path_concat p01 p12) p23 == path_concat p01 (path_concat p12 p23)))\n (decreases p23)\n= match p23 with\n | PathBase -> ()\n | PathStep _ _ p23' _ -> path_concat_assoc p01 p12 p23'", "val buffer_as_addr\n (#t: typ)\n (b: buffer t)\n: GTot (x: nat { x > 0 } )", "val buffer_as_addr_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n: Lemma\n (ensures (buffer_as_addr (gsingleton_buffer_of_pointer p) == as_addr p))\n [SMTPat (buffer_as_addr (gsingleton_buffer_of_pointer p))]", "let rec path_sel_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_sel m (path_concat p q) == path_sel (path_sel m p) q))\n (decreases q)\n [SMTPat (path_sel m (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_sel_concat m p q'", "val buffer_as_addr_gbuffer_of_array_pointer\n (#t: typ)\n (#length: array_length_t)\n (p: pointer (TArray length t))\n: Lemma\n (ensures (buffer_as_addr (gbuffer_of_array_pointer p) == as_addr p))\n [SMTPat (buffer_as_addr (gbuffer_of_array_pointer p))]", "val gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Ghost (buffer t)\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (fun _ -> True))", "let rec path_upd_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_upd m (path_concat p q) v == path_upd m p (path_upd (path_sel m p) q v)))\n (decreases q)\n [SMTPat (path_upd m (path_concat p q) v)]\n= match q with\n | PathBase -> ()\n | PathStep through' to' q' st ->\n let (s: otype_of_typ through') = path_sel m (path_concat p q') in\n let (s': otype_of_typ through') = step_upd s st v in\n path_upd_concat m p q' s'", "val frameOf_buffer_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n frameOf_buffer (gsub_buffer b i len) == frameOf_buffer b\n ))\n [SMTPat (frameOf_buffer (gsub_buffer b i len))]", "val buffer_as_addr_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (\n UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\\n buffer_as_addr (gsub_buffer b i len) == buffer_as_addr b\n ))\n [SMTPat (buffer_as_addr (gsub_buffer b i len))]", "let rec path_includes\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Ghost bool\n (requires True)\n (ensures (fun _ -> True))\n (decreases p2)\n= (to1 = to2 && p1 = p2) || (match p2 with\n | PathBase -> false\n | PathStep _ _ p2' _ ->\n path_includes p1 p2'\n )", "val sub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: HST.Stack (buffer t)\n (requires (fun h -> UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h b' h' -> UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ h' == h /\\ b' == gsub_buffer b i len ))", "let rec path_includes_base\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes (PathBase #from) p))\n (decreases p)\n [SMTPat (path_includes PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p2' _ -> path_includes_base p2'", "val offset_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: HST.Stack (buffer t)\n (requires (fun h -> UInt32.v i <= UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h b' h' -> UInt32.v i <= UInt32.v (buffer_length b) /\\ h' == h /\\ b' == gsub_buffer b i (UInt32.sub (buffer_length b) i)))", "let path_includes_refl\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes p p))\n [SMTPat (path_includes p p)]\n= ()", "val buffer_length_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_length (gsub_buffer b i len) == len))\n [SMTPat (buffer_length (gsub_buffer b i len))]", "let path_includes_step_r\n (#from #through #to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (PathStep through to p s)))\n [SMTPat (path_includes p (PathStep through to p s))]\n= ()", "val buffer_live_gsub_buffer_equiv\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ (buffer_live h (gsub_buffer b i len) <==> buffer_live h b)))\n [SMTPat (buffer_live h (gsub_buffer b i len))]", "let rec path_includes_trans\n (#from #to1 #to2 #to3: typ)\n (p1: path from to1)\n (p2: path from to2)\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3})\n: Lemma\n (requires True)\n (ensures (path_includes p1 p3))\n (decreases p3)\n= FStar.Classical.or_elim\n #(to2 == to3 /\\ p2 == p3)\n #(match p3 with\n | PathBase -> False\n | PathStep _ _ p3' _ ->\n\tpath_includes p2 p3')\n #(fun _ -> path_includes p1 p3)\n (fun _ -> ())\n (fun _ -> match p3 with\n | PathBase -> assert False\n | PathStep _ _ p3' _ ->\n\tpath_includes_trans p1 p2 p3'\n )", "val buffer_live_gsub_buffer_intro\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (buffer_live h b /\\ UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_live h (gsub_buffer b i len)))\n [SMTPat (buffer_live h (gsub_buffer b i len))]", "val buffer_unused_in_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ (buffer_unused_in (gsub_buffer b i len) h <==> buffer_unused_in b h)))\n [SMTPat (buffer_unused_in (gsub_buffer b i len) h)]", "let rec path_includes_ind\n (#from: typ)\n (x:((#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2 {path_includes p1 p2} ) ->\n GTot Type0))\n (h_step:\n ((#through: typ) ->\n (#to: typ) ->\n (p: path from through) ->\n (s: step through to { path_includes p (PathStep through to p s) } ) ->\n Lemma (x p (PathStep through to p s))))\n (h_refl:\n ((#to: typ) ->\n (p: path from to {path_includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#to1: typ) ->\n (#to2: typ) ->\n (#to3: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3 /\\ path_includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (requires True)\n (ensures (x p1 p2))\n (decreases p2)\n= FStar.Classical.or_elim\n #(to1 == to2 /\\ p1 == p2)\n #(match p2 with\n | PathBase -> False\n | PathStep _ _ p' _ -> path_includes p1 p')\n #(fun _ -> x p1 p2)\n (fun _ -> h_refl p1)\n (fun _ -> match p2 with\n | PathBase -> assert False\n | PathStep _ _ p2' st ->\n let _ = path_includes_ind x h_step h_refl h_trans p1 p2' in\n let _ = path_includes_step_r p2' st in\n let _ = h_step p2' st in\n h_trans p1 p2' p2\n )", "val gsub_buffer_gsub_buffer\n (#a: typ)\n (b: buffer a)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v len1\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v len1 /\\\n gsub_buffer (gsub_buffer b i1 len1) i2 len2 == gsub_buffer b FStar.UInt32.(i1 +^ i2) len2\n ))\n [SMTPat (gsub_buffer (gsub_buffer b i1 len1) i2 len2)]", "val gsub_buffer_zero_buffer_length\n (#a: typ)\n (b: buffer a)\n: Lemma\n (ensures (gsub_buffer b 0ul (buffer_length b) == b))\n [SMTPat (gsub_buffer b 0ul (buffer_length b))]", "val buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot (Seq.seq (type_of_typ t))", "val buffer_length_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires True)\n (ensures (Seq.length (buffer_as_seq h b) == UInt32.v (buffer_length b)))\n [SMTPat (Seq.length (buffer_as_seq h b))]", "val buffer_as_seq_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n: Lemma\n (requires True)\n (ensures (buffer_as_seq h (gsingleton_buffer_of_pointer p) == Seq.create 1 (gread h p)))\n [SMTPat (buffer_as_seq h (gsingleton_buffer_of_pointer p))]", "let rec path_length\n (#from #to: typ)\n (p: path from to)\n: Tot nat\n (decreases p)\n= match p with\n | PathBase -> 0\n | PathStep _ _ p' _ -> 1 + path_length p'", "val buffer_as_seq_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray length t))\n: Lemma\n (requires True)\n (ensures (buffer_as_seq h (gbuffer_of_array_pointer p) == gread h p))\n [SMTPat (buffer_as_seq h (gbuffer_of_array_pointer p))]", "let path_includes_length\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (ensures (path_length p1 <= path_length p2))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_length p1_ <= path_length p2_)\n (fun #through #to p st -> ())\n (fun #to p -> ())\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> ())\n p1 p2", "val buffer_as_seq_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_as_seq h (gsub_buffer b i len) == Seq.slice (buffer_as_seq h b) (UInt32.v i) (UInt32.v i + UInt32.v len)))\n [SMTPat (buffer_as_seq h (gsub_buffer b i len))]", "let path_includes_step_l\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (~ (path_includes (PathStep through to p s) p)))\n [SMTPat (path_includes (PathStep through to p s) p)]\n= assert (path_length (PathStep through to p s) > path_length p);\n FStar.Classical.forall_intro (path_includes_length #from #to #through (PathStep through to p s))", "val gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Ghost (pointer t)\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (fun _ -> True))", "val pointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: HST.Stack (pointer t)\n (requires (fun h -> UInt32.v i < UInt32.v (buffer_length b) /\\ buffer_live h b))\n (ensures (fun h p h' -> UInt32.v i < UInt32.v (buffer_length b) /\\ h' == h /\\ p == gpointer_of_buffer_cell b i))", "let rec path_includes_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (path_concat p q)))\n (decreases q)\n [SMTPat (path_includes p (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_includes_concat p q'", "val gpointer_of_buffer_cell_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len /\\\n gpointer_of_buffer_cell (gsub_buffer b i1 len) i2 == gpointer_of_buffer_cell b FStar.UInt32.(i1 +^ i2)\n ))", "let path_includes_exists_concat\n (#from #through: typ)\n (p: path from through)\n (#to: typ)\n (q: path from to { path_includes p q } )\n: Lemma\n (ensures (exists (r: path through to) . q == path_concat p r))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> exists r . p2_ == path_concat p1_ r)\n (fun #through #to_ p s -> \n let r = PathStep through to_ PathBase s in\n assert_norm (PathStep through to_ p s == path_concat p r)\n )\n (fun #to p -> FStar.Classical.exists_intro (fun r -> p == path_concat p r) PathBase)\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ ->\n FStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r12 -> p2_ == path_concat p1_ r12) () (fun r12 ->\n\tFStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r23 -> p3_ == path_concat p2_ r23) () (fun r23 ->\n\t path_concat_assoc p1_ r12 r23;\n\t FStar.Classical.exists_intro (fun r -> p3_ == path_concat p1_ r) (path_concat r12 r23)\n\t)\n )\n )\n p q", "let gpointer_of_buffer_cell_gsub_buffer'\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len\n ))\n (ensures (\n UInt32.v i1 + UInt32.v len <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v len /\\\n gpointer_of_buffer_cell (gsub_buffer b i1 len) i2 == gpointer_of_buffer_cell b FStar.UInt32.(i1 +^ i2)\n ))\n [SMTPat (gpointer_of_buffer_cell (gsub_buffer b i1 len) i2)]\n= gpointer_of_buffer_cell_gsub_buffer b i1 len i2", "let path_concat_includes\n (#from #through: typ)\n (p: path from through)\n (phi: (\n (#to: typ) ->\n (p': path from to) ->\n Ghost Type0\n (requires (path_includes p p'))\n (ensures (fun _ -> True))\n ))\n (f: (\n (to: typ) ->\n (p': path through to) ->\n Lemma\n (ensures (phi (path_concat p p')))\n ))\n (#to: typ)\n (q: path from to)\n: Lemma\n (requires (path_includes p q))\n (ensures (path_includes p q /\\ phi q))\n= Classical.forall_intro_2 f;\n path_includes_exists_concat p q", "val live_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (h: HS.mem)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b) /\\\n (live h (gpointer_of_buffer_cell b i) <==> buffer_live h b)\n ))\n [SMTPat (live h (gpointer_of_buffer_cell b i))]", "val gpointer_of_buffer_cell_gsingleton_buffer_of_pointer\n (#t: typ)\n (p: pointer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < 1))\n (ensures (UInt32.v i < 1 /\\ gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) i == p))\n [SMTPat (gpointer_of_buffer_cell (gsingleton_buffer_of_pointer p) i)]", "let step_disjoint\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: GTot bool\n= match s1 with\n | StepField _ fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 <> fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n UInt32.v i1 <> UInt32.v i2\n | StepUField _ _ ->\n (* two fields of the same union are never disjoint *)\n false", "val gpointer_of_buffer_cell_gbuffer_of_array_pointer\n (#length: array_length_t)\n (#t: typ)\n (p: pointer (TArray length t))\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v length))\n (ensures (UInt32.v i < UInt32.v length /\\ gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i == gcell p i))\n [SMTPat (gpointer_of_buffer_cell (gbuffer_of_array_pointer p) i)]", "val frameOf_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ frameOf (gpointer_of_buffer_cell b i) == frameOf_buffer b))\n [SMTPat (frameOf (gpointer_of_buffer_cell b i))]", "let step_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Tot (b: bool { b = true <==> to1 == to2 /\\ s1 == s2 } )\n= match s1 with\n | StepField l1 fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 = fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n i1 = i2\n | StepUField l1 fd1 ->\n let (StepUField _ fd2) = s2 in\n fd1 = fd2", "val as_addr_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ as_addr (gpointer_of_buffer_cell b i) == buffer_as_addr b))\n [SMTPat (as_addr (gpointer_of_buffer_cell b i))]", "val gread_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gread h (gpointer_of_buffer_cell b i) == Seq.index (buffer_as_seq h b) (UInt32.v i)))\n [SMTPat (gread h (gpointer_of_buffer_cell b i))]", "let step_disjoint_not_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2 == true))\n (ensures (step_eq s1 s2 == false))\n= ()", "val gread_gpointer_of_buffer_cell'\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gread h (gpointer_of_buffer_cell b i) == Seq.index (buffer_as_seq h b) (UInt32.v i)))", "let step_disjoint_sym\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2))\n (ensures (step_disjoint s2 s1))\n= ()", "val index_buffer_as_seq\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: nat)\n: Lemma\n (requires (i < UInt32.v (buffer_length b)))\n (ensures (i < UInt32.v (buffer_length b) /\\ Seq.index (buffer_as_seq h b) i == gread h (gpointer_of_buffer_cell b (UInt32.uint_to_t i))))\n [SMTPat (Seq.index (buffer_as_seq h b) i)]", "path_disjoint_t", "val gsingleton_buffer_of_pointer_gcell\n (#t: typ)\n (#len: array_length_t)\n (p: pointer (TArray len t))\n (i: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v len\n ))\n (ensures (\n UInt32.v i < UInt32.v len /\\\n gsingleton_buffer_of_pointer (gcell p i) == gsub_buffer (gbuffer_of_array_pointer p) i 1ul\n ))\n [SMTPat (gsingleton_buffer_of_pointer (gcell p i))]", "PathDisjointStep", "PathDisjointStep", "PathDisjointStep", "through", "through", "to1", "to1", "to2", "to2", "p", "p", "s1", "s1", "s2", "s2", "PathDisjointIncludes", "PathDisjointIncludes", "PathDisjointIncludes", "to1", "to1", "to2", "to2", "p1", "p1", "p2", "p2", "val gsingleton_buffer_of_pointer_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i < UInt32.v (buffer_length b)\n ))\n (ensures (\n UInt32.v i < UInt32.v (buffer_length b) /\\\n gsingleton_buffer_of_pointer (gpointer_of_buffer_cell b i) == gsub_buffer b i 1ul\n ))\n [SMTPat (gsingleton_buffer_of_pointer (gpointer_of_buffer_cell b i))]", "to1'", "to1'", "to2'", "to2'", "p1'", "p1'", "p2'", "p2'", "let rec path_disjoint_t_rect\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (h: path_disjoint_t p1 p2) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n (h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)) ->\n GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2'}) ->\n (h: path_disjoint_t p1 p2) ->\n (h': path_disjoint_t p1' p2') ->\n (ihx: x p1 p2 h) ->\n GTot (x p1' p2' h')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n: Ghost (x p1 p2 h)\n (requires True)\n (ensures (fun _ -> True))\n (decreases h)\n= match h with\n | PathDisjointStep p s1 s2 -> h_step p s1 s2 h\n | PathDisjointIncludes p1_ p2_ p1' p2' h_ -> h_includes p1_ p2_ p1' p2' h_ h (path_disjoint_t_rect x h_step h_includes p1_ p2_ h_)", "val buffer_readable\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: GTot Type0", "val buffer_readable_buffer_live\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (buffer_readable h b))\n (ensures (buffer_live h b))\n [SMTPatOr [\n [SMTPat (buffer_readable h b)];\n [SMTPat (buffer_live h b)];\n ]]", "val buffer_readable_gsingleton_buffer_of_pointer\n (#t: typ)\n (h: HS.mem)\n (p: pointer t)\n: Lemma\n (ensures (buffer_readable h (gsingleton_buffer_of_pointer p) <==> readable h p))\n [SMTPat (buffer_readable h (gsingleton_buffer_of_pointer p))]", "val buffer_readable_gbuffer_of_array_pointer\n (#len: array_length_t)\n (#t: typ)\n (h: HS.mem)\n (p: pointer (TArray len t))\n: Lemma\n (requires True)\n (ensures (buffer_readable h (gbuffer_of_array_pointer p) <==> readable h p))\n [SMTPat (buffer_readable h (gbuffer_of_array_pointer p))]", "let path_disjoint\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: GTot Type0\n= squash (path_disjoint_t p1 p2)", "val buffer_readable_gsub_buffer\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_readable h b))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ buffer_readable h (gsub_buffer b i len)))\n [SMTPat (buffer_readable h (gsub_buffer b i len))]", "let path_disjoint_ind\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2 {path_disjoint p1 p2} ) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 /\\ path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) } ) ->\n Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2) )))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2 { path_disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun (h: path_disjoint_t p1 p2) ->\n path_disjoint_t_rect\n (fun #v1 #v2 p1 p2 h -> let _ = FStar.Squash.return_squash h in squash (x p1 p2))\n (fun #through #to1 #to2 p s1 s2 h -> let _ = FStar.Squash.return_squash h in h_step p s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' h h' hx ->\n let _ = FStar.Squash.return_squash h in\n let _ = FStar.Squash.return_squash h' in\n let _ = FStar.Squash.return_squash hx in\n h_includes p1 p2 p1' p2')\n p1 p2 h)", "val readable_gpointer_of_buffer_cell\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ buffer_readable h b))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ readable h (gpointer_of_buffer_cell b i)))\n [SMTPat (readable h (gpointer_of_buffer_cell b i))]", "val buffer_readable_intro\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (\n buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )))\n (ensures (buffer_readable h b))", "val buffer_readable_elim\n (#t: typ)\n (h: HS.mem)\n (b: buffer t)\n: Lemma\n (requires (\n buffer_readable h b\n ))\n (ensures (\n buffer_live h b /\\ (\n forall (i: UInt32.t) .\n UInt32.v i < UInt32.v (buffer_length b) ==>\n readable h (gpointer_of_buffer_cell b i)\n )))", "val loc : Type u#0", "let path_disjoint_step\n (#from: typ)\n (#through: typ)\n (#to1: typ)\n (#to2: typ)\n (p: path from through)\n (s1: step through to1)\n (s2: step through to2 { step_disjoint s1 s2 } )\n: Lemma\n (requires True)\n (ensures (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2)))\n [SMTPat (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2))]\n= FStar.Classical.give_witness (FStar.Squash.return_squash (PathDisjointStep p s1 s2))", "val loc_none: loc", "val loc_union\n (s1 s2: loc)\n: GTot loc", "val loc_union_idem\n (s: loc)\n: Lemma\n (loc_union s s == s)\n [SMTPat (loc_union s s)]", "let path_disjoint_includes\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (#to2': typ)\n (p1': path from to1')\n (p2': path from to2')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1' /\\ path_includes p2 p2'))\n (ensures (path_disjoint p1' p2'))\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun h -> FStar.Squash.return_squash (PathDisjointIncludes p1 p2 p1' p2' h))", "val loc_pointer\n (#t: typ)\n (p: pointer t)\n: GTot loc", "val loc_buffer\n (#t: typ)\n (b: buffer t)\n: GTot loc", "val loc_addresses\n (r: HS.rid)\n (n: Set.set nat)\n: GTot loc", "val loc_regions\n (r: Set.set HS.rid)\n: GTot loc", "let path_disjoint_includes_l\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (p1': path from to1')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1'))\n (ensures (path_disjoint p1' p2))\n [SMTPatOr [\n [SMTPat (path_disjoint p1 p2); SMTPat (path_includes p1 p1')];\n [SMTPat (path_disjoint p1' p2); SMTPat (path_includes p1 p1')];\n ]]\n= path_disjoint_includes p1 p2 p1' p2", "val loc_includes\n (s1 s2: loc)\n: GTot Type0", "val loc_includes_refl\n (s: loc)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]", "val loc_includes_trans\n (s1 s2 s3: loc)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))", "let path_disjoint_sym\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint p2 p1))\n [SMTPatOr [[SMTPat (path_disjoint p1 p2)]; [SMTPat (path_disjoint p2 p1)]]]\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint p2 p1)\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step p s2 s1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_includes p2 p1 p2' p1')\n p1 p2", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]", "let rec path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Tot (b: bool { b == true <==> (value1 == value2 /\\ p1 == p2) } )\n (decreases p1)\n= match p1 with\n | PathBase -> PathBase? p2\n | PathStep _ _ p1' s1 ->\n PathStep? p2 && (\n let (PathStep _ _ p2' s2) = p2 in (\n path_equal p1' p2' &&\n step_eq s1 s2\n ))", "val loc_includes_none\n (s: loc)\n: Lemma\n (loc_includes s loc_none)\n [SMTPat (loc_includes s loc_none)]", "val loc_includes_pointer_pointer\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (includes p1 p2))\n (ensures (loc_includes (loc_pointer p1) (loc_pointer p2)))\n [SMTPat (loc_includes (loc_pointer p1) (loc_pointer p2))]", "let rec path_length_concat\n (#t0 #t1 #t2: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n: Lemma\n (requires True)\n (ensures (path_length (path_concat p01 p12) == path_length p01 + path_length p12))\n (decreases p12)\n= match p12 with\n | PathBase -> ()\n | PathStep _ _ p' s' -> path_length_concat p01 p'", "val loc_includes_gsingleton_buffer_of_pointer\n (l: loc)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_includes l (loc_pointer p)))\n (ensures (loc_includes l (loc_buffer (gsingleton_buffer_of_pointer p))))\n [SMTPat (loc_includes l (loc_buffer (gsingleton_buffer_of_pointer p)))]", "val loc_includes_gbuffer_of_array_pointer\n (l: loc)\n (#len: array_length_t)\n (#t: typ)\n (p: pointer (TArray len t))\n: Lemma\n (requires (loc_includes l (loc_pointer p)))\n (ensures (loc_includes l (loc_buffer (gbuffer_of_array_pointer p))))\n [SMTPat (loc_includes l (loc_buffer (gbuffer_of_array_pointer p)))]", "let rec path_concat_inj_l\n (#from #through1: typ)\n (p1_: path from through1)\n (#v1: typ)\n (p1: path through1 v1)\n (#through2 #v2: typ)\n (p2_: path from through2)\n (p2: path through2 v2)\n: Lemma\n (requires (path_equal (path_concat p1_ p1) (path_concat p2_ p2) == true /\\ path_length p1_ == path_length p2_))\n (ensures (path_equal p1_ p2_ == true /\\ path_equal p1 p2 == true))\n (decreases p1)\n= path_length_concat p1_ p1;\n path_length_concat p2_ p2;\n match p1 with\n | PathBase -> ()\n | PathStep _ _ p1' s1 ->\n let (PathStep _ _ p2' s2) = p2 in\n path_concat_inj_l p1_ p1' p2_ p2'", "val loc_includes_gpointer_of_array_cell\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_includes l (loc_pointer (gpointer_of_buffer_cell b i))))\n [SMTPat (loc_includes l (loc_pointer (gpointer_of_buffer_cell b i)))]", "val loc_includes_gsub_buffer_r\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n (len: UInt32.t)\n: Lemma\n (requires (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer b)))\n (ensures (UInt32.v i + UInt32.v len <= UInt32.v (buffer_length b) /\\ loc_includes l (loc_buffer (gsub_buffer b i len))))\n [SMTPat (loc_includes l (loc_buffer (gsub_buffer b i len)))]", "path_disjoint_decomp_t", "PathDisjointDecomp", "PathDisjointDecomp", "PathDisjointDecomp", "d_through", "d_through", "val loc_includes_gsub_buffer_l\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\ UInt32.v i1 <= UInt32.v i2 /\\ UInt32.v i2 + UInt32.v len2 <= UInt32.v i1 + UInt32.v len1))\n (ensures (UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\ UInt32.v i1 <= UInt32.v i2 /\\ UInt32.v i2 + UInt32.v len2 <= UInt32.v i1 + UInt32.v len1 /\\ loc_includes (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2))))\n [SMTPat (loc_includes (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2)))]", "d_p", "d_p", "d_v1", "d_v1", "d_s1", "d_s1", "d_p1'", "d_p1'", "d_v2", "d_v2", "d_s2", "d_s2", "d_p2'", "d_p2'", "val loc_includes_addresses_pointer\n (#t: typ)\n (r: HS.rid)\n (s: Set.set nat)\n (p: pointer t)\n: Lemma\n (requires (frameOf p == r /\\ Set.mem (as_addr p) s))\n (ensures (loc_includes (loc_addresses r s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_addresses r s) (loc_pointer p))]", "let path_disjoint_decomp_includes\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (#value1': typ)\n (#value2': typ)\n (p1': path from value1')\n (p2': path from value2')\n: Lemma\n (requires (\n path_includes p1 p1' /\\\n path_includes p2 p2' /\\ (\n exists (d : path_disjoint_decomp_t p1 p2) . True\n )))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n= let f\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n (requires (\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n = let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_assoc (PathStep _ _ p s1) p1_ q1;\n path_concat_assoc (PathStep _ _ p s2) p2_ q2;\n let d' : path_disjoint_decomp_t p1' p2' =\n PathDisjointDecomp _ p _ s1 (path_concat p1_ q1) _ s2 (path_concat p2_ q2) ()\n in\n Classical.exists_intro (fun _ -> True) d'\n in\n let g\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n ((\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ) ==> (\n exists (d: path_disjoint_decomp_t p1' p2') . True\n ))\n = Classical.move_requires (f q1 q2) d // FIXME: annoying to repeat those type annotations above. WHY WHY WHY can't I just use (fun q1 q2 d -> Classical.move_requires (f q1 q2) d) as an argument of Classical.forall_intro_3 below instead of this g???\n in\n path_includes_exists_concat p1 p1' ;\n path_includes_exists_concat p2 p2' ;\n let _ : squash (exists (d: path_disjoint_decomp_t p1' p2') . True) =\n Classical.forall_intro_3 g\n in\n ()", "val loc_includes_addresses_buffer\n (#t: typ)\n (r: HS.rid)\n (s: Set.set nat)\n (p: buffer t)\n: Lemma\n (requires (frameOf_buffer p == r /\\ Set.mem (buffer_as_addr p) s))\n (ensures (loc_includes (loc_addresses r s) (loc_buffer p)))\n [SMTPat (loc_includes (loc_addresses r s) (loc_buffer p))]", "val loc_includes_region_pointer\n (#t: typ)\n (s: Set.set HS.rid)\n (p: pointer t)\n: Lemma\n (requires (Set.mem (frameOf p) s))\n (ensures (loc_includes (loc_regions s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_regions s) (loc_pointer p))]", "val loc_includes_region_buffer\n (#t: typ)\n (s: Set.set HS.rid)\n (b: buffer t)\n: Lemma\n (requires (Set.mem (frameOf_buffer b) s))\n (ensures (loc_includes (loc_regions s) (loc_buffer b)))\n [SMTPat (loc_includes (loc_regions s) (loc_buffer b))]", "val loc_includes_region_addresses\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions s) (loc_addresses r a)))\n [SMTPat (loc_includes (loc_regions s) (loc_addresses r a))]", "val loc_includes_region_region\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset s2 s1))\n (ensures (loc_includes (loc_regions s1) (loc_regions s2)))\n [SMTPat (loc_includes (loc_regions s1) (loc_regions s2))]", "val loc_includes_region_union_l\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2)))\n [SMTPat (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2))]", "let path_disjoint_decomp\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (exists (d: path_disjoint_decomp_t p1 p2) . True))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> exists (d: path_disjoint_decomp_t #from #v1 #v2 p1 p2) . True)\n (fun #through #to1 #to2 p s1 s2 ->\n let d : path_disjoint_decomp_t (PathStep _ _ p s1) (PathStep _ _ p s2) =\n PathDisjointDecomp _ p _ s1 PathBase _ s2 PathBase ()\n in\n Classical.exists_intro (fun _ -> True) d\n )\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_decomp_includes p1 p2 p1' p2')\n p1 p2", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0", "val loc_disjoint_sym\n (s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))\n [SMTPat (loc_disjoint s1 s2)]", "val loc_disjoint_none_r\n (s: loc)\n: Lemma\n (ensures (loc_disjoint s loc_none))\n [SMTPat (loc_disjoint s loc_none)]", "let path_disjoint_not_path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_equal p1 p2 == false))\n= let f\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma (path_equal p1 p2 == false)\n = if path_equal p1 p2\n then\n let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_inj_l (PathStep _ _ p s1) p1_ (PathStep _ _ p s2) p2_\n else ()\n in\n path_disjoint_decomp p1 p2;\n Classical.forall_intro f", "val loc_disjoint_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))\n [SMTPat (loc_disjoint s (loc_union s1 s2))]", "val loc_disjoint_root\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))\n (ensures (loc_disjoint (loc_pointer p1) (loc_pointer p2)))", "val loc_disjoint_gfield\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd1 fd2: struct_field l)\n: Lemma\n (requires (fd1 <> fd2))\n (ensures (loc_disjoint (loc_pointer (gfield p fd1)) (loc_pointer (gfield p fd2))))\n [SMTPat (loc_disjoint (loc_pointer (gfield p fd1)) (loc_pointer (gfield p fd2)))]", "let rec path_destruct_l\n (#t0 #t2: typ)\n (p: path t0 t2)\n: Tot (\n x: option (t1: typ & (s: step t0 t1 & (p' : path t1 t2 { p == path_concat (PathStep _ _ PathBase s) p' /\\ path_length p' < path_length p } ) ) )\n { None? x <==> PathBase? p }\n )\n (decreases p)\n= match p with\n | PathBase -> None\n | PathStep _ _ p' s ->\n begin match path_destruct_l p' with\n | None -> Some (| _, (| s, PathBase |) |)\n | Some (| t_, (| s_, p_ |) |) ->\n Some (| t_, (| s_, PathStep _ _ p_ s |) |)\n end", "val loc_disjoint_gcell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\\n UInt32.v i1 <> UInt32.v i2\n ))\n (ensures (\n UInt32.v i1 < UInt32.v length /\\\n UInt32.v i2 < UInt32.v length /\\ \n loc_disjoint (loc_pointer (gcell p i1)) (loc_pointer (gcell p i2))\n ))\n [SMTPat (loc_disjoint (loc_pointer (gcell p i1)) (loc_pointer (gcell p i2)))]", "let rec path_equal'\n (#from #to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Tot (b: bool { b == true <==> to1 == to2 /\\ p1 == p2 } )\n (decreases (path_length p1))\n= match path_destruct_l p1 with\n | None -> PathBase? p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> false\n | (Some (| t2, (| s2, p2' |) |) ) ->\n step_eq s1 s2 &&\n path_equal' p1' p2'\n end", "val loc_disjoint_includes\n (p1 p2 p1' p2' : loc)\n: Lemma\n (requires (loc_includes p1 p1' /\\ loc_includes p2 p2' /\\ loc_disjoint p1 p2))\n (ensures (loc_disjoint p1' p2'))", "let path_includes_concat_l\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_includes p1 p2))\n (ensures (path_includes (path_concat p0 p1) (path_concat p0 p2)))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_includes (path_concat p0 p1_) (path_concat p0 p2_))\n (fun #through #to p st -> ())\n (fun #to p -> path_includes_refl (path_concat p0 p))\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> path_includes_trans (path_concat p0 p1_) (path_concat p0 p2_) (path_concat p0 p3_))\n p1 p2", "val live_unused_in_disjoint_strong\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (frameOf p1 <> frameOf p2 \\/ as_addr p1 <> as_addr p2))", "let path_disjoint_concat\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint (path_concat p0 p1) (path_concat p0 p2)))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint (path_concat p0 p1) (path_concat p0 p2))\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step (path_concat p0 p) s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n path_includes_concat_l p0 p1 p1';\n path_includes_concat_l p0 p2 p2';\n path_disjoint_includes (path_concat p0 p1) (path_concat p0 p2) (path_concat p0 p1') (path_concat p0 p2'))\n p1 p2", "val live_unused_in_disjoint\n (#value1: typ)\n (#value2: typ)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: pointer value2)\n: Lemma\n (requires (live h p1 /\\ unused_in p2 h))\n (ensures (loc_disjoint (loc_pointer p1) (loc_pointer p2)))\n [SMTPatOr [\n [SMTPat (loc_disjoint (loc_pointer p1) (loc_pointer p2)); SMTPat (live h p1)];\n [SMTPat (loc_disjoint (loc_pointer p1) (loc_pointer p2)); SMTPat (unused_in p2 h)];\n [SMTPat (live h p1); SMTPat (unused_in p2 h)];\n ]]", "val pointer_live_reference_unused_in_disjoint\n (#value1: typ)\n (#value2: Type0)\n (h: HS.mem)\n (p1: pointer value1)\n (p2: HS.reference value2)\n: Lemma\n (requires (live h p1 /\\ HS.unused_in p2 h))\n (ensures (loc_disjoint (loc_pointer p1) (loc_addresses (HS.frameOf p2) (Set.singleton (HS.as_addr p2)))))\n [SMTPat (live h p1); SMTPat (HS.unused_in p2 h)]", "val reference_live_pointer_unused_in_disjoint\n (#value1: Type0)\n (#value2: typ)\n (h: HS.mem)\n (p1: HS.reference value1)\n (p2: pointer value2)\n: Lemma\n (requires (HS.contains h p1 /\\ unused_in p2 h))\n (ensures (loc_disjoint (loc_addresses (HS.frameOf p1) (Set.singleton (HS.as_addr p1))) (loc_pointer p2)))\n [SMTPat (HS.contains h p1); SMTPat (unused_in p2 h)]", "val loc_disjoint_gsub_buffer\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (len1: UInt32.t)\n (i2: UInt32.t)\n (len2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v (buffer_length b) /\\ (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v i2 \\/\n UInt32.v i2 + UInt32.v len2 <= UInt32.v i1\n )))\n (ensures (\n UInt32.v i1 + UInt32.v len1 <= UInt32.v (buffer_length b) /\\\n UInt32.v i2 + UInt32.v len2 <= UInt32.v (buffer_length b) /\\\n loc_disjoint (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2))\n ))\n [SMTPat (loc_disjoint (loc_buffer (gsub_buffer b i1 len1)) (loc_buffer (gsub_buffer b i2 len2)))]", "let step_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2 {step_disjoint s1 s2})\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n: Lemma\n (step_sel (step_upd m s1 v) s2 == step_sel m s2)\n= match s1 with\n | StepField l1 fd1 ->\n let (m: ostruct l1) = m in\n let (StepField _ fd2) = s2 in\n begin match m with\n | None -> ()\n | Some m -> DM.sel_upd_other m fd1 v fd2\n end\n | StepCell length1 _ i1 ->\n let (m: option (array length1 (otype_of_typ to1))) = m in\n let (StepCell _ _ i2) = s2 in\n begin match m with\n | None -> ()\n | Some m ->\n Seq.lemma_index_upd2 m (UInt32.v i1) v (UInt32.v i2)\n end", "val loc_disjoint_gpointer_of_buffer_cell\n (#t: typ)\n (b: buffer t)\n (i1: UInt32.t)\n (i2: UInt32.t)\n: Lemma\n (requires (\n UInt32.v i1 < UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v (buffer_length b) /\\ (\n UInt32.v i1 <> UInt32.v i2\n )))\n (ensures (\n UInt32.v i1 < UInt32.v (buffer_length b) /\\\n UInt32.v i2 < UInt32.v (buffer_length b) /\\\n loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i1)) (loc_pointer (gpointer_of_buffer_cell b i2))\n ))\n [SMTPat (loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i1)) (loc_pointer (gpointer_of_buffer_cell b i2)))]", "let path_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_disjoint p1 p2})\n: Lemma\n (ensures (forall (m: otype_of_typ from) (v: otype_of_typ to1) . path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> forall (m: otype_of_typ from) (v: otype_of_typ v1) . path_sel (path_upd m p1_ v) p2_ == path_sel m p2_)\n (fun #through #to1_ #to2_ p s1 s2 ->\n FStar.Classical.forall_intro_sub #_ #(fun m -> forall (v: otype_of_typ to1_) . path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun m ->\n\t FStar.Classical.forall_intro_sub #_ #(fun v -> path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun v ->\n\t let m0 = path_sel m p in\n let m1 = step_sel m0 s1 in\n let m2 = step_sel m0 s2 in\n let m0' = step_upd m0 s1 v in\n path_sel_upd_same m p m0';\n step_sel_upd_other s1 s2 m0 v\n )))\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n let h1: squash (exists r1 . p1' == path_concat p1 r1) = path_includes_exists_concat p1 p1' in\n let h2: squash (exists r2 . p2' == path_concat p2 r2) = path_includes_exists_concat p2 p2' in\n FStar.Classical.forall_intro_sub #_ #(fun (m: otype_of_typ from) -> forall v . path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (m: otype_of_typ from) ->\n FStar.Classical.forall_intro_sub #_ #(fun (v: otype_of_typ v1') -> path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (v: otype_of_typ v1') ->\n FStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h1 (fun r1 ->\n\tFStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h2 (fun r2 ->\n\t path_upd_concat m p1 r1 v;\n\t path_sel_concat m p2 r2\n\t )))))\n p1 p2", "let loc_disjoint_gpointer_of_buffer_cell_r\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint l (loc_buffer b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint l (loc_pointer (gpointer_of_buffer_cell b i))))\n [SMTPat (loc_disjoint l (loc_pointer (gpointer_of_buffer_cell b i)))]\n= loc_disjoint_includes l (loc_buffer b) l (loc_pointer (gpointer_of_buffer_cell b i))", "let loc_disjoint_gpointer_of_buffer_cell_l\n (l: loc)\n (#t: typ)\n (b: buffer t)\n (i: UInt32.t)\n: Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint (loc_buffer b) l))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i)) l))\n [SMTPat (loc_disjoint (loc_pointer (gpointer_of_buffer_cell b i)) l)]\n= loc_disjoint_includes (loc_buffer b) l (loc_pointer (gpointer_of_buffer_cell b i)) l", "let path_sel_upd_other'\n (#from: typ)\n (#to1: typ)\n (p1: path from to1)\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n (#to2: typ)\n (p2: path from to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_sel_upd_other p1 p2", "val loc_disjoint_addresses\n (r1 r2: HS.rid)\n (n1 n2: Set.set nat)\n: Lemma\n (requires (r1 <> r2 \\/ Set.subset (Set.intersect n1 n2) Set.empty))\n (ensures (loc_disjoint (loc_addresses r1 n1) (loc_addresses r2 n2)))\n [SMTPat (loc_disjoint (loc_addresses r1 n1) (loc_addresses r2 n2))]", "val loc_disjoint_pointer_addresses\n (#t: typ)\n (p: pointer t)\n (r: HS.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r <> frameOf p \\/ (~ (Set.mem (as_addr p) n))))\n (ensures (loc_disjoint (loc_pointer p) (loc_addresses r n)))\n [SMTPat (loc_disjoint (loc_pointer p) (loc_addresses r n))]", "let equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_equal (Pointer?.p p1) (Pointer?.p p2)", "val loc_disjoint_buffer_addresses\n (#t: typ)\n (p: buffer t)\n (r: HH.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r <> frameOf_buffer p \\/ (~ (Set.mem (buffer_as_addr p) n))))\n (ensures (loc_disjoint (loc_buffer p) (loc_addresses r n)))\n [SMTPat (loc_disjoint (loc_buffer p) (loc_addresses r n))]", "let as_addr (#t: typ) (p: pointer t) =\n HS.aref_as_addr (Pointer?.contents p)", "val loc_disjoint_regions\n (rs1 rs2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset (Set.intersect rs1 rs2) Set.empty))\n (ensures (loc_disjoint (loc_regions rs1) (loc_regions rs2)))\n [SMTPat (loc_disjoint (loc_regions rs1) (loc_regions rs2))]", "let _field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TStruct l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepField _ fd) in\n Pointer from contents p''", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0", "let _cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t {UInt32.v i < UInt32.v length})\n: Tot (pointer value)\n= let (Pointer from contents p') = p in\n let p' : path from (TArray length value) = p' in\n let p'' : path from value = PathStep _ _ p' (StepCell _ _ i) in\n Pointer from contents p''", "val modifies_loc_regions_intro\n (rs: Set.set HS.rid)\n (h1 h2: HS.mem)\n: Lemma\n (requires (HS.modifies rs h1 h2))\n (ensures (modifies (loc_regions rs) h1 h2))", "val modifies_pointer_elim\n (s: loc)\n (h1 h2: HS.mem)\n (#a': typ)\n (p': pointer a')\n: Lemma\n (requires (\n modifies s h1 h2 /\\\n live h1 p' /\\\n loc_disjoint (loc_pointer p') s\n ))\n (ensures (\n equal_values h1 p' h2 p'\n ))\n [SMTPatOr [\n [ SMTPat (modifies s h1 h2); SMTPat (gread h1 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (readable h1 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (live h1 p') ];\n [ SMTPat (modifies s h1 h2); SMTPat (gread h2 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (readable h2 p') ] ;\n [ SMTPat (modifies s h1 h2); SMTPat (live h2 p') ]\n ] ]", "let _ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TUnion l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepUField _ fd) in\n Pointer from contents p''", "let unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0\n= let (Pointer from contents p') = p in\n HS.aref_unused_in contents h", "let pointer_ref_contents : Type0 = (t: typ & otype_of_typ t)", "let live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0\n= let rel = Heap.trivial_preorder pointer_ref_contents in\n let (Pointer from contents _) = p in (\n HS.aref_live_at h contents pointer_ref_contents rel /\\ (\n let untyped_contents = HS.greference_of contents pointer_ref_contents rel in (\n dfst (HS.sel h untyped_contents) == from\n )))", "val modifies_buffer_elim\n (#t1: typ)\n (b: buffer t1)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_buffer b) p /\\\n buffer_live h b /\\\n (UInt32.v (buffer_length b) == 0 ==> buffer_live h' b) /\\ // necessary for liveness, because all buffers of size 0 are disjoint for any memory location, so we cannot talk about their liveness individually without referring to a larger nonempty buffer\n modifies p h h'\n ))\n (ensures (\n buffer_live h' b /\\ (\n buffer_readable h b ==> (\n\tbuffer_readable h' b /\\\n\tbuffer_as_seq h b == buffer_as_seq h' b\n ))))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (buffer_as_seq h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_readable h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_live h b) ];\n [ SMTPat (modifies p h h'); SMTPat (buffer_as_seq h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_readable h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (buffer_live h' b) ]\n ] ]", "let nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0\n= if g_is_null p\n then True\n else live h p", "let live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= ()", "let g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n= ()", "val modifies_reference_elim\n (#t: Type0)\n (b: HS.reference t)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_addresses (HS.frameOf b) (Set.singleton (HS.as_addr b))) p /\\\n HS.contains h b /\\\n modifies p h h'\n ))\n (ensures (\n HS.contains h' b /\\\n HS.sel h b == HS.sel h' b\n ))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h b) ];\n [ SMTPat (modifies p h h'); SMTPat (HS.sel h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (HS.contains h' b) ]\n ] ]", "let greference_of\n (#value: typ)\n (p: pointer value)\n: Ghost (HS.reference pointer_ref_contents)\n (requires (exists h . live h p))\n (ensures (fun x -> (exists h . live h p) /\\ x == HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\ HS.aref_of x == Pointer?.contents p))\n= HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)", "let unused_in_greference_of\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: Lemma\n (requires (exists h . live h p))\n (ensures ((exists h . live h p) /\\ (HS.unused_in (greference_of p) h <==> unused_in p h)))\n [SMTPatOr [\n [SMTPat (HS.unused_in (greference_of p) h)];\n [SMTPat (unused_in p h)];\n ]]\n= ()", "val modifies_refl\n (s: loc)\n (h: HS.mem)\n: Lemma\n (modifies s h h)\n [SMTPat (modifies s h h)]", "let live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= let f () : Lemma\n (requires (live h p /\\ p `unused_in` h))\n (ensures False)\n = let r = greference_of p in\n HS.contains_aref_unused_in h r (Pointer?.contents p)\n in\n Classical.move_requires f ()", "val modifies_loc_includes\n (s1: loc)\n (h h': HS.mem)\n (s2: loc)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\n [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]", "let gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)\n= if StrongExcludedMiddle.strong_excluded_middle (live h p)\n then\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n value_of_ovalue value (path_sel c (Pointer?.p p))\n else\n dummy_val value", "val modifies_trans\n (s12: loc)\n (h1 h2: HS.mem)\n (s23: loc)\n (h3: HS.mem)\n: Lemma\n (requires (modifies s12 h1 h2 /\\ modifies s23 h2 h3))\n (ensures (modifies (loc_union s12 s23) h1 h3))\n [SMTPat (modifies s12 h1 h2); SMTPat (modifies s23 h2 h3)]", "let modifies_0 (h0 h1: HS.mem) : GTot Type0 =\n modifies loc_none h0 h1", "let frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid\n= HS.frameOf_aref (Pointer?.contents p)", "let modifies_1 (#t: typ) (p: pointer t) (h0 h1: HS.mem) : GTot Type0 =\n modifies (loc_pointer p) h0 h1" ], "closest": [ "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\n [SMTPat (HS.fresh_frame h0 h1); SMTPat (HS.popped h2 h3); SMTPat (modifies s h0 h3)]\nlet modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped", "val modifies_liveness_insensitive_region_buffer_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (x: B.buffer t)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (B.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (B.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_buffer_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (B.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (B.frameOf x))];\n ]]\n= modifies_liveness_insensitive_region_buffer loc_none l2 h h' x", "val modifies_live_region\n (s: loc)\n (h1 h2: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (modifies s h1 h2 /\\ loc_disjoint s (loc_region_only false r) /\\ HS.live_region h1 r))\n (ensures (HS.live_region h2 r))\n [SMTPatOr [\n [SMTPat (modifies s h1 h2); SMTPat (HS.live_region h1 r)];\n [SMTPat (modifies s h1 h2); SMTPat (HS.live_region h2 r)];\n ]]\nlet modifies_live_region = MG.modifies_live_region", "val modifies_liveness_insensitive_region_mreference_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_mreference_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\n= modifies_liveness_insensitive_region_mreference loc_none l2 h h' x", "val modifies_liveness_insensitive_region_mreference_weak\n (l2: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_mreference_weak\n (l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma (requires (modifies l2 h h' /\\\n region_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\n = modifies_liveness_insensitive_region_mreference loc_none l2 h h' x", "val modifies_liveness_insensitive_region_buffer_weak\n (l2: loc)\n (h h': HS.mem)\n (#a: Type0)\n (#rrel #rel: srel a)\n (x: mbuffer a rrel rel)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (frameOf x))]\n ]\n ]\nlet modifies_liveness_insensitive_region_buffer_weak\n (l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies l2 h h' /\\\n region_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' (frameOf x))];\n ]]\n = modifies_liveness_insensitive_region_buffer loc_none l2 h h' x", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h (HS.frameOf x))];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' (HS.frameOf x))];\n ]]\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val modifies_liveness_insensitive_region_buffer\n (l1 l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_buffer x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (frameOf x)))\n (ensures (HS.live_region h' (frameOf x)))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h (frameOf x))];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' (frameOf x))];\n ]]\nlet modifies_liveness_insensitive_region_buffer l1 l2 h h' #_ #_ #_ x =\n if g_is_null x then ()\n else MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(frameOf x) #(as_addr x) (ubuffer_of_buffer x)", "val valid_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires (live_slice h sl /\\ B.modifies l h h' /\\ B.loc_disjoint (loc_slice_from sl pos) l))\n (ensures\n ((valid p h sl pos \\/ valid p h' sl pos) ==>\n (valid p h sl pos /\\\n valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos))))\n [\n SMTPatOr\n [\n [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]\n ]\n ]\nlet valid_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n: Lemma\n (requires (live_slice h sl /\\ B.modifies l h h' /\\ B.loc_disjoint (loc_slice_from sl pos) l))\n (ensures (\n (valid p h sl pos \\/ valid p h' sl pos) ==> (\n valid p h sl pos /\\\n valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos)\n )))\n [SMTPatOr [\n [SMTPat (valid p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')];\n ]]\n= let f () : Lemma\n (requires (U32.v pos <= U32.v sl.len /\\ (valid p h sl pos \\/ valid p h' sl pos)))\n (ensures (\n valid p h sl pos /\\\n valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos)\n ))\n =\n B.modifies_buffer_from_to_elim sl.base pos sl.len l h h';\n valid_facts p h sl pos;\n valid_facts p h' sl pos\n in\n Classical.move_requires f ()", "val modifies_fresh_frame_popped\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\nlet modifies_fresh_frame_popped = MG.modifies_fresh_frame_popped", "val fresh_frame_modifies (h0 h1: HS.mem) : Lemma\n (requires (HS.fresh_frame h0 h1))\n (ensures (modifies loc_none h0 h1))\n [SMTPat (HS.fresh_frame h0 h1)]\nlet fresh_frame_modifies h0 h1 = MG.fresh_frame_modifies #_ cls h0 h1", "val fresh_frame_loc_not_unused_in_disjoint (h0 h1: HS.mem)\n : Lemma (requires (HS.fresh_frame h0 h1))\n (ensures (loc_disjoint (loc_region_only false (HS.get_tip h1)) (loc_not_unused_in h0)))\n [SMTPat (HS.fresh_frame h0 h1)]\nlet fresh_frame_loc_not_unused_in_disjoint\n (h0 h1: HS.mem)\n: Lemma\n (requires (HS.fresh_frame h0 h1))\n (ensures (loc_disjoint (loc_region_only false (HS.get_tip h1)) (loc_not_unused_in h0)))\n [SMTPat (HS.fresh_frame h0 h1)]\n= not_live_region_loc_not_unused_in_disjoint h0 (HS.get_tip h1)", "val modifies_fresh_frame_popped'\n (h0 h1: HS.mem)\n (s: loc)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_regions (Set.singleton (HS.get_tip h1))) s) h1 h2 /\\\n (HS.get_tip h2) == (HS.get_tip h1) /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n (HS.get_tip h3) == HS.get_tip h0\n ))\nlet modifies_fresh_frame_popped' h0 h1 s h2 h3 =\n modifies_fresh_frame_popped h0 h1 s h2 h3", "val modifies_remove_fresh_frame (h1 h2 h3: HS.mem) (l: loc)\n : Lemma\n (requires\n (HS.fresh_frame h1 h2 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h2)) l) h2 h3))\n (ensures (modifies l h1 h3))\n [SMTPat (modifies l h1 h3); SMTPat (HS.fresh_frame h1 h2)]\nlet modifies_remove_fresh_frame (h1 h2 h3:HS.mem) (l:loc)\n : Lemma (requires (HS.fresh_frame h1 h2 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h2)) l) h2 h3))\n (ensures (modifies l h1 h3))\n\t [SMTPat (modifies l h1 h3); SMTPat (HS.fresh_frame h1 h2)]\n = loc_regions_unused_in h1 (HS.mod_set (Set.singleton (HS.get_tip h2)));\n modifies_only_not_unused_in l h1 h3", "val frame: #t_k:eqtype -> #t_v:Type0 -> ll:t t_k t_v -> l:B.loc -> h0:HS.mem -> h1: HS.mem -> Lemma\n (requires\n invariant h0 ll /\\\n B.loc_disjoint l (region_of ll) /\\\n B.modifies l h0 h1)\n (ensures\n invariant h1 ll /\\\n v h1 ll == v h0 ll)\n [ SMTPatOr [\n [ SMTPat (invariant h1 ll); SMTPat (B.modifies l h0 h1) ];\n [ SMTPat (v h1 ll); SMTPat (B.modifies l h0 h1) ];\n ]]\nlet frame #_ #_ ll _ h0 _ =\n LL2.footprint_in_r h0 ll", "val valid_frame'\n (p: parser)\n (h: HS.mem)\n (b: B.buffer U8.t)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n (pos': U32.t)\n : Lemma\n ((B.live h b /\\ (valid_pos p h b pos pos' \\/ valid_pos p h' b pos pos') /\\ B.modifies l h h' /\\\n B.loc_disjoint l (B.loc_buffer_from_to b pos pos')) ==>\n (valid_pos p h b pos pos' /\\ valid_pos p h' b pos pos' /\\\n contents p h' b pos pos' == contents p h b pos pos'))\nlet valid_frame'\n (p: parser)\n (h: HS.mem)\n (b: B.buffer U8.t)\n (pos: U32.t)\n (l: B.loc)\n (h' : HS.mem)\n (pos' : U32.t)\n: Lemma\n ((\n B.live h b /\\\n (valid_pos p h b pos pos' \\/ valid_pos p h' b pos pos') /\\\n B.modifies l h h' /\\\n B.loc_disjoint l (B.loc_buffer_from_to b pos pos')\n ) ==> (\n valid_pos p h b pos pos' /\\\n valid_pos p h' b pos pos' /\\\n contents p h' b pos pos' == contents p h b pos pos'\n ))\n= Classical.move_requires (valid_frame p h b pos pos' l) h'", "val sub_ptr_stable (#t0 #t1: _) (r0: repr_ptr t0) (r1: repr_ptr t1) (h: HS.mem)\n : Lemma (requires r0 `sub_ptr` r1 /\\ valid_if_live r1 /\\ valid r1 h /\\ valid r0 h)\n (ensures\n valid_if_live r0 /\\\n (let b0 = C.cast r0.b in\n let b1 = C.cast r1.b in\n B.frameOf b0 == B.frameOf b1 /\\ (B.region_lifetime_buf b1 ==> B.region_lifetime_buf b0)))\n [SMTPat (r0 `sub_ptr` r1); SMTPat (valid_if_live r1); SMTPat (valid r0 h)]\nlet sub_ptr_stable (#t0 #t1:_) (r0:repr_ptr t0) (r1:repr_ptr t1) (h:HS.mem)\n : Lemma\n (requires\n r0 `sub_ptr` r1 /\\\n valid_if_live r1 /\\\n valid r1 h /\\\n valid r0 h)\n (ensures\n valid_if_live r0 /\\\n (let b0 = C.cast r0.b in\n let b1 = C.cast r1.b in\n B.frameOf b0 == B.frameOf b1 /\\\n (B.region_lifetime_buf b1 ==>\n B.region_lifetime_buf b0)))\n [SMTPat (r0 `sub_ptr` r1);\n SMTPat (valid_if_live r1);\n SMTPat (valid r0 h)]\n = reveal_valid ();\n let b0 : I.ibuffer LP.byte = C.cast r0.b in\n let b1 : I.ibuffer LP.byte = C.cast r1.b in\n assert (I.value_is b1 (Ghost.hide r1.meta.repr_bytes));\n assert (Seq.length r1.meta.repr_bytes == B.length b1);\n let aux (i len:U32.t)\n : Lemma\n (requires\n r0.b `C.const_sub_buffer i len` r1.b)\n (ensures\n I.value_is b0 (Ghost.hide r0.meta.repr_bytes))\n [SMTPat (r0.b `C.const_sub_buffer i len` r1.b)]\n = I.sub_ptr_value_is b0 b1 h i len r1.meta.repr_bytes\n in\n B.region_lifetime_sub #_ #_ #_ #(I.immutable_preorder _) b1 b0;\n valid_if_live_intro r0 h", "val readable_frame\n (h: HS.mem)\n (#t: _)\n (#b: B.buffer t)\n (p: perm b)\n (from: U32.t)\n (to: U32.t{U32.v from <= U32.v to /\\ U32.v to <= B.length b})\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (readable h p from to /\\ B.modifies l h h' /\\ B.loc_disjoint (loc_perm p) l /\\ B.live h' b))\n (ensures (readable h' p from to))\n [\n SMTPatOr\n [\n [SMTPat (B.modifies l h h'); SMTPat (readable h p from to)];\n [SMTPat (B.modifies l h h'); SMTPat (readable h' p from to)]\n ]\n ]\nlet readable_frame\n (h: HS.mem)\n (#t: _) (#b: B.buffer t) (p: perm b)\n (from: U32.t)\n (to: U32.t { U32.v from <= U32.v to /\\ U32.v to <= B.length b })\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n readable h p from to /\\\n B.modifies l h h' /\\\n B.loc_disjoint (loc_perm p) l /\\\n B.live h' b // because nothing prevents b from being deallocated\n ))\n (ensures (\n readable h' p from to\n ))\n [SMTPatOr [\n [ SMTPat (B.modifies l h h'); SMTPat (readable h p from to) ] ;\n [ SMTPat (B.modifies l h h'); SMTPat (readable h' p from to) ] ;\n ]]\n=\n valid_perm_frame h p l h' ;\n preserved_split p 0ul from (B.len b) h h' ;\n preserved_split p from to (B.len b) h h' ;\n readable_frame0 h p from to h'", "val valid_perm_frame_pat (h: HS.mem) (#t: _) (#b: B.buffer t) (p: perm b) (l: B.loc) (h': HS.mem)\n : Lemma\n (requires\n (valid_perm h p /\\ B.modifies l h h' /\\ B.loc_disjoint (loc_perm p) l /\\ B.live h' b))\n (ensures (valid_perm h' p /\\ preserved p 0ul (B.len b) h h'))\n [\n SMTPatOr\n [\n [SMTPat (B.modifies l h h'); SMTPat (valid_perm h p)];\n [SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p)]\n ]\n ]\nlet valid_perm_frame_pat\n (h: HS.mem)\n (#t: _) (#b: B.buffer t) (p: perm b)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n valid_perm h p /\\\n B.modifies l h h' /\\\n B.loc_disjoint (loc_perm p) l /\\\n B.live h' b // because nothing prevents b from being deallocated\n ))\n (ensures (\n valid_perm h' p /\\\n preserved p 0ul (B.len b) h h'\n ))\n [SMTPatOr [\n [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h p) ] ;\n [ SMTPat (B.modifies l h h'); SMTPat (valid_perm h' p) ] ;\n ]]\n= valid_perm_frame h p l h'", "val modifies_fresh_frame_popped\n (#aloc: aloc_t) (#c: cls aloc)\n (h0 h1: HS.mem)\n (s: loc c)\n (h2 h3: HS.mem)\n: Lemma\n (requires (\n HS.fresh_frame h0 h1 /\\\n modifies (loc_union (loc_all_regions_from false (HS.get_tip h1)) s) h1 h2 /\\\n HS.get_tip h2 == HS.get_tip h1 /\\\n HS.popped h2 h3\n ))\n (ensures (\n modifies s h0 h3 /\\\n HS.get_tip h3 == HS.get_tip h0\n ))\nlet modifies_fresh_frame_popped #al #c h0 h1 s h2 h3 =\n fresh_frame_modifies c h0 h1;\n let r = loc_region_only #al #c false (HS.get_tip h2) in\n let rs = HS.mod_set (Set.singleton (HS.get_tip h1)) in\n let s' = loc_union (loc_regions false rs) s in\n modifies_trans' s' h0 h1 h2;\n assert (modifies_preserves_mreferences r h2 h3);\n let f23 (r: HS.rid) (a: nat) (b: al r a) : Lemma\n (requires (r <> HS.get_tip h2))\n (ensures (c.aloc_preserved b h2 h3))\n = c.same_mreference_aloc_preserved #r #a b h2 h3 (fun a' pre r' -> ())\n in\n modifies_preserves_alocs_intro r h2 h3 () (fun r a b ->\n f23 r a b\n );\n modifies_trans' s' h0 h2 h3;\n modifies_only_live_regions rs s h0 h3", "val modifies_liveness_insensitive_region_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (HS.frameOf x)))\n (ensures (HS.live_region h' (HS.frameOf x)))\nlet modifies_liveness_insensitive_region_mreference = MG.modifies_preserves_region_liveness_reference", "val loc_includes_region_buffer\n (#t: Type)\n (preserve_liveness: bool)\n (s: Set.set HS.rid)\n (b: B.buffer t)\n: Lemma\n (requires (Set.mem (B.frameOf b) s))\n (ensures (loc_includes (loc_regions preserve_liveness s) (loc_buffer b)))\n [SMTPat (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))]\nlet loc_includes_region_buffer #t preserve_liveness s b =\n MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(B.frameOf b) #(B.as_addr b) (LocBuffer b)", "val modifies_liveness_insensitive_region\n (l1 l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_region_only false x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies (loc_union l1 l2) h h'); SMTPat (HS.live_region h' x)];\n ]]\nlet modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness", "val valid_frame (p: parser) (h: HS.mem) (b: B.buffer U8.t) (pos pos': U32.t) (l: B.loc) (h': HS.mem)\n : Lemma\n (requires\n (B.live h b /\\ (valid_pos p h b pos pos' \\/ valid_pos p h' b pos pos') /\\ B.modifies l h h' /\\\n B.loc_disjoint l (B.loc_buffer_from_to b pos pos')))\n (ensures\n (valid_pos p h b pos pos' /\\ valid_pos p h' b pos pos' /\\\n contents p h' b pos pos' == contents p h b pos pos'))\nlet valid_frame\n (p: parser)\n (h: HS.mem)\n (b: B.buffer U8.t)\n (pos: U32.t)\n (pos' : U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n B.live h b /\\\n (valid_pos p h b pos pos' \\/ valid_pos p h' b pos pos') /\\\n B.modifies l h h' /\\\n B.loc_disjoint l (B.loc_buffer_from_to b pos pos')\n ))\n (ensures (\n valid_pos p h b pos pos' /\\\n valid_pos p h' b pos pos' /\\\n contents p h' b pos pos' == contents p h b pos pos'\n ))\n= B.loc_buffer_mgsub_eq (B.trivial_preorder _) b pos (pos' `U32.sub` pos);\n Classical.move_requires (valid_ext p h b pos pos' h' b pos) pos';\n Classical.move_requires (valid_ext p h' b pos pos' h b pos) pos'", "val frame_region (#a: Type) (ll: t a) (l: B.loc) (h0 h1: HS.mem): Lemma\n (requires\n invariant h0 ll /\\\n B.(loc_disjoint l (region_of ll)) /\\\n B.modifies l h0 h1)\n (ensures\n invariant h1 ll /\\\n footprint h1 ll == footprint h0 ll)\nlet frame_region #_ ll _ h0 h1 =\n footprint_in_r h0 ll;\n ()", "val mreference_live_loc_not_unused_in\n (#t: Type)\n (#pre: Preorder.preorder t)\n (h: HS.mem)\n (r: HS.mreference t pre)\n: Lemma\n (requires (h `HS.contains` r))\n (ensures (loc_not_unused_in h `loc_includes` loc_freed_mreference r /\\ loc_not_unused_in h `loc_includes` loc_mreference r))\n [SMTPatOr [\n [SMTPat (HS.contains h r)];\n [SMTPat (loc_not_unused_in h `loc_includes` loc_mreference r)];\n [SMTPat (loc_not_unused_in h `loc_includes` loc_freed_mreference r)];\n ]]\nlet mreference_live_loc_not_unused_in =\n MG.mreference_live_loc_not_unused_in cls", "val modifies_liveness_insensitive_region_weak (l2: loc) (h h': HS.mem) (x: HS.rid)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h x))\n (ensures (HS.live_region h' x))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)]\n ]\n ]\nlet modifies_liveness_insensitive_region_weak\n (l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)];\n ]]\n= modifies_liveness_insensitive_region loc_none l2 h h' x", "val modifies_liveness_insensitive_region_weak (l2: loc) (h h': HS.mem) (x: HS.rid)\n : Lemma\n (requires\n (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\\n HS.live_region h x))\n (ensures (HS.live_region h' x))\n [\n SMTPatOr\n [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)]\n ]\n ]\nlet modifies_liveness_insensitive_region_weak\n (l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies l2 h h' /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\n [SMTPatOr [\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h x)];\n [SMTPat (modifies l2 h h'); SMTPat (HS.live_region h' x)];\n ]]\n= modifies_liveness_insensitive_region loc_none l2 h h' x", "val valid_list_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos pos': U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos')))\n (ensures\n ((valid_list p h s pos pos' \\/ valid_list p h' s pos pos') ==>\n (valid_list p h s pos pos' /\\ valid_list p h' s pos pos' /\\\n contents_list p h' s pos pos' == contents_list p h s pos pos')))\n [\n SMTPatOr\n [\n [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')]\n ]\n ]\nlet valid_list_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos: U32.t)\n (pos' : U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos')))\n (ensures (\n (valid_list p h s pos pos' \\/ valid_list p h' s pos pos') ==> (\n valid_list p h s pos pos' /\\\n valid_list p h' s pos pos' /\\ contents_list p h' s pos pos' == contents_list p h s pos pos'\n )))\n [SMTPatOr [\n [SMTPat (valid_list p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (valid_list p h' s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_list p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_list p h' s pos pos'); SMTPat (B.modifies l h h')];\n ]]\n= Classical.move_requires (valid_list_frame_1 p h s pos pos' l) h';\n Classical.move_requires (valid_list_frame_2 p h s pos pos' l) h'", "val valid_frame_strong\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (live_slice h sl /\\ valid p h sl pos /\\ B.modifies l h h' /\\\n B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\\\n k.parser_kind_subkind == Some ParserStrong))\n (ensures (valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos)))\n [\n SMTPatOr\n [\n [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')]\n ]\n ]\nlet valid_frame_strong\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n: Lemma\n (requires (\n live_slice h sl /\\\n valid p h sl pos /\\\n B.modifies l h h' /\\ B.loc_disjoint (loc_slice_from_to sl pos (get_valid_pos p h sl pos)) l /\\ k.parser_kind_subkind == Some ParserStrong))\n (ensures (\n valid_content_pos p h' sl pos (contents p h sl pos) (get_valid_pos p h sl pos)\n ))\n [SMTPatOr [\n// [SMTPat (valid p h sl pos); SMTPat (B.modifies_inert l h h')];\n [SMTPat (valid p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (contents p h' sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (content_length p h' sl pos); SMTPat (B.modifies l h h')];\n ]]\n= valid_pos_frame_strong p h sl pos (get_valid_pos p h sl pos) l h'", "val live_loc_not_unused_in (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel) (h:HS.mem)\n :Lemma (requires (live h b))\n (ensures (loc_not_unused_in h `loc_includes` loc_addr_of_buffer b))\n [SMTPat (live h b)]\nlet live_loc_not_unused_in #_ #_ #_ b h =\n unused_in_equiv b h;\n Classical.move_requires (MG.does_not_contain_addr_addr_unused_in h) (frameOf b, as_addr b);\n MG.loc_addresses_not_unused_in cls (frameOf b) (Set.singleton (as_addr b)) h;\n ()", "val modifies_liveness_insensitive_region_buffer\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_buffer x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h (B.frameOf x)))\n (ensures (HS.live_region h' (B.frameOf x)))\nlet modifies_liveness_insensitive_region_buffer l1 l2 h h' #t x =\n MG.modifies_preserves_region_liveness_aloc l1 l2 h h' #(B.frameOf x) #(B.as_addr x) (LocBuffer x)", "val liveness_preservation_intro (#a:Type0) (#rrel:srel a) (#rel:srel a)\n (h h':HS.mem) (b:mbuffer a rrel rel)\n (f: (\n (t':Type0) ->\n (pre: Preorder.preorder t') ->\n (r: HS.mreference t' pre) ->\n Lemma\n (requires (HS.frameOf r == frameOf b /\\ HS.as_addr r == as_addr b /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\n ))\n :Lemma (requires (live h b)) (ensures (live h' b))\nlet liveness_preservation_intro #_ #_ #_ _ _ b f =\n if Null? b\n then ()\n else f _ _ (Buffer?.content b)", "val addr_of_gref_of\n (a: aref)\n (t: Type0)\n (rel: preorder t)\n: Lemma\n (requires (exists h . aref_live_at h a t rel))\n (ensures ((exists h . aref_live_at h a t rel) /\\ addr_of (gref_of a t rel) == addr_of_aref a))\n [SMTPat (addr_of (gref_of a t rel))]\nlet addr_of_gref_of a t rel = addr_of_aref_of (gref_of a t rel)", "val not_live_region_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (~ (HS.live_region h (fst ra))))\n (ensures (h `does_not_contain_addr` ra))\nlet not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr", "val not_live_region_does_not_contain_addr\n (h: HS.mem)\n (ra: HS.rid * nat)\n: Lemma\n (requires (~ (HS.live_region h (fst ra))))\n (ensures (h `does_not_contain_addr` ra))\nlet not_live_region_does_not_contain_addr = MG.not_live_region_does_not_contain_addr", "val valid_rptr_frame\n (#p: parser) (#inv: memory_invariant) (x: ptr p inv) (inv' : memory_invariant)\n: Lemma\n (requires (\n inv `memory_invariant_includes` inv'\n ))\n (ensures (\n valid_rptr p inv' x /\\\n deref_spec #p #inv' x == deref_spec #p #inv x\n ))\n [SMTPatOr [\n [SMTPat (inv `memory_invariant_includes` inv'); SMTPat (valid_rptr p inv x)];\n [SMTPat (inv `memory_invariant_includes` inv'); SMTPat (valid_rptr p inv' x)];\n ]]\nlet valid_rptr_frame\n #p #inv x inv'\n= valid_frame p inv.h0 x.rptr_base 0ul (B.len x.rptr_base) inv.lwrite inv'.h0", "val valid_exact_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos pos': U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos')))\n (ensures\n ((valid_exact p h s pos pos' \\/ valid_exact p h' s pos pos') ==>\n (valid_exact p h s pos pos' /\\ valid_exact p h' s pos pos' /\\\n contents_exact p h' s pos pos' == contents_exact p h s pos pos')))\n [\n SMTPatOr\n [\n [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')]\n ]\n ]\nlet valid_exact_frame\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos: U32.t)\n (pos' : U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos')))\n (ensures (\n (valid_exact p h s pos pos' \\/ valid_exact p h' s pos pos') ==> (\n valid_exact p h s pos pos' /\\\n valid_exact p h' s pos pos' /\\ contents_exact p h' s pos pos' == contents_exact p h s pos pos'\n )))\n [SMTPatOr [\n [SMTPat (valid_exact p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (valid_exact p h' s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_exact p h s pos pos'); SMTPat (B.modifies l h h')];\n [SMTPat (contents_exact p h' s pos pos'); SMTPat (B.modifies l h h')];\n ]]\n= let f () : Lemma\n (requires (\n U32.v pos <= U32.v pos' /\\ U32.v pos' <= U32.v s.len /\\ (valid_exact p h s pos pos' \\/ valid_exact p h' s pos pos')\n ))\n (ensures (\n valid_exact p h s pos pos' /\\\n valid_exact p h' s pos pos' /\\ contents_exact p h' s pos pos' == contents_exact p h s pos pos'\n ))\n =\n valid_exact_equiv p h s pos pos' ;\n valid_exact_equiv p h' s pos pos' ;\n Classical.move_requires (contents_exact_eq p h s pos) pos' ;\n Classical.move_requires (contents_exact_eq p h' s pos) pos' ;\n B.modifies_buffer_from_to_elim s.base pos pos' l h h'\n in\n Classical.move_requires f ()", "val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\n [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]\nlet no_upd_fresh_region = MG.no_upd_fresh_region", "val no_upd_fresh_region: r:HS.rid -> l:loc -> h0:HS.mem -> h1:HS.mem -> Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\n [SMTPat (HS.fresh_region r h0 h1); SMTPat (modifies l h0 h1)]\nlet no_upd_fresh_region = MG.no_upd_fresh_region", "val popped_modifies (h0 h1: HS.mem) : Lemma\n (requires (HS.popped h0 h1))\n (ensures (modifies (loc_region_only false (HS.get_tip h0)) h0 h1))\n [SMTPat (HS.popped h0 h1)]\nlet popped_modifies = MG.popped_modifies #_ cls", "val free (#a: Type0) (b: buffer a)\n : ST unit\n (requires fun h0 -> live h0 b /\\ freeable b)\n (ensures\n (fun h0 _ h1 ->\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free (#a:Type0) (b:buffer a)\n : ST unit\n (requires fun h0 ->\n live h0 b /\\\n freeable b)\n (ensures (fun h0 _ h1 -> \n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\n = B.free b", "val free (#a: Type0) (b: buffer a)\n : ST unit\n (requires fun h0 -> live h0 b /\\ freeable b)\n (ensures\n (fun h0 _ h1 ->\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free (#a:Type0) (b:buffer a)\n : ST unit\n (requires fun h0 ->\n live h0 b /\\\n freeable b)\n (ensures (fun h0 _ h1 -> \n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n B.modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\n = B.free b", "val loc_disjoint_addresses_pointer\n (#t: typ)\n (p: pointer t)\n (r: HH.rid)\n (n: Set.set nat)\n: Lemma\n (requires (r <> frameOf p \\/ (~ (Set.mem (as_addr p) n))))\n (ensures (loc_disjoint (loc_addresses r n) (loc_pointer p)))\n [SMTPat (loc_disjoint (loc_addresses r n) (loc_pointer p))]\nlet loc_disjoint_addresses_pointer #t p r n =\n loc_disjoint_sym (loc_pointer p) (loc_addresses r n)", "val lemma_upd (#a: Type) (h: mem) (x: reference a {live_region h (HS.frameOf x)}) (v: a)\n : Lemma (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\nlet lemma_upd (#a:Type) (h:mem) (x:reference a{live_region h (HS.frameOf x)}) (v:a) : Lemma\n (requires True)\n (ensures (Map.domain (HS.get_hmap h) == Map.domain (HS.get_hmap (upd h x v))))\n = let m = HS.get_hmap h in\n let m' = Map.upd m (HS.frameOf x) (Heap.upd (Map.sel m (HS.frameOf x)) (HS.as_ref x) v) in\n Set.lemma_equal_intro (Map.domain m) (Map.domain m')", "val loc_includes_region_buffer (#a:Type0) (#rrel #rel:srel a)\n (preserve_liveness:bool) (s:Set.set HS.rid) (b:mbuffer a rrel rel)\n :Lemma (requires (Set.mem (frameOf b) s))\n (ensures (loc_includes (loc_regions preserve_liveness s) (loc_buffer b)))\n [SMTPat (loc_includes (loc_regions preserve_liveness s) (loc_buffer b))]\nlet loc_includes_region_buffer #_ #_ #_ preserve_liveness s b =\n MG.loc_includes_region_aloc #_ #cls preserve_liveness s #(frameOf b) #(as_addr b) (ubuffer_of_buffer b)", "val modifies_liveness_insensitive_buffer_weak\n (l: loc)\n (h h': HS.mem)\n (#a: Type0)\n (#rrel #rel: srel a)\n (x: mbuffer a rrel rel)\n : Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ live h x))\n (ensures (live h' x))\n [\n SMTPatOr\n [\n [SMTPat (live h x); SMTPat (modifies l h h')];\n [SMTPat (live h' x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_buffer_weak\n (l:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ live h x))\n (ensures (live h' x))\n [SMTPatOr [\n [SMTPat (live h x); SMTPat (modifies l h h');];\n [SMTPat (live h' x); SMTPat (modifies l h h');];\n ]]\n = modifies_liveness_insensitive_buffer loc_none l h h' x", "val loc_includes_addresses_buffer\n (#t: Type)\n (preserve_liveness: bool)\n (r: HS.rid)\n (s: Set.set nat)\n (p: B.buffer t)\n: Lemma\n (requires (B.frameOf p == r /\\ Set.mem (B.as_addr p) s))\n (ensures (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p)))\n [SMTPat (loc_includes (loc_addresses preserve_liveness r s) (loc_buffer p))]\nlet loc_includes_addresses_buffer #t preserve_liveness r s p =\n MG.loc_includes_addresses_aloc #_ #cls preserve_liveness r s #(B.as_addr p) (LocBuffer p)", "val rfree (#a: Type) (b: buffer a)\n : HST.ST unit\n (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures\n (fun h0 _ h1 ->\n (not (g_is_null b)) /\\\n (Map.domain (HS.get_hmap h1)) `Set.equal` (Map.domain (HS.get_hmap h0)) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\ modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet rfree\n (#a: Type)\n (b: buffer a)\n: HST.ST unit\n (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures (fun h0 _ h1 ->\n (not (g_is_null b)) /\\\n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\ \n (HS.get_tip h1) == (HS.get_tip h0) /\\\n modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)\n ))\n= free b", "val is_mm_gref_of\n (a: aref)\n (t: Type0)\n (rel: preorder t)\n: Lemma\n (requires (exists h . aref_live_at h a t rel))\n (ensures ((exists h . aref_live_at h a t rel) /\\ is_mm (gref_of a t rel) == aref_is_mm a))\n [SMTPat (is_mm (gref_of a t rel))]\nlet is_mm_gref_of a t rel = is_mm_aref_of (gref_of a t rel)", "val loc_disjoint_gsingleton_buffer_of_pointer_r\n (l: loc)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_disjoint l (loc_pointer p)))\n (ensures (loc_disjoint l (loc_buffer (gsingleton_buffer_of_pointer p))))\n [SMTPat (loc_disjoint l (loc_buffer (gsingleton_buffer_of_pointer p)))]\nlet loc_disjoint_gsingleton_buffer_of_pointer_r l #t p =\n loc_disjoint_includes l (loc_pointer p) l (loc_buffer (gsingleton_buffer_of_pointer p))", "val not_live_region_loc_not_unused_in_disjoint\n (#al: aloc_t)\n (c: cls al)\n (h0: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (~ (HS.live_region h0 r)))\n (ensures (loc_disjoint (loc_region_only false r) (loc_not_unused_in c h0)))\nlet not_live_region_loc_not_unused_in_disjoint #al c h0 r\n= let l1 = loc_region_only false r in\n let l2 = loc_not_unused_in c h0 in\n assert (loc_disjoint_region_liveness_tags l1 l2);\n assert (loc_disjoint_addrs l1 l2);\n assert (loc_disjoint_aux l1 l2)", "val modifies_only_live_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (rs: Set.set HS.rid)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions #al #c rs l h h' =\n let s = l in\n let c_rs = Set.complement rs in\n let s_rs = restrict_to_regions s rs in\n let s_c_rs = restrict_to_regions s c_rs in\n let lrs = loc_regions false rs in\n loc_includes_loc_regions_restrict_to_regions s rs;\n loc_includes_union_l lrs s_c_rs s_rs;\n loc_includes_refl s_c_rs;\n loc_includes_union_l lrs s_c_rs s_c_rs;\n loc_includes_union_r (loc_union lrs s_c_rs) s_rs s_c_rs;\n loc_includes_loc_union_restrict_to_regions s rs;\n loc_includes_trans (loc_union lrs s_c_rs) (loc_union s_rs s_c_rs) s;\n modifies_loc_includes (loc_union lrs s_c_rs) h h' (loc_union lrs s);\n loc_includes_loc_regions_restrict_to_regions s c_rs;\n loc_disjoint_regions #al #c false false rs c_rs;\n loc_includes_refl lrs;\n loc_disjoint_includes lrs (loc_regions false c_rs) lrs s_c_rs;\n modifies_only_live_regions_weak rs s_c_rs h h';\n loc_includes_restrict_to_regions s c_rs;\n modifies_loc_includes s h h' s_c_rs", "val free (#a:Type0) (#rrel #rel:srel a) (b:mbuffer a rrel rel)\n :HST.ST unit (requires (fun h0 -> live h0 b /\\ freeable b))\n (ensures (fun h0 _ h1 -> (not (g_is_null b)) /\\\n Map.domain (HS.get_hmap h1) `Set.equal` Map.domain (HS.get_hmap h0) /\\\n (HS.get_tip h1) == (HS.get_tip h0) /\\\n modifies (loc_addr_of_buffer b) h0 h1 /\\\n HS.live_region h1 (frameOf b)))\nlet free #_ #_ #_ b = HST.rfree (Buffer?.content b)", "val preserved'\n (#t: Type)\n (#[EverParse3d.Util.solve_from_ctx ()] inst: input_stream_inst t)\n (x: t)\n (l: B.loc)\n (h h': HS.mem)\n : Lemma (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures\n (live x h' /\\ get_remaining x h' == get_remaining x h /\\ get_read x h' == get_read x h))\n [\n SMTPatOr\n [\n [SMTPat (live x h); SMTPat (B.modifies l h h')];\n [SMTPat (live x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h'); SMTPat (B.modifies l h h')]\n ]\n ]\nlet preserved'\n (#t: Type)\n (# [EverParse3d.Util.solve_from_ctx ()] inst : input_stream_inst t)\n (x: t)\n (l: B.loc)\n (h: HS.mem)\n (h' : HS.mem)\n : Lemma\n (requires (live x h /\\ B.modifies l h h' /\\ B.loc_disjoint (footprint x) l))\n (ensures (\n live x h' /\\\n get_remaining x h' == get_remaining x h /\\\n get_read x h' == get_read x h\n ))\n [SMTPatOr [\n [SMTPat (live x h); SMTPat (B.modifies l h h')];\n [SMTPat (live x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_remaining x h'); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h); SMTPat (B.modifies l h h')];\n [SMTPat (get_read x h'); SMTPat (B.modifies l h h')];\n ]]\n= preserved x l h h'", "val modifies_liveness_insensitive_buffer_weak (l: loc) (h h': HS.mem) (#t: Type) (x: B.buffer t)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ B.live h x))\n (ensures (B.live h' x))\n [\n SMTPatOr\n [\n [SMTPat (B.live h x); SMTPat (modifies l h h')];\n [SMTPat (B.live h' x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_buffer_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (x: B.buffer t)\n: Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ B.live h x))\n (ensures (B.live h' x))\n [SMTPatOr [\n [SMTPat (B.live h x); SMTPat (modifies l h h');];\n [SMTPat (B.live h' x); SMTPat (modifies l h h');];\n ]]\n= modifies_liveness_insensitive_buffer loc_none l h h' x", "val peer_p_frame_live :\n #idc:idconfig\n -> l:B.loc\n -> p:peer_p_or_null idc\n -> h0:HS.mem\n -> h1:HS.mem ->\n Lemma\n (requires (\n peer_p_live h0 p /\\\n B.loc_disjoint l (peer_p_or_null_footprint p) /\\\n B.modifies l h0 h1))\n (ensures (\n peer_p_live h1 p))\nlet peer_p_frame_live #idc l p h0 h1 =\n let sp = LL.stateful_get_prim (idc_stateful_peer_p idc) in\n if peer_p_g_is_null p then ()\n else sp.St.frame_invariant l p h0 h1", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma (requires (modifies l h h' /\\\n address_liveness_insensitive_locs `loc_includes` l /\\\n\t\t h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n = modifies_liveness_insensitive_mreference loc_none l h h' x", "val modifies_liveness_insensitive_mreference_weak\n (l: loc)\n (h h': HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n : Lemma\n (requires\n (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x)\n )\n (ensures (h' `HS.contains` x))\n [\n SMTPatOr\n [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h')];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h')]\n ]\n ]\nlet modifies_liveness_insensitive_mreference_weak\n (l : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies l h h' /\\ address_liveness_insensitive_locs `loc_includes` l /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies l h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies l h h');];\n ]]\n= modifies_liveness_insensitive_mreference loc_none l h h' x", "val fresh_frame_modifies\n (#aloc: aloc_t) (c: cls aloc)\n (h0 h1: HS.mem)\n: Lemma\n (requires (HS.fresh_frame h0 h1))\n (ensures (modifies #_ #c loc_none h0 h1))\nlet fresh_frame_modifies #al c h0 h1 =\n modifies_intro_strong #_ #c loc_none h0 h1\n (fun _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ _ -> ())\n (fun _ _ -> ())\n (fun r a x ->\n c.same_mreference_aloc_preserved #r #a x h0 h1 (fun _ _ _ -> ()))", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions = MG.modifies_only_live_regions", "val modifies_only_live_regions\n (rs: Set.set HS.rid)\n (l: loc)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\nlet modifies_only_live_regions = MG.modifies_only_live_regions", "val old_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid)\n : Lemma\n (old_to_union_loc (OldM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (old_to_union_loc (OldM.loc_regions preserve_liveness r))]\nlet old_to_union_loc_regions (preserve_liveness: bool) (r: Set.set HS.rid) : Lemma\n (old_to_union_loc (OldM.loc_regions preserve_liveness r) == M.loc_regions preserve_liveness r)\n [SMTPat (old_to_union_loc (OldM.loc_regions preserve_liveness r))]\n= OldM.cloc_of_loc_regions preserve_liveness r;\n M.union_loc_of_loc_regions old_and_new_cl false preserve_liveness r", "val modifies_liveness_insensitive_buffer\n (l1 l2:loc)\n (h h':HS.mem)\n (#a:Type0) (#rrel #rel:srel a)\n (x:mbuffer a rrel rel)\n :Lemma (requires (modifies (loc_union l1 l2) h h' /\\\n loc_disjoint l1 (loc_buffer x) /\\\n\t\t address_liveness_insensitive_locs `loc_includes` l2 /\\\n\t\t live h x))\n (ensures (live h' x))\n [SMTPatOr [\n [SMTPat (live h x); SMTPat (modifies (loc_union l1 l2) h h');];\n [SMTPat (live h' x); SMTPat (modifies (loc_union l1 l2) h h');];\n ]]\nlet modifies_liveness_insensitive_buffer l1 l2 h h' #_ #_ #_ x =\n if g_is_null x then ()\n else\n liveness_preservation_intro h h' x (fun t' pre r ->\n MG.modifies_preserves_liveness_strong l1 l2 h h' r (ubuffer_of_buffer x))", "val footprint_in_r: #t_k:eqtype -> #t_v:Type0 -> h0:HS.mem -> ll:t t_k t_v -> Lemma\n (requires\n invariant h0 ll)\n (ensures\n B.(loc_includes (region_of ll) (footprint h0 ll)))\n [ SMTPat (footprint h0 ll) ]\nlet footprint_in_r #_ #_ h0 ll =\n LL2.footprint_in_r h0 ll", "val frame (#a: Type) (l: t a) (n: list a) (r: B.loc) (h0 h1: HS.mem)\n : Lemma\n (requires\n (well_formed h0 l n /\\ invariant h0 l n /\\ B.loc_disjoint r (footprint h0 l n) /\\\n B.modifies r h0 h1))\n (ensures\n (well_formed h1 l n /\\ footprint h1 l n == footprint h0 l n /\\ cells h1 l n == cells h0 l n /\\\n invariant h1 l n))\n (decreases n)\n [SMTPat (well_formed h1 l n); SMTPat (B.modifies r h0 h1)]\nlet rec frame (#a: Type) (l: t a) (n: list a) (r: B.loc) (h0 h1: HS.mem): Lemma\n (requires (\n well_formed h0 l n /\\\n invariant h0 l n /\\\n B.loc_disjoint r (footprint h0 l n) /\\\n B.modifies r h0 h1\n ))\n (ensures (\n well_formed h1 l n /\\\n footprint h1 l n == footprint h0 l n /\\\n cells h1 l n == cells h0 l n /\\\n invariant h1 l n\n ))\n (decreases n)\n [ SMTPat (well_formed h1 l n); SMTPat (B.modifies r h0 h1) ]\n=\n if B.g_is_null l then\n ()\n else\n frame (B.deref h0 l).next (L.tl n) r h0 h1", "val loc_includes_region_addresses\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]\nlet loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls", "val loc_includes_region_addresses\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s) (loc_addresses preserve_liveness2 r a))]\nlet loc_includes_region_addresses = MG.loc_includes_region_addresses #_ #cls", "val recall_stable_region_repr_ptr (#t: _) (r: ST.drgn) (p: stable_region_repr_ptr r t)\n : Stack unit\n (requires fun h -> HS.live_region h (ST.rid_of_drgn r))\n (ensures fun h0 _ h1 -> h0 == h1 /\\ valid p h1)\nlet recall_stable_region_repr_ptr #t (r:ST.drgn) (p:stable_region_repr_ptr r t)\n : Stack unit\n (requires fun h ->\n HS.live_region h (ST.rid_of_drgn r))\n (ensures fun h0 _ h1 ->\n h0 == h1 /\\\n valid p h1)\n = B.recall (C.cast p.b);\n recall_stable_repr_ptr p", "val region_liveness_insensitive_buffer (#t: Type) (b: B.buffer t) : Lemma\n (region_liveness_insensitive_locs `loc_includes` (loc_buffer b))\n [SMTPat (region_liveness_insensitive_locs `loc_includes` (loc_buffer b))]\nlet region_liveness_insensitive_buffer #t b =\n MG.loc_includes_region_liveness_insensitive_locs_loc_of_aloc #_ cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b)", "val union_loc_to_new_regions (preserve_liveness: bool) (r: Set.set HS.rid)\n : Lemma\n (union_loc_to_new (M.loc_regions preserve_liveness r) == NewM.loc_regions preserve_liveness r)\n [SMTPat (union_loc_to_new (M.loc_regions preserve_liveness r))]\nlet union_loc_to_new_regions (preserve_liveness: bool) (r: Set.set HS.rid) : Lemma\n (union_loc_to_new (M.loc_regions preserve_liveness r) == NewM.loc_regions preserve_liveness r)\n [SMTPat (union_loc_to_new (M.loc_regions preserve_liveness r))]\n= M.loc_of_union_loc_regions old_and_new_cl true preserve_liveness r;\n M.lower_loc_regions u#0 u#0 #_ #NewM.cloc_cls preserve_liveness r;\n NewM.cloc_of_loc_regions preserve_liveness r;\n NewM.cloc_of_loc_of_cloc (M.loc_regions preserve_liveness r)", "val no_upd_fresh_region\n (#aloc: aloc_t) (#c: cls aloc)\n (r:HS.rid)\n (l:loc c)\n (h0:HS.mem)\n (h1:HS.mem)\n: Lemma\n (requires (HS.fresh_region r h0 h1 /\\ modifies (loc_union (loc_all_regions_from false r) l) h0 h1))\n (ensures (modifies l h0 h1))\nlet no_upd_fresh_region #al #c r l h0 h1 =\n modifies_only_live_regions (HS.mod_set (Set.singleton r)) l h0 h1", "val valid_list_frame_2\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos pos': U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\\\n valid_list p h' s pos pos'))\n (ensures\n (valid_list p h' s pos pos' /\\ valid_list p h s pos pos' /\\\n contents_list p h' s pos pos' == contents_list p h s pos pos'))\n (decreases (U32.v pos' - U32.v pos))\nlet rec valid_list_frame_2\n (#rrel #rel: _)\n (#k: parser_kind)\n (#t: Type)\n (p: parser k t)\n (h: HS.mem)\n (s: slice rrel rel)\n (pos: U32.t)\n (pos' : U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (live_slice h s /\\ B.modifies l h h' /\\ B.loc_disjoint l (loc_slice_from_to s pos pos') /\\ valid_list p h' s pos pos'))\n (ensures (\n valid_list p h' s pos pos' /\\ valid_list p h s pos pos' /\\ contents_list p h' s pos pos' == contents_list p h s pos pos'\n ))\n (decreases (U32.v pos' - U32.v pos))\n= valid_list_equiv p h' s pos pos' ;\n contents_list_eq p h' s pos pos' ;\n valid_list_equiv p h s pos pos' ;\n if pos = pos'\n then ()\n else begin\n let pos1 = get_valid_pos p h' s pos in\n valid_valid_exact p h' s pos;\n valid_exact_valid p h s pos pos1;\n valid_list_frame_2 p h s pos1 pos' l h'\n end;\n B.modifies_buffer_from_to_elim s.base pos pos' l h h';\n contents_list_eq p h s pos pos'", "val not_live_region_loc_not_unused_in_disjoint\n (h0: HS.mem)\n (r: HS.rid)\n: Lemma\n (requires (~ (HS.live_region h0 r)))\n (ensures (loc_disjoint (loc_region_only false r) (loc_not_unused_in h0)))\nlet not_live_region_loc_not_unused_in_disjoint = MG.not_live_region_loc_not_unused_in_disjoint cls", "val modifies_buffer_elim\n (#t1: Type)\n (b: B.buffer t1)\n (p: loc)\n (h h': HS.mem)\n: Lemma\n (requires (\n loc_disjoint (loc_buffer b) p /\\\n B.live h b /\\\n modifies p h h'\n ))\n (ensures (\n B.live h' b /\\ (\n B.as_seq h b == B.as_seq h' b\n )))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (B.as_seq h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (B.live h b) ];\n [ SMTPat (modifies p h h'); SMTPat (B.as_seq h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (B.live h' b) ]\n ] ]\nlet modifies_buffer_elim #t1 b p h h' =\n MG.modifies_aloc_elim #_ #cls #(B.frameOf b) #(B.as_addr b) (LocBuffer b) p h h'", "val loc_disjoint_gsingleton_buffer_of_pointer_l\n (l: loc)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_disjoint (loc_pointer p) l))\n (ensures (loc_disjoint (loc_buffer (gsingleton_buffer_of_pointer p)) l))\n [SMTPat (loc_disjoint (loc_buffer (gsingleton_buffer_of_pointer p)) l)]\nlet loc_disjoint_gsingleton_buffer_of_pointer_l l #t p =\n loc_disjoint_sym (loc_pointer p) l;\n loc_disjoint_gsingleton_buffer_of_pointer_r l p;\n loc_disjoint_sym l (loc_buffer (gsingleton_buffer_of_pointer p))", "val slice_access_frame_weak\n (#rrel #rel: _)\n (h: HS.mem)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h': HS.mem)\n : Lemma\n (requires\n (valid p1 h sl pos /\\ cl.clens_cond (contents p1 h sl pos) /\\ B.modifies l h h' /\\\n B.loc_disjoint l (loc_slice_from sl pos)))\n (ensures\n (valid p1 h' sl pos /\\ cl.clens_cond (contents p1 h' sl pos) /\\\n slice_access h' g sl pos == slice_access h g sl pos))\n [\n SMTPatOr\n [\n [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')]\n ]\n ]\nlet slice_access_frame_weak\n (#rrel #rel: _)\n (h: HS.mem)\n (#k1: parser_kind)\n (#t1: Type)\n (#p1: parser k1 t1)\n (#k2: parser_kind)\n (#t2: Type)\n (#p2: parser k2 t2)\n (#cl: clens t1 t2)\n (g: gaccessor p1 p2 cl)\n (sl: slice rrel rel)\n (pos: U32.t)\n (l: B.loc)\n (h' : HS.mem)\n: Lemma\n (requires (\n valid p1 h sl pos /\\\n cl.clens_cond (contents p1 h sl pos) /\\\n B.modifies l h h' /\\\n B.loc_disjoint l (loc_slice_from sl pos)\n ))\n (ensures (\n valid p1 h' sl pos /\\\n cl.clens_cond (contents p1 h' sl pos) /\\\n slice_access h' g sl pos == slice_access h g sl pos\n ))\n [SMTPatOr [\n [SMTPat (slice_access h g sl pos); SMTPat (B.modifies l h h')];\n [SMTPat (slice_access h' g sl pos); SMTPat (B.modifies l h h')];\n ]]\n= valid_facts p1 h sl pos;\n valid_facts p1 h' sl pos;\n slice_access_eq h g sl pos;\n slice_access_eq h' g sl pos;\n B.modifies_buffer_from_to_elim sl.base pos sl.len l h h'", "val modifies_preserves_region_liveness_aloc\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (h h' : HS.mem)\n (#r: HS.rid)\n (#n: nat)\n (x: al r n)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ region_liveness_insensitive_locs c `loc_includes` l2 /\\ loc_disjoint (loc_of_aloc x) l1 /\\ HS.live_region h r))\n (ensures (HS.live_region h' r))\nlet modifies_preserves_region_liveness_aloc #al #c l1 l2 h h' #r #n x =\n if Set.mem r (Ghost.reveal (Loc?.region_liveness_tags l1))\n then begin\n assert (GSet.subset (GSet.complement GSet.empty) (Loc?.non_live_addrs l1 r));\n assert (GSet.subset (Loc?.non_live_addrs l1 r) (Loc?.live_addrs l1 r))\n end else ()", "val includes_frameOf_as_addr (#a1 #a2:Type0) (#rrel1 #rel1:srel a1) (#rrel2 #rel2:srel a2)\n (larger:mbuffer a1 rrel1 rel1) (smaller:mbuffer a2 rrel2 rel2)\n :Lemma (requires (larger `includes` smaller))\n (ensures (g_is_null larger == g_is_null smaller /\\ frameOf larger == frameOf smaller /\\ as_addr larger == as_addr smaller))\n [SMTPat (larger `includes` smaller)]\nlet includes_frameOf_as_addr #_ #_ #_ #_ #_ #_ larger smaller =\n if Null? larger || Null? smaller then ()\n else\n MG.loc_includes_aloc_elim #_ #cls #(frameOf larger) #(frameOf smaller) #(as_addr larger) #(as_addr smaller) (ubuffer_of_buffer larger) (ubuffer_of_buffer smaller)", "val modifies_aloc_intro\n (#al: aloc_t) (#c: cls al) (#r: HS.rid) (#n: nat) (z: al r n) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (livenesses: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires (HS.contains h b))\n (ensures (HS.contains h' b))\n ))\n (addr_unused_in: (\n (r: HS.rid) ->\n (n: nat) ->\n Lemma\n (requires (HS.live_region h r /\\ HS.live_region h' r /\\ n `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r)))\n (ensures (n `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r)))\n ))\n (alocs: (\n (x: al r n) ->\n Lemma\n (requires (c.aloc_disjoint x z))\n (ensures (c.aloc_preserved x h h'))\n ))\n: Lemma\n (modifies (loc_of_aloc #_ #c z) h h')\nlet modifies_aloc_intro #al #c #r #n x h h' regions mrefs livenesses unused_ins alocs =\n modifies_intro_strong #_ #c (loc_of_aloc x) h h'\n (fun r -> regions r)\n (fun t pre b -> mrefs t pre b)\n (fun t pre b -> livenesses t pre b)\n (fun r n -> unused_ins r n)\n (fun r' n' z ->\n if r' = r && n' = n\n then begin\n loc_disjoint_aloc_elim #_ #c z x;\n alocs z\n end else\n c.same_mreference_aloc_preserved z h h' (fun t pre p ->\n mrefs t pre p\n )\n )", "val modifies_preserves_liveness_strong\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (r: HS.mreference t pre)\n (x: aloc (HS.frameOf r) (HS.as_addr r))\n: Lemma\n (requires (modifies (loc_union s1 s2) h h' /\\ loc_disjoint s1 (loc_of_aloc #_ #c #(HS.frameOf r) #(HS.as_addr r) x) /\\ loc_includes (address_liveness_insensitive_locs c) s2 /\\ h `HS.contains` r))\n (ensures (h' `HS.contains` r))\nlet modifies_preserves_liveness_strong #al #c s1 s2 h h' #t #pre r x =\n let rg = HS.frameOf r in\n let ad = HS.as_addr r in\n let la = loc_of_aloc #_ #c #rg #ad x in\n if Set.mem rg (regions_of_loc s2)\n then begin\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` Loc?.non_live_addrs (address_liveness_insensitive_locs c) rg);\n assert (Loc?.non_live_addrs s2 rg `GSet.subset` GSet.empty);\n assert (~ (GSet.mem ad (Loc?.non_live_addrs s2 rg)));\n if Set.mem rg (regions_of_loc s1)\n then begin\n if GSet.mem ad (Loc?.non_live_addrs s1 rg)\n then begin\n assert (loc_disjoint_aux s1 la);\n assert (GSet.subset (Loc?.non_live_addrs s1 rg) (Loc?.live_addrs s1 rg));\n assert (aloc_domain c (Loc?.regions s1) (Loc?.live_addrs s1) `GSet.subset` (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad None) (Ghost.reveal (Loc?.aux s1)));\n assert (GSet.mem (ALoc rg ad (Some x)) (Ghost.reveal (Loc?.aux la)));\n assert (aloc_disjoint (ALoc rg ad None) (ALoc #_ #c rg ad (Some x)));\n ()\n end else ()\n end else ()\n end else ()", "val reference_of (h:mem) (a:aref) (v:Type0) (rel:preorder v)\n :Pure (mreference v rel) (requires (aref_live_at h a v rel))\n (ensures (fun x -> aref_live_at h a v rel /\\ frameOf x == frameOf_aref a /\\\n\t\t\t as_addr x == aref_as_addr a /\\ is_mm x == aref_is_mm a))\nlet reference_of h a v rel = MkRef a.aref_region (Heap.ref_of (Map.sel h.h a.aref_region) a.aref_aref v rel)", "val modifies_only_live_regions_weak\n (#al: aloc_t)\n (#c: cls al)\n (rs: Set.set HS.rid)\n (l: loc c)\n (h h': HS.mem)\n : Lemma\n (requires\n (modifies (loc_union (loc_regions false rs) l) h h' /\\ loc_disjoint (loc_regions false rs) l /\\\n (forall r. Set.mem r rs ==> (~(HS.live_region h r))))) (ensures (modifies l h h'))\nlet modifies_only_live_regions_weak\n (#al: aloc_t) (#c: cls al)\n (rs: Set.set HS.rid)\n (l: loc c)\n (h h' : HS.mem)\n: Lemma\n (requires (\n modifies (loc_union (loc_regions false rs) l) h h' /\\\n loc_disjoint (loc_regions false rs) l /\\\n (forall r . Set.mem r rs ==> (~ (HS.live_region h r)))\n ))\n (ensures (modifies l h h'))\n= assert (modifies_preserves_mreferences l h h'); // FIXME: WHY WHY WHY?\n Classical.forall_intro_3 (fun r a b -> Classical.move_requires (addr_unused_in_aloc_preserved #al #c #r #a b h) h')", "val peer_p_or_null_frame_invariant :\n #idc:idconfig\n -> l:B.loc\n -> p:peer_p_or_null idc\n -> dvp:device_p idc\n -> h0:HS.mem\n -> h1:HS.mem ->\n Lemma\n (requires (\n peer_p_or_null_invariant h0 p dvp /\\\n B.loc_disjoint l (device_p_region_of dvp) /\\\n B.modifies l h0 h1))\n (ensures (\n peer_p_or_null_invariant h1 p dvp /\\\n peer_p_or_null_v h0 p == peer_p_or_null_v h1 p))\n [SMTPat (peer_p_or_null_invariant h0 p dvp);\n SMTPat (B.modifies l h0 h1)]\nlet peer_p_or_null_frame_invariant #idc l p dvp h0 h1 =\n assert(B.loc_includes (device_p_region_of dvp) (peer_p_or_null_footprint p));\n peer_p_frame_live l p h0 h1;\n if peer_p_g_is_null p then ()\n else\n begin\n peer_p_frame_invariant l p h0 h1;\n assert(device_p_owns_peer h1 dvp p)\n end", "val modifies_salloc_post\n (#a: Type)\n (#rel: Preorder.preorder a)\n (init: a)\n (h: HS.mem)\n (x: HST.mreference a rel { HS.is_stack_region (HS.frameOf x) } )\n (h' : HS.mem)\n: Lemma\n (requires (HST.salloc_post init h x h'))\n (ensures (modifies loc_none h h'))\n [SMTPat (HST.salloc_post init h x h')]\nlet modifies_salloc_post = MG.modifies_salloc_post #_ #cls", "val modifies_liveness_insensitive_mreference\n (l1 l2 : loc)\n (h h' : HS.mem)\n (#t: Type)\n (#pre: Preorder.preorder t)\n (x: HS.mreference t pre)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_mreference x) /\\ address_liveness_insensitive_locs `loc_includes` l2 /\\ h `HS.contains` x))\n (ensures (h' `HS.contains` x))\n [SMTPatOr [\n [SMTPat (h `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n [SMTPat (h' `HS.contains` x); SMTPat (modifies (loc_union l1 l2) h h');];\n ]]\nlet modifies_liveness_insensitive_mreference = MG.modifies_preserves_liveness", "val modifies_preserves_livenesses_intro\n (#al: aloc_t)\n (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f:\n (t: Type -> pre: Preorder.preorder t -> p: HS.mreference t pre\n -> Lemma\n (requires\n (HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==>\n ~(GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))))\n (ensures (HS.contains h2 p))))\n : Lemma (modifies_preserves_livenesses s h1 h2)\nlet modifies_preserves_livenesses_intro\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n (h1 h2: HS.mem)\n (f: (\n (t: Type) ->\n (pre: Preorder.preorder t) ->\n (p: HS.mreference t pre) ->\n Lemma\n (requires (\n HS.contains h1 p /\\\n (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))\n ))\n (ensures (HS.contains h2 p))\n ))\n: Lemma\n (modifies_preserves_livenesses s h1 h2)\n= let f'\n (t : Type)\n (pre: Preorder.preorder t)\n (p : HS.mreference t pre)\n : Lemma\n (\n (HS.contains h1 p /\\ (Set.mem (HS.frameOf p) (regions_of_loc s) ==> ~ (GSet.mem (HS.as_addr p) (Loc?.non_live_addrs s (HS.frameOf p))))) ==>\n (h2 `HS.contains` p))\n = Classical.move_requires (f t pre) p\n in\n Classical.forall_intro_3 f'", "val contains_aref_unused_in (#a:Type) (#rel:preorder a) (h:mem) (x:mreference a rel) (y:aref)\n :Lemma (requires (contains h x /\\ aref_unused_in y h))\n (ensures (frameOf x <> frameOf_aref y \\/ as_addr x <> aref_as_addr y))\n [SMTPat (contains h x); SMTPat (aref_unused_in y h)]\nlet contains_aref_unused_in #_ #_ h x y =\n if frameOf x = frameOf_aref y\n then\n Heap.contains_aref_unused_in (Map.sel h.h (frameOf x)) (as_ref x) y.aref_aref\n else ()", "val lemma_frame_equalities (frame:vprop) (h0:rmem frame) (h1:rmem frame) (p:Type0)\n : Lemma\n (requires (h0 frame == h1 frame) == p)\n (ensures frame_equalities' frame h0 h1 == p)\nlet lemma_frame_equalities frame h0 h1 p =\n let p1 : prop = h0 frame == h1 frame in\n let p2 : prop = frame_equalities' frame h0 h1 in\n lemma_frame_refl' frame h0 h1;\n FStar.PropositionalExtensionality.apply p1 p2", "val old_to_union_loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat)\n : Lemma\n (old_to_union_loc (OldM.loc_addresses preserve_liveness r n) ==\n M.loc_addresses preserve_liveness r n)\n [SMTPat (old_to_union_loc (OldM.loc_addresses preserve_liveness r n))]\nlet old_to_union_loc_addresses (preserve_liveness: bool) (r: HS.rid) (n: Set.set nat) : Lemma\n (old_to_union_loc (OldM.loc_addresses preserve_liveness r n) == M.loc_addresses preserve_liveness r n)\n [SMTPat (old_to_union_loc (OldM.loc_addresses preserve_liveness r n))]\n= OldM.cloc_of_loc_addresses preserve_liveness r n;\n M.union_loc_of_loc_addresses old_and_new_cl false preserve_liveness r n", "val modifies_liveness_insensitive_region\n (l1 l2 : loc)\n (h h' : HS.mem)\n (x: HS.rid)\n: Lemma\n (requires (modifies (loc_union l1 l2) h h' /\\ loc_disjoint l1 (loc_region_only false x) /\\ region_liveness_insensitive_locs `loc_includes` l2 /\\ HS.live_region h x))\n (ensures (HS.live_region h' x))\nlet modifies_liveness_insensitive_region = MG.modifies_preserves_region_liveness", "val write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag #l h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\nlet write\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (v: P.type_of_typ (P.typ_of_struct_field l f))\n: HST.Stack unit\n (requires (fun h ->\n P.live h p\n ))\n (ensures (fun h0 _ h1 ->\n P.live h0 p /\\ P.live h1 p /\\\n P.modifies_1 p h0 h1 /\\\n P.readable h1 p /\\\n valid h1 tgs p /\\\n gread_tag h1 tgs p == normalize_term (tag_of_field tgs f) /\\\n field_matches_tag tgs f (gread_tag h1 tgs p) /\\\n P.gread h1 (gfield tgs p f) == v\n ))\n=\n let tag_ptr = P.field p (tag_field l) in\n let u_ptr = P.field p (union_field l) in\n let t = tag_of_field #l tgs f in\n P.write tag_ptr t;\n let h11 = HST.get () in\n P.write (P.ufield u_ptr f) v;\n let h1 = HST.get () in\n // SMTPats for this lemma do not seem to trigger?\n// P.no_upd_lemma_1 h11 h1 u_ptr tag_ptr;\n assert (P.readable h1 tag_ptr);\n assert (P.readable h1 u_ptr);\n P.readable_struct_fields_readable_struct h1 p;\n let uf = P.ufield u_ptr f in\n P.is_active_union_field_includes_readable #l h1 u_ptr f uf;\n assert (P.is_active_union_field #l h1 u_ptr f)", "val modifies_buffer_elim (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel) (p:loc) (h h':HS.mem)\n :Lemma (requires (loc_disjoint (loc_buffer b) p /\\ live h b /\\ modifies p h h'))\n (ensures (live h' b /\\ (as_seq h b == as_seq h' b)))\n [SMTPatOr [\n [ SMTPat (modifies p h h'); SMTPat (as_seq h b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (live h b) ];\n [ SMTPat (modifies p h h'); SMTPat (as_seq h' b) ] ;\n [ SMTPat (modifies p h h'); SMTPat (live h' b) ]\n ]]\nlet modifies_buffer_elim #_ #_ #_ b p h h' =\n if g_is_null b\n then\n assert (as_seq h b `Seq.equal` as_seq h' b)\n else begin\n MG.modifies_aloc_elim #_ #cls #(frameOf b) #(as_addr b) (ubuffer_of_buffer b) p h h' ;\n ubuffer_preserved_elim b h h'\n end", "val live_not_unused_in' (#a: Type0) (#rrel #rel: srel a) (h: HS.mem) (b: mbuffer a rrel rel)\n : Lemma (requires (live h b /\\ b `unused_in` h))\n (ensures False)\n [SMTPat (live h b); SMTPat (b `unused_in` h)]\nlet live_not_unused_in' (#a:Type0) (#rrel #rel:srel a) (h:HS.mem) (b:mbuffer a rrel rel)\n :Lemma (requires (live h b /\\ b `unused_in` h))\n (ensures False)\n [SMTPat (live h b); SMTPat (b `unused_in` h)]\n = live_not_unused_in h b", "val modifies_address_intro\n (#al: aloc_t) (#c: cls al) (r: HS.rid) (n: nat) (h h' : HS.mem)\n (regions: (\n (r: HS.rid) ->\n Lemma\n (requires (HS.live_region h r))\n (ensures (HS.live_region h' r))\n ))\n (mrefs: (\n (t: Type0) ->\n (pre: Preorder.preorder t) ->\n (b: HS.mreference t pre) ->\n Lemma\n (requires ((r <> HS.frameOf b \\/ n <> HS.as_addr b) /\\ HS.contains h b))\n (ensures (HS.contains h' b /\\ HS.sel h' b == HS.sel h b))\n ))\n (addr_unused_in: (\n (r': HS.rid) ->\n (n' : nat) ->\n Lemma\n (requires ((r' <> r \\/ n' <> n) /\\ HS.live_region h r' /\\ HS.live_region h' r' /\\ n' `Heap.addr_unused_in` (HS.get_hmap h' `Map.sel` r')))\n (ensures (n' `Heap.addr_unused_in` (HS.get_hmap h `Map.sel` r')))\n ))\n: Lemma\n (modifies (loc_addresses #_ #c false r (Set.singleton n)) h h')\nlet modifies_address_intro #al #c r n h h' regions mrefs unused_ins =\n Classical.forall_intro (Classical.move_requires regions);\n let l : loc c = loc_addresses #_ #c false r (Set.singleton n) in\n modifies_preserves_mreferences_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_livenesses_intro l h h'\n (fun t pre p -> mrefs t pre p)\n ;\n modifies_preserves_not_unused_in_intro l h h'\n (fun r n -> unused_ins r n)\n ;\n modifies_preserves_alocs_intro l h h' ()\n (fun r a b ->\n c.same_mreference_aloc_preserved b h h' (fun t pre p -> mrefs t pre p)\n )", "val free_path:\n p:path_p ->\n HST.ST unit\n (requires (fun h0 ->\n B.live h0 p /\\ B.freeable p /\\\n V.live h0 (phashes h0 p) /\\ V.freeable (phashes h0 p) /\\\n HH.extends (V.frameOf (phashes h0 p)) (B.frameOf p)))\n (ensures (fun h0 _ h1 ->\n modifies (path_loc p) h0 h1))\nlet free_path p =\n let pv = !*p in\n V.free (Path?.hashes pv);\n B.free p", "val lemma_frame_refl' (frame: vprop) (h0 h1: rmem frame)\n : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)\nlet rec lemma_frame_refl' (frame:vprop) (h0:rmem frame) (h1:rmem frame)\n : Lemma ((h0 frame == h1 frame) <==> frame_equalities' frame h0 h1)\n = match frame with\n | VUnit _ -> ()\n | VStar p1 p2 ->\n can_be_split_star_l p1 p2;\n can_be_split_star_r p1 p2;\n\n let h01 : rmem p1 = focus_rmem h0 p1 in\n let h11 : rmem p1 = focus_rmem h1 p1 in\n let h02 = focus_rmem h0 p2 in\n let h12 = focus_rmem h1 p2 in\n\n\n lemma_frame_refl' p1 h01 h11;\n lemma_frame_refl' p2 h02 h12", "val modifies_1_valid\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h0 h1: HS.mem)\n (#t': P.typ)\n (p': P.pointer t')\n: Lemma\n (requires (\n valid h0 tgs p /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n P.modifies_1 (gfield tgs p f) h0 h1 /\\\n P.includes (gfield tgs p f) p' /\\\n P.readable h1 p'\n ))\n (ensures (valid h1 tgs p))\n [SMTPat (valid #l h0 tgs p);\n SMTPat (P.readable h1 p');\n SMTPat (gfield #l tgs p f)]\nlet modifies_1_valid\n (#l: P.union_typ)\n (tgs: tags l)\n (p: P.pointer (typ l))\n (f: P.struct_field l)\n (h0 h1: HS.mem)\n (#t': P.typ)\n (p': P.pointer t')\n: Lemma\n (requires (\n valid h0 tgs p /\\\n field_matches_tag tgs f (gread_tag h0 tgs p) /\\\n P.modifies_1 (gfield tgs p f) h0 h1 /\\\n P.includes (gfield tgs p f) p' /\\\n P.readable h1 p'\n ))\n (ensures (valid h1 tgs p))\n [SMTPat (valid #l h0 tgs p); SMTPat (P.modifies_1 (gfield #l tgs p f) h0 h1);\n SMTPat (P.includes #_ #t' (gfield #l tgs p f) p')]\n=\n let u_ptr = P.gfield p (union_field l) in\n P.is_active_union_field_includes_readable h1 u_ptr f p'", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls" ], "closest_src": [ { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_buffer_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_live_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_mreference_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_mreference_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_buffer_weak" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_buffer" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_frame" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.fresh_frame_modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.fresh_frame_loc_not_unused_in_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.modifies_fresh_frame_popped'" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_remove_fresh_frame" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.frame" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.valid_frame'" }, { "project_name": "everparse", "file_name": "LowParse.Repr.fsti", "name": "LowParse.Repr.sub_ptr_stable" }, { "project_name": "everparse", "file_name": "EverParse3d.Readable.fsti", "name": "EverParse3d.Readable.readable_frame" }, { "project_name": "everparse", "file_name": "EverParse3d.Readable.fsti", "name": "EverParse3d.Readable.valid_perm_frame_pat" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_fresh_frame_popped" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region_mreference" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region" }, { "project_name": "FStar", "file_name": "LowParseWriters.LowParse.fsti", "name": "LowParseWriters.LowParse.valid_frame" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList2.fst", "name": "LowStar.Lib.LinkedList2.frame_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.mreference_live_loc_not_unused_in" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_region_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_region_weak" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_list_frame" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_frame_strong" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.live_loc_not_unused_in" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.liveness_preservation_intro" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.addr_of_gref_of" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.not_live_region_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.not_live_region_does_not_contain_addr" }, { "project_name": "FStar", "file_name": "LowParseWriters.fst", "name": "LowParseWriters.valid_rptr_frame" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_exact_frame" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.no_upd_fresh_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.no_upd_fresh_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.popped_modifies" }, { "project_name": "FStar", "file_name": "OPLSS2021.MemCpy.Deps.fst", "name": "OPLSS2021.MemCpy.Deps.free" }, { "project_name": "FStar", "file_name": "Demo.Deps.fst", "name": "Demo.Deps.free" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_addresses_pointer" }, { "project_name": "FStar", "file_name": "FStar.Buffer.fst", "name": "FStar.Buffer.lemma_upd" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_buffer_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_addresses_buffer" }, { "project_name": "FStar", "file_name": "LowStar.BufferCompat.fst", "name": "LowStar.BufferCompat.rfree" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.Heap.fst", "name": "FStar.Monotonic.Heap.is_mm_gref_of" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gsingleton_buffer_of_pointer_r" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.not_live_region_loc_not_unused_in_disjoint" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.free" }, { "project_name": "everparse", "file_name": "EverParse3d.InputStream.Base.fst", "name": "EverParse3d.InputStream.Base.preserved'" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_buffer_weak" }, { "project_name": "noise-star", "file_name": "Impl.Noise.API.Device.fst", "name": "Impl.Noise.API.Device.peer_p_frame_live" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fsti", "name": "FStar.Modifies.modifies_liveness_insensitive_mreference_weak" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.fresh_frame_modifies" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_only_live_regions" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc_regions" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_buffer" }, { "project_name": "karamel", "file_name": "LowStar.Lib.AssocList.fst", "name": "LowStar.Lib.AssocList.footprint_in_r" }, { "project_name": "karamel", "file_name": "LowStar.Lib.LinkedList.fst", "name": "LowStar.Lib.LinkedList.frame" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_addresses" }, { "project_name": "everparse", "file_name": "LowParse.Repr.fsti", "name": "LowParse.Repr.recall_stable_region_repr_ptr" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.region_liveness_insensitive_buffer" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.union_loc_to_new_regions" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.no_upd_fresh_region" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.valid_list_frame_2" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.not_live_region_loc_not_unused_in_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_buffer_elim" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_disjoint_gsingleton_buffer_of_pointer_l" }, { "project_name": "everparse", "file_name": "LowParse.Low.Base.Spec.fsti", "name": "LowParse.Low.Base.Spec.slice_access_frame_weak" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_region_liveness_aloc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.includes_frameOf_as_addr" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_aloc_intro" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_liveness_strong" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fst", "name": "FStar.Monotonic.HyperStack.reference_of" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_only_live_regions_weak" }, { "project_name": "noise-star", "file_name": "Impl.Noise.API.Device.fst", "name": "Impl.Noise.API.Device.peer_p_or_null_frame_invariant" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_salloc_post" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_liveness_insensitive_mreference" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_preserves_livenesses_intro" }, { "project_name": "FStar", "file_name": "FStar.Monotonic.HyperStack.fst", "name": "FStar.Monotonic.HyperStack.contains_aref_unused_in" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.lemma_frame_equalities" }, { "project_name": "FStar", "file_name": "LowStar.ToFStarBuffer.fst", "name": "LowStar.ToFStarBuffer.old_to_union_loc_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_liveness_insensitive_region" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.write" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_buffer_elim" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.live_not_unused_in'" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.modifies_address_intro" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.free_path" }, { "project_name": "steel", "file_name": "Steel.Effect.Common.fst", "name": "Steel.Effect.Common.lemma_frame_refl'" }, { "project_name": "FStar", "file_name": "FStar.TaggedUnion.fst", "name": "FStar.TaggedUnion.modifies_1_valid" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_region" } ], "selected_premises": [ "FStar.Pointer.Base.otype_of_typ", "FStar.Pointer.Base.npointer", "FStar.Pointer.Base.as_addr", "FStar.Pointer.Base.path_sel_none_ovalue", "FStar.Pointer.Base.path_sel", "FStar.Pointer.Base.buffer", "FStar.Pointer.Base.gread", "FStar.Heap.trivial_preorder", "FStar.Pointer.Base.none_ovalue", "FStar.Pointer.Base.step_typ_depth", "FStar.Pointer.Base.path_typ_depth", "FStar.Pointer.Base.g_is_null", "FStar.Pointer.Base.path_length", "FStar.Pointer.Base.step_upd", "FStar.Pointer.Base.ovalue_of_value", "FStar.Monotonic.HyperStack.sel", "FStar.Pointer.Base._field", "FStar.Pointer.Base.struct_sel", "FStar.Pointer.Base.otype_of_struct_field", "FStar.Pointer.Base.ovalue_is_readable_ovalue_of_value", "FStar.Monotonic.HyperStack.live_region", "FStar.Pointer.Base.frameOf", "FStar.UInt.size", "FStar.Pointer.Base.dummy_val", "FStar.Pointer.Base.step_sel", "FStar.Pointer.Base.pointer_ref_contents", "FStar.Pointer.Base.nlive", "FStar.Pointer.Base.live", "FStar.Pointer.Base.path_upd", "FStar.Pointer.Base.struct_create_fun", "FStar.Pointer.Base.value_of_ovalue", "FStar.Pointer.Base.otype_of_typ_struct", "FStar.Pointer.Base.not_an_array_cell", "FStar.Pointer.Base.ovalue_is_readable", "FStar.Pointer.Base.type_of_typ'_eq", "FStar.Pointer.Base.path_equal'", "FStar.Pervasives.Native.fst", "FStar.Pointer.Base.value_of_ovalue_of_value", "FStar.HyperStack.ST.is_eternal_region", "FStar.Pointer.Base.ounion", "FStar.Pointer.Base.nullptr", "FStar.Pointer.Base.ostruct", "FStar.Pointer.Base.greference_of", "FStar.Pervasives.Native.snd", "FStar.Pointer.Base.equal", "FStar.Pointer.Base.buffer_root_length", "FStar.Pointer.Base.unused_in", "FStar.Monotonic.HyperStack.mreference", "FStar.Pointer.Base.ostruct_field_of_struct_field", "FStar.Pointer.Base.type_of_typ'", "FStar.Mul.op_Star", "FStar.Pointer.Base.struct_field_is_readable", "FStar.Pointer.Base.union_get_value", "FStar.Pointer.Base.gtdata", "FStar.Pointer.Base.ovalue_is_readable_array_intro", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.Pointer.Base.path_includes", "FStar.Pointer.Base.path_disjoint_includes", "FStar.Pointer.Base.path_disjoint_not_path_equal", "FStar.Monotonic.HyperStack.as_addr", "FStar.Pointer.Base.path_disjoint_t_rect", "FStar.Pointer.Base.struct", "FStar.Pointer.Base.path_disjoint", "FStar.Pointer.Base.path_concat", "FStar.Pointer.Base.path_disjoint_decomp", "FStar.Pointer.Base.path_equal", "FStar.Monotonic.HyperStack.frameOf", "FStar.Pervasives.reveal_opaque", "FStar.Pointer.Base.path_includes_exists_concat", "FStar.Pointer.Base._gtdata_get_key", "FStar.Pointer.Base._cell", "FStar.Pointer.Base.ovalue_is_readable_ostruct_field_of_struct_field", "FStar.Pointer.Base.path_destruct_l", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Pointer.Base.path_disjoint_decomp_includes", "FStar.Pointer.Base.path_sel_upd_other'", "FStar.Pointer.Base.step_sel_upd_other", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Pointer.Base.step_disjoint", "FStar.Pointer.Base.union_create", "FStar.Pointer.Base.ostruct_create", "FStar.Pointer.Base.ostruct_sel", "FStar.Pointer.Base.path_length_concat", "FStar.Pointer.Base.path_includes_trans", "FStar.Monotonic.HyperStack.modifies_ref", "FStar.Pointer.Base._ufield", "FStar.Pervasives.dfst", "FStar.Pointer.Base.step_eq", "FStar.Monotonic.HyperStack.contains", "FStar.Pointer.Base.otype_of_typ_union", "FStar.Monotonic.HyperStack.is_in", "FStar.Pointer.Base.gtdata_get_value", "FStar.Pointer.Base.path_disjoint_ind", "FStar.Pointer.Base.ovalue_is_readable_struct_intro", "FStar.Pointer.Base.path_concat_assoc", "FStar.Pervasives.dsnd", "FStar.Pointer.Base.gtdata_create", "FStar.Monotonic.HyperStack.is_mm", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Pointer.Base.union" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.Pointer.Base\n\nmodule DM = FStar.DependentMap\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\n(*** Definitions *)\n\n(** Pointers to data of type t.\n\n This defines two main types:\n - `npointer (t: typ)`, a pointer that may be \"NULL\";\n - `pointer (t: typ)`, a pointer that cannot be \"NULL\"\n (defined as a refinement of `npointer`).\n\n `nullptr #t` (of type `npointer t`) represents the \"NULL\" value.\n*)\n\n#set-options \"--initial_fuel 1 --initial_ifuel 1 --max_fuel 1 --max_ifuel 1\"\n\ntype step: (from: typ) -> (to: typ) -> Tot Type0 =\n | StepField:\n (l: struct_typ) ->\n (fd: struct_field l) ->\n step (TStruct l) (typ_of_struct_field l fd)\n | StepUField:\n (l: union_typ) ->\n (fd: struct_field l) ->\n step (TUnion l) (typ_of_struct_field l fd)\n | StepCell:\n (length: UInt32.t) ->\n (value: typ) ->\n (index: UInt32.t { UInt32.v index < UInt32.v length } ) ->\n step (TArray length value) value\n\ntype path (from: typ) : (to: typ) -> Tot Type0 =\n | PathBase:\n path from from\n | PathStep:\n (through: typ) ->\n (to: typ) ->\n (p: path from through) ->\n (s: step through to) ->\n path from to\n\nlet step_typ_depth\n (#from #to: typ)\n (s: step from to)\n: Lemma\n (typ_depth from > typ_depth to)\n= match s with\n | StepUField l fd\n | StepField l fd ->\n typ_depth_typ_of_struct_field l.fields fd\n | _ -> ()\n\nlet rec path_typ_depth\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (ensures (\n typ_depth from >= typ_depth to /\\ (\n (~ (PathBase? p)) ==> typ_depth from <> typ_depth to\n )))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' s ->\n path_typ_depth p';\n step_typ_depth s\n\n(*\nprivate\nlet not_cell\n (#from #to: typ)\n (p: path from to)\n: GTot bool\n= match p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nprivate type array_path (from: typ) (to_elem: typ) : (length: UInt32.t) -> Tot Type0 =\n| PSingleton:\n (p: path from to_elem { not_cell p } ) ->\n array_path from to_elem 1ul\n| PArray:\n length: UInt32.t ->\n path from (TArray length to_elem) ->\n array_path from to_elem length\n\nprivate let path' (from: typ) (to: typ) : Tot Type0 =\n if TArray? to\n then\n let length = TArray?.length to in\n (array_path from (TArray?.t to) length * (offset: UInt32.t & (length': UInt32.t {UInt32.v offset + UInt32.v length' <= UInt32.v length})))\n else path from to\n*)\n\nnoeq type _npointer (to : typ): Type0 =\n | Pointer:\n (from: typ) ->\n (contents: HS.aref) ->\n (p: path from to) ->\n _npointer to\n | NullPtr\n\nlet npointer (t: typ): Tot Type0 =\n _npointer t\n\n(** The null pointer *)\n\nlet nullptr (#t: typ): Tot (npointer t) = NullPtr\n\nlet g_is_null (#t: typ) (p: npointer t) : GTot bool =\n match p with\n | NullPtr -> true\n | _ -> false\n\nlet g_is_null_intro\n (t: typ)\n: Lemma\n (g_is_null (nullptr #t) == true)\n= ()\n\n(** Buffers *)\n\nlet not_an_array_cell (#t: typ) (p: pointer t) : GTot bool =\n match Pointer?.p p with\n | PathStep _ _ _ (StepCell _ _ _) -> false\n | _ -> true\n\nnoeq type buffer_root (t: typ) =\n| BufferRootSingleton:\n (p: pointer t { not_an_array_cell p } ) ->\n buffer_root t\n| BufferRootArray:\n (#max_length: array_length_t) ->\n (p: pointer (TArray max_length t)) ->\n buffer_root t\n\nlet buffer_root_length (#t: typ) (b: buffer_root t): Tot UInt32.t = match b with\n| BufferRootSingleton _ -> 1ul\n| BufferRootArray #_ #len _ -> len\n\nnoeq type _buffer (t: typ) =\n| Buffer:\n (broot: buffer_root t) ->\n (bidx: UInt32.t) ->\n (blength: UInt32.t { UInt32.v bidx + UInt32.v blength <= UInt32.v (buffer_root_length broot) } ) ->\n _buffer t\nlet buffer (t: typ): Tot Type0 = _buffer t\n\n(** Helper for the interpretation of unions.\n\n A C union is interpreted as a dependent pair of a key and a value (which\n depends on the key). The intent is for the key to be ghost, as it will not\n exist at runtime (C unions are untagged).\n\n Therefore,\n - `gtdata_get_key` (defined below) is in `GTot`, and\n - `gtdata_get_value` asks for the key `k` to read, and a proof that `k`\n matches the ghost key.\n*)\n\nlet gtdata (* ghostly-tagged data *)\n (key: eqtype)\n (value: (key -> Tot Type0))\n: Tot Type0\n= ( k: key & value k )\n\nlet _gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: Tot key\n= dfst u\n\nlet gtdata_get_key\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n: GTot key // important: must be Ghost, the tag is not actually stored in memory\n= _gtdata_get_key u\n\nlet gtdata_get_value\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u: gtdata key value)\n (k: key)\n: Pure (value k)\n (requires (gtdata_get_key u == k))\n (ensures (fun _ -> True))\n= let (| _, v |) = u in v\n\nlet gtdata_create\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (k: key)\n (v: value k)\n: Pure (gtdata key value)\n (requires True)\n (ensures (fun x -> gtdata_get_key x == k /\\ gtdata_get_value x k == v))\n= (| k, v |)\n\nlet gtdata_extensionality\n (#key: eqtype)\n (#value: (key -> Tot Type0))\n (u1 u2: gtdata key value)\n: Lemma\n (requires (\n let k = gtdata_get_key u1 in (\n k == gtdata_get_key u2 /\\\n gtdata_get_value u1 k == gtdata_get_value u2 k\n )))\n (ensures (u1 == u2))\n= ()\n\n(* Interprets a type code (`typ`) as a FStar type (`Type0`). *)\nlet rec type_of_typ'\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> type_of_base_typ b\n | TStruct l ->\n struct l\n | TUnion l ->\n union l\n | TArray length t ->\n array length (type_of_typ' t)\n | TPointer t ->\n pointer t\n | TNPointer t ->\n npointer t\n | TBuffer t ->\n buffer t\nand struct (l: struct_typ) : Tot Type0 =\n DM.t (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\nand union (l: union_typ) : Tot Type0 =\n gtdata (struct_field l) (type_of_struct_field' l (fun x -> type_of_typ' x))\n\nlet rec type_of_typ'_eq (t: typ) : Lemma (type_of_typ' t == type_of_typ t)\n [SMTPat (type_of_typ t)]\n=\n match t with\n | TArray _ t' -> type_of_typ'_eq t'\n | TPointer t' -> type_of_typ'_eq t'\n | TNPointer t' -> type_of_typ'_eq t'\n | TBuffer t' -> type_of_typ'_eq t'\n | _ -> ()\n\n(** Interpretation of unions, as ghostly-tagged data\n (see `gtdata` for more information).\n*)\nlet _union_get_key (#l: union_typ) (v: union l) : Tot (struct_field l) = _gtdata_get_key v\n\nlet struct_sel (#l: struct_typ) (s: struct l) (f: struct_field l) : Tot (type_of_struct_field l f) =\n DM.sel s f\n\nlet struct_upd (#l: struct_typ) (s: struct l) (f: struct_field l) (v: type_of_struct_field l f) : Tot (struct l) =\n DM.upd s f v\n\nlet struct_create_fun (l: struct_typ) (f: ((fd: struct_field l) -> Tot (type_of_struct_field l fd))) : Tot (struct l) =\n DM.create #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) f\n\nlet struct_sel_struct_create_fun l f fd = ()\n\nlet union_get_key (#l: union_typ) (v: union l) : GTot (struct_field l) = gtdata_get_key v\n\nlet union_get_value #l v fd = gtdata_get_value v fd\n\nlet union_create l fd v = gtdata_create fd v\n\n(** For any `t: typ`, `dummy_val t` provides a default value of this type.\n\n This is useful to represent uninitialized data.\n*)\nlet rec dummy_val\n (t: typ)\n: Tot (type_of_typ t)\n= match t with\n | TBase b ->\n begin match b with\n | TUInt -> 0\n | TUInt8 -> UInt8.uint_to_t 0\n | TUInt16 -> UInt16.uint_to_t 0\n | TUInt32 -> UInt32.uint_to_t 0\n | TUInt64 -> UInt64.uint_to_t 0\n | TInt -> 0\n | TInt8 -> Int8.int_to_t 0\n | TInt16 -> Int16.int_to_t 0\n | TInt32 -> Int32.int_to_t 0\n | TInt64 -> Int64.int_to_t 0\n | TChar -> 'c'\n | TBool -> false\n | TUnit -> ()\n end\n | TStruct l ->\n struct_create_fun l (fun f -> (\n dummy_val (typ_of_struct_field l f)\n ))\n | TUnion l ->\n let dummy_field : string = List.Tot.hd (List.Tot.map fst l.fields) in\n union_create l dummy_field (dummy_val (typ_of_struct_field l dummy_field))\n | TArray length t -> Seq.create (UInt32.v length) (dummy_val t)\n | TPointer t -> Pointer t HS.dummy_aref PathBase\n | TNPointer t -> NullPtr #t\n | TBuffer t -> Buffer (BufferRootSingleton (Pointer t HS.dummy_aref PathBase)) 0ul 1ul\n\n(** The interpretation of type codes (`typ`) defined previously (`type_of_typ`)\n maps codes to fully defined FStar types. In other words, a struct is\n interpreted as a dependent map where all fields have a well defined value.\n\n However, in practice, C structures (or any other type) can be uninitialized\n or partially-initialized.\n\n To account for that:\n\n - First, we define an alternative interpretation of type codes,\n `otype_of_typ`, which makes uninitialized data explicit (essentially\n wrapping all interpretations with `option`).\n\n This concrete interpretation is what is stored in the model of the heap,\n and what is manipulated internally. As it is quite verbose, it is not\n exposed to the user.\n\n - Then, interpretations with explicit uninitialized data (`otype_of_type t`)\n can be mapped to fully-initialized data (`type_of_type t`) by inserting\n dummy values. This is done by the `value_of_ovalue` function.\n\n - Finally, reading from a fully-initialized data is guarded by a `readable`\n predicate, which ensures that the dummy values cannot be accessed, and\n therefore that reading uninitialized data is actually forbidden.\n*)\n\nlet rec otype_of_typ\n (t: typ)\n: Tot Type0\n= match t with\n | TBase b -> option (type_of_base_typ b)\n | TStruct l ->\n option (DM.t (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TUnion l ->\n option (gtdata (struct_field l) (type_of_struct_field' l otype_of_typ))\n | TArray length t ->\n option (array length (otype_of_typ t))\n | TPointer t ->\n option (pointer t)\n | TNPointer t ->\n option (npointer t)\n | TBuffer t ->\n option (buffer t)\n\nlet otype_of_struct_field\n (l: struct_typ)\n: Tot (struct_field l -> Tot Type0)\n= type_of_struct_field' l otype_of_typ\n\nlet otype_of_typ_otype_of_struct_field\n (l: struct_typ)\n (f: struct_field l)\n: Lemma\n (otype_of_typ (typ_of_struct_field l f) == otype_of_struct_field l f)\n [SMTPat (type_of_typ (typ_of_struct_field l f))]\n= ()\n\nlet otype_of_typ_base\n (b: base_typ)\n: Lemma\n (otype_of_typ (TBase b) == option (type_of_base_typ b))\n [SMTPat (otype_of_typ (TBase b))]\n= ()\n\nlet otype_of_typ_array\n (len: array_length_t )\n (t: typ)\n: Lemma\n (otype_of_typ (TArray len t) == option (array len (otype_of_typ t)))\n [SMTPat (otype_of_typ (TArray len t))]\n= ()\n\nlet ostruct (l: struct_typ) = option (DM.t (struct_field l) (otype_of_struct_field l))\n\nlet ostruct_sel (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) : Tot (otype_of_struct_field l f) =\n DM.sel (Some?.v s) f\n\nlet ostruct_upd (#l: struct_typ) (s: ostruct l { Some? s }) (f: struct_field l) (v: otype_of_struct_field l f) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.upd (Some?.v s) f v)\n\nlet ostruct_create (l: struct_typ) (f: ((fd: struct_field l) -> Tot (otype_of_struct_field l fd))) : Tot (s': ostruct l { Some? s' } ) =\n Some (DM.create #(struct_field l) #(otype_of_struct_field l) f)\n\nlet otype_of_typ_struct\n (l: struct_typ)\n: Lemma\n (otype_of_typ (TStruct l) == ostruct l)\n [SMTPat (otype_of_typ (TStruct l))]\n= assert_norm(otype_of_typ (TStruct l) == ostruct l)\n\nlet ounion (l: struct_typ) = option (gtdata (struct_field l) (otype_of_struct_field l))\n\nlet ounion_get_key (#l: union_typ) (v: ounion l { Some? v } ) : Tot (struct_field l) = _gtdata_get_key (Some?.v v)\n\nlet ounion_get_value\n (#l: union_typ)\n (v: ounion l { Some? v } )\n (fd: struct_field l)\n: Pure (otype_of_struct_field l fd)\n (requires (ounion_get_key v == fd))\n (ensures (fun _ -> True))\n= gtdata_get_value (Some?.v v) fd\n\nlet ounion_create\n (l: union_typ)\n (fd: struct_field l)\n (v: otype_of_struct_field l fd)\n: Tot (ounion l)\n= Some (gtdata_create fd v)\n\nlet otype_of_typ_union\n (l: union_typ)\n: Lemma\n (otype_of_typ (TUnion l) == ounion l)\n [SMTPat (otype_of_typ (TUnion l))]\n= assert_norm (otype_of_typ (TUnion l) == ounion l)\n\nlet struct_field_is_readable\n (l: struct_typ)\n (ovalue_is_readable: (\n (t: typ) ->\n (v: otype_of_typ t) ->\n Pure bool\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: ostruct l { Some? v } )\n (s: string)\n: Tot bool\n= if List.Tot.mem s (List.Tot.map fst l.fields)\n then ovalue_is_readable (typ_of_struct_field l s) (ostruct_sel v s)\n else true\n\nlet rec ovalue_is_readable\n (t: typ)\n (v: otype_of_typ t)\n: Tot bool\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n Some? v && (\n let keys = List.Tot.map fst l.fields in\n let pred\n (t': typ)\n (v: otype_of_typ t')\n : Pure bool\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_is_readable t' v\n in\n List.Tot.for_all (struct_field_is_readable l pred v) keys\n )\n | TUnion l ->\n let v : ounion l = v in\n Some? v && (\n let k = ounion_get_key v in\n ovalue_is_readable (typ_of_struct_field l k) (ounion_get_value v k)\n )\n | TArray len t ->\n let (v: option (array len (otype_of_typ t))) = v in\n Some? v &&\n Seq.for_all (ovalue_is_readable t) (Some?.v v)\n | TBase t ->\n let (v: option (type_of_base_typ t)) = v in\n Some? v\n | TPointer t ->\n let (v: option (pointer t)) = v in\n Some? v\n | TNPointer t ->\n let (v: option (npointer t)) = v in\n Some? v\n | TBuffer t ->\n let (v: option (buffer t)) = v in\n Some? v\n\nlet ovalue_is_readable_struct_intro'\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\\n List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields)\n )))\n (ensures (ovalue_is_readable (TStruct l) v))\n= assert_norm (ovalue_is_readable (TStruct l) v == true)\n\nlet ovalue_is_readable_struct_intro\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n: Lemma\n (requires (\n let (v: ostruct l) = v in (\n Some? v /\\ (\n forall (f: struct_field l) .\n ovalue_is_readable (typ_of_struct_field l f) (ostruct_sel v f)\n ))))\n (ensures (ovalue_is_readable (TStruct l) v))\n= List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n ovalue_is_readable_struct_intro' l v\n\nlet ovalue_is_readable_struct_elim\n (l: struct_typ)\n (v: otype_of_typ (TStruct l))\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) v))\n (ensures (\n let (v: ostruct l) = v in (\n Some? v /\\\n ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd)\n )))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))]\n= let (v: ostruct l) = v in\n assert_norm (ovalue_is_readable (TStruct l) v == List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n assert (List.Tot.for_all (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields));\n List.Tot.for_all_mem (struct_field_is_readable l (fun x y -> ovalue_is_readable x y) v) (List.Tot.map fst l.fields);\n assert (ovalue_is_readable (typ_of_struct_field l fd) (ostruct_sel v fd))\n\nlet ovalue_is_readable_array_elim\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n (i: UInt32.t { UInt32.v i < UInt32.v len } )\n: Lemma\n (requires (ovalue_is_readable (TArray len t) v))\n (ensures (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n )))\n= ()\n\nlet ovalue_is_readable_array_intro\n (#len: array_length_t )\n (#t: typ)\n (v: otype_of_typ (TArray len t))\n: Lemma\n (requires (\n let (v: option (array len (otype_of_typ t))) = v in (\n Some? v /\\ (\n forall (i: UInt32.t { UInt32.v i < UInt32.v len } ) .\n ovalue_is_readable t (Seq.index (Some?.v v) (UInt32.v i))\n ))))\n (ensures (ovalue_is_readable (TArray len t) v))\n= let (v: option (array len (otype_of_typ t))) = v in\n let (v: array len (otype_of_typ t)) = Some?.v v in\n let f\n (i: nat { i < UInt32.v len } )\n : Lemma\n (ovalue_is_readable t (Seq.index v i))\n = let (j : UInt32.t { UInt32.v j < UInt32.v len } ) = UInt32.uint_to_t i in\n assert (ovalue_is_readable t (Seq.index v (UInt32.v j)))\n in\n Classical.forall_intro f\n\nlet ostruct_field_of_struct_field\n (l: struct_typ)\n (ovalue_of_value: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Pure (otype_of_typ t)\n (requires (t << l))\n (ensures (fun _ -> True))\n ))\n (v: struct l)\n (f: struct_field l)\n: Tot (otype_of_struct_field l f)\n= ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n\n(* TODO: move to Seq.Base *)\n\nlet seq_init_index\n (#a:Type) (len:nat) (contents:(i:nat { i < len } -> Tot a)) (i: nat)\n: Lemma\n (requires (i < len))\n (ensures (i < len /\\ Seq.index (Seq.init len contents) i == contents i))\n [SMTPat (Seq.index (Seq.init len contents) i)]\n= Seq.init_index len contents\n\nlet rec ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Tot (otype_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let oval\n (t' : typ)\n (v' : type_of_typ t')\n : Pure (otype_of_typ t')\n (requires (t' << l))\n (ensures (fun _ -> True))\n = ovalue_of_value t' v'\n in\n ostruct_create l (ostruct_field_of_struct_field l oval v)\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n assert (UInt32.v len == Seq.length v);\n let f\n (i: nat {i < UInt32.v len})\n : Tot (otype_of_typ t)\n = ovalue_of_value t (Seq.index v i)\n in\n let (v': array len (otype_of_typ t)) = Seq.init (UInt32.v len) f in\n Some v'\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ounion_create l k (ovalue_of_value (typ_of_struct_field l k) (union_get_value v k))\n | _ -> Some v\n\nlet ovalue_is_readable_ostruct_field_of_struct_field\n (l: struct_typ)\n (ih: (\n (t: typ) ->\n (v: type_of_typ t) ->\n Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n ))\n (v: struct l)\n (f: struct_field l)\n: Lemma\n (ovalue_is_readable (typ_of_struct_field l f) (ostruct_field_of_struct_field l ovalue_of_value v f))\n= ih (typ_of_struct_field l f) (struct_sel #l v f)\n\nlet rec ovalue_is_readable_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (requires True)\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n (decreases t)\n [SMTPat (ovalue_is_readable t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let (v: struct l) = v in\n let (v': ostruct l) = ovalue_of_value (TStruct l) v in\n let phi\n (t: typ)\n (v: type_of_typ t)\n : Lemma\n (requires (t << l))\n (ensures (ovalue_is_readable t (ovalue_of_value t v)))\n = ovalue_is_readable_ovalue_of_value t v\n in\n Classical.forall_intro (ovalue_is_readable_ostruct_field_of_struct_field l phi v);\n ovalue_is_readable_struct_intro l v'\n | TArray len t ->\n let (v: array len (type_of_typ t)) = v in\n let (v': otype_of_typ (TArray len t)) = ovalue_of_value (TArray len t) v in\n let (v': array len (otype_of_typ t)) = Some?.v v' in\n let phi\n (i: nat { i < Seq.length v' } )\n : Lemma\n (ovalue_is_readable t (Seq.index v' i))\n = ovalue_is_readable_ovalue_of_value t (Seq.index v i)\n in\n Classical.forall_intro phi\n | TUnion l ->\n let (v: union l) = v in\n let k = _union_get_key v in\n ovalue_is_readable_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()\n\nlet rec value_of_ovalue\n (t: typ)\n (v: otype_of_typ t)\n: Tot (type_of_typ t)\n (decreases t)\n= match t with\n | TStruct l ->\n let (v: ostruct l) = v in\n if Some? v\n then\n let phi\n (f: struct_field l)\n : Tot (type_of_struct_field l f)\n = value_of_ovalue (typ_of_struct_field l f) (ostruct_sel v f)\n in\n struct_create_fun l phi\n else dummy_val t\n | TArray len t' ->\n let (v: option (array len (otype_of_typ t'))) = v in\n begin match v with\n | None -> dummy_val t\n | Some v ->\n let phi\n (i: nat { i < UInt32.v len } )\n : Tot (type_of_typ t')\n = value_of_ovalue t' (Seq.index v i)\n in\n Seq.init (UInt32.v len) phi\n end\n | TUnion l ->\n let (v: ounion l) = v in\n begin match v with\n | None -> dummy_val t\n | _ ->\n let k = ounion_get_key v in\n union_create l k (value_of_ovalue (typ_of_struct_field l k) (ounion_get_value v k))\n end\n | TBase b ->\n let (v: option (type_of_base_typ b)) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TPointer t' ->\n let (v: option (pointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TNPointer t' ->\n let (v: option (npointer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n | TBuffer t' ->\n let (v: option (buffer t')) = v in\n begin match v with\n | None -> dummy_val t\n | Some v -> v\n end\n\nlet ovalue_of_value_array_index\n (#len: array_length_t)\n (t' : typ)\n (v: array len (type_of_typ t'))\n (sv: array len (otype_of_typ t'))\n: Lemma\n (requires (ovalue_of_value (TArray len t') v == Some sv))\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index sv i == ovalue_of_value t' (Seq.index v i)))\n= ()\n\n\nlet value_of_ovalue_array_index\n (#len: array_length_t)\n (t': typ)\n (sv: array len (otype_of_typ t'))\n: Lemma\n (ensures (forall (i: nat) . i < UInt32.v len ==> Seq.index (value_of_ovalue (TArray len t') (Some sv)) i == value_of_ovalue t' (Seq.index sv i)))\n= ()\n\n#set-options \"--z3rlimit 16\"\n\nlet rec value_of_ovalue_of_value\n (t: typ)\n (v: type_of_typ t)\n: Lemma\n (value_of_ovalue t (ovalue_of_value t v) == v)\n [SMTPat (value_of_ovalue t (ovalue_of_value t v))]\n= match t with\n | TStruct l ->\n let v : struct l = v in\n let v' : struct l = value_of_ovalue t (ovalue_of_value t v) in\n let phi\n (f: struct_field l)\n : Lemma\n (struct_sel #l v' f == struct_sel #l v f)\n = value_of_ovalue_of_value (typ_of_struct_field l f) (struct_sel #l v f)\n in\n Classical.forall_intro phi;\n DM.equal_intro v' v;\n DM.equal_elim #(struct_field l) #(type_of_struct_field' l (fun x -> type_of_typ' x)) v' v\n | TArray len t' ->\n let (v: array len (type_of_typ t')) = v in\n let ov : option (array len (otype_of_typ t')) = ovalue_of_value (TArray len t') v in\n assert (Some? ov);\n let sv : array len (otype_of_typ t') = Some?.v ov in\n assert (Seq.length sv == UInt32.v len);\n// assert (forall (i : nat { i < UInt32.v len } ) . Seq.index sv i == ovalue_of_value t' (Seq.index v i));\n ovalue_of_value_array_index t' v sv;\n let v' : array len (type_of_typ t') = value_of_ovalue t ov in\n assert (Seq.length v' == UInt32.v len);\n// assert (forall (i: nat { i < UInt32.v len } ) . Seq.index v' i == value_of_ovalue t' (Seq.index sv i));\n value_of_ovalue_array_index t' sv;\n let phi\n (i: nat { i < UInt32.v len } )\n : Lemma\n (value_of_ovalue t' (ovalue_of_value t' (Seq.index v i)) == Seq.index v i)\n = value_of_ovalue_of_value t' (Seq.index v i)\n in\n Classical.forall_intro phi;\n Seq.lemma_eq_intro v' v;\n Seq.lemma_eq_elim v' v\n | TUnion l ->\n let v : union l = v in\n let k = _union_get_key v in\n value_of_ovalue_of_value (typ_of_struct_field l k) (union_get_value v k)\n | _ -> ()\n\nlet none_ovalue\n (t: typ)\n: Tot (otype_of_typ t)\n= match t with\n | TStruct l -> (None <: ostruct l)\n | TArray len t' -> (None <: option (array len (otype_of_typ t')))\n | TUnion l -> (None <: ounion l)\n | TBase b -> (None <: option (type_of_base_typ b))\n | TPointer t' -> (None <: option (pointer t'))\n | TNPointer t' -> (None <: option (npointer t'))\n | TBuffer t' -> (None <: option (buffer t'))\n\nlet not_ovalue_is_readable_none_ovalue\n (t: typ)\n: Lemma\n (ovalue_is_readable t (none_ovalue t) == false)\n= ()\n\n(*** Semantics of pointers *)\n\n(** Pointer paths *)\n\nlet step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n= match s with\n | StepField l fd ->\n let (m': ostruct l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ -> ostruct_sel m' fd\n end\n | StepUField l fd ->\n let (m' : ounion l) = m' in\n begin match m' with\n | None -> none_ovalue to\n | _ ->\n if fd = ounion_get_key m'\n then ounion_get_value m' fd\n else none_ovalue to\n end\n | StepCell length value i ->\n let (m': option (array length (otype_of_typ to))) = m' in\n begin match m' with\n | None -> none_ovalue to\n | Some m' -> Seq.index m' (UInt32.v i)\n end\n\n(* TODO: we used to have this:\n<<<\nlet ovalue_is_readable_step_sel\n (#from: typ)\n (#to: typ)\n (m': otype_of_typ from)\n (s: step from to)\n: Lemma\n (requires (ovalue_is_readable from m'))\n (ensures (ovalue_is_readable to (step_sel m' s)))\n [SMTPat (ovalue_is_readable to (step_sel m' s))]\n= match s with\n | StepField l fd -> ovalue_is_readable_struct_elim l m' fd\n | _ -> ()\n>>>\nWhich is, of course, wrong with unions. So we have to specialize this rule for each step:\n*)\n\nlet ovalue_is_readable_step_sel_cell\n (#length: array_length_t)\n (#value: typ)\n (m': otype_of_typ (TArray length value))\n (index: UInt32.t { UInt32.v index < UInt32.v length } )\n: Lemma\n (requires (ovalue_is_readable (TArray length value) m'))\n (ensures (ovalue_is_readable value (step_sel m' (StepCell length value index))))\n [SMTPat (ovalue_is_readable value (step_sel m' (StepCell length value index)))]\n= ()\n\nlet ovalue_is_readable_step_sel_field\n (#l: struct_typ)\n (m: ostruct l)\n (fd: struct_field l)\n: Lemma\n (requires (ovalue_is_readable (TStruct l) m))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd))))\n [SMTPat (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepField l fd)))]\n= ()\n\nlet ovalue_is_readable_step_sel_union_same\n (#l: union_typ)\n (m: ounion l)\n (fd: struct_field l)\n: Lemma\n (requires (\n ovalue_is_readable (TUnion l) m /\\\n ounion_get_key m == fd\n ))\n (ensures (ovalue_is_readable (typ_of_struct_field l fd) (step_sel m (StepUField l fd))))\n= ()\n\nlet step_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (s: step from to)\n: Lemma\n (step_sel (none_ovalue from) s == none_ovalue to)\n= ()\n\nlet rec path_sel\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n: Tot (otype_of_typ to)\n (decreases p)\n= match p with\n | PathBase -> m\n | PathStep through' to' p' s ->\n let (m': otype_of_typ through') = path_sel m p' in\n step_sel m' s\n\nlet rec path_sel_none_ovalue\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_sel (none_ovalue from) p == none_ovalue to))\n (decreases p)\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' s ->\n path_sel_none_ovalue p'\n\nlet step_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases s)\n= match s with\n | StepField l fd ->\n let (m: ostruct l) = m in\n begin match m with\n | None ->\n (* whole structure does not exist yet,\n so create one with only one field initialized,\n and all others uninitialized *)\n let phi\n (fd' : struct_field l)\n : Tot (otype_of_struct_field l fd')\n = if fd' = fd\n then v\n else none_ovalue (typ_of_struct_field l fd')\n in\n ostruct_create l phi\n | Some _ -> ostruct_upd m fd v\n end\n | StepCell len _ i ->\n let (m: option (array len (otype_of_typ to))) = m in\n begin match m with\n | None ->\n (* whole array does not exist yet,\n so create one with only one cell initialized,\n and all others uninitialized *)\n let phi\n (j: nat { j < UInt32.v len } )\n : Tot (otype_of_typ to)\n = if j = UInt32.v i\n then v\n else none_ovalue to\n in\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.init (UInt32.v len) phi)\n in\n m'\n | Some m ->\n let (m' : option (array len (otype_of_typ to))) =\n Some (Seq.upd m (UInt32.v i) v)\n in\n m'\n end\n | StepUField l fd ->\n (* overwrite the whole union with the new field *)\n ounion_create l fd v\n\nlet step_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (s: step from to)\n (v: otype_of_typ to)\n: Lemma\n (step_sel (step_upd m s v) s == v)\n= ()\n\nlet rec path_upd\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Tot (otype_of_typ from)\n (decreases p)\n= match p with\n | PathBase -> v\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n path_upd m p' (step_upd s st v)\n\nlet rec path_sel_upd_same\n (#from: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_sel (path_upd m p v) p == v))\n (decreases p)\n [SMTPat (path_sel (path_upd m p v) p)]\n= match p with\n | PathBase -> ()\n | PathStep through' to' p' st ->\n let s = path_sel m p' in\n step_sel_upd_same s st v;\n let s' = step_upd s st v in\n path_sel_upd_same m p' s'\n\nlet rec path_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Pure (path from to)\n (requires True)\n (ensures (fun _ -> True))\n (decreases q)\n= match q with\n | PathBase -> p\n | PathStep through' to' q' st -> PathStep through' to' (path_concat p q') st\n\nlet path_concat_base_r\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (ensures (path_concat p PathBase == p))\n= ()\n\nlet rec path_concat_base_l\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_concat PathBase p == p))\n (decreases p)\n [SMTPat (path_concat PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p' _ -> path_concat_base_l p'\n\nlet rec path_concat_assoc\n (#t0 #t1 #t2 #t3: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n (p23: path t2 t3)\n: Lemma\n (requires True)\n (ensures (path_concat (path_concat p01 p12) p23 == path_concat p01 (path_concat p12 p23)))\n (decreases p23)\n= match p23 with\n | PathBase -> ()\n | PathStep _ _ p23' _ -> path_concat_assoc p01 p12 p23'\n\nlet rec path_sel_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_sel m (path_concat p q) == path_sel (path_sel m p) q))\n (decreases q)\n [SMTPat (path_sel m (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_sel_concat m p q'\n\nlet rec path_upd_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (m: otype_of_typ from)\n (p: path from through)\n (q: path through to)\n (v: otype_of_typ to)\n: Lemma\n (requires True)\n (ensures (path_upd m (path_concat p q) v == path_upd m p (path_upd (path_sel m p) q v)))\n (decreases q)\n [SMTPat (path_upd m (path_concat p q) v)]\n= match q with\n | PathBase -> ()\n | PathStep through' to' q' st ->\n let (s: otype_of_typ through') = path_sel m (path_concat p q') in\n let (s': otype_of_typ through') = step_upd s st v in\n path_upd_concat m p q' s'\n\n// TODO: rename as: prefix_of; use infix notation (p1 `prefix_of` p2)\nlet rec path_includes\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Ghost bool\n (requires True)\n (ensures (fun _ -> True))\n (decreases p2)\n= (to1 = to2 && p1 = p2) || (match p2 with\n | PathBase -> false\n | PathStep _ _ p2' _ ->\n path_includes p1 p2'\n )\n\nlet rec path_includes_base\n (#from: typ)\n (#to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes (PathBase #from) p))\n (decreases p)\n [SMTPat (path_includes PathBase p)]\n= match p with\n | PathBase -> ()\n | PathStep _ _ p2' _ -> path_includes_base p2'\n\nlet path_includes_refl\n (#from #to: typ)\n (p: path from to)\n: Lemma\n (requires True)\n (ensures (path_includes p p))\n [SMTPat (path_includes p p)]\n= ()\n\nlet path_includes_step_r\n (#from #through #to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (PathStep through to p s)))\n [SMTPat (path_includes p (PathStep through to p s))]\n= ()\n\nlet rec path_includes_trans\n (#from #to1 #to2 #to3: typ)\n (p1: path from to1)\n (p2: path from to2)\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3})\n: Lemma\n (requires True)\n (ensures (path_includes p1 p3))\n (decreases p3)\n= FStar.Classical.or_elim\n #(to2 == to3 /\\ p2 == p3)\n #(match p3 with\n | PathBase -> False\n | PathStep _ _ p3' _ ->\n\tpath_includes p2 p3')\n #(fun _ -> path_includes p1 p3)\n (fun _ -> ())\n (fun _ -> match p3 with\n | PathBase -> assert False\n | PathStep _ _ p3' _ ->\n\tpath_includes_trans p1 p2 p3'\n )\n\nlet rec path_includes_ind\n (#from: typ)\n (x:((#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2 {path_includes p1 p2} ) ->\n GTot Type0))\n (h_step:\n ((#through: typ) ->\n (#to: typ) ->\n (p: path from through) ->\n (s: step through to { path_includes p (PathStep through to p s) } ) ->\n Lemma (x p (PathStep through to p s))))\n (h_refl:\n ((#to: typ) ->\n (p: path from to {path_includes p p}) ->\n Lemma (x p p)))\n (h_trans:\n ((#to1: typ) ->\n (#to2: typ) ->\n (#to3: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (p3: path from to3 {path_includes p1 p2 /\\ path_includes p2 p3 /\\ path_includes p1 p3 /\\ x p1 p2 /\\ x p2 p3}) ->\n Lemma (x p1 p3)))\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (requires True)\n (ensures (x p1 p2))\n (decreases p2)\n= FStar.Classical.or_elim\n #(to1 == to2 /\\ p1 == p2)\n #(match p2 with\n | PathBase -> False\n | PathStep _ _ p' _ -> path_includes p1 p')\n #(fun _ -> x p1 p2)\n (fun _ -> h_refl p1)\n (fun _ -> match p2 with\n | PathBase -> assert False\n | PathStep _ _ p2' st ->\n let _ = path_includes_ind x h_step h_refl h_trans p1 p2' in\n let _ = path_includes_step_r p2' st in\n let _ = h_step p2' st in\n h_trans p1 p2' p2\n )\n\nlet rec path_length\n (#from #to: typ)\n (p: path from to)\n: Tot nat\n (decreases p)\n= match p with\n | PathBase -> 0\n | PathStep _ _ p' _ -> 1 + path_length p'\n\nlet path_includes_length\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_includes p1 p2})\n: Lemma\n (ensures (path_length p1 <= path_length p2))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_length p1_ <= path_length p2_)\n (fun #through #to p st -> ())\n (fun #to p -> ())\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> ())\n p1 p2\n\nlet path_includes_step_l\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (s: step through to)\n: Lemma\n (requires True)\n (ensures (~ (path_includes (PathStep through to p s) p)))\n [SMTPat (path_includes (PathStep through to p s) p)]\n= assert (path_length (PathStep through to p s) > path_length p);\n FStar.Classical.forall_intro (path_includes_length #from #to #through (PathStep through to p s))\n\nlet rec path_includes_concat\n (#from: typ)\n (#through: typ)\n (#to: typ)\n (p: path from through)\n (q: path through to)\n: Lemma\n (requires True)\n (ensures (path_includes p (path_concat p q)))\n (decreases q)\n [SMTPat (path_includes p (path_concat p q))]\n= match q with\n | PathBase -> ()\n | PathStep _ _ q' _ -> path_includes_concat p q'\n\nlet path_includes_exists_concat\n (#from #through: typ)\n (p: path from through)\n (#to: typ)\n (q: path from to { path_includes p q } )\n: Lemma\n (ensures (exists (r: path through to) . q == path_concat p r))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> exists r . p2_ == path_concat p1_ r)\n (fun #through #to_ p s ->\n let r = PathStep through to_ PathBase s in\n assert_norm (PathStep through to_ p s == path_concat p r)\n )\n (fun #to p -> FStar.Classical.exists_intro (fun r -> p == path_concat p r) PathBase)\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ ->\n FStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r12 -> p2_ == path_concat p1_ r12) () (fun r12 ->\n\tFStar.Classical.exists_elim (exists r . p3_ == path_concat p1_ r) #_ #(fun r23 -> p3_ == path_concat p2_ r23) () (fun r23 ->\n\t path_concat_assoc p1_ r12 r23;\n\t FStar.Classical.exists_intro (fun r -> p3_ == path_concat p1_ r) (path_concat r12 r23)\n\t)\n )\n )\n p q\n\nlet path_concat_includes\n (#from #through: typ)\n (p: path from through)\n (phi: (\n (#to: typ) ->\n (p': path from to) ->\n Ghost Type0\n (requires (path_includes p p'))\n (ensures (fun _ -> True))\n ))\n (f: (\n (to: typ) ->\n (p': path through to) ->\n Lemma\n (ensures (phi (path_concat p p')))\n ))\n (#to: typ)\n (q: path from to)\n: Lemma\n (requires (path_includes p q))\n (ensures (path_includes p q /\\ phi q))\n= Classical.forall_intro_2 f;\n path_includes_exists_concat p q\n\nlet step_disjoint\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: GTot bool\n= match s1 with\n | StepField _ fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 <> fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n UInt32.v i1 <> UInt32.v i2\n | StepUField _ _ ->\n (* two fields of the same union are never disjoint *)\n false\n\nlet step_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Tot (b: bool { b = true <==> to1 == to2 /\\ s1 == s2 } )\n= match s1 with\n | StepField l1 fd1 ->\n let (StepField _ fd2) = s2 in\n fd1 = fd2\n | StepCell _ _ i1 ->\n let (StepCell _ _ i2) = s2 in\n i1 = i2\n | StepUField l1 fd1 ->\n let (StepUField _ fd2) = s2 in\n fd1 = fd2\n\nlet step_disjoint_not_eq\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2 == true))\n (ensures (step_eq s1 s2 == false))\n= () (* Note: the converse is now wrong, due to unions *)\n\nlet step_disjoint_sym\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2)\n: Lemma\n (requires (step_disjoint s1 s2))\n (ensures (step_disjoint s2 s1))\n= ()\n\nnoeq type path_disjoint_t (#from: typ):\n (#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n Type0\n= | PathDisjointStep:\n (#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)\n | PathDisjointIncludes:\n (#to1: typ) ->\n (#to2: typ) ->\n (p1: path from to1) ->\n (p2: path from to2) ->\n (#to1': typ) ->\n (#to2': typ) ->\n (p1': path from to1' {path_includes p1 p1'}) ->\n (p2': path from to2' {path_includes p2 p2'}) ->\n path_disjoint_t p1 p2 ->\n path_disjoint_t p1' p2'\n\nlet rec path_disjoint_t_rect\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (h: path_disjoint_t p1 p2) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 } ) ->\n (h: path_disjoint_t (PathStep through to1 p s1) (PathStep through to2 p s2)) ->\n GTot (x (PathStep through to1 p s1) (PathStep through to2 p s2) h)))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2'}) ->\n (h: path_disjoint_t p1 p2) ->\n (h': path_disjoint_t p1' p2') ->\n (ihx: x p1 p2 h) ->\n GTot (x p1' p2' h')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (h: path_disjoint_t p1 p2)\n: Ghost (x p1 p2 h)\n (requires True)\n (ensures (fun _ -> True))\n (decreases h)\n= match h with\n | PathDisjointStep p s1 s2 -> h_step p s1 s2 h\n | PathDisjointIncludes p1_ p2_ p1' p2' h_ -> h_includes p1_ p2_ p1' p2' h_ h (path_disjoint_t_rect x h_step h_includes p1_ p2_ h_)\n\nlet path_disjoint\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: GTot Type0\n= squash (path_disjoint_t p1 p2)\n\n#push-options \"--smtencoding.valid_intro true --smtencoding.valid_elim true\"\nlet path_disjoint_ind\n (#from: typ)\n (x:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2 {path_disjoint p1 p2} ) ->\n GTot Type))\n (h_step:\n ((#through: typ) ->\n (#to1: typ) ->\n (#to2: typ) ->\n (p: path from through) ->\n (s1: step through to1) ->\n (s2: step through to2 { step_disjoint s1 s2 /\\ path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2) } ) ->\n Lemma (x (PathStep through to1 p s1) (PathStep through to2 p s2) )))\n (h_includes:\n ((#value1: typ) ->\n (#value2: typ) ->\n (p1: path from value1) ->\n (p2: path from value2) ->\n (#value1': typ) ->\n (#value2': typ) ->\n (p1': path from value1' {path_includes p1 p1'}) ->\n (p2': path from value2' {path_includes p2 p2' /\\ path_disjoint p1 p2 /\\ path_disjoint p1' p2' /\\ x p1 p2}) ->\n Lemma (x p1' p2')))\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2 { path_disjoint p1 p2 } )\n: Lemma (x p1 p2)\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun (h: path_disjoint_t p1 p2) ->\n path_disjoint_t_rect\n (fun #v1 #v2 p1 p2 h -> let _ = FStar.Squash.return_squash h in squash (x p1 p2))\n (fun #through #to1 #to2 p s1 s2 h -> let _ = FStar.Squash.return_squash h in h_step p s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' h h' hx ->\n let _ = FStar.Squash.return_squash h in\n let _ = FStar.Squash.return_squash h' in\n let _ = FStar.Squash.return_squash hx in\n h_includes p1 p2 p1' p2')\n p1 p2 h)\n#pop-options\n\nlet path_disjoint_step\n (#from: typ)\n (#through: typ)\n (#to1: typ)\n (#to2: typ)\n (p: path from through)\n (s1: step through to1)\n (s2: step through to2 { step_disjoint s1 s2 } )\n: Lemma\n (requires True)\n (ensures (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2)))\n [SMTPat (path_disjoint (PathStep through to1 p s1) (PathStep through to2 p s2))]\n= FStar.Classical.give_witness (FStar.Squash.return_squash (PathDisjointStep p s1 s2))\n\n#push-options \"--smtencoding.valid_intro true --smtencoding.valid_elim true\"\nlet path_disjoint_includes\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (#to2': typ)\n (p1': path from to1')\n (p2': path from to2')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1' /\\ path_includes p2 p2'))\n (ensures (path_disjoint p1' p2'))\n= let h : squash (path_disjoint_t p1 p2) = FStar.Squash.join_squash () in\n FStar.Squash.bind_squash h (fun h -> FStar.Squash.return_squash (PathDisjointIncludes p1 p2 p1' p2' h))\n#pop-options\n\nlet path_disjoint_includes_l\n (#from: typ)\n (#to1: typ)\n (#to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n (#to1': typ)\n (p1': path from to1')\n: Lemma\n (requires (path_disjoint p1 p2 /\\ path_includes p1 p1'))\n (ensures (path_disjoint p1' p2))\n [SMTPatOr [\n [SMTPat (path_disjoint p1 p2); SMTPat (path_includes p1 p1')];\n [SMTPat (path_disjoint p1' p2); SMTPat (path_includes p1 p1')];\n ]]\n= path_disjoint_includes p1 p2 p1' p2\n\nlet path_disjoint_sym\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint p2 p1))\n [SMTPatOr [[SMTPat (path_disjoint p1 p2)]; [SMTPat (path_disjoint p2 p1)]]]\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint p2 p1)\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step p s2 s1)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_includes p2 p1 p2' p1')\n p1 p2\n\nlet rec path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Tot (b: bool { b == true <==> (value1 == value2 /\\ p1 == p2) } )\n (decreases p1)\n= match p1 with\n | PathBase -> PathBase? p2\n | PathStep _ _ p1' s1 ->\n PathStep? p2 && (\n let (PathStep _ _ p2' s2) = p2 in (\n path_equal p1' p2' &&\n step_eq s1 s2\n ))\n\nlet rec path_length_concat\n (#t0 #t1 #t2: typ)\n (p01: path t0 t1)\n (p12: path t1 t2)\n: Lemma\n (requires True)\n (ensures (path_length (path_concat p01 p12) == path_length p01 + path_length p12))\n (decreases p12)\n= match p12 with\n | PathBase -> ()\n | PathStep _ _ p' s' -> path_length_concat p01 p'\n\nlet rec path_concat_inj_l\n (#from #through1: typ)\n (p1_: path from through1)\n (#v1: typ)\n (p1: path through1 v1)\n (#through2 #v2: typ)\n (p2_: path from through2)\n (p2: path through2 v2)\n: Lemma\n (requires (path_equal (path_concat p1_ p1) (path_concat p2_ p2) == true /\\ path_length p1_ == path_length p2_))\n (ensures (path_equal p1_ p2_ == true /\\ path_equal p1 p2 == true))\n (decreases p1)\n= path_length_concat p1_ p1;\n path_length_concat p2_ p2;\n match p1 with\n | PathBase -> ()\n | PathStep _ _ p1' s1 ->\n let (PathStep _ _ p2' s2) = p2 in\n path_concat_inj_l p1_ p1' p2_ p2'\n\ntype path_disjoint_decomp_t\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Type\n= | PathDisjointDecomp:\n (d_through: typ) ->\n (d_p: path from d_through) ->\n (d_v1: typ) ->\n (d_s1: step d_through d_v1) ->\n (d_p1': path d_v1 value1) ->\n (d_v2: typ) ->\n (d_s2: step d_through d_v2) ->\n (d_p2': path d_v2 value2) ->\n squash (\n step_disjoint d_s1 d_s2 == true /\\\n p1 == path_concat (PathStep _ _ d_p d_s1) d_p1' /\\\n p2 == path_concat (PathStep _ _ d_p d_s2) d_p2'\n ) ->\n path_disjoint_decomp_t p1 p2\n\nlet path_disjoint_decomp_includes\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n (#value1': typ)\n (#value2': typ)\n (p1': path from value1')\n (p2': path from value2')\n: Lemma\n (requires (\n path_includes p1 p1' /\\\n path_includes p2 p2' /\\ (\n exists (d : path_disjoint_decomp_t p1 p2) . True\n )))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n= let f\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n (requires (\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ))\n (ensures (exists (d: path_disjoint_decomp_t p1' p2') . True))\n = let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_assoc (PathStep _ _ p s1) p1_ q1;\n path_concat_assoc (PathStep _ _ p s2) p2_ q2;\n let d' : path_disjoint_decomp_t p1' p2' =\n PathDisjointDecomp _ p _ s1 (path_concat p1_ q1) _ s2 (path_concat p2_ q2) ()\n in\n Classical.exists_intro (fun _ -> True) d'\n in\n let g\n (q1: path value1 value1' )\n (q2: path value2 value2' )\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma\n ((\n p1' == path_concat p1 q1 /\\\n p2' == path_concat p2 q2\n ) ==> (\n exists (d: path_disjoint_decomp_t p1' p2') . True\n ))\n = Classical.move_requires (f q1 q2) d // FIXME: annoying to repeat those type annotations above. WHY WHY WHY can't I just use (fun q1 q2 d -> Classical.move_requires (f q1 q2) d) as an argument of Classical.forall_intro_3 below instead of this g???\n in\n path_includes_exists_concat p1 p1' ;\n path_includes_exists_concat p2 p2' ;\n let _ : squash (exists (d: path_disjoint_decomp_t p1' p2') . True) =\n Classical.forall_intro_3 g\n in\n ()\n\nlet path_disjoint_decomp\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (exists (d: path_disjoint_decomp_t p1 p2) . True))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> exists (d: path_disjoint_decomp_t #from #v1 #v2 p1 p2) . True)\n (fun #through #to1 #to2 p s1 s2 ->\n let d : path_disjoint_decomp_t (PathStep _ _ p s1) (PathStep _ _ p s2) =\n PathDisjointDecomp _ p _ s1 PathBase _ s2 PathBase ()\n in\n Classical.exists_intro (fun _ -> True) d\n )\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' -> path_disjoint_decomp_includes p1 p2 p1' p2')\n p1 p2\n\nlet path_disjoint_not_path_equal\n (#from: typ)\n (#value1: typ)\n (#value2: typ)\n (p1: path from value1)\n (p2: path from value2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_equal p1 p2 == false))\n= let f\n (d: path_disjoint_decomp_t p1 p2)\n : Lemma (path_equal p1 p2 == false)\n = if path_equal p1 p2\n then\n let (PathDisjointDecomp _ p _ s1 p1_ _ s2 p2_ _) = d in\n path_concat_inj_l (PathStep _ _ p s1) p1_ (PathStep _ _ p s2) p2_\n else ()\n in\n path_disjoint_decomp p1 p2;\n Classical.forall_intro f\n\nlet rec path_destruct_l\n (#t0 #t2: typ)\n (p: path t0 t2)\n: Tot (\n x: option (t1: typ & (s: step t0 t1 & (p' : path t1 t2 { p == path_concat (PathStep _ _ PathBase s) p' /\\ path_length p' < path_length p } ) ) )\n { None? x <==> PathBase? p }\n )\n (decreases p)\n= match p with\n | PathBase -> None\n | PathStep _ _ p' s ->\n begin match path_destruct_l p' with\n | None -> Some (| _, (| s, PathBase |) |)\n | Some (| t_, (| s_, p_ |) |) ->\n Some (| t_, (| s_, PathStep _ _ p_ s |) |)\n end\n\nlet rec path_equal'\n (#from #to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2)\n: Tot (b: bool { b == true <==> to1 == to2 /\\ p1 == p2 } )\n (decreases (path_length p1))\n= match path_destruct_l p1 with\n | None -> PathBase? p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> false\n | (Some (| t2, (| s2, p2' |) |) ) ->\n step_eq s1 s2 &&\n path_equal' p1' p2'\n end\n\nlet path_includes_concat_l\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_includes p1 p2))\n (ensures (path_includes (path_concat p0 p1) (path_concat p0 p2)))\n= path_includes_ind\n (fun #to1_ #to2_ p1_ p2_ -> path_includes (path_concat p0 p1_) (path_concat p0 p2_))\n (fun #through #to p st -> ())\n (fun #to p -> path_includes_refl (path_concat p0 p))\n (fun #to1_ #to2_ #to3_ p1_ p2_ p3_ -> path_includes_trans (path_concat p0 p1_) (path_concat p0 p2_) (path_concat p0 p3_))\n p1 p2\n\nlet path_disjoint_concat\n (#from #through #to1 #to2: typ)\n (p0: path from through)\n (p1: path through to1)\n (p2: path through to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_disjoint (path_concat p0 p1) (path_concat p0 p2)))\n= path_disjoint_ind\n (fun #v1 #v2 p1 p2 -> path_disjoint (path_concat p0 p1) (path_concat p0 p2))\n (fun #through #to1 #to2 p s1 s2 -> path_disjoint_step (path_concat p0 p) s1 s2)\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n path_includes_concat_l p0 p1 p1';\n path_includes_concat_l p0 p2 p2';\n path_disjoint_includes (path_concat p0 p1) (path_concat p0 p2) (path_concat p0 p1') (path_concat p0 p2'))\n p1 p2\n\n(* TODO: the following is now wrong due to unions, but should still hold if we restrict ourselves to readable paths\nlet rec not_path_equal_path_disjoint_same_type\n (#from: typ)\n (#value: typ)\n (p1: path from value)\n (p2: path from value)\n: Lemma\n (requires (path_equal p1 p2 == false))\n (ensures (path_disjoint p1 p2))\n (decreases (path_length p1))\n= assert (path_equal p1 p2 == path_equal' p1 p2);\n match path_destruct_l p1 with\n | None -> path_typ_depth p2\n | Some (| t1, (| s1, p1' |) |) ->\n begin match path_destruct_l p2 with\n | None -> path_typ_depth p1\n | Some (| t2, (| s2, p2' |) |) ->\n if step_eq s1 s2\n then begin\n\tnot_path_equal_path_disjoint_same_type p1' p2' ;\n\tpath_disjoint_concat (PathStep _ _ PathBase s1) p1' p2'\n end else begin\n path_disjoint_step PathBase s1 s2;\n\tpath_includes_concat (PathStep _ _ PathBase s1) p1';\n\tpath_includes_concat (PathStep _ _ PathBase s2) p2';\n\tpath_disjoint_includes (PathStep _ _ PathBase s1) (PathStep _ _ PathBase s2) p1 p2\n end\n end\n*)\n\nlet step_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (s1: step from to1)\n (s2: step from to2 {step_disjoint s1 s2})\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n: Lemma\n (step_sel (step_upd m s1 v) s2 == step_sel m s2)\n= match s1 with\n | StepField l1 fd1 ->\n let (m: ostruct l1) = m in\n let (StepField _ fd2) = s2 in\n begin match m with\n | None -> ()\n | Some m -> DM.sel_upd_other m fd1 v fd2\n end\n | StepCell length1 _ i1 ->\n let (m: option (array length1 (otype_of_typ to1))) = m in\n let (StepCell _ _ i2) = s2 in\n begin match m with\n | None -> ()\n | Some m ->\n Seq.lemma_index_upd2 m (UInt32.v i1) v (UInt32.v i2)\n end\n\nlet path_sel_upd_other\n (#from: typ)\n (#to1 #to2: typ)\n (p1: path from to1)\n (p2: path from to2 {path_disjoint p1 p2})\n: Lemma\n (ensures (forall (m: otype_of_typ from) (v: otype_of_typ to1) . path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_disjoint_ind\n (fun #v1 #v2 p1_ p2_ -> forall (m: otype_of_typ from) (v: otype_of_typ v1) . path_sel (path_upd m p1_ v) p2_ == path_sel m p2_)\n (fun #through #to1_ #to2_ p s1 s2 ->\n FStar.Classical.forall_intro_sub #_ #(fun m -> forall (v: otype_of_typ to1_) . path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun m ->\n\t FStar.Classical.forall_intro_sub #_ #(fun v -> path_sel (path_upd m (PathStep through to1_ p s1) v) (PathStep through to2_ p s2) == path_sel m (PathStep through to2_ p s2)) (fun v ->\n\t let m0 = path_sel m p in\n let m1 = step_sel m0 s1 in\n let m2 = step_sel m0 s2 in\n let m0' = step_upd m0 s1 v in\n path_sel_upd_same m p m0';\n step_sel_upd_other s1 s2 m0 v\n )))\n (fun #v1 #v2 p1 p2 #v1' #v2' p1' p2' ->\n let h1: squash (exists r1 . p1' == path_concat p1 r1) = path_includes_exists_concat p1 p1' in\n let h2: squash (exists r2 . p2' == path_concat p2 r2) = path_includes_exists_concat p2 p2' in\n FStar.Classical.forall_intro_sub #_ #(fun (m: otype_of_typ from) -> forall v . path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (m: otype_of_typ from) ->\n FStar.Classical.forall_intro_sub #_ #(fun (v: otype_of_typ v1') -> path_sel (path_upd m p1' v) p2' == path_sel m p2') (fun (v: otype_of_typ v1') ->\n FStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h1 (fun r1 ->\n\tFStar.Classical.exists_elim (path_sel (path_upd m p1' v) p2' == path_sel m p2') h2 (fun r2 ->\n\t path_upd_concat m p1 r1 v;\n\t path_sel_concat m p2 r2\n\t )))))\n p1 p2\n\nlet path_sel_upd_other'\n (#from: typ)\n (#to1: typ)\n (p1: path from to1)\n (m: otype_of_typ from)\n (v: otype_of_typ to1)\n (#to2: typ)\n (p2: path from to2)\n: Lemma\n (requires (path_disjoint p1 p2))\n (ensures (path_sel (path_upd m p1 v) p2 == path_sel m p2))\n= path_sel_upd_other p1 p2\n\n(** Operations on pointers *)\n\nlet equal\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Ghost bool\n (requires True)\n (ensures (fun b -> b == true <==> t1 == t2 /\\ p1 == p2 ))\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_equal (Pointer?.p p1) (Pointer?.p p2)\n\nlet as_addr (#t: typ) (p: pointer t) =\n HS.aref_as_addr (Pointer?.contents p)\n\nlet _field\n (#l: struct_typ)\n (p: pointer (TStruct l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TStruct l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepField _ fd) in\n Pointer from contents p''\n\nlet _cell\n (#length: array_length_t)\n (#value: typ)\n (p: pointer (TArray length value))\n (i: UInt32.t {UInt32.v i < UInt32.v length})\n: Tot (pointer value)\n= let (Pointer from contents p') = p in\n let p' : path from (TArray length value) = p' in\n let p'' : path from value = PathStep _ _ p' (StepCell _ _ i) in\n Pointer from contents p''\n\nlet _ufield\n (#l: union_typ)\n (p: pointer (TUnion l))\n (fd: struct_field l)\n: Tot (pointer (typ_of_struct_field l fd))\n= let (Pointer from contents p') = p in\n let p' : path from (TUnion l) = p' in\n let p'' : path from (typ_of_struct_field l fd) = PathStep _ _ p' (StepUField _ fd) in\n Pointer from contents p''\n\nlet unused_in\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: GTot Type0\n= let (Pointer from contents p') = p in\n HS.aref_unused_in contents h\n\nlet pointer_ref_contents : Type0 = (t: typ & otype_of_typ t)\n\nlet live\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot Type0\n= let rel = Heap.trivial_preorder pointer_ref_contents in\n let (Pointer from contents _) = p in (\n HS.aref_live_at h contents pointer_ref_contents rel /\\ (\n let untyped_contents = HS.greference_of contents pointer_ref_contents rel in (\n dfst (HS.sel h untyped_contents) == from\n )))\n\nlet nlive\n (#value: typ)\n (h: HS.mem)\n (p: npointer value)\n: GTot Type0\n= if g_is_null p\n then True\n else live h p\n\nlet live_nlive\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= ()\n\nlet g_is_null_nlive\n (#t: typ)\n (h: HS.mem)\n (p: npointer t)\n= ()\n\nlet greference_of\n (#value: typ)\n (p: pointer value)\n: Ghost (HS.reference pointer_ref_contents)\n (requires (exists h . live h p))\n (ensures (fun x -> (exists h . live h p) /\\ x == HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents) /\\ HS.aref_of x == Pointer?.contents p))\n= HS.greference_of (Pointer?.contents p) pointer_ref_contents (Heap.trivial_preorder pointer_ref_contents)\n\nlet unused_in_greference_of\n (#value: typ)\n (p: pointer value)\n (h: HS.mem)\n: Lemma\n (requires (exists h . live h p))\n (ensures ((exists h . live h p) /\\ (HS.unused_in (greference_of p) h <==> unused_in p h)))\n [SMTPatOr [\n [SMTPat (HS.unused_in (greference_of p) h)];\n [SMTPat (unused_in p h)];\n ]]\n= ()\n\nlet live_not_unused_in\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n= let f () : Lemma\n (requires (live h p /\\ p `unused_in` h))\n (ensures False)\n = let r = greference_of p in\n HS.contains_aref_unused_in h r (Pointer?.contents p)\n in\n Classical.move_requires f ()\n\nlet gread\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: GTot (type_of_typ value)\n= if StrongExcludedMiddle.strong_excluded_middle (live h p)\n then\n let content = greference_of p in\n let (| _, c |) = HS.sel h content in\n value_of_ovalue value (path_sel c (Pointer?.p p))\n else\n dummy_val value\n\nlet frameOf\n (#value: typ)\n (p: pointer value)\n: GTot HS.rid\n= HS.frameOf_aref (Pointer?.contents p)\n", "sketch": [ "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in memory `h`.", "We want to prove that if a pointer `p` is live in a memory region `h`, then the frame of `p` is also live in `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in memory `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in memory `h`.", "We want to prove that if a pointer `p` is live in the memory `h`, then the frame of `p` is also live in the memory `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in memory `h`.", "We want to prove that if a pointer `p` is live in memory `h`, then the frame of `p` is also live in `h`." ], "generated_solution": [ "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()", "let live_region_frameOf\n (#value: typ)\n (h: HS.mem)\n (p: pointer value)\n: Lemma\n (requires (live h p))\n (ensures (HS.live_region h (frameOf p)))\n [SMTPatOr [\n [SMTPat (HS.live_region h (frameOf p))];\n [SMTPat (live h p)]\n ]]\n= ()" ] }, { "file_name": "Hacl.Spec.SHA2.EquivScalar.fst", "name": "Hacl.Spec.SHA2.EquivScalar.shuffle_lemma_i_step", "opens_and_abbrevs": [ { "abbrev": "Loops", "full_module": "Lib.LoopCombinators" }, { "abbrev": "LSeqLemmas", "full_module": "Lib.Sequence.Lemmas" }, { "abbrev": "UpdLemmas", "full_module": "Lib.UpdateMulti.Lemmas" }, { "abbrev": "BSeq", "full_module": "Lib.ByteSequence" }, { "abbrev": "LSeq", "full_module": "Lib.Sequence" }, { "abbrev": "Spec", "full_module": "Spec.SHA2" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.LoopCombinators" }, { "open": "Lib.Sequence" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Spec.Hash.Definitions" }, { "open": "Lib.Sequence" }, { "open": "Lib.IntTypes" }, { "open": "FStar.Mul" }, { "open": "Hacl.Spec.SHA2" }, { "open": "Hacl.Spec.SHA2" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 0, "max_fuel": 0, "initial_ifuel": 0, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 50, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": false, "reuse_hint_for": null }, "source_type": "val shuffle_lemma_i_step:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a\n -> st1:words_state a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))", "source_definition": "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s = Spec.ws_pre a block in\n let st_s = Loops.repeati 16 (shuffle_pre_inner16 a ws_s i) st1 in\n let st = Loops.repeati 16 (shuffle_inner a ws1 i) st1 in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n ws_next_inner_lemma a block i ws1;\n\n let aux_st (j:nat{j < 16}) (hash:words_state a) :\n Lemma (shuffle_pre_inner16 a ws_s i j hash == shuffle_inner a ws1 i j hash) =\n let k_t = Seq.index (k0 a) (16 * i + j) in\n let lp = shuffle_core_pre a k_t ws_s.[16 * i + j] st in\n let rp = shuffle_core_pre a k_t ws1.[j] hash in\n assert (ws1.[j] == ws_s.[16 * i + j]) in\n\n Classical.forall_intro_2 aux_st;\n LSeqLemmas.repeati_extensionality 16 (shuffle_pre_inner16 a ws_s i) (shuffle_inner a ws1 i) st1", "source_range": { "start_line": 487, "start_col": 0, "end_line": 502, "end_col": 97 }, "interleaved": false, "definition": "fun a block _ i ws1 st1 ->\n let ws_s = Spec.SHA2.ws_pre a block in\n let st_s =\n Lib.LoopCombinators.repeati 16 (Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner16 a ws_s i) st1\n in\n let st = Lib.LoopCombinators.repeati 16 (Hacl.Spec.SHA2.shuffle_inner a ws1 i) st1 in\n let ws =\n (match i < Hacl.Spec.SHA2.num_rounds16 a - 1 with\n | true -> Hacl.Spec.SHA2.ws_next a ws1\n | _ -> ws1)\n <:\n Hacl.Spec.SHA2.k_w a\n in\n Hacl.Spec.SHA2.EquivScalar.ws_next_inner_lemma a block i ws1;\n let aux_st j hash =\n (let k_t = FStar.Seq.Base.index (Hacl.Spec.SHA2.k0 a) (16 * i + j) in\n let lp = Hacl.Spec.SHA2.shuffle_core_pre a k_t ws_s.[ 16 * i + j ] st in\n let rp = Hacl.Spec.SHA2.shuffle_core_pre a k_t ws1.[ j ] hash in\n assert (ws1.[ j ] == ws_s.[ 16 * i + j ]))\n <:\n FStar.Pervasives.Lemma\n (ensures\n Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner16 a ws_s i j hash ==\n Hacl.Spec.SHA2.shuffle_inner a ws1 i j hash)\n in\n FStar.Classical.forall_intro_2 aux_st;\n Lib.Sequence.Lemmas.repeati_extensionality 16\n (Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner16 a ws_s i)\n (Hacl.Spec.SHA2.shuffle_inner a ws1 i)\n st1", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Spec.Hash.Definitions.sha2_alg", "Hacl.Spec.SHA2.k_w", "Spec.Hash.Definitions.words_state", "Prims.nat", "Prims.b2t", "Prims.op_LessThan", "Hacl.Spec.SHA2.num_rounds16", "Lib.Sequence.Lemmas.repeati_extensionality", "Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner16", "Hacl.Spec.SHA2.shuffle_inner", "Prims.unit", "FStar.Classical.forall_intro_2", "Prims.eq2", "Prims.l_True", "Prims.squash", "Prims.Nil", "FStar.Pervasives.pattern", "Prims._assert", "Spec.Hash.Definitions.word", "Hacl.Spec.SHA2.op_String_Access", "Prims.op_Addition", "FStar.Mul.op_Star", "Hacl.Spec.SHA2.shuffle_core_pre", "FStar.Seq.Base.index", "Hacl.Spec.SHA2.k0", "Hacl.Spec.SHA2.EquivScalar.ws_next_inner_lemma", "Prims.op_Subtraction", "Hacl.Spec.SHA2.ws_next", "Prims.bool", "Lib.LoopCombinators.repeati", "Spec.SHA2.k_w", "Spec.SHA2.ws_pre" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n a: Spec.Hash.Definitions.sha2_alg ->\n block: Hacl.Spec.SHA2.k_w a ->\n st0: Spec.Hash.Definitions.words_state a ->\n i: Prims.nat{i < Hacl.Spec.SHA2.num_rounds16 a} ->\n ws1: Hacl.Spec.SHA2.k_w a ->\n st1: Spec.Hash.Definitions.words_state a\n -> FStar.Pervasives.Lemma\n (requires\n (let ws_s = Spec.SHA2.ws_pre a block in\n (match i < Hacl.Spec.SHA2.num_rounds16 a - 1 with\n | true -> ws1 == FStar.Seq.Base.slice ws_s (16 * i) (16 * i + 16)\n | _ ->\n ws1 ==\n FStar.Seq.Base.slice ws_s\n (16 * (Hacl.Spec.SHA2.num_rounds16 a - 1))\n (16 * Hacl.Spec.SHA2.num_rounds16 a))\n <:\n Type0))\n (ensures\n (let ws_s = Spec.SHA2.ws_pre a block in\n let st_s = Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner_num_rounds a ws_s i st1 in\n let _ = Hacl.Spec.SHA2.shuffle_inner_loop a i (ws1, st1) in\n (let FStar.Pervasives.Native.Mktuple2 #_ #_ ws st = _ in\n st == st_s /\\\n (match i < Hacl.Spec.SHA2.num_rounds16 a - 1 with\n | true -> ws == FStar.Seq.Base.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n | _ ->\n ws ==\n FStar.Seq.Base.slice ws_s\n (16 * (Hacl.Spec.SHA2.num_rounds16 a - 1))\n (16 * Hacl.Spec.SHA2.num_rounds16 a)))\n <:\n Type0))", "prompt": "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n ", "expected_response": "let ws_s = Spec.ws_pre a block in\nlet st_s = Loops.repeati 16 (shuffle_pre_inner16 a ws_s i) st1 in\nlet st = Loops.repeati 16 (shuffle_inner a ws1 i) st1 in\nlet ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\nws_next_inner_lemma a block i ws1;\nlet aux_st (j: nat{j < 16}) (hash: words_state a)\n : Lemma (shuffle_pre_inner16 a ws_s i j hash == shuffle_inner a ws1 i j hash) =\n let k_t = Seq.index (k0 a) (16 * i + j) in\n let lp = shuffle_core_pre a k_t ws_s.[ 16 * i + j ] st in\n let rp = shuffle_core_pre a k_t ws1.[ j ] hash in\n assert (ws1.[ j ] == ws_s.[ 16 * i + j ])\nin\nClassical.forall_intro_2 aux_st;\nLSeqLemmas.repeati_extensionality 16 (shuffle_pre_inner16 a ws_s i) (shuffle_inner a ws1 i) st1", "source": { "project_name": "hacl-star", "file_name": "code/sha2-mb/Hacl.Spec.SHA2.EquivScalar.fst", "git_rev": "eb1badfa34c70b0bbe0fe24fe0f49fb1295c7872", "git_url": "https://github.com/project-everest/hacl-star.git" }, "dependencies": { "source_file": "Hacl.Spec.SHA2.EquivScalar.fst", "checked_file": "dataset/Hacl.Spec.SHA2.EquivScalar.fst.checked", "interface_file": true, "dependencies": [ "dataset/Spec.SHA2.fst.checked", "dataset/Spec.SHA2.fst.checked", "dataset/Spec.Hash.MD.fst.checked", "dataset/Spec.Hash.Definitions.fst.checked", "dataset/Spec.Agile.Hash.fst.checked", "dataset/prims.fst.checked", "dataset/Lib.Vec.Lemmas.fsti.checked", "dataset/Lib.UpdateMulti.Lemmas.fsti.checked", "dataset/Lib.Sequence.Lemmas.fsti.checked", "dataset/Lib.Sequence.fsti.checked", "dataset/Lib.LoopCombinators.fsti.checked", "dataset/Lib.IntTypes.fsti.checked", "dataset/Lib.ByteSequence.fsti.checked", "dataset/Hacl.Spec.SHA2.fst.checked", "dataset/FStar.UInt32.fsti.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Mul.fst.checked", "dataset/FStar.Math.Lemmas.fst.checked", "dataset/FStar.Classical.fsti.checked", "dataset/FStar.Calc.fsti.checked" ] }, "definitions_in_context": [ "val update_lemma: a:sha2_alg -> block:block_t a -> hash:words_state a ->\n Lemma (update a block hash == Spec.Agile.Hash.update a hash block)", "val finish_lemma: a:sha2_alg -> st:words_state a ->\n Lemma (finish a st == Spec.Agile.Hash.finish a st ())", "val update_nblocks_is_repeat_blocks_multi:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma (update_nblocks a len b st0 ==\n repeat_blocks_multi (block_length a) (Seq.slice b 0 (Seq.length b - Seq.length b % block_length a)) (update a) st0)", "val ws_next_inductive: a:sha2_alg -> ws0:k_w a -> k:nat{k <= 16} ->\n Pure (k_w a)\n (requires True)\n (ensures fun res ->\n res == Loops.repeati k (ws_next_inner a) ws0 /\\\n (forall (i:nat{i < k}). index res i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index res i == index (Loops.repeati (k - 1) (ws_next_inner a) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index res i == index ws0 i))", "val hash_is_repeat_blocks:\n a:sha2_alg\n -> len:len_lt_max_a_t a\n -> b:seq uint8{length b = len}\n -> st0:words_state a ->\n Lemma\n (let len' : len_t a = mk_len_t a len in\n let st = update_nblocks a len b st0 in\n let rem = len % block_length a in\n let mb = Seq.slice b (len - rem) len in\n update_last a len' rem mb st ==\n Lib.Sequence.repeat_blocks (block_length a) b (update a) (update_last a len') st0)", "let ws_next_inductive a ws0 k =\n Loops.eq_repeati0 k (ws_next_inner a) ws0;\n repeati_inductive #(k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (ws_next_inner a) ws0 /\\\n (forall (i0:nat{i0 < i}). index wsi i0 == index (ws_next_inner a i0 (Loops.repeati i0 (ws_next_inner a) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). index wsi i0 == index (Loops.repeati (i - 1) (ws_next_inner a) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < 16}). index wsi i0 == index ws0 i0))\n (fun i wsi ->\n let ws = ws_next_inner a i wsi in\n Loops.unfold_repeati (i + 1) (ws_next_inner a) ws0 i;\n ws)\n ws0", "val update_last_is_repeat_blocks_multi:\n a:sha2_alg\n -> totlen:len_lt_max_a_t a\n -> len: size_nat { len <= block_length a }\n -> last:lseq uint8 len\n -> st1:words_state a ->\n Lemma\n (requires\n (let blocksize = block_length a in\n len % blocksize == totlen % blocksize))\n (ensures\n (let totlen' : len_t a = mk_len_t a totlen in\n let pad_s = Spec.Hash.MD.pad a totlen in\n let blocksize = block_length a in\n let blocks1 = Seq.append last pad_s in\n Seq.length blocks1 % blocksize == 0 /\\\n update_last a totlen' len last st1 ==\n repeat_blocks_multi blocksize blocks1 (update a) st1))", "val ws_next_lemma: a:sha2_alg -> ws0:k_w a -> k:pos{k <= 16} -> Lemma\n (let wsk : k_w a = Loops.repeati k (ws_next_inner a) ws0 in\n let wsk1 : k_w a = Loops.repeati (k - 1) (ws_next_inner a) ws0 in\n (forall (i:nat{i < k}). index wsk i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index wsk i == index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index wsk i == index ws0 i))", "let ws_next_lemma a ws0 k =\n let _ = ws_next_inductive a ws0 k in ()", "val ws_next_lemma_k: a:sha2_alg -> ws0:k_w a -> k:nat{k < 16} -> Lemma\n (let ws : k_w a = Loops.repeati 16 (ws_next_inner a) ws0 in\n let wsk : k_w a = Loops.repeati (k + 1) (ws_next_inner a) ws0 in\n Seq.index ws k == Seq.index wsk k)", "val hash_agile_lemma: #a:sha2_alg -> len:len_lt_max_a_t a -> b:seq uint8{length b = len} ->\n Lemma (hash #a len b == Spec.Agile.Hash.hash a b)", "let ws_next_lemma_k a ws0 k =\n ws_next_lemma a ws0 (k + 1);\n ws_next_lemma a ws0 16", "val ws_pre_inductive: a:sha2_alg -> block:Spec.block_w a -> k:nat{k <= Spec.size_k_w a} ->\n Pure (Spec.k_w a)\n (requires True)\n (ensures fun res ->\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n res == Loops.repeati k (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i:nat{i < k}).\n Seq.index res i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}).\n Seq.index res i == Seq.index (Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index res i == Seq.index ws0 i)))", "let ws_pre_inductive a block k =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n Loops.eq_repeati0 k (Spec.ws_pre_inner a block) ws0;\n repeati_inductive #(Spec.k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i0:nat{i0 < i}).\n Seq.index wsi i0 ==\n Seq.index (Spec.ws_pre_inner a block i0 (Loops.repeati (i0 + 1) (Spec.ws_pre_inner a block) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). Seq.index wsi i0 == Seq.index (Loops.repeati (i - 1) (Spec.ws_pre_inner a block) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < Spec.size_k_w a}). Seq.index wsi i0 == Seq.index ws0 i0))\n (fun i wsi ->\n let ws = Spec.ws_pre_inner a block i wsi in\n Loops.unfold_repeati (i + 1) (Spec.ws_pre_inner a block) ws0 i;\n ws)\n ws0", "val ws_pre_lemma: a:sha2_alg -> block:Spec.block_w a -> k:pos{k <= Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let wsk : Spec.k_w a = Loops.repeati k (Spec.ws_pre_inner a block) ws0 in\n let wsk1 : Spec.k_w a = Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0 in\n (forall (i:nat{i < k}).\n Seq.index wsk i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). Seq.index wsk i == Seq.index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index wsk i == Seq.index ws0 i))", "let ws_pre_lemma a block k =\n let _ = ws_pre_inductive a block k in ()", "val ws_pre_lemma_k: a:sha2_alg -> block:Spec.block_w a -> k:nat{k < Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let wsk : Spec.k_w a = Loops.repeati (k + 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.index wsk k == Seq.index ws k)", "let ws_pre_lemma_k a block k =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma a block (Spec.size_k_w a)", "val ws_next_pre_lemma_j_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 j == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n1 j 16 == Seq.slice ws_n0 j 16))\n (ensures\n (let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j)))", "let ws_next_pre_lemma_j_step a block i j ws1 ws_n1 =\n let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n\n let s0_n = _sigma0 a ws_n1.[(j+1) % 16] in\n let s1_n = _sigma1 a ws_n1.[(j+14) % 16] in\n //assert (Seq.index ws_n j == s1_n +. ws_n1.[(j+9) % 16] +. s0_n +. ws_n1.[j]);\n\n let s0 = _sigma0 a ws1.[16 * i + 16 + j - 15] in\n let s1 = _sigma1 a ws1.[16 * i + 16 + j - 2] in\n //assert (Seq.index ws (16 * i + 16 + j) == s1 +. ws1.[16 * i + 16 + j - 7] +. s0 +. ws1.[16 * i + 16 + j - 16]);\n\n let ws_n1_index (k:nat{k < 16}) :\n Lemma (if k < j then ws_n1.[k] == ws1.[16 * i + 16 + k] else ws_n1.[k] == ws1.[16 * i + k]) =\n if k < j then Seq.lemma_index_slice ws_n1 0 j k\n else Seq.lemma_index_slice ws_n1 j 16 (k - j) in\n\n ws_n1_index ((j + 1) % 16);\n assert (ws_n1.[(j + 1) % 16] == ws1.[16 * i + j + 1]);\n ws_n1_index ((j + 14) % 16);\n assert (ws_n1.[(j + 14) % 16] == ws1.[16 * i + j + 14]);\n ws_n1_index ((j + 9) % 16);\n assert (ws_n1.[(j + 9) % 16] == ws1.[16 * i + j + 9]);\n ws_n1_index j;\n assert (ws_n1.[j] == ws1.[16 * i + j])", "val ws_next_pre_lemma_aux:\n a:sha2_alg\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a\n -> ws:Spec.k_w a\n -> ws_n:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) /\\\n (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k) /\\\n (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k) /\\\n Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1) /\\\n (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k)))\n (ensures\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16))", "let ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n =\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n\n let ws_n1_index1 (k:nat{k < j - 1}) : Lemma (Seq.index ws_n1 k == Seq.index ws1 (16 * i + 16 + k)) =\n Seq.lemma_index_slice ws_n1 0 (j - 1) k;\n Seq.lemma_index_slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) k in\n\n let ws_n_index1 (k:nat{k < j}) : Lemma (Seq.index ws_n k == Seq.index ws (16 * i + 16 + k)) =\n if k < j - 1 then ws_n1_index1 k else () in\n\n let ws_n_index2 (k:nat{j <= k /\\ k < 16}) : Lemma (Seq.index ws_n k == Seq.index ws_n0 k) =\n () in\n\n Classical.forall_intro ws_n_index1;\n Seq.lemma_eq_intro (Seq.slice ws_n 0 j) (Seq.slice ws (16 * i + 16) (16 * i + 16 + j));\n Classical.forall_intro ws_n_index2;\n Seq.lemma_eq_intro (Seq.slice ws_n j 16) (Seq.slice ws_n0 j 16)", "val ws_next_pre_lemma_init:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.slice ws1 (16 * i) (16 * i + 16) == Seq.slice ws (16 * i) (16 * i + 16))", "let ws_next_pre_lemma_init a block i j =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n\n let s : Spec.block_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let s1 : Spec.block_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index s k == Seq.index s1 k) =\n ws_pre_lemma a block (16 * i + 16 + j);\n ws_pre_lemma a block (16 * i + 16 + j - 1) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro s s1", "val ws_next_pre_lemma_j:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j (ws_next_inner a) ws_n0 in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16)", "let rec ws_next_pre_lemma_j a block i j =\n let ws_pre_f = Spec.ws_pre_inner a block in\n let ws_next_f = ws_next_inner a in\n\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) ws_pre_f ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j ws_next_f ws_n0 in\n\n if j = 0 then\n Loops.eq_repeati0 j ws_next_f ws_n0\n else begin\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) ws_pre_f ws0 in\n ws_next_pre_lemma_init a block i j;\n assert (Seq.slice ws1 (16 * i) (16 * i + 16) == ws_n0);\n let ws_n1 : k_w a = Loops.repeati (j - 1) ws_next_f ws_n0 in\n ws_next_pre_lemma_j a block i (j - 1);\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n assert (Seq.slice ws_n1 (j - 1) 16 == Seq.slice ws_n0 (j - 1) 16);\n\n ws_pre_lemma a block (16 * i + 16 + j);\n assert (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k);\n Loops.unfold_repeati (16 * i + 16 + j) ws_pre_f ws0 (16 * i + 16 + j - 1);\n //assert (ws == ws_pre_f (16 * i + 16 + j - 1) ws1);\n\n ws_next_lemma a ws_n0 j;\n assert (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k);\n assert (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k);\n Loops.unfold_repeati j ws_next_f ws_n0 (j - 1);\n //assert (ws_n == ws_next_f (j - 1) ws_n1);\n ws_next_pre_lemma_j_step a block i (j - 1) ws1 ws_n1;\n assert (Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1));\n ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n;\n () end", "val ws_next_pre_lemma:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16} -> Lemma\n (let ws : Spec.k_w a = Spec.ws_pre a block in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = ws_next a ws_n0 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j))", "let ws_next_pre_lemma a block i j =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati 16 (ws_next_inner a) ws_n0 in\n\n let wsj : Spec.k_w a = Loops.repeati (16 * i + 16 + j + 1) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0j : k_w a = Seq.slice wsj (16 * i) (16 * i + 16) in\n let ws_nj : k_w a = Loops.repeati (j + 1) (ws_next_inner a) ws_n0 in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws_n0 k == Seq.index ws_n0j k) =\n ws_pre_lemma a block (16 * i + 16 + j + 1);\n ws_pre_lemma a block (Spec.size_k_w a) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro ws_n0 ws_n0j;\n\n ws_next_pre_lemma_j a block i (j + 1);\n assert (Seq.slice ws_nj 0 (j + 1) == Seq.slice wsj (16 * i + 16) (16 * i + 16 + j + 1));\n Seq.lemma_index_slice ws_nj 0 (j + 1) j;\n assert (Seq.index ws_nj j == Seq.index wsj (16 * i + 16 + j));\n\n ws_pre_lemma_k a block (16 * i + 16 + j);\n assert (Seq.index wsj (16 * i + 16 + j) == Seq.index ws (16 * i + 16 + j));\n\n ws_next_lemma_k a ws_n0 j;\n assert (Seq.index ws_nj j == Seq.index ws_n j)", "val shuffle_core_pre_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state a ->\n Lemma (shuffle_core_pre a k_t ws_t hash == Spec.shuffle_core_pre a k_t ws_t hash)", "let shuffle_core_pre_lemma a k_t ws_t hash =\n reveal_opaque (`%Spec.shuffle_core_pre) Spec.shuffle_core_pre", "val shuffle_pre_inner: a:sha2_alg -> ws:Spec.k_w a -> i:nat{i < size_k_w a} -> st:words_state a -> words_state a", "let shuffle_pre_inner a ws i st =\n let k = k0 a in\n shuffle_core_pre a k.[i] ws.[i] st", "val shuffle_spec_lemma: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 == Spec.shuffle a st0 block)", "let shuffle_spec_lemma a st0 block =\n reveal_opaque (`%Spec.shuffle) Spec.shuffle;\n let ws = Spec.ws_pre a block in\n let k = Spec.k0 a in\n let aux (i:nat{i < Spec.size_k_w a}) (st:words_state a) :\n Lemma (shuffle_pre_inner a ws i st == Spec.shuffle_core_pre a k.[i] ws.[i] st) =\n let k = Spec.k0 a in\n shuffle_core_pre_lemma a k.[i] ws.[i] st in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality (Spec.size_k_w a)\n (shuffle_pre_inner a ws)\n (fun i h -> Spec.shuffle_core_pre a k.[i] ws.[i] h) st0", "val shuffle_pre_inner16:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> j:nat{j < 16}\n -> st:words_state a ->\n words_state a", "let shuffle_pre_inner16 a ws i j st =\n let k = k0 a in\n shuffle_core_pre a k.[16 * i + j] ws.[16 * i + j] st", "val shuffle_pre_inner_num_rounds:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a ->\n words_state a", "let shuffle_pre_inner_num_rounds a ws i st =\n Loops.repeati 16 (shuffle_pre_inner16 a ws i) st", "val shuffle_spec_lemma16_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a\n -> j:nat{j <= 16} ->\n Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati j (shuffle_pre_inner16 a ws i) st ==\n Loops.repeat_right (16 * i) (16 * i + j) (Loops.fixed_a (words_state a)) (shuffle_pre_inner a ws) st)", "let rec shuffle_spec_lemma16_step a block i st j =\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n //let lp = Loops.repeati j (shuffle_pre_inner16 a ws i) st in\n //let rp = Loops.repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st in\n if j = 0 then begin\n Loops.eq_repeati0 j (shuffle_pre_inner16 a ws i) st;\n Loops.eq_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st end\n else begin\n //let lp1 = Loops.repeati (j - 1) (shuffle_pre_inner16 a ws i) st in\n //let rp1 = Loops.repeat_right (16 * i) (16 * i + j - 1) a_fixed (shuffle_pre_inner a ws) st in\n Loops.unfold_repeati j (shuffle_pre_inner16 a ws i) st (j - 1);\n Loops.unfold_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st (16 * i + j - 1);\n //assert (lp == shuffle_pre_inner16 a ws i (j - 1) lp1);\n //assert (rp == shuffle_pre_inner a ws (16 * i + j - 1) rp1);\n shuffle_spec_lemma16_step a block i st (j - 1);\n () end", "val shuffle_spec_lemma16: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 ==\n Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws) st0)", "let shuffle_spec_lemma16 a st0 block =\n //w = 16, n = num_rounds16 a, normalize_v = id\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n let aux (i:nat{i < num_rounds16 a}) (st:words_state a) :\n Lemma (shuffle_pre_inner_num_rounds a ws i st ==\n Loops.repeat_right (16 * i) (16 * (i + 1)) a_fixed (shuffle_pre_inner a ws) st) =\n shuffle_spec_lemma16_step a block i st 16 in\n\n Classical.forall_intro_2 aux;\n Lib.Vec.Lemmas.lemma_repeati_vec 16 (num_rounds16 a) (fun x -> x)\n (shuffle_pre_inner a ws)\n (shuffle_pre_inner_num_rounds a ws)\n st0", "val ws_next_inner_lemma:\n a:sha2_alg\n -> block:k_w a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))", "let ws_next_inner_lemma a block i ws1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n\n if i < num_rounds16 a - 1 then begin\n let aux (k:nat{k < 16}) : Lemma (Seq.index (ws_next a ws1) k == Seq.index ws_s (16 * (i + 1) + k)) =\n ws_next_pre_lemma a block i k in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (ws_next a ws1) (Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)) end\n else ()", "val shuffle_lemma_i_step:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a\n -> st1:words_state a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))" ], "closest": [ "val shuffle_inner_loop_lemma:\n #a:sha2_alg\n -> #m:m_spec\n -> i:nat{i < Spec.num_rounds16 a}\n -> ws0:ws_spec a m\n -> st0:state_spec a m\n -> l:nat{l < lanes a m}\n -> n:nat{n <= 16} ->\n Lemma\n ((state_spec_v (repeati n (shuffle_inner ws0 i) st0)).[l] ==\n repeati n (Spec.shuffle_inner a (ws_spec_v ws0).[l] i) (state_spec_v st0).[l])\nlet rec shuffle_inner_loop_lemma #a #m i ws0 st0 l n =\n let f_sc = Spec.shuffle_inner a (ws_spec_v ws0).[l] i in\n let lp = repeati n (shuffle_inner ws0 i) st0 in\n let rp = repeati n f_sc (state_spec_v st0).[l] in\n\n if n = 0 then begin\n eq_repeati0 n (shuffle_inner ws0 i) st0;\n eq_repeati0 n f_sc (state_spec_v st0).[l];\n shuffle_inner_lemma_l #a #m ws0 i n st0 l end\n else begin\n let lp0 = repeati (n - 1) (shuffle_inner ws0 i) st0 in\n let rp0 = repeati (n - 1) f_sc (state_spec_v st0).[l] in\n shuffle_inner_loop_lemma #a #m i ws0 st0 l (n - 1);\n assert ((state_spec_v lp0).[l] == rp0);\n unfold_repeati n (shuffle_inner ws0 i) st0 (n - 1);\n unfold_repeati n f_sc (state_spec_v st0).[l] (n - 1);\n shuffle_inner_lemma_l #a #m ws0 i (n - 1) lp0 l end", "val shuffle_inner_loop_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> i:nat{i < Spec.num_rounds16 a}\n -> ws_st:tuple2 (ws_spec a m) (state_spec a m)\n -> l:nat{l < lanes a m} ->\n Lemma\n (let (ws1, st1) = shuffle_inner_loop i ws_st in\n let (ws0, st0) = ws_st in\n let (ws, st) = Spec.shuffle_inner_loop a i ((ws_spec_v ws0).[l], (state_spec_v st0).[l]) in\n (ws_spec_v ws1).[l] == ws /\\ (state_spec_v st1).[l] == st)\nlet shuffle_inner_loop_lemma_l #a #m i (ws0, st0) l =\n shuffle_inner_loop_lemma #a #m i ws0 st0 l 16;\n ws_next_lemma_l ws0 l", "val shuffle_inner_loop:\n a:sha2_alg\n -> i:nat{i < num_rounds16 a}\n -> ws_st:tuple2 (k_w a) (words_state a) ->\n k_w a & words_state a\nlet shuffle_inner_loop a i (ws, st) =\n let st' = Lib.LoopCombinators.repeati 16 (shuffle_inner a ws i) st in\n let ws' = if i < num_rounds16 a - 1 then ws_next a ws else ws in\n (ws', st')", "val shuffle_inner_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> ws:ws_spec a m\n -> i:nat{i < Spec.num_rounds16 a}\n -> j:nat{j < 16}\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma\n ((state_spec_v (shuffle_inner ws i j st)).[l] ==\n Spec.shuffle_inner a (ws_spec_v ws).[l] i j (state_spec_v st).[l])\nlet shuffle_inner_lemma_l #a #m ws i j st l =\n let k_t = Seq.index (Spec.k0 a) (16 * i + j) in\n let ws_t = ws.[j] in\n shuffle_core_spec_lemma_l k_t ws_t st l", "val shuffle_inner:\n a:sha2_alg\n -> ws:k_w a\n -> i:nat{i < num_rounds16 a}\n -> j:nat{j < 16}\n -> hash:words_state a ->\n words_state a\nlet shuffle_inner a ws i j hash =\n let k_t = Seq.index (k0 a) (16 * i + j) in\n let ws_t = ws.[j] in\n shuffle_core_pre a k_t ws_t hash", "val shuffle_loop_lemma:\n #a:sha2_alg\n -> #m:m_spec\n -> ws0:ws_spec a m\n -> st0:state_spec a m\n -> l:nat{l < lanes a m}\n -> n:nat{n <= Spec.num_rounds16 a} ->\n Lemma\n (let (ws_v, st_v) = repeati n (shuffle_inner_loop #a #m) (ws0, st0) in\n let (ws, st) = repeati n (Spec.shuffle_inner_loop a) ((ws_spec_v ws0).[l], (state_spec_v st0).[l]) in\n (ws_spec_v ws_v).[l] == ws /\\ (state_spec_v st_v).[l] == st)\nlet rec shuffle_loop_lemma #a #m ws0 st0 l n =\n let (ws_v, st_v) = repeati n (shuffle_inner_loop #a #m) (ws0, st0) in\n let acc0 = ((ws_spec_v ws0).[l], (state_spec_v st0).[l]) in\n let (ws, st) = repeati n (Spec.shuffle_inner_loop a) acc0 in\n\n if n = 0 then begin\n eq_repeati0 n (shuffle_inner_loop #a #m) (ws0, st0);\n eq_repeati0 n (Spec.shuffle_inner_loop a) acc0;\n shuffle_inner_loop_lemma_l #a #m n (ws0, st0) l end\n else begin\n let (ws_v1, st_v1) = repeati (n - 1) (shuffle_inner_loop #a #m) (ws0, st0) in\n let (ws1, st1) = repeati (n - 1) (Spec.shuffle_inner_loop a) acc0 in\n shuffle_loop_lemma #a #m ws0 st0 l (n - 1);\n //assert ((ws_spec_v ws_v1).[l] == ws1 /\\ (state_spec_v st_v1).[l] == st1);\n unfold_repeati n (shuffle_inner_loop #a #m) (ws0, st0) (n - 1);\n unfold_repeati n (Spec.shuffle_inner_loop a) acc0 (n - 1);\n shuffle_inner_loop_lemma_l #a #m (n - 1) (ws_v1, st_v1) l end", "val shuffle_inner_loop\n (#a: sha2_alg)\n (#m: m_spec)\n (i: nat{i < v (num_rounds16 a)})\n (ws_st: ws_spec a m & state_spec a m)\n : ws_spec a m & state_spec a m\nlet shuffle_inner_loop (#a:sha2_alg) (#m:m_spec) (i:nat{i < v (num_rounds16 a)})\n (ws_st:ws_spec a m & state_spec a m) : ws_spec a m & state_spec a m =\n let (ws,st) = ws_st in\n let st' = repeati 16 (shuffle_inner ws i) st in\n let ws' = if i < v (num_rounds16 a) - 1 then ws_next ws else ws in\n (ws',st')", "val shuffle_inner\n (#a: sha2_alg)\n (#m: m_spec)\n (ws: ws_spec a m)\n (i: nat{i < v (num_rounds16 a)})\n (j: nat{j < 16})\n (st: state_spec a m)\n : state_spec a m\nlet shuffle_inner (#a:sha2_alg) (#m:m_spec) (ws:ws_spec a m) (i:nat{i < v (num_rounds16 a)}) (j:nat{j < 16}) (st:state_spec a m) : state_spec a m =\n let k_t = Seq.index (Spec.k0 a) (16 * i + j) in\n let ws_t = ws.[j] in\n shuffle_core_spec k_t ws_t st", "val shuffle_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> ws:ws_spec a m\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma ((state_spec_v (shuffle ws st)).[l] ==\n Spec.shuffle a (ws_spec_v ws).[l] (state_spec_v st).[l])\nlet shuffle_lemma_l #a #m ws st l =\n shuffle_loop_lemma #a #m ws st l (Spec.num_rounds16 a)", "val shuffle_is_shuffle_pre: a:sha2_alg -> hash:words_state a -> block:block_w a ->\n Lemma (shuffle a hash block == shuffle_aux a hash block)\nlet shuffle_is_shuffle_pre a hash block =\n let rec repeati_is_repeat_range #a (n:nat)\n (f:a -> (i:nat{i < n}) -> Tot a)\n (f': (i:nat{i < n}) -> a -> Tot a)\n (i:nat{i <= n})\n (acc0:a)\n : Lemma\n (requires forall x i. f x i == f' i x)\n (ensures Spec.Loops.repeat_range 0 i f acc0 == Lib.LoopCombinators.repeati i f' acc0)\n = if i = 0 then (\n Lib.LoopCombinators.eq_repeati0 n f' acc0\n ) else (\n Spec.Loops.repeat_range_induction 0 i f acc0;\n Lib.LoopCombinators.unfold_repeati n f' acc0 (i-1);\n repeati_is_repeat_range n f f' (i-1) acc0\n )\n in\n let rec ws_is_ws_pre (i:nat{i <= size_k_w a}) : Lemma\n (ensures forall (j:nat{j < i}).\n ws a block j ==\n (Lib.LoopCombinators.repeati i\n (ws_pre_inner a block)\n (Seq.create (size_k_w a) (to_word a 0))).[j]\n )\n\n = if i = 0 then ()\n else (\n ws_is_ws_pre (i - 1);\n\n Lib.LoopCombinators.unfold_repeati (size_k_w a) (ws_pre_inner a block)\n (Seq.create (size_k_w a) (to_word a 0)) (i - 1);\n\n let f = ws_pre_inner a block in\n let acc0 = Seq.create (size_k_w a) (to_word a 0) in\n\n assert (Lib.LoopCombinators.repeati i f acc0 ==\n f (i - 1) (Lib.LoopCombinators.repeati (i-1) f acc0));\n reveal_opaque (`%ws) ws\n )\n in\n let ws = ws_pre a block in\n let k = k0 a in\n let shuffle_core_is_shuffle_core_pre\n hash\n (i:counter{i < size_k_w a})\n : Lemma (shuffle_core a block hash i == shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] hash)\n = ws_is_ws_pre (size_k_w a);\n reveal_opaque (`%ws_pre) ws_pre;\n reveal_opaque (`%shuffle_core) shuffle_core;\n reveal_opaque (`%shuffle_core_pre) shuffle_core_pre\n in\n Classical.forall_intro_2 shuffle_core_is_shuffle_core_pre;\n repeati_is_repeat_range (size_k_w a) (shuffle_core a block) (fun i h -> shuffle_core_pre a (k0 a).[i] (ws_pre a block).[i] h) (size_k_w a) hash;\n assert (shuffle_pre a hash block == shuffle_aux a hash block);\n reveal_opaque (`%shuffle) shuffle", "val shuffle_core_spec_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> k_t:word a\n -> ws_t:element_t a m\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma\n ((state_spec_v (shuffle_core_spec k_t ws_t st)).[l] ==\n Spec.shuffle_core_pre a k_t (vec_v ws_t).[l] (state_spec_v st).[l])\nlet shuffle_core_spec_lemma_l #a #m k_t ws_t st l =\n eq_intro #(word a) #(state_word_length a)\n (state_spec_v (shuffle_core_spec k_t ws_t st)).[l]\n (shuffle_core_pre_create8 a k_t (vec_v ws_t).[l] (state_spec_v st).[l]);\n shuffle_core_pre_create8_lemma a k_t (vec_v ws_t).[l] (state_spec_v st).[l]", "val shuffle (a: sha2_alg) (ws: k_w a) (hash: words_state a) : Tot (words_state a)\nlet shuffle (a:sha2_alg) (ws:k_w a) (hash:words_state a) : Tot (words_state a) =\n let (ws, st) = Lib.LoopCombinators.repeati (num_rounds16 a) (shuffle_inner_loop a) (ws, hash) in\n st", "val shuffle_pre (a: sha2_alg) (hash: words_state a) (block: block_w a) : Tot (words_state a)\nlet shuffle_pre (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =\n let ws = ws_pre a block in\n let k = k0 a in\n Lib.LoopCombinators.repeati (size_k_w a)\n (fun i h -> shuffle_core_pre a k.[i] ws.[i] h) hash", "val Spec.SHA2.Lemmas.shuffle_core = \n a: Spec.Hash.Definitions.sha2_alg ->\n block: Spec.SHA2.block_w a ->\n hash: Spec.Hash.Definitions.words_state a ->\n t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_core = shuffle_core_", "val shuffle_core_pre_create8_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state' a ->\n Lemma (Spec.shuffle_core_pre a k_t ws_t hash == shuffle_core_pre_create8 a k_t ws_t hash)\nlet shuffle_core_pre_create8_lemma a k_t ws_t hash =\n let a0 = Seq.index hash 0 in\n let b0 = Seq.index hash 1 in\n let c0 = Seq.index hash 2 in\n let d0 = Seq.index hash 3 in\n let e0 = Seq.index hash 4 in\n let f0 = Seq.index hash 5 in\n let g0 = Seq.index hash 6 in\n let h0 = Seq.index hash 7 in\n\n let t1 = h0 +. (Spec._Sigma1 a e0) +. (Spec._Ch a e0 f0 g0) +. k_t +. ws_t in\n let t2 = (Spec._Sigma0 a a0) +. (Spec._Maj a a0 b0 c0) in\n seq_of_list_is_create8 (t1 +. t2) a0 b0 c0 (d0 +. t1) e0 f0 g0", "val shuffle_core_\n (a: sha2_alg)\n (block: block_w a)\n (hash: words_state a)\n (t: counter{t < size_k_w a})\n : Tot (words_state a)\nlet shuffle_core_ (a:sha2_alg) (block:block_w a) (hash:words_state a) (t:counter{t < size_k_w a}): Tot (words_state a) =\n (**) assert(7 <= S.length hash);\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n\n (**) assert(S.length (k0 a) = size_k_w a);\n let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. (k0 a).[t] +. (ws a block t) in\n let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in\n\n (**) assert(t < S.length (k0 a));\n let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in\n assert_norm (List.Tot.length l = 8);\n S.seq_of_list l", "val lemma_rnds2_spec_quad32_is_shuffle_core_x2\n (abef cdgh: quad32)\n (wk0 wk1: UInt32.t)\n (block: block_w)\n (t: counter{t < size_k_w_256 - 1})\n : Lemma\n (requires\n vv wk0 == add_mod32 (k0 SHA2_256).[ t ] (ws_opaque block t) /\\\n vv wk1 == add_mod32 (k0 SHA2_256).[ t + 1 ] (ws_opaque block (t + 1)))\n (ensures\n (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in\n let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in\n hash2 == make_hash abef'' cdgh''))\nlet lemma_rnds2_spec_quad32_is_shuffle_core_x2 (abef cdgh:quad32) (wk0 wk1:UInt32.t) (block:block_w) (t:counter{t < size_k_w_256 - 1}) : Lemma\n (requires vv wk0 == add_mod32 (k0 SHA2_256).[t] (ws_opaque block t) /\\\n vv wk1 == add_mod32 (k0 SHA2_256).[t+1] (ws_opaque block (t+1)))\n (ensures (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in\n let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in\n hash2 == make_hash abef'' cdgh''))\n =\n let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n let abef', cdgh' = sha256_rnds2_spec_update_quad32 abef cdgh wk0 in\n let abef'', cdgh'' = sha256_rnds2_spec_update_quad32 abef' cdgh' wk1 in\n lemma_rnds_quad32 abef cdgh wk0 block t;\n lemma_rnds_quad32 abef' cdgh' wk1 block (t+1);\n assert (equal (make_hash abef' cdgh') hash1);\n assert (equal (make_hash abef'' cdgh'') hash2);\n ()", "val shuffle_core: #a:sha2_alg -> #m:m_spec\n -> k_t:word a\n -> ws_t:element_t a m\n -> st:state_t a m ->\n Stack unit\n (requires fun h -> live h st)\n (ensures fun h0 _ h1 ->\n modifies (loc st) h0 h1 /\\\n as_seq h1 st == SpecVec.shuffle_core_spec k_t ws_t (as_seq h0 st))\nlet shuffle_core #a #m k_t ws_t st =\n let hp0 = ST.get() in\n let a0 = st.(0ul) in\n let b0 = st.(1ul) in\n let c0 = st.(2ul) in\n let d0 = st.(3ul) in\n let e0 = st.(4ul) in\n let f0 = st.(5ul) in\n let g0 = st.(6ul) in\n let h0 = st.(7ul) in\n let k_e_t = load_element a m k_t in\n let t1 = h0 +| (_Sigma1 e0) +| (_Ch e0 f0 g0) +| k_e_t +| ws_t in\n let t2 = (_Sigma0 a0) +| (_Maj a0 b0 c0) in\n let a1 = t1 +| t2 in\n let b1 = a0 in\n let c1 = b0 in\n let d1 = c0 in\n let e1 = d0 +| t1 in\n let f1 = e0 in\n let g1 = f0 in\n let h1 = g0 in\n create8 st a1 b1 c1 d1 e1 f1 g1 h1", "val shuffle_aux (a: sha2_alg) (hash: words_state a) (block: block_w a) : Tot (words_state a)\nlet shuffle_aux (a:sha2_alg) (hash:words_state a) (block:block_w a): Tot (words_state a) =\n Spec.Loops.repeat_range 0 (size_k_w a) (shuffle_core a block) hash", "val sha256_rnds2_spec_quad32_is_shuffle_core_x2\n (abef cdgh wk: quad32)\n (block: block_w)\n (t: counter{t < size_k_w_256 - 1})\n : Lemma\n (requires\n wk.lo0 == add_mod32 (k0 SHA2_256).[ t ] (ws_opaque block t) /\\\n wk.lo1 == add_mod32 (k0 SHA2_256).[ t + 1 ] (ws_opaque block (t + 1)))\n (ensures\n (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n let abef' = sha256_rnds2_spec_quad32 cdgh abef wk in\n hash2 == make_hash abef' abef))\nlet sha256_rnds2_spec_quad32_is_shuffle_core_x2 (abef cdgh wk:quad32) (block:block_w) (t:counter{t < size_k_w_256 - 1}) : Lemma\n (requires wk.lo0 == add_mod32 (k0 SHA2_256).[t] (ws_opaque block t) /\\\n wk.lo1 == add_mod32 (k0 SHA2_256).[t+1] (ws_opaque block (t+1)))\n (ensures (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n let abef' = sha256_rnds2_spec_quad32 cdgh abef wk in\n hash2 == make_hash abef' abef))\n =\n lemma_rnds2_spec_quad32_is_shuffle_core_x2 abef cdgh (to_uint32 wk.lo0) (to_uint32 wk.lo1) block t;\n sha256_rnds2_spec_update_quad32_x2_shifts abef cdgh (to_uint32 wk.lo0) (to_uint32 wk.lo1);\n ()", "val shuffle: #a:sha2_alg -> #m:m_spec -> ws:ws_t a m -> hash:state_t a m ->\n Stack unit\n (requires fun h -> live h hash /\\ live h ws /\\ disjoint hash ws)\n (ensures fun h0 _ h1 -> modifies2 ws hash h0 h1 /\\\n as_seq h1 hash == SpecVec.shuffle #a #m (as_seq h0 ws) (as_seq h0 hash))\nlet shuffle #a #m ws hash =\n let h0 = ST.get() in\n loop2 h0 (num_rounds16 a) ws hash\n (fun h -> shuffle_inner_loop #a #m)\n (fun i ->\n Lib.LoopCombinators.unfold_repeati (v (num_rounds16 a)) (shuffle_inner_loop #a #m) (as_seq h0 ws, as_seq h0 hash) (v i);\n let h1 = ST.get() in\n loop1 h1 16ul hash\n (fun h -> shuffle_inner #a #m (as_seq h1 ws) (v i))\n (fun j ->\n Lib.LoopCombinators.unfold_repeati 16 (shuffle_inner #a #m (as_seq h1 ws) (v i)) (as_seq h1 hash) (v j);\n let k_t = index_k0 a (16ul *. i +. j) in\n let ws_t = ws.(j) in\n shuffle_core k_t ws_t hash);\n if i <. num_rounds16 a -. 1ul then ws_next ws)", "val shuffle_core_pre_ (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a)\nlet shuffle_core_pre_ (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) =\n (**) assert(7 <= S.length hash);\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n\n (**) assert(S.length (k0 a) = size_k_w a);\n let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in\n let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in\n\n let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in\n assert_norm (List.Tot.length l = 8);\n S.seq_of_list l", "val encrypt_block_lemma_st0_i:\n #w:lanes\n -> st_v0:state w\n -> c:counter{w * c <= max_size_t}\n -> b_v:blocks w\n -> j:nat{j < w * blocksize} ->\n Lemma\n (Math.Lemmas.cancel_mul_div w blocksize;\n let b = SeqLemmas.get_block_s #uint8 #(w * blocksize) blocksize b_v j in\n div_mul_lt blocksize j w;\n (chacha20_encrypt_block st_v0 c b_v).[j] ==\n (Scalar.chacha20_encrypt_block (transpose_state st_v0).[j / blocksize] (w * c) b).[j % blocksize])\nlet encrypt_block_lemma_st0_i #w st_v0 c b_v j =\n let k = chacha20_core c st_v0 in\n chacha20_core_lemma_i #w c st_v0 (j / blocksize);\n xor_block_lemma_i #w k b_v j", "val shuffle_core_properties (block: block_w) (hash: hash256) (t: counter{t < size_k_w_256})\n : Lemma\n (let h = shuffle_core_opaque block hash t in\n let open Lib.IntTypes in\n let a0 = hash.[ 0 ] in\n let b0 = hash.[ 1 ] in\n let c0 = hash.[ 2 ] in\n let d0 = hash.[ 3 ] in\n let e0 = hash.[ 4 ] in\n let f0 = hash.[ 5 ] in\n let g0 = hash.[ 6 ] in\n let h0 = hash.[ 7 ] in\n let t1 =\n h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[ t ] +.\n (ws SHA2_256 block t)\n in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n h.[ 0 ] == t1 +. t2 /\\ h.[ 1 ] == a0 /\\ h.[ 2 ] == b0 /\\ h.[ 3 ] == c0 /\\ h.[ 4 ] == d0 +. t1 /\\\n h.[ 5 ] == e0 /\\ h.[ 6 ] == f0 /\\ h.[ 7 ] == g0)\nlet shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) :\n Lemma(let h = shuffle_core_opaque block hash t in\n let open Lib.IntTypes in\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n h.[0] == t1 +. t2 /\\\n h.[1] == a0 /\\\n h.[2] == b0 /\\\n h.[3] == c0 /\\\n h.[4] == d0 +. t1 /\\\n h.[5] == e0 /\\\n h.[6] == f0 /\\\n h.[7] == g0)\n =\n Pervasives.reveal_opaque (`%shuffle_core) shuffle_core;\n let h = shuffle_core SHA2_256 block hash t in\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in\n assert (h == seq_of_list l);\n elim_of_list l;\n ()", "val shuffle_core_properties (block: block_w) (hash: hash256) (t: counter{t < size_k_w_256})\n : Lemma\n (let h = shuffle_core_opaque block hash t in\n let open Lib.IntTypes in\n let a0 = hash.[ 0 ] in\n let b0 = hash.[ 1 ] in\n let c0 = hash.[ 2 ] in\n let d0 = hash.[ 3 ] in\n let e0 = hash.[ 4 ] in\n let f0 = hash.[ 5 ] in\n let g0 = hash.[ 6 ] in\n let h0 = hash.[ 7 ] in\n let t1 =\n h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[ t ] +.\n (ws SHA2_256 block t)\n in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n h.[ 0 ] == t1 +. t2 /\\ h.[ 1 ] == a0 /\\ h.[ 2 ] == b0 /\\ h.[ 3 ] == c0 /\\ h.[ 4 ] == d0 +. t1 /\\\n h.[ 5 ] == e0 /\\ h.[ 6 ] == f0 /\\ h.[ 7 ] == g0)\nlet shuffle_core_properties (block:block_w) (hash:hash256) (t:counter{t < size_k_w_256}) :\n Lemma(let h = shuffle_core_opaque block hash t in\n let open Lib.IntTypes in\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n h.[0] == t1 +. t2 /\\\n h.[1] == a0 /\\\n h.[2] == b0 /\\\n h.[3] == c0 /\\\n h.[4] == d0 +. t1 /\\\n h.[5] == e0 /\\\n h.[6] == f0 /\\\n h.[7] == g0)\n =\n Pervasives.reveal_opaque (`%shuffle_core) shuffle_core;\n let h = shuffle_core SHA2_256 block hash t in\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n let t1 = h0 +. (_Sigma1 SHA2_256 e0) +. (_Ch SHA2_256 e0 f0 g0) +. (k0 SHA2_256).[t] +. (ws SHA2_256 block t) in\n let t2 = (_Sigma0 SHA2_256 a0) +. (_Maj SHA2_256 a0 b0 c0) in\n let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in\n assert (h == seq_of_list l);\n elim_of_list l;\n ()", "val shuffle_core_pre (a: sha2_alg) (k_t ws_t: word a) (hash: words_state a) : Tot (words_state a)\nlet shuffle_core_pre (a:sha2_alg) (k_t: word a) (ws_t: word a) (hash:words_state a) : Tot (words_state a) =\n (**) assert(7 <= S.length hash);\n let a0 = hash.[0] in\n let b0 = hash.[1] in\n let c0 = hash.[2] in\n let d0 = hash.[3] in\n let e0 = hash.[4] in\n let f0 = hash.[5] in\n let g0 = hash.[6] in\n let h0 = hash.[7] in\n\n (**) assert(S.length (k0 a) = size_k_w a);\n let t1 = h0 +. (_Sigma1 a e0) +. (_Ch a e0 f0 g0) +. k_t +. ws_t in\n let t2 = (_Sigma0 a a0) +. (_Maj a a0 b0 c0) in\n\n let l = [ t1 +. t2; a0; b0; c0; d0 +. t1; e0; f0; g0 ] in\n assert_norm (List.Tot.length l = 8);\n S.seq_of_list l", "val transpose_state8_lemma:\n #a:sha2_alg\n -> #m:m_spec{lanes a m == 8}\n -> st:state_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 8 * word_length a} ->\n Lemma\n (let l = lanes a m in\n let ind = 8 * j + i / word_length a in\n Seq.index (vec_v (transpose_state8 st).[ind / l]) (ind % l) ==\n Seq.index (state_spec_v st).[j] (i / word_length a))\nlet transpose_state8_lemma #a #m st j i =\n let l = lanes a m in\n let ind = 8 * j + i / word_length a in\n let r0 = transpose8x8_lseq st in\n transpose8x8_lemma st", "val lemma_shuffle_core_properties (t:counter) (block:block_w) (hash_orig:hash256) : Lemma\n (requires t < size_k_w_256)\n (ensures (let hash = Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig in\n let h = Spec.Loops.repeat_range 0 (t + 1) (shuffle_core_opaque block) hash_orig in\n let a0 = word_to_nat32 hash.[0] in\n let b0 = word_to_nat32 hash.[1] in\n let c0 = word_to_nat32 hash.[2] in\n let d0 = word_to_nat32 hash.[3] in\n let e0 = word_to_nat32 hash.[4] in\n let f0 = word_to_nat32 hash.[5] in\n let g0 = word_to_nat32 hash.[6] in\n let h0 = word_to_nat32 hash.[7] in\n let t1 = add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t) in\n let t2 = add_wrap (sigma256_1_0 a0) (maj_256 a0 b0 c0) in\n word_to_nat32 h.[0] == add_wrap t1 t2 /\\\n word_to_nat32 h.[1] == a0 /\\\n word_to_nat32 h.[2] == b0 /\\\n word_to_nat32 h.[3] == c0 /\\\n word_to_nat32 h.[4] == add_wrap d0 t1 /\\\n word_to_nat32 h.[5] == e0 /\\\n word_to_nat32 h.[6] == f0 /\\\n word_to_nat32 h.[7] == g0))\nlet lemma_shuffle_core_properties (t:counter) (block:block_w) (hash_orig:hash256) : Lemma\n (requires t < size_k_w_256)\n (ensures (let hash = Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig in\n let h = Spec.Loops.repeat_range 0 (t + 1) (shuffle_core_opaque block) hash_orig in\n let a0 = word_to_nat32 hash.[0] in\n let b0 = word_to_nat32 hash.[1] in\n let c0 = word_to_nat32 hash.[2] in\n let d0 = word_to_nat32 hash.[3] in\n let e0 = word_to_nat32 hash.[4] in\n let f0 = word_to_nat32 hash.[5] in\n let g0 = word_to_nat32 hash.[6] in\n let h0 = word_to_nat32 hash.[7] in\n let t1 = add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t) in\n let t2 = add_wrap (sigma256_1_0 a0) (maj_256 a0 b0 c0) in\n word_to_nat32 h.[0] == add_wrap t1 t2 /\\\n word_to_nat32 h.[1] == a0 /\\\n word_to_nat32 h.[2] == b0 /\\\n word_to_nat32 h.[3] == c0 /\\\n word_to_nat32 h.[4] == add_wrap d0 t1 /\\\n word_to_nat32 h.[5] == e0 /\\\n word_to_nat32 h.[6] == f0 /\\\n word_to_nat32 h.[7] == g0))\n =\n let hash = Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig in\n let a0 = word_to_nat32 hash.[0] in\n let b0 = word_to_nat32 hash.[1] in\n let c0 = word_to_nat32 hash.[2] in\n let d0 = word_to_nat32 hash.[3] in\n let e0 = word_to_nat32 hash.[4] in\n let f0 = word_to_nat32 hash.[5] in\n let g0 = word_to_nat32 hash.[6] in\n let h0 = word_to_nat32 hash.[7] in\n ch_256_reveal ();\n maj_256_reveal ();\n lemma_add_wrap_is_add_mod h0 (sigma256_1_1 e0);\n lemma_add_wrap_is_add_mod (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0);\n lemma_add_wrap_is_add_mod (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t]);\n lemma_add_wrap_is_add_mod (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t);\n lemma_add_wrap_is_add_mod (sigma256_1_0 a0) (maj_256 a0 b0 c0);\n lemma_add_wrap_is_add_mod (add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t)) (add_wrap (sigma256_1_0 a0) (maj_256 a0 b0 c0));\n lemma_add_wrap_is_add_mod d0 (add_wrap (add_wrap (add_wrap (add_wrap h0 (sigma256_1_1 e0)) (ch_256 e0 f0 g0)) (word_to_nat32 k.[t])) (ws_opaque block t));\n Spec.Loops.repeat_range_induction 0 (t + 1) (shuffle_core_opaque block) hash_orig;\n shuffle_core_properties block (Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_orig) t", "val Spec.SHA2.shuffle = \n a: Spec.Hash.Definitions.sha2_alg ->\n hash: Spec.Hash.Definitions.words_state a ->\n block: Spec.SHA2.block_w a\n -> Spec.Hash.Definitions.words_state a\nlet shuffle = shuffle_pre", "val transpose_state_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> st:state_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 8 * word_length a} ->\n Lemma\n (let l = lanes a m in\n let ind = 8 * j + i / word_length a in\n (Seq.index (vec_v (transpose_state st).[ind / l])) (ind % l) ==\n (Seq.index (state_spec_v st).[j] (i / word_length a)))\nlet transpose_state_lemma_ij #a #m st j i =\n match lanes a m with\n | 1 -> ()\n | 4 -> transpose_state4_lemma #a #m st j i\n | 8 -> transpose_state8_lemma #a #m st j i", "val transpose_ws8_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec{lanes a m == 8}\n -> ws:ws_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 16} ->\n Lemma\n (let l = lanes a m in\n (vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])\nlet transpose_ws8_lemma_ij #a #m ws j i =\n let l = lanes a m in\n let i_sub = i / l in\n let j_sub = i % l in\n assert (i_sub * l + j_sub == i);\n\n let vs = sub ws (i_sub * l) l in\n eq_intro (sub (transpose_ws8 ws) (i_sub * l) l) (transpose8x8_lseq vs);\n assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v (transpose8x8_lseq vs).[j_sub]).[j]);\n transpose8x8_lemma vs;\n assert ((vec_v (transpose_ws8 ws).[i]).[j] == (vec_v ws.[i_sub * lanes a m + j]).[j_sub])", "val Spec.SHA2.shuffle_core_pre = \n a: Spec.Hash.Definitions.sha2_alg ->\n k_t: Spec.Hash.Definitions.word a ->\n ws_t: Spec.Hash.Definitions.word a ->\n hash: Spec.Hash.Definitions.words_state a\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_core_pre = shuffle_core_pre_", "val encrypt_block_lemma_bs_i:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter{c0 + w <= max_size_t}\n -> c:counter{w * c <= max_size_t}\n -> b_v:blocks w\n -> j:nat{j < w * blocksize} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n Math.Lemmas.cancel_mul_div w blocksize;\n let b = SeqLemmas.get_block_s #uint8 #(w * blocksize) blocksize b_v j in\n div_mul_lt blocksize j w;\n (chacha20_encrypt_block st_v0 c b_v).[j] ==\n (Scalar.chacha20_encrypt_block st0 (w * c + j / blocksize) b).[j % blocksize])\nlet encrypt_block_lemma_bs_i #w k n c0 c b_v j =\n let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n Math.Lemmas.cancel_mul_div w blocksize;\n let b = SeqLemmas.get_block_s #uint8 #(w * blocksize) blocksize b_v j in\n encrypt_block_lemma_st0_i #w st_v0 c b_v j;\n div_mul_lt blocksize j w;\n encrypt_block_scalar_lemma_i #w k n c0 c b (j / blocksize)", "val transpose_ws4_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec{lanes a m == 4} // lanes a m * lanes a m = 16\n -> ws:ws_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 16} ->\n Lemma\n (let l = lanes a m in\n (vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i / l * l + j]).[i % l])\nlet transpose_ws4_lemma_ij #a #m ws j i =\n let l = lanes a m in\n let i_sub = i / l in\n let j_sub = i % l in\n assert (i_sub * l + j_sub == i);\n\n let vs = sub ws (i_sub * l) l in\n eq_intro (sub (transpose_ws4 ws) (i_sub * l) l) (transpose4x4_lseq vs);\n //assert ((transpose_ws4 ws).[i] == (sub (transpose_ws4 ws) (i_sub * l) l).[j_sub]);\n //assert ((transpose_ws4 ws).[i] == (transpose4x4_lseq vs).[j_sub]);\n assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v (transpose4x4_lseq vs).[j_sub]).[j]);\n transpose4x4_lemma vs;\n assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v vs.[j]).[j_sub]);\n assert ((vec_v (transpose_ws4 ws).[i]).[j] == (vec_v ws.[i_sub * l + j]).[j_sub])", "val transpose_state4_lemma:\n #a:sha2_alg\n -> #m:m_spec{lanes a m == 4}\n -> st:state_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 8 * word_length a} ->\n Lemma\n (let l = lanes a m in\n let ind = 8 * j + i / word_length a in\n Seq.index (vec_v (transpose_state st).[ind / l]) (ind % l) ==\n Seq.index (state_spec_v st).[j] (i / word_length a))\nlet transpose_state4_lemma #a #m st j i =\n let r0 = transpose4x4_lseq (sub st 0 4) in\n transpose4x4_lemma (sub st 0 4);\n let r1 = transpose4x4_lseq (sub st 4 4) in\n transpose4x4_lemma (sub st 4 4)", "val shuffle (#a: sha2_alg) (#m: m_spec) (ws: ws_spec a m) (st: state_spec a m) : state_spec a m\nlet shuffle (#a:sha2_alg) (#m:m_spec) (ws:ws_spec a m) (st:state_spec a m) : state_spec a m =\n let (ws,st) = repeati (v(num_rounds16 a)) (shuffle_inner_loop #a #m) (ws,st) in\n st", "val ws_next_inner_lemma_l:\n #a:sha2_alg\n -> #m:m_spec\n -> i:nat{i < 16}\n -> ws:ws_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma ((ws_spec_v (ws_next_inner i ws)).[l] == Spec.ws_next_inner a i (ws_spec_v ws).[l])\nlet ws_next_inner_lemma_l #a #m i ws l =\n eq_intro #(word a) #16\n (ws_spec_v (ws_next_inner i ws)).[l]\n (Spec.ws_next_inner a i (ws_spec_v ws).[l])", "val encrypt_block_scalar_lemma_i:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter\n -> c:counter{w * c <= max_size_t /\\ c0 + w <= max_size_t}\n -> b_i:Scalar.block\n -> i:nat{i < w} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n Scalar.chacha20_encrypt_block st0 (w * c + i) b_i `Seq.equal`\n Scalar.chacha20_encrypt_block (transpose_state st_v0).[i] (w * c) b_i)\nlet encrypt_block_scalar_lemma_i #w k n c0 c b i =\n let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n chacha20_init_lemma_i #w k n c0 i;\n assert ((transpose_state st_v0).[i] == Scalar.chacha20_init k n (c0 + i));\n kb_equiv_lemma #w k n c0 c i", "val ws0_pre_inner (a: sha2_alg) (block: block_w a) (i: nat{i < block_word_length a}) (ws: k_w a)\n : k_w a\nlet ws0_pre_inner (a:sha2_alg) (block:block_w a) (i:nat{i < block_word_length a}) (ws:k_w a) : k_w a =\n Seq.upd ws i (Seq.index block i)", "val ws_next_lemma_loop:\n #a:sha2_alg\n -> #m:m_spec\n -> ws:ws_spec a m\n -> l:nat{l < lanes a m}\n -> n:nat{n <= 16} ->\n Lemma\n ((ws_spec_v (repeati n (ws_next_inner #a #m) ws)).[l] ==\n repeati n (Spec.ws_next_inner a) (ws_spec_v ws).[l])\nlet rec ws_next_lemma_loop #a #m ws l n =\n let lp = repeati n (ws_next_inner #a #m) ws in\n let rp = repeati n (Spec.ws_next_inner a) (ws_spec_v ws).[l] in\n\n if n = 0 then begin\n eq_repeati0 n (ws_next_inner #a #m) ws;\n eq_repeati0 n (Spec.ws_next_inner a) (ws_spec_v ws).[l];\n ws_next_inner_lemma_l 0 ws l end\n else begin\n let lp0 = repeati (n - 1) (ws_next_inner #a #m) ws in\n let rp0 = repeati (n - 1) (Spec.ws_next_inner a) (ws_spec_v ws).[l] in\n ws_next_lemma_loop #a #m ws l (n - 1);\n //assert ((ws_spec_v lp0).[l] == rp0);\n unfold_repeati n (ws_next_inner #a #m) ws (n - 1);\n unfold_repeati n (Spec.ws_next_inner a) (ws_spec_v ws).[l] (n - 1);\n //assert (lp == ws_next_inner #a #m (n - 1) lp0);\n //assert (rp == Spec.ws_next_inner a (n - 1) rp0);\n ws_next_inner_lemma_l (n - 1) lp0 l;\n () end", "val shuffle_core_pre_create8: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state' a -> words_state' a\nlet shuffle_core_pre_create8 a k_t ws_t hash =\n let a0 = Seq.index hash 0 in\n let b0 = Seq.index hash 1 in\n let c0 = Seq.index hash 2 in\n let d0 = Seq.index hash 3 in\n let e0 = Seq.index hash 4 in\n let f0 = Seq.index hash 5 in\n let g0 = Seq.index hash 6 in\n let h0 = Seq.index hash 7 in\n\n let t1 = h0 +. (Spec._Sigma1 a e0) +. (Spec._Ch a e0 f0 g0) +. k_t +. ws_t in\n let t2 = (Spec._Sigma0 a a0) +. (Spec._Maj a a0 b0 c0) in\n create8 (t1 +. t2) a0 b0 c0 (d0 +. t1) e0 f0 g0", "val lemma_update1_shift:\n a:alg\n -> b:block_s a\n -> d:bytes{length d + (size_block a) <= max_limb a}\n -> i:nat{i < length d / size_block a /\\ (size_block a) + length d <= max_limb a}\n -> s:state a ->\n Lemma (\n blake2_update1 a 0 (b `Seq.append` d) (i + 1) s == blake2_update1 a (size_block a) d i s\n )\nlet lemma_update1_shift a b d i s =\n assert (get_blocki a (b `Seq.append` d) (i + 1) `Seq.equal` get_blocki a d i)", "val lemma_sha256_rnds2_two_steps (abef cdgh xmm0: quad32) (t: counter) (block: block_w)\n : Lemma\n (requires\n t + 1 < size_k_w_256 /\\ xmm0.lo0 == add_wrap (vv (k0 SHA2_256).[ t ]) (ws_opaque block t) /\\\n xmm0.lo1 == add_wrap (vv (k0 SHA2_256).[ t + 1 ]) (ws_opaque block (t + 1)))\n (ensures\n (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n hash2 == make_hash (sha256_rnds2_spec cdgh abef xmm0) abef))\nlet lemma_sha256_rnds2_two_steps (abef cdgh xmm0:quad32) (t:counter) (block:block_w) : Lemma\n (requires t + 1 < size_k_w_256 /\\\n xmm0.lo0 == add_wrap (vv (k0 SHA2_256).[t] ) (ws_opaque block t) /\\\n xmm0.lo1 == add_wrap (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1)) )\n (ensures (let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n hash2 == make_hash (sha256_rnds2_spec cdgh abef xmm0) abef))\n =\n let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let hash2 = shuffle_core_opaque block hash1 (t + 1) in\n lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t] ) (ws_opaque block t);\n lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1));\n sha256_rnds2_spec_quad32_is_shuffle_core_x2 abef cdgh xmm0 block t;\n lemma_sha256_rnds2_spec_quad32 cdgh abef xmm0;\n ()", "val transpose_ws_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> ws:ws_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 16} ->\n Lemma\n (let l = lanes a m in\n ((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v ws.[i / l * l + j]).[i % l])\nlet transpose_ws_lemma_ij #a #m ws j i =\n assert (((ws_spec_v (transpose_ws ws)).[j]).[i] == (vec_v (transpose_ws ws).[i]).[j]);\n match lanes a m with\n | 1 -> ()\n | 4 -> transpose_ws4_lemma_ij #a #m ws j i\n | 8 -> transpose_ws8_lemma_ij #a #m ws j i", "val update_block_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len\n -> i:nat{i < len / block_length a}\n -> st:state_spec a m\n -> l:nat{l < lanes a m} ->\n Lemma\n ((state_spec_v (update_block len b i st)).[l] ==\n Spec.update_block a len b.(|l|) i (state_spec_v st).[l])\nlet update_block_lemma_l #a #m len b i st l =\n let mb = get_multiblock_spec len b i in\n update_lemma_l mb st l", "val update_block\n (a: sha2_alg)\n (len: len_lt_max_a_t a)\n (b: seq uint8 {length b = len})\n (i: nat{i < len / block_length a})\n (st: words_state a)\n : words_state a\nlet update_block (a:sha2_alg) (len:len_lt_max_a_t a) (b:seq uint8{length b = len})\n (i:nat{i < len / block_length a}) (st:words_state a) : words_state a\n =\n let mb = Seq.slice b (i * block_length a) (i * block_length a + block_length a) in\n update a mb st", "val Vale.SHA.SHA_helpers.shuffle_core_opaque_aux = \n a: Spec.Hash.Definitions.sha2_alg ->\n block: Spec.SHA2.block_w a ->\n hash: Spec.Hash.Definitions.words_state a ->\n t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_core_opaque_aux = shuffle_core", "val shuffle_core_spec: #a: sha2_alg -> #m:m_spec ->\n k_t: word a ->\n ws_t: element_t a m ->\n st: state_spec a m ->\n state_spec a m\nlet shuffle_core_spec #a #m k_t ws_t st =\n let a0 = st.[0] in\n let b0 = st.[1] in\n let c0 = st.[2] in\n let d0 = st.[3] in\n let e0 = st.[4] in\n let f0 = st.[5] in\n let g0 = st.[6] in\n let h0 = st.[7] in\n let k_e_t = load_element a m k_t in\n let t1 = h0 +| (_Sigma1 e0) +| (_Ch e0 f0 g0) +| k_e_t +| ws_t in\n let t2 = (_Sigma0 a0) +| (_Maj a0 b0 c0) in\n let a1 = t1 +| t2 in\n let b1 = a0 in\n let c1 = b0 in\n let d1 = c0 in\n let e1 = d0 +| t1 in\n let f1 = e0 in\n let g1 = f0 in\n let h1 = g0 in\n create8 a1 b1 c1 d1 e1 f1 g1 h1", "val va_lemma_Loop_rounds_1_15_shift_body : va_b0:va_code -> va_s0:va_state -> i:nat ->\n msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> block:block_w\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Loop_rounds_1_15_shift_body i msg0 msg1) va_s0 /\\\n va_is_dst_vec_opr msg0 va_s0 /\\ va_is_src_vec_opr msg1 va_s0 /\\ va_get_ok va_s0 /\\ l_and (l_and\n (0 <= i) (i < 16)) (i `op_Modulus` 4 =!= 0) /\\ msg0 == i /\\ msg1 == i - i `op_Modulus` 4 /\\ (i\n `op_Modulus` 4 == 1 ==> Vale.Def.Words_s.__proj__Mkfour__item__hi2 (va_eval_vec_opr va_s0 msg1)\n == Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\\ (i `op_Modulus` 4 == 2 ==>\n Vale.Def.Words_s.__proj__Mkfour__item__lo1 (va_eval_vec_opr va_s0 msg1) ==\n Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i) /\\ (i `op_Modulus` 4 == 3 ==>\n Vale.Def.Words_s.__proj__Mkfour__item__lo0 (va_eval_vec_opr va_s0 msg1) ==\n Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==\n Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i /\\ va_state_eq va_sM (va_update_ok va_sM\n (va_update_operand_vec_opr msg0 va_sM va_s0))))\nlet va_lemma_Loop_rounds_1_15_shift_body va_b0 va_s0 i msg0 msg1 block =\n let (va_mods:va_mods_t) = [va_Mod_ok; va_mod_vec_opr msg0] in\n let va_qc = va_qcode_Loop_rounds_1_15_shift_body va_mods i msg0 msg1 block in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_1_15_shift_body i msg0\n msg1) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 83 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 98 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n (Vale.Def.Words_s.__proj__Mkfour__item__hi3 (va_eval_vec_opr va_sM msg0) ==\n Vale.SHA.PPC64LE.SHA_helpers.ws_opaque block i)) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;\n (va_sM, va_fM)", "val Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_opaque_aux = \n a: Spec.Hash.Definitions.sha2_alg ->\n block: Spec.SHA2.block_w a ->\n hash: Spec.Hash.Definitions.words_state a ->\n t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_core_opaque_aux = shuffle_core", "val store_state_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> st:state_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 8 * word_length a} ->\n Lemma\n ((store_state st).[j * (8 * word_length a) + i] ==\n (BSeq.uint_to_bytes_be (Seq.index (state_spec_v st).[j] (i / word_length a))).[i % word_length a])\nlet store_state_lemma_ij #a #m st j i =\n let st1 = transpose_state st in\n let j_v = j * (8 * word_length a) + i in\n let blocksize_v = word_length a * lanes a m in\n\n calc (==) { // j_v % blocksize_v / word_length a\n (j * (8 * word_length a) + i) % blocksize_v / word_length a;\n (==) { Math.Lemmas.modulo_division_lemma (j * (8 * word_length a) + i) (word_length a) (lanes a m) }\n (j * (8 * word_length a) + i) / word_length a % lanes a m;\n (==) { Math.Lemmas.paren_mul_right j 8 (word_length a);\n Math.Lemmas.division_addition_lemma i (word_length a) (8 * j) }\n (8 * j + i / word_length a) % lanes a m;\n };\n\n calc (==) { // j_v / blocksize_v\n (j * (8 * word_length a) + i) / (word_length a * lanes a m);\n (==) { Math.Lemmas.division_multiplication_lemma (j * (8 * word_length a) + i) (word_length a) (lanes a m) }\n (j * (8 * word_length a) + i) / word_length a / lanes a m;\n (==) { Math.Lemmas.paren_mul_right j 8 (word_length a);\n Math.Lemmas.division_addition_lemma i (word_length a) (8 * j) }\n (8 * j + i / word_length a) / lanes a m;\n };\n\n calc (==) {\n Seq.index (store_state st) j_v;\n (==) { index_vecs_to_bytes_be #(word_t a) #(lanes a m) #8 st1 j_v }\n (BSeq.uints_to_bytes_be (vec_v st1.[j_v / blocksize_v])).[j_v % blocksize_v];\n (==) { BSeq.index_uints_to_bytes_be (vec_v st1.[j_v / blocksize_v]) (j_v % blocksize_v) }\n (BSeq.uint_to_bytes_be\n (Seq.index (vec_v st1.[j_v / blocksize_v]) (j_v % blocksize_v / word_length a))).[(j_v % blocksize_v) % word_length a];\n (==) { Math.Lemmas.modulo_modulo_lemma j_v (word_length a) (lanes a m) }\n (BSeq.uint_to_bytes_be\n (Seq.index (vec_v st1.[j_v / blocksize_v]) (j_v % blocksize_v / word_length a))).[j_v % word_length a];\n (==) { Lemmas.transpose_state_lemma_ij #a #m st j i }\n (BSeq.uint_to_bytes_be (Seq.index (state_spec_v st).[j] (i / word_length a))).[j_v % word_length a];\n (==) { Math.Lemmas.paren_mul_right j 8 (word_length a);\n Math.Lemmas.modulo_addition_lemma i (word_length a) (j * 8) }\n (BSeq.uint_to_bytes_be (Seq.index (state_spec_v st).[j] (i / word_length a))).[i % word_length a];\n }", "val load_blocks_lemma_ij_subst:\n #a:sha2_alg\n -> #m:m_spec\n -> b:multiblock_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 16} ->\n Lemma (let l = lanes a m in\n (vec_v (load_blocks b).[i / l * l + j]).[i % l] ==\n BSeq.uint_from_bytes_be\n (Seq.slice b.(|j|) (i * word_length a) (i * word_length a + word_length a)))\nlet load_blocks_lemma_ij_subst #a #m b j i =\n let l = lanes a m in\n let i_new = i / l * l + j in\n let j_new = i % l in\n load_blocks_lemma_ij #a #m b j_new i_new;\n //assert (\n //(vec_v (load_blocks b).[i_new]).[j_new] ==\n //BSeq.uint_from_bytes_be (sub b.(|i_new % l|) ((i_new / l * l + j_new) * word_length a) (word_length a)));\n\n calc (==) {\n i_new % l;\n (==) { }\n (i / l * l + j) % l;\n (==) { Math.Lemmas.modulo_addition_lemma j l (i / l) }\n j % l;\n (==) { Math.Lemmas.small_mod j l }\n j;\n };\n\n calc (==) {\n i_new / l * l + j_new;\n (==) { }\n (i / l * l + j) / l * l + i % l;\n (==) { Math.Lemmas.division_addition_lemma j l (i / l) }\n (i / l + j / l) * l + i % l;\n (==) { Math.Lemmas.distributivity_add_left (i / l) (j / l) l }\n i / l * l + j / l * l + i % l;\n (==) { Math.Lemmas.euclidean_division_definition i l }\n i + j / l * l;\n (==) { Math.Lemmas.small_div j l }\n i;\n }", "val chacha20_core_lemma_i: #w:lanes -> c:counter{w * c <= max_size_t} -> st_v0:state w -> i:nat{i < w} ->\n Lemma ((transpose_state (chacha20_core c st_v0)).[i] `Seq.equal` Scalar.chacha20_core (w * c) (transpose_state st_v0).[i])\nlet chacha20_core_lemma_i #w c st_v0 i =\n let k0 = add_counter c st_v0 in\n add_counter_lemma_i st_v0 c i;\n let k1 = rounds k0 in\n rounds_lemma_i k0 i;\n let k2 = sum_state k1 st_v0 in\n sum_state_lemma_i k1 st_v0 i;\n let k3 = add_counter c k2 in\n add_counter_lemma_i k2 c i", "val wsi_pre_inner (a: sha2_alg) (i: nat{i >= block_word_length a /\\ i < size_k_w a}) (ws: k_w a)\n : k_w a\nlet wsi_pre_inner (a:sha2_alg) (i:nat{i >= block_word_length a /\\ i < size_k_w a}) (ws:k_w a) : k_w a =\n let t16 = ws.[i - 16] in\n let t15 = ws.[i - 15] in\n let t7 = ws.[i - 7] in\n let t2 = ws.[i - 2] in\n let s1 = _sigma1 a t2 in\n let s0 = _sigma0 a t15 in\n Seq.upd ws i (s1 +. t7 +. s0 +. t16)", "val load_blocks_lemma_ij:\n #a:sha2_alg\n -> #m:m_spec\n -> b:multiblock_spec a m\n -> j:nat{j < lanes a m}\n -> i:nat{i < 16} ->\n Lemma (let l = lanes a m in\n let ind = (i / l * l + j) * word_length a in\n (vec_v (load_blocks b).[i]).[j] ==\n BSeq.uint_from_bytes_be\n (Seq.slice b.(|i % l|) ind (ind + word_length a)))\nlet load_blocks_lemma_ij #a #m b j i =\n let l = lanes a m in\n let idx_i = i % l in\n let idx_j = i / l in\n\n let blocksize = word_length a in\n let blocksize_l = l * blocksize in\n let b_j = Seq.slice b.(|idx_i|) (idx_j * blocksize_l) (idx_j * blocksize_l + blocksize_l) in\n\n //assert ((load_blocks b).[i] == vec_from_bytes_be (word_t a) l b_j);\n assert (vec_v ((load_blocks b).[i]) == BSeq.uints_from_bytes_be b_j);\n BSeq.index_uints_from_bytes_be #(word_t a) #SEC #(lanes a m) b_j j;\n assert ((vec_v ((load_blocks b).[i])).[j] ==\n BSeq.uint_from_bytes_be (Seq.slice b_j (j * blocksize) (j * blocksize + blocksize)));\n\n calc (==) {\n idx_j * blocksize_l + j * blocksize;\n (==) { Math.Lemmas.paren_mul_right idx_j l blocksize;\n Math.Lemmas.distributivity_add_left (idx_j * l) j blocksize }\n (idx_j * l + j) * blocksize;\n };\n\n Seq.Properties.slice_slice b.(|idx_i|)\n (idx_j * blocksize_l) (idx_j * blocksize_l + blocksize_l)\n (j * blocksize) (j * blocksize + blocksize);\n\n assert ((vec_v ((load_blocks b).[i])).[j] ==\n BSeq.uint_from_bytes_be\n (Seq.slice b.(|idx_i|) ((idx_j * l + j) * blocksize)\n ((idx_j * l + j) * blocksize + blocksize)))", "val transpose_lemma_i: #w:lanes -> k:state w -> i:nat{i < w * blocksize} -> Lemma\n (Seq.index (vec_v (Seq.index (transpose k) (i / (w * 4)))) (i % (w * 4) / 4) ==\n Seq.index (Seq.index (transpose_state k) (i / blocksize)) (i % blocksize / 4))\nlet transpose_lemma_i #w k i =\n let bs = w * 4 in\n let j = i / bs in\n let ki = (transpose_state k).[i / blocksize] in\n calc (==) {\n Seq.index (vec_v (Seq.index (transpose k) j)) (i % bs / 4);\n (==) { Math.Lemmas.modulo_division_lemma i 4 w }\n Seq.index (vec_v (Seq.index (transpose k) j)) (i / 4 % w);\n (==) { Math.Lemmas.division_multiplication_lemma i 4 w }\n Seq.index (vec_v (Seq.index (transpose k) (i / 4 / w))) (i / 4 % w);\n (==) { Lemmas.transpose_lemma_index #w k (i / 4); Math.Lemmas.division_multiplication_lemma i 4 16 }\n Seq.index ki (i / 4 % 16);\n (==) { Math.Lemmas.modulo_division_lemma i 4 16 }\n Seq.index ki (i % blocksize / 4);\n }", "val lemma_sha256_step2 (src1 src2: quad32) (t: counter) (block: block_w)\n : Lemma\n (requires\n 16 <= t /\\ t < size_k_w (SHA2_256) - 3 /\\ src2.hi2 == ws_opaque block (t - 2) /\\\n src2.hi3 == ws_opaque block (t - 1) /\\\n (let w = sha256_msg1_spec_t (t - 16) block in\n let mid = ws_quad32 (t - 7) block in\n src1 == add_mod_quad32 w mid))\n (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block)\nlet lemma_sha256_step2 (src1 src2:quad32) (t:counter) (block:block_w) : Lemma\n (requires 16 <= t /\\ t < size_k_w(SHA2_256) - 3 /\\\n src2.hi2 == ws_opaque block (t-2) /\\\n src2.hi3 == ws_opaque block (t-1) /\\\n (let w = sha256_msg1_spec_t (t-16) block in\n let mid = ws_quad32 (t-7) block in\n src1 == add_mod_quad32 w mid))\n (ensures sha256_msg2_spec src1 src2 == ws_computed_quad32 t block)\n =\n sha256_msg2_spec_reveal ();\n let w = sha256_msg1_spec_t (t-16) block in\n let mid = ws_quad32 (t-7) block in\n let final = sha256_msg2_spec src1 src2 in\n lemma_ws_computed_is_ws_opaque block (t);\n lemma_ws_computed_is_ws_opaque block (t+1);\n ()", "val chacha20_core_scalar_lemma:\n w:lanes\n -> st1:Scalar.state\n -> st2:Scalar.state\n -> c0:counter\n -> c:counter{w * c <= max_size_t /\\ c0 + w <= max_size_t}\n -> i:nat{i < w} -> Lemma\n (requires\n (forall (j:nat). j < 16 /\\ j <> 12 ==> st1.[j] == st2.[j] /\\\n st1.[12] == u32 c0 /\\ st2.[12] == u32 (c0 + i)))\n (ensures\n Scalar.chacha20_core (w * c + i) st1 `Seq.equal` Scalar.chacha20_core (w * c) st2)\nlet chacha20_core_scalar_lemma w st1 st2 c0 c i =\n let k1 = Scalar.chacha20_add_counter st1 (w * c + i) in\n assert (k1.[12] == u32 c0 +. u32 (w * c + i));\n let k2 = Scalar.chacha20_add_counter st2 (w * c) in\n assert (k2.[12] == u32 (c0 + i) +. u32 (w * c));\n assert (v k1.[12] == v k2.[12]);\n eq_intro k1 k2;\n let k = Scalar.rounds k1 in\n let k1 = Scalar.sum_state k st1 in\n assert (k1.[12] == k.[12] +. u32 c0);\n let k2 = Scalar.sum_state k st2 in\n assert (k2.[12] == k.[12] +. u32 (c0 + i));\n assert (forall (j:nat). j < 16 /\\ j <> 12 ==> k1.[j] == k2.[j]);\n let k1 = Scalar.chacha20_add_counter k1 (w * c + i) in\n assert (k1.[12] == k.[12] +. u32 c0 +. u32 (w * c + i));\n let k2 = Scalar.chacha20_add_counter k2 (w * c) in\n assert (k2.[12] == k.[12] +. u32 (c0 + i) +. u32 (w * c));\n add_counter_lemma_aux w c0 c i k.[12];\n eq_intro k1 k2", "val chacha20_map_blocks_vec_equiv_pre_k1:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter{c0 + w <= max_size_t}\n -> hi_fv:size_nat{w * hi_fv + w <= max_size_t} // n == hi_fv == len / (w * blocksize)\n -> rem:nat{rem < w * blocksize}\n -> b_v:lseq uint8 rem\n -> j:nat{rem / blocksize * blocksize <= j /\\ j < rem} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let g_v = chacha20_encrypt_last st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n let g = Scalar.chacha20_encrypt_last st0 in\n VecLemmas.map_blocks_vec_equiv_pre_k w blocksize hi_fv f g g_v rem b_v j)\nlet chacha20_map_blocks_vec_equiv_pre_k1 #w k n c0 hi_fv rem b_v j =\n let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let f_v = chacha20_encrypt_block st_v0 in\n let g_v = chacha20_encrypt_last st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n let g = Scalar.chacha20_encrypt_last st0 in\n\n let blocksize_v = w * blocksize in\n let plain_v = create blocksize_v (u8 0) in\n let plain_v = update_sub plain_v 0 rem b_v in\n\n Math.Lemmas.cancel_mul_div w blocksize;\n let b = SeqLemmas.get_block_s #uint8 #blocksize_v blocksize plain_v j in\n let b1 = SeqLemmas.get_last_s #uint8 #rem blocksize b_v in\n\n let plain = create blocksize (u8 0) in\n let plain = update_sub plain 0 (rem % blocksize) b1 in\n\n calc (==) {\n Seq.index (g_v hi_fv rem b_v) j;\n (==) { encrypt_block_lemma_bs_i #w k n c0 hi_fv plain_v j; div_mul_lt blocksize j w }\n Seq.index (f (w * hi_fv + j / blocksize) b) (j % blocksize);\n (==) { update_sub_get_last_lemma w blocksize (u8 0) rem b_v j; mod_div_lt blocksize j rem }\n Seq.index (f (w * hi_fv + j / blocksize) plain) (j % blocksize);\n (==) { }\n Seq.index (g (w * hi_fv + j / blocksize) (rem % blocksize) b1) (j % blocksize);\n }", "val chacha20_map_blocks_multi_vec_equiv_pre_k:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter{c0 + w <= max_size_t}\n -> hi_fv:nat // n == hi_fv == len / (w * blocksize)\n -> hi_f:size_nat{w * hi_fv <= hi_f}\n -> i:nat{i < hi_fv}\n -> b_v:lseq uint8 (w * blocksize)\n -> j:nat{j < w * blocksize} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let f_v = chacha20_encrypt_block st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n VecLemmas.map_blocks_multi_vec_equiv_pre_k w blocksize hi_fv hi_f f f_v i b_v j)\nlet chacha20_map_blocks_multi_vec_equiv_pre_k #w k n c0 hi_fv hi_f i b_v j =\n encrypt_block_lemma_bs_i #w k n c0 i b_v j", "val chacha20_init_lemma_i: #w:lanes -> k:key -> n:nonce -> c0:counter{c0 + w <= max_size_t} -> i:nat{i < w} ->\n Lemma ((transpose_state (chacha20_init #w k n c0)).[i] `Seq.equal` Scalar.chacha20_init k n (c0 + i))\nlet chacha20_init_lemma_i #w k n c0 i =\n let st1 = setup1 k n c0 in\n assert (st1 == Scalar.chacha20_init k n c0);\n assert (st1.[12] == u32 c0);\n\n let st = map (vec_load_i w) st1 in\n eq_intro (transpose_state st).[i] st1;\n assert ((transpose_state st).[i] == st1);\n\n let c = vec_counter U32 w in\n assert ((vec_v c).[i] == u32 i);\n\n let res = st.[12] <- st.[12] +| c in\n let res1 = st1.[12] <- st1.[12] +. u32 i in\n eq_intro (transpose_state res).[i] res1;\n assert ((transpose_state res).[i] == res1);\n assert (res1.[12] == u32 c0 +. u32 i);\n assert (v (u32 c0 +. u32 i) == v (u32 (c0 + i)));\n assert (res1.[12] == u32 (c0 + i));\n\n let res2 = Scalar.chacha20_init k n (c0 + i) in\n chacha20_init_scalar_lemma k n c0;\n chacha20_init_scalar_lemma k n (c0 + i);\n eq_intro res1 res2", "val state_spec_v_lemma (a:sha2_alg) (st:Vec.state_spec a Vec.M32) : Lemma\n (Lib.IntVector.reveal_vec_1 (word_t a);\n st `Seq.equal` Lib.Sequence.index (Vec.state_spec_v st) 0)\nlet state_spec_v_lemma a st =\n let open Lib.Sequence in\n let open Lib.IntVector in\n reveal_vec_v_1 st.[0];\n reveal_vec_v_1 st.[1];\n reveal_vec_v_1 st.[2];\n reveal_vec_v_1 st.[3];\n reveal_vec_v_1 st.[4];\n reveal_vec_v_1 st.[5];\n reveal_vec_v_1 st.[6];\n reveal_vec_v_1 st.[7];\n reveal_vec_1 (word_t a);\n eq_intro #(word a) #8 (Vec.state_spec_v st).[0] st", "val chacha20_map_blocks_vec_equiv_pre_k:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter{c0 + w <= max_size_t}\n -> hi_fv:size_nat{w * hi_fv + w <= max_size_t} // n == hi_fv == len / (w * blocksize)\n -> rem:nat{rem < w * blocksize}\n -> b_v:lseq uint8 rem\n -> j:nat{j < rem} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let g_v = chacha20_encrypt_last st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n let g = Scalar.chacha20_encrypt_last st0 in\n VecLemmas.map_blocks_vec_equiv_pre_k w blocksize hi_fv f g g_v rem b_v j)\nlet chacha20_map_blocks_vec_equiv_pre_k #w k n c0 hi_fv rem b_v j =\n if j < rem / blocksize * blocksize then\n chacha20_map_blocks_vec_equiv_pre_k0 #w k n c0 hi_fv rem b_v j\n else\n chacha20_map_blocks_vec_equiv_pre_k1 #w k n c0 hi_fv rem b_v j", "val xor_block_lemma_i: #w:lanes -> k:state w -> b:blocks w -> i:nat{i < w * blocksize} -> Lemma\n (let k_i = (transpose_state k).[i / blocksize] in\n let b_i = sub b (i / blocksize * blocksize) blocksize in\n (xor_block (transpose k) b).[i] == (Scalar.xor_block k_i b_i).[i % blocksize])\nlet xor_block_lemma_i #w k b i =\n let bs = w * 4 in\n let j = i / bs in\n let ki = (transpose_state k).[i / blocksize] in\n\n let b_i = sub b (i / blocksize * blocksize) blocksize in\n let block = sub b (i / 4 * 4) 4 in\n\n calc (==) {\n Seq.index (xor_block (transpose k) b) i;\n (==) { xor_block_vec_lemma_i #w (transpose k) b i }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le block) ^. (Seq.index (vec_v (transpose k).[j]) (i % bs / 4)))) (i % 4);\n (==) { transpose_lemma_i #w k i }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le block) ^. (Seq.index ki (i % blocksize / 4)))) (i % 4);\n };\n\n calc (==) {\n Seq.index (Scalar.xor_block ki b_i) (i % blocksize);\n (==) { xor_block_scalar_lemma_i ki b_i (i % blocksize); Math.Lemmas.modulo_modulo_lemma i 4 16 }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le #U32 #SEC (sub b_i (i % blocksize / 4 * 4) 4)) ^. ki.[i % blocksize / 4])) (i % 4);\n (==) { lemma_i_div_blocksize w i; Seq.Properties.slice_slice b (i / blocksize * blocksize)\n (i / blocksize * blocksize + blocksize) (i % blocksize / 4 * 4) (i % blocksize / 4 * 4 + 4) }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le #U32 #SEC block) ^. (Seq.index ki (i % blocksize / 4)))) (i % 4);\n }", "val xor_block_vec_lemma_i: #w:lanes -> k:state w -> b:blocks w -> i:nat{i < w * blocksize} -> Lemma\n (let bs = w * 4 in\n let j = i / bs in\n let block = sub b (i / 4 * 4) 4 in\n Seq.index (xor_block k b) i ==\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le block) ^. (Seq.index (vec_v k.[j]) (i % bs / 4)))) (i % 4))\nlet xor_block_vec_lemma_i #w k b i =\n let bs = w * 4 in\n let j = i / bs in\n let kb_j = vec_v k.[j] in\n\n let b_j = sub b (i / bs * bs) bs in\n let b_i = sub b_j (i % bs / 4 * 4) 4 in\n let block = sub b (i / 4 * 4) 4 in\n\n let ob = map2 (^.) (uints_from_bytes_le b_j) kb_j in\n\n calc (==) {\n Seq.index (xor_block k b) i;\n (==) { index_map_blocks_multi (w * 4) 16 16 b (xor_block_f #w k) i }\n Seq.index (uints_to_bytes_le ob) (i % bs);\n (==) { index_uints_to_bytes_le ob (i % bs) }\n Seq.index (uint_to_bytes_le ob.[i % bs / 4]) (i % bs % 4);\n (==) { Math.Lemmas.modulo_modulo_lemma i 4 w }\n Seq.index (uint_to_bytes_le ob.[i % bs / 4]) (i % 4);\n (==) { (* def of xor *) }\n Seq.index (uint_to_bytes_le ((uints_from_bytes_le #U32 #SEC #w b_j).[i % bs / 4] ^. kb_j.[i % bs / 4])) (i % 4);\n (==) { index_uints_from_bytes_le #U32 #SEC #w b_j (i % bs / 4) }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le b_i) ^. kb_j.[i % bs / 4])) (i % 4);\n (==) { lemma_i_div_w4 w i; Seq.slice_slice b (j * bs) (j * bs + bs) (i % bs / 4 * 4) (i % bs / 4 * 4 + 4) }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le block) ^. kb_j.[i % bs / 4])) (i % 4);\n }", "val exp_mont_ladder_lemma_step:\n #t:Type -> k:comm_monoid t\n -> bBits:nat -> b:nat{b < pow2 bBits}\n -> a:t -> r0:t -> r1:t\n -> i:nat{i < bBits} -> Lemma\n (requires\n r1 == mul r0 a /\\ r0 == pow k a (b / pow2 (bBits - i)))\n (ensures\n (let (r0', r1') = exp_mont_ladder_f k bBits b i (r0, r1) in\n r1' == mul r0' a /\\ r0' == pow k a (b / pow2 (bBits - i - 1))))\nlet exp_mont_ladder_lemma_step #t k bBits b a r0 r1 i =\n let (r0', r1') = exp_mont_ladder_f k bBits b i (r0, r1) in\n lemma_b_div_pow2i bBits b (i + 1);\n assert (b / pow2 (bBits - i - 1) == b / pow2 (bBits - i) * 2 + b / pow2 (bBits - i - 1) % 2);\n lemma_pow_add k a (b / pow2 (bBits - i)) (b / pow2 (bBits - i));\n assert (mul r0 r0 == pow k a (b / pow2 (bBits - i) * 2));\n\n if (b / pow2 (bBits - i - 1) % 2 = 0) then begin\n assert (r0' == pow k a (b / pow2 (bBits - i - 1)));\n //assert (r1' == mul r1 r0);\n assert (r1' == mul (mul r0 a) r0);\n lemma_mul_comm r0 a;\n lemma_mul_assoc a r0 r0;\n assert (r1' == mul a r0');\n lemma_mul_comm a r0';\n () end\n else begin\n //assert (r0' == mul r0 r1);\n assert (r0' == mul r0 (mul r0 a));\n lemma_mul_assoc r0 r0 a;\n lemma_pow1 k a;\n lemma_pow_add k a (b / pow2 (bBits - i) * 2) 1;\n assert (r0' == pow k a (b / pow2 (bBits - i - 1)));\n //assert (r1' == mul r1 r1);\n assert (r1' == mul (mul r0 a) (mul r0 a));\n lemma_mul_comm r0 a;\n lemma_mul_assoc a r0 (mul r0 a);\n assert (r1' == mul a r0');\n lemma_mul_comm a r0';\n () end", "val ws_pre_inner (a: sha2_alg) (block: block_w a) (i: nat{i < size_k_w a}) (ws: k_w a) : k_w a\nlet ws_pre_inner (a:sha2_alg) (block:block_w a) (i:nat{i < size_k_w a}) (ws:k_w a) : k_w a =\n if i < block_word_length a then\n ws0_pre_inner a block i ws\n else\n wsi_pre_inner a i ws", "val bn_sub_lemma_loop_step:\n #t:limb_t\n -> #aLen:size_nat\n -> a:lbignum t aLen\n -> b:lbignum t aLen\n -> i:pos{i <= aLen}\n -> c1_res1:generate_elem_a (limb t) (carry t) aLen (i - 1) -> Lemma\n (requires\n (let (c1, res1) = c1_res1 in\n bn_v #t #(i - 1) res1 - v c1 * pow2 (bits t * (i - 1)) == eval_ aLen a (i - 1) - eval_ aLen b (i - 1)))\n (ensures\n (let (c, res) = generate_elem_f aLen (bn_sub_f a b) (i - 1) c1_res1 in\n bn_v #t #i res - v c * pow2 (bits t * i) == eval_ aLen a i - eval_ aLen b i))\nlet bn_sub_lemma_loop_step #t #aLen a b i (c1, res1) =\n let pbits = bits t in\n let (c, res) = generate_elem_f aLen (bn_sub_f a b) (i - 1) (c1, res1) in\n let c, e = bn_sub_f a b (i - 1) c1 in\n assert (v e - v c * pow2 pbits == v a.[i - 1] - v b.[i - 1] - v c1);\n\n calc (==) {\n bn_v #t #i res - v c * pow2 (pbits * i);\n (==) { bn_eval_snoc #t #(i - 1) res1 e }\n bn_v #t #(i - 1) res1 + v e * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { }\n eval_ aLen a (i - 1) - eval_ aLen b (i - 1) + (v a.[i - 1] - v b.[i - 1] + v c * pow2 pbits - v e) * pow2 (pbits * (i - 1)) + v e * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.distributivity_sub_left (v a.[i - 1] - v b.[i - 1] + v c * pow2 pbits) (v e) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) - eval_ aLen b (i - 1) + (v a.[i - 1] - v b.[i - 1] + v c * pow2 pbits) * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.distributivity_add_left (v a.[i - 1] - v b.[i - 1]) (v c * pow2 pbits) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) - eval_ aLen b (i - 1) + (v a.[i - 1] - v b.[i - 1]) * pow2 (pbits * (i - 1)) + v c * pow2 pbits * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.paren_mul_right (v c) (pow2 pbits) (pow2 (pbits * (i - 1))); Math.Lemmas.pow2_plus pbits (pbits * (i - 1)) }\n eval_ aLen a (i - 1) - eval_ aLen b (i - 1) + (v a.[i - 1] - v b.[i - 1]) * pow2 (pbits * (i - 1));\n (==) { Math.Lemmas.distributivity_sub_left (v a.[i - 1]) (v b.[i - 1]) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) - eval_ aLen b (i - 1) + v a.[i - 1] * pow2 (pbits * (i - 1)) - v b.[i - 1] * pow2 (pbits * (i - 1));\n (==) { bn_eval_unfold_i a i }\n eval_ aLen a i - eval_ aLen b (i - 1) - v b.[i - 1] * pow2 (pbits * (i - 1));\n (==) { bn_eval_unfold_i b i }\n eval_ aLen a i - eval_ aLen b i;\n };\n assert (bn_v #t #i res - v c * pow2 (pbits * i) == eval_ aLen a i - eval_ aLen b i)", "val lemma_shift_update_last:\n a:alg\n -> rem: nat\n -> b:block_s a\n -> d:bytes{length d + (size_block a) <= max_limb a /\\ rem <= length d /\\ rem <= size_block a}\n -> s:state a ->\n Lemma (\n blake2_update_last a 0 rem (b `Seq.append` d) s ==\n blake2_update_last a (size_block a) rem d s\n )\nlet lemma_shift_update_last a rem b d s =\n let m = b `Seq.append` d in\n assert (Seq.slice m (length m - rem) (length m) `Seq.equal` Seq.slice d (length d - rem) (length d));\n assert (get_last_padded_block a (b `Seq.append` d) rem == get_last_padded_block a d rem)", "val chacha20_map_blocks_vec_equiv_pre_k0:\n #w:lanes\n -> k:key\n -> n:nonce\n -> c0:counter{c0 + w <= max_size_t}\n -> hi_fv:size_nat{w * hi_fv + w <= max_size_t} // n == hi_fv == len / (w * blocksize)\n -> rem:nat{rem < w * blocksize}\n -> b_v:lseq uint8 rem\n -> j:nat{j < rem / blocksize * blocksize} ->\n Lemma\n (let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let g_v = chacha20_encrypt_last st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n let g = Scalar.chacha20_encrypt_last st0 in\n VecLemmas.map_blocks_vec_equiv_pre_k w blocksize hi_fv f g g_v rem b_v j)\nlet chacha20_map_blocks_vec_equiv_pre_k0 #w k n c0 hi_fv rem b_v j =\n let st_v0 = chacha20_init #w k n c0 in\n let st0 = Scalar.chacha20_init k n c0 in\n let g_v = chacha20_encrypt_last st_v0 in\n let f = Scalar.chacha20_encrypt_block st0 in\n let g = Scalar.chacha20_encrypt_last st0 in\n\n let blocksize_v = w * blocksize in\n let plain_v = create blocksize_v (u8 0) in\n let plain_v = update_sub plain_v 0 rem b_v in\n\n Math.Lemmas.cancel_mul_div w blocksize;\n let b = SeqLemmas.get_block_s #uint8 #blocksize_v blocksize plain_v j in\n let b1 = SeqLemmas.get_block_s #uint8 #rem blocksize b_v j in\n\n calc (==) {\n Seq.index (g_v hi_fv rem b_v) j;\n (==) { encrypt_block_lemma_bs_i #w k n c0 hi_fv plain_v j; div_mul_lt blocksize j w }\n Seq.index (f (w * hi_fv + j / blocksize) b) (j % blocksize);\n (==) { update_sub_get_block_lemma w blocksize (u8 0) rem b_v j }\n Seq.index (f (w * hi_fv + j / blocksize) b1) (j % blocksize);\n }", "val exp_four_fw_lemma_step:\n #t:Type -> k:comm_monoid t\n -> a1:t -> bBits:nat -> b1:nat{b1 < pow2 bBits}\n -> a2:t -> b2:nat{b2 < pow2 bBits}\n -> a3:t -> b3:nat{b3 < pow2 bBits}\n -> a4:t -> b4:nat{b4 < pow2 bBits}\n -> l:pos -> i:pos{i <= bBits / l} -> acc:t -> Lemma\n (requires\n acc ==\n k.mul\n (k.mul\n (k.mul\n (pow k a1 (b_acc l bBits b1 (i - 1)))\n (pow k a2 (b_acc l bBits b2 (i - 1))))\n (pow k a3 (b_acc l bBits b3 (i - 1))))\n (pow k a4 (b_acc l bBits b4 (i - 1))))\n (ensures\n exp_four_fw_f k a1 bBits b1 a2 b2 a3 b3 a4 b4 l (i - 1) acc ==\n k.mul\n (k.mul\n (k.mul\n (pow k a1 (b_acc l bBits b1 i))\n (pow k a2 (b_acc l bBits b2 i)))\n (pow k a3 (b_acc l bBits b3 i)))\n (pow k a4 (b_acc l bBits b4 i)))\nlet exp_four_fw_lemma_step #t k a1 bBits b1 a2 b2 a3 b3 a4 b4 l i acc =\n let acc1 = exp_pow2 k acc l in\n let r11 = b_acc l bBits b1 (i - 1) in\n let r12 = b_acc l bBits b1 i % pow2 l in\n let r21 = b_acc l bBits b2 (i - 1) in\n let r22 = b_acc l bBits b2 i % pow2 l in\n let r31 = b_acc l bBits b3 (i - 1) in\n let r32 = b_acc l bBits b3 i % pow2 l in\n let r41 = b_acc l bBits b4 (i - 1) in\n let r42 = b_acc l bBits b4 i % pow2 l in\n Math.Lemmas.distributivity_sub_right l i 1;\n\n let res_a1 = pow k a1 (b_acc l bBits b1 i) in\n let res_a2 = pow k a2 (b_acc l bBits b2 i) in\n let res_a3 = pow k a3 (b_acc l bBits b3 i) in\n let res_a4 = pow k a4 (b_acc l bBits b4 i) in\n\n let acc_1 = pow k a1 r11 in\n let acc_1_l = pow k acc_1 (pow2 l) in\n let acc_12 = k.mul acc_1 (pow k a2 r21) in\n let acc_12_l = pow k acc_12 (pow2 l) in\n let acc_123 = k.mul acc_12 (pow k a3 r31) in\n let acc_123_l = pow k acc_123 (pow2 l) in\n\n calc (==) {\n k.mul acc1 (pow k a4 r42);\n (==) { exp_pow2_lemma k acc l }\n k.mul (pow k acc (pow2 l)) (pow k a4 r42);\n (==) { }\n k.mul (pow k (k.mul acc_123 (pow k a4 r41)) (pow2 l)) (pow k a4 r42);\n (==) { lemma_pow_mul_base k acc_123 (pow k a4 r41) (pow2 l) }\n k.mul (k.mul acc_123_l (pow k (pow k a4 r41) (pow2 l))) (pow k a4 r42);\n (==) { lemma_pow_distr_mul k acc_123_l a4 r41 r42 (pow2 l) }\n k.mul (pow k a4 (r41 * pow2 l + r42)) acc_123_l;\n (==) { lemma_b_div_pow2ki bBits b4 l i }\n k.mul res_a4 acc_123_l;\n };\n\n calc (==) {\n k.mul (k.mul acc1 (pow k a4 r42)) (pow k a3 r32);\n (==) { }\n k.mul (k.mul res_a4 (pow k (k.mul acc_12 (pow k a3 r31)) (pow2 l))) (pow k a3 r32);\n (==) {k.lemma_mul_assoc res_a4 (pow k (k.mul acc_12 (pow k a3 r31)) (pow2 l)) (pow k a3 r32)}\n k.mul res_a4 (k.mul (pow k (k.mul acc_12 (pow k a3 r31)) (pow2 l)) (pow k a3 r32));\n (==) { lemma_pow_mul_base k acc_12 (pow k a3 r31) (pow2 l) }\n k.mul res_a4 (k.mul (k.mul acc_12_l (pow k (pow k a3 r31) (pow2 l))) (pow k a3 r32));\n (==) { lemma_pow_distr_mul k acc_12_l a3 r31 r32 (pow2 l) }\n k.mul res_a4 (k.mul (pow k a3 (r31 * pow2 l + r32)) acc_12_l);\n (==) { lemma_b_div_pow2ki bBits b3 l i }\n k.mul res_a4 (k.mul res_a3 acc_12_l);\n (==) { k.lemma_mul_assoc res_a4 res_a3 acc_12_l; k.lemma_mul_comm res_a4 res_a3 }\n k.mul (k.mul res_a3 res_a4) acc_12_l;\n };\n\n let res_a234 = k.mul (k.mul res_a2 res_a3) res_a4 in\n let res_a34 = k.mul res_a3 res_a4 in\n calc (==) {\n k.mul (k.mul (k.mul acc1 (pow k a4 r42)) (pow k a3 r32)) (pow k a2 r22);\n (==) { }\n k.mul (k.mul res_a34 (pow k (k.mul acc_1 (pow k a2 r21)) (pow2 l))) (pow k a2 r22);\n (==) { lemma_mul_assoc res_a34 (pow k (k.mul acc_1 (pow k a2 r21)) (pow2 l)) (pow k a2 r22) }\n k.mul res_a34 (k.mul (pow k (k.mul acc_1 (pow k a2 r21)) (pow2 l)) (pow k a2 r22));\n (==) { lemma_pow_mul_base k acc_1 (pow k a2 r21) (pow2 l) }\n k.mul res_a34 (k.mul (k.mul acc_1_l (pow k (pow k a2 r21) (pow2 l))) (pow k a2 r22));\n (==) { lemma_pow_distr_mul k acc_1_l a2 r21 r22 (pow2 l) }\n k.mul res_a34 (k.mul (pow k a2 (r21 * pow2 l + r22)) acc_1_l);\n (==) { lemma_b_div_pow2ki bBits b2 l i }\n k.mul res_a34 (k.mul res_a2 acc_1_l);\n (==) { k.lemma_mul_assoc res_a34 res_a2 acc_1_l; k.lemma_mul_comm res_a34 res_a2 }\n k.mul (k.mul res_a2 res_a34) acc_1_l;\n (==) { k.lemma_mul_assoc res_a2 res_a3 res_a4 }\n k.mul res_a234 acc_1_l;\n };\n\n calc (==) {\n k.mul (k.mul (k.mul (k.mul acc1 (pow k a4 r42)) (pow k a3 r32)) (pow k a2 r22)) (pow k a1 r12);\n (==) { }\n k.mul (k.mul res_a234 (pow k (pow k a1 r11) (pow2 l))) (pow k a1 r12);\n (==) { lemma_pow_distr_mul k res_a234 a1 r11 r12 (pow2 l) }\n k.mul (pow k a1 (r11 * pow2 l + r12)) res_a234;\n (==) { lemma_b_div_pow2ki bBits b1 l i }\n k.mul res_a1 (k.mul (k.mul res_a2 res_a3) res_a4);\n (==) { lemma_mul_assoc4 k res_a1 res_a2 res_a3 res_a4 }\n k.mul (k.mul (k.mul res_a1 res_a2) res_a3) res_a4;\n }", "val lemma_expand_key_128_i (key:aes_key_word AES_128) (i:nat) : Lemma\n (requires\n 0 < i /\\ i < 11\n )\n (ensures (\n let m = 4 * (i - 1) in\n let n = 4 * i in\n let v = expand_key AES_128 key n in\n let w = expand_key AES_128 key (n + 4) in\n let prev = Mkfour v.[m + 3] v.[m + 2] v.[m + 1] v.[m + 0] in\n round_key_128 prev i == Mkfour w.[n + 3] w.[n + 2] w.[n + 1] w.[n + 0]\n ))\nlet lemma_expand_key_128_i (key:aes_key_word AES_128) (i:nat) =\n expand_key_reveal ();\n let n = 4 * i in\n // unfold expand_key 4 times (could use fuel, but that unfolds everything):\n let _ = expand_key AES_128 key (n + 1) in\n let _ = expand_key AES_128 key (n + 2) in\n let _ = expand_key AES_128 key (n + 3) in\n ()", "val exp_lr_lemma_step:\n #t:Type -> k:comm_monoid t\n -> a:t -> bBits:nat -> b:nat{b < pow2 bBits}\n -> i:nat{i < bBits}\n -> acc1:t -> Lemma\n (requires acc1 == pow k a (b / pow2 (bBits - i)))\n (ensures exp_lr_f k a bBits b i acc1 == pow k a (b / pow2 (bBits - i - 1)))\nlet exp_lr_lemma_step #t k a bBits b i acc1 =\n let acc = exp_lr_f k a bBits b i acc1 in\n lemma_b_div_pow2i bBits b (i + 1);\n assert (b / pow2 (bBits - i - 1) == b / pow2 (bBits - i) * 2 + b / pow2 (bBits - i - 1) % 2);\n lemma_pow_add k a (b / pow2 (bBits - i)) (b / pow2 (bBits - i));\n assert (mul acc1 acc1 == pow k a (b / pow2 (bBits - i) * 2));\n\n if (b / pow2 (bBits - i - 1) % 2 = 0) then ()\n else begin\n assert (acc == mul (pow k a (b / pow2 (bBits - i) * 2)) a);\n lemma_pow1 k a;\n lemma_pow_add k a (b / pow2 (bBits - i) * 2) 1;\n () end", "val Vale.SHA.PPC64LE.SHA_helpers.shuffle_opaque = \n a: Spec.Hash.Definitions.sha2_alg ->\n hash: Spec.Hash.Definitions.words_state a ->\n block: Spec.SHA2.block_w a\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_opaque = shuffle", "val lemma_ws_opaque (block:block_w) (t:counter) : Lemma\n (requires 16 <= t && t < size_k_w_256)\n (ensures (let sigma0 = sigma256_0_0 (ws_opaque block (t - 15)) in\n let sigma1 = sigma256_0_1 (ws_opaque block (t - 2)) in\n ws_opaque block t == add_wrap (add_wrap (add_wrap sigma1 (ws_opaque block (t - 7))) sigma0) (ws_opaque block (t - 16))))\nlet lemma_ws_opaque (block:block_w) (t:counter) : Lemma\n (requires 16 <= t && t < size_k_w_256)\n (ensures (let sigma0 = sigma256_0_0 (ws_opaque block (t - 15)) in\n let sigma1 = sigma256_0_1 (ws_opaque block (t - 2)) in\n ws_opaque block t == add_wrap (add_wrap (add_wrap sigma1 (ws_opaque block (t - 7))) sigma0) (ws_opaque block (t - 16))))\n =\n let t16 = ws SHA2_256 block (t - 16) in\n let t15 = ws SHA2_256 block (t - 15) in\n let t7 = ws SHA2_256 block (t - 7) in\n let t2 = ws SHA2_256 block (t - 2) in\n let sigma0 = sigma256_0_0 (ws_opaque block (t - 15)) in\n let sigma1 = sigma256_0_1 (ws_opaque block (t - 2)) in\n let s1 = _sigma1 SHA2_256 t2 in\n let s0 = _sigma0 SHA2_256 t15 in\n calc (==) {\n ws_opaque block t;\n (==) { Pervasives.reveal_opaque (`%ws) ws }\n vv ((s1 +. t7 +. s0) +. t16);\n (==) { lemma_add_wrap_is_add_mod (vv (s1 +. t7 +. s0)) (ws_opaque block (t-16)) }\n add_wrap (vv ((s1 +. t7) +. s0)) (ws_opaque block (t-16));\n (==) { lemma_add_wrap_is_add_mod (vv (s1 +. t7)) sigma0 }\n add_wrap (add_wrap (vv (s1 +. t7)) sigma0) (ws_opaque block (t-16));\n (==) { lemma_add_wrap_is_add_mod sigma1 (ws_opaque block (t-7)) }\n add_wrap (add_wrap (add_wrap sigma1 (ws_opaque block (t - 7))) sigma0) (ws_opaque block (t - 16));\n\n }", "val lemma_sha256_rnds2 (abef cdgh xmm0:quad32) (t:counter) (block:block_w) (hash_in:hash256) : Lemma\n (requires t + 1 < size_k_w_256 /\\\n xmm0.lo0 == add_wrap (word_to_nat32 k.[t]) (ws_opaque block t) /\\\n xmm0.lo1 == add_wrap (word_to_nat32 k.[t+1]) (ws_opaque block (t+1)) /\\\n make_hash abef cdgh == Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_in\n )\n (ensures make_hash (sha256_rnds2_spec cdgh abef xmm0) abef ==\n Spec.Loops.repeat_range 0 (t+2) (shuffle_core_opaque block) hash_in)\nlet lemma_sha256_rnds2 (abef cdgh xmm0:quad32) (t:counter) (block:block_w) (hash_in:hash256) : Lemma\n (requires t + 1 < size_k_w_256 /\\\n xmm0.lo0 == add_wrap (word_to_nat32 k.[t]) (ws_opaque block t) /\\\n xmm0.lo1 == add_wrap (word_to_nat32 k.[t+1]) (ws_opaque block (t+1)) /\\\n make_hash abef cdgh == Spec.Loops.repeat_range 0 t (shuffle_core_opaque block) hash_in\n )\n (ensures make_hash (sha256_rnds2_spec cdgh abef xmm0) abef ==\n Spec.Loops.repeat_range 0 (t+2) (shuffle_core_opaque block) hash_in)\n =\n lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t] ) (ws_opaque block t);\n lemma_add_wrap_is_add_mod (vv (k0 SHA2_256).[t+1]) (ws_opaque block (t+1));\n lemma_sha256_rnds2_two_steps abef cdgh xmm0 t block;\n Spec.Loops.repeat_range_induction 0 (t + 1) (shuffle_core_opaque block) hash_in;\n Spec.Loops.repeat_range_induction 0 (t + 2) (shuffle_core_opaque block) hash_in;\n ()", "val exp_mont_ladder_swap_lemma_loop: #t:Type -> k:concrete_ops t\n -> a:t -> bBits:nat -> b:nat{b < pow2 bBits} -> i:nat{i <= bBits} ->\n Lemma (let one = k.one () in\n let (r0s, r1s, sws) =\n Loops.repeati i (S.exp_mont_ladder_swap_f k.to.comm_monoid bBits b) (k.to.refl one, k.to.refl a, 0) in\n let (r0, r1, sw) =\n Loops.repeati i (exp_mont_ladder_swap_f k bBits b) (one, a, 0) in\n k.to.refl r0 == r0s /\\ k.to.refl r1 == r1s /\\ sw == sws)\nlet rec exp_mont_ladder_swap_lemma_loop #t k a bBits b i =\n let one = k.one () in\n let inp0 = (k.to.refl one, k.to.refl a, 0) in\n let inp1 = (one, a, 0) in\n let f0 = S.exp_mont_ladder_swap_f k.to.comm_monoid bBits b in\n let f1 = exp_mont_ladder_swap_f k bBits b in\n\n if i = 0 then begin\n Loops.eq_repeati0 bBits f0 inp0;\n Loops.eq_repeati0 bBits f1 inp1 end\n else begin\n exp_mont_ladder_swap_lemma_loop #t k a bBits b (i - 1);\n Loops.unfold_repeati bBits f0 inp0 (i - 1);\n Loops.unfold_repeati bBits f1 inp1 (i - 1) end", "val lemma_rnds_quad32\n (abef cdgh: quad32)\n (wk: UInt32.t)\n (block: block_w)\n (t: counter{t < size_k_w_256})\n : Lemma (requires wk == to_uint32 (add_mod32 (k0 SHA2_256).[ t ] (ws_opaque block t)))\n (ensures\n sha256_rnds2_spec_update_core_quad32 abef cdgh wk block t ==\n sha256_rnds2_spec_update_quad32 abef cdgh wk)\nlet lemma_rnds_quad32 (abef cdgh:quad32) (wk:UInt32.t) (block:block_w) (t:counter{t < size_k_w_256}) : Lemma\n (requires wk == to_uint32 (add_mod32 (k0 SHA2_256).[t] (ws_opaque block t)))\n (ensures sha256_rnds2_spec_update_core_quad32 abef cdgh wk block t == sha256_rnds2_spec_update_quad32 abef cdgh wk)\n =\n let hash0 = make_hash abef cdgh in\n let hash1 = shuffle_core_opaque block hash0 t in\n let a', b', c', d', e', f', g', h' =\n sha256_rnds2_spec_update hash0.[0] hash0.[1] hash0.[2] hash0.[3]\n hash0.[4] hash0.[5] hash0.[6] hash0.[7] wk in\n let l = [a'; b'; c'; d'; e'; f'; g'; h'] in\n elim_of_list l;\n lemma_sha256_rnds2_spec_update_is_shuffle_core hash0 wk t block;\n ()", "val exp_mont_ladder_swap_lemma_loop:\n #t:Type -> k:comm_monoid t\n -> a:t -> bBits:nat -> b:nat{b < pow2 bBits}\n -> sw0:nat{sw0 == b / pow2 bBits % 2}\n -> i:nat{i <= bBits} ->\n Lemma\n (let (r0, r1, sw) = Loops.repeati i (exp_mont_ladder_swap_f k bBits b) (one, a, sw0) in\n let (r3, r4) = Loops.repeati i (exp_mont_ladder_f k bBits b) (cswap sw0 one a) in\n let bit = b / pow2 (bBits - i) % 2 in\n sw == bit /\\ cswap bit r0 r1 == (r3, r4))\nlet rec exp_mont_ladder_swap_lemma_loop #t k a bBits b sw0 i =\n if i = 0 then begin\n Loops.eq_repeati0 i (exp_mont_ladder_swap_f k bBits b) (one, a, sw0);\n Loops.eq_repeati0 i (exp_mont_ladder_f k bBits b) (cswap sw0 one a);\n () end\n else begin\n Loops.unfold_repeati i (exp_mont_ladder_swap_f k bBits b) (one, a, sw0) (i - 1);\n Loops.unfold_repeati i (exp_mont_ladder_f k bBits b) (cswap sw0 one a) (i - 1);\n exp_mont_ladder_swap_lemma_loop k a bBits b sw0 (i - 1);\n () end", "val va_lemma_Loop_rounds_16_51_body : va_b0:va_code -> va_s0:va_state -> i:nat -> k_b:buffer128 ->\n block:block_w -> hash_orig:hash256\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_body i) va_s0 /\\ va_get_ok va_s0 /\\\n (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0 va_s0)\n (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\\ l_and (4 <= i) (i < 13) /\\\n Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0 va_s0) k_b)\n /\\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==\n Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` i) block hash_orig /\\ l_and (l_and\n (l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block)\n (va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4\n `op_Multiply` (i + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1) + 1)\n block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))\n block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i - 1))\n block))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==\n Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\\ va_get_xmm\n 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\\ va_get_xmm 5 va_sM\n == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))\n block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\\ va_get_xmm 6 va_sM ==\n Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\\ va_get_xmm 3 va_sM ==\n Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\\ va_state_eq va_sM (va_update_flags\n va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4\n va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0\n va_sM (va_update_ok va_sM va_s0))))))))))))\nlet va_lemma_Loop_rounds_16_51_body va_b0 va_s0 i k_b block hash_orig =\n let (va_mods:va_mods_t) = [va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;\n va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok] in\n let va_qc = va_qcode_Loop_rounds_16_51_body va_mods i k_b block hash_orig in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_51_body i) va_qc va_s0\n (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 219 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_ok va_sM) /\\ (label va_range1\n \"***** POSTCONDITION NOT MET AT line 251 column 78 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==\n Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 253 column 42 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 4 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block) /\\ label\n va_range1\n \"***** POSTCONDITION NOT MET AT line 254 column 87 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 5 va_sM == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4\n `op_Multiply` (i + 2)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block))\n /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 255 column 43 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 6 va_sM == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block) /\\\n label va_range1\n \"***** POSTCONDITION NOT MET AT line 256 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.X64.vaf *****\"\n (va_get_xmm 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_flags; va_Mod_xmm 7; va_Mod_xmm 6; va_Mod_xmm 5; va_Mod_xmm 4;\n va_Mod_xmm 3; va_Mod_xmm 2; va_Mod_xmm 1; va_Mod_xmm 0; va_Mod_ok]) va_sM va_s0;\n (va_sM, va_fM)", "val update_sub_get_block_lemma_k:\n #a:Type\n -> w:size_pos\n -> blocksize:size_pos{w * blocksize <= max_size_t}\n -> zero:a\n -> len:nat{len < w * blocksize}\n -> b_v:lseq a len\n -> j:nat{j < len / blocksize * blocksize}\n -> k:nat{k < blocksize} ->\n Lemma\n (let blocksize_v = w * blocksize in\n let plain_v = create blocksize_v zero in\n let plain_v = update_sub plain_v 0 len b_v in\n div_mul_lt blocksize j w;\n Math.Lemmas.cancel_mul_div w blocksize;\n\n Seq.index (SeqLemmas.get_block_s #a #blocksize_v blocksize plain_v j) k ==\n Seq.index (SeqLemmas.get_block_s #a #len blocksize b_v j) k)\nlet update_sub_get_block_lemma_k #a w blocksize zero len b_v j k =\n let blocksize_v = w * blocksize in\n let plain = create blocksize_v zero in\n let plain = update_sub plain 0 len b_v in\n let zeros = create (blocksize_v - len) zero in\n update_sub_is_append #a zero blocksize_v len b_v;\n assert (plain == Seq.append b_v zeros);\n\n div_mul_lt blocksize j w;\n Math.Lemmas.cancel_mul_div w blocksize;\n //assert (j / blocksize < w);\n //assert (j < blocksize_v / blocksize * blocksize);\n let b_p = SeqLemmas.get_block_s #a #blocksize_v blocksize plain j in\n let b = SeqLemmas.get_block_s #a #len blocksize b_v j in\n\n calc (<=) {\n (j / blocksize + 1) * blocksize;\n (<=) { div_mul_lt blocksize j (len / blocksize) }\n len / blocksize * blocksize;\n (<=) { Math.Lemmas.multiply_fractions len blocksize }\n len;\n };\n\n calc (==) {\n Seq.index b_p k;\n (==) { }\n Seq.index (Seq.slice plain (j / blocksize * blocksize) (j / blocksize * blocksize + blocksize)) k;\n (==) { Seq.lemma_index_slice plain (j / blocksize * blocksize) (j / blocksize * blocksize + blocksize) k }\n Seq.index plain (j / blocksize * blocksize + k);\n (==) { Seq.lemma_index_app1 b_v zeros (j / blocksize * blocksize + k) }\n Seq.index b_v (j / blocksize * blocksize + k);\n };\n\n Seq.lemma_index_slice b_v (j / blocksize * blocksize) (j / blocksize * blocksize + blocksize) k", "val Vale.SHA.SHA_helpers.shuffle_opaque = \n a: Spec.Hash.Definitions.sha2_alg ->\n hash: Spec.Hash.Definitions.words_state a ->\n block: Spec.SHA2.block_w a\n -> Spec.Hash.Definitions.words_state a\nlet shuffle_opaque = shuffle", "val num_rounds16 (a: sha2_alg) : n: pos{16 * n == size_k_w a}\nlet num_rounds16 (a:sha2_alg) : n:pos{16 * n == size_k_w a} =\n match a with\n | SHA2_224 | SHA2_256 -> 4\n | SHA2_384 | SHA2_512 -> 5", "val lemma_expand_key_128_i (key:aes_key_LE AES_128) (i:nat) : Lemma\n (requires\n 0 < i /\\ i < 11\n )\n (ensures (\n let m = 4 * (i - 1) in\n let n = 4 * i in\n let v = expand_key AES_128 key n in\n let w = expand_key AES_128 key (n + 4) in\n let prev = Mkfour v.[m + 0] v.[m + 1] v.[m + 2] v.[m + 3] in\n round_key_128 prev i == Mkfour w.[n + 0] w.[n + 1] w.[n + 2] w.[n + 3]\n ))\nlet lemma_expand_key_128_i (key:aes_key_LE AES_128) (i:nat) =\n expand_key_reveal ();\n let n = 4 * i in\n // unfold expand_key 4 times (could use fuel, but that unfolds everything):\n let _ = expand_key AES_128 key (n + 1) in\n let _ = expand_key AES_128 key (n + 2) in\n let _ = expand_key AES_128 key (n + 3) in\n ()", "val load_ws_lemma_l:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> b:multiblock_spec a m\n -> j:nat{j < lanes a m} ->\n Lemma ((ws_spec_v (load_ws b)).[j] == BSeq.uints_from_bytes_be #(word_t a) #SEC #(block_word_length a) b.(|j|))\nlet load_ws_lemma_l #a #m b j =\n let lp = Seq.index (ws_spec_v (load_ws b)) j in\n let rp = BSeq.uints_from_bytes_be #(word_t a) #SEC #16 b.(|j|) in\n\n let aux (i:nat{i < 16}) : Lemma (Seq.index lp i == Seq.index rp i) =\n let l = lanes a m in\n BSeq.index_uints_from_bytes_be #(word_t a) #SEC #16 b.(|j|) i;\n assert (Seq.index rp i == BSeq.uint_from_bytes_be\n (Seq.slice b.(|j|) (i * word_length a) (i * word_length a + word_length a)));\n\n assert (Seq.index lp i == Seq.index (Seq.index (ws_spec_v (transpose_ws (load_blocks b))) j) i);\n Lemmas.transpose_ws_lemma_ij (load_blocks b) j i;\n load_blocks_lemma_ij_subst #a #m b j i in\n\n Classical.forall_intro aux;\n eq_intro lp rp", "val bn_add_lemma_loop_step:\n #t:limb_t\n -> #aLen:size_nat\n -> a:lbignum t aLen\n -> b:lbignum t aLen\n -> i:pos{i <= aLen}\n -> c1_res1:generate_elem_a (limb t) (carry t) aLen (i - 1) -> Lemma\n (requires\n (let (c1, res1) = c1_res1 in\n v c1 * pow2 (bits t * (i - 1)) + bn_v #t #(i - 1) res1 == eval_ aLen a (i - 1) + eval_ aLen b (i - 1)))\n (ensures\n (let (c1, res1) = c1_res1 in\n let (c, res) = generate_elem_f aLen (bn_add_f a b) (i - 1) (c1, res1) in\n v c * pow2 (bits t * i) + bn_v #t #i res == eval_ aLen a i + eval_ aLen b i))\nlet bn_add_lemma_loop_step #t #aLen a b i (c1, res1) =\n let pbits = bits t in\n let (c, res) = generate_elem_f aLen (bn_add_f a b) (i - 1) (c1, res1) in\n let c, e = bn_add_f a b (i - 1) c1 in\n assert (v e + v c * pow2 pbits == v a.[i - 1] + v b.[i - 1] + v c1);\n\n calc (==) {\n v c * pow2 (pbits * i) + bn_v #t #i res;\n (==) { bn_eval_snoc #t #(i - 1) res1 e }\n v c * pow2 (pbits * i) + bn_v #t #(i - 1) res1 + v e * pow2 (pbits * (i - 1));\n (==) { }\n v c * pow2 (pbits * i) + eval_ aLen a (i - 1) + eval_ aLen b (i - 1) - (v e + v c * pow2 pbits - v a.[i - 1] - v b.[i - 1]) * pow2 (pbits * (i - 1)) + v e * pow2 (pbits * (i - 1));\n (==) { Math.Lemmas.distributivity_sub_left (v e) (v e + v c * pow2 pbits - v a.[i - 1] - v b.[i - 1]) (pow2 (pbits * (i - 1))) }\n v c * pow2 (pbits * i) + eval_ aLen a (i - 1) + eval_ aLen b (i - 1) + (v e - v e - v c * pow2 pbits + v a.[i - 1] + v b.[i - 1]) * pow2 (pbits * (i - 1));\n (==) { Math.Lemmas.distributivity_sub_left (v a.[i - 1] + v b.[i - 1]) (v c1 * pow2 pbits) (pow2 (pbits * (i - 1))) }\n v c * pow2 (pbits * i) + eval_ aLen a (i - 1) + eval_ aLen b (i - 1) + (v a.[i - 1] + v b.[i - 1]) * pow2 (pbits * (i - 1)) - v c * pow2 pbits * pow2 (pbits * (i - 1));\n (==) { Math.Lemmas.paren_mul_right (v c) (pow2 pbits) (pow2 (pbits * (i - 1))); Math.Lemmas.pow2_plus pbits (pbits * (i - 1)) }\n eval_ aLen a (i - 1) + eval_ aLen b (i - 1) + (v a.[i - 1] + v b.[i - 1]) * pow2 (pbits * (i - 1));\n (==) { Math.Lemmas.distributivity_add_left (v a.[i - 1]) (v b.[i - 1]) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) + eval_ aLen b (i - 1) + v a.[i - 1] * pow2 (pbits * (i - 1)) + v b.[i - 1] * pow2 (pbits * (i - 1));\n (==) { bn_eval_unfold_i #t #aLen a i }\n eval_ aLen a i + eval_ aLen b (i - 1) + v b.[i - 1] * pow2 (pbits * (i - 1));\n (==) { bn_eval_unfold_i #t #aLen b i }\n eval_ aLen a i + eval_ aLen b i;\n };\n assert (v c * pow2 (pbits * i) + bn_v #t #i res == eval_ aLen a i + eval_ aLen b i)", "val update_nblocks_loop_lemma:\n #a:sha2_alg\n -> #m:m_spec{is_supported a m}\n -> len:Spec.len_lt_max_a_t a\n -> b:multiseq (lanes a m) len\n -> st:state_spec a m\n -> l:nat{l < lanes a m}\n -> n:nat{n <= len / block_length a } ->\n Lemma\n ((state_spec_v (repeati n (update_block #a #m len b) st)).[l] ==\n repeati n (Spec.update_block a len b.(|l|)) ((state_spec_v st).[l]))\nlet rec update_nblocks_loop_lemma #a #m len b st l n =\n let lp = repeati n (update_block #a #m len b) st in\n let f_sc = Spec.update_block a len b.(|l|) in\n let rp = repeati n f_sc (state_spec_v st).[l] in\n\n if n = 0 then begin\n eq_repeati0 n (update_block #a #m len b) st;\n eq_repeati0 n f_sc (state_spec_v st).[l] end\n else begin\n let lp1 = repeati (n - 1) (update_block #a #m len b) st in\n let rp1 = repeati (n - 1) f_sc (state_spec_v st).[l] in\n update_nblocks_loop_lemma #a #m len b st l (n - 1);\n assert ((state_spec_v lp1).[l] == rp1);\n unfold_repeati n (update_block #a #m len b) st (n - 1);\n unfold_repeati n f_sc (state_spec_v st).[l] (n - 1);\n update_block_lemma_l #a #m len b (n - 1) lp1 l end", "val lemma_modulo_shift_byte (a: nat) (i: pos)\n : Lemma\n (let open FStar.Mul in (pow2 8 * a) % (pow2 (8 * i)) = pow2 8 * (a % pow2 (8 * (i - 1))))\nlet lemma_modulo_shift_byte (a:nat) (i:pos) : Lemma\n (let open FStar.Mul in\n (pow2 8 * a) % (pow2 (8*i)) = pow2 8 * (a % pow2 (8*(i-1)))) =\n let sub = 8 `op_Multiply` (i-1) in\n FStar.Math.Lemmas.pow2_plus 8 sub;\n lemma_propagate_pow_mod a (pow2 sub) 8", "val Spec.SHA2.Lemmas.ws = \n a: Spec.Hash.Definitions.sha2_alg ->\n b: Spec.SHA2.block_w a ->\n t: Spec.SHA2.counter{t < Spec.SHA2.size_k_w a}\n -> Spec.Hash.Definitions.word a\nlet ws = ws_aux", "val exp_fw_lemma_step:\n #t:Type -> k:comm_monoid t\n -> a:t -> bBits:nat -> b:nat{b < pow2 bBits}\n -> l:pos -> i:pos{i <= bBits / l} -> acc1:t -> Lemma\n (requires acc1 == pow k a (b_acc l bBits b (i - 1)))\n (ensures exp_fw_f k a bBits b l (i - 1) acc1 == pow k a (b_acc l bBits b i))\nlet exp_fw_lemma_step #t k a bBits b l i acc1 =\n let acc = exp_fw_f k a bBits b l (i - 1) acc1 in\n exp_pow2_lemma k acc1 l;\n\n let r1 = b_acc l bBits b (i - 1) in\n let r2 = b_acc l bBits b i % pow2 l in\n Math.Lemmas.distributivity_sub_right l i 1;\n assert (acc == k.mul (pow k acc1 (pow2 l)) (pow k a r2));\n\n calc (==) {\n k.mul (pow k acc1 (pow2 l)) (pow k a r2);\n (==) { }\n k.mul (pow k (pow k a r1) (pow2 l)) (pow k a r2);\n (==) { lemma_pow_mul k a r1 (pow2 l) }\n k.mul (pow k a (r1 * pow2 l)) (pow k a r2);\n (==) { lemma_pow_add k a (r1 * pow2 l) r2 }\n pow k a (r1 * pow2 l + r2);\n (==) { lemma_b_div_pow2ki bBits b l i }\n pow k a (b_acc l bBits b i);\n }", "val lemma_blocki_aux1 (a: blake_alg) (s1 s2: bytes) (i: nat{i < S.length s1 / block_length a})\n : Lemma\n (Spec.Blake2.get_blocki (to_blake_alg a) s1 i ==\n Spec.Blake2.get_blocki (to_blake_alg a) (S.append s1 s2) i)\nlet lemma_blocki_aux1 (a:blake_alg) (s1 s2:bytes) (i:nat{i < S.length s1 / block_length a})\n : Lemma (Spec.Blake2.get_blocki (to_blake_alg a) s1 i == Spec.Blake2.get_blocki (to_blake_alg a) (S.append s1 s2) i)\n = assert (Spec.Blake2.get_blocki (to_blake_alg a) s1 i `S.equal` Spec.Blake2.get_blocki (to_blake_alg a) (S.append s1 s2) i)", "val va_lemma_Loop_rounds_16_51_recursive : va_b0:va_code -> va_s0:va_state -> i:nat ->\n k_b:buffer128 -> block:block_w -> hash_orig:hash256\n -> Ghost (va_state & va_fuel)(decreases %[va_b0;va_s0;i;k_b;block;hash_orig])\n (requires (va_require_total va_b0 (va_code_Loop_rounds_16_51_recursive i) va_s0 /\\ va_get_ok\n va_s0 /\\ (sha_enabled /\\ sse_enabled /\\ Vale.X64.Decls.validSrcAddrs128 (va_get_mem_heaplet 0\n va_s0) (va_get_reg64 rRcx va_s0) k_b 16 (va_get_mem_layout va_s0) Secret /\\ l_and (4 <= i) (i <\n 13) /\\ Vale.SHA.SHA_helpers.k_reqs (Vale.X64.Decls.buffer128_as_seq (va_get_mem_heaplet 0\n va_s0) k_b) /\\ Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_s0) (va_get_xmm 2 va_s0) ==\n Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` 4) block hash_orig /\\ l_and (l_and\n (l_and (va_get_xmm 3 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` 4) block)\n (va_get_xmm 4 va_s0 == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4\n `op_Multiply` (4 + 1)) block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1) + 1)\n block))) (va_get_xmm 5 va_s0 == Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (4 + 2))\n block)) (va_get_xmm 6 va_s0 == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (4 - 1))\n block))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (Vale.SHA.SHA_helpers.make_hash (va_get_xmm 1 va_sM) (va_get_xmm 2 va_sM) ==\n Vale.SHA.SHA_helpers.repeat_range_vale (4 `op_Multiply` (i + 1)) block hash_orig /\\ va_get_xmm\n 3 va_sM == Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` (i + 1)) block /\\ va_get_xmm 4 va_sM\n == Vale.Arch.Types.add_wrap_quad32 (Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 2))\n block) (Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i + 1) block) /\\ va_get_xmm 5 va_sM ==\n Vale.SHA.SHA_helpers.ws_partial (4 `op_Multiply` (i + 3)) block /\\ va_get_xmm 6 va_sM ==\n Vale.SHA.SHA_helpers.ws_quad32 (4 `op_Multiply` i) block) /\\ va_state_eq va_sM (va_update_flags\n va_sM (va_update_xmm 7 va_sM (va_update_xmm 6 va_sM (va_update_xmm 5 va_sM (va_update_xmm 4\n va_sM (va_update_xmm 3 va_sM (va_update_xmm 2 va_sM (va_update_xmm 1 va_sM (va_update_xmm 0\n va_sM (va_update_ok va_sM va_s0))))))))))))\nlet rec va_lemma_Loop_rounds_16_51_recursive va_b0 va_s0 i k_b block hash_orig =\n va_reveal_opaque (`%va_code_Loop_rounds_16_51_recursive) (va_code_Loop_rounds_16_51_recursive i);\n let (va_old_s:va_state) = va_s0 in\n let (va_b1:va_codes) = va_get_block va_b0 in\n let va_b11 = va_tl va_b1 in\n let va_c11 = va_hd va_b1 in\n let (va_fc11, va_s11) =\n (\n if (i > 4) then\n (\n let va_b12 = va_get_block va_c11 in\n let (va_s13, va_fc13) = va_lemma_Loop_rounds_16_51_recursive (va_hd va_b12) va_s0 (i - 1) k_b\n block hash_orig in\n let va_b13 = va_tl va_b12 in\n let (va_s11, va_f13) = va_lemma_empty_total va_s13 va_b13 in\n let va_fc11 = va_lemma_merge_total va_b12 va_s0 va_fc13 va_s13 va_f13 va_s11 in\n (va_fc11, va_s11)\n )\n else\n (\n let va_b14 = va_get_block va_c11 in\n let (va_s11, va_fc11) = va_lemma_empty_total va_s0 va_b14 in\n (va_fc11, va_s11)\n )\n ) in\n let (va_s15, va_fc15) = va_lemma_Loop_rounds_16_51_body (va_hd va_b11) va_s11 i k_b block\n hash_orig in\n let va_b15 = va_tl va_b11 in\n let (va_s16, va_fc16) = va_lemma_Msg_shift (va_hd va_b15) va_s15 in\n let va_b16 = va_tl va_b15 in\n let (va_sM, va_f16) = va_lemma_empty_total va_s16 va_b16 in\n let va_f15 = va_lemma_merge_total va_b15 va_s15 va_fc16 va_s16 va_f16 va_sM in\n let va_f11 = va_lemma_merge_total va_b11 va_s11 va_fc15 va_s15 va_f15 va_sM in\n let va_fM = va_lemma_merge_total va_b1 va_s0 va_fc11 va_s11 va_f11 va_sM in\n (va_sM, va_fM)", "val update_384_512: st:words_state SHA2_512 ->\n block:bytes{Seq.length block = block_length SHA2_512} ->\n Lemma\n (ensures (Spec.Agile.Hash.(update SHA2_512 st block == update SHA2_384 st block)))\nlet update_384_512 hash block =\n assert_norm (words_state SHA2_384 == words_state SHA2_512);\n let rec ws_384_512 (b: block_w SHA2_512) (t:counter{t < size_k_w SHA2_512}):\n Lemma\n (ensures (ws SHA2_384 b t == ws SHA2_512 b t))\n [ SMTPat (ws SHA2_512 b t) ]\n =\n reveal_opaque (`%ws) ws;\n assert_norm (block_w SHA2_512 == block_w SHA2_384);\n assert_norm (size_k_w SHA2_512 == size_k_w SHA2_384);\n\n (*\n * The code earlier was doing assert_norm (_sigma0 SHA2_512 == _sigma0 SHA2_384)\n *\n * This is a bit suboptimal, since assert_norm is a heavy hammer,\n * it also ends up unfolding `==`, which means the equality is not\n * reduced in F*, rather the query for proving equality of two\n * lambda terms reaches Z3 -- once that happens we are at the mercy of\n * hashconsing etc. to prove the equality\n *\n * Instead, if we do controlled normalization, we can prove the equality\n * within F*\n *)\n\n let steps = [iota; primops; simplify; delta_only [\n `%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;\n `%__proj__Mkops__item__e5; `%op384_512; `%__proj__Mkops__item__e3;\n `%__proj__Mkops__item__e4;\n `%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;\n `%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in\n\n assert (norm steps (_sigma0 SHA2_512) == norm steps (_sigma0 SHA2_384));\n assert (norm steps (_sigma1 SHA2_512) == norm steps (_sigma1 SHA2_384));\n\n norm_spec steps (_sigma0 SHA2_512);\n norm_spec steps (_sigma0 SHA2_384);\n norm_spec steps (_sigma1 SHA2_512);\n norm_spec steps (_sigma1 SHA2_384);\n\n // assert_norm (word_add_mod SHA2_512 == word_add_mod SHA2_384);\n if t < block_word_length SHA2_512 then\n ()\n else begin\n ws_384_512 b (t - 16);\n ws_384_512 b (t - 15);\n ws_384_512 b (t - 7);\n ws_384_512 b (t - 2)\n end\n in\n let shuffle_core_384_512 (block:block_w SHA2_512) (hash:words_state SHA2_512) (t:counter{t < size_k_w SHA2_512}):\n Lemma (ensures (shuffle_core SHA2_384 block hash t == shuffle_core SHA2_512 block hash t))\n [ SMTPat (shuffle_core SHA2_512 block hash t) ]\n =\n reveal_opaque (`%shuffle_core) shuffle_core\n in\n let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):\n Lemma\n (requires (forall x (i: nat { i < max }). {:pattern f x i \\/ g x i } f x i == g x i))\n (ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))\n (decreases (max - min))\n [ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]\n =\n if min = max then\n ()\n else\n repeat_range_f (min + 1) max f g (f x min)\n in\n let shuffle_384_512 (hash:words_state SHA2_512) (block:block_w SHA2_512):\n Lemma (ensures (shuffle SHA2_384 hash block == shuffle SHA2_512 hash block))\n [ SMTPat (shuffle SHA2_512 hash block) ]\n =\n shuffle_is_shuffle_pre SHA2_384 hash block;\n shuffle_is_shuffle_pre SHA2_512 hash block;\n reveal_opaque (`%shuffle) shuffle;\n assert_norm (words_state SHA2_384 == words_state SHA2_512)\n in\n let rec seq_map2_f\n (#a:Type) (#b:Type) (#c:Type)\n (f g:(a -> b -> Tot c))\n (s:S.seq a) (s':S.seq b{S.length s = S.length s'}):\n Lemma\n (requires (forall x y. {:pattern f x y \\/ g x y} f x y == g x y))\n (ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))\n (decreases (S.length s))\n [ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]\n =\n if S.length s = 0 then\n ()\n else\n seq_map2_f f g (S.tail s) (S.tail s')\n in\n assert_norm (words_of_bytes SHA2_512 #(block_word_length SHA2_512) == words_of_bytes SHA2_384 #(block_word_length SHA2_384));\n reveal_opaque (`%shuffle) shuffle;\n reveal_opaque (`%update) update", "val set_wsi: #a:sha2_alg -> #m:m_spec\n -> ws:ws_t a m\n -> i:size_t{v i < 16}\n -> b:lbuffer uint8 (HD.block_len a)\n -> bi:size_t{v bi < 16 / (lanes a m)} ->\n Stack unit\n (requires fun h -> live h b /\\ live h ws /\\ disjoint b ws)\n (ensures fun h0 _ h1 -> modifies (loc ws) h0 h1 /\\\n as_seq h1 ws == LSeq.upd (as_seq h0 ws) (v i) (SpecVec.load_elementi #a #m (as_seq h0 b) (v bi)))\nlet set_wsi #a #m ws i b bi =\n [@inline_let]\n let l = lanes a m in\n ws.(i) <- vec_load_be (word_t a) l (sub b (bi *! size l *! HD.word_len a) (size l *! HD.word_len a))", "val bn_mul1_lemma_loop_step:\n #t:limb_t\n -> #aLen:size_nat\n -> a:lbignum t aLen\n -> l:limb t\n -> i:pos{i <= aLen}\n -> c1_res1:generate_elem_a (limb t) (limb t) aLen (i - 1) -> Lemma\n (requires\n (let (c1, res1) = c1_res1 in\n v c1 * pow2 (bits t * (i - 1)) + bn_v #t #(i - 1) res1 == eval_ aLen a (i - 1) * v l))\n (ensures\n (let (c1, res1) = c1_res1 in\n let (c, res) = generate_elem_f aLen (bn_mul1_f a l) (i - 1) (c1, res1) in\n v c * pow2 (bits t * i) + bn_v #t #i res == eval_ aLen a i * v l))\nlet bn_mul1_lemma_loop_step #t #aLen a l i (c1, res1) =\n let pbits = bits t in\n let b1 = pow2 (pbits * (i - 1)) in\n let b2 = pow2 (pbits * i) in\n\n let (c, res) = generate_elem_f aLen (bn_mul1_f a l) (i - 1) (c1, res1) in\n let c, e = mul_wide_add a.[i - 1] l c1 in\n assert (v e + v c * pow2 pbits == v a.[i - 1] * v l + v c1);\n\n calc (==) {\n v c * b2 + bn_v #t #i res;\n (==) { bn_eval_snoc #t #(i - 1) res1 e }\n v c * b2 + bn_v #t #(i - 1) res1 + v e * b1;\n (==) { }\n v c * b2 + eval_ aLen a (i - 1) * v l -(v e + v c * pow2 pbits - v a.[i - 1] * v l) * b1 + v e * b1;\n (==) { Math.Lemmas.distributivity_add_left (v e) (v c * pow2 pbits - v a.[i - 1] * v l) b1 }\n v c * b2 + eval_ aLen a (i - 1) * v l - (v c * pow2 pbits - v a.[i - 1] * v l) * b1;\n (==) { Math.Lemmas.distributivity_sub_left (v c * pow2 pbits) (v a.[i - 1] * v l) b1 }\n v c * b2 + eval_ aLen a (i - 1) * v l - v c * pow2 pbits * b1 + v a.[i - 1] * v l * b1;\n (==) { Math.Lemmas.paren_mul_right (v c) (pow2 pbits) b1; Math.Lemmas.pow2_plus pbits (pbits * (i - 1)) }\n eval_ aLen a (i - 1) * v l + v a.[i - 1] * v l * b1;\n (==) { Math.Lemmas.paren_mul_right (v a.[i - 1]) (v l) b1 }\n eval_ aLen a (i - 1) * v l + v a.[i - 1] * (b1 * v l);\n (==) { Math.Lemmas.paren_mul_right (v a.[i - 1]) b1 (v l) }\n eval_ aLen a (i - 1) * v l + v a.[i - 1] * b1 * v l;\n (==) { Math.Lemmas.distributivity_add_left (eval_ aLen a (i - 1)) (v a.[i - 1] * b1) (v l) }\n (eval_ aLen a (i - 1) + v a.[i - 1] * b1) * v l;\n (==) { bn_eval_unfold_i a i }\n eval_ aLen a i * v l;\n };\n assert (v c * b2 + bn_v #t #i res == eval_ aLen a i * v l)", "val bn_sub_carry_lemma_loop_step:\n #t:limb_t\n -> #aLen:size_nat\n -> a:lbignum t aLen\n -> c_in:carry t\n -> i:pos{i <= aLen}\n -> c1_res1:generate_elem_a (limb t) (carry t) aLen (i - 1) -> Lemma\n (requires\n (let (c1, res1) = c1_res1 in\n bn_v #t #(i - 1) res1 - v c1 * pow2 (bits t * (i - 1)) == eval_ aLen a (i - 1) - v c_in))\n (ensures\n (let (c_out, res) = generate_elem_f aLen (bn_sub_carry_f a) (i - 1) c1_res1 in\n bn_v #t #i res - v c_out * pow2 (bits t * i) == eval_ aLen a i - v c_in))\nlet bn_sub_carry_lemma_loop_step #t #aLen a c_in i (c1, res1) =\n let pbits = bits t in\n let (c_out, res) = generate_elem_f aLen (bn_sub_carry_f a) (i - 1) (c1, res1) in\n let c, e = bn_sub_carry_f a (i - 1) c1 in\n assert (v e - v c * pow2 pbits == v a.[i - 1] - v c1);\n\n calc (==) {\n bn_v #t #i res - v c * pow2 (pbits * i);\n (==) { bn_eval_snoc #t #(i - 1) res1 e }\n bn_v #t #(i - 1) res1 + v e * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { }\n eval_ aLen a (i - 1) - v c_in + (v a.[i - 1] - v e + v c * pow2 pbits) * pow2 (pbits * (i - 1)) + v e * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.distributivity_sub_left (v a.[i - 1] + v c * pow2 pbits) (v e) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) - v c_in + (v a.[i - 1] + v c * pow2 pbits) * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.distributivity_add_left (v a.[i - 1]) (v c * pow2 pbits) (pow2 (pbits * (i - 1))) }\n eval_ aLen a (i - 1) - v c_in + v a.[i - 1] * pow2 (pbits * (i - 1)) + v c * pow2 pbits * pow2 (pbits * (i - 1)) - v c * pow2 (pbits * i);\n (==) { Math.Lemmas.paren_mul_right (v c) (pow2 pbits) (pow2 (pbits * (i - 1))); Math.Lemmas.pow2_plus pbits (pbits * (i - 1)) }\n eval_ aLen a (i - 1) - v c_in + v a.[i - 1] * pow2 (pbits * (i - 1));\n (==) { bn_eval_unfold_i a i }\n eval_ aLen a i - v c_in;\n };\n assert (bn_v #t #i res - v c * pow2 (pbits * i) == eval_ aLen a i - v c_in)", "val va_lemma_Loop_rounds_16_63_body : va_b0:va_code -> va_s0:va_state -> i:nat ->\n msg0:va_operand_vec_opr -> msg1:va_operand_vec_opr -> msg2:va_operand_vec_opr ->\n msg3:va_operand_vec_opr -> block:block_w\n -> Ghost (va_state & va_fuel)\n (requires (va_require_total va_b0 (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2 msg3) va_s0 /\\\n va_is_dst_vec_opr msg0 va_s0 /\\ va_is_src_vec_opr msg1 va_s0 /\\ va_is_src_vec_opr msg2 va_s0 /\\\n va_is_src_vec_opr msg3 va_s0 /\\ va_get_ok va_s0 /\\ (l_and (16 <= i) (i < 64) /\\ (let j = i\n `op_Modulus` 16 in msg0 == j /\\ msg1 == (j + 1) `op_Modulus` 16 /\\ msg2 == (j + 9) `op_Modulus`\n 16 /\\ msg3 == (j + 14) `op_Modulus` 16 /\\ (va_eval_vec_opr va_s0 msg0).hi3 == ws_opaque block\n (i - 16) /\\ (va_eval_vec_opr va_s0 msg1).hi3 == ws_opaque block (i - 15) /\\ (va_eval_vec_opr\n va_s0 msg2).hi3 == ws_opaque block (i - 7) /\\ (va_eval_vec_opr va_s0 msg3).hi3 == ws_opaque\n block (i - 2)))))\n (ensures (fun (va_sM, va_fM) -> va_ensure_total va_b0 va_s0 va_sM va_fM /\\ va_get_ok va_sM /\\\n (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in let sigma1 = sigma256_0_1 (ws_opaque\n block (i - 2)) in (va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32\n (ws_opaque block (i - 16)) sigma0) sigma1) (ws_opaque block (i - 7)) /\\ (va_eval_vec_opr va_sM\n msg0).hi3 == ws_opaque block i) /\\ va_state_eq va_sM (va_update_vec 26 va_sM (va_update_vec 25\n va_sM (va_update_ok va_sM (va_update_operand_vec_opr msg0 va_sM va_s0))))))\nlet va_lemma_Loop_rounds_16_63_body va_b0 va_s0 i msg0 msg1 msg2 msg3 block =\n let (va_mods:va_mods_t) = [va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0] in\n let va_qc = va_qcode_Loop_rounds_16_63_body va_mods i msg0 msg1 msg2 msg3 block in\n let (va_sM, va_fM, va_g) = va_wp_sound_code_norm (va_code_Loop_rounds_16_63_body i msg0 msg1 msg2\n msg3) va_qc va_s0 (fun va_s0 va_sM va_g -> let () = va_g in label va_range1\n \"***** POSTCONDITION NOT MET AT line 114 column 1 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n (va_get_ok va_sM) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 140 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n (let sigma0 = sigma256_0_0 (ws_opaque block (i - 15)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 141 column 9 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n (let sigma1 = sigma256_0_1 (ws_opaque block (i - 2)) in label va_range1\n \"***** POSTCONDITION NOT MET AT line 142 column 118 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n ((va_eval_vec_opr va_sM msg0).hi3 == add_wrap32 (add_wrap32 (add_wrap32 (ws_opaque block (i -\n 16)) sigma0) sigma1) (ws_opaque block (i - 7))) /\\ label va_range1\n \"***** POSTCONDITION NOT MET AT line 143 column 40 of file /home/gebner/fstar_dataset/projects/hacl-star/vale/code/thirdPartyPorts/OpenSSL/sha/Vale.SHA.PPC64LE.Rounds.Core.vaf *****\"\n ((va_eval_vec_opr va_sM msg0).hi3 == ws_opaque block i)))) in\n assert_norm (va_qc.mods == va_mods);\n va_lemma_norm_mods ([va_Mod_vec 26; va_Mod_vec 25; va_Mod_ok; va_mod_vec_opr msg0]) va_sM va_s0;\n (va_sM, va_fM)", "val update_224_256: st:words_state SHA2_256 ->\n block:bytes{Seq.length block = block_length SHA2_256} ->\n Lemma\n (ensures (Spec.Agile.Hash.(update SHA2_256 st block == update SHA2_224 st block)))\nlet update_224_256 hash block =\n assert_norm (words_state SHA2_224 == words_state SHA2_256);\n let rec ws_224_256 (b: block_w SHA2_256) (t:counter{t < size_k_w SHA2_256}):\n Lemma\n (ensures (ws SHA2_224 b t == ws SHA2_256 b t))\n [ SMTPat (ws SHA2_256 b t) ]\n =\n reveal_opaque (`%ws) ws;\n assert_norm (block_w SHA2_256 == block_w SHA2_224);\n assert_norm (size_k_w SHA2_256 == size_k_w SHA2_224);\n\n (*\n * The code earlier was doing assert_norm (_sigma0 SHA2_256 == _sigma0 SHA2_224)\n *\n * This is a bit suboptimal, since assert_norm is a heavy hammer,\n * it also ends up unfolding `==`, which means the equality is not\n * reduced in F*, rather the query for proving equality of two\n * lambda terms reaches Z3 -- once that happens we are at the mercy of\n * hashconsing etc. to prove the equality\n *\n * Instead, if we do controlled normalization, we can prove the equality\n * within F*\n *)\n\n let steps = [iota; primops; simplify; delta_only [\n `%_sigma0; `%_sigma1; `%op0; `%word; `%word_t;\n `%__proj__Mkops__item__e5; `%op224_256; `%__proj__Mkops__item__e3;\n `%__proj__Mkops__item__e4;\n `%Spec.SHA2.op_Hat_Dot; `%Spec.SHA2.op_Greater_Greater_Dot;\n `%Spec.SHA2.op_Greater_Greater_Greater_Dot ]] in\n\n assert (norm steps (_sigma0 SHA2_256) == norm steps (_sigma0 SHA2_224));\n assert (norm steps (_sigma1 SHA2_256) == norm steps (_sigma1 SHA2_224));\n\n norm_spec steps (_sigma0 SHA2_256);\n norm_spec steps (_sigma0 SHA2_224);\n norm_spec steps (_sigma1 SHA2_256);\n norm_spec steps (_sigma1 SHA2_224);\n\n // assert_norm (word_add_mod SHA2_256 == word_add_mod SHA2_224);\n if t < block_word_length SHA2_256 then\n ()\n else begin\n ws_224_256 b (t - 16);\n ws_224_256 b (t - 15);\n ws_224_256 b (t - 7);\n ws_224_256 b (t - 2)\n end\n in\n let shuffle_core_224_256 (block:block_w SHA2_256) (hash:words_state SHA2_256) (t:counter{t < size_k_w SHA2_256}):\n Lemma (ensures (shuffle_core SHA2_224 block hash t == shuffle_core SHA2_256 block hash t))\n [ SMTPat (shuffle_core SHA2_256 block hash t) ]\n =\n reveal_opaque (`%shuffle_core) shuffle_core\n in\n let rec repeat_range_f (#a:Type) (min:nat) (max:nat{min <= max}) (f g:(a -> i:nat{i < max} -> Tot a)) (x: a):\n Lemma\n (requires (forall x (i: nat { i < max }). {:pattern f x i \\/ g x i } f x i == g x i))\n (ensures (Spec.Loops.repeat_range min max f x == Spec.Loops.repeat_range min max g x))\n (decreases (max - min))\n [ SMTPat (Spec.Loops.repeat_range min max f x); SMTPat (Spec.Loops.repeat_range min max g x) ]\n =\n if min = max then\n ()\n else\n repeat_range_f (min + 1) max f g (f x min)\n in\n let shuffle_224_256 (hash:words_state SHA2_256) (block:block_w SHA2_256):\n Lemma (ensures (shuffle SHA2_224 hash block == shuffle SHA2_256 hash block))\n [ SMTPat (shuffle SHA2_256 hash block) ]\n =\n shuffle_is_shuffle_pre SHA2_224 hash block;\n shuffle_is_shuffle_pre SHA2_256 hash block;\n reveal_opaque (`%shuffle) shuffle;\n assert_norm (words_state SHA2_224 == words_state SHA2_256)\n in\n let rec seq_map2_f\n (#a:Type) (#b:Type) (#c:Type)\n (f g:(a -> b -> Tot c))\n (s:S.seq a) (s':S.seq b{S.length s = S.length s'}):\n Lemma\n (requires (forall x y. {:pattern f x y \\/ g x y} f x y == g x y))\n (ensures (Spec.Loops.(seq_map2 f s s' == seq_map2 g s s')))\n (decreases (S.length s))\n [ SMTPat (Spec.Loops.seq_map2 f s s'); SMTPat (Spec.Loops.seq_map2 g s s') ]\n =\n if S.length s = 0 then\n ()\n else\n seq_map2_f f g (S.tail s) (S.tail s')\n in\n assert_norm (words_of_bytes SHA2_256 #(block_word_length SHA2_256) == words_of_bytes SHA2_224 #(block_word_length SHA2_224));\n reveal_opaque (`%shuffle) shuffle;\n reveal_opaque (`%update) update", "val update_sub_get_last_lemma:\n #a:Type\n -> w:size_pos\n -> blocksize:size_pos{w * blocksize <= max_size_t}\n -> zero:a\n -> len:nat{len < w * blocksize}\n -> b_v:lseq a len\n -> j:nat{len / blocksize * blocksize <= j /\\ j < len} ->\n Lemma\n (let blocksize_v = w * blocksize in\n let plain_v = create blocksize_v zero in\n let plain_v = update_sub plain_v 0 len b_v in\n div_mul_lt blocksize j w;\n Math.Lemmas.cancel_mul_div w blocksize;\n\n let block_l = SeqLemmas.get_last_s #a #len blocksize b_v in\n let plain = create blocksize zero in\n let plain = update_sub plain 0 (len % blocksize) block_l in\n\n SeqLemmas.get_block_s #a #blocksize_v blocksize plain_v j == plain)\nlet update_sub_get_last_lemma #a w blocksize zero len b_v j =\n let blocksize_v = w * blocksize in\n let plain_v = create blocksize_v zero in\n let plain_v = update_sub plain_v 0 len b_v in\n div_mul_lt blocksize j w;\n Math.Lemmas.cancel_mul_div w blocksize;\n\n let block_l = SeqLemmas.get_last_s #a #len blocksize b_v in\n let plain = create blocksize zero in\n let plain = update_sub plain 0 (len % blocksize) block_l in\n let b = SeqLemmas.get_block_s #a #blocksize_v blocksize plain_v j in\n\n let aux (k:nat{k < blocksize}) : Lemma (Seq.index b k == Seq.index plain k) =\n update_sub_get_last_lemma_plain_k #a w blocksize zero len b_v j k;\n update_sub_get_last_lemma_plain_v_k #a w blocksize zero len b_v j k in\n\n Classical.forall_intro aux;\n eq_intro b plain", "val xor_block_scalar_lemma_i: k:Scalar.state -> b:Scalar.block -> i:nat{i < blocksize} -> Lemma\n ((Scalar.xor_block k b).[i] == (uint_to_bytes_le ((uint_from_bytes_le (sub b (i / 4 * 4) 4)) ^. k.[i / 4])).[i % 4])\nlet xor_block_scalar_lemma_i k b i =\n let ib = uints_from_bytes_le b in\n let ob = map2 (^.) ib k in\n let b_i = sub b (i / 4 * 4) 4 in\n\n calc (==) {\n Seq.index (uints_to_bytes_le ob) i;\n (==) { index_uints_to_bytes_le ob i }\n Seq.index (uint_to_bytes_le ob.[i / 4]) (i % 4);\n (==) { (* def of xor *) }\n Seq.index (uint_to_bytes_le (ib.[i / 4] ^. k.[i / 4])) (i % 4);\n (==) { index_uints_from_bytes_le #U32 #SEC #16 b (i / 4) }\n Seq.index (uint_to_bytes_le ((uint_from_bytes_le b_i) ^. k.[i / 4])) (i % 4);\n }" ], "closest_src": [ { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_inner_loop_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_inner_loop_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.shuffle_inner_loop" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_inner_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.shuffle_inner" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_loop_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.shuffle_inner_loop" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.shuffle_inner" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_lemma_l" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.shuffle_is_shuffle_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_core_spec_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.shuffle" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.shuffle_pre" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.shuffle_core" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_core_pre_create8_lemma" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.shuffle_core_" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_rnds2_spec_quad32_is_shuffle_core_x2" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Generic.fst", "name": "Hacl.Impl.SHA2.Generic.shuffle_core" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.shuffle_aux" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.sha256_rnds2_spec_quad32_is_shuffle_core_x2" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Generic.fst", "name": "Hacl.Impl.SHA2.Generic.shuffle" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.shuffle_core_pre_" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.encrypt_block_lemma_st0_i" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_properties" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.shuffle_core_properties" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.shuffle_core_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_state8_lemma" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.lemma_shuffle_core_properties" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.shuffle" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_state_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_ws8_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.shuffle_core_pre" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.encrypt_block_lemma_bs_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_ws4_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_state4_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.shuffle" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.ws_next_inner_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.encrypt_block_scalar_lemma_i" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.ws0_pre_inner" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.ws_next_lemma_loop" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.shuffle_core_pre_create8" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Alternative.fst", "name": "Spec.Blake2.Alternative.lemma_update1_shift" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_sha256_rnds2_two_steps" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Lemmas.fst", "name": "Hacl.Spec.SHA2.Lemmas.transpose_ws_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.update_block_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.update_block" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.shuffle_core_opaque_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Vec.fst", "name": "Hacl.Spec.SHA2.Vec.shuffle_core_spec" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.Rounds.Core.fst", "name": "Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_1_15_shift_body" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.shuffle_core_opaque_aux" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.store_state_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.load_blocks_lemma_ij_subst" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_core_lemma_i" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.wsi_pre_inner" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.load_blocks_lemma_ij" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.transpose_lemma_i" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_sha256_step2" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_core_scalar_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_map_blocks_vec_equiv_pre_k1" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_map_blocks_multi_vec_equiv_pre_k" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_init_lemma_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Hash.SHA2.fst", "name": "Hacl.Hash.SHA2.state_spec_v_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_map_blocks_vec_equiv_pre_k" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.xor_block_lemma_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.xor_block_vec_lemma_i" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_mont_ladder_lemma_step" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.fst", "name": "Spec.SHA2.ws_pre_inner" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Addition.fst", "name": "Hacl.Spec.Bignum.Addition.bn_sub_lemma_loop_step" }, { "project_name": "hacl-star", "file_name": "Spec.Blake2.Alternative.fst", "name": "Spec.Blake2.Alternative.lemma_shift_update_last" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.chacha20_map_blocks_vec_equiv_pre_k0" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_four_fw_lemma_step" }, { "project_name": "hacl-star", "file_name": "Vale.AES.AES_helpers_BE.fst", "name": "Vale.AES.AES_helpers_BE.lemma_expand_key_128_i" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_lr_lemma_step" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.shuffle_opaque" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.SHA_helpers.fst", "name": "Vale.SHA.PPC64LE.SHA_helpers.lemma_ws_opaque" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_sha256_rnds2" }, { "project_name": "hacl-star", "file_name": "Spec.Exponentiation.fst", "name": "Spec.Exponentiation.exp_mont_ladder_swap_lemma_loop" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.lemma_rnds_quad32" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_mont_ladder_swap_lemma_loop" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Loop_rounds_16_51_body" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.update_sub_get_block_lemma_k" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.SHA_helpers.fst", "name": "Vale.SHA.SHA_helpers.shuffle_opaque" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.fst", "name": "Hacl.Spec.SHA2.num_rounds16" }, { "project_name": "hacl-star", "file_name": "Vale.AES.AES_helpers.fst", "name": "Vale.AES.AES_helpers.lemma_expand_key_128_i" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.load_ws_lemma_l" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Addition.fst", "name": "Hacl.Spec.Bignum.Addition.bn_add_lemma_loop_step" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.SHA2.Equiv.fst", "name": "Hacl.Spec.SHA2.Equiv.update_nblocks_loop_lemma" }, { "project_name": "everquic-crypto", "file_name": "QUIC.Spec.Lemmas.fst", "name": "QUIC.Spec.Lemmas.lemma_modulo_shift_byte" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.ws" }, { "project_name": "hacl-star", "file_name": "Lib.Exponentiation.fst", "name": "Lib.Exponentiation.exp_fw_lemma_step" }, { "project_name": "hacl-star", "file_name": "Spec.Hash.Lemmas.fst", "name": "Spec.Hash.Lemmas.lemma_blocki_aux1" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.X64.fst", "name": "Vale.SHA.X64.va_lemma_Loop_rounds_16_51_recursive" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_384_512" }, { "project_name": "hacl-star", "file_name": "Hacl.Impl.SHA2.Core.fst", "name": "Hacl.Impl.SHA2.Core.set_wsi" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Multiplication.fst", "name": "Hacl.Spec.Bignum.Multiplication.bn_mul1_lemma_loop_step" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Bignum.Addition.fst", "name": "Hacl.Spec.Bignum.Addition.bn_sub_carry_lemma_loop_step" }, { "project_name": "hacl-star", "file_name": "Vale.SHA.PPC64LE.Rounds.Core.fst", "name": "Vale.SHA.PPC64LE.Rounds.Core.va_lemma_Loop_rounds_16_63_body" }, { "project_name": "hacl-star", "file_name": "Spec.SHA2.Lemmas.fst", "name": "Spec.SHA2.Lemmas.update_224_256" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.update_sub_get_last_lemma" }, { "project_name": "hacl-star", "file_name": "Hacl.Spec.Chacha20.Equiv.fst", "name": "Hacl.Spec.Chacha20.Equiv.xor_block_scalar_lemma_i" } ], "selected_premises": [ "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_j", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma", "Hacl.Spec.SHA2.EquivScalar.ws_next_inner_lemma", "FStar.Mul.op_Star", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_aux", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_init", "Lib.Sequence.op_String_Access", "Hacl.Spec.SHA2.EquivScalar.ws_next_lemma_k", "Lib.Sequence.slice", "Hacl.Spec.SHA2.EquivScalar.ws_next_pre_lemma_j_step", "Lib.Sequence.to_seq", "Lib.Sequence.lseq", "Spec.SHA2._sigma1", "Hacl.Spec.SHA2._sigma1", "Lib.Sequence.op_String_Assignment", "Hacl.Spec.SHA2._Sigma1", "Spec.SHA2._Sigma1", "Lib.IntTypes.int_t", "Spec.Hash.MD.max_input_size_len", "Lib.IntTypes.uint_t", "Lib.Sequence.length", "FStar.Pervasives.reveal_opaque", "Spec.Loops.repeat_range_induction", "Hacl.Spec.SHA2.EquivScalar.ws_pre_inductive", "Spec.SHA2.ws_pre_", "Hacl.Spec.SHA2.EquivScalar.ws_pre_lemma", "Lib.IntTypes.op_Plus_Bang", "Lib.IntTypes.op_Star_Bang", "FStar.UInt.size", "Hacl.Spec.SHA2.EquivScalar.ws_next_inductive", "Lib.IntTypes.range", "Lib.IntTypes.bits", "Lib.IntTypes.op_Plus_Dot", "Hacl.Spec.SHA2.EquivScalar.shuffle_core_pre_lemma", "Hacl.Spec.SHA2.ws_next_inner", "Hacl.Spec.SHA2._sigma0", "Spec.SHA2._sigma0", "Lib.UpdateMulti.Lemmas.repeat_f", "Spec.SHA2.k0", "Hacl.Spec.SHA2.k0", "Hacl.Spec.SHA2._Sigma0", "Spec.SHA2._Sigma0", "Hacl.Spec.SHA2.EquivScalar.ws_pre_lemma_k", "Hacl.Spec.SHA2.ws_next", "Hacl.Spec.SHA2.EquivScalar.shuffle_spec_lemma16", "Hacl.Spec.SHA2.EquivScalar.ws_next_lemma", "Hacl.Spec.SHA2.num_rounds16", "Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner_num_rounds", "Spec.Hash.Definitions.words_state", "Lib.IntTypes.u64", "Lib.IntTypes.op_Subtraction_Dot", "Spec.Agile.Hash.update_multi", "Lib.IntTypes.op_Star_Dot", "Spec.SHA2.Constants.k384_512", "Spec.Loops.repeat_induction", "FStar.Math.Lemmas.pow2_plus", "Spec.SHA2.counter", "Lib.Sequence.seq", "Lib.UpdateMulti.Lemmas.repeat_l", "Hacl.Spec.SHA2.EquivScalar.shuffle_pre_inner16", "Hacl.Spec.SHA2.op0", "Spec.SHA2.op0", "Hacl.Spec.SHA2.EquivScalar.shuffle_spec_lemma", "Lib.IntTypes.uint", "Lib.IntTypes.size", "Hacl.Spec.SHA2.EquivScalar.shuffle_spec_lemma16_step", "Lib.IntTypes.uint_v", "Spec.Hash.Definitions.hash_length", "Spec.Hash.Definitions.word_t", "Lib.IntTypes.numbytes", "Spec.SHA2._Ch", "Hacl.Spec.SHA2._Ch", "Spec.SHA2.op_Greater_Greater_Greater_Dot", "Hacl.Spec.SHA2.op_Greater_Greater_Greater_Dot", "Lib.IntTypes.v", "Spec.Hash.Definitions.word", "Lib.IntTypes.op_Amp_Dot", "Spec.SHA2.wsi_pre_inner", "Spec.SHA2.k_w", "Spec.SHA2.size_k_w", "Hacl.Spec.SHA2.size_k_w", "Spec.Hash.Definitions.rate", "Spec.Hash.Definitions.len_length", "Spec.SHA3.get", "Spec.SHA2.ws0_pre_inner", "Spec.SHA2.ws_pre_inner", "Spec.SHA3.keccak", "Lib.IntTypes.op_Hat_Dot", "Lib.Sequence.Lemmas.repeat_gen_blocks_f", "Lib.ByteSequence.nat_from_bytes_le", "Spec.SHA2.Constants.k224_256", "Spec.SHA2.op_Plus_Dot", "Hacl.Spec.SHA2.op_Plus_Dot", "FStar.Math.Lemmas.pow2_le_compat", "FStar.Math.Lemmas.pow2_lt_compat", "Spec.SHA2.shuffle_core_pre", "Hacl.Spec.SHA2.word_n", "Spec.SHA2.word_n", "Hacl.Spec.SHA2._Maj", "Spec.SHA2._Maj" ], "source_upto_this": "module Hacl.Spec.SHA2.EquivScalar\n\nopen FStar.Mul\nopen Lib.IntTypes\nopen Lib.Sequence\nopen Lib.LoopCombinators\n\nopen Spec.Hash.Definitions\nopen Hacl.Spec.SHA2\n\nmodule Spec = Spec.SHA2\nmodule LSeq = Lib.Sequence\nmodule BSeq = Lib.ByteSequence\nmodule UpdLemmas = Lib.UpdateMulti.Lemmas\nmodule LSeqLemmas = Lib.Sequence.Lemmas\nmodule Loops = Lib.LoopCombinators\n\nfriend Spec.SHA2\nfriend Spec.Agile.Hash\n\n#set-options \"--z3rlimit 50 --fuel 0 --ifuel 0\"\n\nval ws_next_inductive: a:sha2_alg -> ws0:k_w a -> k:nat{k <= 16} ->\n Pure (k_w a)\n (requires True)\n (ensures fun res ->\n res == Loops.repeati k (ws_next_inner a) ws0 /\\\n (forall (i:nat{i < k}). index res i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index res i == index (Loops.repeati (k - 1) (ws_next_inner a) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index res i == index ws0 i))\n\nlet ws_next_inductive a ws0 k =\n Loops.eq_repeati0 k (ws_next_inner a) ws0;\n repeati_inductive #(k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (ws_next_inner a) ws0 /\\\n (forall (i0:nat{i0 < i}). index wsi i0 == index (ws_next_inner a i0 (Loops.repeati i0 (ws_next_inner a) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). index wsi i0 == index (Loops.repeati (i - 1) (ws_next_inner a) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < 16}). index wsi i0 == index ws0 i0))\n (fun i wsi ->\n let ws = ws_next_inner a i wsi in\n Loops.unfold_repeati (i + 1) (ws_next_inner a) ws0 i;\n ws)\n ws0\n\n\nval ws_next_lemma: a:sha2_alg -> ws0:k_w a -> k:pos{k <= 16} -> Lemma\n (let wsk : k_w a = Loops.repeati k (ws_next_inner a) ws0 in\n let wsk1 : k_w a = Loops.repeati (k - 1) (ws_next_inner a) ws0 in\n (forall (i:nat{i < k}). index wsk i == index (ws_next_inner a i (Loops.repeati i (ws_next_inner a) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). index wsk i == index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < 16}). index wsk i == index ws0 i))\n\nlet ws_next_lemma a ws0 k =\n let _ = ws_next_inductive a ws0 k in ()\n\n\nval ws_next_lemma_k: a:sha2_alg -> ws0:k_w a -> k:nat{k < 16} -> Lemma\n (let ws : k_w a = Loops.repeati 16 (ws_next_inner a) ws0 in\n let wsk : k_w a = Loops.repeati (k + 1) (ws_next_inner a) ws0 in\n Seq.index ws k == Seq.index wsk k)\n\nlet ws_next_lemma_k a ws0 k =\n ws_next_lemma a ws0 (k + 1);\n ws_next_lemma a ws0 16\n\n\nval ws_pre_inductive: a:sha2_alg -> block:Spec.block_w a -> k:nat{k <= Spec.size_k_w a} ->\n Pure (Spec.k_w a)\n (requires True)\n (ensures fun res ->\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n res == Loops.repeati k (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i:nat{i < k}).\n Seq.index res i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}).\n Seq.index res i == Seq.index (Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0) i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index res i == Seq.index ws0 i)))\n\nlet ws_pre_inductive a block k =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n Loops.eq_repeati0 k (Spec.ws_pre_inner a block) ws0;\n repeati_inductive #(Spec.k_w a) k\n (fun i wsi ->\n wsi == Loops.repeati i (Spec.ws_pre_inner a block) ws0 /\\\n (forall (i0:nat{i0 < i}).\n Seq.index wsi i0 ==\n Seq.index (Spec.ws_pre_inner a block i0 (Loops.repeati (i0 + 1) (Spec.ws_pre_inner a block) ws0)) i0) /\\\n (forall (i0:nat{i0 < i - 1}). Seq.index wsi i0 == Seq.index (Loops.repeati (i - 1) (Spec.ws_pre_inner a block) ws0) i0) /\\\n (forall (i0:nat{i <= i0 /\\ i0 < Spec.size_k_w a}). Seq.index wsi i0 == Seq.index ws0 i0))\n (fun i wsi ->\n let ws = Spec.ws_pre_inner a block i wsi in\n Loops.unfold_repeati (i + 1) (Spec.ws_pre_inner a block) ws0 i;\n ws)\n ws0\n\n\nval ws_pre_lemma: a:sha2_alg -> block:Spec.block_w a -> k:pos{k <= Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let wsk : Spec.k_w a = Loops.repeati k (Spec.ws_pre_inner a block) ws0 in\n let wsk1 : Spec.k_w a = Loops.repeati (k - 1) (Spec.ws_pre_inner a block) ws0 in\n (forall (i:nat{i < k}).\n Seq.index wsk i ==\n Seq.index (Spec.ws_pre_inner a block i (Loops.repeati (i + 1) (Spec.ws_pre_inner a block) ws0)) i) /\\\n (forall (i:nat{i < k - 1}). Seq.index wsk i == Seq.index wsk1 i) /\\\n (forall (i:nat{k <= i /\\ i < Spec.size_k_w a}). Seq.index wsk i == Seq.index ws0 i))\n\nlet ws_pre_lemma a block k =\n let _ = ws_pre_inductive a block k in ()\n\n\nval ws_pre_lemma_k: a:sha2_alg -> block:Spec.block_w a -> k:nat{k < Spec.size_k_w a} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let wsk : Spec.k_w a = Loops.repeati (k + 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.index wsk k == Seq.index ws k)\n\nlet ws_pre_lemma_k a block k =\n ws_pre_lemma a block (k + 1);\n ws_pre_lemma a block (Spec.size_k_w a)\n\n\nval ws_next_pre_lemma_j_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 j == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n1 j 16 == Seq.slice ws_n0 j 16))\n (ensures\n (let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j)))\n\nlet ws_next_pre_lemma_j_step a block i j ws1 ws_n1 =\n let ws_n = ws_next_inner a j ws_n1 in\n let ws = Spec.ws_pre_inner a block (16 * i + 16 + j) ws1 in\n\n let s0_n = _sigma0 a ws_n1.[(j+1) % 16] in\n let s1_n = _sigma1 a ws_n1.[(j+14) % 16] in\n //assert (Seq.index ws_n j == s1_n +. ws_n1.[(j+9) % 16] +. s0_n +. ws_n1.[j]);\n\n let s0 = _sigma0 a ws1.[16 * i + 16 + j - 15] in\n let s1 = _sigma1 a ws1.[16 * i + 16 + j - 2] in\n //assert (Seq.index ws (16 * i + 16 + j) == s1 +. ws1.[16 * i + 16 + j - 7] +. s0 +. ws1.[16 * i + 16 + j - 16]);\n\n let ws_n1_index (k:nat{k < 16}) :\n Lemma (if k < j then ws_n1.[k] == ws1.[16 * i + 16 + k] else ws_n1.[k] == ws1.[16 * i + k]) =\n if k < j then Seq.lemma_index_slice ws_n1 0 j k\n else Seq.lemma_index_slice ws_n1 j 16 (k - j) in\n\n ws_n1_index ((j + 1) % 16);\n assert (ws_n1.[(j + 1) % 16] == ws1.[16 * i + j + 1]);\n ws_n1_index ((j + 14) % 16);\n assert (ws_n1.[(j + 14) % 16] == ws1.[16 * i + j + 14]);\n ws_n1_index ((j + 9) % 16);\n assert (ws_n1.[(j + 9) % 16] == ws1.[16 * i + j + 9]);\n ws_n1_index j;\n assert (ws_n1.[j] == ws1.[16 * i + j])\n\n\nval ws_next_pre_lemma_aux:\n a:sha2_alg\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16}\n -> ws1:Spec.k_w a\n -> ws_n1:k_w a\n -> ws:Spec.k_w a\n -> ws_n:k_w a ->\n Lemma\n (requires\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) /\\\n (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k) /\\\n (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k) /\\\n Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1) /\\\n (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k)))\n (ensures\n (let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16))\n\nlet ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n =\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n\n let ws_n1_index1 (k:nat{k < j - 1}) : Lemma (Seq.index ws_n1 k == Seq.index ws1 (16 * i + 16 + k)) =\n Seq.lemma_index_slice ws_n1 0 (j - 1) k;\n Seq.lemma_index_slice ws1 (16 * i + 16) (16 * i + 16 + j - 1) k in\n\n let ws_n_index1 (k:nat{k < j}) : Lemma (Seq.index ws_n k == Seq.index ws (16 * i + 16 + k)) =\n if k < j - 1 then ws_n1_index1 k else () in\n\n let ws_n_index2 (k:nat{j <= k /\\ k < 16}) : Lemma (Seq.index ws_n k == Seq.index ws_n0 k) =\n () in\n\n Classical.forall_intro ws_n_index1;\n Seq.lemma_eq_intro (Seq.slice ws_n 0 j) (Seq.slice ws (16 * i + 16) (16 * i + 16 + j));\n Classical.forall_intro ws_n_index2;\n Seq.lemma_eq_intro (Seq.slice ws_n j 16) (Seq.slice ws_n0 j 16)\n\n\nval ws_next_pre_lemma_init:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:pos{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n Seq.slice ws1 (16 * i) (16 * i + 16) == Seq.slice ws (16 * i) (16 * i + 16))\n\nlet ws_next_pre_lemma_init a block i j =\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) (Spec.ws_pre_inner a block) ws0 in\n\n let s : Spec.block_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let s1 : Spec.block_w a = Seq.slice ws1 (16 * i) (16 * i + 16) in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index s k == Seq.index s1 k) =\n ws_pre_lemma a block (16 * i + 16 + j);\n ws_pre_lemma a block (16 * i + 16 + j - 1) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro s s1\n\n\nval ws_next_pre_lemma_j:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j <= 16} -> Lemma\n (let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j (ws_next_inner a) ws_n0 in\n Seq.slice ws_n 0 j == Seq.slice ws (16 * i + 16) (16 * i + 16 + j) /\\\n Seq.slice ws_n j 16 == Seq.slice ws_n0 j 16)\n\nlet rec ws_next_pre_lemma_j a block i j =\n let ws_pre_f = Spec.ws_pre_inner a block in\n let ws_next_f = ws_next_inner a in\n\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (16 * i + 16 + j) ws_pre_f ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati j ws_next_f ws_n0 in\n\n if j = 0 then\n Loops.eq_repeati0 j ws_next_f ws_n0\n else begin\n let ws1 : Spec.k_w a = Loops.repeati (16 * i + 16 + j - 1) ws_pre_f ws0 in\n ws_next_pre_lemma_init a block i j;\n assert (Seq.slice ws1 (16 * i) (16 * i + 16) == ws_n0);\n let ws_n1 : k_w a = Loops.repeati (j - 1) ws_next_f ws_n0 in\n ws_next_pre_lemma_j a block i (j - 1);\n assert (Seq.slice ws_n1 0 (j - 1) == Seq.slice ws1 (16 * i + 16) (16 * i + 16 + j - 1));\n assert (Seq.slice ws_n1 (j - 1) 16 == Seq.slice ws_n0 (j - 1) 16);\n\n ws_pre_lemma a block (16 * i + 16 + j);\n assert (forall (k:nat{k < 16 * i + 16 + j - 1}). Seq.index ws k == Seq.index ws1 k);\n Loops.unfold_repeati (16 * i + 16 + j) ws_pre_f ws0 (16 * i + 16 + j - 1);\n //assert (ws == ws_pre_f (16 * i + 16 + j - 1) ws1);\n\n ws_next_lemma a ws_n0 j;\n assert (forall (k:nat{k < j - 1}). Seq.index ws_n k == Seq.index ws_n1 k);\n assert (forall (k:nat{j <= k /\\ k < 16}). Seq.index ws_n k == Seq.index ws_n0 k);\n Loops.unfold_repeati j ws_next_f ws_n0 (j - 1);\n //assert (ws_n == ws_next_f (j - 1) ws_n1);\n ws_next_pre_lemma_j_step a block i (j - 1) ws1 ws_n1;\n assert (Seq.index ws_n (j - 1) == Seq.index ws (16 * i + 16 + j - 1));\n ws_next_pre_lemma_aux a i j ws1 ws_n1 ws ws_n;\n () end\n\n\nval ws_next_pre_lemma:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a - 1}\n -> j:nat{j < 16} -> Lemma\n (let ws : Spec.k_w a = Spec.ws_pre a block in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = ws_next a ws_n0 in\n Seq.index ws_n j == Seq.index ws (16 * i + 16 + j))\n\nlet ws_next_pre_lemma a block i j =\n reveal_opaque (`%Spec.ws_pre) Spec.ws_pre;\n let ws0 = Seq.create (Spec.size_k_w a) (to_word a 0) in\n let ws : Spec.k_w a = Loops.repeati (Spec.size_k_w a) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0 : k_w a = Seq.slice ws (16 * i) (16 * i + 16) in\n let ws_n : k_w a = Loops.repeati 16 (ws_next_inner a) ws_n0 in\n\n let wsj : Spec.k_w a = Loops.repeati (16 * i + 16 + j + 1) (Spec.ws_pre_inner a block) ws0 in\n let ws_n0j : k_w a = Seq.slice wsj (16 * i) (16 * i + 16) in\n let ws_nj : k_w a = Loops.repeati (j + 1) (ws_next_inner a) ws_n0 in\n\n let aux (k:nat{k < 16}) : Lemma (Seq.index ws_n0 k == Seq.index ws_n0j k) =\n ws_pre_lemma a block (16 * i + 16 + j + 1);\n ws_pre_lemma a block (Spec.size_k_w a) in\n\n Classical.forall_intro aux;\n Seq.lemma_eq_intro ws_n0 ws_n0j;\n\n ws_next_pre_lemma_j a block i (j + 1);\n assert (Seq.slice ws_nj 0 (j + 1) == Seq.slice wsj (16 * i + 16) (16 * i + 16 + j + 1));\n Seq.lemma_index_slice ws_nj 0 (j + 1) j;\n assert (Seq.index ws_nj j == Seq.index wsj (16 * i + 16 + j));\n\n ws_pre_lemma_k a block (16 * i + 16 + j);\n assert (Seq.index wsj (16 * i + 16 + j) == Seq.index ws (16 * i + 16 + j));\n\n ws_next_lemma_k a ws_n0 j;\n assert (Seq.index ws_nj j == Seq.index ws_n j)\n\n\nval shuffle_core_pre_lemma: a:sha2_alg -> k_t:word a -> ws_t:word a -> hash:words_state a ->\n Lemma (shuffle_core_pre a k_t ws_t hash == Spec.shuffle_core_pre a k_t ws_t hash)\nlet shuffle_core_pre_lemma a k_t ws_t hash =\n reveal_opaque (`%Spec.shuffle_core_pre) Spec.shuffle_core_pre\n\n\nnoextract\nval shuffle_pre_inner: a:sha2_alg -> ws:Spec.k_w a -> i:nat{i < size_k_w a} -> st:words_state a -> words_state a\nlet shuffle_pre_inner a ws i st =\n let k = k0 a in\n shuffle_core_pre a k.[i] ws.[i] st\n\n\nval shuffle_spec_lemma: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 == Spec.shuffle a st0 block)\n\nlet shuffle_spec_lemma a st0 block =\n reveal_opaque (`%Spec.shuffle) Spec.shuffle;\n let ws = Spec.ws_pre a block in\n let k = Spec.k0 a in\n let aux (i:nat{i < Spec.size_k_w a}) (st:words_state a) :\n Lemma (shuffle_pre_inner a ws i st == Spec.shuffle_core_pre a k.[i] ws.[i] st) =\n let k = Spec.k0 a in\n shuffle_core_pre_lemma a k.[i] ws.[i] st in\n Classical.forall_intro_2 aux;\n LSeqLemmas.repeati_extensionality (Spec.size_k_w a)\n (shuffle_pre_inner a ws)\n (fun i h -> Spec.shuffle_core_pre a k.[i] ws.[i] h) st0\n\n\nnoextract\nval shuffle_pre_inner16:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> j:nat{j < 16}\n -> st:words_state a ->\n words_state a\n\nlet shuffle_pre_inner16 a ws i j st =\n let k = k0 a in\n shuffle_core_pre a k.[16 * i + j] ws.[16 * i + j] st\n\n\nnoextract\nval shuffle_pre_inner_num_rounds:\n a:sha2_alg\n -> ws:Spec.k_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a ->\n words_state a\n\nlet shuffle_pre_inner_num_rounds a ws i st =\n Loops.repeati 16 (shuffle_pre_inner16 a ws i) st\n\n\nval shuffle_spec_lemma16_step:\n a:sha2_alg\n -> block:Spec.block_w a\n -> i:nat{i < num_rounds16 a}\n -> st:words_state a\n -> j:nat{j <= 16} ->\n Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati j (shuffle_pre_inner16 a ws i) st ==\n Loops.repeat_right (16 * i) (16 * i + j) (Loops.fixed_a (words_state a)) (shuffle_pre_inner a ws) st)\n\nlet rec shuffle_spec_lemma16_step a block i st j =\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n //let lp = Loops.repeati j (shuffle_pre_inner16 a ws i) st in\n //let rp = Loops.repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st in\n if j = 0 then begin\n Loops.eq_repeati0 j (shuffle_pre_inner16 a ws i) st;\n Loops.eq_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st end\n else begin\n //let lp1 = Loops.repeati (j - 1) (shuffle_pre_inner16 a ws i) st in\n //let rp1 = Loops.repeat_right (16 * i) (16 * i + j - 1) a_fixed (shuffle_pre_inner a ws) st in\n Loops.unfold_repeati j (shuffle_pre_inner16 a ws i) st (j - 1);\n Loops.unfold_repeat_right (16 * i) (16 * i + j) a_fixed (shuffle_pre_inner a ws) st (16 * i + j - 1);\n //assert (lp == shuffle_pre_inner16 a ws i (j - 1) lp1);\n //assert (rp == shuffle_pre_inner a ws (16 * i + j - 1) rp1);\n shuffle_spec_lemma16_step a block i st (j - 1);\n () end\n\n\nval shuffle_spec_lemma16: a:sha2_alg -> st0:words_state a -> block:Spec.block_w a -> Lemma\n (let ws = Spec.ws_pre a block in\n Loops.repeati (Spec.size_k_w a) (shuffle_pre_inner a ws) st0 ==\n Loops.repeati (num_rounds16 a) (shuffle_pre_inner_num_rounds a ws) st0)\n\nlet shuffle_spec_lemma16 a st0 block =\n //w = 16, n = num_rounds16 a, normalize_v = id\n let ws = Spec.ws_pre a block in\n let a_fixed = Loops.fixed_a (words_state a) in\n let aux (i:nat{i < num_rounds16 a}) (st:words_state a) :\n Lemma (shuffle_pre_inner_num_rounds a ws i st ==\n Loops.repeat_right (16 * i) (16 * (i + 1)) a_fixed (shuffle_pre_inner a ws) st) =\n shuffle_spec_lemma16_step a block i st 16 in\n\n Classical.forall_intro_2 aux;\n Lib.Vec.Lemmas.lemma_repeati_vec 16 (num_rounds16 a) (fun x -> x)\n (shuffle_pre_inner a ws)\n (shuffle_pre_inner_num_rounds a ws)\n st0\n\n\nval ws_next_inner_lemma:\n a:sha2_alg\n -> block:k_w a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n\nlet ws_next_inner_lemma a block i ws1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then ws_next a ws1 else ws1 in\n\n if i < num_rounds16 a - 1 then begin\n let aux (k:nat{k < 16}) : Lemma (Seq.index (ws_next a ws1) k == Seq.index ws_s (16 * (i + 1) + k)) =\n ws_next_pre_lemma a block i k in\n Classical.forall_intro aux;\n Seq.lemma_eq_intro (ws_next a ws1) (Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)) end\n else ()\n\n\nval shuffle_lemma_i_step:\n a:sha2_alg\n -> block:k_w a\n -> st0:words_state a\n -> i:nat{i < num_rounds16 a}\n -> ws1:k_w a\n -> st1:words_state a ->\n Lemma\n (requires\n (let ws_s = Spec.ws_pre a block in\n (if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n (ensures\n (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n (if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))))\n", "sketch": [ "Step 1: We start by assuming the preconditions of the lemma, which specify the initial values of `ws1` and `st1` based on the current round `i`. \n\nStep 2: We then calculate the expected state `st_s` after applying the `shuffle_pre_inner_num_rounds` function with the input `ws_s`, `i`, and `st1`.\n\nStep 3: Next, we calculate the expected values of `ws` and `st` after applying the `shuffle_inner_loop` function with the input `i`, `ws1`, and `st1`.\n\nStep 4: Finally, we assert that the calculated `st` is equal to the expected `st_s`, and the calculated `ws` matches the expected value based on the current round `i`.", "Step 1: We first obtain the slice of `ws_s` corresponding to the current round `i` and assign it to `ws1`. If `i` is less than `num_rounds16 a - 1`, we take the slice from index `16 * i` to `16 * i + 16`, otherwise we take the slice from index `16 * (num_rounds16 a - 1)` to `16 * num_rounds16 a`.\n\nStep 2: We calculate the state `st_s` after applying the `shuffle_pre_inner_num_rounds` function with the current `ws_s` and `i` as inputs.\n\nStep 3: We then call the `shuffle_inner_loop` function with `i`, `ws1`, and `st1` as inputs, and obtain the resulting `ws` and `st`.\n\nStep 4: We assert that the resulting state `st` is equal to the state `st_s` calculated in step 2.\n\nStep 5: If `i` is less than `num_rounds16 a - 1`, we assert that the resulting `ws` is equal to the slice of `ws_s` from index `16 * (i + 1)` to `16 * (i + 1) + 16`, otherwise we assert that `ws` is equal to the slice of `ws_s` from index `16 * (num_rounds16 a - 1)` to `16 * num_rounds16 a`.", "Step 1: We start by assuming the preconditions of the lemma, where we have the block and the initial state `st0`, and we are focusing on a specific round `i`. We also have the intermediate state `st1` and the corresponding `ws1` for this round `i`.\n\nStep 2: We use the preconditions to extract the corresponding slice of the precomputed `ws` values for the given round `i`.\n\nStep 3: We then use the extracted `ws` slice to compute the expected state `st_s` after applying the shuffle operation for this round.\n\nStep 4: We then use the `shuffle_inner_loop` function to compute the actual next state `st` and the corresponding `ws` for the next round.", "Step 1: We need to show that for a given `i`, `ws1`, and `st1`, the shuffle operation `shuffle_inner_loop` produces the expected `ws` and `st` values. We will use the `shuffle_pre_inner_num_rounds` function to calculate the expected `st` value based on `ws_s` and `st1`.\n\nStep 2: We will then call the `shuffle_inner_loop` function with the input `(ws1, st1)` to obtain the actual `ws` and `st` values.\n\nStep 3: Finally, we will compare the actual `st` value with the expected `st_s` value, and the actual `ws` value with the expected `ws` value based on the value of `i`.", "Step 1: We start by assuming the preconditions of the lemma, where we have the initial state `st0`, the block `block`, the index `i`, the word sequence `ws1`, and the state `st1`. We also have the word sequence `ws_s` obtained from `Spec.ws_pre a block`. \n\nStep 2: We then calculate the state `st_s` by applying `shuffle_pre_inner_num_rounds a ws_s i st1`. \n\nStep 3: Next, we calculate the pair `(ws, st)` by applying `shuffle_inner_loop a i (ws1, st1)`.\n\nStep 4: Finally, we assert that the calculated state `st` is equal to `st_s` and that the calculated word sequence `ws` matches the expected slice of `ws_s` based on the value of `i`.", "Step 1: We start by assuming the preconditions of the lemma, where we have the value of `ws1` based on the current round `i`. \n\nStep 2: We then calculate the expected state `st_s` after applying the `shuffle_pre_inner_num_rounds` function with the current `ws1` and `st1`.\n\nStep 3: Next, we calculate the expected values of `ws` and `st` after applying the `shuffle_inner_loop` function with the current `ws1` and `st1`.", "Step 1: We will first use the given precondition to obtain the value of `ws_s`, which is the slice of `Spec.ws_pre` corresponding to the current round `i`. We will also obtain the value of `st_s` by applying `shuffle_pre_inner_num_rounds` to `ws_s` and `st1`.\n\nStep 2: Next, we will use the obtained values of `ws_s` and `st_s` to compute the next values of `ws` and `st` by calling the `shuffle_inner_loop` function with the input `(ws1, st1)` and the current round `i`.", "Step 1: We start by assuming the preconditions of the lemma, which involve the initial state `st0`, the current round `i`, and the corresponding `ws1` value. We also obtain the corresponding `ws_s` value from the precomputed word sequence `ws_pre` based on the block.\n\nStep 2: We then calculate the expected state `st_s` after applying the `shuffle_pre_inner_num_rounds` function to the input `st1` and `ws_s` for the current round `i`.\n\nStep 3: Next, we calculate the expected values of `ws` and `st` after applying the `shuffle_inner_loop` function to the input `ws1` and `st1` for the current round `i`.\n\nStep 4: Finally, we assert that the resulting state `st` is equal to the expected state `st_s`, and the resulting word sequence `ws` is equal to the expected word sequence based on the next round.", "Step 1: We start by assuming the preconditions of the lemma, where we have the initial state st0, the current round index i, the current block ws1, and the current state st1. We also have the sequence of words ws_s representing the precomputed message schedule for the current block.\n\nStep 2: We then calculate the expected state st_s after applying the shuffle operations for the current round i using the precomputed message schedule ws_s and the current state st1.\n\nStep 3: Next, we calculate the expected message schedule ws and state st after applying the shuffle_inner_loop operation for the current round i using the current block ws1 and state st1.", "Step 1: We will first use the given precondition to extract the appropriate slice of `ws_s` based on the value of `i`. If `i` is less than `num_rounds16 a - 1`, we will extract the slice from index `16 * i` to `16 * i + 16`, otherwise we will extract the slice from index `16 * (num_rounds16 a - 1)` to `16 * num_rounds16 a`.\n\nStep 2: Next, we will use the extracted `ws_s` slice and the input `st1` to compute the expected state `st_s` using the `shuffle_pre_inner_num_rounds` function.\n\nStep 3: Then, we will call the `shuffle_inner_loop` function with the input `i`, `ws1`, and `st1` to obtain the resulting `ws` and `st`.\n\nStep 4: Finally, we will compare the resulting `st` with the expected state `st_s`, and if `i` is less than `num_rounds16 a - 1`, we will compare the resulting `ws` with the appropriate slice of `ws_s` based on the value of `i`. If `i` is less than `num_rounds16 a - 1`, we will compare the slice from index `16 * (i + 1)` to `16 * (i + 1) + 16`, otherwise we will compare the slice from index `16 * (num_rounds16 a - 1)` to `16 * num_rounds16 a`." ], "generated_solution": [ "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n requires (let ws_s = Spec.ws_pre a block in\n if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a));\n ensures (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "val shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws = if i < num_rounds16 a - 1 then Seq.slice ws_s (16 * i) (16 * i + 16)\n else Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a) in\n\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws', st') = shuffle_inner_loop a i (ws1, st1) in\n\n assert (st' == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws' == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws' == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a)", "val shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : k_w a = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "val shuffle_lemma_i_step a block st0 i ws1 st1 =\n requires (let ws_s = Spec.ws_pre a block in\n if i < num_rounds16 a - 1 then\n ws1 == Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n ws1 == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a));\n ensures (let ws_s = Spec.ws_pre a block in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n st == st_s /\\\n if i < num_rounds16 a - 1 then\n ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16)\n else\n ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a));", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : k_w a =\n if i < num_rounds16 a - 1 then\n Seq.slice (Spec.ws_pre a block) (16 * i) (16 * i + 16)\n else\n Seq.slice (Spec.ws_pre a block) (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a) in\n let st_s : words_state a = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice (Spec.ws_pre a block) (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice (Spec.ws_pre a block) (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "val shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : k_w a = Spec.ws_pre a block in\n let st_s : words_state a = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let st_s : words_state a = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a)", "let shuffle_lemma_i_step a block st0 i ws1 st1 =\n let ws_s : Spec.k_w a = Spec.ws_pre a block in\n let ws_slice = if i < num_rounds16 a - 1 then\n Seq.slice ws_s (16 * i) (16 * i + 16)\n else\n Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a) in\n let st_s = shuffle_pre_inner_num_rounds a ws_s i st1 in\n let (ws, st) = shuffle_inner_loop a i (ws1, st1) in\n assert (st == st_s);\n if i < num_rounds16 a - 1 then\n assert (ws == Seq.slice ws_s (16 * (i + 1)) (16 * (i + 1) + 16))\n else\n assert (ws == Seq.slice ws_s (16 * (num_rounds16 a - 1)) (16 * num_rounds16 a))" ] }, { "file_name": "MerkleTree.New.High.Correct.fst", "name": "MerkleTree.New.High.Correct.mt_get_path_ok", "opens_and_abbrevs": [ { "abbrev": "MTS", "full_module": "MerkleTree.Spec" }, { "abbrev": "Path", "full_module": "MerkleTree.New.High.Correct.Path" }, { "abbrev": "Flushing", "full_module": "MerkleTree.New.High.Correct.Flushing" }, { "abbrev": "Rhs", "full_module": "MerkleTree.New.High.Correct.Rhs" }, { "abbrev": "Insertion", "full_module": "MerkleTree.New.High.Correct.Insertion" }, { "abbrev": "S", "full_module": "FStar.Seq" }, { "open": "MerkleTree.New.High.Correct.Path" }, { "open": "MerkleTree.New.High.Correct.Flushing" }, { "open": "MerkleTree.New.High.Correct.Rhs" }, { "open": "MerkleTree.New.High.Correct.Insertion" }, { "open": "MerkleTree.New.High.Correct.Base" }, { "open": "MerkleTree.New.High" }, { "open": "FStar.Seq" }, { "open": "MerkleTree.New.High" }, { "open": "MerkleTree.New.High" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 0, "initial_ifuel": 1, "max_ifuel": 0, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 20, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val mt_get_path_ok:\n #hsz:pos -> \n mto:mt_olds #hsz ->\n idx:nat{MT?.i (MTO?.mt mto) <= idx && idx < MT?.j (MTO?.mt mto)} ->\n drt:hash ->\n Lemma (requires mto_inv mto /\\ MT?.j (MTO?.mt mto) > 0)\n (ensures (let f = (MT?.hash_fun (MTO?.mt mto)) in\n let j, p, rt = mt_get_path (MTO?.mt mto) idx drt in\n j == MT?.j (MTO?.mt mto) /\\\n mt_root_inv #_ #f (mto_base mto) hash_init false rt /\\\n S.head p == S.index (mto_base mto) idx /\\\n (assert (S.length (S.tail p) == mt_path_length idx (MT?.j (MTO?.mt mto)) false);\n S.equal (path_spec idx (MT?.j (MTO?.mt mto)) false (S.tail p))\n (MTS.mt_get_path #_ #f #(log2c j) (mto_spec mto) idx))))", "source_definition": "let mt_get_path_ok #_ mto idx drt =\n Path.mt_get_path_inv_ok (MTO?.mt mto) (MTO?.olds mto) idx drt", "source_range": { "start_line": 133, "start_col": 0, "end_line": 134, "end_col": 63 }, "interleaved": false, "definition": "fun mto idx drt ->\n MerkleTree.New.High.Correct.Path.mt_get_path_inv_ok (MTO?.mt mto) (MTO?.olds mto) idx drt", "effect": "FStar.Pervasives.Lemma", "effect_flags": [ "lemma" ], "mutual_with": [], "premises": [ "Prims.pos", "MerkleTree.New.High.Correct.mt_olds", "Prims.nat", "Prims.b2t", "Prims.op_AmpAmp", "Prims.op_LessThanOrEqual", "MerkleTree.New.High.__proj__MT__item__i", "MerkleTree.New.High.Correct.__proj__MTO__item__mt", "Prims.op_LessThan", "MerkleTree.New.High.__proj__MT__item__j", "MerkleTree.New.High.hash", "MerkleTree.New.High.Correct.Path.mt_get_path_inv_ok", "MerkleTree.New.High.Correct.__proj__MTO__item__olds", "Prims.unit" ], "proof_features": [], "is_simple_lemma": true, "is_div": false, "is_proof": true, "is_simply_typed": false, "is_type": false, "type": "\n mto: MerkleTree.New.High.Correct.mt_olds ->\n idx: Prims.nat{MT?.i (MTO?.mt mto) <= idx && idx < MT?.j (MTO?.mt mto)} ->\n drt: MerkleTree.New.High.hash\n -> FStar.Pervasives.Lemma\n (requires MerkleTree.New.High.Correct.mto_inv mto /\\ MT?.j (MTO?.mt mto) > 0)\n (ensures\n (let f = MT?.hash_fun (MTO?.mt mto) in\n let _ = MerkleTree.New.High.mt_get_path (MTO?.mt mto) idx drt in\n (let FStar.Pervasives.Native.Mktuple3 #_ #_ #_ j p rt = _ in\n j == MT?.j (MTO?.mt mto) /\\\n MerkleTree.New.High.Correct.Base.mt_root_inv (MerkleTree.New.High.Correct.mto_base mto)\n MerkleTree.New.High.hash_init\n false\n rt /\\\n FStar.Seq.Properties.head p ==\n FStar.Seq.Base.index (MerkleTree.New.High.Correct.mto_base mto) idx /\\\n (assert (FStar.Seq.Base.length (FStar.Seq.Properties.tail p) ==\n MerkleTree.New.High.mt_path_length idx (MT?.j (MTO?.mt mto)) false);\n FStar.Seq.Base.equal (MerkleTree.New.High.Correct.Path.path_spec idx\n (MT?.j (MTO?.mt mto))\n false\n (FStar.Seq.Properties.tail p))\n (MerkleTree.Spec.mt_get_path (MerkleTree.New.High.Correct.mto_spec mto) idx)))\n <:\n Type0))", "prompt": "let mt_get_path_ok #_ mto idx drt =\n ", "expected_response": "Path.mt_get_path_inv_ok (MTO?.mt mto) (MTO?.olds mto) idx drt", "source": { "project_name": "merkle-tree", "file_name": "src/MerkleTree.New.High.Correct.fst", "git_rev": "7d7bdc20f2033171e279c176b26e84f9069d23c6", "git_url": "https://github.com/hacl-star/merkle-tree.git" }, "dependencies": { "source_file": "MerkleTree.New.High.Correct.fst", "checked_file": "dataset/MerkleTree.New.High.Correct.fst.checked", "interface_file": false, "dependencies": [ "dataset/prims.fst.checked", "dataset/MerkleTree.Spec.fst.checked", "dataset/MerkleTree.New.High.Correct.Rhs.fst.checked", "dataset/MerkleTree.New.High.Correct.Path.fst.checked", "dataset/MerkleTree.New.High.Correct.Insertion.fst.checked", "dataset/MerkleTree.New.High.Correct.Flushing.fst.checked", "dataset/MerkleTree.New.High.Correct.Base.fst.checked", "dataset/MerkleTree.New.High.fst.checked", "dataset/FStar.Seq.fst.checked", "dataset/FStar.Pervasives.fsti.checked" ] }, "definitions_in_context": [ "old_hashes", "mt_olds", "MTO", "MTO", "MTO", "mt", "mt", "olds", "olds", "val mto_inv: #hsz:pos -> mt_olds #hsz -> GTot Type0", "let mto_inv #hsz mto =\n mt_inv (MTO?.mt mto) (MTO?.olds mto)", "val mto_base: #hsz:pos -> mto:mt_olds #hsz -> GTot (hs:hashes #hsz{S.length hs = MT?.j (MTO?.mt mto)})", "let mto_base #hsz mto =\n mt_base (MTO?.mt mto) (MTO?.olds mto)", "val mto_spec:\n #hsz:pos ->\n mto:mt_olds #hsz {MT?.j (MTO?.mt mto) > 0} ->\n GTot (MTS.merkle_tree #hsz (log2c (MT?.j (MTO?.mt mto))))", "let mto_spec #hsz mto =\n mt_spec (MTO?.mt mto) (MTO?.olds mto)", "val create_mt_ok:\n hsz:pos -> f:MTS.hash_fun_t ->\n init:hash #hsz ->\n Lemma (empty_olds_inv #_ #f 0;\n mto_inv (MTO (mt_create hsz f init) (empty_hashes 32)))", "let create_mt_ok hsz f init =\n Insertion.create_mt_inv_ok #_ #f init", "val mt_insert_ok:\n #hsz:pos -> \n mto:mt_olds #hsz -> v:hash #hsz ->\n Lemma (requires mto_inv mto /\\ mt_not_full (MTO?.mt mto))\n (ensures mto_inv (MTO (mt_insert (MTO?.mt mto) v) (MTO?.olds mto)))", "let mt_insert_ok #hsz mto v =\n Insertion.mt_insert_inv_preserved (MTO?.mt mto) v (MTO?.olds mto)", "val mt_flush_to_ok:\n #hsz:pos -> \n mto:mt_olds #hsz ->\n idx:nat{idx >= MT?.i (MTO?.mt mto) /\\ idx < MT?.j (MTO?.mt mto)} ->\n Lemma (requires mto_inv mto)\n (ensures mto_inv (MTO (mt_flush_to (MTO?.mt mto) idx)\n (mt_flush_to_olds #hsz #(MT?.hash_fun (MTO?.mt mto)) 0 (MT?.i (MTO?.mt mto)) idx (MT?.j (MTO?.mt mto))\n (MTO?.olds mto) (MT?.hs (MTO?.mt mto)))))", "let mt_flush_to_ok #_ mto idx =\n Flushing.mt_flush_to_inv_preserved (MTO?.mt mto) (MTO?.olds mto) idx", "val mt_flush_ok:\n #hsz:pos -> \n mto:mt_olds #hsz ->\n Lemma (requires mto_inv mto /\\ MT?.j (MTO?.mt mto) > MT?.i (MTO?.mt mto))\n (ensures mto_inv (MTO (mt_flush_to (MTO?.mt mto) (MT?.j (MTO?.mt mto) - 1))\n (mt_flush_to_olds #hsz #(MT?.hash_fun (MTO?.mt mto)) 0 (MT?.i (MTO?.mt mto))\n (MT?.j (MTO?.mt mto) - 1) (MT?.j (MTO?.mt mto))\n (MTO?.olds mto) (MT?.hs (MTO?.mt mto)))))", "let mt_flush_ok #_ mto =\n Flushing.mt_flush_inv_preserved (MTO?.mt mto) (MTO?.olds mto)", "val mt_get_root_ok:\n #hsz:pos -> \n mto:mt_olds #hsz -> drt:hash #hsz ->\n Lemma (requires mto_inv mto)\n (ensures (let nmt, rt = mt_get_root (MTO?.mt mto) drt in\n // Only `MT?.rhs` and `MT?.mroot` are changed.\n MT?.i (MTO?.mt mto) == MT?.i nmt /\\\n MT?.j (MTO?.mt mto) == MT?.j nmt /\\\n MT?.hs (MTO?.mt mto) == MT?.hs nmt /\\\n // A Merkle tree with new `MT?.rhs` and `MT?.mroot` is valid.\n mt_inv nmt (MTO?.olds mto) /\\\n // A returned root is indeed the Merkle root.\n rt == MT?.mroot nmt))", "let mt_get_root_ok #_ mto drt =\n Rhs.mt_get_root_inv_ok (MTO?.mt mto) drt (MTO?.olds mto)", "val mt_get_path_ok:\n #hsz:pos -> \n mto:mt_olds #hsz ->\n idx:nat{MT?.i (MTO?.mt mto) <= idx && idx < MT?.j (MTO?.mt mto)} ->\n drt:hash ->\n Lemma (requires mto_inv mto /\\ MT?.j (MTO?.mt mto) > 0)\n (ensures (let f = (MT?.hash_fun (MTO?.mt mto)) in\n let j, p, rt = mt_get_path (MTO?.mt mto) idx drt in\n j == MT?.j (MTO?.mt mto) /\\\n mt_root_inv #_ #f (mto_base mto) hash_init false rt /\\\n S.head p == S.index (mto_base mto) idx /\\\n (assert (S.length (S.tail p) == mt_path_length idx (MT?.j (MTO?.mt mto)) false);\n S.equal (path_spec idx (MT?.j (MTO?.mt mto)) false (S.tail p))\n (MTS.mt_get_path #_ #f #(log2c j) (mto_spec mto) idx))))" ], "closest": [ "val mt_get_path_inv_ok:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n idx:nat{MT?.i mt <= idx && idx < MT?.j mt} ->\n drt:hash ->\n Lemma (requires (MT?.j mt > 0 /\\ mt_inv mt olds))\n (ensures (let j, p, rt = mt_get_path mt idx drt in\n j == MT?.j mt /\\\n mt_root_inv #_ #(MT?.hash_fun mt) (mt_base mt olds) hash_init false rt /\\\n S.head p == S.index (mt_base mt olds) idx /\\\n (assert (S.length (S.tail p) == mt_path_length idx (MT?.j mt) false);\n S.equal (path_spec idx (MT?.j mt) false (S.tail p))\n (MTS.mt_get_path #_ #(MT?.hash_fun mt) #(log2c j) (mt_spec mt olds) idx))))\nlet mt_get_path_inv_ok #hsz mt olds idx drt =\n let j, p, rt = mt_get_path mt idx drt in\n mt_get_root_inv_ok mt drt olds;\n assert (j == MT?.j mt);\n assert (mt_root_inv #_ #(MT?.hash_fun mt) (mt_base mt olds) hash_init false rt);\n\n let ofs = offset_of (MT?.i mt) in\n let umt, _ = mt_get_root mt drt in\n let ip = path_insert S.empty (S.index (mt_base mt olds) idx) in\n mt_get_path_unchanged 0 (MT?.hs umt) (MT?.rhs umt)\n (MT?.i umt) (MT?.j umt) idx ip false;\n assert (S.head ip == S.head (S.slice p 0 (S.length ip)));\n assert (S.head ip == S.head p);\n assert (S.head p == S.index (mt_base mt olds) idx);\n\n assert (S.length (S.tail p) == mt_path_length idx (MT?.j mt) false);\n mt_get_path_inv_ok_ #_ #(MT?.hash_fun mt) 0 (MT?.i umt) (MT?.j umt)\n olds (MT?.hs umt) (MT?.rhs umt) idx ip hash_init false", "val mt_get_path_inv_ok_:\n #hsz:pos -> #f:MTS.hash_fun_t ->\n lv:nat{lv < 32} ->\n i:nat ->\n j:nat{j > 0 /\\ i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs i j} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n acc:hash -> actd:bool ->\n Lemma (requires (log2c_div j; log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n (mt_hashes_inv #_ #f lv j (merge_hs #_ #f olds hs) /\\\n\t\t (let t1 = hash_seq_spec_full #_ #f (S.index (merge_hs #_ #f olds hs) lv) acc actd in\n\t\t let t2 = S.slice rhs lv (lv + log2c j) in\n mt_rhs_inv #_ #f j t1 t2 actd))))\n (ensures (S.equal (path_spec k j actd\n (S.slice (mt_get_path_ lv hs rhs i j k p actd)\n (S.length p) (S.length p + mt_path_length k j actd)))\n (MTS.mt_get_path #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f \n (S.index (merge_hs #_ #f olds hs) lv) acc actd) k)))\nlet mt_get_path_inv_ok_ #_ #f lv i j olds hs rhs k p acc actd =\n log2c_div j; log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n mt_hashes_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n\n mt_get_path_acc_consistent #_ #f lv i j olds hs rhs k actd;\n mt_get_path_slice lv hs rhs i j k p actd;\n mt_get_path_acc_inv_ok #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j))\n (S.slice rhs lv (lv + log2c j))\n k acc actd", "val mt_get_path:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n idx:nat{MT?.i mt <= idx /\\ idx < MT?.j mt} ->\n drt:hash #hsz ->\n GTot (nat *\n (np:path #hsz {S.length np = 1 + mt_path_length idx (MT?.j mt) false}) *\n hash #hsz)\nlet mt_get_path #hsz mt idx drt =\n let (umt, root) = mt_get_root mt drt in\n let ofs = offset_of (MT?.i umt) in\n let np = path_insert S.empty (S.index (S.index (MT?.hs umt) 0) (idx - ofs)) in\n MT?.j umt,\n mt_get_path_ 0 (MT?.hs umt) (MT?.rhs umt)\n (MT?.i umt) (MT?.j umt) idx np false,\n root", "val mt_get_path_ok_:\n #hsz:pos -> #f:hash_fun_t #hsz -> #n:nat ->\n t:merkle_tree #hsz n -> i:nat{i < pow2 n} ->\n Lemma (mt_verify_ #_ #f (mt_get_path #_ #f t i) i (mt_get t i) == mt_get_root #_ #f t)\nlet rec mt_get_path_ok_ #hsz #f #n mt idx =\n if n = 0 then ()\n else begin\n assert (S.head (mt_get_path #_ #f mt idx) ==\n (if idx % 2 = 0 then mt.[idx + 1] else mt.[idx - 1]));\n assert (S.equal (S.tail (mt_get_path #_ #f mt idx))\n (mt_get_path #_ #f (mt_next_lv #_ #f mt) (idx / 2)));\n mt_get_path_ok_ #_ #f (mt_next_lv #_ #f mt) (idx / 2);\n mt_next_lv_get #_ #f mt idx\n end", "val mt_get_path:\n #hsz:Ghost.erased hash_size_t ->\n mt:const_mt_p ->\n idx:offset_t ->\n p:path_p ->\n root:hash #hsz ->\n HST.ST index_t\n (requires (fun h0 ->\n let mt = CB.cast mt in\n let dmt = B.get h0 mt 0 in\n MT?.hash_size dmt = Ghost.reveal hsz /\\\n Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\\\n mt_get_path_pre_nst (B.get h0 mt 0) idx (B.get h0 p 0) root /\\\n mt_safe h0 mt /\\\n path_safe h0 (B.frameOf mt) p /\\\n Rgl?.r_inv (hreg hsz) h0 root /\\\n HH.disjoint (B.frameOf root) (B.frameOf mt) /\\\n HH.disjoint (B.frameOf root) (B.frameOf p)))\n (ensures (fun h0 _ h1 ->\n let mt = CB.cast mt in\n let mtv0 = B.get h0 mt 0 in\n let mtv1 = B.get h1 mt 0 in\n let idx = split_offset (MT?.offset mtv0) idx in\n MT?.hash_size mtv0 = Ghost.reveal hsz /\\\n MT?.hash_size mtv1 = Ghost.reveal hsz /\\\n Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\\\n Path?.hash_size (B.get h1 p 0) = Ghost.reveal hsz /\\\n // memory safety\n modifies (loc_union\n (loc_union\n (mt_loc mt)\n (B.loc_all_regions_from false (B.frameOf root)))\n (path_loc p))\n h0 h1 /\\\n mt_safe h1 mt /\\\n path_safe h1 (B.frameOf mt) p /\\\n Rgl?.r_inv (hreg hsz) h1 root /\\\n V.size_of (phashes h1 p) ==\n 1ul + mt_path_length 0ul idx (MT?.j mtv0) false /\\\n // correctness\n (let sj, sp, srt =\n MTH.mt_get_path\n (mt_lift h0 mt) (U32.v idx) (Rgl?.r_repr (hreg hsz) h0 root) in\n sj == U32.v (MT?.j mtv1) /\\\n S.equal sp (lift_path #hsz h1 (B.frameOf mt) p) /\\\n srt == Rgl?.r_repr (hreg hsz) h1 root)))\nlet mt_get_path #hsz mt idx p root =\n let ncmt = CB.cast mt in\n let mtframe = B.frameOf ncmt in\n let hh0 = HST.get () in\n mt_get_root mt root;\n let mtv = !*ncmt in\n let hsz = MT?.hash_size mtv in\n \n let hh1 = HST.get () in\n path_safe_init_preserved mtframe p\n (B.loc_union (mt_loc ncmt)\n (B.loc_all_regions_from false (B.frameOf root)))\n hh0 hh1;\n assert (MTH.mt_get_root (mt_lift hh0 ncmt) (Rgl?.r_repr (hreg hsz) hh0 root) ==\n (mt_lift hh1 ncmt, Rgl?.r_repr (hreg hsz) hh1 root));\n assert (S.equal (lift_path #hsz hh1 mtframe p) S.empty);\n\n let idx = split_offset (MT?.offset mtv) idx in\n let i = MT?.i mtv in\n let ofs = offset_of (MT?.i mtv) in\n let j = MT?.j mtv in\n let hs = MT?.hs mtv in\n let rhs = MT?.rhs mtv in\n\n assert (mt_safe_elts hh1 0ul hs i j);\n assert (V.size_of (V.get hh1 hs 0ul) == j - ofs);\n assert (idx < j);\n\n hash_vv_rv_inv_includes hh1 hs 0ul (idx - ofs);\n hash_vv_rv_inv_r_inv hh1 hs 0ul (idx - ofs);\n hash_vv_as_seq_get_index hh1 hs 0ul (idx - ofs);\n\n let ih = V.index (V.index hs 0ul) (idx - ofs) in\n mt_path_insert #hsz mtframe p ih;\n\n let hh2 = HST.get () in\n assert (S.equal (lift_path hh2 mtframe p)\n (MTH.path_insert\n (lift_path hh1 mtframe p)\n (S.index (S.index (RV.as_seq hh1 hs) 0) (U32.v idx - U32.v ofs))));\n Rgl?.r_sep (hreg hsz) root (path_loc p) hh1 hh2;\n mt_safe_preserved ncmt (path_loc p) hh1 hh2;\n mt_preserved ncmt (path_loc p) hh1 hh2;\n assert (V.size_of (phashes hh2 p) == 1ul);\n\n mt_get_path_ 0ul mtframe hs rhs i j idx p false;\n\n let hh3 = HST.get () in\n\n // memory safety\n mt_get_path_loc_union_helper\n (loc_union (mt_loc ncmt)\n (B.loc_all_regions_from false (B.frameOf root)))\n (path_loc p);\n Rgl?.r_sep (hreg hsz) root (path_loc p) hh2 hh3;\n mt_safe_preserved ncmt (path_loc p) hh2 hh3;\n mt_preserved ncmt (path_loc p) hh2 hh3;\n assert (V.size_of (phashes hh3 p) ==\n 1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);\n assert (S.length (lift_path #hsz hh3 mtframe p) ==\n S.length (lift_path #hsz hh2 mtframe p) +\n MTH.mt_path_length (U32.v idx) (U32.v (MT?.j (B.get hh0 ncmt 0))) false);\n\n assert (modifies (loc_union\n (loc_union\n (mt_loc ncmt)\n (B.loc_all_regions_from false (B.frameOf root)))\n (path_loc p))\n hh0 hh3);\n assert (mt_safe hh3 ncmt);\n assert (path_safe hh3 mtframe p);\n assert (Rgl?.r_inv (hreg hsz) hh3 root);\n assert (V.size_of (phashes hh3 p) ==\n 1ul + mt_path_length 0ul idx (MT?.j (B.get hh0 ncmt 0)) false);\n\n // correctness\n mt_safe_elts_spec hh2 0ul hs i j;\n assert (S.equal (lift_path hh3 mtframe p)\n (MTH.mt_get_path_ 0 (RV.as_seq hh2 hs) (RV.as_seq hh2 rhs)\n (U32.v i) (U32.v j) (U32.v idx)\n (lift_path hh2 mtframe p) false));\n assert (MTH.mt_get_path\n (mt_lift hh0 ncmt) (U32.v idx) (Rgl?.r_repr (hreg hsz) hh0 root) ==\n (U32.v (MT?.j (B.get hh3 ncmt 0)),\n lift_path hh3 mtframe p,\n Rgl?.r_repr (hreg hsz) hh3 root));\n j", "val mt_verify_ok:\n #hsz:pos -> #f:MTS.hash_fun_t ->\n k:nat ->\n j:nat{k < j} ->\n p:path #hsz {S.length p = 1 + mt_path_length k j false} ->\n rt:hash #hsz ->\n Lemma (mt_verify #_ #f k j p rt <==>\n MTS.mt_verify #_ #f #(log2c j)\n (path_spec k j false (S.tail p)) k (MTS.HRaw (S.head p)) (MTS.HRaw rt))\nlet mt_verify_ok #_ #f k j p rt =\n mt_verify_ok_ #_ #f k j p 1 (S.head p) false", "val mt_get_path_acc_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t ->\n j:nat ->\n fhs:hashess #hsz {S.length fhs = log2c j} ->\n rhs:hashes #hsz {S.length rhs = log2c j} ->\n k:nat{k <= j} ->\n acc:hash -> actd:bool ->\n Lemma (requires (j > 0 /\\\n mt_hashes_lth_inv_log #hsz j fhs /\\\n mt_hashes_inv_log #_ #f j fhs /\\\n mt_rhs_inv #_ #f j (hash_seq_spec_full #_ #f (S.head fhs) acc actd) rhs actd))\n (ensures (S.equal (path_spec k j actd (mt_get_path_acc #_ #f j fhs rhs k actd))\n (MTS.mt_get_path #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd) k)))\n (decreases j)\nlet rec mt_get_path_acc_inv_ok #_ #f j fhs rhs k acc actd =\n // Below dummy `let` is necessary to provide guidance to the SMT solver.\n let _ = mt_get_path_step_acc j (S.head fhs) (S.head rhs) k actd in\n let smt = hash_seq_spec_full #_ #f (S.head fhs) acc actd in\n let nacc = (if j % 2 = 0 then acc\n else if actd\n then f (S.last (S.head fhs)) acc\n else S.last (S.head fhs)) in\n let nactd = actd || j % 2 = 1 in\n\n if j = 1 then (if k = 0 then () else ())\n else begin\n mt_hashes_lth_inv_log_next #_ #f j fhs;\n hash_seq_spec_full_next #_ #f j (S.head fhs) (S.head (S.tail fhs)) acc actd nacc nactd;\n mt_get_path_acc_inv_ok #_ #f (j / 2) (S.tail fhs) (S.tail rhs) (k / 2) nacc nactd;\n if k % 2 = 0\n then begin\n if k = j || (k + 1 = j && not actd)\n then assert (S.index smt (k + 1) == MTS.HPad)\n else if k + 1 = j\n then assert (S.index smt (k + 1) == MTS.HRaw (S.head rhs))\n else hash_seq_spec_full_index_raw #_ #f (S.head fhs) acc actd (k + 1)\n end\n else begin\n hash_seq_spec_full_index_raw #_ #f (S.head fhs) acc actd (k - 1)\n end\n end", "val mt_get_path_:\n #hsz:hash_size_t ->\n lv:uint32_t{lv <= merkle_tree_size_lg} ->\n mtr:HH.rid ->\n hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->\n rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->\n i:index_t -> j:index_t{i <= j /\\ U32.v j < pow2 (32 - U32.v lv)} ->\n k:index_t{i <= k && k <= j} ->\n p:path_p ->\n actd:bool ->\n HST.ST unit\n (requires (fun h0 ->\n HH.includes mtr (V.frameOf hs) /\\\n HH.includes mtr (V.frameOf rhs) /\\\n RV.rv_inv h0 hs /\\ RV.rv_inv h0 rhs /\\\n mt_safe_elts h0 lv hs i j /\\\n path_safe h0 mtr p /\\\n Path?.hash_size (B.get h0 p 0) = hsz /\\\n V.size_of (phashes h0 p) <= lv + 1ul))\n (ensures (fun h0 _ h1 ->\n // memory safety\n modifies (path_loc p) h0 h1 /\\\n path_safe h1 mtr p /\\\n V.size_of (phashes h1 p) ==\n V.size_of (phashes h0 p) + mt_path_length lv k j actd /\\\n // correctness\n (mt_safe_elts_spec h0 lv hs i j;\n (let hsz0 = Path?.hash_size (B.get h0 p 0) in\n let hsz1 = Path?.hash_size (B.get h1 p 0) in\n let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in \n let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in \n hsz = hsz0 /\\ hsz = hsz1 /\\\n S.equal after\n (MTH.mt_get_path_ (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)\n (U32.v i) (U32.v j) (U32.v k) before actd)))))\n (decreases (32 - U32.v lv))\nlet rec mt_get_path_ #hsz lv mtr hs rhs i j k p actd =\n let hh0 = HST.get () in\n mt_safe_elts_spec hh0 lv hs i j;\n\n let ofs = offset_of i in\n if j = 0ul then ()\n else\n (mt_make_path_step lv mtr hs rhs i j k p actd;\n\n let hh1 = HST.get () in\n mt_safe_elts_spec hh0 lv hs i j;\n assert (S.equal (lift_path hh1 mtr p)\n (MTH.mt_make_path_step\n (U32.v lv) (RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)\n (U32.v i) (U32.v j) (U32.v k)\n (lift_path hh0 mtr p) actd));\n\n RV.rv_inv_preserved hs (path_loc p) hh0 hh1;\n RV.rv_inv_preserved rhs (path_loc p) hh0 hh1;\n RV.as_seq_preserved hs (path_loc p) hh0 hh1;\n RV.as_seq_preserved rhs (path_loc p) hh0 hh1;\n V.loc_vector_within_included hs lv (V.size_of hs);\n mt_safe_elts_preserved lv hs i j (path_loc p) hh0 hh1;\n assert (mt_safe_elts hh1 lv hs i j);\n mt_safe_elts_rec hh1 lv hs i j;\n mt_safe_elts_spec hh1 (lv + 1ul) hs (i / 2ul) (j / 2ul);\n\n mt_get_path_ (lv + 1ul) mtr hs rhs (i / 2ul) (j / 2ul) (k / 2ul) p\n (if j % 2ul = 0ul then actd else true);\n\n let hh2 = HST.get () in\n assert (S.equal (lift_path hh2 mtr p)\n (MTH.mt_get_path_ (U32.v lv + 1)\n (RV.as_seq hh1 hs) (RV.as_seq hh1 rhs)\n (U32.v i / 2) (U32.v j / 2) (U32.v k / 2)\n (lift_path hh1 mtr p)\n (if U32.v j % 2 = 0 then actd else true)));\n assert (S.equal (lift_path hh2 mtr p)\n (MTH.mt_get_path_ (U32.v lv)\n (RV.as_seq hh0 hs) (RV.as_seq hh0 rhs)\n (U32.v i) (U32.v j) (U32.v k)\n (lift_path hh0 mtr p) actd)))", "val mt_get_path_acc_consistent:\n #hsz:pos -> #f:MTS.hash_fun_t ->\n lv:nat{lv <= 32} ->\n i:nat ->\n j:nat{i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs i j} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n k:nat{i <= k && k <= j} ->\n actd:bool ->\n Lemma (requires True)\n (ensures\n (log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n S.equal (mt_get_path_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j))\n (S.slice rhs lv (lv + log2c j)) k actd)\n (mt_get_path_ #_ lv hs rhs i j k S.empty actd)))\n (decreases j)\nlet rec mt_get_path_acc_consistent #hsz #f lv i j olds hs rhs k actd =\n log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n\n if j = 0 then ()\n else begin\n let nactd = if j % 2 = 0 then actd else true in\n let nactd_ = actd || j % 2 = 1 in\n assert (nactd == nactd_);\n\n let pa = mt_get_path_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j))\n (S.slice rhs lv (lv + log2c j)) k actd in\n let p = mt_get_path_ lv hs rhs i j k S.empty actd in\n\n log2c_div j; log2c_bound (j / 2) (32 - (lv + 1));\n assert (mt_hashes_lth_inv (lv + 1) (j / 2) (merge_hs #_ #f olds hs));\n assert (mt_hashes_lth_inv_log #hsz (j / 2)\n (S.slice (merge_hs #_ #f olds hs) (lv + 1) (lv + 1 + log2c (j / 2))));\n let npsa = mt_get_path_step_acc j\n (S.index (merge_hs #_ #f olds hs) lv) (S.index rhs lv) k actd in\n let npa = mt_get_path_acc #_ #f (j / 2)\n (S.slice (merge_hs #_ #f olds hs) (lv + 1) (lv + 1 + log2c (j / 2)))\n (S.slice rhs (lv + 1) (lv + 1 + log2c (j / 2))) (k / 2) nactd_ in\n let nps = mt_make_path_step lv hs rhs i j k S.empty actd in\n let np = mt_get_path_ (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) nps nactd in\n let npe = mt_get_path_ (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) S.empty nactd in\n mt_get_path_pull (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) nps nactd;\n assert (S.equal p np);\n assert (S.equal np (S.append nps npe));\n assert (S.equal p (S.append nps npe));\n assert (S.equal pa (if Some? npsa\n then S.cons (Some?.v npsa) npa\n else npa));\n\n mt_get_path_acc_consistent #_ #f (lv + 1) (i / 2) (j / 2)\n olds hs rhs (k / 2) nactd;\n assert (S.equal npa npe);\n\n mt_get_path_step_acc_consistent #_ #f lv i j olds hs rhs k actd;\n if Some? npsa\n then begin\n assert (S.equal nps (S.cons (Some?.v npsa) S.empty));\n assert (S.equal p (S.append (S.cons (Some?.v npsa) S.empty) npa));\n assert (S.equal pa (S.cons (Some?.v npsa) npa));\n seq_cons_append (Some?.v npsa) npa;\n assert (S.equal pa p)\n end\n else begin\n assert (S.equal nps S.empty);\n S.append_empty_l npe;\n assert (S.equal p npe);\n assert (S.equal pa npa);\n assert (S.equal pa p)\n end\n end", "val mt_get_root_inv_ok:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} -> drt:hash ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n Lemma (requires (mt_inv mt olds))\n (ensures (let nmt, rt = mt_get_root mt drt in\n // Only `MT?.rhs` and `MT?.mroot` are changed.\n MT?.i mt == MT?.i nmt /\\\n MT?.j mt == MT?.j nmt /\\\n MT?.hs mt == MT?.hs nmt /\\\n // A Merkle tree with new `MT?.rhs` and `MT?.mroot` is valid.\n mt_inv nmt olds /\\\n // A returned root is indeed the Merkle root.\n rt == MT?.mroot nmt))\nlet mt_get_root_inv_ok #hsz mt drt olds =\n if MT?.rhs_ok mt then ()\n else if MT?.j mt = 0 then ()\n else begin\n construct_rhs_base_inv_ok #_ #(MT?.hash_fun mt)\n (MT?.i mt) (MT?.j mt) olds (MT?.hs mt) (MT?.rhs mt)\n hash_init false;\n construct_rhs_init_ignored #_ #(MT?.hash_fun mt)\n 0 (MT?.hs mt) (MT?.rhs mt) (MT?.i mt) (MT?.j mt)\n hash_init drt\n end", "val mt_get_path_slice:\n #hsz:pos -> \n lv:nat{lv <= 32} ->\n hs:hashess #hsz {S.length hs = 32} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n i:nat ->\n j:nat{\n i <= j /\\ j < pow2 (32 - lv) /\\\n hs_wf_elts lv hs i j} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n actd:bool ->\n Lemma (requires True)\n (ensures S.equal (S.slice (mt_get_path_ lv hs rhs i j k p actd)\n (S.length p) (S.length p + mt_path_length k j actd))\n (mt_get_path_ lv hs rhs i j k S.empty actd))\n (decreases (32 - lv))\nlet mt_get_path_slice #hsz lv hs rhs i j k p actd =\n mt_get_path_pull lv hs rhs i j k p actd", "val mt_verify_ok_:\n #hsz:pos -> #f:MTS.hash_fun_t ->\n k:nat ->\n j:nat{k <= j} ->\n p:path ->\n ppos:nat ->\n acc:hash #hsz ->\n actd:bool ->\n Lemma (requires (ppos + mt_path_length k j actd <= S.length p))\n (ensures (MTS.HRaw (mt_verify_ #_ #f k j p ppos acc actd) ==\n MTS.mt_verify_ #_ #f #(log2c j)\n (path_spec k j actd\n (S.slice p ppos (ppos + mt_path_length k j actd)))\n k (MTS.HRaw acc)))\n (decreases j)\nlet rec mt_verify_ok_ #hsz #f k j p ppos acc actd =\n if j = 0 then ()\n else begin\n log2c_div j;\n let vi = mt_verify_ #_ #f k j p ppos acc actd in\n let plen = mt_path_length k j actd in\n let vs = MTS.mt_verify_ #_ #f #(log2c j)\n (path_spec k j actd (S.slice p ppos (ppos + plen)))\n k (MTS.HRaw acc) in\n let nactd = actd || (j % 2 = 1) in\n let nplen = mt_path_length (k / 2) (j / 2) nactd in\n\n if k % 2 = 0\n then begin\n if j = k || (j = k + 1 && not actd)\n then begin\n assert (vi == mt_verify_ #_ #f (k / 2) (j / 2) p ppos acc nactd);\n assert (plen == nplen);\n assert (S.equal (path_spec k j actd (S.slice p ppos (ppos + plen)))\n (S.cons MTS.HPad\n (path_spec (k / 2) (j / 2) nactd\n (S.slice p ppos (ppos + plen)))));\n assert (vs ==\n MTS.mt_verify_ #_ #f #(log2c (j / 2))\n (path_spec (k / 2) (j / 2) nactd (S.slice p ppos (ppos + plen)))\n (k / 2) (MTS.HRaw acc));\n mt_verify_ok_ #_ #f (k / 2) (j / 2) p ppos acc nactd\n end\n else begin\n let nacc = f acc (S.index p ppos) in\n assert (vi == mt_verify_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd);\n assert (plen == nplen + 1);\n assert (S.equal (S.tail (S.slice p ppos (ppos + plen)))\n (S.slice p (ppos + 1) (ppos + 1 + nplen)));\n assert (S.equal (path_spec k j actd (S.slice p ppos (ppos + plen)))\n (S.cons (MTS.HRaw (S.index p ppos))\n (path_spec (k / 2) (j / 2) nactd\n (S.slice p (ppos + 1) (ppos + 1 + nplen)))));\n assert (vs ==\n MTS.mt_verify_ #_ #f #(log2c (j / 2))\n (path_spec (k / 2) (j / 2) nactd\n (S.slice p (ppos + 1) (ppos + 1 + nplen)))\n (k / 2) (MTS.HRaw nacc));\n mt_verify_ok_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd\n end\n end\n else begin\n let nacc = f (S.index p ppos) acc in\n assert (vi == mt_verify_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd);\n assert (plen == 1 + nplen);\n assert (S.equal (S.tail (S.slice p ppos (ppos + plen)))\n (S.slice p (ppos + 1) (ppos + 1 + nplen)));\n assert (S.equal (path_spec k j actd (S.slice p ppos (ppos + plen)))\n (S.cons (MTS.HRaw (S.index p ppos))\n (path_spec (k / 2) (j / 2) nactd\n (S.slice p (ppos + 1) (ppos + 1 + nplen)))));\n assert (vs ==\n MTS.mt_verify_ #_ #f #(log2c (j / 2))\n (path_spec (k / 2) (j / 2) nactd\n (S.slice p (ppos + 1) (ppos + 1 + nplen)))\n (k / 2) (MTS.HRaw nacc));\n mt_verify_ok_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd\n end\n end", "val mt_get_path_pull:\n #hsz:pos -> \n lv:nat{lv <= 32} ->\n hs:hashess #hsz {S.length hs = 32} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n i:nat ->\n j:nat{\n i <= j /\\ j < pow2 (32 - lv) /\\\n hs_wf_elts lv hs i j} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n actd:bool ->\n Lemma (requires True)\n (ensures S.equal (mt_get_path_ lv hs rhs i j k p actd)\n (S.append p (mt_get_path_ lv hs rhs i j k S.empty actd)))\n (decreases (32 - lv))\nlet rec mt_get_path_pull #hsz lv hs rhs i j k p actd =\n let ofs = offset_of i in\n if j = 0 then ()\n else\n (let np = mt_make_path_step lv hs rhs i j k p actd in\n let nactd = if j % 2 = 0 then actd else true in\n mt_get_path_pull (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) np nactd;\n mt_get_path_pull (lv + 1) hs rhs (i / 2) (j / 2) (k / 2)\n (mt_make_path_step lv hs rhs i j k S.empty actd) nactd)", "val mt_get_path_acc:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat ->\n fhs:hashess #hsz {S.length fhs = log2c j /\\ mt_hashes_lth_inv_log #hsz j fhs} ->\n rhs:hashes #hsz {S.length rhs = log2c j} ->\n k:nat{k <= j} ->\n actd:bool ->\n GTot (np:path #hsz {S.length np = mt_path_length k j actd})\n (decreases j)\nlet rec mt_get_path_acc #_ #f j fhs rhs k actd =\n if j = 0 then S.empty\n else\n (let sp = mt_get_path_step_acc #_ j (S.head fhs) (S.head rhs) k actd in\n let rp = mt_get_path_acc #_ #f (j / 2) (S.tail fhs) (S.tail rhs) (k / 2)\n (actd || j % 2 = 1) in\n if Some? sp\n then (S.cons (Some?.v sp) rp)\n else rp)", "val mt_get_path:\n #hsz:pos -> #f:hash_fun_t #hsz -> #n:nat ->\n mt:merkle_tree #hsz n -> i:nat{i < pow2 n} -> GTot (path #hsz n)\nlet rec mt_get_path #hsz #f #n t i =\n if n = 0 then S.empty\n else S.cons\n (if i % 2 = 0 then t.[i + 1] else t.[i - 1])\n (mt_get_path #_ #f (mt_next_lv #_ #f t) (i / 2))", "val mt_get_path_unchanged:\n #hsz:pos -> \n lv:nat{lv <= 32} ->\n hs:hashess #hsz {S.length hs = 32} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n i:nat ->\n j:nat{\n i <= j /\\ j < pow2 (32 - lv) /\\\n hs_wf_elts #hsz lv hs i j} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n actd:bool ->\n Lemma (requires True)\n (ensures S.equal p (S.slice (mt_get_path_ lv hs rhs i j k p actd)\n 0 (S.length p)))\n (decreases (32 - lv))\nlet rec mt_get_path_unchanged #hsz lv hs rhs i j k p actd =\n let ofs = offset_of i in\n if j = 0 then ()\n else\n (let np = mt_make_path_step lv hs rhs i j k p actd in\n assert (S.equal p (S.slice np 0 (S.length p)));\n mt_get_path_unchanged (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) np\n (if j % 2 = 0 then actd else true))", "val mt_make_path_step:\n #hsz:hash_size_t ->\n lv:uint32_t{lv <= merkle_tree_size_lg} ->\n mtr:HH.rid ->\n hs:hash_vv hsz {V.size_of hs = merkle_tree_size_lg} ->\n rhs:hash_vec #hsz {V.size_of rhs = merkle_tree_size_lg} ->\n i:index_t ->\n j:index_t{j <> 0ul /\\ i <= j /\\ U32.v j < pow2 (32 - U32.v lv)} ->\n k:index_t{i <= k && k <= j} ->\n p:path_p ->\n actd:bool ->\n HST.ST unit\n (requires (fun h0 ->\n HH.includes mtr (V.frameOf hs) /\\\n HH.includes mtr (V.frameOf rhs) /\\\n RV.rv_inv h0 hs /\\ RV.rv_inv h0 rhs /\\\n mt_safe_elts h0 lv hs i j /\\\n path_safe h0 mtr p /\\\n Path?.hash_size (B.get h0 p 0) = hsz /\\\n V.size_of (phashes h0 p) <= lv + 1ul))\n (ensures (fun h0 _ h1 ->\n // memory safety\n modifies (path_loc p) h0 h1 /\\\n path_safe h1 mtr p /\\\n V.size_of (phashes h1 p) == V.size_of (phashes h0 p) + mt_path_length_step k j actd /\\\n V.size_of (phashes h1 p) <= lv + 2ul /\\\n // correctness\n (mt_safe_elts_spec h0 lv hs i j;\n (let hsz0 = Path?.hash_size (B.get h0 p 0) in\n let hsz1 = Path?.hash_size (B.get h1 p 0) in\n let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in \n let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in \n hsz = hsz0 /\\ hsz = hsz1 /\\\n S.equal after\n (MTH.mt_make_path_step\n (U32.v lv) (RV.as_seq h0 hs) (RV.as_seq h0 rhs)\n (U32.v i) (U32.v j) (U32.v k) before actd)))))\nlet mt_make_path_step #hsz lv mtr hs rhs i j k p actd =\n let pth = !*p in\n let hh0 = HST.get () in\n let ofs = offset_of i in\n if k % 2ul = 1ul\n then begin\n hash_vv_rv_inv_includes hh0 hs lv (k - 1ul - ofs);\n assert (HH.includes mtr\n (B.frameOf (V.get hh0 (V.get hh0 hs lv) (k - 1ul - ofs))));\n assert(Path?.hash_size pth = hsz);\n mt_path_insert #hsz mtr p (V.index (V.index hs lv) (k - 1ul - ofs))\n end\n else begin\n if k = j then ()\n else if k + 1ul = j\n then (if actd\n then (assert (HH.includes mtr (B.frameOf (V.get hh0 rhs lv)));\n mt_path_insert mtr p (V.index rhs lv)))\n else (hash_vv_rv_inv_includes hh0 hs lv (k + 1ul - ofs);\n assert (HH.includes mtr\n (B.frameOf (V.get hh0 (V.get hh0 hs lv) (k + 1ul - ofs))));\n mt_path_insert mtr p (V.index (V.index hs lv) (k + 1ul - ofs)))\n end", "val mt_verify:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n k:nat ->\n j:nat{k < j} ->\n p:path #hsz {S.length p = 1 + mt_path_length k j false} ->\n rt:hash #hsz ->\n GTot prop\nlet mt_verify #_ #f k j p rt =\n let crt = mt_verify_ #_ #f k j p 1 (S.index p 0) false in\n crt == rt", "val mt_get_path_step_acc:\n #hsz:pos ->\n j:nat{j > 0} ->\n chs:hashes #hsz {S.length chs = j} ->\n crh:hash #hsz ->\n k:nat{k <= j} ->\n actd:bool ->\n GTot (option (hash #hsz))\nlet mt_get_path_step_acc #hsz j chs crh k actd =\n if k % 2 = 1\n then Some (S.index chs (k - 1))\n else (if k = j then None\n else if k + 1 = j\n\t then (if actd then Some crh else None)\n\t else Some (S.index chs (k + 1)))", "val mt_verify_:\n #hsz:hash_size_t ->\n #hash_spec:MTS.hash_fun_t #(U32.v hsz) ->\n k:index_t ->\n j:index_t{k <= j} ->\n mtr:HH.rid ->\n p:const_path_p ->\n ppos:uint32_t ->\n acc:hash #hsz ->\n actd:bool ->\n hash_fun:hash_fun_t #hsz #hash_spec ->\n HST.ST unit\n (requires (fun h0 ->\n let p = CB.cast p in\n path_safe h0 mtr p /\\ Rgl?.r_inv (hreg hsz) h0 acc /\\\n Path?.hash_size (B.get h0 p 0) = hsz /\\\n HH.disjoint (B.frameOf p) (B.frameOf acc) /\\\n HH.disjoint mtr (B.frameOf acc) /\\\n // Below is a very relaxed condition,\n // but sufficient to ensure (+) for uint32_t is sound.\n ppos <= 64ul - mt_path_length 0ul k j actd /\\\n ppos + mt_path_length 0ul k j actd <= V.size_of (phashes h0 p)))\n (ensures (fun h0 _ h1 ->\n let p = CB.cast p in \n // memory safety\n modifies (B.loc_all_regions_from false (B.frameOf acc)) h0 h1 /\\\n Rgl?.r_inv (hreg hsz) h1 acc /\\\n // correctness\n Rgl?.r_repr (hreg hsz) h1 acc ==\n MTH.mt_verify_ #(U32.v hsz) #hash_spec (U32.v k) (U32.v j) (lift_path h0 mtr p)\n (U32.v ppos) (Rgl?.r_repr (hreg hsz) h0 acc) actd))\nlet rec mt_verify_ #hsz #hash_spec k j mtr p ppos acc actd hash_fun =\n let ncp:path_p = CB.cast p in\n let hh0 = HST.get () in\n if j = 0ul then ()\n else (let nactd = actd || (j % 2ul = 1ul) in\n if k % 2ul = 0ul then begin\n if j = k || (j = k + 1ul && not actd) then\n mt_verify_ (k / 2ul) (j / 2ul) mtr p ppos acc nactd hash_fun\n else begin\n let ncpd = !*ncp in\n let phash = V.index (Path?.hashes ncpd) ppos in\n hash_fun acc phash acc;\n let hh1 = HST.get () in\n path_preserved mtr ncp\n (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;\n lift_path_index hh0 mtr ncp ppos;\n assert (Rgl?.r_repr (hreg hsz) hh1 acc ==\n hash_spec (Rgl?.r_repr (hreg hsz) hh0 acc)\n (S.index (lift_path #hsz hh0 mtr ncp) (U32.v ppos)));\n mt_verify_ (k / 2ul) (j / 2ul) mtr p (ppos + 1ul) acc nactd hash_fun\n end\n end\n else begin\n let ncpd = !*ncp in\n let phash = V.index (Path?.hashes ncpd) ppos in\n hash_fun phash acc acc;\n let hh1 = HST.get () in\n path_preserved mtr ncp\n (B.loc_all_regions_from false (B.frameOf acc)) hh0 hh1;\n lift_path_index hh0 mtr ncp ppos;\n assert (Rgl?.r_repr (hreg hsz) hh1 acc ==\n hash_spec (S.index (lift_path #hsz hh0 mtr ncp) (U32.v ppos))\n (Rgl?.r_repr (hreg hsz) hh0 acc));\n mt_verify_ (k / 2ul) (j / 2ul) mtr p (ppos + 1ul) acc nactd hash_fun\n end)", "val mt_get_path_pre:\n #hsz:Ghost.erased hash_size_t ->\n mt:const_mt_p ->\n idx:offset_t ->\n p:const_path_p ->\n root:hash #hsz ->\n HST.ST bool\n (requires (fun h0 ->\n let mt = CB.cast mt in\n let p = CB.cast p in\n let dmt = B.get h0 mt 0 in\n let dp = B.get h0 p 0 in\n MT?.hash_size dmt = (Ghost.reveal hsz) /\\\n Path?.hash_size dp = (Ghost.reveal hsz) /\\\n mt_safe h0 mt /\\\n path_safe h0 (B.frameOf mt) p /\\ \n Rgl?.r_inv (hreg hsz) h0 root /\\\n HH.disjoint (B.frameOf root) (B.frameOf mt) /\\\n HH.disjoint (B.frameOf root) (B.frameOf p)))\n (ensures (fun _ _ _ -> True))\nlet mt_get_path_pre #_ mt idx p root =\n let mt = CB.cast mt in\n let p = CB.cast p in\n let mtv = !*mt in\n mt_get_path_pre_nst mtv idx !*p root", "val mt_get_path_:\n #hsz:pos -> \n lv:nat{lv <= 32} ->\n hs:hashess #hsz {S.length hs = 32} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n i:nat ->\n j:nat{\n i <= j /\\ j < pow2 (32 - lv) /\\\n hs_wf_elts lv hs i j} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n actd:bool ->\n GTot (np:path #hsz {S.length np = S.length p + mt_path_length k j actd})\n (decreases (32 - lv))\nlet rec mt_get_path_ #hsz lv hs rhs i j k p actd =\n let ofs = offset_of i in\n if j = 0 then p\n else\n (let np = mt_make_path_step lv hs rhs i j k p actd in\n mt_get_path_ (lv + 1) hs rhs (i / 2) (j / 2) (k / 2) np\n \t\t (if j % 2 = 0 then actd else true))", "val construct_rhs_base_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n i:nat -> j:nat{j > 0 /\\ i <= j /\\ j < pow2 32} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts 0 hs i j} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n acc:hash #hsz ->\n actd:bool ->\n Lemma (requires (mt_olds_hs_lth_inv_ok #_ #f 0 i j olds hs;\n mt_hashes_inv #_ #f 0 j (merge_hs #_ #f olds hs)))\n (ensures (log2c_bound j 32;\n mt_olds_hs_lth_inv_ok #_ #f 0 i j olds hs;\n (let crhs = construct_rhs #_ #f 0 hs rhs i j acc actd in\n mt_rhs_inv #_ #f j\n (hash_seq_spec_full #_ #f (S.head (merge_hs #_ #f olds hs)) acc actd)\n (S.slice (fst crhs) 0 (log2c j)) actd /\\\n MTS.mt_get_root #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head (merge_hs #_ #f olds hs)) acc actd) ==\n MTS.HRaw (snd crhs))))\nlet construct_rhs_base_inv_ok #hsz #f i j olds hs rhs acc actd =\n construct_rhs_inv_ok #_ #f 0 i j olds hs rhs acc actd", "val construct_rhs_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n i:nat ->\n j:nat{j > 0 /\\ i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs i j} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n acc:hash #hsz ->\n actd:bool ->\n Lemma (requires (mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_inv #_ #f lv j (merge_hs #_ #f olds hs)))\n (ensures (log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n (let crhs = construct_rhs #_ #f lv hs rhs i j acc actd in\n mt_rhs_inv #_ #f j\n (hash_seq_spec_full #_ #f (S.index (merge_hs #_ #f olds hs) lv) acc actd)\n (S.slice (fst crhs) lv (lv + log2c j)) actd /\\\n MTS.mt_get_root #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.index (merge_hs #_ #f olds hs) lv) acc actd) ==\n MTS.HRaw (snd crhs))))\nlet construct_rhs_inv_ok #hsz #f lv i j olds hs rhs acc actd =\n log2c_div j; log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n mt_hashes_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n let crhs = construct_rhs #_ #f lv hs rhs i j acc actd in\n let crhsf = construct_rhs_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd in\n construct_rhs_acc_consistent #_ #f lv i j olds hs rhs acc actd;\n construct_rhs_acc_inv_ok #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd;\n rhs_equiv_inv_preserved #_ #f j\n (hash_seq_spec_full #_ #f (S.index (merge_hs #_ #f olds hs) lv) acc actd)\n (fst crhsf) (S.slice (fst crhs) lv (lv + log2c j)) actd", "val mt_make_path_step:\n #hsz:pos -> \n lv:nat{lv <= 32} ->\n hs:hashess #hsz {S.length hs = 32} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n i:nat ->\n j:nat{\n j <> 0 /\\ i <= j /\\ j < pow2 (32 - lv) /\\\n hs_wf_elts lv hs i j} ->\n k:nat{i <= k && k <= j} ->\n p:path #hsz ->\n actd:bool ->\n GTot (path #hsz)\nlet mt_make_path_step #hsz lv hs rhs i j k p actd =\n let ofs = offset_of i in\n if k % 2 = 1\n then path_insert p (S.index (S.index hs lv) (k - 1 - ofs))\n else (if k = j then p\n else if k + 1 = j\n\t then (if actd\n\t\t then path_insert p (S.index rhs lv)\n\t\t else p)\n\t else path_insert p (S.index (S.index hs lv) (k + 1 - ofs)))", "val mt_get_path\n (#h: HS.mem)\n (mt: const_mt_p)\n (idx: offset_t)\n (path: path_p{path_hash_size #h path = const_tree_hash_size #h mt})\n (root: hash #(path_hash_size #h path))\n : HST.ST index_t pf pt\nlet mt_get_path\n (#h:HS.mem)\n (mt:const_mt_p)\n (idx:offset_t)\n (path:path_p{path_hash_size #h path = const_tree_hash_size #h mt})\n (root:hash #(path_hash_size #h path))\n: HST.ST index_t pf pt\n= let hash_size = MTNL.MT?.hash_size (B.index (CB.cast mt) 0ul) in\n MTNL.mt_get_path #hash_size mt idx path root", "val mt_verify_:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n k:nat ->\n j:nat{k <= j} ->\n p:path #hsz ->\n ppos:nat ->\n acc:hash #hsz ->\n actd:bool{ppos + mt_path_length k j actd <= S.length p} ->\n GTot (hash #hsz)\nlet rec mt_verify_ #hsz #f k j p ppos acc actd =\n if j = 0 then acc\n else (let nactd = actd || (j % 2 = 1) in\n if k % 2 = 0\n then (if j = k || (j = k + 1 && not actd)\n\t then mt_verify_ #_ #f (k / 2) (j / 2) p ppos acc nactd\n\t else (let nacc = f acc (S.index p ppos) in\n\t\t mt_verify_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd))\n else (let nacc = f (S.index p ppos) acc in\n\t mt_verify_ #_ #f (k / 2) (j / 2) p (ppos + 1) nacc nactd))", "val construct_rhs_acc_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 0} ->\n fhs:hashess #hsz {\n S.length fhs = log2c j /\\\n mt_hashes_lth_inv_log #hsz j fhs /\\\n mt_hashes_inv_log #_ #f j fhs} ->\n acc:hash #hsz ->\n actd:bool ->\n Lemma (requires True)\n (ensures (let crhs = construct_rhs_acc #_ #f j fhs acc actd in\n mt_rhs_inv #_ #f j\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd)\n (fst crhs) actd /\\\n MTS.mt_get_root #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd) ==\n MTS.HRaw (snd crhs)))\n (decreases j)\nlet rec construct_rhs_acc_inv_ok #hsz #f j fhs acc actd =\n if j = 1 then \n construct_rhs_acc_inv_ok_0 #_ #f fhs acc actd\n else if j % 2 = 0 then begin\n construct_rhs_acc_inv_ok #_ #f (j / 2) (S.tail fhs) acc actd;\n let rcrhs = construct_rhs_acc #_ #f (j / 2) (S.tail fhs) acc actd in\n assert (mt_rhs_inv #_ #f (j / 2)\n (hash_seq_spec_full #_ #f (S.head (S.tail fhs)) acc actd)\n (fst rcrhs) actd);\n assert (MTS.mt_get_root #_ #f #(log2c j - 1)\n (hash_seq_spec_full #_ #f (S.head (S.tail fhs)) acc actd) ==\n MTS.HRaw (snd rcrhs));\n\n let crhs = (S.cons hash_init (fst rcrhs), snd rcrhs) in\n mt_hashes_lth_inv_log_next #_ #f j fhs;\n hash_seq_spec_full_even_next #_ #f \n j (S.head fhs) (S.head (S.tail fhs)) acc actd;\n assert (mt_rhs_inv #_ #f (j / 2)\n (MTS.mt_next_lv #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd))\n (fst rcrhs) actd);\n\n assert (mt_rhs_inv #_ #f j\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd)\n (fst crhs) actd);\n assert (MTS.mt_get_root #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd) ==\n MTS.HRaw (snd rcrhs))\n end\n\n else begin\n let rhd = if actd then acc else hash_init #hsz in\n let nacc = if actd\n then f (S.last (S.head fhs)) acc\n else S.last (S.head fhs) in\n construct_rhs_acc_inv_ok #_ #f (j / 2) (S.tail fhs) nacc true;\n let rcrhs = construct_rhs_acc #_ #f (j / 2) (S.tail fhs) nacc true in\n assert (mt_rhs_inv #_ #f (j / 2)\n (hash_seq_spec_full #_ #f (S.head (S.tail fhs)) nacc true)\n (fst rcrhs) true);\n assert (MTS.mt_get_root #_ #f #(log2c j - 1)\n (hash_seq_spec_full #_ #f (S.head (S.tail fhs)) nacc true) ==\n MTS.HRaw (snd rcrhs));\n\n let crhs = (S.cons rhd (fst rcrhs), snd rcrhs) in\n mt_hashes_lth_inv_log_next #_ #f j fhs;\n hash_seq_spec_full_odd_next #_ #f \n j (S.head fhs) (S.head (S.tail fhs)) acc actd nacc;\n (if actd then hash_seq_spec_full_case_true #_ #f (S.head fhs) acc);\n assert (if actd\n then (S.index (hash_seq_spec_full #_ #f (S.head fhs) acc actd) j ==\n MTS.HRaw rhd)\n else true);\n assert (mt_rhs_inv #_ #f (j / 2)\n (MTS.mt_next_lv #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd))\n (fst rcrhs) true);\n\n assert (mt_rhs_inv #_ #f j\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd)\n (fst crhs) actd);\n assert (MTS.mt_get_root #_ #f #(log2c j)\n (hash_seq_spec_full #_ #f (S.head fhs) acc actd) ==\n MTS.HRaw (snd crhs))\n end", "val mt_get_path_pre\n (#h: HS.mem)\n (mt: const_mt_p)\n (idx: offset_t)\n (path: const_path_p{const_path_hash_size #h path = const_tree_hash_size #h mt})\n (root: hash #(const_path_hash_size #h path))\n : HST.ST bool pf pt\nlet mt_get_path_pre\n (#h:HS.mem)\n (mt:const_mt_p)\n (idx:offset_t)\n (path:const_path_p{const_path_hash_size #h path = const_tree_hash_size #h mt})\n (root:hash #(const_path_hash_size #h path))\n: HST.ST bool pf pt\n= let hash_size = MTNL.MT?.hash_size (B.index (CB.cast mt) 0ul) in\n MTNL.mt_get_path_pre #hash_size mt idx path root", "val lift_path_index:\n h:HS.mem -> mtr:HH.rid ->\n p:path_p -> i:uint32_t ->\n Lemma (requires (path_safe h mtr p /\\\n i < V.size_of (phashes h p)))\n (ensures (let hsz = Path?.hash_size (B.get h p 0) in\n Rgl?.r_repr (hreg hsz) h (V.get h (phashes h p) i) ==\n S.index (lift_path #(hsz) h mtr p) (U32.v i)))\nlet lift_path_index h mtr p i =\n lift_path_index_ h (V.as_seq h (phashes h p))\n 0 (S.length (V.as_seq h (phashes h p))) (U32.v i)", "val mt_path_insert:\n #hsz:hash_size_t ->\n mtr:HH.rid -> p:path_p -> hp:hash #hsz ->\n HST.ST unit\n (requires (fun h0 ->\n path_safe h0 mtr p /\\\n not (V.is_full (phashes h0 p)) /\\\n Rgl?.r_inv (hreg hsz) h0 hp /\\\n HH.disjoint mtr (B.frameOf p) /\\\n HH.includes mtr (B.frameOf hp) /\\\n Path?.hash_size (B.get h0 p 0) = hsz))\n (ensures (fun h0 _ h1 -> \n // memory safety\n modifies (path_loc p) h0 h1 /\\\n path_safe h1 mtr p /\\ \n // correctness\n (let hsz0 = Path?.hash_size (B.get h0 p 0) in\n let hsz1 = Path?.hash_size (B.get h1 p 0) in\n (let before:(S.seq (MTH.hash #(U32.v hsz0))) = lift_path h0 mtr p in \n let after:(S.seq (MTH.hash #(U32.v hsz1))) = lift_path h1 mtr p in\n V.size_of (phashes h1 p) = V.size_of (phashes h0 p) + 1ul /\\\n hsz = hsz0 /\\ hsz = hsz1 /\\ \n (let hspec:(S.seq (MTH.hash #(U32.v hsz))) = (MTH.path_insert #(U32.v hsz) before (Rgl?.r_repr (hreg hsz) h0 hp)) in\n S.equal hspec after)))))\nlet mt_path_insert #hsz mtr p hp = \n let pth = !*p in\n let pv = Path?.hashes pth in\n let hh0 = HST.get () in\n let ipv = V.insert pv hp in\n let hh1 = HST.get () in\n path_safe_preserved_\n mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))\n (B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;\n path_preserved_\n mtr (V.as_seq hh0 pv) 0 (S.length (V.as_seq hh0 pv))\n (B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;\n Rgl?.r_sep (hreg hsz) hp\n (B.loc_all_regions_from false (V.frameOf ipv)) hh0 hh1;\n p *= Path hsz ipv;\n let hh2 = HST.get () in\n path_safe_preserved_\n mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))\n (B.loc_region_only false (B.frameOf p)) hh1 hh2;\n path_preserved_\n mtr (V.as_seq hh1 ipv) 0 (S.length (V.as_seq hh1 ipv))\n (B.loc_region_only false (B.frameOf p)) hh1 hh2;\n Rgl?.r_sep (hreg hsz) hp\n (B.loc_region_only false (B.frameOf p)) hh1 hh2;\n assert (S.equal (lift_path hh2 mtr p)\n (lift_path_ hh1 (S.snoc (V.as_seq hh0 pv) hp)\n 0 (S.length (V.as_seq hh1 ipv))));\n lift_path_eq hh1 (S.snoc (V.as_seq hh0 pv) hp) (V.as_seq hh0 pv)\n 0 (S.length (V.as_seq hh0 pv))", "val mt_get_root:\n #hsz:Ghost.erased hash_size_t ->\n mt:const_mt_p ->\n rt:hash #hsz ->\n HST.ST unit\n (requires (fun h0 ->\n let mt = CB.cast mt in\n let dmt = B.get h0 mt 0 in\n MT?.hash_size dmt = (Ghost.reveal hsz) /\\\n mt_get_root_pre_nst dmt rt /\\\n mt_safe h0 mt /\\ Rgl?.r_inv (hreg hsz) h0 rt /\\\n HH.disjoint (B.frameOf mt) (B.frameOf rt)))\n (ensures (fun h0 _ h1 ->\n let mt = CB.cast mt in\n // memory safety\n modifies (loc_union\n (mt_loc mt)\n (B.loc_all_regions_from false (B.frameOf rt)))\n h0 h1 /\\\n mt_safe h1 mt /\\\n (let mtv0 = B.get h0 mt 0 in\n let mtv1 = B.get h1 mt 0 in\n MT?.hash_size mtv0 = (Ghost.reveal hsz) /\\\n MT?.hash_size mtv1 = (Ghost.reveal hsz) /\\\n MT?.i mtv1 = MT?.i mtv0 /\\ MT?.j mtv1 = MT?.j mtv0 /\\\n MT?.hs mtv1 == MT?.hs mtv0 /\\ MT?.rhs mtv1 == MT?.rhs mtv0 /\\\n MT?.offset mtv1 == MT?.offset mtv0 /\\\n MT?.rhs_ok mtv1 = true /\\\n Rgl?.r_inv (hreg hsz) h1 rt /\\\n // correctness\n MTH.mt_get_root (mt_lift h0 mt) (Rgl?.r_repr (hreg hsz) h0 rt) ==\n (mt_lift h1 mt, Rgl?.r_repr (hreg hsz) h1 rt))))\nlet mt_get_root #hsz mt rt =\n let mt = CB.cast mt in\n let hh0 = HST.get () in\n let mtv = !*mt in\n let prefix = MT?.offset mtv in\n let i = MT?.i mtv in\n let j = MT?.j mtv in\n let hs = MT?.hs mtv in\n let rhs = MT?.rhs mtv in\n let mroot = MT?.mroot mtv in\n let hash_size = MT?.hash_size mtv in\n let hash_spec = MT?.hash_spec mtv in\n let hash_fun = MT?.hash_fun mtv in\n if MT?.rhs_ok mtv\n then begin\n Cpy?.copy (hcpy hash_size) hash_size mroot rt;\n let hh1 = HST.get () in\n mt_safe_preserved mt\n (B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;\n mt_preserved mt\n (B.loc_all_regions_from false (Rgl?.region_of (hreg hsz) rt)) hh0 hh1;\n MTH.mt_get_root_rhs_ok_true\n (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);\n assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==\n (mt_lift hh1 mt, Rgl?.r_repr (hreg hsz) hh1 rt))\n end\n else begin\n construct_rhs #hash_size #hash_spec 0ul hs rhs i j rt false hash_fun;\n let hh1 = HST.get () in\n // memory safety\n assert (RV.rv_inv hh1 rhs);\n assert (Rgl?.r_inv (hreg hsz) hh1 rt);\n assert (B.live hh1 mt);\n RV.rv_inv_preserved\n hs (loc_union\n (RV.loc_rvector rhs)\n (B.loc_all_regions_from false (B.frameOf rt)))\n hh0 hh1;\n RV.as_seq_preserved\n hs (loc_union\n (RV.loc_rvector rhs)\n (B.loc_all_regions_from false (B.frameOf rt)))\n hh0 hh1;\n V.loc_vector_within_included hs 0ul (V.size_of hs);\n mt_safe_elts_preserved 0ul hs i j\n (loc_union\n (RV.loc_rvector rhs)\n (B.loc_all_regions_from false (B.frameOf rt)))\n hh0 hh1;\n\n // correctness\n mt_safe_elts_spec hh0 0ul hs i j;\n assert (MTH.construct_rhs #(U32.v hash_size) #hash_spec 0\n (Rgl?.r_repr (hvvreg hsz) hh0 hs)\n (Rgl?.r_repr (hvreg hsz) hh0 rhs)\n (U32.v i) (U32.v j)\n (Rgl?.r_repr (hreg hsz) hh0 rt) false ==\n (Rgl?.r_repr (hvreg hsz) hh1 rhs, Rgl?.r_repr (hreg hsz) hh1 rt));\n\n Cpy?.copy (hcpy hash_size) hash_size rt mroot;\n let hh2 = HST.get () in\n // memory safety\n RV.rv_inv_preserved\n hs (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n RV.rv_inv_preserved\n rhs (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n RV.as_seq_preserved\n hs (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n RV.as_seq_preserved\n rhs (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n B.modifies_buffer_elim\n rt (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n mt_safe_elts_preserved 0ul hs i j\n (B.loc_all_regions_from false (B.frameOf mroot))\n hh1 hh2;\n\n // correctness\n assert (Rgl?.r_repr (hreg hsz) hh2 mroot == Rgl?.r_repr (hreg hsz) hh1 rt);\n\n mt *= MT hash_size prefix i j hs true rhs mroot hash_spec hash_fun;\n let hh3 = HST.get () in\n // memory safety\n Rgl?.r_sep (hreg hsz) rt (B.loc_buffer mt) hh2 hh3;\n RV.rv_inv_preserved hs (B.loc_buffer mt) hh2 hh3;\n RV.rv_inv_preserved rhs (B.loc_buffer mt) hh2 hh3;\n RV.as_seq_preserved hs (B.loc_buffer mt) hh2 hh3;\n RV.as_seq_preserved rhs (B.loc_buffer mt) hh2 hh3;\n Rgl?.r_sep (hreg hsz) mroot (B.loc_buffer mt) hh2 hh3;\n mt_safe_elts_preserved 0ul hs i j\n (B.loc_buffer mt) hh2 hh3;\n assert (mt_safe hh3 mt);\n\n // correctness\n MTH.mt_get_root_rhs_ok_false\n (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt);\n assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==\n (MTH.MT #(U32.v hash_size)\n (U32.v i) (U32.v j)\n (RV.as_seq hh0 hs)\n true\n (RV.as_seq hh1 rhs)\n (Rgl?.r_repr (hreg hsz) hh1 rt)\n hash_spec,\n Rgl?.r_repr (hreg hsz) hh1 rt));\n assert (MTH.mt_get_root (mt_lift hh0 mt) (Rgl?.r_repr (hreg hsz) hh0 rt) ==\n (mt_lift hh3 mt, Rgl?.r_repr (hreg hsz) hh3 rt))\n end", "val lift_path_eq:\n #hsz:hash_size_t ->\n h:HS.mem ->\n hs1:S.seq (hash #hsz) -> hs2:S.seq (hash #hsz) ->\n i:nat -> j:nat ->\n Lemma (requires (i <= j /\\ j <= S.length hs1 /\\ j <= S.length hs2 /\\\n S.equal (S.slice hs1 i j) (S.slice hs2 i j) /\\\n V.forall_seq hs1 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp) /\\\n V.forall_seq hs2 i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))\n (ensures (S.equal (lift_path_ h hs1 i j) (lift_path_ h hs2 i j)))\nlet lift_path_eq #hsz h hs1 hs2 i j =\n assert (forall (k:nat{i <= k && k < j}).\n S.index (lift_path_ h hs1 i j) (k - i) ==\n Rgl?.r_repr (hreg hsz) h (S.index hs1 k));\n assert (forall (k:nat{i <= k && k < j}).\n S.index (lift_path_ h hs2 i j) (k - i) ==\n Rgl?.r_repr (hreg hsz) h (S.index hs2 k));\n assert (forall (k:nat{k < j - i}).\n S.index (lift_path_ h hs1 i j) k ==\n Rgl?.r_repr (hreg hsz) h (S.index hs1 (k + i)));\n assert (forall (k:nat{k < j - i}).\n S.index (lift_path_ h hs2 i j) k ==\n Rgl?.r_repr (hreg hsz) h (S.index hs2 (k + i)));\n assert (forall (k:nat{k < j - i}).\n S.index (S.slice hs1 i j) k == S.index (S.slice hs2 i j) k);\n assert (forall (k:nat{i <= k && k < j}).\n S.index (S.slice hs1 i j) (k - i) == S.index (S.slice hs2 i j) (k - i))", "val mt_get_root_step: #hsz:pos -> #f:hash_fun_t #hsz -> #n:pos -> mt:merkle_tree #hsz n ->\n Lemma (mt_get_root #_ #f mt ==\n padded_hash_fun #_ f (mt_get_root #_ #f (mt_left mt)) (mt_get_root #_ #f (mt_right mt)))\nlet rec mt_get_root_step #hsz #f #n mt =\n if n = 1 then ()\n else begin\n mt_get_root_step #_ #f (mt_next_lv #_ #f mt);\n mt_next_lv_mt_left #_ #f mt;\n mt_next_lv_mt_right #_ #f mt\n end", "val mt_verify:\n #hsz:Ghost.erased hash_size_t ->\n #hash_spec:MTS.hash_fun_t #(U32.v hsz) ->\n mt:const_mt_p ->\n k:uint64_t ->\n j:uint64_t ->\n mtr:HH.rid ->\n p:const_path_p ->\n rt:hash #hsz ->\n HST.ST bool\n (requires (fun h0 ->\n let mt = CB.cast mt in\n let p = CB.cast p in\n let mtv0 = B.get h0 mt 0 in\n MT?.hash_size mtv0 = Ghost.reveal hsz /\\\n Path?.hash_size (B.get h0 p 0) = Ghost.reveal hsz /\\\n Ghost.reveal (MT?.hash_spec mtv0) == hash_spec /\\\n mt_safe h0 mt /\\\n path_safe h0 mtr p /\\ Rgl?.r_inv (hreg hsz) h0 rt /\\\n HST.is_eternal_region (B.frameOf rt) /\\\n HH.disjoint (B.frameOf p) (B.frameOf rt) /\\\n HH.disjoint mtr (B.frameOf rt) /\\\n mt_verify_pre_nst (B.get h0 mt 0) k j (B.get h0 p 0) rt))\n (ensures (fun h0 b h1 ->\n let mt = CB.cast mt in\n let p = CB.cast p in\n let mtv0 = B.get h0 mt 0 in\n let mtv1 = B.get h1 mt 0 in\n MT?.hash_size mtv0 = Ghost.reveal hsz /\\\n MT?.hash_size mtv1 = Ghost.reveal hsz /\\ \n // memory safety:\n // `rt` is not modified in this function, but we use a trick\n // to allocate an auxiliary buffer in the extended region of `rt`.\n modifies (B.loc_all_regions_from false (B.frameOf rt)) h0 h1 /\\\n Rgl?.r_inv (hreg hsz) h1 rt /\\\n // correctness\n S.equal (Rgl?.r_repr (hreg hsz) h0 rt) (Rgl?.r_repr (hreg hsz) h1 rt) /\\\n (let mtv = B.get h0 mt 0 in\n let k = split_offset (MT?.offset mtv) k in\n let j = split_offset (MT?.offset mtv) j in\n b <==> MTH.mt_verify #(U32.v hsz) #hash_spec (U32.v k) (U32.v j)\n (lift_path h0 mtr p) (Rgl?.r_repr (hreg hsz) h0 rt))))\nlet mt_verify #_ #hash_spec mt k j mtr p rt =\n let ncmt = CB.cast mt in\n let ncp = CB.cast p in\n let mtv = !*ncmt in\n let hash_size = MT?.hash_size mtv in\n let hrg = hreg hash_size in\n let k = split_offset (MT?.offset mtv) k in\n let j = split_offset (MT?.offset mtv) j in\n let hh0 = HST.get () in\n let nrid = HST.new_region (B.frameOf rt) in\n let ih = rg_alloc hrg nrid in\n let pth = !*ncp in\n assert (MT?.hash_size mtv = hash_size);\n assert (Path?.hash_size pth = hash_size);\n let first = V.index (Path?.hashes pth) 0ul in\n Cpy?.copy (hcpy hash_size) hash_size first ih;\n let hh1 = HST.get () in\n path_safe_preserved\n mtr ncp (B.loc_all_regions_from false (B.frameOf rt)) hh0 hh1;\n path_preserved mtr ncp (B.loc_all_regions_from false (B.frameOf rt)) hh0 hh1;\n lift_path_index hh0 mtr ncp 0ul;\n assert (Rgl?.r_repr hrg hh1 ih == S.index (lift_path #hash_size hh0 mtr ncp) 0);\n mt_verify_ #hash_size #hash_spec k j mtr p 1ul ih false (MT?.hash_fun mtv);\n let hh2 = HST.get () in\n assert (Rgl?.r_repr hrg hh2 ih ==\n MTH.mt_verify_ #(U32.v hash_size) #hash_spec (U32.v k) (U32.v j) (lift_path hh1 mtr ncp)\n 1 (Rgl?.r_repr hrg hh1 ih) false);\n let r = Lib.ByteBuffer.lbytes_eq #hash_size ih rt in\n rg_free hrg ih;\n r", "val mt_olds_hs_lth_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n i:nat ->\n j:nat{i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts #hsz lv hs i j} ->\n Lemma (requires True)\n (ensures mt_hashes_lth_inv #hsz lv j (merge_hs #_ #f olds hs))\n (decreases (32 - lv))\nlet rec mt_olds_hs_lth_inv_ok #hsz #f lv i j olds hs =\n if lv = 32 then ()\n else (mt_olds_hs_lth_inv_ok #_ #f (lv + 1) (i / 2) (j / 2) olds hs)", "val mt_next_lv_get:\n #hsz:pos -> #f:hash_fun_t #hsz -> #n:pos ->\n mt:merkle_tree #hsz n -> idx:nat{idx < pow2 n} ->\n Lemma (\n (mt_next_lv #_ #f mt).[idx / 2] ==\n (if idx % 2 = 0\n then padded_hash_fun #_ f mt.[idx] mt.[idx + 1]\n else padded_hash_fun #_ f mt.[idx - 1] mt.[idx]))\nlet mt_next_lv_get #hsz #f #n mt idx =\n hs_next_lv_get #_ #f #(pow2 (n-1)) mt idx", "val create_mt_inv_ok:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n init:hash ->\n Lemma (empty_olds_inv #_ #f 0;\n mt_inv #hsz (mt_create hsz f init) (empty_hashes 32))\nlet create_mt_inv_ok #hsz #f init =\n create_empty_mt_inv_ok #_ #f ();\n empty_olds_inv #_ #f 0;\n mt_insert_inv_preserved #_ (create_empty_mt #hsz #f ()) init (empty_hashes 32)", "val mt_base:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n GTot (bhs:hashes #hsz {S.length bhs = MT?.j mt})\nlet mt_base #hsz mt olds =\n S.head (merge_hs #hsz #(MT?.hash_fun mt) olds (MT?.hs mt))", "val mt_get_path_step:\n #hsz:Ghost.erased hash_size_t ->\n mtr:HH.rid ->\n p:const_path_p ->\n i:uint32_t ->\n HST.ST (hash #hsz)\n (requires (fun h0 -> \n path_safe h0 mtr (CB.cast p) /\\ \n (let pv = B.get h0 (CB.cast p) 0 in\n Path?.hash_size pv = Ghost.reveal hsz /\\\n live h0 (Path?.hashes pv) /\\\n i < V.size_of (Path?.hashes pv))))\n (ensures (fun h0 r h1 -> True ))\nlet mt_get_path_step #hsz mtr p i = \n let pd = !*(CB.cast p) in\n V.index #(hash #(Path?.hash_size pd)) (Path?.hashes pd) i", "val mt_verify\n (#h: HS.mem)\n (#hash_size: Ghost.erased hash_size_t)\n (#hash_spec: MTS.hash_fun_t #(U32.v hash_size))\n (mt: const_mt_p)\n (tgt max: UInt64.t)\n (mtr: HH.rid)\n (path:\n const_path_p\n { let phs = const_path_hash_size #h path in\n phs = const_tree_hash_size #h mt /\\ phs = Ghost.reveal hash_size })\n (root: hash #(const_path_hash_size #h path))\n : HST.ST bool pf pt\nlet mt_verify\n (#h:HS.mem)\n (#hash_size:Ghost.erased hash_size_t)\n (#hash_spec:MTS.hash_fun_t #(U32.v hash_size))\n (mt:const_mt_p)\n (tgt:UInt64.t)\n (max:UInt64.t)\n (mtr:HH.rid)\n (path:const_path_p{let phs = const_path_hash_size #h path in phs = const_tree_hash_size #h mt /\\ phs = Ghost.reveal hash_size})\n (root:hash #(const_path_hash_size #h path))\n: HST.ST bool pf pt\n= let dmt = B.index (CB.cast mt) 0ul in\n let hsz = MTNL.MT?.hash_size dmt in\n MTNL.mt_verify #hsz #hash_spec mt tgt max mtr path root", "val init_path:\n hsz:hash_size_t ->\n mtr:HH.rid -> r:HST.erid ->\n HST.ST path_p\n (requires (fun h0 -> HH.disjoint mtr r))\n (ensures (fun h0 p h1 ->\n // memory safety\n path_safe h1 mtr p /\\\n // correctness\n Path?.hash_size (B.get h1 p 0) = hsz /\\\n S.equal (lift_path #hsz h1 mtr p) S.empty))\nlet init_path hsz mtr r =\n let nrid = HST.new_region r in\n (B.malloc r (Path hsz (rg_alloc (hvreg hsz) nrid)) 1ul)", "val lift_path:\n #hsz:hash_size_t ->\n h:HS.mem -> mtr:HH.rid -> p:path_p {path_safe h mtr p /\\ (Path?.hash_size (B.get h p 0)) = hsz} ->\n GTot (hp:MTH.path #(U32.v hsz) {S.length hp = U32.v (V.size_of (phashes h p))})\nlet lift_path #hsz h mtr p =\n lift_path_ h (V.as_seq h (phashes h p))\n 0 (S.length (V.as_seq h (phashes h p)))", "val mt_next_lv_equiv:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n j:nat -> n:pos{j <= pow2 n} ->\n mt1:merkle_tree #hsz n -> mt2:merkle_tree #hsz n ->\n Lemma (requires S.equal (S.slice mt1 0 j) (S.slice mt2 0 j))\n (ensures S.equal (S.slice (mt_next_lv #_ #f #_ mt1) 0 (j / 2))\n (S.slice (mt_next_lv #_ #f #_ mt2) 0 (j / 2)))\nlet mt_next_lv_equiv #hsz #f j n mt1 mt2 =\n hs_next_lv_equiv #_ #f j (pow2 (n-1)) mt1 mt2", "val mt_hashes_lth_inv_log_converted:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j < pow2 32} ->\n fhs:hashess #hsz {S.length fhs = 32} ->\n Lemma (requires mt_hashes_lth_inv #hsz 0 j fhs)\n (ensures (log2c_bound j 32;\n mt_hashes_lth_inv_log #hsz j (S.slice fhs 0 (log2c j))))\nlet mt_hashes_lth_inv_log_converted #_ #f j fhs =\n mt_hashes_lth_inv_log_converted_ #_ #f 0 j fhs", "val mt_hashes_next_rel_next_even:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 1} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n Lemma (requires j % 2 = 0 /\\ mt_hashes_next_rel #_ #f j hs nhs)\n (ensures S.equal (hash_seq_spec #hsz nhs)\n (MTS.mt_next_lv #_ #f #(log2c j) (hash_seq_spec #hsz hs)))\nlet mt_hashes_next_rel_next_even #hsz #f j hs nhs =\n log2c_div j;\n mt_hashes_next_rel_lift_even #_ #f j hs nhs;\n MTS.mt_next_rel_next_lv #_ #f (log2c j)\n (hash_seq_spec #hsz hs) (hash_seq_spec #hsz nhs)", "val mt_get_root_pad_index_0:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n #n:nat -> mt:merkle_tree #hsz n ->\n Lemma (HPad? mt.[0] <==> HPad? (mt_get_root #_ #f mt))\nlet rec mt_get_root_pad_index_0 #hsz #f #n (mt:merkle_tree #hsz n) =\n if n = 0 then ()\n else\n let mt:merkle_tree #hsz (n-1) = mt_next_lv #_ #f #n mt in\n mt_get_root_pad_index_0 #_ #f #(n-1) mt", "val lift_path_index_:\n #hsz:hash_size_t ->\n h:HS.mem ->\n hs:S.seq (hash #hsz) ->\n i:nat -> j:nat{i <= j && j <= S.length hs} ->\n k:nat{i <= k && k < j} ->\n Lemma (requires (V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)))\n (ensures (Rgl?.r_repr (hreg hsz) h (S.index hs k) ==\n S.index (lift_path_ h hs i j) (k - i)))\n (decreases j)\n [SMTPat (S.index (lift_path_ h hs i j) (k - i))]\nlet rec lift_path_index_ #hsz h hs i j k =\n if i = j then ()\n else if k = j - 1 then ()\n else lift_path_index_ #hsz h hs i (j - 1) k", "val mt_get_path_step_pre:\n #hsz:Ghost.erased hash_size_t ->\n mtr:HH.rid ->\n p:const_path_p ->\n i:uint32_t ->\n HST.ST bool\n (requires (fun h0 -> \n path_safe h0 mtr (CB.cast p) /\\ \n (let pv = B.get h0 (CB.cast p) 0 in\n Path?.hash_size pv = Ghost.reveal hsz /\\\n live h0 (Path?.hashes pv) /\\\n mt_get_path_step_pre_nst #hsz mtr pv i)))\n (ensures (fun _ _ _ -> True))\nlet mt_get_path_step_pre #hsz mtr p i = \n let p = CB.cast p in\n mt_get_path_step_pre_nst #hsz mtr !*p i", "val mt_root_inv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n hs0:hashes #hsz {S.length hs0 > 0} ->\n acc:hash #hsz -> actd:bool ->\n rt:hash #hsz ->\n GTot Type0\nlet mt_root_inv #_ #f hs0 acc actd rt =\n MTS.mt_get_root #_ #f #(log2c (S.length hs0))\n (hash_seq_spec_full #_ #f hs0 acc actd) == MTS.HRaw rt", "val mt_hashes_inv_log_converted:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 0 && j < pow2 32} ->\n fhs:hashess #hsz {S.length fhs = 32 /\\ mt_hashes_lth_inv #hsz 0 j fhs} ->\n Lemma (requires mt_hashes_inv #_ #f 0 j fhs)\n (ensures (log2c_bound j 32;\n mt_hashes_lth_inv_log_converted_ #_ #f 0 j fhs;\n mt_hashes_inv_log #_ #f j (S.slice fhs 0 (log2c j))))\nlet mt_hashes_inv_log_converted #_ #f j fhs =\n mt_hashes_inv_log_converted_ #_ #f 0 j fhs", "val lift_path_:\n #hsz:hash_size_t ->\n h:HS.mem ->\n hs:S.seq (hash #hsz) ->\n i:nat ->\n j:nat{\n i <= j /\\ j <= S.length hs /\\\n V.forall_seq hs i j (fun hp -> Rgl?.r_inv (hreg hsz) h hp)} ->\n GTot (hp:MTH.path #(U32.v hsz) {S.length hp = j - i}) (decreases j)\nlet rec lift_path_ #hsz h hs i j =\n if i = j then S.empty\n else (S.snoc (lift_path_ h hs i (j - 1))\n (Rgl?.r_repr (hreg hsz) h (S.index hs (j - 1))))", "val mt_spec:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt /\\ MT?.j mt > 0} ->\n olds:hashess{S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n GTot (MTS.merkle_tree #hsz (log2c (MT?.j mt)))\nlet mt_spec #hsz mt olds =\n hash_seq_spec #_ (mt_base mt olds)", "val mt_olds_hs_inv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n i:nat ->\n j:nat{i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts #hsz lv hs i j} ->\n GTot Type0\nlet mt_olds_hs_inv #hsz #f lv i j olds hs =\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_inv #_ #f lv j (merge_hs #_ #f olds hs)", "val mt_hashes_lth_inv_equiv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n j:nat{j < pow2 (32 - lv)} ->\n fhs1:hashess{S.length fhs1 = 32} ->\n fhs2:hashess{S.length fhs2 = 32} ->\n Lemma (requires mt_hashes_lth_inv lv j fhs1 /\\\n S.equal (S.slice fhs1 lv 32) (S.slice fhs2 lv 32))\n (ensures mt_hashes_lth_inv #hsz lv j fhs2)\n (decreases (32 - lv))\nlet rec mt_hashes_lth_inv_equiv #hsz #f lv j fhs1 fhs2 =\n if lv = 31 then ()\n else (assert (S.index fhs1 lv == S.index fhs2 lv);\n mt_hashes_lth_inv_equiv #_ #f (lv + 1) (j / 2) fhs1 fhs2)", "val mt_hashes_next_rel_lift_even:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 1} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n Lemma (requires j % 2 = 0 /\\ mt_hashes_next_rel #_ #f j hs nhs)\n (ensures MTS.mt_next_rel #_ #f (log2c j)\n (hash_seq_spec #hsz hs) (hash_seq_spec #hsz nhs))\nlet mt_hashes_next_rel_lift_even #hsz #_ j hs nhs =\n hash_seq_lift_index #hsz hs;\n hash_seq_lift_index #hsz nhs", "val mt_inv: \n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n olds:hashess{S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n GTot Type0\nlet mt_inv #hsz mt olds =\n let i = MT?.i mt in\n let j = MT?.j mt in\n let hs = MT?.hs mt in\n let rhs = MT?.rhs mt in\n let f = MT?.hash_fun mt in\n let fhs = merge_hs #hsz #f olds hs in\n let rt = MT?.mroot mt in\n log2c_bound j 32;\n mt_olds_hs_inv #_ #f 0 i j olds hs /\\\n (if j > 0 && MT?.rhs_ok mt\n then (mt_olds_hs_lth_inv_ok #_ #f 0 i j olds hs;\n mt_hashes_lth_inv_log_converted #_ #f j fhs;\n (mt_rhs_inv #_ #f j (mt_spec mt olds) (S.slice rhs 0 (log2c j)) false /\\\n mt_root_inv #_ #f (mt_base mt olds) hash_init false rt))\n else true)", "val mt_flush_to_inv_preserved:\n #hsz:pos -> \n mt:merkle_tree{mt_wf_elts mt} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds} ->\n idx:nat{idx >= MT?.i mt /\\ idx < MT?.j mt} ->\n Lemma (requires (mt_inv mt olds))\n (ensures (mt_inv (mt_flush_to mt idx)\n (mt_flush_to_olds #_ #(MT?.hash_fun mt) 0 (MT?.i mt) idx (MT?.j mt) olds (MT?.hs mt))))\nlet mt_flush_to_inv_preserved #hsz mt olds idx =\n mt_flush_to_inv_preserved_ #_ #(MT?.hash_fun mt) 0 (MT?.i mt) idx (MT?.j mt) olds (MT?.hs mt);\n mt_flush_to_merge_preserved #_ #(MT?.hash_fun mt) 0 (MT?.i mt) idx (MT?.j mt) olds (MT?.hs mt)", "val mt_hashes_inv_equiv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n j:nat{j < pow2 (32 - lv)} ->\n fhs1:hashess #hsz {S.length fhs1 = 32 /\\ mt_hashes_lth_inv lv j fhs1} ->\n fhs2:hashess #hsz {S.length fhs2 = 32 /\\ mt_hashes_lth_inv lv j fhs2} ->\n Lemma (requires mt_hashes_inv #_ #f lv j fhs1 /\\\n S.equal (S.slice fhs1 lv 32) (S.slice fhs2 lv 32))\n (ensures mt_hashes_inv #_ #f lv j fhs2)\n (decreases (32 - lv))\nlet rec mt_hashes_inv_equiv #hsz #f lv j fhs1 fhs2 =\n if lv = 31 then ()\n else (assert (S.index fhs1 lv == S.index fhs2 lv);\n assert (S.index fhs1 (lv + 1) == S.index fhs2 (lv + 1));\n mt_hashes_inv_equiv #_ #f (lv + 1) (j / 2) fhs1 fhs2)", "val path_spec:\n #hsz:pos ->\n k:nat ->\n j:nat{k <= j} ->\n actd:bool ->\n p:path #hsz {S.length p = mt_path_length k j actd} ->\n GTot (sp:S.seq (MTS.padded_hash #hsz){S.length sp = log2c j})\n (decreases j)\nlet rec path_spec #hsz k j actd p =\n if j = 0 then S.empty\n else (if k % 2 = 0\n then (if j = k || (j = k + 1 && not actd)\n then S.cons MTS.HPad (path_spec (k / 2) (j / 2) (actd || (j % 2 = 1)) p)\n else S.cons (MTS.HRaw #hsz (S.head p))\n (path_spec (k / 2) (j / 2) (actd || (j % 2 = 1)) (S.tail p)))\n else S.cons (MTS.HRaw #hsz (S.head p))\n (path_spec (k / 2) (j / 2) (actd || (j % 2 = 1)) (S.tail p)))", "val mt_get: #hsz:pos -> #n:nat -> mt:merkle_tree #hsz n -> idx:nat{idx < pow2 n} -> GTot (padded_hash #hsz)\nlet mt_get #_ #_ mt idx = S.index mt idx", "val mt_verify_:\n #hsz:pos -> #f:hash_fun_t #hsz ->#n:nat ->\n p:path #hsz n -> idx:nat{idx < pow2 n} -> padded_hash #hsz -> GTot (padded_hash #hsz)\nlet rec mt_verify_ #hsz #f #n p idx h =\n if n = 0 then h\n else mt_verify_ #_ #f #(n-1) (S.tail p) (idx / 2)\n (if idx % 2 = 0\n then padded_hash_fun #_ f h (S.head p)\n else padded_hash_fun #_ f (S.head p) h)", "val mt_hashes_next_rel_lift_odd:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 1} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n Lemma (requires j % 2 = 1 /\\ mt_hashes_next_rel #_ #f j hs nhs)\n (ensures MTS.mt_next_rel #_ #f (log2c j)\n (hash_seq_spec #hsz hs)\n (S.upd (hash_seq_spec #hsz nhs)\n (S.length nhs) (MTS.HRaw (S.last hs))))\nlet mt_hashes_next_rel_lift_odd #hsz #_ j hs nhs =\n log2c_div j;\n hash_seq_lift_index #hsz hs;\n hash_seq_lift_index #hsz nhs", "val construct_rhs_acc_consistent:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n i:nat ->\n j:nat{i <= j /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs i j} ->\n rhs:hashes #hsz {S.length rhs = 32} ->\n acc:hash #hsz ->\n actd:bool ->\n Lemma (requires True)\n (ensures\n (log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n (let rrf = construct_rhs_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd in\n let rr = construct_rhs #_ #f lv hs rhs i j acc actd in\n rhs_equiv #hsz j (fst rrf) (S.slice (fst rr) lv (lv + log2c j)) actd /\\\n snd rrf == snd rr)))\n (decreases j)\nlet rec construct_rhs_acc_consistent #hsz #f lv i j olds hs rhs acc actd =\n assert (j < pow2 (32 - lv));\n assert (j <> 0 ==> j / 2 < pow2 (32 - (lv + 1)));\n log2c_bound j (32 - lv);\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n let rrf = construct_rhs_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd in\n let rr = construct_rhs #_ #f lv hs rhs i j acc actd in\n construct_rhs_unchanged #_ #f lv hs rhs i j acc actd;\n assert (S.equal (S.slice rhs 0 lv) (S.slice (fst rr) 0 lv));\n\n if j = 0 then ()\n else begin\n log2c_div j; \n assert (32 - (lv + 1) >= 0);\n log2c_bound (j / 2) (32 - (lv + 1));\n mt_olds_hs_lth_inv_ok #_ #f (lv + 1) (i / 2) (j / 2) olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f (lv + 1) (j / 2) (merge_hs #_ #f olds hs);\n \n if j % 2 = 0 then begin\n construct_rhs_acc_consistent #_ #f (lv + 1) (i / 2) (j / 2)\n olds hs rhs acc actd;\n log2c_bound (j/2) (32 - (lv + 1));\n mt_olds_hs_lth_inv_ok #hsz #f (lv+1) (i/2) (j/2) olds hs;\n mt_hashes_lth_inv_log_converted_ #_ #f lv j (merge_hs #_ #f olds hs);\n let rrf = construct_rhs_acc #_ #f j\n (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd in\n let rr = construct_rhs #_ #f lv hs rhs i j acc actd in\n assert (rhs_equiv #hsz j (fst rrf) (S.slice (fst rr) lv (lv + log2c j)) actd);\n assert (snd rrf == snd rr)\n end\n else\n begin\n let rhd = if actd then acc else hash_init in\n let nacc = if actd\n then f (S.last (S.index hs lv)) acc\n else S.last (S.index hs lv) in\n assert (S.equal (S.tail (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)))\n (S.slice (merge_hs #_ #f olds hs)\n (lv + 1) (lv + 1 + log2c (j / 2))));\n\n // Recursion step for `construct_rhs_acc`\n let nrrf = construct_rhs_acc #_ #f (j / 2)\n (S.slice (merge_hs #_ #f olds hs) (lv + 1) (lv + 1 + (log2c (j / 2))))\n nacc true in\n construct_rhs_acc_odd #_ #f j (S.slice (merge_hs #_ #f olds hs) lv (lv + log2c j)) acc actd;\n\n // Recursion step for `construct_rhs`\n assert (hs_wf_elts (lv + 1) hs (i / 2) (j / 2));\n let nrhs = if actd then S.upd rhs lv acc else rhs in\n let nrr = construct_rhs #_ #f (lv + 1) hs nrhs (i / 2) (j / 2) nacc true in\n construct_rhs_odd #_ #f lv hs rhs i j acc actd;\n construct_rhs_unchanged #_ #f (lv + 1) hs nrhs (i / 2) (j / 2) nacc true;\n assert (S.equal (S.slice nrhs 0 (lv + 1)) (S.slice (fst nrr) 0 (lv + 1)));\n assert (S.index (fst nrr) lv == S.index nrhs lv);\n\n // Recursion for the proof\n construct_rhs_acc_consistent #_ #f (lv + 1) (i / 2) (j / 2)\n olds hs nrhs nacc true;\n assert (rhs_equiv #hsz (j / 2) (fst nrrf)\n (S.slice (fst nrr) (lv + 1) (lv + 1 + log2c (j / 2))) true);\n assert (snd nrrf == snd nrr);\n\n // All together\n (if actd\n then (assert (S.head (fst rrf) == rhd);\n assert (rhd == acc);\n assert (S.index (fst rr) lv == S.index nrhs lv);\n assert (S.index nrhs lv == acc);\n assert (S.head (fst rrf) == S.index (fst rr) lv))\n else ());\n\n assert (if actd then S.head (fst rrf) == S.index (fst rr) lv else true);\n assert (rhs_equiv #hsz (j / 2) (S.tail (fst rrf))\n (S.slice (fst rr) (lv + 1) (lv + 1 + log2c (j / 2))) true);\n assert (rhs_equiv #hsz j (fst rrf) (S.slice (fst rr) lv (lv + log2c j)) actd);\n assert (snd rrf == snd rr)\n end\n end", "val mt_verify:\n #hsz:pos -> #f:hash_fun_t #hsz -> #n:nat ->\n p:(path #hsz n) -> idx:nat{idx < pow2 n} -> padded_hash #hsz -> padded_hash #hsz -> GTot prop\nlet mt_verify #hsz #f #n p idx h rt =\n rt == mt_verify_ #_ #f p idx h", "val mt_path_length:\n lv:uint32_t{lv <= merkle_tree_size_lg} ->\n k:index_t ->\n j:index_t{k <= j && U32.v j < pow2 (32 - U32.v lv)} ->\n actd:bool ->\n Tot (l:uint32_t{\n U32.v l = MTH.mt_path_length (U32.v k) (U32.v j) actd &&\n l <= 32ul - lv})\n (decreases (U32.v j))\nlet rec mt_path_length lv k j actd =\n if j = 0ul then 0ul\n else (let nactd = actd || (j % 2ul = 1ul) in\n mt_path_length_step k j actd +\n mt_path_length (lv + 1ul) (k / 2ul) (j / 2ul) nactd)", "val mt_hashes_lth_inv_log_converted_:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n j:nat{j < pow2 (32 - lv)} ->\n fhs:hashess #hsz {S.length fhs = 32} ->\n Lemma (requires mt_hashes_lth_inv #hsz lv j fhs)\n (ensures (log2c_bound j (32 - lv);\n mt_hashes_lth_inv_log #hsz j (S.slice fhs lv (lv + log2c j))))\n (decreases j)\nlet rec mt_hashes_lth_inv_log_converted_ #_ #f lv j fhs =\n if j = 0 then ()\n else (log2c_bound (j / 2) (32 - (lv + 1));\n mt_hashes_lth_inv_log_converted_ #_ #f (lv + 1) (j / 2) fhs)", "val mt_olds_inv_equiv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n i:nat ->\n olds1:hashess #hsz {S.length olds1 = 32} ->\n olds2:hashess #hsz {S.length olds2 = 32} ->\n Lemma (requires mt_olds_inv #hsz lv i olds1 /\\\n S.equal (S.slice olds1 lv 32) (S.slice olds2 lv 32))\n (ensures mt_olds_inv #hsz lv i olds2)\n (decreases (32 - lv))\nlet rec mt_olds_inv_equiv #hsz #f lv i olds1 olds2 =\n if lv = 32 then ()\n else (assert (S.index olds1 lv == S.index olds2 lv);\n mt_olds_inv_equiv #_ #f (lv + 1) (i / 2) olds1 olds2)", "val mt_verify_pre:\n #hsz:Ghost.erased hash_size_t ->\n mt:const_mt_p ->\n k:uint64_t ->\n j:uint64_t ->\n mtr:HH.rid ->\n p:const_path_p ->\n rt:hash #hsz ->\n HST.ST bool\n (requires (fun h0 ->\n let mt = CB.cast mt in\n let p = CB.cast p in\n let mtv0 = B.get h0 mt 0 in\n MT?.hash_size mtv0 = Ghost.reveal hsz /\\\n mt_safe h0 mt /\\\n path_safe h0 mtr p /\\ Rgl?.r_inv (hreg hsz) h0 rt /\\\n HST.is_eternal_region (B.frameOf rt) /\\\n HH.disjoint (B.frameOf p) (B.frameOf rt) /\\\n HH.disjoint mtr (B.frameOf rt)))\n (ensures (fun _ _ _ -> True))\nlet mt_verify_pre #hsz mt k j mtr p rt =\n let mt = CB.cast mt in\n let p = CB.cast p in\n let mtv = !*mt in\n mt_verify_pre_nst mtv k j !*p rt", "val mt_hashes_inv_log_converted_:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n j:nat{j > 0 && j < pow2 (32 - lv)} ->\n fhs:hashess #hsz {S.length fhs = 32 /\\ mt_hashes_lth_inv #hsz lv j fhs} ->\n Lemma (requires mt_hashes_inv #_ #f lv j fhs)\n (ensures (log2c_bound j (32 - lv);\n mt_hashes_lth_inv_log_converted_ #_ #f lv j fhs;\n mt_hashes_inv_log #_ #f j (S.slice fhs lv (lv + log2c j))))\n (decreases j)\nlet rec mt_hashes_inv_log_converted_ #_ #f lv j fhs =\n if j = 1 then ()\n else (log2c_bound (j / 2) (32 - (lv + 1));\n mt_hashes_lth_inv_log_converted_ #_ #f (lv + 1) (j / 2) fhs;\n mt_hashes_inv_log_converted_ #_ #f (lv + 1) (j / 2) fhs)", "val mt_verify_pre\n (#h: HS.mem)\n (mt: const_mt_p)\n (tgt max: UInt64.t)\n (mtr: HH.rid)\n (path: const_path_p{const_path_hash_size #h path = const_tree_hash_size #h mt})\n (root: hash #(const_path_hash_size #h path))\n : HST.ST bool pf pt\nlet mt_verify_pre\n (#h:HS.mem)\n (mt:const_mt_p)\n (tgt:UInt64.t)\n (max:UInt64.t)\n (mtr:HH.rid)\n (path:const_path_p{const_path_hash_size #h path = const_tree_hash_size #h mt})\n (root:hash #(const_path_hash_size #h path))\n: HST.ST bool pf pt\n= let hash_size = MTNL.MT?.hash_size (B.index (CB.cast mt) 0ul) in\n MTNL.mt_verify_pre #hash_size mt tgt max mtr path root", "val mt_get_root:\n #hsz:pos ->\n mt:merkle_tree #hsz {mt_wf_elts #hsz mt} -> drt:hash #hsz ->\n GTot (merkle_tree #hsz * hash #hsz)\nlet mt_get_root #hsz mt drt =\n if MT?.rhs_ok mt then (mt, MT?.mroot mt)\n else begin\n let (nrhs, rt) = construct_rhs #_ #(MT?.hash_fun mt) 0 (MT?.hs mt) (MT?.rhs mt) (MT?.i mt) (MT?.j mt) drt false in\n (MT (MT?.i mt) (MT?.j mt) (MT?.hs mt) true nrhs rt (MT?.hash_fun mt), rt)\n end", "val mt_flush_to:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n idx:nat{idx >= MT?.i mt /\\ idx < MT?.j mt} ->\n GTot (fmt:merkle_tree{mt_wf_elts #hsz fmt})\nlet mt_flush_to #hsz mt idx =\n let fhs = mt_flush_to_ #hsz 0 (MT?.hs mt) (MT?.i mt) idx (MT?.j mt) in\n MT idx (MT?.j mt) fhs (MT?.rhs_ok mt) (MT?.rhs mt) (MT?.mroot mt) (MT?.hash_fun mt)", "val rpmt_get_root_raw:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n #n:nat -> #i:nat{i <= pow2 n} -> mt:rpmt #_ #f n i ->\n Lemma (i > 0 <==> HRaw? (mt_get_root #_ #f mt))\nlet rpmt_get_root_raw #hsz #f #n #i mt =\n allow_inversion (padded_hash #hsz);\n rpmt_get_root_pad #_ #f mt", "val hash_seq_spec_full_next:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 1} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n acc:hash #hsz -> actd:bool -> nacc:hash #hsz -> nactd:bool ->\n Lemma\n (requires mt_hashes_next_rel #_ #f j hs nhs /\\\n nacc == (if j % 2 = 0 then acc\n else if actd \n then f (S.last hs) acc\n else S.last hs) /\\\n nactd == (actd || j % 2 = 1))\n (ensures S.equal (hash_seq_spec_full #_ #f nhs nacc nactd)\n (MTS.mt_next_lv #_ #f #(log2c j) (hash_seq_spec_full #_ #f hs acc actd)))\nlet hash_seq_spec_full_next #_ #f j hs nhs acc actd nacc nactd =\n if j % 2 = 0 \n then hash_seq_spec_full_even_next #_ #f j hs nhs acc actd\n else hash_seq_spec_full_odd_next #_ #f j hs nhs acc actd nacc", "val mt_retract_to:\n #hsz:pos -> \n mt:merkle_tree #hsz {mt_wf_elts mt} ->\n r:nat{MT?.i mt <= r /\\ r < MT?.j mt} ->\n GTot (rmt:merkle_tree #hsz {mt_wf_elts rmt /\\ MT?.i rmt = MT?.i mt /\\ MT?.j rmt = r + 1})\nlet mt_retract_to #hsz mt r =\n let nhs = mt_retract_to_ (MT?.hs mt) 0 (MT?.i mt) (r+1) (MT?.j mt) in\n MT (MT?.i mt) (r+1) nhs false (MT?.rhs mt) (MT?.mroot mt) (MT?.hash_fun mt)", "val mt_get_root:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n #n:nat -> mt:merkle_tree #hsz n -> GTot (padded_hash #hsz)\nlet rec mt_get_root #hsz #f #n mt =\n if n = 0 then mt.[0]\n else mt_get_root #_ #f (mt_next_lv #_ #f mt)", "val mt_rhs_inv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat ->\n smt:MTS.merkle_tree #hsz (log2c j) ->\n rhs:hashes #hsz {S.length rhs = log2c j} ->\n actd:bool ->\n GTot Type0 (decreases j)\nlet rec mt_rhs_inv #_ #f j smt rhs actd =\n if j = 0 then true\n else begin\n (if j % 2 = 1 && actd \n then (S.index smt j == MTS.HRaw (S.head rhs))\n else true) /\\\n mt_rhs_inv #_ #f (j / 2) (MTS.mt_next_lv #_ #f #(log2c j) smt) (S.tail rhs)\n (actd || (j % 2 = 1))\n end", "val hash_seq_spec_full_even_next:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 0} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n acc:hash #hsz -> actd:bool ->\n Lemma\n (requires j % 2 = 0 /\\ mt_hashes_next_rel #_ #f j hs nhs)\n (ensures S.equal (hash_seq_spec_full #_ #f nhs acc actd)\n (MTS.mt_next_lv #_ #f #(log2c j) (hash_seq_spec_full #_ #f hs acc actd)))\nlet hash_seq_spec_full_even_next #hsz #f j hs nhs acc actd =\n log2c_div j;\n mt_hashes_next_rel_lift_even #_ #f j hs nhs;\n if actd \n then begin \n MTS.mt_next_rel_upd_even_pad #_ #f (log2c j)\n (hash_seq_spec #hsz hs) (hash_seq_spec #hsz nhs) (S.length hs / 2) (MTS.HRaw acc);\n let n = log2c j in\n let mt = S.upd (hash_seq_spec #hsz hs) (S.length hs) (MTS.HRaw acc) in\n let nmt = S.upd (hash_seq_spec #hsz nhs) (S.length nhs) (MTS.HRaw acc) in\n // assume (MTS.mt_next_rel #_ #f n mt nmt);\n MTS.mt_next_rel_next_lv #_ #f n mt nmt\n end\n else MTS.mt_next_rel_next_lv #_ #f (log2c j)\n (hash_seq_spec_full #_ #f hs acc actd)\n (hash_seq_spec_full #_ #f nhs acc actd)", "val rhs_equiv_inv_preserved:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat ->\n smt:MTS.merkle_tree (log2c j) ->\n rhs1:hashes #hsz {S.length rhs1 = log2c j} ->\n rhs2:hashes #hsz {S.length rhs2 = log2c j} ->\n actd:bool ->\n Lemma (requires (mt_rhs_inv #_ #f j smt rhs1 actd /\\\n rhs_equiv #hsz j rhs1 rhs2 actd))\n (ensures (mt_rhs_inv #_ #f j smt rhs2 actd))\n (decreases j)\nlet rec rhs_equiv_inv_preserved #_ #f j smt rhs1 rhs2 actd =\n if j = 0 then ()\n else if j % 2 = 0\n then rhs_equiv_inv_preserved #_ #f (j / 2) (MTS.mt_next_lv #_ #f #(log2c j) smt)\n (S.tail rhs1) (S.tail rhs2) actd\n else begin\n (if actd\n then (assert (S.index smt j == MTS.HRaw (S.head rhs1));\n assert (S.head rhs1 == S.head rhs2))\n else ());\n rhs_equiv_inv_preserved #_ #f (j / 2) (MTS.mt_next_lv #_ #f #(log2c j) smt)\n (S.tail rhs1) (S.tail rhs2) true\n end", "val mt_get_root_pre:\n #hsz:Ghost.erased hash_size_t ->\n mt:const_mt_p ->\n rt:hash #hsz ->\n HST.ST bool\n (requires (fun h0 ->\n let mt = CB.cast mt in\n MT?.hash_size (B.get h0 mt 0) = Ghost.reveal hsz /\\\n mt_safe h0 mt /\\ Rgl?.r_inv (hreg hsz) h0 rt /\\\n HH.disjoint (B.frameOf mt) (B.frameOf rt)))\n (ensures (fun _ _ _ -> True))\nlet mt_get_root_pre #hsz mt rt =\n let mt = CB.cast mt in\n let mt = !*mt in\n let hsz = MT?.hash_size mt in\n assert (MT?.hash_size mt = hsz);\n mt_get_root_pre_nst mt rt", "val mt_next_lv_mt_left: #hsz:pos -> #f:hash_fun_t #hsz -> #n:nat{1 < n} -> mt:merkle_tree #hsz n ->\n Lemma (S.equal (mt_next_lv #_ #f #_ (mt_left mt)) (mt_left (mt_next_lv #_ #f #_ mt)))\nlet mt_next_lv_mt_left #hsz #f #n mt =\n hs_next_lv_slice #_ #f #(pow2 (n-1)) mt 0 (pow2 (n-2))", "val path_preserved_:\n #hsz:hash_size_t ->\n mtr:HH.rid ->\n hs:S.seq (hash #hsz) ->\n i:nat -> j:nat{i <= j && j <= S.length hs} ->\n dl:loc -> h0:HS.mem -> h1:HS.mem ->\n Lemma (requires (V.forall_seq hs i j\n (fun hp -> Rgl?.r_inv (hreg hsz) h0 hp /\\\n HH.includes mtr (Rgl?.region_of (hreg hsz) hp)) /\\\n loc_disjoint dl (B.loc_all_regions_from false mtr) /\\\n modifies dl h0 h1))\n (ensures (path_safe_preserved_ mtr hs i j dl h0 h1;\n S.equal (lift_path_ h0 hs i j)\n (lift_path_ h1 hs i j)))\n (decreases j)\nlet rec path_preserved_ #hsz mtr hs i j dl h0 h1 =\n if i = j then ()\n else (path_safe_preserved_ mtr hs i (j - 1) dl h0 h1;\n path_preserved_ mtr hs i (j - 1) dl h0 h1;\n assert (loc_includes\n (B.loc_all_regions_from false mtr)\n (B.loc_all_regions_from false\n (Rgl?.region_of (hreg hsz) (S.index hs (j - 1)))));\n Rgl?.r_sep (hreg hsz) (S.index hs (j - 1)) dl h0 h1)", "val mt_next_lv_mt_right: #hsz:pos -> #f:hash_fun_t #hsz -> #n:nat{1 < n} -> mt:merkle_tree #hsz n ->\n Lemma (S.equal (mt_next_lv #_ #f #_ (mt_right mt)) (mt_right (mt_next_lv #_ #f #_ mt)))\nlet mt_next_lv_mt_right #hsz #f #n mt =\n hs_next_lv_slice #hsz #f #(pow2 (n-1)) mt (pow2 (n-2)) (pow2 (n-1))", "val mt_hashes_next_rel:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n GTot Type0\nlet mt_hashes_next_rel #hsz #f j hs nhs =\n forall (i:nat{i < j / 2}).\n S.index nhs i == \n f (S.index hs (op_Multiply 2 i))\n (S.index hs (op_Multiply 2 i + 1))", "val mt_flush_to_olds_hs_equiv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n pi:nat ->\n i:nat{i >= pi} ->\n j:nat{j >= i /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv pi olds} ->\n hs1:hashess #hsz {S.length hs1 = 32 /\\ hs_wf_elts lv hs1 pi j} ->\n hs2:hashess #hsz {S.length hs2 = 32 /\\ hs_wf_elts lv hs2 pi j} ->\n Lemma (requires (S.equal (S.slice hs1 lv 32) (S.slice hs2 lv 32)))\n (ensures (S.equal (mt_flush_to_olds #_ #f lv pi i j olds hs1)\n (mt_flush_to_olds #_ #f lv pi i j olds hs2)))\n (decreases i)\nlet rec mt_flush_to_olds_hs_equiv #_ #f lv pi i j olds hs1 hs2 =\n let oi = offset_of i in\n let opi = offset_of pi in\n if oi = opi then ()\n else (assert (S.index hs1 lv == S.index hs2 lv);\n let nolds = \n S.upd olds lv\n (S.append (S.index olds lv)\n (S.slice (S.index hs1 lv) 0 (oi - opi))) in\n mt_olds_inv_equiv #_ #f (lv + 1) (pi / 2) olds nolds;\n mt_flush_to_olds_hs_equiv #_ #f \n (lv + 1) (pi / 2) (i / 2) (j / 2) nolds hs1 hs2)", "val mt_get_path_pre_nst:\n mtv:merkle_tree ->\n idx:offset_t ->\n p:path ->\n root:(hash #(MT?.hash_size mtv)) ->\n Tot bool\nlet mt_get_path_pre_nst mtv idx p root =\n offsets_connect (MT?.offset mtv) idx &&\n Path?.hash_size p = MT?.hash_size mtv &&\n ([@inline_let] let idx = split_offset (MT?.offset mtv) idx in\n MT?.i mtv <= idx && idx < MT?.j mtv &&\n V.size_of (Path?.hashes p) = 0ul)", "val mt_hashes_inv_log:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat ->\n fhs:hashess #hsz {S.length fhs = log2c j /\\ mt_hashes_lth_inv_log #hsz j fhs} ->\n GTot Type0 (decreases j)\nlet rec mt_hashes_inv_log #hsz #f j fhs =\n if j <= 1 then true\n else (mt_hashes_next_rel #_ #f j (S.index fhs 0) (S.index fhs 1) /\\\n mt_hashes_inv_log #_ #f (j / 2) (S.tail fhs))", "val hash_seq_spec_full_odd_next:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n j:nat{j > 1} ->\n hs:hashes #hsz {S.length hs = j} ->\n nhs:hashes #hsz {S.length nhs = j / 2} ->\n acc:hash #hsz -> actd:bool -> nacc:hash #hsz ->\n Lemma\n (requires j % 2 = 1 /\\\n mt_hashes_next_rel #_ #f j hs nhs /\\\n nacc == (if actd then f (S.last hs) acc else S.last hs))\n (ensures S.equal (hash_seq_spec_full #_ #f nhs nacc true)\n (MTS.mt_next_lv #_ #f #(log2c j) (hash_seq_spec_full #_ #f hs acc actd)))\nlet hash_seq_spec_full_odd_next #hsz #f j hs nhs acc actd nacc =\n log2c_div j;\n mt_hashes_next_rel_lift_odd #_ #f j hs nhs;\n if actd\n then begin\n MTS.mt_next_rel_upd_odd #_ #f (log2c j)\n (hash_seq_spec #hsz hs)\n (S.upd (hash_seq_spec #hsz nhs) (S.length nhs) (MTS.HRaw (S.last hs)))\n (S.length nhs) (MTS.HRaw acc);\n MTS.mt_next_rel_next_lv #_ #f (log2c j)\n (S.upd (hash_seq_spec #hsz hs) (S.length hs) (MTS.HRaw acc))\n (S.upd (hash_seq_spec #hsz nhs) (S.length nhs) (MTS.HRaw (f (S.last hs) acc)))\n end\n else MTS.mt_next_rel_next_lv #_ #f (log2c j)\n (hash_seq_spec_full #_ #f hs acc actd)\n (hash_seq_spec_full #_ #f nhs nacc true)", "val mt_flush_to_olds:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n pi:nat ->\n i:nat{i >= pi} ->\n j:nat{j >= i /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv pi olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs pi j} ->\n GTot (folds:hashess #hsz {\n S.length folds = 32 /\\\n S.equal (S.slice olds 0 lv) (S.slice folds 0 lv) /\\\n mt_olds_inv #hsz lv i folds})\n (decreases i)\nlet rec mt_flush_to_olds #_ #f lv pi i j olds hs =\n let oi = offset_of i in\n let opi = offset_of pi in\n if oi = opi then olds (* no updates *)\n else (let nolds = \n S.upd olds lv\n (S.append (S.index olds lv)\n (S.slice (S.index hs lv) 0 (oi - opi))) in\n mt_olds_inv_equiv #_ #f (lv + 1) (pi / 2) olds nolds;\n mt_flush_to_olds #_ #f (lv + 1) (pi / 2) (i / 2) (j / 2) nolds hs)", "val mt_next_rel_next_lv:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n n:pos ->\n mt:merkle_tree #hsz n ->\n nmt:merkle_tree (n - 1) ->\n Lemma (requires mt_next_rel #_ #f n mt nmt)\n (ensures S.equal nmt (mt_next_lv #_ #f mt))\nlet mt_next_rel_next_lv #hsz #f n mt nmt =\n hs_next_rel_next_lv #_ #f (pow2 (n-1)) mt nmt", "val empty_olds_inv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv <= 32} ->\n Lemma (requires True)\n (ensures (mt_olds_inv #hsz lv 0 (empty_hashes 32)))\n (decreases (32 - lv))\nlet rec empty_olds_inv #_ #f lv =\n if lv = 32 then ()\n else empty_olds_inv #_ #f (lv + 1)", "val mt_hashes_inv:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n j:nat{j < pow2 (32 - lv)} ->\n fhs:hashess #hsz {S.length fhs = 32 /\\ mt_hashes_lth_inv lv j fhs} ->\n GTot Type0 (decreases (32 - lv))\nlet rec mt_hashes_inv #hsz #f lv j fhs =\n if lv = 31 then true\n else (mt_hashes_next_rel #_ #f j (S.index fhs lv) (S.index fhs (lv + 1)) /\\\n mt_hashes_inv #_ #f (lv + 1) (j / 2) fhs)", "val mt_flush_to_inv_preserved_:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n pi:nat -> i:nat{i >= pi} ->\n j:nat{j >= i /\\ j < pow2 (32 - lv)} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv pi olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs pi j} ->\n Lemma (requires (mt_olds_hs_inv #_ #f lv pi j olds hs))\n (ensures (mt_olds_hs_inv #_ #f lv i j \n (mt_flush_to_olds #_ #f lv pi i j olds hs) \n (mt_flush_to_ lv hs pi i j)))\nlet mt_flush_to_inv_preserved_ #_ #f lv pi i j olds hs =\n mt_flush_to_merge_preserved #_ #f lv pi i j olds hs;\n mt_olds_hs_lth_inv_ok #_ #f lv pi j olds hs;\n mt_hashes_lth_inv_equiv #_ #f lv j\n (merge_hs #_ #f olds hs)\n (merge_hs #_ #f (mt_flush_to_olds #_ #f lv pi i j olds hs) \n (mt_flush_to_ lv hs pi i j));\n mt_hashes_inv_equiv #_ #f lv j\n (merge_hs #_ #f olds hs)\n (merge_hs #_ #f (mt_flush_to_olds #_ #f lv pi i j olds hs) \n (mt_flush_to_ lv hs pi i j))", "val rpmt_get_root_pad_hashes:\n #hsz:pos -> #f:hash_fun_t #hsz ->\n #n:nat -> #i:nat{i <= pow2 n} -> mt:rpmt #_ #f n i ->\n Lemma (pad_hashes #_ #f mt <==> HPad? (mt_get_root #_ #f mt))\nlet rpmt_get_root_pad_hashes #_ #f #n #i mt =\n rpmt_pad_hashes_index_0 #_ #f mt;\n mt_get_root_pad_index_0 #_ #f mt", "val insert_inv_preserved:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n i:nat ->\n j:nat{i <= j /\\ j < pow2 (32 - lv) - 1} ->\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz lv i olds} ->\n hs:hashess #hsz {S.length hs = 32 /\\ hs_wf_elts lv hs i j} ->\n acc:hash ->\n Lemma (requires (mt_olds_hs_inv #_ #f lv i j olds hs))\n (ensures (mt_olds_hs_inv #_ #f lv i (j + 1) olds (insert_ #_ #f lv i j hs acc)))\n (decreases (32 - lv))\nlet rec insert_inv_preserved #_ #f lv i j olds hs acc =\n if j % 2 = 1 \n then begin\n let ihs = hashess_insert lv i j hs acc in\n mt_olds_hs_lth_inv_ok #_ #f lv i j olds hs;\n merge_hs_slice_equal #_ #f olds hs olds ihs (lv + 1) 32;\n assert (mt_hashes_inv #_ #f lv j (merge_hs #_ #f olds hs));\n \n remainder_2_1_div j;\n insert_rec #_ #f lv i j hs acc;\n\n // Recursion\n mt_hashes_lth_inv_equiv #_ #f (lv + 1) (j / 2)\n (merge_hs #_ #f olds hs) (merge_hs #_ #f olds ihs);\n mt_hashes_inv_equiv #_ #f (lv + 1) (j / 2)\n (merge_hs #_ #f olds hs) (merge_hs #_ #f olds ihs);\n let nacc = f (S.last (S.index hs lv)) acc in\n let rihs = insert_ #_ #f (lv + 1) (i / 2) (j / 2) ihs nacc in\n insert_inv_preserved #_ #f (lv + 1) (i / 2) (j / 2) olds ihs nacc;\n\n // Head proof of `mt_hashes_inv`\n mt_olds_hs_lth_inv_ok #_ #f lv i (j + 1) olds rihs;\n mt_hashes_next_rel_insert_odd #_ #f j\n (S.index (merge_hs #_ #f olds hs) lv) acc\n (S.index (merge_hs #_ #f olds hs) (lv + 1));\n assert (S.equal (S.index rihs lv) (S.index ihs lv));\n insert_head #_ #f (lv + 1) (i / 2) (j / 2) ihs nacc;\n assert (S.equal (S.index ihs (lv + 1)) (S.index hs (lv + 1)));\n assert (mt_hashes_next_rel #_ #f (j + 1)\n (S.index (merge_hs #_ #f olds rihs) lv)\n (S.index (merge_hs #_ #f olds rihs) (lv + 1)));\n\n // Tail proof of `mt_hashes_inv` by recursion\n assert (mt_olds_hs_inv #_ #f (lv + 1) (i / 2) ((j + 1) / 2) olds rihs);\n\n assert (mt_hashes_inv #_ #f lv (j + 1) (merge_hs #_ #f olds rihs));\n assert (mt_olds_hs_inv #_ #f lv i (j + 1) olds rihs);\n assert (mt_olds_hs_inv #_ #f lv i (j + 1) olds (insert_ #_ #f lv i j hs acc))\n end\n else begin\n insert_inv_preserved_even #_ #f lv i j olds hs acc;\n assert (mt_olds_hs_inv #_ #f lv i (j + 1) olds (insert_ #_ #f lv i j hs acc))\n end", "val hash_seq_spec_full_index_raw:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n hs:hashes #hsz {S.length hs > 0} ->\n acc:hash #hsz -> actd:bool -> i:nat{i < S.length hs} ->\n Lemma (S.index (hash_seq_spec_full #_ #f hs acc actd) i ==\n MTS.HRaw (S.index hs i))\nlet hash_seq_spec_full_index_raw #hsz #_ hs acc actd i =\n hash_seq_spec_index_raw #hsz hs i", "val mt_hashes_inv_empty:\n #hsz:pos -> #f:MTS.hash_fun_t #hsz ->\n lv:nat{lv < 32} ->\n Lemma (requires True)\n (ensures (mt_hashes_lth_inv_empty #hsz lv;\n mt_hashes_inv #hsz #f lv 0 (empty_hashes #hsz 32)))\n (decreases (32 - lv))\nlet rec mt_hashes_inv_empty #hsz #f lv =\n if lv = 31 then ()\n else (mt_hashes_lth_inv_empty #hsz (lv + 1);\n mt_hashes_inv_empty #_ #f (lv + 1))", "val hash_seq_spec_index_raw:\n #hsz:pos -> \n hs:hashes #hsz {S.length hs > 0} ->\n i:nat{i < S.length hs} ->\n Lemma (S.index (hash_seq_spec #hsz hs) i == MTS.HRaw #hsz (S.index hs i))\nlet hash_seq_spec_index_raw #hsz hs i =\n hash_seq_lift_index #hsz hs", "val hash_seq_lift_index:\n #hsz:pos -> \n hs:hashes #hsz ->\n Lemma (requires True)\n (ensures forall (i:nat{i < S.length hs}).\n S.index (hash_seq_lift #hsz hs) i == MTS.HRaw (S.index hs i))\n (decreases (S.length hs))\nlet rec hash_seq_lift_index #hsz hs =\n if S.length hs = 0 then ()\n else hash_seq_lift_index #hsz (S.tail hs)" ], "closest_src": [ { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_inv_ok_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get_path_ok_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_verify_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_acc_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_acc_consistent" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.mt_get_root_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_path_slice" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_verify_ok_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_path_pull" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_acc" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_path_unchanged" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_make_path_step" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_verify" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.mt_get_path_step_acc" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_verify_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_path_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.construct_rhs_base_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.construct_rhs_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_make_path_step" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.mt_get_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_verify_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.construct_rhs_acc_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.mt_get_path_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.lift_path_index" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_path_insert" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_root" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.lift_path_eq" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get_root_step" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_verify" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_olds_hs_lth_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_next_lv_get" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Insertion.fst", "name": "MerkleTree.New.High.Correct.Insertion.create_mt_inv_ok" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_base" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path_step" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.mt_verify" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.init_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.lift_path" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_next_lv_equiv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv_log_converted" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_next_rel_next_even" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get_root_pad_index_0" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.lift_path_index_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path_step_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_root_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv_log_converted" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.lift_path_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_spec" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_olds_hs_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv_equiv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_next_rel_lift_even" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Flushing.fst", "name": "MerkleTree.New.High.Correct.Flushing.mt_flush_to_inv_preserved" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv_equiv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Path.fst", "name": "MerkleTree.New.High.Correct.Path.path_spec" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_verify_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_next_rel_lift_odd" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.construct_rhs_acc_consistent" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_verify" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_path_length" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_lth_inv_log_converted_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_olds_inv_equiv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_verify_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv_log_converted_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.fsti", "name": "MerkleTree.mt_verify_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_get_root" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_flush_to" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.rpmt_get_root_raw" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_spec_full_next" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.fst", "name": "MerkleTree.New.High.mt_retract_to" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_get_root" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_rhs_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_spec_full_even_next" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Rhs.fst", "name": "MerkleTree.New.High.Correct.Rhs.rhs_equiv_inv_preserved" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_root_pre" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_next_lv_mt_left" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.path_preserved_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_next_lv_mt_right" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_next_rel" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Flushing.fst", "name": "MerkleTree.New.High.Correct.Flushing.mt_flush_to_olds_hs_equiv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Low.fst", "name": "MerkleTree.Low.mt_get_path_pre_nst" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv_log" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_spec_full_odd_next" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Flushing.fst", "name": "MerkleTree.New.High.Correct.Flushing.mt_flush_to_olds" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.mt_next_rel_next_lv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Insertion.fst", "name": "MerkleTree.New.High.Correct.Insertion.empty_olds_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Flushing.fst", "name": "MerkleTree.New.High.Correct.Flushing.mt_flush_to_inv_preserved_" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.Spec.fst", "name": "MerkleTree.Spec.rpmt_get_root_pad_hashes" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Insertion.fst", "name": "MerkleTree.New.High.Correct.Insertion.insert_inv_preserved" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_spec_full_index_raw" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.mt_hashes_inv_empty" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_spec_index_raw" }, { "project_name": "merkle-tree", "file_name": "MerkleTree.New.High.Correct.Base.fst", "name": "MerkleTree.New.High.Correct.Base.hash_seq_lift_index" } ], "selected_premises": [ "LowStar.Buffer.gcmalloc_of_list", "EverCrypt.Hash.state", "Lib.Buffer.as_seq", "LowStar.Buffer.trivial_preorder", "LowStar.BufferOps.op_Bang_Star", "LowStar.ConstBuffer.qbuf_pre", "Hacl.Hash.Definitions.prev_len_v", "MerkleTree.New.High.Correct.mto_inv", "EverCrypt.Hash.alg", "LowStar.Monotonic.Buffer.length", "Lib.IntTypes.size", "Lib.Buffer.modifies", "Lib.Buffer.lbuffer", "EverCrypt.Hash.free", "Hacl.Hash.Definitions.mk_impl", "Hacl.Hash.Definitions.as_seq", "Hacl.Hash.Definitions.m_spec", "LowStar.Monotonic.Buffer.srel", "Lib.Buffer.disjoint", "Lib.IntTypes.u8", "Lib.UpdateMulti.uint8", "MerkleTree.New.High.Correct.Insertion.create_mt_inv_ok", "Lib.Buffer.loc", "Lib.Buffer.gsub", "Lib.Buffer.lbuffer_t", "Hacl.Impl.Blake2.Core.blake2b_params_v", "MerkleTree.New.High.Correct.mt_insert_ok", "MerkleTree.Spec.hashes", "Lib.Sequence.createL", "MerkleTree.New.High.Correct.Rhs.construct_rhs_acc", "MerkleTree.Spec.raw_hashes_raws", "MerkleTree.Spec.raw_hashes", "MerkleTree.New.High.path_insert", "MerkleTree.New.High.Correct.Base.mt_root_inv", "Lib.Buffer.buffer_t", "Hacl.Impl.Blake2.Core.blake2s_params_v", "MerkleTree.New.High.Correct.Path.mt_get_path_acc_inv_ok", "Spec.Hash.Definitions.hash_length", "Hacl.Impl.Blake2.Core.blake2b_params_loc", "LowStar.ImmutableBuffer.immutable_preorder", "Spec.Hash.Definitions.is_shake", "MerkleTree.New.High.Correct.Path.mt_get_path_inv_ok_", "Lib.IntTypes.max_size_t", "Lib.Sequence.lseq", "MerkleTree.New.High.Correct.Insertion.empty_olds_inv", "Hacl.Hash.Definitions.impl_word", "Spec.Hash.Definitions.words_state", "Lib.IntTypes.uint_t", "Lib.IntTypes.range", "MerkleTree.New.High.Correct.Base.mt_olds_hs_inv", "Lib.IntTypes.int_t", "MerkleTree.New.High.Correct.Rhs.construct_rhs_base_inv_ok", "MerkleTree.New.High.offset_of", "MerkleTree.New.High.construct_rhs_unchanged", "Lib.IntTypes.u32", "FStar.Heap.trivial_preorder", "Lib.Sequence.to_seq", "MerkleTree.New.High.construct_rhs", "Lib.Buffer.eq_or_disjoint", "MerkleTree.New.High.Correct.Base.hash_seq_spec_full_next", "EverCrypt.Hash.footprint", "Lib.IntTypes.v", "MerkleTree.New.High.Correct.create_mt_ok", "MerkleTree.New.High.Correct.Rhs.construct_rhs_init_ignored", "Hacl.Impl.Blake2.Core.blake2b_params_inv", "Spec.AES.to_elem", "Hacl.Hash.Definitions.get_alg", "FStar.Integers.op_Less_Equals", "MerkleTree.New.High.mt_verify", "Spec.Hash.Definitions.fixed_len_alg", "FStar.Integers.op_Greater_Equals", "MerkleTree.New.High.Correct.Rhs.construct_rhs_acc_inv_ok", "MerkleTree.New.High.Correct.mto_base", "MerkleTree.Spec.pad_hashes", "MerkleTree.New.High.Correct.Insertion.create_empty_mt_inv_ok", "FStar.Integers.op_Less", "FStar.ST.op_Bang", "MerkleTree.New.High.Correct.Base.mt_hashes_inv_empty", "Lib.Sequence.seq", "Spec.Hash.Definitions.is_keccak", "LowStar.BufferOps.op_Star_Equals", "MerkleTree.New.High.Correct.Base.mt_hashes_inv_log", "Lib.Buffer.cbuffer", "MerkleTree.New.High.Correct.mt_flush_to_ok", "FStar.Integers.op_Greater", "MerkleTree.New.High.Correct.Base.mt_olds_hs_lth_inv_ok", "Lib.IntTypes.uint_v", "MerkleTree.Spec.extract", "Lib.IntVector.width", "Hacl.Impl.Blake2.Core.blake2s_params_loc", "Lib.IntTypes.u64", "Lib.Sequence.length", "MerkleTree.New.High.Correct.Path.mt_verify_ok", "FStar.Integers.op_Plus", "Spec.Hash.Definitions.rate", "Lib.Buffer.op_Bar_Plus_Bar", "Hacl.Hash.Definitions.get_spec", "Lib.Buffer.clbuffer", "MerkleTree.New.High.Correct.Rhs.construct_rhs_inv_ok", "FStar.UInt.size" ], "source_upto_this": "module MerkleTree.New.High.Correct\n\nopen FStar.Seq\n\nopen MerkleTree.New.High\nopen MerkleTree.New.High.Correct.Base\nopen MerkleTree.New.High.Correct.Insertion\nopen MerkleTree.New.High.Correct.Rhs\nopen MerkleTree.New.High.Correct.Flushing\nopen MerkleTree.New.High.Correct.Path\n\nmodule S = FStar.Seq\n\nmodule Insertion = MerkleTree.New.High.Correct.Insertion\nmodule Rhs = MerkleTree.New.High.Correct.Rhs\nmodule Flushing = MerkleTree.New.High.Correct.Flushing\nmodule Path = MerkleTree.New.High.Correct.Path\n\nmodule MTS = MerkleTree.Spec\n\n#set-options \"--z3rlimit 20 --max_fuel 0 --max_ifuel 0\"\n\n/// Correctness of the high-level Merkle tree design\n\n// We claim below statements as the correctness of the high-level Merkle tree design:\n// 1) There is an invariant (`mt_inv`), and `create_mt` satisfies it.\n// 2) The invariant is preserved for insertion and flushing.\n// 3) Assuming the invariant, we can construct the specification (`mt_spec`) for a given tree.\n// 4) Merkle paths generated by the design and the corresponding spec are equal.\n// 5) Merkle path verification by the design and the spec give the same result.\n\ntype old_hashes (#hsz:pos) (mt:merkle_tree #hsz) =\n olds:hashess #hsz {S.length olds = 32 /\\ mt_olds_inv #hsz 0 (MT?.i mt) olds}\n\nnoeq type mt_olds (#hsz:pos) =\n| MTO: mt:merkle_tree #hsz {mt_wf_elts mt} ->\n olds:old_hashes #hsz mt ->\n mt_olds #hsz\n\nval mto_inv: #hsz:pos -> mt_olds #hsz -> GTot Type0\nlet mto_inv #hsz mto =\n mt_inv (MTO?.mt mto) (MTO?.olds mto)\n\nval mto_base: #hsz:pos -> mto:mt_olds #hsz -> GTot (hs:hashes #hsz{S.length hs = MT?.j (MTO?.mt mto)})\nlet mto_base #hsz mto =\n mt_base (MTO?.mt mto) (MTO?.olds mto)\n\nval mto_spec:\n #hsz:pos ->\n mto:mt_olds #hsz {MT?.j (MTO?.mt mto) > 0} ->\n GTot (MTS.merkle_tree #hsz (log2c (MT?.j (MTO?.mt mto))))\nlet mto_spec #hsz mto =\n mt_spec (MTO?.mt mto) (MTO?.olds mto)\n\n// `create_mt` is correct.\n\nval create_mt_ok:\n hsz:pos -> f:MTS.hash_fun_t ->\n init:hash #hsz ->\n Lemma (empty_olds_inv #_ #f 0;\n mto_inv (MTO (mt_create hsz f init) (empty_hashes 32)))\nlet create_mt_ok hsz f init =\n Insertion.create_mt_inv_ok #_ #f init\n\n// `mt_insert` is correct.\n\nval mt_insert_ok:\n #hsz:pos ->\n mto:mt_olds #hsz -> v:hash #hsz ->\n Lemma (requires mto_inv mto /\\ mt_not_full (MTO?.mt mto))\n (ensures mto_inv (MTO (mt_insert (MTO?.mt mto) v) (MTO?.olds mto)))\nlet mt_insert_ok #hsz mto v =\n Insertion.mt_insert_inv_preserved (MTO?.mt mto) v (MTO?.olds mto)\n\n// `mt_flush_to` and `mt_flush` are correct.\n\nval mt_flush_to_ok:\n #hsz:pos ->\n mto:mt_olds #hsz ->\n idx:nat{idx >= MT?.i (MTO?.mt mto) /\\ idx < MT?.j (MTO?.mt mto)} ->\n Lemma (requires mto_inv mto)\n (ensures mto_inv (MTO (mt_flush_to (MTO?.mt mto) idx)\n (mt_flush_to_olds #hsz #(MT?.hash_fun (MTO?.mt mto)) 0 (MT?.i (MTO?.mt mto)) idx (MT?.j (MTO?.mt mto))\n (MTO?.olds mto) (MT?.hs (MTO?.mt mto)))))\nlet mt_flush_to_ok #_ mto idx =\n Flushing.mt_flush_to_inv_preserved (MTO?.mt mto) (MTO?.olds mto) idx\n\nval mt_flush_ok:\n #hsz:pos ->\n mto:mt_olds #hsz ->\n Lemma (requires mto_inv mto /\\ MT?.j (MTO?.mt mto) > MT?.i (MTO?.mt mto))\n (ensures mto_inv (MTO (mt_flush_to (MTO?.mt mto) (MT?.j (MTO?.mt mto) - 1))\n (mt_flush_to_olds #hsz #(MT?.hash_fun (MTO?.mt mto)) 0 (MT?.i (MTO?.mt mto))\n (MT?.j (MTO?.mt mto) - 1) (MT?.j (MTO?.mt mto))\n (MTO?.olds mto) (MT?.hs (MTO?.mt mto)))))\nlet mt_flush_ok #_ mto =\n Flushing.mt_flush_inv_preserved (MTO?.mt mto) (MTO?.olds mto)\n\n// `mt_get_root` is correct.\n\nval mt_get_root_ok:\n #hsz:pos ->\n mto:mt_olds #hsz -> drt:hash #hsz ->\n Lemma (requires mto_inv mto)\n (ensures (let nmt, rt = mt_get_root (MTO?.mt mto) drt in\n // Only `MT?.rhs` and `MT?.mroot` are changed.\n MT?.i (MTO?.mt mto) == MT?.i nmt /\\\n MT?.j (MTO?.mt mto) == MT?.j nmt /\\\n MT?.hs (MTO?.mt mto) == MT?.hs nmt /\\\n // A Merkle tree with new `MT?.rhs` and `MT?.mroot` is valid.\n mt_inv nmt (MTO?.olds mto) /\\\n // A returned root is indeed the Merkle root.\n rt == MT?.mroot nmt))\nlet mt_get_root_ok #_ mto drt =\n Rhs.mt_get_root_inv_ok (MTO?.mt mto) drt (MTO?.olds mto)\n\n// `mt_get_path` is correct.\n\nval mt_get_path_ok:\n #hsz:pos ->\n mto:mt_olds #hsz ->\n idx:nat{MT?.i (MTO?.mt mto) <= idx && idx < MT?.j (MTO?.mt mto)} ->\n drt:hash ->\n Lemma (requires mto_inv mto /\\ MT?.j (MTO?.mt mto) > 0)\n (ensures (let f = (MT?.hash_fun (MTO?.mt mto)) in\n let j, p, rt = mt_get_path (MTO?.mt mto) idx drt in\n j == MT?.j (MTO?.mt mto) /\\\n mt_root_inv #_ #f (mto_base mto) hash_init false rt /\\\n S.head p == S.index (mto_base mto) idx /\\\n (assert (S.length (S.tail p) == mt_path_length idx (MT?.j (MTO?.mt mto)) false);\n S.equal (path_spec idx (MT?.j (MTO?.mt mto)) false (S.tail p))\n (MTS.mt_get_path #_ #f #(log2c j) (mto_spec mto) idx))))", "sketch": [ "Step 1: We first assume that the invariant `mto_inv` holds for the given `mt_olds` object `mto`. We also assume that the number of elements in the Merkle tree is greater than 0. \n\nStep 2: We then call the `mt_get_path` function with the given `mto` object, index `idx`, and the designated root hash `drt`. We obtain the resulting values `j`, `p`, and `rt` from the function call.\n\nStep 3: We then verify that the resulting `j` is equal to the number of elements in the Merkle tree, `MT?.j (MTO?.mt mto)`. \n\nStep 4: We verify that the root hash `rt` obtained from the `mt_get_path` function call satisfies the `mt_root_inv` invariant with respect to the hash function, base hashes, and initial hash.\n\nStep 5: We check that the first element of the path `p` obtained from the `mt_get_path` function call is equal to the hash at index `idx` in the base hashes obtained from the `mto` object.\n\nStep 6: We assert that the length of the tail of the path `p` is equal to the expected path length for the given index and number of elements in the Merkle tree.\n\nStep 7: Finally, we compare the tail of the path `p` with the corresponding path obtained from the specification using the `MTS.mt_get_path` function, and ensure that they are equal.\n\n```fstar\n// Completion of the proof for mt_get_path_ok\nlet mt_get_path_ok #hsz mto idx drt =\n // Step 1: Assume the invariant and the number of elements in the Merkle tree is greater than 0\n assume (mto_inv mto /\\ MT?.j (MTO?.mt mto) > 0)\n \n // Step 2: Call mt_get_path and obtain j, p, and rt\n let j, p, rt = mt_get_path (MTO?.mt mto) idx drt\n \n // Step 3: Verify that j is equal to the number of elements in the Merkle tree\n assert (j == MT?.j (MTO?.mt mto))\n \n // Step 4: Verify the root hash rt satisfies the mt_root_inv invariant\n assert (mt_root_inv #_ (MT?.hash_fun (MTO?.mt mto)) (mto_base mto) hash_init false rt)\n \n // Step 5: Verify the first element of the path p\n assert (S.head p == S.index (mto_base mto) idx)\n \n // Step 6: Assert the length of the tail of the path p\n assert (S.length (S.tail p) == mt_path_length idx (MT?.j (MTO?.mt mto)) false)\n \n // Step 7: Compare the tail of the path p with the corresponding path from the specification\n assert (S.equal (path_spec idx (MT?.j (MTO?.mt mto)) false (S.tail p)) (MTS.mt_get_path #_ (MT?.hash_fun (MTO?.mt mto)) #(log2c j) (mto_spec mto) idx))\n```" ], "generated_solution": [] }, { "file_name": "FStar.ModifiesGen.fst", "name": "FStar.ModifiesGen.loc_includes", "opens_and_abbrevs": [ { "abbrev": "F", "full_module": "FStar.FunctionalExtensionality" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "abbrev": "HST", "full_module": "FStar.HyperStack.ST" }, { "abbrev": "HS", "full_module": "FStar.HyperStack" }, { "open": "FStar" }, { "open": "FStar" }, { "open": "FStar.Pervasives" }, { "open": "Prims" }, { "open": "FStar" } ], "vconfig": { "initial_fuel": 2, "max_fuel": 8, "initial_ifuel": 1, "max_ifuel": 2, "detail_errors": false, "detail_hint_replay": false, "no_smt": false, "quake_lo": 1, "quake_hi": 1, "quake_keep": false, "retry": false, "smtencoding_elim_box": false, "smtencoding_nl_arith_repr": "boxwrap", "smtencoding_l_arith_repr": "boxwrap", "smtencoding_valid_intro": true, "smtencoding_valid_elim": false, "tcnorm": true, "no_plugins": false, "no_tactics": false, "z3cliopt": [], "z3smtopt": [], "z3refresh": false, "z3rlimit": 5, "z3rlimit_factor": 1, "z3seed": 0, "z3version": "4.8.5", "trivial_pre_for_unannotated_effectful_fns": true, "reuse_hint_for": null }, "source_type": "val loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0", "source_definition": "let loc_includes #al #c s1 s2 =\n loc_includes' s1 s2", "source_range": { "start_line": 412, "start_col": 0, "end_line": 413, "end_col": 21 }, "interleaved": false, "definition": "fun s1 s2 -> FStar.ModifiesGen.loc_includes' s1 s2", "effect": "Prims.GTot", "effect_flags": [ "sometrivial" ], "mutual_with": [], "premises": [ "FStar.ModifiesGen.aloc_t", "FStar.ModifiesGen.cls", "FStar.ModifiesGen.loc", "FStar.ModifiesGen.loc_includes'" ], "proof_features": [], "is_simple_lemma": false, "is_div": false, "is_proof": false, "is_simply_typed": false, "is_type": true, "type": "s1: FStar.ModifiesGen.loc c -> s2: FStar.ModifiesGen.loc c -> Prims.GTot Type0", "prompt": "let loc_includes #al #c s1 s2 =\n ", "expected_response": "loc_includes' s1 s2", "source": { "project_name": "FStar", "file_name": "ulib/FStar.ModifiesGen.fst", "git_rev": "10183ea187da8e8c426b799df6c825e24c0767d3", "git_url": "https://github.com/FStarLang/FStar.git" }, "dependencies": { "source_file": "FStar.ModifiesGen.fst", "checked_file": "dataset/FStar.ModifiesGen.fst.checked", "interface_file": true, "dependencies": [ "dataset/prims.fst.checked", "dataset/FStar.Universe.fsti.checked", "dataset/FStar.Tactics.SMT.fst.checked", "dataset/FStar.Tactics.Effect.fsti.checked", "dataset/FStar.Stubs.Tactics.V2.Builtins.fsti.checked", "dataset/FStar.StrongExcludedMiddle.fst.checked", "dataset/FStar.Set.fsti.checked", "dataset/FStar.Preorder.fst.checked", "dataset/FStar.Pervasives.Native.fst.checked", "dataset/FStar.Pervasives.fsti.checked", "dataset/FStar.Map.fsti.checked", "dataset/FStar.HyperStack.ST.fsti.checked", "dataset/FStar.HyperStack.fst.checked", "dataset/FStar.Heap.fst.checked", "dataset/FStar.GSet.fsti.checked", "dataset/FStar.Ghost.fsti.checked", "dataset/FStar.FunctionalExtensionality.fsti.checked", "dataset/FStar.Classical.fsti.checked" ] }, "definitions_in_context": [ "", "", "", "", "aloc", "ALoc", "ALoc", "ALoc", "aloc_t", "region", "region", "addr", "addr", "loc", "loc", "cls", "Cls", "Cls", "Cls", "aloc_includes", "aloc_includes", "let aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))", "aloc_includes_refl", "aloc_includes_refl", "let i_restricted_g_t = F.restricted_g_t", "let addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )", "let non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })", "aloc_includes_trans", "aloc_includes_trans", "let live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )", "aloc_disjoint", "aloc_disjoint", "loc'", "Loc", "Loc", "Loc", "regions", "regions", "aloc_disjoint_sym", "aloc_disjoint_sym", "region_liveness_tags", "region_liveness_tags", "non_live_addrs", "non_live_addrs", "live_addrs", "live_addrs", "aloc_disjoint_includes", "aloc_disjoint_includes", "aux", "aux", "let loc = loc'", "let mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f", "aloc_preserved", "aloc_preserved", "let mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f", "aloc_preserved_refl", "aloc_preserved_refl", "let loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)", "aloc_preserved_trans", "aloc_preserved_trans", "let regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)", "let addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty", "same_mreference_aloc_preserved", "same_mreference_aloc_preserved", "let addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty", "let addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)", "val loc (#aloc: aloc_t u#x) (c: cls aloc) : Tot (Type u#x)", "val loc_none (#aloc: aloc_t) (#c: cls aloc): Tot (loc c)", "val loc_union\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot (loc c)", "let addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))", "val loc_union_idem\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union s s == s)", "let addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)", "val loc_union_comm\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: Lemma\n (loc_union s1 s2 == loc_union s2 s1)", "let addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()", "val loc_union_assoc\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s3: loc c)\n: Lemma\n (loc_union s1 (loc_union s2 s3) == loc_union (loc_union s1 s2) s3)", "val loc_union_loc_none_l\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union loc_none s == s)", "val loc_union_loc_none_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_union s loc_none == s)", "let loc_union #al #c s1 s2 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let regions = Set.union regions1 regions2 in\n let region_liveness_tags : Ghost.erased (Set.set HS.rid) = (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1)) (Ghost.reveal (Loc?.region_liveness_tags s2)))) in\n let gregions = Ghost.hide regions in\n let non_live_addrs =\n F.on_dom_g (addrs_dom gregions) #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\n in\n let live_addrs =\n F.on_dom_g (addrs_dom gregions) #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\n in\n let aux = Ghost.hide\n (Ghost.reveal (Loc?.aux s1) `GSet.union` Ghost.reveal (Loc?.aux s2))\n in\n Loc\n (Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux", "val loc_of_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b: aloc r n)\n: GTot (loc c)", "val loc_of_aloc_not_none\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b: aloc r n)\n: Lemma (loc_of_aloc #_ #c b == loc_none ==> False)", "val loc_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n (n: Set.set nat)\n: GTot (loc c)", "val loc_regions\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: Set.set HS.rid)\n: GTot (loc c)", "let fun_set_equal (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) :Tot Type0 =\n forall (x: t) . {:pattern (f1 x) \\/ (f2 x) } f1 x `GSet.equal` f2 x", "let loc_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses true (HS.frameOf b) (Set.singleton (HS.as_addr b))", "let fun_set_equal_elim (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) : Lemma\n (requires (fun_set_equal f1 f2))\n (ensures (f1 == f2))\n// [SMTPat (fun_set_equal f1 f2)]\n= assert (f1 `FunctionalExtensionality.feq_g` f2)", "let loc_freed_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses false (HS.frameOf b) (Set.singleton (HS.as_addr b))", "let loc_equal (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : GTot Type0 =\n let Loc regions1 region_liveness_tags1 _ _ aux1 = s1 in\n let Loc regions2 region_liveness_tags2 _ _ aux2 = s2 in\n Ghost.reveal regions1 `Set.equal` Ghost.reveal regions2 /\\\n Ghost.reveal region_liveness_tags1 `Set.equal` Ghost.reveal region_liveness_tags2 /\\\n fun_set_equal (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2) /\\\n fun_set_equal (Loc?.live_addrs s1) (Loc?.live_addrs s2) /\\\n Ghost.reveal (Loc?.aux s1) `GSet.equal` Ghost.reveal (Loc?.aux s2)", "let loc_region_only\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (Set.singleton r)", "let loc_equal_elim (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : Lemma\n (requires (loc_equal s1 s2))\n (ensures (s1 == s2))\n [SMTPat (s1 `loc_equal` s2)]\n= fun_set_equal_elim (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2);\n fun_set_equal_elim (Loc?.live_addrs s1) (Loc?.live_addrs s2)", "let loc_all_regions_from\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (HS.mod_set (Set.singleton r))", "let loc_union_idem #al #c s =\n assert (loc_union s s `loc_equal` s)", "let loc_union_comm #al #c s1 s2 =\n assert (loc_union s1 s2 `loc_equal` loc_union s2 s1)", "let loc_union_assoc #al #c s1 s2 s3 =\n assert (loc_union s1 (loc_union s2 s3) `loc_equal` loc_union (loc_union s1 s2) s3)", "val loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0", "let loc_union_loc_none_l #al #c s =\n assert (loc_union loc_none s `loc_equal` s)", "val loc_includes_refl\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_includes s s)", "let loc_union_loc_none_r #al #c s =\n assert (loc_union s loc_none `loc_equal` s)", "let loc_of_aloc #al #c #r #n b =\n let regions = (Ghost.hide (Set.singleton r)) in\n let region_liveness_tags = (Ghost.hide (Set.empty)) in\n Loc\n regions\n region_liveness_tags\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide (GSet.singleton (ALoc r n (Some b))))", "val loc_includes_trans\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s3: loc c)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))", "val loc_includes_union_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s s1 s2: loc c)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))", "let loc_of_aloc_not_none #al #c #r #n b = ()", "let loc_addresses #al #c preserve_liveness r n =\n let regions = (Ghost.hide (Set.singleton r)) in\n Loc\n regions\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> if preserve_liveness then GSet.empty else GSet.of_set n))\n (mk_live_addrs (fun _ -> GSet.of_set n))\n (Ghost.hide (aloc_domain c regions (fun _ -> GSet.of_set n)))", "val loc_includes_union_l\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2 s: loc c)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))", "let loc_regions_region_liveness_tags (preserve_liveness: bool) (r: Set.set HS.rid) : Tot (Ghost.erased (Set.set HS.rid)) =\n if preserve_liveness then Ghost.hide Set.empty else Ghost.hide r", "val loc_includes_none\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (loc_includes s loc_none)", "let loc_regions #al #c preserve_liveness r =\n let region_liveness_tags = loc_regions_region_liveness_tags preserve_liveness r in\n let addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { r' `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y } ) =\n GSet.complement GSet.empty\n in\n let live_addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { addrs r' `GSet.subset` y } ) =\n addrs r'\n in\n Loc\n (Ghost.hide r)\n region_liveness_tags\n (mk_non_live_addrs addrs)\n (mk_live_addrs live_addrs)\n (Ghost.hide (aloc_domain c (Ghost.hide r) addrs))", "val loc_includes_none_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (requires (loc_includes loc_none s))\n (ensures (s == loc_none))", "val loc_includes_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (#r: HS.rid)\n (#n: nat)\n (b1 b2: aloc r n)\n: Lemma\n (requires (c.aloc_includes b1 b2))\n (ensures (loc_includes (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))", "let aloc_includes (#al: aloc_t) (#c: cls al) (b0 b: aloc c) : GTot Type0 =\n b0.region == b.region /\\ b0.addr == b.addr /\\ Some? b0.loc == Some? b.loc /\\ (if Some? b0.loc && Some? b.loc then c.aloc_includes (Some?.v b0.loc) (Some?.v b.loc) else True)", "let loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b: aloc c)\n: GTot Type0\n (decreases s)\n= exists (b0 : aloc c) . b0 `GSet.mem` s /\\ b0 `aloc_includes` b", "val loc_includes_aloc_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1 #r2: HS.rid)\n (#n1 #n2: nat)\n (b1: aloc r1 n1)\n (b2: aloc r2 n2)\n: Lemma\n (requires (loc_includes (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))\n (ensures (r1 == r2 /\\ n1 == n2 /\\ c.aloc_includes b1 b2))", "let loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: GTot Type0\n (decreases s2)\n= forall (b2: aloc c) . GSet.mem b2 s2 ==> loc_aux_includes_buffer s1 b2", "val loc_includes_addresses_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n (s: Set.set nat)\n (#a: nat)\n (p: aloc r a)\n: Lemma\n (requires (Set.mem a s))\n (ensures (loc_includes (loc_addresses preserve_liveness r s) (loc_of_aloc #_ #c p)))", "let loc_aux_includes_union_l\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s \\/ loc_aux_includes s2 s))\n (ensures (loc_aux_includes (GSet.union s1 s2) s))\n (decreases s)\n= ()", "let loc_aux_includes_refl\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n: Lemma\n (loc_aux_includes s s)\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)", "val loc_includes_region_aloc\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (s: Set.set HS.rid)\n (#r: HS.rid)\n (#a: nat)\n (b: aloc r a)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions preserve_liveness s) (loc_of_aloc #_ #c b)))", "let loc_aux_includes_subset\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)", "val loc_includes_region_addresses\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (s: Set.set HS.rid)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (Set.mem r s))\n (ensures (loc_includes (loc_regions #_ #c preserve_liveness1 s) (loc_addresses preserve_liveness2 r a)))", "let loc_aux_includes_subset'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n [SMTPatOr [\n [SMTPat (s1 `GSet.subset` s2)];\n [SMTPat (loc_aux_includes s2 s1)];\n ]]\n= loc_aux_includes_subset s1 s2", "val loc_includes_region_region\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions #_ #c preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))", "let loc_aux_includes_union_l_r\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s s') s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s s' s", "val loc_includes_region_union_l\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (l: loc c)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))", "let loc_aux_includes_union_l_l\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s' s) s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s' s s", "val loc_includes_addresses_addresses\n (#aloc: aloc_t) (c: cls aloc)\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (a1 a2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset a2 a1))\n (ensures (loc_includes #_ #c (loc_addresses preserve_liveness1 r a1) (loc_addresses preserve_liveness2 r a2)))", "let loc_aux_includes_buffer_includes\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b1 b2: aloc c)\n: Lemma\n (requires (loc_aux_includes_buffer s b1 /\\ b1 `aloc_includes` b2))\n (ensures (loc_aux_includes_buffer s b2))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))", "val loc_disjoint\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0", "let loc_aux_includes_loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n (b: aloc c)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\n= Classical.forall_intro_3 (fun s b1 b2 -> Classical.move_requires (loc_aux_includes_buffer_includes #al #c s b1) b2)", "val loc_disjoint_sym\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s1 s2))\n (ensures (loc_disjoint s2 s1))", "let loc_aux_includes_trans\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))", "val loc_disjoint_none_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s: loc c)\n: Lemma\n (ensures (loc_disjoint s loc_none))", "let addrs_of_loc_weak_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc_weak (loc_union l1 l2) r == GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r))\n [SMTPat (addrs_of_loc_weak (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc_weak (loc_union l1 l2) r) (GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r)))", "val loc_disjoint_union_r\n (#aloc: aloc_t) (#c: cls aloc)\n (s s1 s2: loc c)\n: Lemma\n (requires (loc_disjoint s s1 /\\ loc_disjoint s s2))\n (ensures (loc_disjoint s (loc_union s1 s2)))", "val loc_disjoint_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (p1 p2 p1' p2' : loc c)\n: Lemma\n (requires (loc_includes p1 p1' /\\ loc_includes p2 p2' /\\ loc_disjoint p1 p2))\n (ensures (loc_disjoint p1' p2'))", "let addrs_of_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc (loc_union l1 l2) r == GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r))\n [SMTPat (addrs_of_loc (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc (loc_union l1 l2) r) (GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r)))", "val loc_disjoint_aloc_intro\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1: HS.rid)\n (#a1: nat)\n (#r2: HS.rid)\n (#a2: nat)\n (b1: aloc r1 a1)\n (b2: aloc r2 a2)\n: Lemma\n (requires ((r1 == r2 /\\ a1 == a2) ==> c.aloc_disjoint b1 b2))\n (ensures (loc_disjoint (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))", "let loc_includes' #al (#c: cls al) (s1 s2: loc c) =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in (\n Set.subset regions2 regions1 /\\\n Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) /\\\n (\n forall (r: HS.rid { Set.mem r regions2 } ) .\n GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r)\n ) /\\\n (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r)\n ) /\\ (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r)\n ) /\\ (\n (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2))\n )\n )", "val loc_disjoint_aloc_elim\n (#aloc: aloc_t) (#c: cls aloc)\n (#r1: HS.rid)\n (#a1: nat)\n (#r2: HS.rid)\n (#a2: nat)\n (b1: aloc r1 a1)\n (b2: aloc r2 a2)\n: Lemma\n (requires (loc_disjoint (loc_of_aloc b1) (loc_of_aloc #_ #c b2)))\n (ensures ((r1 == r2 /\\ a1 == a2) ==> c.aloc_disjoint b1 b2))" ], "closest": [ "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_includes\n (s1 s2: loc)\n: GTot Type0\nlet loc_includes = MG.loc_includes", "val loc_includes (s1 s2:loc) : GTot prop0\nlet loc_includes = M.loc_includes", "val loc_includes (s1 s2:loc) : GTot prop0\nlet loc_includes = M.loc_includes", "val loc_mreference\n (#aloc: aloc_t)\n (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n : GTot (loc c)\nlet loc_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses true (HS.frameOf b) (Set.singleton (HS.as_addr b))", "val loc_aux_includes (s1 s2: loc_aux) : GTot Type0 (decreases s2)\nlet loc_aux_includes\n (s1 s2: loc_aux)\n: GTot Type0\n (decreases s2)\n= match s2 with\n | LocBuffer b -> loc_aux_includes_buffer s1 b", "val loc_aux_includes (s s2: loc_aux) : GTot Type0 (decreases s2)\nlet loc_aux_includes\n (s: loc_aux)\n (s2: loc_aux)\n: GTot Type0\n (decreases s2)\n= match s2 with\n | LocPointer p ->\n loc_aux_includes_pointer s p\n | LocBuffer b ->\n loc_aux_includes_buffer s b", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l = MG.loc_includes_union_l", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\nlet loc_includes_union_r = MG.loc_includes_union_r", "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_union\n (s1 s2: loc)\n: GTot loc\nlet loc_union = MG.loc_union", "val loc_includes_trans\n (s1 s2 s3: loc)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))\nlet loc_includes_trans = MG.loc_includes_trans", "val loc_includes_trans\n (s1 s2 s3: loc)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))\nlet loc_includes_trans = MG.loc_includes_trans", "val loc_includes_trans\n (s1 s2 s3: loc)\n: Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))\nlet loc_includes_trans = MG.loc_includes_trans", "val loc_includes_union_l (s1 s2 s:loc) : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s", "val loc_includes_union_l (s1 s2 s:loc) : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\nlet loc_includes_union_l s1 s2 s = M.loc_includes_union_l s1 s2 s", "val loc_freed_mreference\n (#aloc: aloc_t)\n (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n : GTot (loc c)\nlet loc_freed_mreference\n (#aloc: aloc_t) (#c: cls aloc)\n (#a: Type)\n (#p: Preorder.preorder a)\n (b: HS.mreference a p)\n: GTot (loc c)\n= loc_addresses false (HS.frameOf b) (Set.singleton (HS.as_addr b))", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l = MG.loc_includes_union_l", "val loc_includes_union_l\n (s1 s2 s: loc)\n: Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l = MG.loc_includes_union_l", "val modifies_loc_includes\n (s1: loc)\n (h h': HS.mem)\n (s2: loc)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\n [SMTPatOr [\n [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')];\n [SMTPat (modifies s1 h h'); SMTPat (loc_includes s1 s2)];\n [SMTPat (modifies s2 h h'); SMTPat (loc_includes s1 s2)];\n ]]\nlet modifies_loc_includes = MG.modifies_loc_includes", "val loc_aux_includes_pointer (s: loc_aux) (#t: typ) (p: pointer t) : GTot Type0\nlet loc_aux_includes_pointer\n (s: loc_aux)\n (#t: typ)\n (p: pointer t)\n: GTot Type0\n= match s with\n | LocPointer p' -> \n p' `includes` p\n | LocBuffer b ->\n buffer_includes_pointer b p", "val loc_region_only (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_region_only\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (Set.singleton r)", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r = MG.loc_includes_union_r", "val loc_includes_union_r\n (s s1 s2: loc)\n: Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r = MG.loc_includes_union_r", "val loc_aux_includes_loc_aux_includes_pointer (s1 s2: loc_aux) (#t: typ) (p: pointer t)\n : Lemma (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_pointer s2 p))\n (ensures (loc_aux_includes_pointer s1 p))\nlet loc_aux_includes_loc_aux_includes_pointer\n (s1: loc_aux)\n (s2: loc_aux)\n (#t: typ)\n (p: pointer t)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_pointer s2 p))\n (ensures (loc_aux_includes_pointer s1 p))\n= match s2 with\n | LocPointer p' ->\n loc_aux_includes_pointer_trans s1 p' p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p))\n (ensures (loc_aux_includes_pointer s1 p))\n = loc_aux_includes_pointer_trans s1 (gpointer_of_buffer_cell b i) p\n in\n Classical.forall_intro (Classical.move_requires f)", "val includes\n (#a1 #a2: Type0)\n (#rrel1 #rel1: srel a1)\n (#rrel2 #rel2: srel a2)\n (b1: mbuffer a1 rrel1 rel1)\n (b2: mbuffer a2 rrel2 rel2)\n : GTot Type0\nlet includes (#a1 #a2:Type0) (#rrel1 #rel1:srel a1) (#rrel2 #rel2:srel a2)\n (b1:mbuffer a1 rrel1 rel1) (b2:mbuffer a2 rrel2 rel2) :GTot Type0 =\n loc_includes (loc_buffer b1) (loc_buffer b2) /\\\n (g_is_null b1 <==> g_is_null b2)", "val loc_includes_trans (s1 s2 s3:loc) : Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))\nlet loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3", "val loc_includes_trans (s1 s2 s3:loc) : Lemma\n (requires (loc_includes s1 s2 /\\ loc_includes s2 s3))\n (ensures (loc_includes s1 s3))\nlet loc_includes_trans s1 s2 s3 = M.loc_includes_trans s1 s2 s3", "val loc_includes_union_r' (s s1 s2: loc)\n : Lemma (loc_includes s (loc_union s1 s2) <==> (loc_includes s s1 /\\ loc_includes s s2))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r'\n (s s1 s2: loc)\n: Lemma\n (loc_includes s (loc_union s1 s2) <==> (loc_includes s s1 /\\ loc_includes s s2))\n [SMTPat (loc_includes s (loc_union s1 s2))]\n= Classical.move_requires (loc_includes_union_r s s1) s2;\n Classical.move_requires (loc_includes_union_l s1 s2) s1;\n Classical.move_requires (loc_includes_union_l s1 s2) s2;\n Classical.move_requires (loc_includes_trans s (loc_union s1 s2)) s1;\n Classical.move_requires (loc_includes_trans s (loc_union s1 s2)) s2", "val loc_aux_includes_pointer_trans (s: loc_aux) (#t1 #t2: typ) (p1: pointer t1) (p2: pointer t2)\n : Lemma (requires (loc_aux_includes_pointer s p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_includes_pointer s p2))\nlet loc_aux_includes_pointer_trans\n (s: loc_aux)\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (loc_aux_includes_pointer s p1 /\\ p1 `includes` p2))\n (ensures (loc_aux_includes_pointer s p2))\n= match s with\n | LocPointer p -> includes_trans p p1 p2\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p1))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ gpointer_of_buffer_cell b i `includes` p2))\n = includes_trans (gpointer_of_buffer_cell b i) p1 p2\n in\n Classical.forall_intro (Classical.move_requires f)", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val loc_disjoint\n (s1 s2: loc)\n: GTot Type0\nlet loc_disjoint = MG.loc_disjoint", "val modifies_loc_includes\n (s1: loc)\n (h h': HS.mem)\n (s2: loc)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\n [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]\nlet modifies_loc_includes = MG.modifies_loc_includes", "val modifies_loc_includes\n (s1: loc)\n (h h': HS.mem)\n (s2: loc)\n: Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\n [SMTPat (modifies s1 h h'); SMTPat (modifies s2 h h')]\nlet modifies_loc_includes = MG.modifies_loc_includes", "val loc_aux_includes_buffer (s: loc_aux) (#t: typ) (b: buffer t) : GTot Type0\nlet loc_aux_includes_buffer\n (s: loc_aux)\n (#t: typ)\n (b: buffer t)\n: GTot Type0\n= forall (i: UInt32.t) . UInt32.v i < UInt32.v (buffer_length b) ==> loc_aux_includes_pointer s (gpointer_of_buffer_cell b i)", "val loc_includes_union_r (s s1 s2:loc) : Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2", "val loc_includes_union_r (s s1 s2:loc) : Lemma\n (requires (loc_includes s s1 /\\ loc_includes s s2))\n (ensures (loc_includes s (loc_union s1 s2)))\n [SMTPat (loc_includes s (loc_union s1 s2))]\nlet loc_includes_union_r s s1 s2 = M.loc_includes_union_r s s1 s2", "val loc_all_regions_from (#aloc: aloc_t) (#c: cls aloc) (preserve_liveness: bool) (r: HS.rid)\n : GTot (loc c)\nlet loc_all_regions_from\n (#aloc: aloc_t) (#c: cls aloc)\n (preserve_liveness: bool)\n (r: HS.rid)\n: GTot (loc c)\n= loc_regions preserve_liveness (HS.mod_set (Set.singleton r))", "val loc_includes_union_assoc_l2r\n (s1 s2 s3 s: loc)\n: Lemma\n (requires (loc_includes (loc_union (loc_union s1 s2) s3) s))\n (ensures (loc_includes (loc_union s1 (loc_union s2 s3)) s))\n [SMTPat (loc_includes (loc_union s1 (loc_union s2 s3)) s)]\nlet loc_includes_union_assoc_l2r s1 s2 s3 s =\n loc_includes_trans (loc_union s1 (loc_union s2 s3)) (loc_union (loc_union s1 s2) s3) s", "val loc_includes_union_assoc_r2l\n (s1 s2 s3 s: loc)\n: Lemma\n (requires (loc_includes (loc_union s1 (loc_union s2 s3)) s))\n (ensures (loc_includes (loc_union (loc_union s1 s2) s3) s))\n [SMTPat (loc_includes (loc_union (loc_union s1 s2) s3) s)]\nlet loc_includes_union_assoc_r2l s1 s2 s3 s =\n loc_includes_trans (loc_union (loc_union s1 s2) s3) (loc_union s1 (loc_union s2 s3)) s", "val loc_union (s1 s2:loc) : GTot loc\nlet loc_union = M.loc_union", "val loc_union (s1 s2:loc) : GTot loc\nlet loc_union = M.loc_union", "val loc_includes_union_l' (s1 s2 s: loc)\n : Lemma (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\nlet loc_includes_union_l'\n (s1 s2 s: loc)\n : Lemma\n (requires (loc_includes s1 s \\/ loc_includes s2 s))\n (ensures (loc_includes (loc_union s1 s2) s))\n [SMTPat (loc_includes (loc_union s1 s2) s)]\n = loc_includes_union_l s1 s2 s", "val loc_includes_region_union_r\n (l: loc)\n (s1 s2: Set.set HH.rid)\n: Lemma\n (requires (loc_includes l (loc_regions (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union l (loc_regions s1)) (loc_regions s2)))\n [SMTPat (loc_includes (loc_union l (loc_regions s1)) (loc_regions s2))]\nlet loc_includes_region_union_r l s1 s2 =\n loc_includes_trans (loc_union l (loc_regions s1)) (loc_union (loc_regions s1) l) (loc_regions s2)", "val loc_aux_includes_trans (s1 s2 s3: loc_aux)\n : Lemma (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\nlet loc_aux_includes_trans\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= match s3 with\n | LocPointer p ->\n loc_aux_includes_loc_aux_includes_pointer s1 s2 p\n | LocBuffer b ->\n let f\n (i: UInt32.t)\n : Lemma\n (requires (UInt32.v i < UInt32.v (buffer_length b)))\n (ensures (UInt32.v i < UInt32.v (buffer_length b) /\\ loc_aux_includes_pointer s1 (gpointer_of_buffer_cell b i)))\n = loc_aux_includes_loc_aux_includes_pointer s1 s2 (gpointer_of_buffer_cell b i)\n in\n Classical.forall_intro (Classical.move_requires f)", "val loc_aux_includes_trans (s1 s2 s3: loc_aux)\n : Lemma (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\nlet loc_aux_includes_trans\n (s1 s2 s3: loc_aux)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= match s3 with\n | LocBuffer b -> loc_aux_includes_loc_aux_includes_buffer s1 s2 b", "val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\nlet modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2", "val modifies_loc_includes (s1:loc) (h h':vale_heap) (s2:loc) : Lemma\n (requires (modifies s2 h h' /\\ loc_includes s1 s2))\n (ensures (modifies s1 h h'))\nlet modifies_loc_includes s1 h h' s2 = M.modifies_loc_includes s1 (_ih h).hs (_ih h').hs s2", "val loc_includes_union_l_buffer\n (s1 s2: loc)\n (#a: Type0)\n (#rrel #rel: srel a)\n (b: mbuffer a rrel rel)\n : Lemma (requires (loc_includes s1 (loc_buffer b) \\/ loc_includes s2 (loc_buffer b)))\n (ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]\nlet loc_includes_union_l_buffer\n (s1 s2:loc)\n (#a:Type0) (#rrel #rel:srel a)\n (b:mbuffer a rrel rel)\n :Lemma (requires (loc_includes s1 (loc_buffer b) \\/ loc_includes s2 (loc_buffer b)))\n (ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]\n = loc_includes_union_l s1 s2 (loc_buffer b)", "val loc_includes_union_l_footprint_s (l1 l2: M.loc) (#a: alg) (s: state_s a)\n : Lemma (requires (M.loc_includes l1 (footprint_s s) \\/ M.loc_includes l2 (footprint_s s)))\n (ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))\n [SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]\nlet loc_includes_union_l_footprint_s\n (l1 l2: M.loc) (#a: alg) (s: state_s a)\n: Lemma\n (requires (\n M.loc_includes l1 (footprint_s s) \\/ M.loc_includes l2 (footprint_s s)\n ))\n (ensures (M.loc_includes (M.loc_union l1 l2) (footprint_s s)))\n [SMTPat (M.loc_includes (M.loc_union l1 l2) (footprint_s s))]\n= M.loc_includes_union_l l1 l2 (footprint_s s)", "val includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\nlet includes\n (#value1: typ)\n (#value2: typ)\n (p1: pointer value1)\n (p2: pointer value2)\n: GTot bool\n= Pointer?.from p1 = Pointer?.from p2 &&\n HS.aref_equal (Pointer?.contents p1) (Pointer?.contents p2) &&\n path_includes (Pointer?.p p1) (Pointer?.p p2)", "val loc_includes_region_union_assoc\n (l r: loc)\n (s1 s2: Set.set HH.rid)\n: Lemma\n (requires (loc_includes (loc_union l r)) (loc_regions (Set.intersect s2 (Set.complement s1))))\n (ensures (loc_includes (loc_union l (loc_union (loc_regions s1) r)) (loc_regions s2)))\n [SMTPat (loc_includes (loc_union l (loc_union (loc_regions s1) r)) (loc_regions s2))]\nlet loc_includes_region_union_assoc l r s1 s2 =\n loc_includes_trans (loc_union l (loc_union (loc_regions s1) r)) (loc_union (loc_regions s1) (loc_union l r)) (loc_regions s2)", "val loc_includes_pointer_pointer\n (#t1 #t2: typ)\n (p1: pointer t1)\n (p2: pointer t2)\n: Lemma\n (requires (includes p1 p2))\n (ensures (loc_includes (loc_pointer p1) (loc_pointer p2)))\n [SMTPat (loc_includes (loc_pointer p1) (loc_pointer p2))]\nlet loc_includes_pointer_pointer #t1 #t2 p1 p2 =\n MG.loc_includes_aloc #_ #cls #(frameOf p1) #(as_addr p1) (LocPointer p1) (LocPointer p2)", "val loc_includes_region_union_l\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2)))\n [SMTPat (loc_includes (loc_union (loc_regions s1) l) (loc_regions s2))]\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l false", "val loc_aux_includes_trans' (s1 s2 s3: loc_aux)\n : Lemma ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\nlet loc_aux_includes_trans'\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\n= Classical.move_requires (loc_aux_includes_trans s1 s2) s3", "val loc_aux_includes_trans' (s1 s2 s3: loc_aux)\n : Lemma ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\nlet loc_aux_includes_trans'\n (s1 s2: loc_aux)\n (s3: loc_aux)\n: Lemma\n ((loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3) ==> loc_aux_includes s1 s3)\n= Classical.move_requires (loc_aux_includes_trans s1 s2) s3", "val loc_includes_union_l_addresses (s1 s2: loc) (prf: bool) (r: HS.rid) (a: Set.set nat)\n : Lemma\n (requires (loc_includes s1 (loc_addresses prf r a) \\/ loc_includes s2 (loc_addresses prf r a))\n )\n (ensures (loc_includes (loc_union s1 s2) (loc_addresses prf r a)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_addresses prf r a))]\nlet loc_includes_union_l_addresses\n (s1 s2: loc)\n (prf: bool)\n (r: HS.rid)\n (a: Set.set nat)\n: Lemma\n (requires (loc_includes s1 (loc_addresses prf r a) \\/ loc_includes s2 (loc_addresses prf r a)))\n (ensures (loc_includes (loc_union s1 s2) (loc_addresses prf r a)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_addresses prf r a))]\n= loc_includes_union_l s1 s2 (loc_addresses prf r a)", "val loc_includes_union_l_footprint_s (l1 l2: B.loc) (#a: alg) (s: state_s a)\n : Lemma (requires (B.loc_includes l1 (footprint_s s) \\/ B.loc_includes l2 (footprint_s s)))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s s))]\nlet loc_includes_union_l_footprint_s\n (l1 l2: B.loc) (#a: alg) (s: state_s a)\n: Lemma\n (requires (\n B.loc_includes l1 (footprint_s s) \\/ B.loc_includes l2 (footprint_s s)\n ))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s s))]\n= B.loc_includes_union_l l1 l2 (footprint_s s)", "val loc_includes_union_l_fragment_fp0 (#t: Type) (s1 s2: loc) (f: fragment t)\n : Lemma (requires (loc_includes s1 (fragment_fp0 f) \\/ loc_includes s2 (fragment_fp0 f)))\n (ensures (loc_includes (loc_union s1 s2) (fragment_fp0 f)))\n [SMTPat (loc_includes (loc_union s1 s2) (fragment_fp0 f))]\nlet loc_includes_union_l_fragment_fp0 (#t: Type) (s1 s2:loc) (f:fragment t) :\n Lemma\n (requires (loc_includes s1 (fragment_fp0 f) \\/ loc_includes s2 (fragment_fp0 f)))\n (ensures (loc_includes (loc_union s1 s2) (fragment_fp0 f)))\n [SMTPat (loc_includes (loc_union s1 s2) (fragment_fp0 f))] =\n loc_includes_union_l s1 s2 (fragment_fp0 f)", "val loc_includes_region_union_l\n (preserve_liveness: bool)\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))\n [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l", "val loc_includes_region_union_l\n (preserve_liveness: bool)\n (l: loc)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (loc_includes l (loc_regions preserve_liveness (Set.intersect s2 (Set.complement s1)))))\n (ensures (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2)))\n [SMTPat (loc_includes (loc_union (loc_regions preserve_liveness s1) l) (loc_regions preserve_liveness s2))]\nlet loc_includes_region_union_l = MG.loc_includes_region_union_l", "val loc_aux_includes_buffer (#a: Type) (s: loc_aux) (b: B.buffer a) : GTot Type0\nlet loc_aux_includes_buffer\n (#a: Type)\n (s: loc_aux)\n (b: B.buffer a)\n: GTot Type0\n= match s with\n | LocBuffer #a0 b0 -> a == a0 /\\ b0 `B.includes` b", "val loc_includes_refl\n (s: loc)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]\nlet loc_includes_refl = MG.loc_includes_refl", "val loc_includes_refl\n (s: loc)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]\nlet loc_includes_refl = MG.loc_includes_refl", "val loc_includes_refl\n (s: loc)\n: Lemma\n (loc_includes s s)\n [SMTPat (loc_includes s s)]\nlet loc_includes_refl = MG.loc_includes_refl", "val loc_includes_region_region\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires (Set.subset s2 s1))\n (ensures (loc_includes (loc_regions s1) (loc_regions s2)))\n [SMTPat (loc_includes (loc_regions s1) (loc_regions s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls false false", "val loc_includes_as_seq (#a:Type0) (#rrel #rel1 #rel2:srel a)\n (h1 h2:HS.mem) (larger:mbuffer a rrel rel1) (smaller:mbuffer a rrel rel2)\n :Lemma (requires (loc_includes (loc_buffer larger) (loc_buffer smaller) /\\\n as_seq h1 larger == as_seq h2 larger /\\\n\t\t (live h1 larger \\/ live h1 smaller) /\\ (live h2 larger \\/ live h2 smaller)))\n (ensures (as_seq h1 smaller == as_seq h2 smaller))\nlet loc_includes_as_seq #_ #rrel #_ #_ h1 h2 larger smaller =\n if Null? smaller then () else\n if Null? larger then begin\n MG.loc_includes_none_elim (loc_buffer smaller);\n MG.loc_of_aloc_not_none #_ #cls #(frameOf smaller) #(as_addr smaller) (ubuffer_of_buffer smaller)\n end else begin\n MG.loc_includes_aloc_elim #_ #cls #(frameOf larger) #(frameOf smaller) #(as_addr larger) #(as_addr smaller) (ubuffer_of_buffer larger) (ubuffer_of_buffer smaller);\n let ul = Ghost.reveal (ubuffer_of_buffer larger) in\n let us = Ghost.reveal (ubuffer_of_buffer smaller) in\n assert (as_seq h1 smaller == Seq.slice (as_seq h1 larger) (us.b_offset - ul.b_offset) (us.b_offset - ul.b_offset + length smaller));\n assert (as_seq h2 smaller == Seq.slice (as_seq h2 larger) (us.b_offset - ul.b_offset) (us.b_offset - ul.b_offset + length smaller))\n end", "val loc_includes_addresses_addresses\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (s1 s2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))\nlet loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses cls", "val loc_includes_addresses_addresses\n (preserve_liveness1 preserve_liveness2: bool)\n (r: HS.rid)\n (s1 s2: Set.set nat)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_addresses preserve_liveness1 r s1) (loc_addresses preserve_liveness2 r s2)))\nlet loc_includes_addresses_addresses = MG.loc_includes_addresses_addresses #_ cls", "val loc_includes_none\n (s: loc)\n: Lemma\n (loc_includes s loc_none)\n [SMTPat (loc_includes s loc_none)]\nlet loc_includes_none = MG.loc_includes_none", "val loc_includes_none\n (s: loc)\n: Lemma\n (loc_includes s loc_none)\n [SMTPat (loc_includes s loc_none)]\nlet loc_includes_none = MG.loc_includes_none", "val loc_includes_none\n (s: loc)\n: Lemma\n (loc_includes s loc_none)\n [SMTPat (loc_includes s loc_none)]\nlet loc_includes_none = MG.loc_includes_none", "val loc_includes_region_pointer\n (#t: typ)\n (s: Set.set HS.rid)\n (p: pointer t)\n: Lemma\n (requires (Set.mem (frameOf p) s))\n (ensures (loc_includes (loc_regions s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_regions s) (loc_pointer p))]\nlet loc_includes_region_pointer #t s p =\n MG.loc_includes_region_aloc #_ #cls false s #(frameOf p) #(as_addr p) (LocPointer p)", "val loc_includes_union_l_piece_fp0 (#t: Type) (s1 s2: loc) (p: piece t)\n : Lemma (requires (loc_includes s1 (piece_fp0 p) \\/ loc_includes s2 (piece_fp0 p)))\n (ensures (loc_includes (loc_union s1 s2) (piece_fp0 p)))\n [SMTPat (loc_includes (loc_union s1 s2) (piece_fp0 p))]\nlet loc_includes_union_l_piece_fp0 (#t: Type) (s1 s2:loc) (p:piece t) :\n Lemma\n (requires (loc_includes s1 (piece_fp0 p) \\/ loc_includes s2 (piece_fp0 p)))\n (ensures (loc_includes (loc_union s1 s2) (piece_fp0 p)))\n [SMTPat (loc_includes (loc_union s1 s2) (piece_fp0 p))] =\n loc_includes_union_l s1 s2 (piece_fp0 p)", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val modifies\n (s: loc)\n (h1 h2: HS.mem)\n: GTot Type0\nlet modifies = MG.modifies", "val loc_aux_includes_loc_aux_includes_buffer (#a: Type) (s1 s2: loc_aux) (b: B.buffer a)\n : Lemma (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\nlet loc_aux_includes_loc_aux_includes_buffer\n (#a: Type)\n (s1 s2: loc_aux)\n (b: B.buffer a)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\n= match s2 with\n | LocBuffer b2 -> loc_aux_includes_buffer_includes s1 b2 b", "val loc_includes_union_l_regions (s1 s2: loc) (prf: bool) (r: Set.set HS.rid)\n : Lemma (requires (loc_includes s1 (loc_regions prf r) \\/ loc_includes s2 (loc_regions prf r)))\n (ensures (loc_includes (loc_union s1 s2) (loc_regions prf r)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_regions prf r))]\nlet loc_includes_union_l_regions\n (s1 s2: loc)\n (prf: bool)\n (r: Set.set HS.rid)\n: Lemma\n (requires (loc_includes s1 (loc_regions prf r) \\/ loc_includes s2 (loc_regions prf r)))\n (ensures (loc_includes (loc_union s1 s2) (loc_regions prf r)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_regions prf r))]\n= loc_includes_union_l s1 s2 (loc_regions prf r)", "val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma\n (requires (loc_includes s1 (loc_buffer b) \\/ loc_includes s2 (loc_buffer b)))\n (ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]\nlet loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)", "val loc_includes_union_l_buffer (#t:base_typ) (s1 s2:loc) (b:buffer t) : Lemma\n (requires (loc_includes s1 (loc_buffer b) \\/ loc_includes s2 (loc_buffer b)))\n (ensures (loc_includes (loc_union s1 s2) (loc_buffer b)))\n [SMTPat (loc_includes (loc_union s1 s2) (loc_buffer b))]\nlet loc_includes_union_l_buffer #t s1 s2 b = M.loc_includes_union_l s1 s2 (loc_buffer b)", "val loc_includes_union_l_footprint_s\n (#index: _)\n (c: block index)\n (i: index)\n (m: HS.mem)\n (l1 l2: B.loc)\n (s: state_s' c i)\n : Lemma\n (requires (B.loc_includes l1 (footprint_s c i m s) \\/ B.loc_includes l2 (footprint_s c i m s))\n )\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s c i m s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s c i m s))]\nlet loc_includes_union_l_footprint_s\n #index\n (c: block index)\n (i: index)\n (m: HS.mem)\n (l1 l2: B.loc) (s: state_s' c i)\n: Lemma\n (requires (\n B.loc_includes l1 (footprint_s c i m s) \\/ B.loc_includes l2 (footprint_s c i m s)\n ))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s c i m s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s c i m s))]\n= B.loc_includes_union_l l1 l2 (footprint_s c i m s)", "val loc_includes_union_l_nodelist_fp0 (#t: Type) (s1 s2: loc) (nl: nodelist t)\n : Lemma (requires (loc_includes s1 (nodelist_fp0 nl) \\/ loc_includes s2 (nodelist_fp0 nl)))\n (ensures (loc_includes (loc_union s1 s2) (nodelist_fp0 nl)))\n [SMTPat (loc_includes (loc_union s1 s2) (nodelist_fp0 nl))]\nlet loc_includes_union_l_nodelist_fp0 (#t: Type) (s1 s2:loc) (nl:nodelist t) :\n Lemma\n (requires (loc_includes s1 (nodelist_fp0 nl) \\/ loc_includes s2 (nodelist_fp0 nl)))\n (ensures (loc_includes (loc_union s1 s2) (nodelist_fp0 nl)))\n [SMTPat (loc_includes (loc_union s1 s2) (nodelist_fp0 nl))] =\n loc_includes_union_l s1 s2 (nodelist_fp0 nl)", "val loc_pointer\n (#t: typ)\n (p: pointer t)\n: GTot loc\nlet loc_pointer #t p =\n MG.loc_of_aloc #_ #cls #(frameOf p) #(as_addr p) (LocPointer p)", "val loc_includes_union_assoc_focalize_1\n (l1 l2 x r s: loc)\n: Lemma\n (requires (loc_includes (loc_union (loc_union l1 l2) (loc_union x r)) s))\n (ensures (loc_includes (loc_union l1 (loc_union (loc_union l2 x) r)) s))\n [SMTPat (loc_includes (loc_union l1 (loc_union (loc_union l2 x) r)) s)]\nlet loc_includes_union_assoc_focalize_1 l1 l2 x r s =\n loc_includes_trans (loc_union l1 (loc_union (loc_union l2 x) r)) (loc_union (loc_union l1 l2) (loc_union x r)) s", "val loc_includes_union_l_dll_fp0 (#t: Type) (s1 s2: loc) (d: dll t)\n : Lemma (requires (loc_includes s1 (dll_fp0 d) \\/ loc_includes s2 (dll_fp0 d)))\n (ensures (loc_includes (loc_union s1 s2) (dll_fp0 d)))\n [SMTPat (loc_includes (loc_union s1 s2) (dll_fp0 d))]\nlet loc_includes_union_l_dll_fp0 (#t: Type) (s1 s2:loc) (d:dll t) :\n Lemma\n (requires (loc_includes s1 (dll_fp0 d) \\/ loc_includes s2 (dll_fp0 d)))\n (ensures (loc_includes (loc_union s1 s2) (dll_fp0 d)))\n [SMTPat (loc_includes (loc_union s1 s2) (dll_fp0 d))] =\n loc_includes_union_l s1 s2 (dll_fp0 d)", "val loc_includes_addresses_pointer\n (#t: typ)\n (r: HS.rid)\n (s: Set.set nat)\n (p: pointer t)\n: Lemma\n (requires (frameOf p == r /\\ Set.mem (as_addr p) s))\n (ensures (loc_includes (loc_addresses r s) (loc_pointer p)))\n [SMTPat (loc_includes (loc_addresses r s) (loc_pointer p))]\nlet loc_includes_addresses_pointer #t r s p =\n MG.loc_includes_addresses_aloc #_ #cls false r s #(as_addr p) (LocPointer p)", "val buffer_includes\n (#t: typ)\n (blarge bsmall: buffer t)\n: GTot Type0\nlet buffer_includes #t blarge bsmall =\n let () = () in (\n root_buffer blarge == root_buffer bsmall /\\\n UInt32.v (buffer_idx blarge) <= UInt32.v (buffer_idx bsmall) /\\\n UInt32.v (buffer_idx bsmall) + UInt32.v (buffer_length bsmall) <= UInt32.v (buffer_idx blarge) + UInt32.v (buffer_length blarge)\n )", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls", "val loc_includes_region_region\n (preserve_liveness1: bool)\n (preserve_liveness2: bool)\n (s1 s2: Set.set HS.rid)\n: Lemma\n (requires ((preserve_liveness1 ==> preserve_liveness2) /\\ Set.subset s2 s1))\n (ensures (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2)))\n [SMTPat (loc_includes (loc_regions preserve_liveness1 s1) (loc_regions preserve_liveness2 s2))]\nlet loc_includes_region_region = MG.loc_includes_region_region #_ #cls", "val loc_includes_union_l_footprint_s (m: HS.mem) (l1 l2: B.loc) (#a: index) (s: state_s a)\n : Lemma (requires (B.loc_includes l1 (footprint_s m s) \\/ B.loc_includes l2 (footprint_s m s)))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s m s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s m s))]\nlet loc_includes_union_l_footprint_s\n (m: HS.mem)\n (l1 l2: B.loc) (#a: index) (s: state_s a)\n: Lemma\n (requires (\n B.loc_includes l1 (footprint_s m s) \\/ B.loc_includes l2 (footprint_s m s)\n ))\n (ensures (B.loc_includes (B.loc_union l1 l2) (footprint_s m s)))\n [SMTPat (B.loc_includes (B.loc_union l1 l2) (footprint_s m s))]\n= B.loc_includes_union_l l1 l2 (footprint_s m s)", "val loc_regions\n (r: Set.set HS.rid)\n: GTot loc\nlet loc_regions = MG.loc_regions false", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l =\n assert_norm (MG.cls abuffer == MG.cls ubuffer);\n coerce (MG.loc cloc_cls) l", "val cloc_of_loc (l: loc) : Tot (MG.loc cloc_cls)\nlet cloc_of_loc l = l", "val loc_includes_union_assoc_focalize_2\n (l x r1 r2 s: loc)\n: Lemma\n (requires (loc_includes (loc_union l (loc_union x (loc_union r1 r2))) s))\n (ensures (loc_includes (loc_union l (loc_union (loc_union x r1) r2)) s))\n [SMTPat (loc_includes (loc_union l (loc_union (loc_union x r1) r2)) s)]\nlet loc_includes_union_assoc_focalize_2 l x r1 r2 s =\n loc_includes_trans (loc_union l (loc_union (loc_union x r1) r2)) (loc_union l (loc_union x (loc_union r1 r2))) s", "val as_loc (x: eloc) : GTot B.loc\nlet as_loc (x:eloc) : GTot B.loc = Ghost.reveal x" ], "closest_src": [ { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_mreference" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_union" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_union" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_trans" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_trans" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_trans" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_union_l" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_freed_mreference" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies_loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_pointer" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_region_only" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_loc_aux_includes_pointer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.includes" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_trans" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_trans" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_r'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_pointer_trans" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_disjoint" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_disjoint" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies_loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies_loc_includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_buffer" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_union_r" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_union_r" }, { "project_name": "FStar", "file_name": "FStar.ModifiesGen.fsti", "name": "FStar.ModifiesGen.loc_all_regions_from" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_l2r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_r2l" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_union" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_union" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_region_union_r" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_trans" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes_trans" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.modifies_loc_includes" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.modifies_loc_includes" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l_buffer" }, { "project_name": "hacl-star", "file_name": "EverCrypt.Hash.fsti", "name": "EverCrypt.Hash.loc_includes_union_l_footprint_s" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.includes" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_region_union_assoc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_pointer_pointer" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_region_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes_trans'" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_aux_includes_trans'" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l_addresses" }, { "project_name": "hacl-star", "file_name": "EverCrypt.AEAD.fsti", "name": "EverCrypt.AEAD.loc_includes_union_l_footprint_s" }, { "project_name": "FStar", "file_name": "DoublyLinkedList.fst", "name": "DoublyLinkedList.loc_includes_union_l_fragment_fp0" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_union_l" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes_buffer" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_refl" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_refl" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_refl" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_region_region" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_as_seq" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_addresses_addresses" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_addresses_addresses" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_none" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_none" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_none" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_region_pointer" }, { "project_name": "FStar", "file_name": "DoublyLinkedList.fst", "name": "DoublyLinkedList.loc_includes_union_l_piece_fp0" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.modifies" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.modifies" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.modifies" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_aux_includes_loc_aux_includes_buffer" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fsti", "name": "LowStar.Monotonic.Buffer.loc_includes_union_l_regions" }, { "project_name": "hacl-star", "file_name": "Vale.X64.Memory.fst", "name": "Vale.X64.Memory.loc_includes_union_l_buffer" }, { "project_name": "hacl-star", "file_name": "Vale.PPC64LE.Memory.fst", "name": "Vale.PPC64LE.Memory.loc_includes_union_l_buffer" }, { "project_name": "hacl-star", "file_name": "Hacl.Streaming.Functor.fsti", "name": "Hacl.Streaming.Functor.loc_includes_union_l_footprint_s" }, { "project_name": "FStar", "file_name": "DoublyLinkedList.fst", "name": "DoublyLinkedList.loc_includes_union_l_nodelist_fp0" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_pointer" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_focalize_1" }, { "project_name": "FStar", "file_name": "DoublyLinkedList.fst", "name": "DoublyLinkedList.loc_includes_union_l_dll_fp0" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_includes_addresses_pointer" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.buffer_includes" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.loc_includes_region_region" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.loc_includes_region_region" }, { "project_name": "everquic-crypto", "file_name": "QUIC.State.fsti", "name": "QUIC.State.loc_includes_union_l_footprint_s" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.loc_regions" }, { "project_name": "FStar", "file_name": "FStar.Modifies.fst", "name": "FStar.Modifies.cloc_of_loc" }, { "project_name": "FStar", "file_name": "LowStar.Monotonic.Buffer.fst", "name": "LowStar.Monotonic.Buffer.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Base.fst", "name": "FStar.Pointer.Base.cloc_of_loc" }, { "project_name": "FStar", "file_name": "FStar.Pointer.Derived1.fst", "name": "FStar.Pointer.Derived1.loc_includes_union_assoc_focalize_2" }, { "project_name": "FStar", "file_name": "LowStar.Lens.fsti", "name": "LowStar.Lens.as_loc" } ], "selected_premises": [ "FStar.ModifiesGen.loc", "FStar.ModifiesGen.loc_none", "FStar.ModifiesGen.loc_equal", "FStar.ModifiesGen.aloc_includes", "FStar.ModifiesGen.loc_aux_includes_buffer", "FStar.ModifiesGen.addrs_of_loc_weak", "FStar.ModifiesGen.loc_union", "FStar.ModifiesGen.loc_aux_includes_buffer_includes", "FStar.ModifiesGen.addrs_of_loc_liveness_not_preserved", "FStar.ModifiesGen.addrs_of_loc_aux", "FStar.ModifiesGen.addrs_of_loc_aux_pred", "FStar.ModifiesGen.loc_of_aloc", "FStar.ModifiesGen.loc_aux_includes_loc_aux_includes_buffer", "FStar.ModifiesGen.loc_aux_includes", "FStar.ModifiesGen.loc_regions", "FStar.ModifiesGen.loc_aux_includes_trans", "FStar.FunctionalExtensionality.feq", "FStar.Pervasives.Native.fst", "FStar.Pervasives.Native.snd", "FStar.Heap.trivial_preorder", "FStar.ModifiesGen.aloc_domain", "FStar.ModifiesGen.addrs_of_loc", "FStar.Tactics.Effect.raise", "FStar.ModifiesGen.loc_aux_includes_refl", "FStar.ModifiesGen.regions_of_loc", "FStar.Monotonic.HyperStack.sel", "FStar.Reflection.Const.cons_qn", "FStar.Reflection.V2.Data.var", "FStar.ModifiesGen.loc_aux_includes_subset", "FStar.FunctionalExtensionality.on_dom", "FStar.ModifiesGen.loc_includes'", "FStar.Tactics.V2.Builtins.ret_t", "FStar.Tactics.SMT.get_initial_fuel", "FStar.Tactics.Types.issues", "FStar.Monotonic.HyperStack.live_region", "FStar.ModifiesGen.loc_union_assoc", "FStar.Tactics.SMT.get_max_fuel", "FStar.Reflection.Const.nil_qn", "FStar.ModifiesGen.mk_non_live_addrs", "FStar.Tactics.SMT.get_rlimit", "FStar.Monotonic.HyperStack.mreference", "FStar.ModifiesGen.i_restricted_g_t", "FStar.Reflection.V2.Data.ppname_t", "FStar.HyperStack.ST.is_eternal_region", "FStar.ModifiesGen.loc_union_comm", "FStar.ModifiesGen.mk_live_addrs", "FStar.Tactics.SMT.get_initial_ifuel", "FStar.Reflection.Const.squash_qn", "FStar.ModifiesGen.loc_union_idem", "FStar.ModifiesGen.loc_addresses", "FStar.ModifiesGen.addrs_dom", "FStar.ModifiesGen.loc_aux_includes_union_l_l", "FStar.ModifiesGen.loc_regions_region_liveness_tags", "FStar.Monotonic.HyperStack.as_addr", "FStar.Monotonic.HyperStack.is_heap_color", "FStar.ModifiesGen.loc_aux_includes_union_l_r", "FStar.Tactics.SMT.get_max_ifuel", "FStar.Monotonic.HyperStack.frameOf", "FStar.Sealed.Inhabited.seal", "FStar.ModifiesGen.loc_union_loc_none_l", "FStar.Reflection.Const.imp_qn", "FStar.Pervasives.dfst", "FStar.Reflection.Const.prop_qn", "FStar.ModifiesGen.loc_union_loc_none_r", "FStar.Tactics.SMT.smt_sync", "FStar.FunctionalExtensionality.on", "FStar.Monotonic.HyperStack.is_stack_region", "FStar.Reflection.V2.Data.as_ppname", "FStar.Sealed.Inhabited.sealed", "FStar.Pervasives.dsnd", "FStar.Tactics.Effect.get", "FStar.Reflection.Const.or_qn", "FStar.Tactics.SMT.smt_sync'", "FStar.Issue.mk_issue", "FStar.Tactics.SMT.set_initial_fuel", "FStar.Tactics.SMT.set_rlimit", "FStar.Reflection.Const.string_lid", "FStar.FunctionalExtensionality.op_Hat_Subtraction_Greater", "FStar.ModifiesGen.addrs_of_loc_weak_loc_union", "FStar.Reflection.Const.mktuple3_qn", "FStar.Tactics.SMT.set_max_fuel", "FStar.Monotonic.HyperStack.is_mm", "FStar.Tactics.SMT.set_fuel", "FStar.ModifiesGen.fun_set_equal", "FStar.Monotonic.HyperHeap.modifies_just", "FStar.Reflection.Const.mktuple8_qn", "FStar.ModifiesGen.addrs_of_loc_union", "FStar.Reflection.V2.Data.notAscription", "FStar.Monotonic.HyperStack.modifies_one", "FStar.Reflection.Const.mktuple6_qn", "FStar.Reflection.Const.eq1_qn", "FStar.Reflection.Const.mktuple7_qn", "FStar.Reflection.Const.mult_qn", "FStar.ModifiesGen.live_addrs_codom", "FStar.Monotonic.HyperStack.contains", "FStar.Reflection.Const.mktuple2_qn", "FStar.Monotonic.HyperStack.is_in", "FStar.Reflection.Const.and_qn", "FStar.Reflection.Const.eq2_qn", "FStar.Reflection.Const.mktuple5_qn" ], "source_upto_this": "(*\n Copyright 2008-2018 Microsoft Research\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n*)\nmodule FStar.ModifiesGen\n\n#set-options \"--split_queries no\"\n#set-options \"--using_facts_from '*,-FStar.Tactics,-FStar.Reflection,-FStar.List'\"\n\nmodule HS = FStar.HyperStack\nmodule HST = FStar.HyperStack.ST\n\nnoeq\ntype aloc (#al: aloc_t) (c: cls al) = | ALoc:\n (region: HS.rid) ->\n (addr: nat) ->\n (loc: option (al region addr)) ->\n aloc c\n\nlet aloc_domain (#al: aloc_t) (c: cls al) (regions: Ghost.erased (Set.set HS.rid)) (addrs: ((r: HS.rid { Set.mem r (Ghost.reveal regions) } ) -> GTot (GSet.set nat))) : GTot (GSet.set (aloc c)) =\n GSet.comprehend (fun a -> Set.mem a.region (Ghost.reveal regions) && GSet.mem a.addr (addrs a.region))\n\nmodule F = FStar.FunctionalExtensionality\n\n[@@(unifier_hint_injective)]\nlet i_restricted_g_t = F.restricted_g_t\n\nlet addrs_dom regions =\n (r: HS.rid { Set.mem r (Ghost.reveal regions) } )\n\nlet non_live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (r:addrs_dom regions) =\n (y: GSet.set nat { r `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y })\n\nlet live_addrs_codom\n (regions: Ghost.erased (Set.set HS.rid))\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } )\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags))\n (r:addrs_dom regions) = (y: GSet.set nat { GSet.subset (non_live_addrs r) y } )\n\nnoeq\ntype loc' (#al: aloc_t u#x) (c: cls al) : Type u#x =\n | Loc:\n (regions: Ghost.erased (Set.set HS.rid)) ->\n (region_liveness_tags: Ghost.erased (Set.set HS.rid) { Ghost.reveal region_liveness_tags `Set.subset` Ghost.reveal regions } ) ->\n (non_live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags)) ->\n (live_addrs:\n i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs)) ->\n (aux: Ghost.erased (GSet.set (aloc c)) {\n aloc_domain c regions live_addrs `GSet.subset` Ghost.reveal aux /\\\n Ghost.reveal aux `GSet.subset` (aloc_domain c regions (fun _ -> GSet.complement GSet.empty))\n } ) ->\n loc' c\n\nlet loc = loc'\n\nlet mk_non_live_addrs (#regions:_) (#region_liveness_tags:_)\n (f: (x:addrs_dom regions -> GTot (non_live_addrs_codom regions region_liveness_tags x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (non_live_addrs_codom regions region_liveness_tags) =\n F.on_dom_g _ f\n\nlet mk_live_addrs (#regions:_) (#region_liveness_tags:_)\n (#non_live_addrs_codom: _)\n (f: (x:addrs_dom regions -> GTot (live_addrs_codom regions region_liveness_tags non_live_addrs_codom x)))\n : i_restricted_g_t\n (addrs_dom regions)\n (live_addrs_codom regions region_liveness_tags non_live_addrs_codom) =\n F.on_dom_g _ f\n\nlet loc_none #a #c =\n Loc\n (Ghost.hide (Set.empty))\n (Ghost.hide (Set.empty))\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide GSet.empty)\n\nlet regions_of_loc\n (#al: aloc_t) (#c: cls al)\n (s: loc c)\n: GTot (Set.set HS.rid)\n= Ghost.reveal (Loc?.regions s)\n\nlet addrs_of_loc_liveness_not_preserved\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.non_live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_weak\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= if Set.mem r (regions_of_loc l)\n then Loc?.live_addrs l r\n else GSet.empty\n\nlet addrs_of_loc_aux_pred\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n (addr: nat)\n: GTot bool\n= StrongExcludedMiddle.strong_excluded_middle (exists a . GSet.mem a (Ghost.reveal (Loc?.aux l)) /\\ a.region == r /\\ a.addr == addr)\n\nlet addrs_of_loc_aux\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (y: GSet.set nat { GSet.subset (GSet.intersect y (addrs_of_loc_weak l r)) GSet.empty } )\n= GSet.comprehend (addrs_of_loc_aux_pred l r)\n `GSet.intersect` (GSet.complement (addrs_of_loc_weak l r))\n\nlet addrs_of_loc\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: GTot (GSet.set nat)\n= GSet.union\n (addrs_of_loc_weak l r)\n (addrs_of_loc_aux l r)\n\nlet addrs_of_loc_aux_prop\n (#al: aloc_t) (#c: cls al)\n (l: loc c)\n (r: HS.rid)\n: Lemma\n (GSet.subset (GSet.intersect (addrs_of_loc_aux l r) (addrs_of_loc_weak l r)) GSet.empty)\n [SMTPatOr [\n [SMTPat (addrs_of_loc_aux l r)];\n [SMTPat (addrs_of_loc_weak l r)];\n [SMTPat (addrs_of_loc l r)];\n ]]\n= ()\n\nlet loc_union #al #c s1 s2 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let regions = Set.union regions1 regions2 in\n let region_liveness_tags : Ghost.erased (Set.set HS.rid) = (Ghost.hide (Set.union (Ghost.reveal (Loc?.region_liveness_tags s1)) (Ghost.reveal (Loc?.region_liveness_tags s2)))) in\n let gregions = Ghost.hide regions in\n let non_live_addrs =\n F.on_dom_g (addrs_dom gregions) #(non_live_addrs_codom gregions region_liveness_tags)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then Loc?.non_live_addrs s1 r else GSet.empty)\n (if Set.mem r regions2 then Loc?.non_live_addrs s2 r else GSet.empty))\n in\n let live_addrs =\n F.on_dom_g (addrs_dom gregions) #(live_addrs_codom gregions region_liveness_tags non_live_addrs)\n (fun r ->\n GSet.union\n (if Set.mem r regions1 then addrs_of_loc_weak s1 r else GSet.empty)\n (if Set.mem r regions2 then addrs_of_loc_weak s2 r else GSet.empty))\n in\n let aux = Ghost.hide\n (Ghost.reveal (Loc?.aux s1) `GSet.union` Ghost.reveal (Loc?.aux s2))\n in\n Loc\n (Ghost.hide regions)\n region_liveness_tags\n non_live_addrs\n live_addrs\n aux\n\nlet fun_set_equal (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) :Tot Type0 =\n forall (x: t) . {:pattern (f1 x) \\/ (f2 x) } f1 x `GSet.equal` f2 x\n\nlet fun_set_equal_elim (#t: Type) (#t': Type)\n (#p:(t -> GSet.set t' -> Type))\n (f1 f2: i_restricted_g_t t (fun x -> g:GSet.set t'{p x g})) : Lemma\n (requires (fun_set_equal f1 f2))\n (ensures (f1 == f2))\n// [SMTPat (fun_set_equal f1 f2)]\n= assert (f1 `FunctionalExtensionality.feq_g` f2)\n\nlet loc_equal (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : GTot Type0 =\n let Loc regions1 region_liveness_tags1 _ _ aux1 = s1 in\n let Loc regions2 region_liveness_tags2 _ _ aux2 = s2 in\n Ghost.reveal regions1 `Set.equal` Ghost.reveal regions2 /\\\n Ghost.reveal region_liveness_tags1 `Set.equal` Ghost.reveal region_liveness_tags2 /\\\n fun_set_equal (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2) /\\\n fun_set_equal (Loc?.live_addrs s1) (Loc?.live_addrs s2) /\\\n Ghost.reveal (Loc?.aux s1) `GSet.equal` Ghost.reveal (Loc?.aux s2)\n\nlet loc_equal_elim (#al: aloc_t) (#c: cls al) (s1 s2: loc c) : Lemma\n (requires (loc_equal s1 s2))\n (ensures (s1 == s2))\n [SMTPat (s1 `loc_equal` s2)]\n= fun_set_equal_elim (Loc?.non_live_addrs s1) (Loc?.non_live_addrs s2);\n fun_set_equal_elim (Loc?.live_addrs s1) (Loc?.live_addrs s2)\n\n\nlet loc_union_idem #al #c s =\n assert (loc_union s s `loc_equal` s)\n\nlet loc_union_comm #al #c s1 s2 =\n assert (loc_union s1 s2 `loc_equal` loc_union s2 s1)\n\nlet loc_union_assoc #al #c s1 s2 s3 =\n assert (loc_union s1 (loc_union s2 s3) `loc_equal` loc_union (loc_union s1 s2) s3)\n\nlet loc_union_loc_none_l #al #c s =\n assert (loc_union loc_none s `loc_equal` s)\n\nlet loc_union_loc_none_r #al #c s =\n assert (loc_union s loc_none `loc_equal` s)\n\nlet loc_of_aloc #al #c #r #n b =\n let regions = (Ghost.hide (Set.singleton r)) in\n let region_liveness_tags = (Ghost.hide (Set.empty)) in\n Loc\n regions\n region_liveness_tags\n (mk_non_live_addrs (fun _ -> GSet.empty))\n (mk_live_addrs (fun _ -> GSet.empty))\n (Ghost.hide (GSet.singleton (ALoc r n (Some b))))\n\nlet loc_of_aloc_not_none #al #c #r #n b = ()\n\nlet loc_addresses #al #c preserve_liveness r n =\n let regions = (Ghost.hide (Set.singleton r)) in\n Loc\n regions\n (Ghost.hide Set.empty)\n (mk_non_live_addrs (fun _ -> if preserve_liveness then GSet.empty else GSet.of_set n))\n (mk_live_addrs (fun _ -> GSet.of_set n))\n (Ghost.hide (aloc_domain c regions (fun _ -> GSet.of_set n)))\n\nlet loc_regions_region_liveness_tags (preserve_liveness: bool) (r: Set.set HS.rid) : Tot (Ghost.erased (Set.set HS.rid)) =\n if preserve_liveness then Ghost.hide Set.empty else Ghost.hide r\n\nlet loc_regions #al #c preserve_liveness r =\n let region_liveness_tags = loc_regions_region_liveness_tags preserve_liveness r in\n let addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { r' `Set.mem` (Ghost.reveal region_liveness_tags) ==> GSet.subset (GSet.complement GSet.empty) y } ) =\n GSet.complement GSet.empty\n in\n let live_addrs (r' : HS.rid { Set.mem r' r } ) : GTot (y: GSet.set nat { addrs r' `GSet.subset` y } ) =\n addrs r'\n in\n Loc\n (Ghost.hide r)\n region_liveness_tags\n (mk_non_live_addrs addrs)\n (mk_live_addrs live_addrs)\n (Ghost.hide (aloc_domain c (Ghost.hide r) addrs))\n\nlet aloc_includes (#al: aloc_t) (#c: cls al) (b0 b: aloc c) : GTot Type0 =\n b0.region == b.region /\\ b0.addr == b.addr /\\ Some? b0.loc == Some? b.loc /\\ (if Some? b0.loc && Some? b.loc then c.aloc_includes (Some?.v b0.loc) (Some?.v b.loc) else True)\n\nlet loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b: aloc c)\n: GTot Type0\n (decreases s)\n= exists (b0 : aloc c) . b0 `GSet.mem` s /\\ b0 `aloc_includes` b\n\nlet loc_aux_includes\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: GTot Type0\n (decreases s2)\n= forall (b2: aloc c) . GSet.mem b2 s2 ==> loc_aux_includes_buffer s1 b2\n\nlet loc_aux_includes_union_l\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s \\/ loc_aux_includes s2 s))\n (ensures (loc_aux_includes (GSet.union s1 s2) s))\n (decreases s)\n= ()\n\nlet loc_aux_includes_refl\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n: Lemma\n (loc_aux_includes s s)\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)\n\nlet loc_aux_includes_subset\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n= Classical.forall_intro_3 (fun r a b -> c.aloc_includes_refl #r #a b)\n\nlet loc_aux_includes_subset'\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n: Lemma\n (requires (s1 `GSet.subset` s2))\n (ensures (loc_aux_includes s2 s1))\n [SMTPatOr [\n [SMTPat (s1 `GSet.subset` s2)];\n [SMTPat (loc_aux_includes s2 s1)];\n ]]\n= loc_aux_includes_subset s1 s2\n\nlet loc_aux_includes_union_l_r\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s s') s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s s' s\n\nlet loc_aux_includes_union_l_l\n (#al: aloc_t) (#c: cls al)\n (s s': GSet.set (aloc c))\n: Lemma\n (loc_aux_includes (GSet.union s' s) s)\n= loc_aux_includes_refl s;\n loc_aux_includes_union_l s' s s\n\nlet loc_aux_includes_buffer_includes\n (#al: aloc_t) (#c: cls al)\n (s: GSet.set (aloc c))\n (b1 b2: aloc c)\n: Lemma\n (requires (loc_aux_includes_buffer s b1 /\\ b1 `aloc_includes` b2))\n (ensures (loc_aux_includes_buffer s b2))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))\n\nlet loc_aux_includes_loc_aux_includes_buffer\n (#al: aloc_t) (#c: cls al)\n (s1 s2: GSet.set (aloc c))\n (b: aloc c)\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes_buffer s2 b))\n (ensures (loc_aux_includes_buffer s1 b))\n= Classical.forall_intro_3 (fun s b1 b2 -> Classical.move_requires (loc_aux_includes_buffer_includes #al #c s b1) b2)\n\nlet loc_aux_includes_trans\n (#al: aloc_t) (#c: cls al)\n (s1 s2 s3: GSet.set (aloc c))\n: Lemma\n (requires (loc_aux_includes s1 s2 /\\ loc_aux_includes s2 s3))\n (ensures (loc_aux_includes s1 s3))\n= Classical.forall_intro_3 (fun r a b1 -> Classical.forall_intro_2 (fun b2 b3 -> Classical.move_requires (c.aloc_includes_trans #r #a b1 b2) b3))\n\nlet addrs_of_loc_weak_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc_weak (loc_union l1 l2) r == GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r))\n [SMTPat (addrs_of_loc_weak (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc_weak (loc_union l1 l2) r) (GSet.union (addrs_of_loc_weak l1 r) (addrs_of_loc_weak l2 r)))\n\nlet addrs_of_loc_union\n (#al: aloc_t) (#c: cls al)\n (l1 l2: loc c)\n (r: HS.rid)\n: Lemma\n (addrs_of_loc (loc_union l1 l2) r == GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r))\n [SMTPat (addrs_of_loc (loc_union l1 l2) r)]\n= assert (GSet.equal (addrs_of_loc (loc_union l1 l2) r) (GSet.union (addrs_of_loc l1 r) (addrs_of_loc l2 r)))\n\nunfold\nlet loc_includes' #al (#c: cls al) (s1 s2: loc c) =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in (\n Set.subset regions2 regions1 /\\\n Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) /\\\n (\n forall (r: HS.rid { Set.mem r regions2 } ) .\n GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r)\n ) /\\\n (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r)\n ) /\\ (\n forall (r: HS.rid) .\n GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r)\n ) /\\ (\n (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2))\n )\n )\n", "sketch": [ "The `loc_includes` function first reveals the regions and region liveness tags of the two locations. Then it checks if the regions of the second location are a subset of the regions of the first location. It also verifies that the region liveness tags of the second location are a subset of the region liveness tags of the first location. Next, it ensures that for each region in the second location, the non-live addresses are a subset of the non-live addresses in the first location. Similarly, it checks that the weakly live addresses and live addresses of the second location are subsets of the weakly live addresses and live addresses of the first location, respectively. Finally, it verifies that the auxiliary information of the first location includes the auxiliary information of the second location.", "The `loc_includes` function is implemented by comparing the regions, region liveness tags, non-live addresses, live addresses, and auxiliary information of the two locations. It uses set operations and comparisons to check if one location includes the other.", "The `loc_includes` function checks if `s2` is included in `s1` by comparing their regions, liveness tags, non-live addresses, live addresses, and auxiliary information. It ensures that the regions of `s2` are a subset of the regions of `s1`, the liveness tags of `s2` are a subset of the liveness tags of `s1`, the non-live addresses of `s2` are a subset of the non-live addresses of `s1` for each region, the weakly reachable addresses of `s2` are a subset of the weakly reachable addresses of `s1` for each region, and the auxiliary information of `s1` includes the auxiliary information of `s2`.", "The `loc_includes` function first retrieves the regions and region liveness tags of the two locations. Then, it checks if the regions and region liveness tags of the second location are subsets of the first location. After that, it verifies that for each region, the non-live addresses and weakly live addresses of the second location are subsets of the first location. Finally, it checks if the auxiliary set of the second location is a subset of the first location's auxiliary set.", "To implement `loc_includes`, we will compare the regions, region liveness tags, non-live addresses, live addresses, and auxiliary information of the two locations to check for subset relationships.", "The `loc_includes` function first reveals the regions and region liveness tags of the two locations. It then checks if the regions of the second location are a subset of the regions of the first location. It also verifies that the region liveness tags of the second location are a subset of the region liveness tags of the first location. Additionally, it ensures that the non-live addresses, live addresses, and auxiliary information of the second location are subsets of the corresponding information in the first location.\n\n```fstar\nlet loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0 =\n {Your F* code here. You should only generate the completion of the definition. Do not include the definition.}\n```" ], "generated_solution": [ "let loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n let subset_regions = Set.subset regions2 regions1 in\n let subset_region_liveness_tags = Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) in\n let non_live_addrs_subset = forall (r: HS.rid { Set.mem r regions2 } ) . GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r) in\n let addrs_of_loc_weak_subset = forall (r: HS.rid) . GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r) in\n let addrs_of_loc_subset = forall (r: HS.rid) . GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r) in\n let aux_includes = (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2)) in\n subset_regions /\\ subset_region_liveness_tags /\\ non_live_addrs_subset /\\ addrs_of_loc_weak_subset /\\ addrs_of_loc_subset /\\ aux_includes", "let loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0 =\n loc_includes' s1 s2", "let loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0 =\n loc_includes' s1 s2", "let loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0\n= loc_includes' s1 s2", "let loc_includes\n (#aloc: aloc_t) (#c: cls aloc)\n (s1 s2: loc c)\n: GTot Type0 =\n let regions1 = Ghost.reveal (Loc?.regions s1) in\n let regions2 = Ghost.reveal (Loc?.regions s2) in\n Set.subset regions2 regions1 /\\\n Set.subset (Ghost.reveal (Loc?.region_liveness_tags s2)) (Ghost.reveal (Loc?.region_liveness_tags s1)) /\\\n (forall (r: HS.rid { Set.mem r regions2 } ) . GSet.subset (Loc?.non_live_addrs s2 r) (Loc?.non_live_addrs s1 r)) /\\\n (forall (r: HS.rid) . GSet.subset (addrs_of_loc_weak s2 r) (addrs_of_loc_weak s1 r)) /\\\n (forall (r: HS.rid) . GSet.subset (addrs_of_loc s2 r) (addrs_of_loc s1 r)) /\\\n (Ghost.reveal (Loc?.aux s1)) `loc_aux_includes` (Ghost.reveal (Loc?.aux s2))" ] } ]